Kali Linux - Command Line Essentials

Last Updated : 17 Nov, 2025

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:

pwd

Output:

To-display-present-working-directory

  • This command will display the current directory you are in. 

2. To list the directories and files in the current directory. 

Command:

ls

Output:

To-list-the-directories-and-files-in-the-current-directory

  • This command will display the list of files and directories in the current directory. 

3. To change the current working directory 

Command:

cd

Output:

To-change-the-current-working-directory

  • This command will change the directory you are currently working on. 

4. Search for a Word in a File

Command:

grep keyword filename

Output:

To-find-a-word-in-a-file

  • 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

To-create-a-new-directory

This command will create a new directory in the current folder with the name directory_name

6. To remove a directory 

Command:

rmdir directory_name

Output:

To-remove-a-directory

  • This command will remove the directory with the name directory_name from the current directory. 

7. To move a file 

Command:

mv source destination

Output:

To-mv-a-file

This command is used to move a file from one location to another. 

8. To copy a file 

Command:

cp source destination

Output:

To-copy-a-file

  • This command will copy the file from the source to the destination. 

9. To create a new file 

Command: 

touch filename 

Output:

To-create-a-new-file

  • This command will create a new file with the name "filename

10. To display manual of a command 

Command:

man ls

Output:

To-display-manual-of-a-command

  • 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.com

Output:

To-check-the-internet-connection-or-to-check-weather-the-host-is-active-or-not

  • 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:  

ifconfig

Output:

To-display-network-interface-details

  • 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:

To-download-a-file

  • This command will download the file from the link entered in the command. 

14. To install a package

Syntax:  

sudo apt install package_name

Command:

sudo apt install netcat

To-install-a-package

  • This command is used to install the mentioned package in the system. 

15. To remove a package 

Syntax:

sudo apt remove package_name

Command:

sudo apt remove netcat

Output:

To-remove-a-package

  • This command will remove the mentioned package from the system. 

16. To upgrade packages in the system 

Command:

sudo apt upgrade

Output:

To-upgrade-packages-in-the-system

  • This command will upgrade all the packages in the system. 

17. To fetch the packages updates  

Command:

sudo apt update

Output:

To-fetch-the-packages-updates

  • 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:

To-get-the-current-username

  • This command is used to print the username of the current user. 

19. To change the current user to superuser or root  

Command:

sudo su

Output:

To-change-the-current-user-to-superuser-or-root

  • 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:

To-print-in-terminal

  • The command will print the mentioned text on the terminal.
Comment

Explore