-
cd - Change directory
cd /home/user/Documents- changes the current directory to /home/user/Documents. -
ls - List directory contents
ls- lists the contents of the current directory.ls /home/user/Documents- lists the contents of the directory /home/user/Documents. -
pwd - Print working directory
pwd- prints the current working directory. -
mkdir - Make directory
mkdir new_directory- creates a new directory named new_directory. -
rmdir - Remove directory
rmdir old_directory- removes the directory named old_directory if it’s empty. -
touch - Create a file
touch new_file.txt- creates a new file named new_file.txt. -
cat - Concatenate and print files
cat file.txt- prints the contents of file.txt to the terminal. -
cp - Copy files or directories
cp file.txt /home/user/Documents- copies file.txt to the directory /home/user/Documents. -
mv - Move or rename files or directories
mv file.txt new_file.txt- renames file.txt to new_file.txt.mv file.txt /home/user/Documents- moves file.txt to the directory /home/user/Documents. -
rm - Remove files or directories
rm file.txt- removes file.txt from the current directory.rm -r directory- removes directory and all its contents recursively. -
chmod - Change file permissions
chmod 755 file.txt- sets the file permission for file.txt to read, write, and execute for the owner, and read and execute for others. -
chown - Change file ownership
sudo chown user:group file.txt- changes the ownership of file.txt to user and the group to group. -
ps - Show current processes
ps- displays a list of the current processes running in the terminal. -
top - Show system processes and resource usage
top- displays a dynamic real-time view of the processes currently running in the system. -
kill - Send a signal to terminate a process
kill process_id- terminates the process with the specified process_id. -
sudo - Run a command with elevated privileges
sudo apt-get update- runs the commandapt-get updatewith elevated privileges. -
su - Switch to another user account
su - user- switches to the user account named user. -
ping - Check network connectivity
ping google.com- sends a ping request to google.com to check network connectivity. -
traceroute - Trace the route taken by packets through an IP network
traceroute google.com- displays the route taken by packets through the IP network to reachgoogle.com. -
ifconfig - Show network interface configuration
ifconfig- displays the configuration details of all the network interfaces in the system. -
netstat - Show network status
netstat- displays the current network connections and their status. -
iptables - Configure firewall rules
iptables -L- lists all the current firewall rules. -
wget - Download files from the web
wget http://example.com/file.zip- downloads the filefile.zipfrom the web. -
curl - Transfer data from or to a server
curl http://example.com/api- sends an HTTP GET request toexample.com/apiand displays the server’s response. -
ssh - Connect to a remote server securely
ssh user@remote_server- connects toremote_serverasuser. -
scp - Securely copy files between hosts
scp file.txt user@remote_server:/home/user- copiesfile.txttoremote_server’s/home/userdirectory. - tar - Archive files and directories
tar -cvf archive.tar file.txt- creates a new tar archivearchive.tarcontainingfile.txt.
- gzip - Compress files
gzip file.txt- compressesfile.txtand renames it tofile.txt.gz.
- unzip - Extract files from a ZIP archive
unzip archive.zip- extracts all the files from the ZIP archivearchive.zip.
- find - Search for files and directories
find /home/user -name file.txt- searches for the filefile.txtin the directory/home/userand its subdirectories.
- grep - Search for a pattern in a file
grep 'error' log.txt- searches for the word ‘error’ in the filelog.txt.
- sed - Stream editor for filtering and transforming text
sed 's/old_text/new_text/g' file.txt- replaces all occurrences ofold_textwithnew_textinfile.txt.
- awk - Text processing and data extraction
awk '{print $1}' file.txt- prints the first column offile.txt.
- echo - Print a message to the terminal
echo 'Hello World!'- prints ‘Hello World!’ to the terminal.
- date - Display or set the system date and time
date- displays the current system date and time.
- cal - Display a calendar
cal- displays a calendar of the current month.
- history - Display the command history
history- displays the list of commands executed in the terminal.
- du - Estimate file space usage
du -h file.txt- displays the disk usage offile.txtin human-readable format.
- df - Show disk usage and free space
df -h- displays the disk usage and free space of all the mounted filesystems in human-readable format.
- free - Display system memory usage
free -h- displays the system memory usage in human-readable format.
- uname - Display system information
uname -a- displays all the system information, including the operating system, kernel version, and hardware architecture.
- whoami - Display the current user
whoami- displays the name of the current user.
- id - Display user and group information
id- displays the user and group information of the current user.
- passwd - Change user password
passwd- changes the password of the current user.
- useradd - Create a new user account
sudo useradd newuser- creates a new user account namednewuser.
- usermod - Modify user account
sudo usermod -aG groupname username- adds the userusernameto the groupgroupname.
- userdel - Delete a user account
sudo userdel username- deletes the user accountusername.
- groupadd - Create a new group
sudo groupadd newgroup- creates a new group namednewgroup.
- groupmod - Modify a group
sudo groupmod -n newname oldname- renames the groupoldnametonewname.
- groupdel - Delete a group
sudo groupdel groupname- deletes the group namedgroupname.