Linux, Git-GitHub Cheat Sheet πŸš€πŸ§πŸŽ‰

Linux, Git-GitHub Cheat Sheet πŸš€πŸ§πŸŽ‰

Linux Cheat Sheet🐧:

Basic Commands

  • pwd: Print working directory

  • ls: List files and directories in the present working Directory

  • cd: Change directory

    • cd ..: Move up one directory
  • mkdir: Create a new directory

  • touch: Create an empty file

  • cp: Copy files/directories

  • mv: Move or rename files/directories

  • rm: Remove files/directories

    • rm -r: Remove recursively (for directories)

File Operation Commands

  • cat: Display file contents

  • head/tail: Display the beginning/end of a file

  • grep: Search for a pattern in files

    • grep -r: Search recursively in directories

File Permission Commands

  • r: Read Permission

  • w: Write Permission

  • x: Execute Permission

  • chown: Command to change the owner of a file.

  • chgrp: Command to change the group ownership of a file.

Package Management:

  • apt :

    • apt update: Update package list

    • apt upgrade: Upgrade installed packages

    • apt install: Install a package

    • apt remove: Remove a package

System Information:

  • uname -a: Display system information

  • uname -r: It shows a version of the kernel

  • df -h: Display disk space usage

  • free -m: Display free and used memory

Process Management:

  • ps: Display information about processes

  • kill: Terminate a process

    • kill -9: Forcefully terminate a process

Text Editor

vim: Text editors

Git/GitHub Cheat Sheet:

Basic Commands:

  • git init: Initialize a new Git repository

  • git clone: Clone a repository

  • git status: Show the status of changes

  • git add: Add changes to the staging area

  • git commit: Commit changes

    • git commit -m "Commit message"

Branching:

  • git branch: List branches

  • git checkout: Switch branches

    • git checkout -b: Create and switch to a new branch
  • git merge: Merge branches

Remote Repositories (GitHub):

  • git remote add origin: Add a remote repository

  • git push: Push changes to a remote repository

    • git push -u origin branch-name
  • git pull: Pull changes from a remote repository

Configuration:

  • git config: Configure Git settings.

    • --global user.name: Set username.

    • --global user.email: Set email.

    • --global core.editor: Set default text editor.

Undoing Changes:

  • git log: View commit history

  • git reset: Reset the staging area

  • git revert: Create a new commit that undoes changes

Logging and History:

  • git log: Display commit history.

    • git log --oneline: Show concise log.
Β