Basic Linux Command

It is important to learn Linux command as a penetration tester since it helps you get your job done faster and you will be working usingTerminal most of the time. So in this week’s post, I’m going to share some basic Linux command that I find useful to use in Terminal.

File Commands

ls – directory listing
✽ ls -al – formatted listing with hidden files
✽ cd directory_name – change directory to directory_name
✽ cd –  change directory to home
cd ..  –  move you up one directory
✽ mkdir directory_name – create a directory called directory_name
 rm file_name – delete file_name
rm * – removes all files in the specified directory
✽ rm -r directory_name – delete directory directory_name
✽ rm -f file_name – force remove file_name
✽ mv file1 file2 rename or move file1 to file2. If file2 is an existing directory, moves file1 into directory file2.
cp file1 file2 – copy file1 to file2
cp -r directory1 directory2 – copy directory1 to directory2; create directory2 if it doesn’t exist.

System Info

whoami – who you are logged in as

Text Editor Command

These are the commands that can be used to open a text editor to write a new file or edit an existing file.

nano file_name
leafpad file_name
gedit file_name

Network Commands

ping host – ping host and output results
whois domain – get whois information for domain
dig domain – get DNS information for domain
wget file_download_url – download a file from an online source

Compression Commands

unzip zipped_filename –  decompress a file with .zip extension
zip zipped_file file1 file2 file3 –  compress file1, file2, and file3 into a file named
zip -r zipped_file directory_name  –  compress directory_name into a file named


We can run several commands in Linux terminal by usingbetween each command.

Example: echo 1 ; echo 2