fbpx

Your first Linux commands – Lesson 6 – Who are you and what’s running on this Linux box anyway?

It’s time to take a look at the users logged onto your Linux box. who will display the users who are logged on..

Every user on Linux is associated with a UID, a user ID. This is a decimal number that uniquely identifies a user on the system.

You have your user with a username. Type in the following for illustration of user ID and group memberships:

  1. We want to see all the running processes with ps. For our purpose to see all running processes we will use the switches aux to see all processes.
    1. a: Select all processes except those with no session leader.
    1. u: Select by effective user list.
    1. x: Display processes in BSD format.
  2. top and interactive view of running processes.
    1. Interpret the columns in the output.
    1. Connect back to the commandline output.
  3. man command with the less command to browse entire help without cropping of output.
  4. who, to see the users logged on. Remember: Linux is a multiuser operating system.
  5. Now type in id <your username> and look at the output.
    1. id and group memberships.

You can see the user ID in the left-most part of the output: uid=..(<username>)

Let’s check users and processes

We will use the ps command and introduce the who and id commands.

  1. Type ps aux to see all processes in BSD format.
  2. Now type this again but write it to a file processes.txt. (Tip: Redirection operator >)
  3. Type in who and press Enter. You should see your own user listed.
  4. Type ps aux | less to be able to scroll up and down in the list of processes.
    1. To the left you will see the user that started the process and is therefore the owner of the process.
    1. Next to that you see an integer value. This is the Process ID or PID that the process is known to by the system.

Now turn your attention to the right-most column. These are the commands that initiated the processes. Yes, we skipped several columns at this stage. But you already know how to identify processes and which owners started them as well as the PIDs for the processes. You can do plenty with this.

Time to continue with lesson seven, “Hey, where is my home directory and what can I do there?“.