The 50 Essential Linux Commands Every Expert Should Know
Master the most important Linux commands. A complete guide with practical examples and use cases for system administrators.
InSkillCoach
The 50 Essential Linux Commands Every Expert Should Know
Whether you’re a beginner system administrator or a seasoned Linux expert, mastering these essential commands is crucial for using your system efficiently. In this complete guide, we’ll explore the most important commands with practical examples.
1. Navigation and File Management
ls - List files
# Simple list
ls
# Detailed list
ls -la
# List with human-readable sizes
ls -lh
# List sorted by date
ls -lt
cd - Change directory
# Go to a directory
cd /chemin/vers/dossier
# Go back to the parent directory
cd ..
# Go back to the home directory
cd ~
pwd - Print the current directory
# Print the full path
pwd
# Print the physical path
pwd -P
2. File Management
cp - Copy files
# Simple copy
cp source.txt destination.txt
# Recursive copy
cp -r dossier_source dossier_dest
# Copy while preserving attributes
cp -p source.txt destination.txt
mv - Move files
# Simple move
mv source.txt destination.txt
# Move with backup
mv -b source.txt destination.txt
rm - Delete files
# Simple deletion
rm fichier.txt
# Recursive deletion
rm -r dossier
# Forced deletion
rm -f fichier.txt
3. Process Management
ps - List processes
# List all processes
ps aux
# List the user's processes
ps -u $USER
# Formatted list
ps -ef
top - Process monitor
# Simple launch
top
# Launch sorted by CPU
top -o %CPU
# Launch with a custom refresh interval
top -d 5
kill - Terminate processes
# Terminate by PID
kill 1234
# Forced termination
kill -9 1234
# Terminate by name
pkill firefox
4. Disk Management
df - Disk space
# Disk space in human-readable format
df -h
# Disk space for a file system
df -h /home
du - Directory size
# Size of the current directory
du -sh
# Detailed size
du -h --max-depth=1
mount - Mount file systems
# List mounted file systems
mount
# Mount a device
sudo mount /dev/sdb1 /mnt/data
5. Network Management
ifconfig/ip - Network configuration
# List interfaces
ip addr show
# Configure an interface
sudo ip addr add 192.168.1.100/24 dev eth0
netstat - Network statistics
# List connections
netstat -tulpn
# Interface statistics
netstat -i
ping - Connectivity test
# Simple test
ping google.com
# Test with a limited count
ping -c 4 google.com
6. User Management
useradd - Create a user
# Simple creation
sudo useradd -m nouvel_utilisateur
# Creation with a specific shell
sudo useradd -s /bin/bash nouvel_utilisateur
passwd - Change a password
# Change your own password
passwd
# Change a user's password
sudo passwd utilisateur
su/sudo - Switch users
# Switch user
su - utilisateur
# Run as root
sudo commande
7. Service Management
systemctl - Manage services
# Start a service
sudo systemctl start service
# Stop a service
sudo systemctl stop service
# Check a service's status
systemctl status service
service - Manage services (legacy style)
# Start
sudo service apache2 start
# Stop
sudo service apache2 stop
# Restart
sudo service apache2 restart
8. Searching and Filtering
grep - Search text
# Simple search
grep "mot" fichier.txt
# Recursive search
grep -r "mot" dossier/
# Case-insensitive search
grep -i "mot" fichier.txt
find - Search for files
# Search by name
find . -name "*.txt"
# Search by size
find . -size +100M
# Search by date
find . -mtime -7
9. Compression and Archiving
tar - Archiving
# Create an archive
tar -czf archive.tar.gz dossier/
# Extract
tar -xzf archive.tar.gz
# List contents
tar -tzf archive.tar.gz
gzip - Compression
# Compress
gzip fichier.txt
# Decompress
gunzip fichier.txt.gz
10. System Monitoring
htop - Enhanced system monitor
# Launch
htop
# Launch with custom sorting
htop -s PERCENT_CPU
iotop - I/O monitoring
# Launch
sudo iotop
# Launch in batch mode
sudo iotop -b
Conclusion
These commands form the foundation of Linux administration. To become an expert:
- Practice regularly
- Explore the options of each command
- Create custom aliases
- Automate repetitive tasks
Remember that mastering these commands is an ongoing process. Keep learning and experimenting to improve your expertise.
About InSkillCoach
Training and technology expert
Coach specializing in advanced technologies and AI, backed by GNeurone Inc.
Certifications:
- AWS Certified Solutions Architect – Professional
- Google Cloud certifications
- Microsoft Certified: DevOps Engineer Expert
- Certified Kubernetes Administrator (CKA)
- CompTIA Security+
Comments
Comments are powered by GitHub Discussions
Sign in with GitHub to join the discussion