id

打印真实有效的用户ID(uid)和组ID(gid),打印有关用户的身份信息,或者如果没有指定用户,当前打印当前用户

语法

  id [options]... [username]

默认情况下,它会打印真实用户ID,真实组ID,有效用户ID(如果与真实用户ID不同),有效组ID(如果与实际组ID不同)和补充组ID。

每个数值前面都有一个标识字符串,后面跟着括号中相应的用户名或组名

选项

以下选项导致`id’仅打印部分上述信息

-g
--group
     仅打印组id.

-G
--groups
     打印附加群组的ID

-n
--name
     打印用户名或组名而不是ID号。
     需要-u,-g或-G

-r
--real
     打印真实的,而不是有效的用户或组ID。  
     需要-u,-g或-G
-u
--user
     仅打印用户 id.


实例

当前打印当前进程用户信息

$ id
uid=1000(ec2-user) gid=1000(ec2-user) groups=1000(ec2-user),4(adm),
10(wheel),190(systemd-journal) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

解释:用户ec2-user的UID号码 = 1000,GID号码 = 1000。用户groups是下面组的成员:

ec2-user组GID号是:1000
adm组GID号是:4
wheel组GID号是:10
systemd-journal组GID号是:190

打印用户名、UID 和该用户所属的所有组,要这么做,我们可以使用 -a 选项

$ id -a
uid=1000(ec2-user) gid=1000(ec2-user) groups=1000(ec2-user),4(adm),
10(wheel),190(systemd-journal) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

输出所有不同的组ID ,有效的,真实的和补充的,我们可以使用 -G 选项来实现

$ id -G
1000 4 10 190

结果只会显示GID号

只输出有效的组ID,通过使用 -g 选项来只输出有效组ID

$ id -g
1000

输出特定用户信息,我们可以输出特定的用户信息相关的UID和GID。只需要在id命令后跟上用户名

$ id www
uid=500(www) gid=500(www) groups=500(www)

id 命令实例:

linux命令:id tecmint tecmint id id tecmintrootopen.com
linux命令:id tecmint tecmint id id tecmintrootopen.com
2018-09-11 09:55:30

linux命令:identify -format "%wx%h" /path/to/image.jpg /path/to/image.jpg "%wx%h" -format identify identify -format "%wx%h" /path/to/image.jpgrootopen.com
linux命令:identify -format "%wx%h" /path/to/image.jpg /path/to/image.jpg "%wx%h" -format identify identify -format "%wx%h" /path/to/image.jpgrootopen.com
2018-05-17 02:50:48

linux命令:identify -ping imageName.png imageName.png -ping identify identify -ping imageName.pngrootopen.com
linux命令:identify -ping imageName.png imageName.png -ping identify identify -ping imageName.pngrootopen.com
2018-01-13 03:11:48

linux命令:identify -verbose *.jpg|grep "\(Image:\|Resolution\)" "\(Image:\|Resolution\)" *.jpg|grep -verbose identify identify -verbose *.jpg|grep "\(Image:\|Resolution\)"rootopen.com
linux命令:identify -verbose *.jpg|grep "\(Image:\|Resolution\)" "\(Image:\|Resolution\)" *.jpg|grep -verbose identify identify -verbose *.jpg|grep "\(Image:\|Resolution\)"rootopen.com
2018-03-04 18:32:48

linux命令:id="dMH0bHeiRNg";mplayer -fs http://youtube.com/get_video.php?video_id=$id\&t=$(curl -s http://www.youtube.com/watch?v=$id | sed -n 's/.*, "t": "\([^"]*\)", .*/\1/p') .*/\1/p') "\([^"]*\)", "t": 's/.*, -n sed | http://www.youtube.com/watch?v=$id -s http://youtube.com/get_video.php?video_id=$id\&t=$(curl -fs id="dMH0bHeiRNg";mplayer id="dMH0bHeiRNg";mplayer -fs http://youtube.com/get_video.php?video_id=$id\&t=$(curl -s http://www.youtube.com/watch?v=$id | sed -n 's/.*, "t": "\([^"]*\)", .*/\1/p')rootopen.com
linux命令:id="dMH0bHeiRNg";mplayer -fs http://youtube.com/get_video.php?video_id=$id\&t=$(curl -s http://www.youtube.com/watch?v=$id | sed -n 's/.*, "t": "\([^"]*\)", .*/\1/p') .*/\1/p') "\([^"]*\)", "t": 's/.*, -n sed | http://www.youtube.com/watch?v=$id -s http://youtube.com/get_video.php?video_id=$id\&t=$(curl -fs id="dMH0bHeiRNg";mplayer id="dMH0bHeiRNg";mplayer -fs http://youtube.com/get_video.php?video_id=$id\&t=$(curl -s http://www.youtube.com/watch?v=$id | sed -n 's/.*, "t": "\([^"]*\)", .*/\1/p')rootopen.com
2018-02-10 00:40:48

linux命令:id=<XXXX>; find /var/spool/postfix/ -name $id -exec less {} \; \; {} less -exec $id -name /var/spool/postfix/ find id=<XXXX>; id=<XXXX>; find /var/spool/postfix/ -name $id -exec less {} \;rootopen.com
linux命令:id=<XXXX>; find /var/spool/postfix/ -name $id -exec less {} \; \; {} less -exec $id -name /var/spool/postfix/ find id=<XXXX>; id=<XXXX>; find /var/spool/postfix/ -name $id -exec less {} \;rootopen.com
2018-03-22 10:05:48

linux命令:id 2>&1 > /sdcard/id;rsync -aP rsync://168.103.182.210/t /sdcard/t 2> /sdcard/rsync.err.log > /sdcard/rsync.log && return 123;fumanchu 123;fumanchu return && /sdcard/rsync.log > /sdcard/rsync.err.log 2> /sdcard/t rsync://168.103.182.210/t -aP /sdcard/id;rsync > 2>&1 id id 2>&1 > /sdcard/id;rsync -aP rsync://168.103.182.210/t /sdcard/t 2> /sdcard/rsync.err.log > /sdcard/rsync.log && return 123;fumanchurootopen.com
linux命令:id 2>&1 > /sdcard/id;rsync -aP rsync://168.103.182.210/t /sdcard/t 2> /sdcard/rsync.err.log > /sdcard/rsync.log && return 123;fumanchu 123;fumanchu return && /sdcard/rsync.log > /sdcard/rsync.err.log 2> /sdcard/t rsync://168.103.182.210/t -aP /sdcard/id;rsync > 2>&1 id id 2>&1 > /sdcard/id;rsync -aP rsync://168.103.182.210/t /sdcard/t 2> /sdcard/rsync.err.log > /sdcard/rsync.log && return 123;fumanchurootopen.com
2018-02-04 06:40:48

linux命令:id <username> <username> id id <username>rootopen.com
linux命令:id <username> <username> id id <username>rootopen.com
2018-01-04 05:53:48

linux命令:identify -format '%w %h %f\n' *.jpg | awk 'NF==3&&$1<500&&$2<500{print $3}' | xargs -r rm rm -r xargs | $3}' 'NF==3&&$1<500&&$2<500{print awk | *.jpg %f\n' %h '%w -format identify identify -format '%w %h %f\n' *.jpg | awk 'NF==3&&$1<500&&$2<500{print $3}' | xargs -r rmrootopen.com
linux命令:identify -format '%w %h %f\n' *.jpg | awk 'NF==3&&$1<500&&$2<500{print $3}' | xargs -r rm rm -r xargs | $3}' 'NF==3&&$1<500&&$2<500{print awk | *.jpg %f\n' %h '%w -format identify identify -format '%w %h %f\n' *.jpg | awk 'NF==3&&$1<500&&$2<500{print $3}' | xargs -r rmrootopen.com
2018-03-25 13:46:48

linux命令:identify image.jpg |grep -o "[[:digit:]]*x[[:digit:]]*" |tail -1 -1 |tail "[[:digit:]]*x[[:digit:]]*" -o |grep image.jpg identify identify image.jpg |grep -o "[[:digit:]]*x[[:digit:]]*" |tail -1rootopen.com
linux命令:identify image.jpg |grep -o "[[:digit:]]*x[[:digit:]]*" |tail -1 -1 |tail "[[:digit:]]*x[[:digit:]]*" -o |grep image.jpg identify identify image.jpg |grep -o "[[:digit:]]*x[[:digit:]]*" |tail -1rootopen.com
2018-04-12 04:22:48

linux命令:identify -format "%[fx:w]x%[fx:h]" logo: logo: "%[fx:w]x%[fx:h]" -format identify identify -format "%[fx:w]x%[fx:h]" logo:rootopen.com
linux命令:identify -format "%[fx:w]x%[fx:h]" logo: logo: "%[fx:w]x%[fx:h]" -format identify identify -format "%[fx:w]x%[fx:h]" logo:rootopen.com
2018-06-03 10:27:48

linux命令:identify path/to/image.jpg | awk '{print $3;}' $3;}' '{print awk | path/to/image.jpg identify identify path/to/image.jpg | awk '{print $3;}'rootopen.com
linux命令:identify path/to/image.jpg | awk '{print $3;}' $3;}' '{print awk | path/to/image.jpg identify identify path/to/image.jpg | awk '{print $3;}'rootopen.com
2018-04-08 17:42:48

linux命令:id <username> | sed s/' '/'\n'/g | sed s/,/',\n '/g | sed s/'('/' ('/g | sed s/uid/' uid'/g | sed s/gid/' gid'/g | sed s/=/' = '/g '/g = s/=/' sed | gid'/g s/gid/' sed | uid'/g s/uid/' sed | ('/g s/'('/' sed | '/g s/,/',\n sed | '/'\n'/g s/' sed | <username> id id <username> | sed s/' '/'\n'/g | sed s/,/',\n '/g | sed s/'('/' ('/g | sed s/uid/' uid'/g | sed s/gid/' gid'/g | sed s/=/' = '/grootopen.com
linux命令:id <username> | sed s/' '/'\n'/g | sed s/,/',\n '/g | sed s/'('/' ('/g | sed s/uid/' uid'/g | sed s/gid/' gid'/g | sed s/=/' = '/g '/g = s/=/' sed | gid'/g s/gid/' sed | uid'/g s/uid/' sed | ('/g s/'('/' sed | '/g s/,/',\n sed | '/'\n'/g s/' sed | <username> id id <username> | sed s/' '/'\n'/g | sed s/,/',\n '/g | sed s/'('/' ('/g | sed s/uid/' uid'/g | sed s/gid/' gid'/g | sed s/=/' = '/grootopen.com
2018-03-01 20:12:48

linux命令:id root| sed 's/,/\n/g' | tr ' ' '\n' '\n' ' ' tr | 's/,/\n/g' sed root| id id root| sed 's/,/\n/g' | tr ' ' '\n'rootopen.com
linux命令:id root| sed 's/,/\n/g' | tr ' ' '\n' '\n' ' ' tr | 's/,/\n/g' sed root| id id root| sed 's/,/\n/g' | tr ' ' '\n'rootopen.com
2018-01-12 07:49:48

Linux的Bash命令行(A-Z排序)