March 29, 2022
In our this article we are going to cover the basic uses of Terminal window on Kali Linux. Hence Kali Linux comes with GUI, but terminal is the most powerful thing on Linux systems. There are lots of terminal tools we need to use during security testing, so we need to learn at least the basics of terminal.
Let’s learn some basics of terminal. We can work on text based things using terminal window. We can write commands, then press Enter ⤶ key to run/execute the command. Sometime things are messed up then we need to clear the terminal using clear command or CTRL+L to clear the terminal. To open a new terminal window from our current terminal session CTRL+SHIFT+T.
To complete the command or the filename on terminal we can press the TAB key. If there are some files starting with same name then whenever we press TAB key it will display all the options in place. We should open our terminal window and practice these things while reading this article.
For an example we have two files with same name at starting test.sh and test.txt on our home directory. When we press the TAB key then we can see that we got the both options, as we can see in the following screenshot:
If we run a command and then we need to stop it’s execution we need to press CTRL+C key combination. To close the terminal window we can press CTRL+D key combo or use exit command.
We can also shut down and restart our system using terminal window. To shut down our system we need to use poweroff and for restart we need to use reboot command with root privilege.
To check our recently used commands on terminal we can use history command, and to use any command used before (reverse command search) we can use CRTL+R and then type the part of the command then terminal will suggest the command. As we can see in the following screenshot:
CTRL+R, then we just type his and it suggest history |
Not only in Kali Linux, Linux in general we need to understand there are lots of redirections in terminal window. For an example we have to write our file list (ls) output on a text (txt) file e need to run following command:
We can see the output in the following command:
Using the above command we save the output of ls command on a text file and provide the text file a name (ls-list.txt), and we redirected the output by using a > (grater than) character.
We also do the opposite by redirecting (printing using cat) the text file contents into the terminal window by using the < (less than) character.
There is another redirection we need to know is the command pipe. In short, we can combine the output of each command and use it on next command using | character.
For an example we need to read a file then short the results and finally use grep command to filter out some text strings. Here we are going to extract files starting with ‘test.‘. So we need to use following commands combining with |
We can see in the output in the following screenshot:
Basic Kali Linux Commands
Now, let’s drive into Kali Linux usage and explore some basic Kali Linux (Linux, in general) commands.
Man Pages
Most of the executable programs on the Linux command line contains a formal piece of documentation is called manual pages or
We can see in the top of the above screenshot that ls is ‘User Command’. Man pages are organized by dividing into various sections as following: To know more about a command we can search a keyword. For example, we need to learn about the file format of /etc/passwd file. We can apply following command to learn more about this: The above command will show information about passwd command as we can see in the following screenshot:
Exploring the manuals for the ls command using man
Also we can use -k flag with man to do a keyword search.
We can see the output on the following screenshot:
We also can filter out the search by using
We can now look at the exact passwd manual page (5) we are interested in by referencing the appropriate section:
Man pages are usually the quickest way to learn more about a Linux command. So we need to take some time and explore the man pages.
Apropos
By using
Check that apropos have similar output like man -k, in fact both are the same.
List
The ls command prints a basic file listing on the directory to the terminal window. We can modify the output results with various flags. Like -a flag is used to display all files (including hidden files) and the -1 option displays each file on a single line, which is very useful for automatic scripts.
Change Directories
Linux does not use Windows-style drive letters (C:). Here, all files, folders, and devices are baby of the root directory, represented by the / character (see our