Useful Linux Commands — Users and Processes

Spread the love

Linux is an operating system that many developers will use.

Therefore, it’s a good idea to learn some Linux commands.

In this article, we’ll look at some useful Linux commands we should know.


We can run a command as another user with the sudo command.

It lets us run commands as root.

For instance, we can run:

sudo nano /etc/hosts

to open the /etc/hosts file with nano as root.

We can also run sudo -i to start a shell as root.

And we can run as another user with the -u flag:

sudo -u bob ls /users/bob

We run ls as bob .


The su command lets us switch the shell to another user.

For instance, we run:

su bob

to run the shell as bob .

When we’re done, we type exit to return to our own shell.


clear lets us clear the screen of the terminal.

ctrl+l is a shortcut to clear the screen.

clear -x clears the screen but lets us go back to see previous work by scrolling up.


The who command lets us display the users logged into the system.

Each shell opened will be listed.

We can see the terminal used and the time and day the session was started.

The -aH flags tell who to display more info like idle time and process ID of the terminal.

who am i liust the current terminal session’s details.


The whoami command print the current user name.


which shows where the command is stored.

For instance, we run which ls to see where ls is stored.


The type command lets us determine the type of command we’re running.

A command can be one of 4 types:

  • an executable
  • a shell built-in program
  • a shell function
  • an alias


The fg common put a job that’s running in the background into the foreground.

We can get the job ID of jobs with the job command.

And we can use the job ID as the argument of fg .

So we run:

fg 2

to put job with ID 2 into the foreground.


bg resumes a job that’s been suspended.

We can get the job ID of jobs with the job command.

And we can use the job ID as the argument of fg .

So we run:

fg 2

to resume the job with ID 2.


jobs lets us list the status of the jobs we started.


The alias command lets us create a shortcut to another command.

For instance, we can run:

alias ll='ls -al'

to create the alias ll to run the ls -al command.


The killall command lets us send signals to multiple processes currently running.

Then general syntax is:

killall <name>

where name is the name of the program.


We can run commands to manage jobs and process with various Linux commands.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *