Cheat SheetsTopics

Unix / Linux Commands

Sometimes something happens that forces you to learn something new. Like when the Android emulator freezes on Fedora, and I can’t even close it! OK, keep calm, I remember something about Linux commands and how useful they are. Oh, really? Hmm, let’s take a closer look!

Obviously I was kidding! System commands are very useful to know, they can drastically improve the way your work.

Here are some that I find very useful.

 

Execute multiple commands in one line:

A; B          # Run A and then B, regardless of success of A

A && B    # Run B if and only if A succeeded

A || B        # Run B if and only if A failed

A &          # Run A in background.

 

Clear the terminal:

 

Monitor processes. See tasks, memory, CPU and swap:

 

Monitor processes by user:

While the command is running you have the following options:

Press ‘q‘ to quit window.

Press ‘z‘ to highlight everything.

Press ‘d‘ to set screen refresh interval.

 

There is an improved top command. It’s not installed by default on most Linux distributions, so you might have to install it first:

And also by user:

Kill processes.

Signal the process to terminate gracefully:

Find the PID (process identification number) of the process you want to kill with the top command or htop command.

If the process does not exit when asked nicely use:

 

Find PID of process running on particular port:

 

Kill process running on a particular port:

 

To be continued…

Spread the knowledge

Leave a Reply

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