Post

A-Z of commands useful for DevOps | LinuxGist

This article will list A-Z of most commonly used commands which are especially handy for DevOps professionals.

Introduction

The real power of Linux commes from its command line tools. For DevOps professionals, Linux commands are essential tools for managing and automating infrastructure, applications, and systems.

Here is the list of commands that DevOps professionals will find very useful

A

  • apt-get: Package manager for Debian-based distributions.
    • Usage:
      1
      2
      
      sudo apt-get update  # Update the package index
      sudo apt-get install <package_name>  # Install a package
      

B

  • bash: The Bourne Again SHell, used for scripting.
    • Usage:
      1
      
      bash script.sh  # Run a Bash script
      

C

  • cat: Concatenate and display files.
    • Usage:
      1
      
      cat file.txt  # Display the contents of a file
      

D

  • docker: Containerization platform.
    • Usage:
      1
      2
      
      docker run <image_name>  # Run a Docker container
      docker build -t <image_name> .  # Build a Docker image from a Dockerfile
      

E

  • echo: Output text or variable values.
    • Usage:
      1
      2
      
      echo "Hello, World!"  # Print a string
      echo $HOME  # Print the value of the HOME environment variable
      

F

  • find: Search for files and directories.
    • Usage:
      1
      
      find /path/to/search -name "*.txt"  # Find all .txt files in a directory
      

G

  • grep: Text search within files.
    • Usage:
      1
      
      grep "error" logfile.txt  # Search for the string "error" in logfile.txt
      

H

  • history: Show command history.
    • Usage:
      1
      
      history  # Display recent commands
      

I

  • ifconfig or ip: Network configuration.
    • Usage:
      1
      2
      
      ifconfig  # Show network interface details
      ip addr show  # Show network interface details using `ip`
      

J

  • journalctl: System log utility.
    • Usage:
      1
      
      journalctl -u service_name.service  # Display logs for a specific service
      

K

  • kill: Terminate processes.
    • Usage:
      1
      2
      
      kill <PID>  # Terminate a process by PID
      killall <process_name>  # Terminate all instances of a process
      

L

  • ls: List directory contents.
    • Usage:
      1
      
      ls -la  # List all files including hidden ones in long format
      

M

  • make: Build and manage software projects using Makefiles.
    • Usage:
      1
      
      make build  # Execute the 'build' target from a Makefile
      

N

  • netstat or ss: Network statistics.
    • Usage:
      1
      2
      
      netstat -tuln  # Show all listening TCP and UDP ports
      ss -tuln  # Same as above but using `ss`
      

O

  • openssl: Cryptographic toolkit.
    • Usage:
      1
      
      openssl genrsa -out key.pem 2048  # Generate a RSA private key
      

P

  • ping: Test network connectivity.
    • Usage:
      1
      
      ping google.com  # Ping the Google domain to check connectivity
      

Q

  • quota or du: Disk usage and quotas.
    • Usage:
      1
      
      du -sh /path/to/directory  # Show disk usage of a directory in human-readable format
      

R

  • rsync: Synchronize files between directories.
    • Usage:
      1
      
      rsync -avz source/ destination/  # Sync contents from source to destination
      

S

  • ssh: Secure shell for remote login and command execution.
    • Usage:
      1
      
      ssh user@remote_host  # Connect to a remote server
      
  • sudo: Execute commands with superuser privileges.
    • Usage:
      1
      
      sudo apt-get update  # Update package index using root privileges
      

T

  • tail: Display the end of files.
    • Usage:
      1
      
      tail -f logfile.txt  # Continuously display new lines added to logfile.txt
      
  • top: Monitor system processes.
    • Usage:
      1
      
      top  # Show real-time resource usage and running processes
      

U

  • uname: Display information about the kernel.
    • Usage:
      1
      
      uname -a  # Show all information about the kernel
      

V

  • vim or nano: Text editors for editing files.
    • Usage:
      1
      2
      
      vim file.txt  # Open a file in Vim
      nano file.txt  # Open a file in Nano
      

W

  • watch: Execute a command repeatedly at intervals.
    • Usage:
      1
      
      watch -n 1 "docker ps"  # Show Docker container status every second
      

X

  • xargs: Build and execute commands from standard input.
    • Usage:
      1
      
      find /path/to/search -name "*.txt" | xargs rm  # Remove all .txt files found
      

Y

  • yum or dnf: Package manager for Red Hat-based distributions.
    • Usage:
      1
      2
      
      yum install package_name  # Install a package using `yum`
      dnf install package_name  # Install a package using `dnf`
      

Z

  • zcat or gzcat: Display compressed files.
    • Usage:
      1
      2
      
      zcat file.gz  # Display contents of a gzip-compressed file
      gzcat file.gz  # Same as above but using `gzcat`
      

Conclusion

This list should cover many common tasks you might perform in a Unix-like environment. Each command has its own options and flags that can be used to customize the behavior according to your needs. Always ensure you have proper permissions before executing commands, especially those involving system changes or file modifications.

This post is licensed under CC BY 4.0 by the author.