Kali Linux - Command Line Essentials
Last Updated :
22 Jan, 2025
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.
Kali Linux Command Line Essentials
1. To display present working directory
pwd

This command will display the current directory you are in.
2. To list the directories and files in the current directory.
ls

This command will display the list of files and directories in the current directory.
3. To change the current working directory
cd

This command will change the directory you are currently working on.
4. To find a word in a file.
grep keyword filename

This command will list all the lines containing the keyword in them.
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
rmdir directory_name

This command will remove the directory with the name directory_name from the current directory.
7. To move a file
mv source destination

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

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

This command will create a new file with the name "filename"
10. To display manual of a command
man ls

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

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

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

This command will download the file from the link entered in the command.
14. To install a package
sudo apt install package_name

This command is used to install the mentioned package in the system.
15. To remove a package
sudo apt remove package_namme

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

This command will upgrade all the packages in the system.
17. To fetch the packages updates
sudo apt update

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

This command is used to print the username of the current user.
19. To change the current user to superuser or root
sudo su

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"

The command will print the mentioned text on the terminal.
Conclusion
In this article, we explored 20 essential commands for mastering the command line in Kali Linux. These include fundamental commands like ls
, cd
, and pwd
for file navigation, and mkdir
, rm
, cp
, and mv
for managing files and directories. Tools like cat
and nano
help with viewing and editing files, while chmod
manages file permissions.
For network tasks, commands such as ifconfig
, ping
, netstat
, and nmap
are invaluable. System monitoring is made easier with top
, and package management is handled with apt-get
. Additionally, wget
aids in downloading files, find
and grep
are perfect for searching files and text, and history
allows you to review previous commands.
Similar Reads
MySQL in Kali Linux Command Line Below is a comprehensive MySQL Command Line tutorial for Kali Linux, starting from beginner to advanced levels. MySQL is a popular open-source relational database management system, and Kali Linux is a Debian-based Linux distribution often used for penetration testing and ethical hacking. Make sure
10 min read
Essential Unix Commands Unix commands are a set of commands that are used to interact with the Unix operating system. Unix is a powerful, multi-user, multi-tasking operating system that was developed in the 1960s by Bell Labs. Unix commands are entered at the command prompt in a terminal window, and they allow users to per
7 min read
Linux command in DevOps DevOps engineers use Linux every day because itâs free, fast, and easy to customize. More importantly, most DevOps tools like Docker, Kubernetes, Ansible, Terraform, and Jenkins are built to run best on Linux.In DevOps, you often work on cloud servers (like AWS, Azure, or Google Cloud), and most of
10 min read
hash command in Linux with examples The `hash` is a command in Linux that helps in managing the hash table. It facilitates with mapping the names of executable files to their locations on disk. It helps in speeds uping the commands execution by remembering paths of frequently used commands. It uses the `hash` to view hashed commands (
5 min read
help Command in Linux with examples If youâre new to the Linux operating system and struggling with command-line utilities, the help command is one of the first tools you should learn. As its name suggests, the 'help' command provides detailed information about built-in shell commands, making it an essential resource for beginners and
5 min read
apt command in linux with examples apt provides a high-level Command Line Interface (CLI) for the APT package management system, offering a user-friendly interface intended for interactive use. It simplifies common tasks like installation, upgrades, and removal, with better defaults than more specialized tools like apt-get and apt-ca
5 min read