- Linux Command Line Essentials
- Git Version Control
- GitHub Workflows
- Quick Reference Cheat Sheet
- Visual Mind Map
pwd # Print working directory
ls # List directory contents
ls -la # List with details and hidden files
ls -lh # List with human-readable file sizes
cd /path/to/directory # Change directory
cd ~ # Go to home directory
cd .. # Go up one directory
cd - # Go to previous directorytouch filename # Create empty file
mkdir dirname # Create directory
mkdir -p path/to/dir # Create nested directories
cp source dest # Copy file
cp -r source dest # Copy directory recursively
mv source dest # Move/rename file or directory
rm filename # Remove file
rm -r dirname # Remove directory recursively
rm -rf dirname # Force remove directory
rmdir dirname # Remove empty directorycat filename # Display file content
head filename # Show first 10 lines
head -n 20 filename # Show first 20 lines
tail filename # Show last 10 lines
tail -f filename # Follow file changes in real-time
less filename # View file with pagination
more filename # View file page by page
wc filename # Word, line, character count
wc -l filename # Line count onlyfind /path -name "pattern" # Find files by name
find . -type f -name "*.txt" # Find all .txt files
find . -type d -name "docs" # Find directories named "docs"
locate filename # Quick file location search
which command # Find command location
whereis command # Find command and manual pagesgrep "pattern" filename # Search for pattern in file
grep -r "pattern" directory # Recursive search in directory
grep -i "pattern" filename # Case-insensitive search
grep -n "pattern" filename # Show line numbers
grep -v "pattern" filename # Show lines NOT matching pattern
awk '{print $1}' filename # Print first column
sed 's/old/new/g' filename # Replace text
sort filename # Sort file contents
uniq filename # Remove duplicate lines
cut -d',' -f1 filename # Extract first column (CSV)chmod 755 filename # Set permissions (rwxr-xr-x)
chmod +x filename # Add execute permission
chmod u+w filename # Add write permission for user
chmod g-r filename # Remove read permission for group
chmod o+r filename # Add read permission for others
chown user:group filename # Change file ownership
chown -R user:group directory # Change ownership recursively| Permission | Binary | Decimal |
|---|---|---|
| --- | 000 | 0 |
| --x | 001 | 1 |
| -w- | 010 | 2 |
| -wx | 011 | 3 |
| r-- | 100 | 4 |
| r-x | 101 | 5 |
| rw- | 110 | 6 |
| rwx | 111 | 7 |
whoami # Current username
id # User and group IDs
groups # User's groups
w # Who is logged in
last # Last login history
su username # Switch user
sudo command # Run command as superuseruname -a # System information
lsb_release -a # Linux distribution info
df -h # Disk space usage
du -sh directory # Directory size
free -h # Memory usage
uptime # System uptime
date # Current date and time
cal # Calendarps aux # List all processes
ps aux | grep process_name # Find specific process
top # Real-time process monitor
htop # Enhanced process monitor
kill PID # Kill process by PID
killall process_name # Kill process by name
jobs # List active jobs
bg # Send job to background
fg # Bring job to foreground
nohup command & # Run command immune to hangupsping hostname # Test network connectivity
wget URL # Download file from web
curl URL # Transfer data from/to server
ssh user@hostname # Secure shell login
scp file user@host:/path # Secure copy over network
netstat -tulpn # Network connections# Set up user identity
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# Set default editor
git config --global core.editor "nano" # or vim, code, etc.
# View all configurations
git config --list
# View specific configuration
git config user.namegit init # Initialize new repository
git clone <repository-url> # Clone existing repository
git clone <url> <folder-name> # Clone to specific folder# Check status
git status # Check repository status
git status -s # Short status format
# Add files to staging
git add filename # Add specific file
git add . # Add all files in current directory
git add -A # Add all files (including deletions)
git add *.txt # Add all .txt files
# Commit changes
git commit -m "Commit message" # Commit with message
git commit -am "Message" # Add and commit tracked files
git commit # Open editor for commit message
git commit --amend # Modify last commit# View differences
git diff # Show unstaged changes
git diff --staged # Show staged changes
git diff HEAD~1 # Compare with previous commit
git diff commit1..commit2 # Compare two commits
# View commit history
git log # Show commit history
git log --oneline # Compact log format
git log --graph # Show branch graph
git log --oneline --decorate --graph --all # Detailed graph
git show <commit-hash> # Show specific commit detailsgit ls-files # List tracked files
git rm filename # Remove file from git and filesystem
git rm --cached filename # Remove from git but keep file
git mv oldname newname # Rename/move file# Create and manage branches
git branch # List local branches
git branch -a # List all branches (local + remote)
git branch branch-name # Create new branch
git branch -d branch-name # Delete branch (safe)
git branch -D branch-name # Force delete branch
git branch -m old-name new-name # Rename branch
# Switch branches
git switch branch-name # Switch to branch (Git 2.23+)
git checkout branch-name # Switch to branch (older method)
git checkout -b branch-name # Create and switch to branch
git switch -c branch-name # Create and switch to branch (Git 2.23+)# Merge branches
git merge branch-name # Merge branch into current branch
git merge --no-ff branch-name # Force merge commit
git merge --squash branch-name # Squash merge
# Check merge status
git branch --merged # Show merged branches
git branch --no-merged # Show unmerged branchesgit rebase branch-name # Rebase current branch onto branch-name
git rebase -i HEAD~3 # Interactive rebase (last 3 commits)
git rebase --continue # Continue rebase after resolving conflicts
git rebase --abort # Abort rebase operation# Unstage files
git reset filename # Unstage specific file
git reset # Unstage all files
git reset --hard # Reset to last commit (lose changes)
git reset --soft HEAD~1 # Undo last commit, keep changes staged
git reset --mixed HEAD~1 # Undo last commit, unstage changes
git reset --hard HEAD~1 # Undo last commit, lose changes
# Revert commits
git revert commit-hash # Create new commit that undoes changes
git revert HEAD # Revert last commit
# Restore files
git restore filename # Restore file to last committed state
git restore --staged filename # Unstage file (Git 2.23+)
git checkout -- filename # Restore file (older method)git stash # Stash current changes
git stash push -m "message" # Stash with message
git stash list # List all stashes
git stash pop # Apply and remove latest stash
git stash apply # Apply latest stash without removing
git stash apply stash@{2} # Apply specific stash
git stash drop stash@{2} # Delete specific stash
git stash clear # Delete all stashes# View remotes
git remote # List remote names
git remote -v # List remotes with URLs
git remote show origin # Show remote details
# Add and manage remotes
git remote add origin <url> # Add remote repository
git remote rename origin upstream # Rename remote
git remote remove origin # Remove remote
git remote set-url origin <new-url> # Change remote URL# Push changes
git push origin branch-name # Push branch to remote
git push -u origin branch-name # Push and set upstream
git push --all origin # Push all branches
git push --tags # Push all tags
git push --force # Force push (dangerous!)
git push --force-with-lease # Safer force push
# Pull changes
git pull # Fetch and merge from upstream
git pull origin branch-name # Pull specific branch
git pull --rebase # Pull with rebase instead of merge
# Fetch changes
git fetch # Download objects and refs
git fetch origin # Fetch from specific remote
git fetch --all # Fetch from all remotes# Create tags
git tag v1.0.0 # Create lightweight tag
git tag -a v1.0.0 -m "Version 1.0.0" # Create annotated tag
git tag -a v1.0.0 commit-hash # Tag specific commit
# List and manage tags
git tag # List all tags
git tag -l "v1.*" # List tags matching pattern
git show v1.0.0 # Show tag details
git tag -d v1.0.0 # Delete local tag
git push origin --delete v1.0.0 # Delete remote tag
# Push tags
git push origin v1.0.0 # Push specific tag
git push origin --tags # Push all tags# Fork workflow
git remote add upstream <original-repo-url>
git fetch upstream
git checkout main
git merge upstream/main
# Branch management for PRs
git checkout -b feature/new-feature
# Make changes, commit
git push -u origin feature/new-feature
# Create PR on GitHub
# After PR merge:
git checkout main
git pull origin main
git branch -d feature/new-feature
git push origin --delete feature/new-feature# Create useful aliases
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.graph 'log --oneline --decorate --graph --all'
# Usage: git st instead of git status# Hook locations
ls .git/hooks/ # View available hooks
# Common hooks:
# - pre-commit: Run before commit
# - post-commit: Run after commit
# - pre-push: Run before push
# - post-receive: Run after receiving push# Add submodule
git submodule add <repository-url> <path>
# Initialize and update submodules
git submodule init
git submodule update
git submodule update --recursive
# Clone repository with submodules
git clone --recursive <repository-url>| Category | Command | Description |
|---|---|---|
| Linux Basics | pwd |
Show current directory |
ls -la |
List files with details | |
cd directory |
Change directory | |
mkdir dirname |
Create directory | |
rm -rf dirname |
Remove directory | |
chmod 755 file |
Set file permissions | |
| Git Basics | git status |
Check repository status |
git add . |
Stage all changes | |
git commit -m "msg" |
Commit with message | |
git push origin main |
Push to remote | |
git pull |
Pull latest changes | |
| Git Branching | git branch |
List branches |
git switch -c branch |
Create and switch branch | |
git merge branch |
Merge branch | |
git branch -d branch |
Delete branch | |
| Git Undo | git reset filename |
Unstage file |
git restore filename |
Restore file | |
git revert HEAD |
Revert last commit | |
git stash |
Temporarily save changes |
# 1. Start new feature
git switch -c feature/new-feature
# 2. Make changes and commit
git add .
git commit -m "Add new feature"
# 3. Push to remote
git push -u origin feature/new-feature
# 4. Create Pull Request on GitHub
# 5. After merge, cleanup
git switch main
git pull origin main
git branch -d feature/new-featureπ LINUX, GIT & GITHUB MASTERY
|
βββ π§ LINUX COMMAND LINE
β βββ π File Operations
β β βββ Navigation (pwd, ls, cd)
β β βββ Creation (touch, mkdir)
β β βββ Manipulation (cp, mv, rm)
β β βββ Content (cat, head, tail, less)
| |
β βββ π Search & Text
β β βββ Find Files (find, locate, which)
β β βββ Search Content (grep, awk, sed)
β β βββ Process Text (sort, uniq, cut)
| |
β βββ π Permissions
β β βββ File Permission (chmod)
β β βββ Ownership (chown)
β β βββ User Management (whoami, su, sudo)
| |
β βββ βοΈ System
β βββ Info (uname, df, free, uptime)
β βββ Processes (ps, top, kill)
β βββ Network (ping, wget, ssh)
β
βββ π― GIT VERSION CONTROL
β βββ π Setup
β β βββ Config (git config)
β β βββ Init (git init)
β β βββ Clone (git clone)
| |
β βββ π¦ Basic Workflow
β β βββ Status (git status)
β β βββ Staging (git add)
β β βββ Committing (git commit)
β β βββ History (git log, git diff)
| |
β βββ πΏ Branching
β β βββ Create (git branch, git switch)
β β βββ Merge (git merge)
β β βββ Rebase (git rebase)
β β βββ Delete (git branch -d)
| |
β βββ π Undoing
β β βββ Reset (git reset)
β β βββ Revert (git revert)
β β βββ Restore (git restore)
β β βββ Stash (git stash)
| |
β βββ π§ Advanced
β βββ Aliases
β βββ Hooks
β βββ Submodules
β
βββ π GITHUB WORKFLOWS
βββ π Remotes
β βββ Add/Manage (git remote)
β βββ Push (git push)
β βββ Pull (git pull)
β βββ Fetch (git fetch)
|
βββ π·οΈ Tags & Releases
β βββ Create Tags (git tag)
β βββ Push Tags
β βββ GitHub Releases
|
βββ π Collaboration
βββ Fork Workflow
βββ Pull Requests
βββ Code Review
βββ Issue Tracking-
Linux Basics
- Master navigation (
pwd,ls,cd) - Learn file operations (
touch,mkdir,cp,mv,rm) - Understand basic permissions (
chmod,chown)
- Master navigation (
-
Git Fundamentals
- Setup Git (
git config) - Learn basic workflow (
init,add,commit,status) - Understand history (
git log,git diff)
- Setup Git (
-
GitHub Basics
- Create account and first repository
- Learn push/pull (
git push,git pull) - Clone existing repositories
-
Advanced Linux
- Master text processing (
grep,awk,sed) - Learn system monitoring (
ps,top,netstat) - Understand pipes and redirection
- Master text processing (
-
Git Branching
- Create and switch branches (
git branch,git switch) - Merge strategies (
git merge,git rebase) - Resolve conflicts
- Create and switch branches (
-
GitHub Collaboration
- Fork repositories
- Create Pull Requests
- Code review process
-
Linux Mastery
- Shell scripting
- Process management
- Network troubleshooting
-
Git Advanced
- Interactive rebase
- Git hooks
- Submodules
-
GitHub Enterprise
- GitHub Actions (CI/CD)
- Issue tracking
- Project management
- Use
history | grep commandto find previously used commands - Create aliases for frequently used commands:
alias ll='ls -la' - Use
ctrl+rfor reverse search in command history - Master tab completion for faster typing
- Use
git commit --amendto fix the last commit message - Create meaningful commit messages (what and why)
- Use
git stashwhen switching contexts quickly - Set up aliases for commonly used Git commands
- Use issue templates for consistent reporting
- Set up branch protection rules
- Use GitHub CLI (
gh) for command-line GitHub operations - Enable GitHub Pages for project documentation
π Happy Learning! Remember: Practice makes perfect. Start with the basics and gradually build up your skills.