Complete List of Common Linux Server Commands
Mastering common Linux commands is the foundation of server management.
File and Directory Operations:
-
ls -la - List all files with detailed information
-
cd /path - Change directory
-
pwd - Display the current directory
-
mkdir dir - Create a directory
-
rm -rf dir - Delete a directory and its contents
-
cp -r src dst - Copy a directory
-
mv old new - Move or rename files/directories
-
chmod 755 file - Modify file permissions
-
chown user file - Change file owner
File Viewing and Editing:
-
cat file - Display file contents
-
less file - View file contents page by page
-
head -n 10 file - View the first 10 lines of a file
-
tail -f file - View log files in real time
-
vi file - Edit a file
-
grep keyword file - Search for specific content in a file
System Management:
-
top - System monitoring
-
htop - Enhanced system monitoring tool
-
free -h - View memory usage
-
df -h - View disk usage
-
du -sh dir - View directory size
-
ps aux - View all running processes
-
kill -9 pid - Force terminate a process
Network Related Commands:
-
ifconfig - View network interface information
-
ip addr - View IP address information
-
ping host - Test network connectivity
-
netstat -tlnp - View listening ports
-
curl url - Send HTTP requests
-
wget url - Download files
Service Management:
-
systemctl start service - Start a service
-
systemctl stop service - Stop a service
-
systemctl restart service - Restart a service
-
systemctl status service - Check service status
-
systemctl enable service - Enable a service to start automatically at boot time