Linux Cheatsheet

Linux commands are common in my workplace and I would like to use command line in dev environment. So I decided to make a cheatsheet on Docker.

To remove a directory that contains other files or directories, use the following command.


rm -r mydir

If you don't want to receive a prompt for each file, during deletion


rm -rf mydir

The ps command lists running processes.


ps -A

List process to scroll through them at chunk


ps -A | less

The following command would search for the Firefox process


ps -A | grep firefox

The kill command can kill a process, given its process ID.


kill PID

pgrep returns the process IDs that match it. For example, you could use the following command to find Firefox’s PID


pgrep firefox

The pkill and killall commands can kill a process, given its name. We can Use either command to kill Firefox


pkill firefox
killall firefox

How to remove intermediary images during docker build


Use --rm together with docker build to remove intermediary images during the build process.

How to change the pririty of a process


renice 19 PID The renice command changes the nice value of an already running process. The nice value determines what priority the process runs with. A value of -19 is very high priority, while a value of 19 is very low priority. A value of 0 is the default priority. The renice command requires a process’s PID. The following command makes a process run with very low priority:

Kill any UI process


xkill command is a way of easily killing graphical programs. Run it and your cursor will turn into an x sign. Click a program’s window to kill that program. If you don’t want to kill a program, you can back out of xkill by right-clicking instead.

Post a Comment

0 Comments