Certainly! Here are 20 commonly used Linux commands with brief explanations:
ls: Lists the contents of a directory. Example:
ls -l
displays the contents in a detailed list format.cd: Changes the current working directory. Example:
cd /home/user
changes the directory to /home/user.pwd: Prints the current working directory.
mkdir: Creates a new directory. Example:
mkdir new_directory
creates a directory named new_directory.rm: Removes files or directories. Example:
rm file.txt
removes the file named file.txt.cp: Copies files and directories. Example:
cp file1 file2
copies file1 to file2.mv: Moves or renames files and directories. Example:
mv file1 file2
moves file1 to file2.cat: Displays the contents of a file. Example:
cat file.txt
displays the contents of file.txt.grep: Searches for a specific pattern in files. Example:
grep pattern file.txt
searches for the pattern in file.txt.chmod: Changes the permissions of files and directories. Example:
chmod 755 file.txt
changes the permissions of file.txt.chown: Changes the owner of files and directories. Example:
chown user:group file.txt
changes the owner and group of file.txt.tar: Archives files into a tarball. Example:
tar -cvf archive.tar file1 file2
creates an archive named archive.tar containing file1 and file2.gzip: Compresses files. Example:
gzip file.txt
compresses file.txt into file.txt.gz.gunzip: Decompresses files. Example:
gunzip file.txt.gz
decompresses file.txt.gz into file.txt.ps: Displays information about running processes. Example:
ps aux
shows a detailed list of all processes.kill: Terminates processes. Example:
kill PID
terminates the process with the specified PID.top: Displays real-time system information. Example:
top
shows a dynamic view of system processes and resource usage.df: Shows disk space usage. Example:
df -h
displays disk space usage in a human-readable format.du: Displays disk usage of files and directories. Example:
du -sh directory
shows the total disk usage of the directory in a human-readable format.free: Shows system memory usage. Example:
free -m
displays memory usage in megabytes.
ssh: Allows secure remote access to a server. Example:
ssh user@hostname
connects to the server with the specified username and hostname.scp: Securely copies files between different hosts. Example:
scp file.txt user@remotehost:/path
copies file.txt to the specified path on the remote host.wget: Downloads files from the internet. Example:
wget
http://example.com/file.txt
downloads file.txt from the specified URL.curl: Transfers data from or to a server. Example:
curl -O
http://example.com/file.txt
downloads file.txt from the specified URL.tail: Displays the last part of a file. Example:
tail -n 10 file.txt
shows the last 10 lines of file.txt.head: Displays the first part of a file. Example:
head -n 10 file.txt
shows the first 10 lines of file.txt.find: Searches for files in a directory hierarchy. Example:
find /path -name "file.txt"
searches for file.txt in the specified path.locate: Finds files by name. Example:
locate file.txt
locates file.txt on the system.date: Displays the current date and time. Example:
date
shows the current date and time.cal: Displays a calendar. Example:
cal 2023
shows the calendar for the year 2023.echo: Displays a line of text. Example:
echo "Hello, World!"
prints Hello, World! to the terminal.history: Shows a list of previously executed commands. Example:
history
displays the command history.man: Displays the manual page for a command. Example:
man ls
shows the manual page for the ls command.alias: Creates an alias for a command. Example:
alias ll='ls -l'
creates an alias ll for the ls -l command.df: Displays disk space usage. Example:
df -h
shows disk space usage in a human-readable format.du: Shows disk usage of files and directories. Example:
du -sh directory
shows the total disk usage of the directory in a human-readable format.free: Shows system memory usage. Example:
free -m
displays memory usage in megabytes.uptime: Displays how long the system has been running. Example:
uptime
shows the system uptime.ifconfig: Displays network interface configuration. Example:
ifconfig
shows the network interface configuration.netstat: Shows network connections, routing tables, interface statistics, and more. Example:
netstat -tuln
displays active network connections.