Below are some of the most commonly used flags (options/switches) for essential tools across
different areas.
1. Linux & System Administration
ls
(List Directory Contents)
# bashls -l # Long formatls -a # Show hidden filesls -h # Human-readable sizesls -t # Sort by modification time grep
(Search for Patterns)
# bashgrep -i # Case-insensitive searchgrep -r # Recursive searchgrep -v # Invert match (exclude)grep -E # Use extended regex find
(Search Files & Directories)
# bashfind / -name "*.log" # Find all log filesfind . -type d # Find directories onlyfind . -mtime -7 # Find files modified in the last 7 days tar
(Archive & Extract Files)
# bashtar -cvf archive.tar file # Create archivetar -xvf archive.tar # Extract archivetar -czvf archive.tar.gz dir/ # Compress with gzip chmod
(Change File Permissions)
# bashchmod -R 755 dir/ # Change directory permissions recursively2. Git & Version Control
git
(Version Control)
# bashgit clone -b branch-name repo-url # Clone a specific branchgit log --oneline --graph --all # View commit historygit diff --staged # Show staged changesgit reset --hard HEAD~1 # Reset to previous commit3. Kubernetes (kubectl)
# bashkubectl get pods -A # List all pods across namespaceskubectl apply -f deployment.yaml # Apply changes from YAML file4. Docker & Containerization
docker
(Container Management)
# bashdocker ps -a # List containers in all statesdocker images -q # List only image IDsdocker run -it ubuntu bash # Run an interactive containerdocker rm -f $(docker ps -aq) # Remove all containers by force5. Ansible (Automation)
# bashansible-playbook -i inventory.ini site.yml --check # Dry-run mode
ansible-playbook -vv site.yml # Increase verbosityansible-playbook --tags "deploy" site.yml # Run specific tags6. Terraform (Infrastructure as Code)
# bashterraform plan -out=tfplan # Preview changesterraform destroy --auto-approve # Destroy infra without confirmation7. AWS CLI (Cloud Management)
# bashaws s3 ls --recursive # List all S3 objects recursivelyaws ec2 describe-instances --filters "Name=instance-state-name,Values=running"aws eks update-kubeconfig --name my-cluster # Update kubeconfig for EKS8. Networking & Security
curl
(HTTP Requests)
# bashcurl -I https://example.com # Get HTTP headerscurl -X POST -d '{"key":"value"}' -H "Content-Type: application/json" https://api.comcurl -k https://untrusted-site.com # Ignore SSL certificate errors iptables
(Firewall Rules)
# bashiptables -L -n -v # List firewall rulesiptables -A INPUT -p tcp --dport 22 -j ACCEPT # Allow SSHiptables -F # Flush all rules9. Logging & Monitoring
journalctl
(System Logs)
# bashjournalctl -u nginx --since "1 hour ago" # View logs for a servicejournalctl -f # Follow logs in real-time top
/ htop
(Process Monitoring)
# bashtop -u user # Show processes for a specific userhtop -s %MEM # Sort by memory usage10. Miscellaneous
ssh
(Remote Access)
# bashssh -i my-key.pem user@server # Use a private keyssh -p 2222 user@server # Connect via a different port rsync
(File Synchronization)
# bashrsync -avz source/ user@remote:/destination/ # Sync files with compressionrsync --delete -avz source/ dest/ # Sync and delete extra files in the destinationtwtech-insights:
These
flags make command-line operations
more efficient, whether you're managing infrastructure,
cloud, security, or automation.
No comments:
Post a Comment