Merge pull request #614 from geekpi/master

[Translating] Linux id Command ¨C Print user ID and group ID information
下回不要将文件名总的横线变成中文的,会被转义。
This commit is contained in:
Xingyu.Wang 2013-12-30 04:48:25 -08:00
commit fe3c20f130
2 changed files with 105 additions and 105 deletions

View File

@ -1,105 +0,0 @@
Linux id Command Print user ID and group ID information
================================================================================
To log in into a computer, we need a username. Username is an identity to recognized by a computer. Based on it, computer will apply a set of rules to a someone that log in with that username. On Linux system we can use **id** command.
### What is id command ###
**id** command is command which can print real and effective User ID (UID) and Group ID (GID). An UID is a single identity for a user. While Group ID (GID) can consist more than one UID.
### How to use it ###
By default, **id** command is installed on most of Linux system. To use it, just type id on your console. Typing id without no options will result as below. The result will use the active user.
$ id
![Default id output](http://linoxide.com/wp-content/uploads/2013/12/id_default.png)
#### Heres how to read the output : ####
- User **pungki** has **UID** number = **1000**, **GID** number = **1000**
- User **pungki is a member** of the following groups :
**pungki** with GID = **1000**
**adm** with GID = **4**
**cdrom** with GID = **24**
**sudo** with GID = **27**
**dip** with GID = **30**
**plugdev** with GID = **46**
**lpadmin** with GID = **108**
**sambashare** with GID = **124**
### Using id with options ###
There are some options that can applied to id command. Heres some options that may useful on day-to-day basis.
#### Print user name, UID an all the group to which the user belongs ####
To do this, we can use **-a** option
$ id -a
![-a option](http://linoxide.com/wp-content/uploads/2013/12/id_a.png)
#### Output all different group IDs (effective, real and supplementary) ####
We can use **-G** option to do fulfill this.
$ id -G
![-G option](http://linoxide.com/wp-content/uploads/2013/12/id_G.png)
The result will only show the GID numbers. You can compare it with **/etc/group** file. Heres a sample of **/etc/grou**p content :
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:pungki
fax:x:21:
voice:x:22:
cdrom:x:24:pungki
floppy:x:25:
tape:x:26:
sudo:x:27:pungki
audio:x:29:pulse
dip:x:30:pungki
www-data:x:33:
backup:x:34:
operator:x:37:
sasl:x:45:
plugdev:x:46:pungki
ssl-cert:x:107:
lpadmin:x:108:pungki
saned:x:123:
sambashare:x:124:pungki
winbindd_priv:x:125:
#### Output only the effective group ID ####
Use **-g** option to output only the effective group ID
$ id -g
![-g option](http://linoxide.com/wp-content/uploads/2013/12/id_g1.png)
#### Print the specific user information ####
We can output a specific user information related UID and GID. Just put the user name after id command.
$ id leni
![leni user](http://linoxide.com/wp-content/uploads/2013/12/id_leni.png)
Above command will print UID and GID of user named **leni**.
### Conclusion ###
This id command is useful for us when we want to know about UID and GID of a user. Some applications may need UID / GID to be run. id make us easier to find UID and GID of a user without seeing and searching it inside /etc/group file. As usual you can go to id manual page by typing **man id** from your console to explore more detail.
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-command/linux-id-command/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,105 @@
Linux id 命令 - 打印用户id和组id信息
================================================================================
要登入一台计算机我们需要一个用户名。用户名是一个被计算机识别的身份。基于此计算机会对使用这个用户名的登陆的人应用一系列的规则。在Linux系统下我们可以使用**id**命令。
### 什么是id命令 ###
**id** 命令可以打印真实并有效的用户ID(UID)和组ID(GID)。UID是对一个用户的唯一标识。组IDGID可以包含多个UID。
### 如何使用 ###
默认上,**id**命令已经预装在大多数Linux系统中。要使用它只需要在你的控制台输入id。不带选项输入id会显示如下。结果会使用活跃用户。
$ id
![id默认输出](http://linoxide.com/wp-content/uploads/2013/12/id_default.png)
#### 如何读取输出t : ####
- 用户 **pungki****UID** 号码 = **1000**, **GID** 号码 = **1000**
- 用户 **pungki ** 是下面的组成员 :
**pungki** with GID = **1000**
**adm** with GID = **4**
**cdrom** with GID = **24**
**sudo** with GID = **27**
**dip** with GID = **30**
**plugdev** with GID = **46**
**lpadmin** with GID = **108**
**sambashare** with GID = **124**
### 带选项使用id ###
id命令可以使用一些选项。下面有一些在日常使用中有用的选项。
#### 打印用户名, 该UID所属的所有组 ####
要这么做,我们可以使用**-a** 选项
$ id -a
![-a 选项](http://linoxide.com/wp-content/uploads/2013/12/id_a.png)
#### 输出所有不同的组ID (有效的,真实的和补充的) ####
我们可以使用 **-G**选项实现这个。
$ id -G
![-G 选项](http://linoxide.com/wp-content/uploads/2013/12/id_G.png)
结果只会显示GID号。你可以和**/etc/group**文件比较。下面是**/etc/group**文件的示例内容:
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:pungki
fax:x:21:
voice:x:22:
cdrom:x:24:pungki
floppy:x:25:
tape:x:26:
sudo:x:27:pungki
audio:x:29:pulse
dip:x:30:pungki
www-data:x:33:
backup:x:34:
operator:x:37:
sasl:x:45:
plugdev:x:46:pungki
ssl-cert:x:107:
lpadmin:x:108:pungki
saned:x:123:
sambashare:x:124:pungki
winbindd_priv:x:125:
#### 只输出有效的组ID ####
使用 **-g** 选项来只输出有效组ID。
$ id -g
![-g 选项](http://linoxide.com/wp-content/uploads/2013/12/id_g1.png)
#### 打印特定用户信息 ####
我们可以输出特定的用户信息相关的UID和GID。只需要在id命令后跟上用户名。
$ id leni
![leni 用户](http://linoxide.com/wp-content/uploads/2013/12/id_leni.png)
上面的命令会打印用户**leni**的UID和GID。
### 总结 ###
当我们想知道某个用户的UID和GID时是非常有用的。一些程序可能需要UID/GID来运行。id使我们更加容易地找出用户的UID以GID而不必在/etc/group文件中搜寻。像往常一样你可以在控制台输入**man id**进入id的手册页来获取更多的细节。
--------------------------------------------------------------------------------
via: http://linoxide.com/linux-command/linux-id-command/
译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出