Linux - Common Commands
The Linux command line rewards time investment. A handful of commands, learned well, let you accomplish almost anything on a Linux system. This chapter covers the essential commands every Linux user needs to know.
What You Will Learn
By the end of this chapter you will be able to:
- Navigate the Linux filesystem confidently
- Create, copy, move, and delete files and directories
- View and search file contents
- Use
manpages and--helpto learn any command - Recall and reuse previous commands efficiently
Topics in This Chapter
| # | Topic | Description |
|---|---|---|
| 1 | Navigation Commands | pwd, ls, cd, tree |
| 2 | File Management Commands | mkdir, touch, cp, mv, rm, ln |
| 3 | Viewing File Contents | cat, less, head, tail, wc, sort |
| 4 | Getting Help | man, –help, tldr, whatis, apropos |
| 5 | Command History and Shortcuts | history, !!, Ctrl+R, aliases |
| 6 | Practice Exercises | Hands-on tasks |
Quick Reference: Most Used Commands
# Navigation
pwd # Print working directory
ls -la # List all files with details
cd ~/projects # Change directory
cd - # Go back to previous directory
# File management
mkdir -p a/b/c # Create nested directories
touch file.txt # Create empty file
cp -r src/ dst/ # Copy directory recursively
mv old.txt new.txt # Rename or move a file
rm -rf tmpdir/ # Delete directory (careful!)
# Viewing files
cat file.txt # Print file to screen
less file.txt # Scroll through file (q to quit)
head -20 file.txt # First 20 lines
tail -f /var/log/syslog # Follow live log output
grep "error" file.txt # Search for pattern in file
# Getting help
man ls # Full manual for ls
ls --help # Quick help
tldr tar # Simplified examples
Next → Navigation Commands