Use User Commands in Linux  Step by Step Guide ▷ 2021

Are you starting to use the Linux terminal? If so, know linux commands id, last, who, groupadd, useradd and userdel is essential.

Of course, the first step to using them correctly is to understand what each one is for. It does not matter if you are already managing a system in companies, schools or businesses. Or if you just want to learn a little Linux OS programming.

Here you will understand what it is about and when it is appropriate to use each argument. By placing the specific syntax you should not have any problem. You will go from seeing the IDs or identification number to managing groups and more.

What are Linux user commands and what are they for?

What are Linux user commands and what are they for?

Basically the command user only works for view users who are connected or logged in to the system. This in case no additional option is added. So each one can be traced. Functionality that can even alert us to dangers within the system. However, there are user comands for enumeration, deletion, or addition more complete. All of these are intended to facilitate management by the superuser. Fundamentally in relation to user and group planning.

Learn how to use the commands “go”, “last”, “quien”, “groupadd”, “useradd”, “userdel”

 Learn how to use the commands "go", "last", "quien", "groupadd", "useradd", "userdel"

Now you must go further and learn step by step how to use them while in the terminal.

Of course, before each syntax it is good that you see its exact meaning:

Command id

With the command id we will have the specific command to see the current and real identifier number.

This is the case for both a user and a group:

  • To access this command you must put the id in the end with the name of the current user
  • In the end it should be something like this example id myuser.
  • Remember that you have more options, for example, add to it -g in order to view effective group ID or -G in order to see all IDs. -N also works to get group or user name instead of ID.
  • Of course, for the latter you must specify if it is -u (user) -g (group) or -G (groups) The same happens with the id -r argument, it helps you to show the real ID of the group or users and not the cash.

Last command

On the same line of ideas, the argument last allows us many variations.

But, its main reason is to list accesses to the system, exits, machine restarts, dates and times:

  • Insert on the console the argument last
  • So it will only show you the last thing in the user list.
  • By adding -n followed by a number you will be indicating how many lines to show. The syntax will be like this last -n. On the other hand, if you place -R it won’t show you the hostname field. While with -a will specify the hostname in the last column.
  • You can also write last followed by -x. In this way, you will see what is registered in the list of users together with the shutdown entries and the modifications in the execution list.

Who command

As we know Linux is a multi-user OS. Thus, the who command indicates all users who are authenticated within the system at the time. Through this you can determine the name of the active users, login time, machine name, terminal line and more.

Let’s see:

  • To activate the argument write who followed by the corresponding option
  • For example, -H so that it is printed to the terminal as a columnar format
  • OR -u to have on the list to users with access to the system.

Groupadd command

One of the commands you can only run the superuser or administrator is groupadd. This is because it is intended to create a new group account.

For this to work you must follow the steps that you will see below:

  • Precedes if necessary as sudo
  • Insert soon groupadd
  • And then place the name of the group
  • In the end you should have a Outcome similar to this: groupadd namegroup.

Keep in mind you can use options preceded to the name of the group. For example, -g it is the numeric value of the group identifier. That is, a specific and unique value. While, the flag -r serves in Linux Redhat to order the account to be added to the system.

Useradd command

This argumentation allows us add a new user using the Linux console. You have to bear in mind that in some versions of the OS it is used adduser. Also, you must remember that this action often requires administrator permission.

You can use the sudo (super user does) argument in front of it if necessary:

  • While in the console we write useradd and then we enter the name of the new user
  • So, you should have a result similar to this: useradd juan.

Userdel command

Contrary to useradd, userdel has been formulated to remove users from the terminal.

Knowing this we follow the procedure:

  • We start with userdel
  • Along with this we add the username to delete
  • And then we immediately specify the name of the group where you are
  • So if we want to eliminate Juan of the group counters we do the following set of commands: userdel juan contadores.

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thanks! 😉

Mario Jose

Author: Mario José

Graduated in journalism, specialized in investigation, I look for the truth of all things. Now 100% focused on technology, computing and Internet issues.

You may be interested:

Leave a Comment