Essential Terminal Commands

1 minute read

Published:

In the realm of Unix-like operating systems, mastery of the command-line interface (CLI) is a fundamental skill for system administrators, developers, and power users alike. The terminal serves as a gateway to interact directly with the underlying system, offering a myriad of commands to query system information, manipulate files and directories, manage processes, and more. Among these commands, a handful stand out as essential tools for navigating and understanding the system’s environment. From querying system information with commands like uname and df, to monitoring system processes with top, this article serves as a comprehensive guide to mastering the essential terminal commands required for efficient system administration and troubleshooting.

List Directory Contents

amitabhadey@amitabhadey:~$ ls
amitabhadey@amitabhadey:~$ ls -lt
amitabhadey@amitabhadey:~$ ls -ls
amitabhadey@amitabhadey:~$ ls -la
amitabhadey@amitabhadey:~$ ls -d */

Change directory

amitabhadey@amitabhadey:~$ cd
amitabhadey@amitabhadey:~$ cd ..
amitabhadey@amitabhadey:~$ cd directory_name
amitabhadey@amitabhadey:~$ cd ~username

amitabhadey@amitabhadey:~$ pwd
amitabhadey@amitabhadey:~$ cd echo $PWD

Make directory

amitabhadey@amitabhadey:~$ mkdir directory_name
amitabhadey@amitabhadey:~$ mkdir directory1 directory2 directory3

Remove directory

amitabhadey@amitabhadey:~$ rmdir directory_name
amitabhadey@amitabhadey:~$ rmdir directory1 directory2 directory3

File Management Commands

Create an empty file

amitabhadey@amitabhadey:~$ touch filename
amitabhadey@amitabhadey:~$ touch file1 file2 file3

Copy files and directories

amitabhadey@amitabhadey:~$ cp source_file destination_file
amitabhadey@amitabhadey:~$ cp file1 file2 file3 directory/

Move or rename files and directories

amitabhadey@amitabhadey:~$ mv old_name new_name
amitabhadey@amitabhadey:~$ mv file1 file2 file3 directory/

Concatenate and display file content

amitabhadey@amitabhadey:~$ cat filename
amitabhadey@amitabhadey:~$ cat file1 file2 file3

System Information Commands

amitabhadey@amitabhadey:~$ uname -a
amitabhadey@amitabhadey:~$ uname -s

Display system processes

amitabhadey@amitabhadey:~$ top -a

Display disk usage

amitabhadey@amitabhadey:~$ df -h