全部博文(478)
分类: Android平台
2018-03-01 20:23:37
What is the command to list users in ubuntu?. In this tutorial i’ll share List all users in ubuntu via . you can easily list users in ubuntu using the cat command as follows:
$ cat /etc/passwd
OR you can view per page ,use following commands
less /etc/passwd
more /etc/passwd
Output :
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
...........
.........
All fields are separated by a colon (:) symbol. Total seven fields exists. The first field is username. It is used when user logs in. It should be between 1 and 32 characters in length
you can also list only usernames with command awk , type these command in terminal :
awk -F':' '{ print $1}' /etc/passwd
Here’s example outputs of command above:
root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
proxy
www-data
backup
list
irc
gnats
nobody
.....
.....