Commands on ubuntu (80%) – part 5

Tram Ho

Hello 500 ae, after 4 numbers in this series, I feel like you are interested in reading this topic. Hope what I find out will help more of you. So we have come out most of the important commands already. Shocked with the next song only. For a more awesome world.

Let’s continue the series of 20% of command line most used. You can see the previous section here .


Even the times when your computer is running normally can run many different processes – processes. You can display all of them using the ps command:

This command will list all user-initiated processes currently running in the current login session. In the picture above there is a shell fish running. To list all processes we need to use options with ps . I usually use the ax option:

Option a is used to list the processes of other users. x used to list processes that are not linked to any terminal (not initiated by a user via the terminal). As shown in the picture, the result of the command is too long.

Searching on this result can seem daunting. We can use a search directly on this output using the grep command. Like below:

The information that ps command gives the information:

  • The first information is the PID – process ID. When you want to interact with this process need to get this PID, for example kill this process.
  • Next, TT tells you the terminal id to use
  • Next STAT tells you the status of the progress. I is an idle process (has been sleeping for more than 20 seconds). R is a running process. S is a process that is sleeping for less than 20 seconds. T is a stopped process. U is an uninterruptible wait – wait, Z is a dead process.

The + sign indicates the process is running in the terminal.


Command top is used to get the list of real-time running processes, used to display actual information about the running processes in the system. To use it, you just need to type cmmand top in the terminal:

It will display a bunch of different information, it looks cool. It doesn’t look any different from that sorrowful muscle. It will run until you stop, exit it with the Q key or the key combination Ctrll + C

It gives a lot of different information: PID – process id, which user’s process, how much CPU and Mem used, how many processes are running, how many are “hibernating” and much more information. other. Below is a list of processes that use the most CPU and Memes from the top down – and are regularly updated.

In addition, it is possible to use more different options to display information according to a certain intention. Example of displaying information sorted by size Mem:

top -o +%MEM

If you have a good eye can see always a process top: v running.

By default, the command top is available just to use, but it seems that the interface and features are a bit difficult to use. I often use another tool which is the htop which is basically the same as the top but easier to use. You install htop by running the command install: apt intsall -y htop . Then the sun htop interface is as follows:

Below are detailed instructions for killing the search process. You guys find out for yourself.


Like the name kill – lets stop a certain process from running (unlike holding a pointed object to kill something: v). Using:

kill <PID>

For you who ask where to get PID. Get the PID using the command top above. By default, when not using any option, it will automatically use the TERM option. There are also many other options.

  • HUP – hang up.
  • INT – interrupt
  • KILL – stop the process
  • TERM – terminate stops a process
  • CONT – continue is used to continue a stopped process
  • STOP – stop the process


Similar to the kill command, killall, instead of sending a signal to a specific process id, sends a signal to multiple processes at the same time. Syntax:

Where name is the name of a certain program and it will kill all the processes of that program. eg killall top


When you use Linux / Mac, we can install the task in the background using the add symbol & at the end of the command. Example for top command running in the background:

This is very handy for long running programs. We can return to that program using the fg command. If there is only 1 chapter, you will enter the running command. If there are many programs running in the background then we have to use the job number identifier – that job number fg 1 , fg 2 , … To get this number, we use the command. Jobs also get information about jobs in the background:

This part of the command fg I will continue in the next part.

Done. This is part 5. Thank you for your interest.

Share the news now

Source : Viblo