Kali Linux is an open source operating system designed for penetration testing and digital forensics. It comes with a variety of powerful terminal commands that can be used to perform various tasks related to hacking and security. In this article, we will discuss some of the most common kali linux terminal commands for hacking that can help you get started with your hacking endeavors.
Mati Aharoni and Devon Kearns created it. Kali Linux is a specially designed for network analysts, penetration testers, or individuals who engage in cybersecurity and analysis.
Kali Linux’s official website is Kali.org. It gained fame after being utilised in the Mr. Robot series. It was not intended for broad usage. Rather, it is intended for use by professionals or individuals who are familiar with Linux/Kali.
Check out the official guide to learn how to install Kali Linux. Although there may be thousands of conditions and payloads to test while performing penetration testing or hacking. We must sometimes automate our work. To maximise time efficiency, we use tools that come pre-packaged with Kali Linux.
1. CD
Cd: This command is used to change the active directory. When you start your system and use the terminal apps. ou are instantly in the home directory of the given username/login. Look below for a few useful commands for changing the directory.
Assume you’re in the directory /root/john/audios. In the command terminal, type cd… to get to /root/john. If you run the same command again, you’ll find yourself in /root/.
This will create a new directory for you. For example, if you write cd movies, it will create a new working directory with the name movies.
2. MKDIR
The mkdir
command in Linux is used to create a new directory or a new folder. The syntax for the mkdir
command is:
mkdir [options] directory_name
The directory_name
is the name of the directory that you want to create. Here are some commonly used options with the mkdir
command:
-p
: This option creates all the parent directories as well. If any of the parent directories don’t exist, it creates them.-m
: This option sets the permission for the new directory. You can use numeric notation to set the permission, such as755
or777
.
For example, to create a new directory called “my_folder” in the current directory, you can use the following command:
mkdir my_folder
To create a new directory called “my_folder” and all its parent directories if they don’t exist, you can use the -p
option:
mkdir -p /home/user/my_folder
To create a new directory called “my_folder” with permission 755
, you can use the -m
option:
mkdir -m 755 my_folder
Note that you need to have write permission in the parent directory to create a new directory. If you don’t have the permission, you will get an error.
3. LS
The ls command is used to list the contents of a directory. When you type “ls” in Terminal, it will show you a list of all the files and directories in the current directory. You can specify a path after the command to list the contents of a specific directory.
For example, if you type “ls /home/user/documents” it will show you a list of all the files and directories in the Documents folder of the user directory.
4. PWD
pwd: This command in terminal will display the working folder or Active Directory. In other words, it will print the currently active or working folder or directory for you.
5. CP
Any file or folder can be copied with CP command. For example, this is the command to use if you want to copy the file abc.mp4 into folder mymovies. Example: CP /MyMovies Abc.mp4
6. RM
RM commands are used to remove or remove files and directors in operating systems such as Unix, Linux and other unix. It is a powerful command that can permanently remove files and directors, so it should be used with caution.
The basic syntax of the rm
command is:
bashCopy coderm [OPTION]... FILE...
Where FILE
is the name of the file or directory to be removed, and OPTION
is an optional argument that modifies the behavior of the command.
Some common options that can be used with rm
command are:
-r
: removes directories and their contents recursively.-f
: forces the removal of files without prompting for confirmation.-i
: prompts the user for confirmation before deleting each file.
For example, to delete a file called myfile.txt
, you would use the following command:
bashCopy coderm myfile.txt
To remove a directory called mydir
and its contents, you would use the following command:
bashCopy coderm -r mydir
It’s important to use the rm
command with care and double-check that you’re deleting the correct file or directory, especially when using the -r
and -f
options.
7. MV
This command moves a file from one location to another. The command structure is fairly similar to the cp command mentioned before. We’ll use the same example to move the file abc.mp4 to the folder myMovies. The command is as follows: mv abc.mp4 /myMovies.
8. PS
In Kali Linux, the ps
command is used to display information about the running processes on the system. The basic syntax of the ps
command is:
ps [options]
Without any options, the ps
command will display a list of processes that are associated with the current terminal session.
9. Kill
In Kali Linux, the kill
command is used to terminate a running process. The basic syntax of the kill
command is:
kill [options] <pid>
Where pid
is the process ID of the process you want to terminate. By default, the kill
command sends the TERM
signal to the specified process, which asks the process to terminate gracefully.
For example, to terminate a process with a PID of 1234, you can use the following command:
kill 1234
If the process doesn’t terminate gracefully, you can use the KILL
signal, which forcefully terminates the process. To send the KILL
signal, use the -9
option with the kill
command:
kill -9 1234
This will immediately terminate the process with a PID of 1234.
You can also use other signals with the kill
command, such as the HUP
signal, which tells the process to reload its configuration files. To send the HUP
signal to a process, use the -HUP
option with the kill
command:
kill -HUP 1234
The kill
command is a powerful tool for managing running processes on a Linux system. It can be used to terminate unresponsive or resource-intensive processes, restart services, and perform other system administration tasks. However, it should be used with caution, as terminating certain critical system processes can cause system instability or even data loss.
10. Toch
In Kali Linux, the touch
command is used to create a new empty file or update the timestamp of an existing file. The basic syntax of the touch
command is:
touch [options] <filename>
Where filename
is the name of the file you want to create or update. If the file already exists, the touch
command updates the timestamp of the file, without modifying the file’s contents.
For example, to create a new empty file called myfile.txt
, you can use the following command:
touch myfile.txt
This will create a new file called myfile.txt
in the current working directory. If the file already exists, the touch
command will update its timestamp to the current time.
The touch
command supports several options that can be used to modify the timestamp of the file, set the timestamp to a specific date and time, or create multiple files at once. Some common options are:
-a
: Update the access time of the file, without changing the modification time.-m
: Update the modification time of the file, without changing the access time.-d
: Set the timestamp of the file to a specific date and time. For example,touch -d "2022-01-01 00:00:00" myfile.txt
sets the timestamp of the file to January 1st, 2022 at midnight.-c
: Only update the timestamp of the file if it already exists. If the file doesn’t exist, thetouch
command does not create a new file.
The touch
command is a useful tool for creating new files or updating the timestamp of existing files. It can be used to mark files as modified, trigger rebuilds in build systems, or set up dependencies in scripting and automation tasks.
Also Read:
Linux Commands Everything you need to know
10 Linux Commands That Will Save You Time and Increase Your Productivity
Advance Linux terminal commands for The Power users
List of 15 Best Netstat Command in Linux
How to Install Blackarch Linux From Scratch – Comprehensive Tutorial