Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1387715
  • 博文数量: 478
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4833
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-28 11:12
文章分类

全部博文(478)

文章存档

2019年(1)

2018年(27)

2017年(21)

2016年(171)

2015年(258)

我的朋友

分类: Android平台

2018-03-01 20:23:37

https://www.cnblogs.com/eastday/archive/2013/06/09/3128235.html

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
.....
.....
阅读(5121) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~