2/25/24, 11:39 PM Revolutionizing the Job Market | NxtWave
Kali Linux OS Commands
Common Terminal Commands
To print the current working directory(folder) you are in, use pwd command.
1 pwd
To view the files present in a directory (also called contents of a directory), use ls command.
1 ls
To navigate from one directory to another, use cd command.
Syntax:
cd <directory path>
1 cd /home/kali/Desktop/
To navigate to the parent directory
1 cd ..
To find the manual on how to use a particular command/tool, use man command.
https://learning.ccbp.in/course?c_id=8185622d-17a1-4f7a-9439-c3004f499db2&t_id=39ede1f3-cb3e-4b99-aa03-6e45557443ef&s_id=0b974725-d453-4583-880b-3d7815b9e9a1 1/7
2/25/24, 11:39 PM Revolutionizing the Job Market | NxtWave
Syntax:
man <command name>
1 man ls
Note: Press
q to Quit
Users
To shift from normal user to the root(admin) user, use sudo command.
1 sudo su
To see the current user logged into the system, use whoami command.
1 whoami
To find out user and group information (such as names and numeric IDs (UID or group ID) of the current user or any other user in the system, use id command.
1 id
Note: Make sure to exit the root user using
exit command before procedding with further sections.
Directories and Files
https://learning.ccbp.in/course?c_id=8185622d-17a1-4f7a-9439-c3004f499db2&t_id=39ede1f3-cb3e-4b99-aa03-6e45557443ef&s_id=0b974725-d453-4583-880b-3d7815b9e9a1 2/7
2/25/24, 11:39 PM Revolutionizing the Job Market | NxtWave
Creating Directories and Files
To create a directory, use mkdir command.
Syntax:
mkdir <directory name>
1 mkdir testdirectory
Copying and Renaming Directories and Files
To copy the contents of a file to another file or to copy the file into a directory, use cp command.
Syntax:
cp source_file destination_file
1 cp /usr/share/wordlists/fastrack.txt mylist.txt
2 cp /usr/share/metasploit-framework/data/wordlists/unix_users.txt users.txt
To copy the one or more files into a directory
Syntax:
cp src_file src_file2 dest_directory
1 cp mylist.txt users.txt testdirectory/
To rename a file/directory, use mv command.
Syntax:
mv src_file dest_file
1 mv mylist.txt newlist.txt
https://learning.ccbp.in/course?c_id=8185622d-17a1-4f7a-9439-c3004f499db2&t_id=39ede1f3-cb3e-4b99-aa03-6e45557443ef&s_id=0b974725-d453-4583-880b-3d7815b9e9a1 3/7
2/25/24, 11:39 PM Revolutionizing the Job Market | NxtWave
y
To move a file into a directory, use mv command.
Syntax:
mv src_file dest_directory
1 mv users.txt testdirectory/
Removing Directories and Files
To remove a file from the current directory, use rm command.
Syntax:
rm <filename>
1 rm testdirectory/users.txt
Locating the Directories and Files
To locate a file, use locate command.
Syntax:
locate <filename>
1 locate wordlists
To find files and directories and perform subsequent operations on them, use find command.
Syntax:
find [directory to search] -name <filename>
https://learning.ccbp.in/course?c_id=8185622d-17a1-4f7a-9439-c3004f499db2&t_id=39ede1f3-cb3e-4b99-aa03-6e45557443ef&s_id=0b974725-d453-4583-880b-3d7815b9e9a1 4/7
2/25/24, 11:39 PM Revolutionizing the Job Market | NxtWave
1 find ./Debug -name sample.txt
Viewing and Editing Files from the Command Line
To view the contents of a file, use cat command.
Syntax:
cat <filename>
1 cat newlist.txt
To make small changes to an existing file or to write to a new text file, use nano command.
Syntax:
nano <filename>
1 nano newlist.txt
Note: Press
CTRL + X to exit and then press Y to Save and N to Not Save.
File Manipulation / Extracting Specific Information
To search a file for a particular pattern of characters, and displays all lines that contain that pattern, use grep command.
Syntax:
grep 'pattern' <filename>
1 grep "ball" newlist.txt
https://learning.ccbp.in/course?c_id=8185622d-17a1-4f7a-9439-c3004f499db2&t_id=39ede1f3-cb3e-4b99-aa03-6e45557443ef&s_id=0b974725-d453-4583-880b-3d7815b9e9a1 5/7
2/25/24, 11:39 PM Revolutionizing the Job Market | NxtWave
Stopping a Command
To stop a command during its runtime
1 Press CTRL + C
Web
Downloading Files
To find out your Public IP address(System IP that is connected to Internet)
www.whatismyipaddress.com
To download the files from the web via command line(from web servers using HTTP, HTTPS and FTP protocols), use wget command.
Syntax:
wget <link to the file>
1 wget https://download.virtualbox.org/virtualbox/6.1.18/Oracle_VM_VirtualBox_Extension_Pack-6.1.18.vbox-extpack
To transfer data to or from a server, use the curl command.
Syntax:
curl <link to the file> --output <specify filename>
1 curl www.example.com/1.zip --output file.zip
https://learning.ccbp.in/course?c_id=8185622d-17a1-4f7a-9439-c3004f499db2&t_id=39ede1f3-cb3e-4b99-aa03-6e45557443ef&s_id=0b974725-d453-4583-880b-3d7815b9e9a1 6/7
2/25/24, 11:39 PM Revolutionizing the Job Market | NxtWave
Network
To display current network configuration information such as IP Address, MAC Address, use ifconfig command.
1 ifconfig
To check the network connectivity between host and server/host, use the ping command.
Syntax:
ping <IP address or URL>
https://learning.ccbp.in/course?c_id=8185622d-17a1-4f7a-9439-c3004f499db2&t_id=39ede1f3-cb3e-4b99-aa03-6e45557443ef&s_id=0b974725-d453-4583-880b-3d7815b9e9a1 7/7