Day 14: Linux & Git-GitHub Cheat Sheet π
Hello DevOps enthusiasts! π Welcome to Day 14 of the #90DaysOfDevOps challenge. Today, I'm sharing a comprehensive cheat sheet of essential commands we've learned so far.
Linux Commands π§
File Operations
# Navigation
pwd # Current directory
ls # List files
ls -la # List detailed including hidden
cd directory # Change directory
cd .. # Go up one level
cd ~ # Go to home
# File Management
touch file.txt # Create empty file
mkdir directory # Create directory
cp source dest # Copy
mv source dest # Move/rename
rm file # Remove file
rm -rf directory # Remove directory
File Content
# Viewing Content
cat file # Display file content
head -n N file # Show first N lines
tail -n N file # Show last N lines
grep pattern file # Search in file
wc file # Line/word/char count
# Editing
nano file # Text editor
vi/vim file # Advanced editor
Permissions
# Changing Permissions
chmod 755 file # Set permissions
chmod u+x file # Add execute permission
chown user:group file # Change ownership
# ACL
getfacl file # Get ACL permissions
setfacl -m u:user:rw # Set ACL permissions
System
# Process Management
ps aux # List processes
top # System monitor
kill PID # Kill process
# Package Management
apt update # Update package list
apt install pkg # Install package
systemctl status svc # Check service status
Git Commands πΏ
Basic Operations
# Repository Setup
git init # Initialize repository
git clone URL # Clone repository
git remote add origin URL # Add remote
# Daily Commands
git status # Check status
git add file # Stage changes
git commit -m "msg" # Commit changes
git push origin branch # Push changes
git pull # Update local repo
Branching
# Branch Management
git branch # List branches
git branch name # Create branch
git checkout branch # Switch branch
git checkout -b name # Create & switch
git merge branch # Merge branch
# Advanced Operations
git rebase main # Rebase to main
git cherry-pick commit # Pick specific commit
git stash # Stash changes
History & Changes
# History
git log # View history
git log --oneline # Compact history
git blame file # Show who changed what
# Undoing Changes
git reset HEAD~1 # Undo last commit
git revert commit # Revert commit
git checkout -- file # Discard changes
Quick Reference Tips π‘
- Use tab completion
- Check command history with
history
- Use
man
command for help - Always verify before destructive operations
- Keep repositories clean
- Make meaningful commit messages
- Branch names should be descriptive
Key Takeaways π―
- Keep commands handy for quick reference
- Practice commands regularly
- Understand the purpose of each command
- Know when to use which command
- Backup before major operations
Linux #Git #DevOps #CheatSheet #90DaysOfDevOps
This is Day 14 of my #90DaysOfDevOps journey. Keep this cheat sheet handy!