Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Kali Linux – Command Line Essentials

  • Last Updated : 05 Nov, 2021

Command-line plays a vital role while working with Kali Linux as most of its tools don’t have a Graphical User Interface and if you are performing ethical hacking or penetration testing then most of the time you will have to work with command Line Interface itself. While executing a command in Kali Linux we enter a command on the terminal emulator and it gives us the appropriate output after the execution of the command. 

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. 

Command Line Essentials

1. To display present working directory 

pwd

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.  

ls

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  

cd

To-change-the-current-working-directory

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

4. To find a word in a file.  

grep keyword filename

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



This command will list all the lines containing the keyword in them. 

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  

rmdir directory_name

To-remove-a-directory

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

7. To mv a file  

mv source destination

To-mv-a-file

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



8. To copy a file  

cp source destination

To-copy-a-file

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

9. To create a new file  

touch filename 

To-create-a-new-file

This command will create a new file with the name “filename” 

10. To display manual of a command  

man ls

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.  



ping google.com

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.  

ifconfig 

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  

wget link_to_file 

To-download-a-file

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

14. To install a package  

sudo apt install package_name

To-install-a-package

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

15. To remove a package  

sudo apt remove package_namme

To-remove-a-package

This command will remove the mentioned package from the system. 

16. To upgrade packages in the system  

sudo apt upgrade

To-upgrade-packages-in-the-system

This command will upgrade all the packages in the system. 

17. To fetch the packages updates  

sudo apt update 

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  

whoami 

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  

sudo su

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. To print in terminal  

echo " To print something on terminal"

To-print-in-terminal

The command will print the mentioned text on the terminal.
 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!