0. pwd

pwd stands for Print Working Directory. This command returns the path of the current working directory, starting from the root.



1. ls

ls stands for List. This command returns the contents of the specified directory. If no specific directory is specified, then it returns the list of content in the current working directory.

/Users/Pralabh/Desktop$ ls

myfile.txt sample.txt 

2. clear

This clear command is used to clear the terminal screen.

$ clear

3. exit

This exit command is used to exit from the terminal and close it where it is currently running.

$ exit

After pressing enter with exit command, the terminal will be closed.

4. mkdir

This command mkdir stands for Make Directory. This command is used to create a new directory.

/Users/Pralabh/Desktop$ ls

myfile.txt sample.txt

Here, we can see that we have two files in our current working directory. Now, we will create a new directory using mkdir command.

/Users/Pralabh/Desktop$ mkdir directory // creating a new directory

/Users/Pralabh/Desktop$ ls

myfile.txt sample.txt

A new directory named directory has been created.

5. rm

This command rm stands for remove. This command is used to remove/delete files from the given path/directory.

$ ls

file1.txt file2.txt file3.txt file4.txt

#Using rm to remove file3.txt

$ rm file3.txt 

$ ls

file1.txt file2.txt file4.txt

We can also remove multiple files using this command

$ ls

file1.txt file2.txt file3.txt file4.txt

#Using rm to remove file3.txt

$ rm file3.txt file2.txt

$ ls

file1.txt file4.txt

6. rmdir

This rmdir command is used to remove an empty directory from the filesystem. This command removes every directory specified in the commend, given that the directory is empty.

$ ls

dir1 dir2 dir3

#Removing directory dir2

$ rmdir dir2

$ ls

dir1 dir2

If the specified directory contains some file or subdirectory, then it can not be simply removed with rmdircommand.

7. cd

This command cd stands for Change Directory. This command is used to change the current working directory.

$ pwd


#Using command to change directory

$ cd Desktop/python



8. chmod

This command chmod used to change the access mode of the specified file.


$ chmod [reference][operator][mode] filename

9. mv

This command mv is used to move files from one directory to another directory in the file system.

#Moving file1.txt to Desktop

$ mv file1.txt Desktop/file1.txt

$ cd Desktop

$ ls


This command is also used to rename the file, if you try to move the file within the same directory, it will be renamed.

$ ls

file1.txt sample.txt 

#Renaming file1.txt to renamed.txt

$ mv file1.txt renamed.txt

$ ls

renamed.txt sample.txt 

10. cp

This command cp stands for Copy. This command is used to copy files or directories from one place to another place.

Syntax: cp [option] Source Destination

$ cp file1.txt Desktop/file1.txt

$ cd Desktop

$ ls


11. Jumping in the Command Line

What happens when you made a typo at the beginning, the middle or the end of a big line. Well, you have to press the arrow key endlessly to get there. These keyboard shortcuts will let you get there quicker.

ctrl-a : moves the cursor to the beginning of the line. This is similar to pressing the Home button on the keyboard.

ctrl-e : moves the cursor to the end of the line. This is similar to pressing the End button on the keyboard.

alt-f : moves the cursor forward one word (same as pressing ctrl + right arrow).

alt-b : moves the cursor forward one word (same as pressing ctrl + right arrow).

ctrl-t : swaps the current character under the cursor with the one preceding it. This can be useful to correct typos very quickly!

12. Search Bash History

Bash keeps a record of the commands we enter inside an actual file at: ~/.bash_history 

You can view the file inside your home directory and can scroll through the history one command at a time using the up and down arrows. We can also use the history command to view the entire history. But generally, it is easier to manage if we pipe the output to less.

Reverse-i-search (ctrl-r) : As you are typing the bash will start searching the history and populate the closest matching command executed recently. You can also press ctrl-r to search for the next matching command in recent history.

Things to do after Downloading Kali :

  • Install Git: An open-source software version control application. It can be used for collaboratively sharing and Editing Code / Cloning Repositories

apt-get install git

  • Install Terminal Multiplexer: A multiplexer is a tiling terminal emulator that allows us to open several terminal sessions inside one single window. The major benefit to this is being able to see all of our open terminal sessions at once and not layer the windows on top of each other.

apt-get install tilix