How to use Essential Linux Commands

Rangika Kavishka
4 min readJul 24, 2023

--

Using essential Linux commands involves executing them in a terminal or shell environment. Here’s a step-by-step guide on how to use some of the essential Linux commands:

1. Opening a Terminal:
•On most Linux distributions, you can open a terminal by pressing `Ctrl` + `Alt` + `T`.
•Alternatively, you can search for “Terminal” or “Shell” in your system’s application launcher.

2. Navigating the File System:
•Use the `pwd` command to display the current working directory:

•Use the `ls` command to list files and directories in the current directory:

•Use the `cd` command to change directories:

For example, to move to the “Documents” folder in your home directory:

To go back one level in the directory hierarchy:

3. Managing Files and Directories:
•Use the `touch` command to create a new empty file:

•Use the `mkdir` command to create a new directory:

•Use the `rm` command to remove files or directories:

•Use the `cp` command to copy files or directories:

•Use the `mv` command to move or rename files or directories:

4. Viewing File Content:
•Use the `cat` command to display the content of a file:

•Use the `less` command to view file content page by page:

Press `q` to quit the `less` viewer.

•Use the `head` and `tail` commands to view the beginning or the end of a file, respectively:

5. File Permissions:
•Use the `chmod` command to change file permissions:

•Use the `chown` command to change file ownership:

chown owner:group filename

6. System Information:
•Use commands like `uname`, `hostname`, `whoami`, `df`, and `free` to get system information:

7. Process Management:
•Use the `ps` command to display information about running processes:

ps aux

•Use the `top` command to monitor system processes and resource usage in real-time:

top

Press `q` to quit the `top` command.

8. File Compression and Archiving:
•Use the `tar` command to archive files into a tarball:

tar -cvf archive.tar files

•Use the `gzip` command to compress a file:

gzip filename

•Use the `gunzip` command to decompress a compressed file:

gunzip filename.gz

These are some of the essential Linux commands and their basic usage. Remember that Linux commands often come with various options and arguments that you can explore using the `man` command (e.g., `man ls`) or by referring to online documentation and tutorials. Always be cautious when using commands that modify or remove files/directories, as these actions are irreversible. Make sure you have proper permissions and backups before executing potentially destructive commands.

--

--

Rangika Kavishka
Rangika Kavishka

Written by Rangika Kavishka

I'm a Content creator that creating IT related content. I'm passionate for Linux, Cyber Security, Ethical Hacking, IoT, Networking and etc.

No responses yet