エクセルでこんな感じにしたいとき向け
| name | UID | GID | comment | home | shel |
|---|---|---|---|---|---|
| root | 0 | 0 | root | /root | /bin/bash |
| hoge | 0 | 0 | hoge | /hoge | /bin/bash |
# cd /tmp
# mkdir userlist
# cd userlist
# touch userlist.sh
# chmod 755 userlist.sh
# vi userlist.sh
cut -d : -f1 /etc/passwd > name.txt
cut -d : -f3 /etc/passwd > uid.txt
cut -d : -f4 /etc/passwd > gid.txt
cut -d : -f5 /etc/passwd > comment.txt
cut -d : -f6 /etc/passwd > home.txt
cut -d : -f7 /etc/passwd > shel.txt
# ./userlist.sh
必要に応じて
# tar cvf userlist.tar .
でホストOSに移動するなりなんなりして
各.txtをファイルを開いてコピーしてエクセルに貼り付け
ちなみにグループ一覧は
cut -d : -f1 /etc/group > name.txt
cut -d : -f3 /etc/group > gid.txt
cut -d : -f4 /etc/group > users.txt
こんな感じで
以上
# ./userlist.sh
必要に応じて
# tar cvf userlist.tar .
でホストOSに移動するなりなんなりして
各.txtをファイルを開いてコピーしてエクセルに貼り付け
ちなみにグループ一覧は
cut -d : -f1 /etc/group > name.txt
cut -d : -f3 /etc/group > gid.txt
cut -d : -f4 /etc/group > users.txt
こんな感じで
【一括実行】以下コピペ後vi起動したらuserlist.shの内容コピペして:wqするとtar化までやってくれる
cd /tmp ; mkdir userlist ; cd userlist ; touch userlist.sh ; chmod 755 userlist.sh ; vi userlist.sh ; ./userlist.sh ; tar cvf userlist.tar .
cd /tmp ; mkdir userlist ; cd userlist ; touch userlist.sh ; chmod 755 userlist.sh ; vi userlist.sh ; ./userlist.sh ; tar cvf userlist.tar .
以上