Osagie Anolu
Posted on November 5, 2024
Comprehensive Guide to Essential Linux Commands
Essential Linux Commands: A Practical Guide
Linux's power lies in its command-line interface (CLI), making it a favorite among developers and system administrators. This guide covers the fundamental commands you'll need for effective system management.
Basic Navigation
pwd # Print working directory
cd # Change directory
cd .. # Move up one level
cd ~ # Go to home directory
File and Directory Operations
Listing and Creating
ls # List files and directories
ls -lah # Detailed list (long format, all files, human-readable sizes)
touch # Create empty file
mkdir # Create directory
mkdir -p # Create nested directories
Manipulating Files
cp file1 file2 # Copy files
cp -r dir1 dir2 # Copy directories recursively
mv old new # Move or rename
rm file # Delete file
rm -r dir # Delete directory recursively
File Permissions
chmod 755 file # Set permissions (rwxr-xr-x)
chmod u+x file # Add execute permission for user
chown user:group file # Change ownership
Text File Operations
Viewing Content
cat file # Display entire file
less file # Page through file
head -n 10 file # Show first 10 lines
tail -n 10 file # Show last 10 lines
Text Editing
-
nano
: Beginner-friendly editor -
vim
: Advanced editor with powerful features -
grep "term" file
: Search within files -
grep -i "term" file
: Case-insensitive search
Process Management
ps aux # List all processes
top # Real-time process monitor
kill PID # Terminate process by ID
killall name # Terminate process by name
Network Operations
ip addr # Show network interfaces
ping host # Test connectivity
netstat -tuln # Show network connections
ss # Modern alternative to netstat
System Information
df -h # Disk space usage
du -h # Directory space usage
uname -a # System information
uptime # System uptime and load
Pro Tips
- Use Tab completion to avoid typing full paths
- Access command history with up/down arrows
- Chain commands with
&&
(AND) or||
(OR) - Use
man
command for detailed documentation - Combine commands with pipes (
|
) for powerful operations
Remember: Linux commands are case-sensitive, and most can be modified with flags (options) that start with -
or --
. When in doubt, use --help
or man
to learn more about any command.
💖 💪 🙅 🚩
Osagie Anolu
Posted on November 5, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
shellscripting Day 5 of #90daysofdevops Advanced Linux Shell Scripting for DevOps Engineers with User Management
June 5, 2024