Manage user accounts at the command line in Linux
This lesson covers various aspects of managing users at the command line in Linux.
List the users on your Linux server at the command line
To list the users on your Linux server at the command line, type the following:
cat /etc/passwd
This will give you a list of all users on the Linux server along with additional detail. Note that it will list system users as well as "regular" users. To veew just the regular users on the server, you can type the following:
cat /etc/passwd |grep 500*
You can tweak this slightly to show only the user names and none of the additional detail using the following command:
cat /etc/passwd | grep 500* | cut -d":" -f1
Change your password in Linux at the command line
To change your password at the command line, type the following:
passwd
You will then be prompted to enter the old password (unless you are logged in with root privileges), the new password, and then the new password again. You will then see a message confirming the change was made successfully.
You can change the password for another user (if you have privileges to do so) by typing:
passwd username
This time you will only be prompted to enter the new password twice.
Join our mailing list
Our Comment Policy.
We welcome your comments and questions about this lesson. We don't welcome spam. Our readers get a lot of value out of the comments and answers on our lessons and spam hurts that experience. Our spam filter is pretty good at stopping bots from posting spam, and our admins are quick to delete spam that does get through. We know that bots don't read messages like this, but there are people out there who manually post spam. I repeat - we delete all spam, and if we see repeated posts from a given IP address, we'll block the IP address. So don't waste your time, or ours. One other point to note - if you post a link in your comment, it will automatically be deleted.
Add comment