The command line interface (CLI) is a crucial part of working with Kali Linux, as most of its powerful tools and utilities operate without a Graphical User Interface (GUI). When performing ethical hacking, penetration testing, or system administration, you’ll spend most of your time interacting directly with the terminal.
- In Kali Linux, commands are executed through the terminal emulator, where users enter specific instructions.
- After execution, the terminal returns the corresponding output or system response, providing precise control over tools, automation, and overall system operations.
Kali Linux Command Line Essentials
There are some commands in Kali Linux which we use too frequently. So we should be aware of those commands as it could increase our productivity.
1. To display present working directory
Command:
pwdOutput:

- This command will display the current directory you are in.
2. To list the directories and files in the current directory.
Command:
lsOutput:

- This command will display the list of files and directories in the current directory.
3. To change the current working directory
Command:
cdOutput:

- This command will change the directory you are currently working on.
4. Search for a Word in a File
Command:
grep keyword filenameOutput:

- This command searches for a specific keyword or pattern inside a file and displays matching lines.
5. To create a new directory
mkdir directory_name
This command will create a new directory in the current folder with the name directory_name.
6. To remove a directory
Command:
rmdir directory_nameOutput:

- This command will remove the directory with the name directory_name from the current directory.
7. To move a file
Command:
mv source destinationOutput:

This command is used to move a file from one location to another.
8. To copy a file
Command:
cp source destinationOutput:

- This command will copy the file from the source to the destination.
9. To create a new file
Command:
touch filename Output:

- This command will create a new file with the name "filename"
10. To display manual of a command
Command:
man lsOutput:

- This command will display a manual or a user guide for the command.
11. To check the internet connection or to check whether the host is active or not.
Command:
ping google.comOutput:

- This command will send some packets to the mentioned host and will give us output about the details of what is the status of the packet. This command could be used to check the internet connection.
12. To display network interface details.
Command:
ifconfigOutput:

- This command is used to display the details of the network interfaces connected to the system.
13. To download a file
Syntax:
wget link_to_file Output:

- This command will download the file from the link entered in the command.
14. To install a package
Syntax:
sudo apt install package_nameCommand:
sudo apt install netcat
- This command is used to install the mentioned package in the system.
15. To remove a package
Syntax:
sudo apt remove package_nameCommand:
sudo apt remove netcatOutput:

- This command will remove the mentioned package from the system.
16. To upgrade packages in the system
Command:
sudo apt upgradeOutput:

- This command will upgrade all the packages in the system.
17. To fetch the packages updates
Command:
sudo apt updateOutput:

- This command will check for updates of all the packages and will add the updates in the list to upgrade.
18. To get the current username
Command:
whoami Output:

- This command is used to print the username of the current user.
19. To change the current user to superuser or root
Command:
sudo suOutput:

- This command will ask for a password and will change the current user to root.
20. Print Text on the Terminal
Command:
echo " To print something on terminal"Output:

- The command will print the mentioned text on the terminal.