Skip to content

Useful commands

A list of useful commands and basic information on navigating SHELL in


The prompt on servers is in the format: [LOGIN@SERVER]:<PATH>$, where:

  • LOGIN - This is the user name in the system.
  • SERVER - This is the server you are logged in to.
  • PATH - This is the current directory you are in.
  • $ - A prompt that informs you about the possibility of entering a command.

User adam logged in to server located in the ~/domains/ directory. What is ~ is the information below.


Basic catalogs:

  • /usr/home/USER - Directory of the user with login USER.
  • ~ - Your user directory.
  • . - The directory you are in.
  • .. - The directory that contains the subdirectory you are in.
  • ~/domains - Directory with created web pages.
  • ~/backups - Directory with backups.
  • ~/repositories - Directory with repositories.
  • /tmp - Temporary directory, periodically cleared of contents.

Basic commands:

  • cd - Go to your home directory.
  • cd path_to_directory - Goes to the given directory.
  • ls - Displays a list of files and directories in the current directory.
  • ls directory_path - Displays a list of files and directories in the given directory.
  • mkdir directory_name - Create directory.
  • cp path_to_file path_to_file - Copying a file.
  • mv path_to_file_or_directory path_to_file_or_directory - Move file or directory.
  • rm path_to_files - Delete multiple files.
  • rm -rf path_to_file_or_directory - Delete multiple files or directories together with subdirectories.
  • rmdir directory - Delete an empty directory.


  • Extracting tar files:
tar -xvf archive.tar
tar -xvzf archive.tar.gz
tar -xvzf archive.tgz
tar -xvjf archive.tar.bz2
tar -xvjf archive.tbz2
  • Extracting other popular archives:
gunzip archive.gz
unrar x archive.rar
bunzip2 archive.bz2
uncompress archive.Z
7z x archive.7z
brotli -d
  • Packing into a zip file:

zip -r directory_path

  • Packing to tar.gz file:

tar -zcvf archive.tar.gz directory_path


Each process has its own unique PID number (process id).

Process list:

$ ps aux
root 22998  0,0  0,0  33964   11792 -  INs  25maj15  0:05,96 screen
adam 85919  0,0  0,0  86476   6664  -  SN   13:56    0:00,14 sshd: adam@pts/38 (sshd)
adam 82119  0,0  0,0  17688   5428 17  INs+ 3cze15   0:00,09 -/usr/local/bin/bash
adam 18327  0,0  0,0  18740   2124 38  RN+  15:18    0:00,00 ps aux
adam 85921  0,0  0,0  17688   5724 38  SNs  13:56    0:00,06 -bash (bash)
adam 86079  0,0  0,0  25772   2884 39  SN+  13:56    0:00,01 screen -r
adam 36518  0,0  0,0  24088   3404 42  INs+ 3cze15   4:33,59 redis-server: redis-server *:0 (redis-server)

There are 4 common signals that can be sent to any process:

  • SIGTERM – correct closing of the process
  • SIGKILL – annihilation of the process, which may result in the loss of all data contained in it (there is no way to intercept this signal by the process)
  • SIGSTOP – stop the process without data loss
  • SIGCONT – restarting a stopped process

By default, the SIGTERM signal is sent, which causes the process to safely shut down. A properly written program can intercept such a signal and handle it appropriately. The signals SIGKILL, SIGSTOP, SIGCONT are information for the system kernel, which must take appropriate steps (the program is unable to handle these signals). SIGKILL allows you to remove a process from your system that has crashed and stopped responding, but it means you will lose all information contained in it. The process is killed by the system kernel, which releases all resources used by the program. The signals are sent using the command: kill -SIGNAL PID


Termination of process 86079 - successful termination of the process:

kill -TERM 86079
kill 86079

Killing the process 86099 - killing the process, which may result in the loss of all data contained in it:

kill -KILL 86099
kill -9 86099