An /etc/passwd record contains the user name, UID, GID, GECOS, home, and shell fields.
alice:x:1500:1500:Alice Example:/home/alice:/bin/bashWhat does the sixth field represent?
The seven passwd fields are name, password marker, UID, GID, GECOS, home directory, and login shell.
Detailed explanation
Correct. /home/alice in the sixth field is the user's home directory.
Correct. /home/alice in the sixth field is the user's home directory.
Incorrect. The login shell is the seventh field, /bin/bash.
Incorrect. The login shell is the seventh field, /bin/bash.
Incorrect. The primary GID is the fourth field.
Incorrect. The primary GID is the fourth field.
Incorrect. The GECOS/comment field is the fifth field.
Incorrect. The GECOS/comment field is the fifth field.
Try it yourself
An example you can run in a temporary verification environment.
entry='alice:x:1500:1500:Alice Example:/home/alice:/bin/bash'; printf '%s\n' "$entry" | cut -d: -f6Expected result
/home/aliceKey points
- Sixth field is home
- Seventh is shell
- Third and fourth are UID/GID
Notes
- Environment: POSIXシェル / 合成レコード
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.