Basic Command Reference
To master Linux, you need to get comfortable with the command line. Here is a curated list of essential commands every DevOps engineer should know.
1. Directory Operations
ls: List files and directories in the current folder.cd: Change directory (e.g.,cd /var/log).pwd: Print working directory (shows where you are).mkdir: Create a new directory.rmdir: Remove an empty directory.
2. File Operations
touch: Create a new empty file.cp: Copy files or directories.mv: Move or rename files or directories.rm: Remove files (use-rfor directories).cat: Display the content of a file.
3. Help & Manuals
man: Display the manual for a command (e.g.,man ls).--help: A common flag to see quick help (e.g.,mkdir --help).
Command Quick Reference
| Command | Usage Example | Result |
|---|---|---|
ls -la | ls -la | List all files including hidden ones with details. |
cd .. | cd .. | Move up one directory level. |
mkdir docs | mkdir docs | Create a folder named "docs". |
touch app.js | touch app.js | Create an empty file named "app.js". |
cp file.txt /tmp | cp file.txt /tmp | Copy a file to the /tmp folder. |
mv old.txt new.txt | mv old.txt new.txt | Rename a file. |
rm -rf folder | rm -rf folder | CAUTION: Recursively delete a folder and its content. |
[!WARNING] Use
rm -rfwith Care Therm -rf /command will attempt to delete everything on your system. Always double-check your path before running a recursive delete!