Linux bash command line cheat sheet for beginners

Linux bash command line cheat sheet for beginners

Damn, it’s frustrating task to refresh your knowledge of the shell. searching for the specific command that you need in a book is not an easy task.Following is the quick and dirty cheatsheet of frequently used commands in a shell,


1> clear (clears the terminal screen)

2> cp (source location) (destination location) [Copy the files from one place to another]

cp /root/Desktop/file.txt /root/etc/dhcp

source location = /root/Desktop/file.txt
destination location = /root/etc/dhcp


3> cd (initial folder/directory) (final folder/directory) [change directory]
cd /etc/dhcp
changes the working directory to dhcp directory.the working directory means the directory in which you are performing tasks.

4>mkdir folder (creates a new folder)
example mkdir pawan

5>ls [lists directory or shows you the files of a folder]

6>history [shows you all the commands you typed]

7> rmdir folder [deletes a folder]
rm pawan

8> cat file1 file2 [combines two text files contents and shows in a single one]
cat hackers.txt hackers1.txt

9> vi file.txt [opens the text files in a program like notepad in windows]

10> bash [executes a script file]

11> apt-get [install a package from internet]
apt-get install isc-dhcp-server

12> wget url [download a file from internet ]
example wget

13> service network-manager stop [stops the network manager i.e the process to connect to the internet]
(used for evil twin process)
service network-manager start/restart [starts the stopped network manager]

14> service process start/stop [starts or stops a required processes]
service apache2 start
service mysql start
service postgresql start
service metasploit start

15>ifconfig [dislay the network information such as ip address,mac address etc]

16> –help
search help of a program if confused about commands

17> less textfile [display text file contents]
example less /root/Desktop/hacked.txt

18>touch file [create a file]
example touch /var/www/website

19>leafpad text.txt [same as vi but easier interface]
example leafpad /etc/config.txt

20>chmod 777 file or folder [change file permissions / change read and write facility]
example chmod 777 /var/www/*.*

21>pwd [displays your present directory that you are working on]
example pwd

22>alias [put a small nickname of lenghty commands]
example alias c=’cp /var/www/index.html /root/Desktop’

when you hit c in terminal it will execute that long commands.

23>gcc -o outputfilename source.c [compile c programs]
example:- gcc -o sum sum.c

24>nasm -f elf example.asm [assemble assembly programs in nasm ]
ld -o outputfilename example.o [add the linker to generate executables]
example:- nasm -f elf sum.asm
ld -o sum sum.o
to execute the program ./sum


Leave a Reply

Your email address will not be published.Required fields are marked *