Basic Commands
- pwd - Print the current working directory
pwd
- ls - List directory contents
ls
- cd - Change the current directory
cd <directory_path>
- mkdir - Create a new directory
mkdir <directory_name>
- rm - Remove files or directories
rm <file_name>
- cp - Copy files or directories
cp <source> <destination>
- mv - Move files or directories
mv <source> <destination>
- cat - Concatenate and display files
cat <file_name>
- grep - Search for patterns in files
grep <pattern> <file_name>
- echo - Display a line of text
echo "Hello, World!"
File and Directory Management
- chmod - Change file permissions
chmod <permissions> <file_name>
- chown - Change file ownership
chown <user>:<group> <file_name>
- tar - Archive files
tar -cvf <archive_name>.tar <file_or_directory>
- gzip - Compress files
gzip <file_name>
- find - Search for files in a directory hierarchy
find <directory_path> -name <file_name>
- locate - Find files by name
locate <file_name>
System Information and Monitoring
- top - Display Linux processes
top
- free - Display amount of free and used memory in the system
free -h
- df - Display disk space usage
df -h
- du - Estimate file space usage
du -h <directory_path>
- uname - Display system information
name -a
Networking
- ifconfig - Configure network interfaces
ifconfig
- ping - Send ICMP ECHO_REQUEST to network hosts
ping <host_name_or_ip>
- netstat - Display network connections, routing tables, and more
netstat -a
- ssh - Connect to a remote machine securely
ssh <user>@<host_name_or_ip>
- scp - Securely copy files between hosts
scp <file_name> <user>@<host_name_or_ip>:<destination_path>
Text Processing
- sed - Stream editor for filtering and transforming text
sed 's/old_text/new_text/g' <file_name>
- awk - Pattern scanning and text processing language
awk '{print $1}' <file_name> - sort - Sort lines of text files
sort <file_name>
- uniq - Report or omit repeated lines
uniq <file_name>
- cut - Remove sections from each line of files
cut -d' ' -f1 <file_name>
Advanced Commands
- cron - Schedule tasks to run at specific times
crontab -e
- rsync - Remote file synchronization
rsync -avz <source> <destination>
- iptables - Linux firewall configuration
iptables -L
- lsof - List open files
lsof -i
- strace - Trace system calls and signals
strace <command>