Updated April 14, 2023
Introduction to Kali Linux Terminal
Kali Linux Terminal is defined as a software representation of physical terminals that were available years back when computers used to be multi-user systems that universities and big corporations owned. The machine itself used to sit in a place where people didn’t visit and interacted via this terminal. In the current scenario, terminals are an interface which allows users to execute commands for a utility and machine, irrespective of wherever it is located, responds to the command and completes the task. If the terminal is for the machine itself, it can be thought of as a GUI which allows user to execute tasks and if one does SSH into another Kali Linux server, terminal acts as a mediator of connection.
How to Use Kali Linux Terminal?
Now that we have an understanding of what a terminal in Kali Linux is intended for let us see a brief history of Kali Linux. Kali Linux is the Debian based distribution of Linux and intended mainly for penetration testing and digital forensics. In today’s world, Linux is the most popular OS used by security experts and hackers, and the features and functionality Kali Linux offers have no match to any of its other alternative (except a few of them). One of Kali Linux’s features is the terminal and gives a head start to a newbie and an experienced Linux user to try out this operating system for fulfilling the duties and tasks.
To use the Kali Linux terminal, one would need to install a terminal in the Kali Linux operating system. By default, Kali Linux distribution comes pre-installed with a terminal which is known as the GNOME terminal. In case you are equipped with some specific terminal, and Kali Linux supports the same terminal user can execute the below command to install the terminal.
sudo apt-get install <terminal name>
Once the terminal is installed, it will appear as an application, and the user can go to the application tab and click on the terminal to open it. Once the terminal is open, it might take a few seconds to make it available for working.
Uses of Commands in Terminal with Examples
Here we will look at the different commands being used in terminals, their uses and examples for hands-on experience to the readers.
In general, commands are broadly divided into 5 different categories.
- General
- Manipulation
- Reading
- Editing
- Permission
We would go through each of the categories one by one and look at various widely used commands within the categories.
1. General
- uname: This command enables a user to understand the system specifications. This command is like the first of the commands for a newbie to start familiarizing oneself to Kali Linux.
Code:
uname
Output:
- pwd: This command allows the system to provide the name of the working directory and print it on the console.
Code:
pwd
Output:
- ls: This command shows the list of contents that are contained in the directory the current command line is pointed to. There are various options available with this command which details a particular format using a particular option.
Code:
ls -l
Output:
- history: In a terminal session, it sometimes is inadvertently required to re-use the commands entered earlier, and this command will allow you to list all of those commands.
Code:
history
Output:
- macchanger: This command enables a user to change the system’s MAC address, essentially changing the system’s identity in the arena of a network.
Code:
macchanger --help
Output:
- ifconfig: This command enables users to view the current network configuration and change as required by the user.
Code:
ifconfig
Output:
- cat: This command enables users to read files and then link them together, allowing exchanging, grepping of contents.
Code:
cat --help
Output:
2. Manipulation
- mkdir: This command enables a user to create a directory under the current directory where the command is executed.
Code:
mkdir tf1
mkdir tf2
ls -l
Output:
Initially, there is no directory when we perform ls, but later you see 2 folders (tf1 and tf2) getting formed.
- cd: This command allows the user to change to another directory where other manipulation activities are expected to be performed.
Code:
cd tf1
pwd
Output:
- cp: This command allows users to copy a file from one location to another. In the below snip, we see that the sample1.txt is moved to a new location “tf1”.
Code:
ls tf1/
cp sample.txt tf1/
ls tf1/
Output:
- mv: In contrast to copying a file, this command moves the file from one location to another. Here in the below snip, we see that the sample3.txt moves from the current location to tf1 after the mv command is executed.
Code:
mv sample3.txt tf1/
ls tf1/
Output:
- rm: This command enables a user to manipulate files or directories by removing them as per the command. In the below snip, the sample1.txt file gets removed from the current location.
Code:
rm sample1.txt
ls
Output:
3. Reading
- more: This command enables the user to understand the contents of a file from a bird’s eye view.
Code:
more sample3.txt
Output:
- less: Very similar to the more command, except the fact that it doesn’t load the file.
Code:
less sample3.txt
Output:
- sort: This command allows users to sort the content in an orderly arrangement. In the below snip, the sentences are arranged alphabetically when the sort command is executed.
Code:
sort sample3.txt
Output:
4. Editing
- vi: This command enables the user to open the file in a text editor for editing purpose.
Code:
vi sample.txt
Output:
- nano: Similar to the vi command, it also opens a file in a text editor, but the application of text editor is a different one.
Code:
nano sample1.txt x
Output:
- leafpad: Again, a similar one to vi and nano, this command opens the file in a simple GTK+ text editor, very similar to editors in windows.
Code:
leafpad sample1.txt
Output:
5. Permission
Before we see about the command in this section, we would need to know the access available with not only Kali Linux but also any Linux distribution.
The 3 levels of access are:
- Read: This level allows the user to open and read a file. For the directory, users can view the contents.
- Write: This level allows the user to open, read and even edit a file. For the directory, users can view, create and rename contents in the directory.
- Execute: This level allows the execution of a file in addition to read and write.
Now, the following performs the changes regarding the permission.
- chmod: This command is an acronym for change mod. In accordance to a particular level for different groups of users, the contents can be restricted by mentioning the r/w/x. In the below snip, we see that using chmod +x; we give executing access to the user group! See the change from -rw-r- to -rwxr-
Code:
chmod +x sample1.txt
ls -l
Output:
- chown: This command allows the user to change the owner of the file or directory and, in addition, has a utility very similar to chmod. In the below snip, notice the change in user owner from root to AmKy.
Code:
chown Amky sample1.txt
ls -lh
Output:
Conclusion
This article has a flavor of what terminal means in Kali Linux and what different utilities the terminal caters to. There are varieties of terminals, and users are free to use one of their choices. Though Kali Linux can be very intimidating for newcomers, having a good grip on these basics will come in handy while performing some cool stuffs with Kali Linux.
Recommended Articles
We hope that this EDUCBA information on “Kali Linux Terminal” was beneficial to you. You can view EDUCBA’s recommended articles for more information.