How to add a comment or a remark for a user in Linux?

July 31, 2021 - 1 min read

To add a comment or a unique remark for a user, you can use the usermod command followed by the -c (comment flag), then followed by the comment in quotes, and then specify the name of the user to add the comment in Linux.

For example, let's say we have a user called john who is the system administrator. So we can add a comment of Administrator for the user john in Linux.

To do that we can use the usermod command like this,

# Add a comment for a user
sudo usermod -c 'Administrator' john
  • Sometimes you may need to use the sudo command before the usermod command to obtain the correct privileges to execute the command.

Now if you look at the output of the list of all users using the cat /etc/passwd command in Linux, you can see that the john user has a comment called Administrator attached to the user.

It may look like this,

# Output of the /etc/passwd file
# ...
# ...

Try executing the above command in this online terminal to see the result.

Feel free to share if you found this useful 😃.