【使用者名稱:?:uid:gid:?:?:?】
...[root@maplechen ~]# cat /etc/group
root:x:0:
bin:x:1:
mail:x:12:
【組名:?:gid:】
...二、cut命令(-d指定分隔符,-f指定提取第幾列)
[root@maplechen ~]# cat /etc/group | grep "mail" | cut -d ':' -f 1,2
mail:x
[root@maplechen ~]# cat /etc/group | grep "mail" | cut -d ':' -f 1
[root@maplechen ~]# cat /etc/group | grep "mail" | cut -d ':' -f 1-3
mail:x:12
[root@maplechen ~]# cat /etc/group | grep "mail" | cut -d \: -f 1
[root@maplechen ~]# cat /etc/group | grep "mail" | cut -d \: -f 1-3
mail:x:12
三、awk命令(-f指定分割符)
[root@maplechen ~]# cat /etc/group | awk -f ':' '($1=="mail")'
mail:x:12:
[root@maplechen ~]# cat /etc/group | awk -f ':' '($1=="mail")'
12四、使用gid關聯查詢出使用者
[root@maplechen ~]# cat /etc/passwd | awk -f ':' '($4=="12")'
## 可以看到當前只有mail使用者屬於mail組
linux 檢視使用者組
groups 賬號,檢視該賬號所屬使用者組 grep 組名 etc groups 檢視這個組底下有哪些使用者 增加使用者組 usermod a g group1 user1 把使用者1加到group1裡頭去同時清空以前的組 gpasswd a user name group name 這個是只加到某...
Linux 檢視某個使用者組下面的所有使用者
我刪除apache組時候報錯 系統內有 groupdel cannot remove the primary group of user apache 於是就想 查查組內有哪幾個使用者,將使用者移除出組,然後刪掉這個組.關組的資訊放在 etc group檔案中,使用者的資訊放在 etc passwd...
Linux 檢視某個使用者組下面的所有使用者
網上搜了下,好多copy的文章,groups顯示的是當前登入使用者的所在使用者組,根本就沒有此使用者組的使用者列表。實踐了下,可以用以下方法檢視某個使用者組裡的所有使用者 系統內有關組的資訊放在 etc group檔案中,使用者的資訊放在 etc passwd檔案中。現在我要檢視乙個名為 plant...