๐๐ Day 12 DevOps Challenge - Master Linux, Git & GitHub: Your Ultimate Cheat Sheet ๐ง๐๐
Linux Commands Cheat Sheet ๐ง
Everyday Linux Commands: Boost Your Productivity ๐ง๐ผ
Navigation:
cd [directory]
: Change directory. ๐pwd
: Print working directory. ๐ls [options] [path]
: List files and directories. ๐๏ธmkdir [directory]
: Create a new directory. ๐rmdir [directory]
: Remove an empty directory. ๐๏ธ
File Operations:
touch [filename]
: Create an empty file. โจcp [source] [destination]
: Copy files/directories. ๐mv [source] [destination]
: Move/Rename files/directories. ๐rm [options] [file/directory]
: Remove files/directories. โ
File Permissions:
chmod [permissions] [file]
: Change file permissions. ๐chown [user:group] [file]
: Change file ownership. ๐ฅ
Text Manipulation:
cat [file]
: Display file contents. ๐ฑless [file]
: View file content interactively. ๐head [file]
: Display the beginning of a file. ๐tail [file]
: Display the end of a file. ๐grep [pattern] [file]
: Search for patterns in a file. ๐wc [file]
: Count lines, words, and characters. ๐งฎ
Process Management:
ps
: Display running processes. ๐kill [PID]
: Terminate process by PID. โ ๏ธkillall [process_name]
: Terminate processes by name. โ ๏ธtop
: Monitor system processes. ๐
System Information:
uname -a
: Display kernel info. ๐งdf -h
: Show disk space usage. ๐ฝfree -h
: Display RAM usage. ๐งifconfig
: View network config. ๐
User Management:
whoami
: Display current username. ๐คid
: Show user/group info. ๐จโ๐ฉโ๐ฆusers
: List logged-in users. ๐งโ๐ปpasswd
: Change user password. ๐
File Searching:
find [path] [expression]
: Search for files/dirs. ๐locate [filename]
: Find files using the database. ๐
Archive & Compression:
tar [options] [archive_name.tar] [files/dirs]
: Create/extract tar archives. ๐๏ธgzip [file]
: Compress using gzip. ๐๏ธgunzip [file]
: Decompress with gzip. ๐๏ธzip [archive_name.zip] [files/dirs]
: Create a zip archive. ๐ฆunzip [archive_name.zip]
: Extract from zip. ๐ฆ
Networking:
ping [host]
: Send ICMP echo requests. ๐ssh [user@]host
: Securely connect with SSH. ๐scp [source] [destination]
: Copy over SSH. ๐ค๐ฅwget [url]
: Download from the web. ๐๐ฝcurl [url]
: Transfer with URLs. ๐๐
Disk & Filesystem:
df -h
: Show disk space usage. ๐พdu -h [directory]
: Estimate file space usage. ๐mount
: Show mounted filesystems. ๐๏ธumount [mount_point]
: Unmount filesystem. ๐ป
Package Management:
Debian/Ubuntu:
apt-get
: Package Tool. ๐ฆ๐งdpkg
: Package manager for .deb. ๐ฆ๐ฆ
Red Hat/CentOS/Fedora:
yum
: Package manager. ๐ฆ๐งrpm
: Package manager for .rpm. ๐ฆ๐ฆ
Process Monitoring:
ps
: Display running processes. ๐top
: Monitor processes. ๐
System Shutdown/Reboot:
shutdown [options] [time]
: Shut down or reboot. ๐ซ๐reboot
: Reboot immediately. ๐
Help:
man [command]
: Display manual. โน๏ธ--help or -h
: Get help. โน๏ธ
Git & GitHub Commands Cheat Sheet ๐
Basic Git Commands ๐
git init
: Initialize Git repo.git clone <repository_url>
: Clone remote repo.git status
: Check repo status.git add <file(s)>
: Add changes to staging. ๐git commit -m "Commit message"
: Commit with the message. ๐ฌgit log
: View commit history. ๐git diff
: View commit differences. ๐git checkout -- <file(s)>
: Discard changes. ๐git reset HEAD <file(s)>
: Unstage changes. ๐ โโ๏ธgit revert <commit_hash>
: Revert a commit. โชgit reset --hard <commit_hash>
: Reset to commit. ๐git clean -n
: List untracked files to be removed. ๐๏ธgit cherry-pick <commit_hash>
: Apply a specific commit. ๐git rebase <branch_name>
: Reapply commits on another base. ๐
Branch & Tag Operations ๐ฟ๐ท๏ธ
git branch
: List/create/delete branches. ๐git checkout <branch_name>
: Switch branch. ๐git checkout -b <branch_name>
: Create & switch. ๐ฑgit merge <branch_name>
: Merge branch. ๐คgit branch -d <branch_name>
: Delete branch. โgit tag <tag_name>
: Create a lightweight tag. ๐ท๏ธgit tag -a <tag_name> -m "Tag message"
: Create annotated tag. ๐ท๏ธ
Stashing & Remote ๐ฆ๐
git stash
: Temporarily save changes. ๐ฆgit stash apply
: Apply last stash. ๐ฆgit stash pop
: Apply & remove last stash. ๐ฆgit stash list
: List stashed changes. ๐ฆgit stash drop
: Discard last stash. ๐ฆgit remote add <remote_name> <repository_url>
: Add remote repo. ๐git remote -v
: List remotes & URLs. ๐git push <remote_name> <branch_name>
: Push commits. โ๏ธgit fetch <remote_name>
: Fetch changes. ๐git pull <remote_name> <branch_name>
: Pull changes. ๐
Advanced Git Actions ๐
git reflog
: View the history of references. ๐git log --graph --oneline --all
: Visualize the commit-graph concisely. ๐git rebase <branch_name>
: Reapply commits on another base. ๐
Note: ๐
This cheat sheet contains all the commands used and mentioned in the past 11 blogs. It's a comprehensive and helpful resource that combines essential Linux commands for efficient file management and system control with powerful Git and GitHub commands for version control and collaborative coding. ๐ง๐ Elevate your skills, streamline your workflow, and navigate the coding universe with confidence. ๐ป Embrace these tools to become a coder ๐!