Mastering Kali Linux - Top 20 Essential Commands to Build you Base on CLI

The Desi Cybersec
5 min readSep 16, 2023

--

Photo by Gabriel Heinzer on Unsplash

Kali Linux, with its reputation as the ultimate toolkit for cybersecurity professionals, can appear daunting at first glance. The myriad of tools and commands might seem like a complex puzzle waiting to be solved. But fear not, for once you’ve mastered these 20 essential Kali Linux commands, it’s like having the keys to a treasure trove of digital security. Let’s embark on this journey together and demystify the art of Kali Linux one command at a time.

In this article, we will discuss the top 20 basic Kali Linux commands that every security professional should know.

1. ls:

The ls command lists the contents of a directory.

2. cd:

The cd command changes the current working directory.

3. mkdir:

The mkdir command creates a new directory.

4. rmdir:

The rmdir command removes an empty directory.

5. touch:

The touch command creates a new file or updates the timestamp of an existing file.

6. cat:

The cat command displays the contents of a file.

7. grep:

The grep command searches for a specific pattern in a file.

8. find:

The find command searches for files and directories based on certain criteria.

9. sudo:

The sudo command allows you to run commands with root privileges.

10. apt:

The apt command is used to install, remove, and update packages.

11. dpkg:

The dpkg command is used to install, remove, and manage Debian packages.

12. apt-cache:

The apt-cache command provides information about packages.

13. service:

Manage system services.

14. tar:

The tar command is used to create, extract, and archive files.

15. gzip:

The gzip command compresses files.

16. gunzip:

The gunzip command decompresses files.

17. zip:

The zip command creates and extracts zip archives.

18. unzip:

The unzip command extracts zip archives.

19. diff:

The diff command compares two files or directories.

20. man:

The man command displays the manual page for a command.

These are just a few of the many basic Kali Linux commands. To learn more, you can consult the Kali Linux documentation or take a Kali Linux training course.

Note :- These are the base of the commands or the common command that we are gonna use in Kali Linux or any other Debian based Distributions.

If you want to know the full manual of a command just use the ‘man’ command.

Instructions:

The man command is a built-in command in Linux that displays the manual page for a command. The manual page provides detailed information about the command, including its syntax, options, and examples.

To use the man command, simply type `man` followed by the name of the command you want to learn more about. For example, to view the manual page for the `ls` command, you would type:

man ls

This would open the manual page for the `ls` command in your terminal window. The manual page is divided into several sections, including:

  1. NAME: The name of the command and a brief description of what it does.
  2. SYNOPSIS:The syntax of the command, including all of the available options.
  3. DESCRIPTION: A detailed description of the command and how to use it.
  4. OPTIONS: A list of all of the available options for the command and what they do.
  5. EXAMPLES:Some examples of how to use the command.

You can use the arrow keys to navigate through the manual page and the `q` key to exit.

The man command is a valuable tool for learning how to use Linux commands. By reading the manual pages for the commands you use, you can become a more proficient Linux user.

Here are some additional tips for using the man command:

* You can use the `-k` option to search for manual pages by keyword. For example, to search for manual pages that contain the keyword "network", you would type:

man -k network

* You can use the `-a` option to view all of the manual pages for a command. For example, to view all of the manual pages for the `ls` command, you would type:

man -a ls

* You can use the `-l` option to display the manual page in a long format. This format includes more information about the command, such as the author and copyright information.

* You can use the `-r` option to display the manual page in a reverse format. This format starts with the most recent manual page and works its way backwards.

The man command is a powerful tool for learning about Linux commands. By using the tips above, you can get the most out of the man command and become a more proficient Linux user.

Now moving on to our main topic .!

Here are some examples of how to use the essential commands we mentioned above :

  • To list the contents of the current directory, type the following command:
ls
  • To change the current working directory to the `/home/user` directory, type the following command:
cd /home/user
  • To create a new directory called `my_dir`, type the following command:
mkdir my_dir
  • To remove the empty directory `my_dir`, type the following command:
rmdir my_dir
  • To create a new file called `my_file.txt`, type the following command:
touch my_file.txt
  • To display the contents of the file `my_file.txt`, type the following command:
cat my_file.txt
  • To search for the pattern "hello" in the file `my_file.txt`, type the following command:
grep "hello" my_file.txt
  • To find all files in the current directory that have the extension `.txt`, type the following command:
find . -name "*.txt"
  • To install the `nmap` package, type the following command:
sudo apt install nmap
  • To remove the `nmap` package, type the following command:
sudo apt remove nmap
  • To update the package list, type the following command:
sudo apt update
  • To upgrade all installed packages, type the following command:
sudo apt upgrade
  • To create a tar archive of the `/home/user` directory, type the following command:
tar -cvf user_dir.tar /home/user
  • To extract the contents of the `user_dir.tar` archive, type the following command:
tar -xvf user_dir.tar
  • To compress the file `my_file.txt` using gzip, type the following command:
gzip my_file.txt
  • To decompress the file `my_file.txt.gz` using gzip, type the following command:
gunzip my_file.txt.gz
  • To create a zip archive of the `/home/user` directory, type the following command:
zip -r user_dir.zip /home/user
  • To check the status of a system service, such as SSH:
service ssh status

These essential Kali Linux commands lay the foundation for more advanced penetration testing and security tasks. By mastering them, you’ll be better equipped to navigate and utilize the powerful tools at your disposal within Kali Linux. Happy hacking!

Photo by Clark Tibbs on Unsplash

--

--

The Desi Cybersec

I am all about - Technology | Cyber Security | Ethical Hacking | A.I | Management |