Day 12 :Mastering Linux and Git/GitHub: A Cheat Sheet ๐ง๐
Mastering Linux and Git/GitHub: A Cheat Sheet ๐ง๐
Welcome to the world of Linux and Git/GitHub! Whether you're a seasoned pro or just getting started, this cheat sheet will help you navigate the powerful Linux command line and version control with Git and GitHub. ๐
Linux Commands Cheat Sheet ๐ง
Navigating the File System ๐
ls
: List files and directories.cd
: Change directory.pwd
: Print the current working directory.touch
: Create an empty file.mkdir
: Create a new directory.rm
: Remove files or directories.cp
: Copy files or directories.mv
: Move or rename files or directories.
Viewing and Editing Files โ๏ธ
cat
: Display file content.nano
orvim
: Text editors for editing files.less
ormore
: View long files page by page.
System Information ๐ฅ๏ธ
uname
: Display system information.df
: Show disk space usage.top
orhtop
: Monitor system processes.free
: Display memory usage.
Package Management ๐ฆ
sudo apt-get update
: Update package lists.sudo apt-get upgrade
: Upgrade installed packages.sudo apt-get install <package>
: Install a package.sudo apt-get remove <package>
: Remove a package.
User Management ๐ค
sudo adduser <username>
: Add a new user.sudo usermod -aG sudo <username>
: Add user to the sudo group.sudo passwd <username>
: Change user password.sudo deluser <username>
: Delete a user.
Git/GitHub Commands Cheat Sheet ๐ฑโ๐ป
Git Configuration โ๏ธ
git config --global
user.name
"Your Name"
: Set your Git username.git config --global
user.email
"
youremail@example.com
"
: Set your Git email.
Basic Git Workflow ๐
git init
: Initialize a new Git repository.git clone <repository URL>
: Clone a remote repository.git status
: Check the status of your repository.git add <file>
: Stage changes for commit.git commit -m "Commit message"
: Commit staged changes.git push origin <branch>
: Push commits to a remote repository.git pull origin <branch>
: Pull changes from a remote repository.
Branching and Merging ๐ฟ
git branch
: List branches.git branch <branch-name>
: Create a new branch.git checkout <branch-name>
: Switch to a branch.git merge <branch-name>
: Merge a branch into the current branch.git branch -d <branch-name>
: Delete a branch.
Undoing Changes โฉ๏ธ
git reset <file>
: Unstage changes.git checkout -- <file>
: Discard changes in a file.git revert <commit>
: Create a new commit that undoes changes.git reset --hard <commit>
: Reset to a specific commit (use with caution).
GitHub Collaboration ๐ค
git remote add origin <repository URL>
: Add a remote repository.git pull origin <branch>
: Pull changes from GitHub.git push origin <branch>
: Push changes to GitHub.git clone <repository URL>
: Clone a GitHub repository.
No matter if you're taming the Linux terminal or collaborating on code with Git and GitHub, this cheat sheet has your back. Feel free to bookmark it and keep it handy for your coding adventures! ๐๐
Happy coding! ๐