Skip to main content

Command Palette

Search for a command to run...

Cheat sheet for Linux, Git-GitHub commands

Published
3 min readView as Markdown
Cheat sheet for Linux, Git-GitHub commands

Linux Commands:

  1. Navigation:

    • cd: Change directory.

    • ls: List files and directories.

    • pwd: Print working directory.

    • mkdir: Make a new directory.

    • rmdir: Remove an empty directory.

    • rm: Remove files or directories.

  2. File Operations:

    • touch: Create an empty file.

    • cp: Copy files or directories.

    • mv: Move or rename files or directories.

    • cat: Concatenate and display file contents.

    • less: View file content with pagination.

    • head: Display the beginning of a file.

    • tail: Display the end of a file.

  3. System Information:

    • top: Display system processes.

    • ps: Display currently running processes.

    • df: Display disk space usage.

    • free: Display memory usage.

    • uname: Print system information.

  4. Permissions:

    • chmod: Change file permissions.

    • chown: Change file ownership.

    • chgrp: Change group ownership.

  5. Networking:

    • ping: Send ICMP echo requests to a host.

    • ifconfig or ip: Network interface configuration.

    • ssh: Secure shell remote login.

    • scp: Securely copy files between hosts.

  6. Text Editing with Nano:

    • nano: Open the nano text editor.

      • Ctrl + O: Save the file.

      • Ctrl + X: Exit the editor.

      • Ctrl + G: Display help.

      • Ctrl + K: Cut the current line.

      • Ctrl + U: Paste the cut line.

  7. Cron Jobs:

    • crontab -e: Edit the current user's cron jobs.

      • * * * * * command: Schedule a cron job with the desired command.

        • The five * represent the minute, hour, day of the month, month, and day of the week fields.

        • For example, 0 2 * * * would run the command at 2:00 AM daily.

Remember to use sudo for commands that require administrative privileges. Be cautious when using rm and other destructive commands. Always verify before proceeding.

Git Commands:

  1. Configuration:

    • git config: Set or view Git configurations.

    • git init: Initialize a new Git repository.

    • git clone: Clone a remote repository to a local machine.

  2. Basic Workflow:

    • git add: Add changes to the staging area.

    • git commit: Commit changes from the staging area to the repository.

    • git status: Show the working tree status.

    • git diff: Show changes between commits or working tree and staging area.

    • git log: View commit history.

  3. Branching and Merging:

    • git branch: List, create, or delete branches.

    • git checkout: Switch branches or restore working tree files.

    • git merge: Merge changes from one branch into another.

    • git cherry-pick: Apply a specific commit from one branch to the current branch.

  4. Stashing Changes:

    • git stash: Temporarily save changes to a stack.

    • git stash list: List stashed changes.

    • git stash apply: Apply the most recent stash and keep it in the stack.

    • git stash pop: Apply the most recent stash and remove it from the stack.

  5. Rebasing:

    • git rebase: Reapply commits on top of another base commit.

    • git rebase -i: Interactive rebase to modify, squash, or reorder commits.

  6. Remote Repositories:

    • git remote: Manage set of tracked repositories.

    • git fetch: Download objects and refs from another repository.

    • git pull: Fetch and integrate changes from a remote repository.

    • git push: Update remote refs along with associated objects.

GitHub Commands:

  1. Working with GitHub:

    • git remote add: Add a remote repository (GitHub) as a named alias.

    • git push origin: Push changes to a remote repository (GitHub).

    • git pull origin: Pull changes from a remote repository (GitHub).

    • git clone: Clone a GitHub repository to a local machine.

  2. Collaboration:

    • git pull request: Create or view a pull request on GitHub.

    • git fetch: Download objects and refs from another repository (GitHub).

🚀Congratulations on reaching the end of our comprehensive cheat sheet for Linux and Git-GitHub! We hope this blog has been a valuable resource for both beginners and seasoned developers, helping you streamline your development process and enhance your productivity.

R

This is a nice cheat sheet, especially for beginners. Nice job!!!

More from this blog

Geethika's blog

18 posts