DEV Community

Kanav Gathe
Kanav Gathe

Posted on

Day 14/90: Essential Linux & Git-GitHub Cheat Sheet 📝 #90DaysOfDevOps

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Quick Reference Tips 💡

  1. Use tab completion
  2. Check command history with history
  3. Use man command for help
  4. Always verify before destructive operations
  5. Keep repositories clean
  6. Make meaningful commit messages
  7. 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!

Top comments (0)