Linux Commands frequently used by Linux Sysadmins – Part 2

Last week, I published part 1 of this five-part series entitled: Linux Commands frequently used by Linux Sysadmins. That first article scratched the surface of what I believe are 50 to 100 commands used often by Linux Sysadmins and power users. Also, see Part 3Part 4, and Part 5.

Let’s jump into another set of commands and command-line tools often used for analysis, troubleshooting, and Linux system administration. Listed below are some of the commands I’ve used over the past week. In this and future series, I will group related commands together as much as possible and add a table of contents to interlink all five parts.

Linux commands examples part 2


1. Command-line Linux system monitoring.

Very often, it’s useful to view Linux system performance. He’s a shortlist for quickly accessing system performance details via the command line.

  • uptime – shows system uptime and load average.
  • top – shows an overall system view.
  • vmstat – shows system memory, processes, interrupts, paging, block I/O, and CPU info.
  • htop – interactive process viewer and manager.
  • dstat – view processes, memory, paging, I/O, CPU, etc., in real-time. All-in-one for vmstat, iostat, netstat, and ifstat.
  • iftop – network traffic viewer. Ex: iftop -i eth0
  • nethogs – network traffic analyzer.
  • iotop – interactive I/O viewer. Get an overview of storage r/w activity. 
  • iostat – for storage I/O statistics.
  • netstat – for network statistics.
  • ss – utility to investigate sockets.

Here are some related articles I’ve written in the past covering command-line system monitoring tools:


2. ssh – secure command-line access to remote Linux systems.

Other than my Homelab, most of my Sysadmin related work is performed remotely. With clients’ server locations in the Americas, Europe, Asia, and Australia. Access command line on a remote server; you can use the ssh command.

The ssh command provides secure encrypted connections between local and remote hosts. ssh is used for terminal access, file transfers (sftp), and tunneling other applications.

ssh -i [key_file] [user]@[hostname/ip] -p [port]

-i identity_file, selects a file from which the identity (private key) for public-key authentication is read.
-p port, is used to select which port to connect to on the remote host.

For example:

ssh -i path/to/key_file root@ip_address -p 2222

SSH can also be run securely on a graphical desktop using terminal emulators such as Terminator.

Also, take a look at telnet and scp – Securely Copy Files Using SCP with examples.

In Part 3, we will take a look at using rsync.


3. sudo – execute commands with administrative privilege.

The sudo (Super User DO) command in Linux is regularly used as a prefix to commands which only the superuser (root) has permission to run. If you are not logged in with the root user, you can use the sudo  command to preface a command in order to run that command with root privileges. For example:

$ sudo apt install terminator

Once you run a sudo command, as a security precaution, you will be prompted to enter the password of the current non-root user session. (not the root password)

See also Red Hat’s Gaining Privileges documentation.


4. cd – Directory navigation.

The cd command allows you to change directories. To navigate into the root directory, use:

cd /

Navigate to your home directory use:



cd ~

Navigate up one directory level:

cd ..

Navigate to the previous directory (or back):

cd -

To navigate to a multi-level directory use:

cd /path/to/directory/

The pwd command shows your current directory location. pwd stands for “print working directory”. Also, see the ls command from part 1.


hydn@ubuntu:~$ pwd

Print the current directory, and resolve all symlinks (i.e. show the “physical” path): pwd -P


5. cp – Copying files and folders

The cp command will create a copy of a file for you. For example:

cp file1 file1_backup

This command will create a copy of “file1” named “file1_backup”, and “file1” will remain unmodified.

To copy a directory and it’s contents use the command with -r recursively:

cp -r directory1 directory1_copy

Recursively means copying the directory and all its files and subdirectories and all their files and subdirectories and so on.


6. mv – moving files and folders.

The mv command is used to move a file from its location to a different location or rename it. For example:

mv file1 file0

This will rename the “file1” to “file0”.

Another example:

mv file1 /home/user/Desktop/

will move “file1” to your Desktop directory, but it will not rename it.

To move AND rename, you can specify a new file. For example:

mv file1 /home/user/Desktop/file0

You can substitute ~ in place of /home/user/ which is faster for home directory related commands. For example:

mv file1 ~/Desktop/

When using the sudo command or logged in as root, then ~ will be the home directory of root.


7. Removing files and folders.

Use the rm command to remove/delete a file in a directory. For example:

rm file1

Use the rmdir command to delete an empty directory.

rmdir /path/to/empty/dir/

Use rm -r to delete a directory and all of its contents recursively:

rm -r /path/to/dir/

You can also create an empty file with touch command or cat:

touch filename

Or create a new directory you can use the mkdir command:

mkdir newdir/

In Part 5, we will look at creating and editing files with vi and nano.


8. man – for reading system reference manuals.

The man command displays a manual for any terminal commands we need help or info. All man pages include but are not limited to the following standard sections: Name, Synopsis, Description, Examples, and See Also.

man [command]


man ssh


9. apropos – Search man page names and descriptions.

The apropos command searches the man page names and descriptions. It can be used to find what commands to use for a certain job.

apropos [keyword]

For example, search for available commands related to the firewall:

apropos firewall


10. Search your package manager for available packages.

If you’d like to search for packages not already installed on your system, you can use the following commands to search for packages using your Linux distro’s package manager:


apt search [keyword]


apt-cache search [keyword]

For example:

hydn@ubuntu:~$ apt-cache search "nginx web"
nginx-core - nginx web/proxy server (standard version)
fcgiwrap - simple server to run CGI applications over FastCGI
libnginx-mod-http-dav-ext - WebDAV missing commands support for Nginx
libnginx-mod-http-ndk - Nginx Development Kit module
nginx-extras - nginx web/proxy server (extended version)
nginx-full - nginx web/proxy server (standard version)
nginx-light - nginx web/proxy server (basic version)


dnf search [keyword]


zypper se [keyword]

Also see, 90 Linux commands frequently used by Linux sysadmins.

That’s it for now. If you’ve found part 2 useful, please share, subscribe, bookmark, and leave a comment or suggestions below.

< Previous – Linux Commands frequently used by Linux Sysadmins – Part 1
Next – Linux Commands frequently used by Linux Sysadmins – Part 3 >

Tags: , , , ,


  1. Thanks for continuing to post these, they are very helpful to rookies like me.

    What would be the best way to find content within a file? I’ve never named my files properly and now I have trouble finding things, but I do know some words and phrases within them.

  2. I love all the stat and top programs that are available. btop is super awesome and I’d recommend it to anyone. Never knew about iftop, seems to do what I like but easier. I’ve been using iptraf for a while and it’s not the easiest to use.

  3. I’m going on a very dusty recollection here, but I think find and grep together might work. Find to iterate over your file system, grep to trigger whether your file contains what you remember is in it.

  4. to search for the pattern recursively in all files within the directory and its subdirectories, you can use the following:
    grep -r "hello" /path/to/directory

    You can also limit the search to specific file types by using the --include option followed by a pattern that matches the file names you want to search:
    grep -r --include="*.txt" "hello" /path/to/directory

Top ↑