DevOps
Linux
Basic Command Reference

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 -r for 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

CommandUsage ExampleResult
ls -lals -laList all files including hidden ones with details.
cd ..cd ..Move up one directory level.
mkdir docsmkdir docsCreate a folder named "docs".
touch app.jstouch app.jsCreate an empty file named "app.js".
cp file.txt /tmpcp file.txt /tmpCopy a file to the /tmp folder.
mv old.txt new.txtmv old.txt new.txtRename a file.
rm -rf folderrm -rf folderCAUTION: Recursively delete a folder and its content.

[!WARNING] Use rm -rf with Care The rm -rf / command will attempt to delete everything on your system. Always double-check your path before running a recursive delete!