User Management Commands

User management is enough to do almost a lot of operations on your computer. A new user can be created, and you can also have the right to delete another user. Along with this article, you will now be able to create a new user, and of course, control of this system is in your hands!

  • Cat: this command shows the information about the file you want to open. In other words, it opens the specified file.
cat /etc/passwd

In the code line above, user information is requested.

This image has an empty alt attribute; its file name is Ekran-Resmi-2020-09-17-08.14.46-1024x290.png

Commands For Adding Users To The System (adduser)

If you want to get user information in the system, you cannot have permission without the Sudo command. Sudo will show that you are a superuser, i.e. a top-level user.

sudo adduser info

At this stage, you will be asked for a control password. When you enter your password, you will not see any output in the terminal, so don’t scare you.

User Control

cat etc/passwd

This command shows whether the information directory is added to the home, i.e. to the home folder. The content display is again performed using the cat command.

User Password Change

On Linux distributed machines, the passwd command doesn’t see sufficient authority. For this reason, the transaction is taken with the permission of sudo.

passwd info ❌
sudo passwd info ✅

But now that I have MacOS, I can change the user’s password in this way.

This image has an empty alt attribute; its file name is Ekran-Resmi-2020-09-17-08.29.50.png

After entering the password 2 times, your new password will be ready to use.

  • history: Displays all commands are written earlier (past tense) in the terminal.

User Exchange (Switching Between Users)

su info / buseyarentekin

As above, it is possible to make user changes with the su command. You can preferably change the user name, I have specified both users so that there is no confusion.

For example, if you are using a Linux distributed computer, you may encounter information such as the following. In this way, the user named information will be passed to the Home directory.

[email protected]:/home/buseyarentekin$

Log Out Of The User

If a valid user is asked to log out, just type the following command line.


If you enter the exit command twice, the terminal will be closed.

Delete A User

The deluser command applies to delete the user. The deluser command comes from the delete user statement.

sudo deluser buseyarentekin

The user has been deleted with this line. But don’t we really want to see it deleted? Here is the command that we will write in this case should be immediately as follows ⬇️

cat /etc/passwd

If there is no user name in the list described here, then it has actually been deleted. You may have noticed that we do the insertion and deletion with the permission of sudo. It is mandatory to use sudo in such transactions that require authorization. Because not every user should perform these operations, this situation is dangerous.

Have you ever thought about how the user of buseyarentekin was deleted? Do you think a user can be deleted directly from the machine? No of course not. First, it makes a backup of the user’s files. It then deletes the user.

  • cd: This command comes from the change directory command. In other words, the directory change is done with this command. This command switches to the parent or child directory.

Show Hidden Files

All operations or commands are stored in the bash-history secret file under Home.

ls -ahl

Hidden files are shown with the command above.

Bash-history File Show

ls -ahl | grep bash

It shows bash information among the listed files. In order to enter the contents of the Bash-history file, we just type the following command on the screen.

cat .bash_history

As a result, we added and deleted users to the system, listed them, and learned our own terminal history. I hope to see you in my next post. Have a healthy day.


Yasin Ortakci, Karabuk University, Operating Systems Lab.

Leave a Reply