Member-only story
Day 2:Basic Linux Commands Every DevOps Engineer Should Know
1. alias — Create Command Shortcuts
Aliases allow you to create shortcuts for complex or frequently used commands, improving efficiency and reducing typing errors.
Example: Advanced Aliases for Productivity
alias ll='ls -lah --color=auto'
alias ..='cd ..'
alias gs='git status'
ll
: A detailedls
command that shows file sizes in human-readable format and highlights files with colors...
: Quickly navigate up one directory.gs
: Short forgit status
, useful when working in Git frequently.
You can also save aliases in your shell’s config file (~/.bashrc
or ~/.zshrc
) to make them permanent.
2. whoami— Identify the current user
This command returns the username of the currently logged-in user, helpful when working with multiple user accounts or SSH connections.
This script checks if the current user is root and exits if not, ensuring that scripts requiring elevated privileges don’t run accidentally.