Basic Linux commands
date
- This command is used to display the system date and time. This information can be useful at times while writing scripts as well
command for displaying system date and time
cal
- This command displays the current month's formatted calender on the terminal screen
command for calender
- cd command is also called as
chdir
which stands for change directory. We use this command to change or switch the currentt working directory. We can also navigate to directories by specifying absolute path from root directory
command for changing directory
- cp command is used to copy files or group of files or directories that create an exact image of a file on a disk with a different file name. We specify the path for the source files and the destination path where we want to have a copy of source files or directories
command for copying files and directories
whoami
and who
whoami
command is used to print the effective user ID whereas the who
command prints information regarding users who are presently logged in.
command for displaying logged in users and current logged in user.
- ls command lists the current directory's files and directories along with the file types. We can modify the behavior of ls command by providing options like -l which shows the file permissions as well
command for listing files and directories
cat
- cat command can be used to concatenate files and view the contents of a file in the terminal window as standard output
command for viewing contents of files
- This command is used to delete files
command for removing files
mkdir
- mkdir command is used to create a new directory inside the current working directory
command for making directories
- mv command can be used to move files or directories from source directory to destination directory in our file system. mv command can also be used to rename files as well
command for moving files and directories
uname
- uname command displays the current system's information. So when we type uname, we get the output as Linux which is the kernel for Kali Linux. With the uname -a, we can learn more about our system including kernel name, node name, kernel release, kernel version, hardware platform, processor and OS
command for system information
uptime
- uptime command displays the amount of time the system has been running
command for shwoing uptime of system
users
- this command is used to display the login names of users logged in on the system
command for all the logged in users on system
less
- this command is used to view files instead of opening the file. The less command is a more powerful variant of the "more" command which is used to show information one page at a time to the terminal
command for viewing files, a better variant of more command
free
- command provides us the useful information about the amount of RAM available on a Linux machine. It also displays the entire amount of physical memory used and available space, as well as swap memory with kernel
buffers
command for showing info on memory space
more
- command permits us to show output in the terminal one page at a time. This is particularly beneficial when using a command that requires a lot of scrolling
command for viewing file contents one page at a time
sort
- We can sort the contents of file line by line. This command is useful when we have many lines of text in our file and we want to sort them in ascending or descending manner and write them to the standard output
command for sorting content of files line by line
history
- This command prints the history of all the commands that have been entered by the current user.
command for showing command history
pwd
- This command prints the current working directory, so if you are in root dir then it prints / and if you are in some other dir, then it prints the current working directory path from root.
command for printing current dirctory path
man
- This command is used to display the user manual for all the commands in Linux. It includes the shell command the detailed synopsis with a short description about the command. The good thing about this is, we can view all the options which can modify the behavior of a command
command for user manual
echo
- This command requires any text as arguments, so that it prints it in the terminal. We can provide a text as a argument, or some other value to print as standard output. This command is useful for debugging shell programs
command for printing text in terminal as standard output
wget
- This command downloads applications and web pages directly from the web. We provide a url on the web and this command downloads the specified resource, it can be a html file or a application
command for downloading files
tree
- This command shows all of the contents in the current working directory. So the list of contents contains all of the files and folders and sub folders and their files as well. It does show all of the contents in the working directory in a nicely formatted tree format.
command for showing file structure in tree format
grep
- This command searches files and prints the lines that match patterns. So we can provide a pattern such as a word, and grep command would search the file for the provided word and prints the lines in the file that contains the given word
command for searching files using a pattern and printing the lines that match the pattern
- wc command stands for word count. It shows the number of lines, words, characters and bytes.
command for counting word count
unzip
- This command is used to extract files i.e unzip files from zip file.
command for unzipping zip files
- du command is used to display the amount of disk space used by files and directories. So it shows how much space is being used in the disk space by each file and directory.
command for displaying amount of disk space used by files and directories
passwd
- Command used to change the user password
command for changing password for user account
macchanger
- macchanger changes your mac address, essentially changing your identity. It helps with protecting your anonymity on the internet, making your IP untraceable.
command for changing mac address
ifconfig
- ifconfig
<=>
interface configuration. can be used for network interface configuration. It shows information about all the network adaptors, and we can also configure the network interface, like changing the IP address.
command for viewing and configuring network interfaces
ping
- used to troubleshoot devices present in the network. it works by sending ICMP packets to the destination device which sends back response packets as well. The output shows the information about the packets sent and received and the time interval as well
command for testing network connectivity
nslookup
- used to find the IP address of a domain or sub domain. So we provide the url as the argument and nslookup is going to provide us the IP of that domain
command for finding IP of a domain
- This command gives the details of all networks like ifconfig.This command can also be used to get the details of a specific interface.
command for displaying info on all networks interfaces.
route
- Linux route command displays and manipulates the routing table existing for your
system.A router is basically used to find the best way to send the packets across to a
destination
command for viewing and configuring kernel routing file
host
- Linux host command displays the domain name for a given IP address and IP address for a given hostname. It is also used to fetch DNS lookup for DNS related query.
command for displaying IP for given hostname
arp
- Linux arp command stands for Address Resolution Protocol. It is used to view and add content to the kernel's ARP table.
command for viewing and configuring kernel's ARP table
iwconfig
- Linux iwconfig is used to configure the wireless network interface. It is used to set and view the basic WI-FI details like SSID and encryption. Just like we have ifconfig, iwconfig is also used to view and configure network interfaces, but only for wireless adaptors.
command for viewing and configuring wireless network interfaces
hostname
- Linux hostname is the simple command used to view and set the hostname of a system.
command for viewing and setting hostname of system
whois
- Linux whois command is used to fetch all the information related to a website. You can get all the information about a website including the registration and the owner information.
command for fetching information about a website or domain.