Day 12 :Mastering Linux and Git/GitHub: A Cheat Sheet ๐Ÿง๐Ÿš€

ยท

3 min read

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 or vim: Text editors for editing files.

  • less or more: View long files page by page.

System Information ๐Ÿ–ฅ๏ธ

  • uname: Display system information.

  • df: Show disk space usage.

  • top or htop: 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 โš™๏ธ

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! ๐ŸŽ‰

ย