DEV Community

Cover image for Linux Commands in DevOps: A Practical Guide with Examples
Osagie Anolu
Osagie Anolu

Posted on

Linux Commands in DevOps: A Practical Guide with Examples

☄️ Top 70 Linux Commands Every DevOps Engineer Should Know ♾

Linux commands form the backbone of DevOps workflows. From file management to process control and network troubleshooting, mastering these commands can significantly enhance productivity and efficiency. Below is a curated list of 70 essential Linux commands for DevOps, categorized and explained for practical use:


  1. File and Directory Management

These commands help manage files and directories efficiently:

  1. ls: Lists directory contents.

  2. cd: Changes the current directory.

  3. pwd: Prints the current directory path.

  4. mkdir: Creates new directories.

  5. touch: Creates empty files.

  6. cp: Copies files or directories.

  7. mv: Moves or renames files/directories.

  8. rm: Removes files or directories.

  9. ln: Creates hard or symbolic links between files.


  1. Searching and Viewing Files

For finding and inspecting data: 10. find: Searches for files and directories.

  1. grep: Searches for patterns in files.
  2. cat: Displays or concatenates file contents.
  3. less: Opens files for paginated viewing.
  4. head: Displays the first few lines of a file.
  5. tail: Displays the last few lines of a file.

  1. Text Editors

Essential for modifying configuration files: 16. vi/vim: Advanced text editor for experts.

  1. nano: User-friendly text editor.

  1. Compression and Archiving

Optimize storage and backup with these tools: 18. tar: Archives and extracts files.

  1. gzip: Compresses files.
  2. gunzip: Decompresses files.

  1. Networking

For troubleshooting and managing networks: 21. wget: Downloads files from the web.

  1. curl: Transfers data between systems.
  2. ssh: Logs into remote servers securely.
  3. scp: Copies files securely across servers.
  4. ping: Tests network connectivity.
  5. netstat: Displays network statistics.
  6. ifconfig: Configures network interfaces.
  7. dig: Performs DNS lookups.
  8. nc: Netcat utility for reading/writing over the network.

  1. System Administration

Handle permissions, processes, and users: 30. chmod: Changes file permissions.

  1. chown: Changes file ownership.
  2. chgrp: Changes group ownership.
  3. ps: Lists running processes.
  4. top: Monitors system performance.
  5. kill: Terminates processes.
  6. df: Displays disk usage.
  7. du: Estimates file/directory size.
  8. free: Shows memory usage.
  9. uname: Prints system information.
  10. lsof: Lists open files and processes.

  1. User Management

Commands for managing user accounts: 41. useradd: Creates a new user account.

  1. passwd: Changes a user's password.
  2. su: Switches to another user.
  3. sudo: Executes commands as another user.
  4. usermod: Modifies user accounts.
  5. groupadd: Creates a new group.
  6. id: Displays user and group IDs.

  1. Scheduling and Automation

Automate repetitive tasks: 48. crontab: Schedules recurring jobs.

  1. at: Schedules one-time tasks.
  2. history: Displays command history.
  3. source: Executes commands from a file in the current shell.

  1. File System Management

Maintain and modify file systems: 52. mkfs: Formats a new file system.

  1. mount: Mounts file systems.
  2. umount: Unmounts file systems.

  1. Development Utilities

Boost productivity with these tools: 55. sed: Edits text streams or files.

  1. awk: Processes and analyzes text data.
  2. diff: Compares files line by line.
  3. rsync: Synchronizes files between locations.
  4. tee: Redirects output to multiple files.
  5. cut: Extracts sections from text.
  6. wc: Counts words, lines, and characters.

  1. Security

Manage keys and encryption: 62. ssh-keygen: Generates SSH keys.

  1. iptables: Configures the firewall.
  2. ssh-agent: Manages SSH keys in memory.

  1. Miscellaneous

Additional commands to streamline your workflow: 65. alias: Creates command shortcuts.

  1. whois: Queries domain registration.
  2. uniq: Removes duplicate lines.
  3. sort: Arranges lines in order.
  4. tr: Translates or deletes characters.
  5. paste: Combines lines of files.

💡 Whether you're a beginner or an experienced DevOps engineer, mastering these commands is vital for efficient operations. Practice regularly, experiment with flags, and integrate them into scripts for automation.

Top comments (0)