Day 12 : A Cheat Sheet for Linux and Git-GitHub

In the world of programming and system administration, proficiency in Linux commands and Git-GitHub is indispensable. Whether you're a seasoned developer or just starting your journey, having a comprehensive cheat sheet at your disposal can significantly boost your productivity and efficiency. In this blog post, we'll compile a well-organized cheat sheet covering essential Linux commands and Git-GitHub operations along with brief explanations of their usage.

Linux Commands ๐Ÿง

  1. pwd: Prints the current working directory.

     $ pwd
    

    This command displays the absolute path of the current working directory.

  2. ls: Lists directory contents.

     $ ls
    

    Use this command to view the files and directories within the current location.

  3. cd: Changes the current directory.

     $ cd /path/to/directory
    

    Navigate to a specific directory by providing its path after the cd command.

  4. mkdir: Creates a new directory.

     $ mkdir new_directory
    

    Make a new directory with the specified name.

  5. touch: Creates a new file.

     $ touch new_file.txt
    

    This command creates a new file with the specified name.

  6. cp: Copies files and directories.

     $ cp file1.txt file2.txt /path/to/destination
    

    Copy files or directories from one location to another.

  7. mv: Moves or renames files and directories.

     $ mv file1.txt /path/to/destination
    

    Use this command to move files to a new location or rename them.

  8. rm: Removes files or directories.

     $ rm file.txt
    

    Be cautious with this command as it permanently deletes files.

  9. grep: Searches for patterns in files.

     $ grep "pattern" file.txt
    

    Find specific patterns within text files.

  10. man: Displays the manual for commands.

    $ man command
    

    Access detailed information about a specific command.

Git-GitHub Commands ๐Ÿš€**:**

  1. git init: Initializes a new Git repository.

     $ git init
    

    Start tracking changes in your project directory.

  2. git clone: Clones a repository into a new directory.

     $ git clone https://github.com/user/repository.git
    

    Make a copy of a repository from GitHub onto your local machine.

  3. git add: Adds changes to the staging area.

     $ git add file.txt
    

    Prepare changes for commit by adding them to the staging area.

  4. git commit: Records changes to the repository.

     $ git commit -m "Commit message"
    

    Save staged changes to the repository with a descriptive message.

  5. git push: Uploads local repository content to a remote repository.

     $ git push origin main
    

    Send committed changes to a remote repository, typically on GitHub.

  6. git pull: Fetches and merges changes from a remote repository.

     $ git pull origin main
    

    Update your local repository with changes from the remote repository.

  7. git status: Displays the status of the working directory and staging area.

     $ git status
    

    Check the current state of your repository, including tracked and untracked files.

  8. git branch: Lists, creates, or deletes branches.

     $ git branch new_branch
    

    Manage branches within your Git repository.

  9. git merge: Combines changes from different branches.

     $ git merge branch_name
    

    Integrate changes from one branch into another.

  10. git log: Displays commit history.

    $ git log
    

    View a chronological list of commits in the repository.

Now that you have this comprehensive cheat sheet at your disposal, you can breeze through your Linux and Git-GitHub tasks with ease. Bookmark this page, print it out, or keep it handy in your terminal for quick reference. Happy coding! ๐ŸŽ‰

I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching .

thank you : )

0
Subscribe to my newsletter

Read articles from Prathmesh Vibhute directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Prathmesh Vibhute
Prathmesh Vibhute