Day 10 of 100 Days: Git and Linux Commands Cheat Sheet

Munilakshmi G JMunilakshmi G J
5 min read

Welcome to your power-packed guide on Git and Linux commands! Think of Git as your digital logbook, capturing every update you make, while Linux is your command-line toolkit, ready to handle everything from organization to quick navigation.

🛠️ Git Commands: Your Code Collaboration Hub

  1. git init

    • Start a new Git repository in your directory.

    • Tip: Like opening a blank project binder.

  2. git clone <url>

    • Duplicate an existing repository locally.

    • Tip: Making a local copy of shared resources.

  3. git add <file>

    • Stage changes for the next commit.

    • Tip: Selecting items for your next “snapshot.”

  4. git commit -m "message"

    • Record staged changes with a message.

    • Tip: Capturing a moment with a caption!

  5. git status

    • Check which files are staged or unstaged.

    • Tip: A quick status check of your workspace.

  6. git log

    • View the commit history.

    • Tip: Your timeline of changes and actions.

  7. git push

    • Send local commits to a remote repository.

    • Tip: Sharing your work with the team.

  8. git pull

    • Fetch and integrate remote changes.

    • Tip: Syncing with the latest updates.

  9. git branch

    • List, create, or delete branches.

    • Tip: Organize work by creating “paths” for features or fixes.

  10. git merge <branch>

    • Integrate changes from one branch to another.

    • Tip: Merging paths for seamless teamwork.

  11. git checkout <branch>

    • Switch between branches.

    • Tip: Moving to another track of work.

  12. git reset <file>

    • Unstage a file from commit.

    • Tip: Reconsider changes before finalizing.

  13. git diff

    • See differences since the last commit.

    • Tip: Quickly spot changes before saving.

  14. git stash

    • Temporarily save work in progress.

    • Tip: Store work without committing.

  15. git stash pop

    • Retrieve stashed changes.

    • Tip: Resuming where you left off.

  16. git rm <file>

    • Remove files from the repository.

    • Tip: Cleaning up unneeded items.

  17. git remote -v

    • View all remote repositories linked.

    • Tip: Track and manage your connected locations.

  18. git fetch

    • Download remote changes without merging.

    • Tip: Updating data without applying it yet.

  19. git rebase <branch>

    • Move branch changes onto another branch.

    • Tip: Reshuffling history for clarity.

  20. git tag <name>

    • Create a version tag for a specific commit.

    • Tip: Marking major milestones.

  21. git cherry-pick <commit>

    • Apply specific commits to another branch.

    • Tip: Selectively merge useful changes.

  22. git show <commit>

    • Display details of a commit.

    • Tip: Zooming in on specific updates.

  23. git blame <file>

    • Identify who made changes to each line.

    • Tip: Tracking responsibility line-by-line.

  24. git config

    • Set user-specific Git configuration.

    • Tip: Personalizing your setup.

  25. git revert <commit>

    • Undo a commit without rewriting history.

    • Tip: Undo with accountability.

  26. git archive

    • Create an archive file of your project.

    • Tip: Compress and save everything.

  27. git clean -f

    • Remove untracked files.

    • Tip: Clear unused files from your workspace.

  28. git shortlog

    • Summarize commit history.

    • Tip: A condensed view of contributions.

  29. git bisect

    • Locate a bug-causing commit.

    • Tip: Pinpointing an issue in the history.

  30. git reflog

    • Review recent actions in Git.

    • Tip: A log of your entire session history.

🔧 Linux Commands: A Command-Line Toolkit

  1. ls

    • List files and directories.

    • Tip: Quick overview of contents.

  2. cd <directory>

    • Change the current directory.

    • Tip: Moving around directories.

  3. pwd

    • Display the current directory path.

    • Tip: Know exactly where you are.

  4. touch <file>

    • Create a new, empty file.

    • Tip: Instantly generate a placeholder.

  5. mkdir <directory>

    • Create a new directory.

    • Tip: Organize files into folders.

  6. rm <file>

    • Delete a file.

    • Tip: Remove unwanted items.

  7. cp <source> <destination>

    • Copy files or directories.

    • Tip: Duplicate files efficiently.

  8. mv <source> <destination>

    • Move or rename files.

    • Tip: Organize files by moving or renaming.

  9. cat <file>

    • Display file content.

    • Tip: Quick file reading.

  10. echo <text>

    • Output text to screen or files.

    • Tip: Display or save simple messages.

  11. chmod <permissions> <file>

    • Change file permissions.

    • Tip: Control access to files.

  12. chown <user> <file>

    • Change file ownership.

    • Tip: Reassign responsibility.

  13. df -h

    • View available disk space.

    • Tip: Know your storage capacity.

  14. du -h <directory>

    • Display directory size.

    • Tip: Measure space used by folders.

  15. head <file>

    • View the start of a file.

    • Tip: Preview content at the top.

  16. tail <file>

    • View the end of a file.

    • Tip: Jump to the last lines.

  17. grep <text> <file>

    • Search for text within files.

    • Tip: Find specific lines quickly.

  18. find <directory> -name <filename>

    • Locate files by name.

    • Tip: Efficient file searching.

  19. ps aux

    • Display active processes.

    • Tip: Check running processes.

  20. kill <process_id>

    • Terminate a process.

    • Tip: End tasks that cause issues.

  21. top

    • View system resource usage.

    • Tip: Monitor performance in real-time.

  22. whoami

    • Display current user.

    • Tip: Identify who’s logged in.

  23. uname -a

    • View system information.

    • Tip: Gather system details.

  24. man <command>

    • Display the manual for a command.

    • Tip: Access detailed usage info.

  25. history

    • Show command history.

    • Tip: Recall past commands.

  26. clear

    • Clear the terminal screen.

    • Tip: Refresh the workspace.

  27. alias <shortcut>='<command>'

    • Create command shortcuts.

    • Tip: Save time with custom aliases.

  28. scp <source> <user@destination>

    • Securely copy files to another location.

    • Tip: Transfer files securely.

Conclusion:

Exploring Git and Linux commands can feel like unlocking new powers every day! This guide provides essential tools, with practical tips to help you achieve more in your DevOps journey. Experiment with these commands to deepen your understanding and keep this sheet handy for a quick reference. Whether managing complex codebases or navigating system operations, these commands simplify your workflow and empower you to work confidently on the command line.

Next Step: Take one new command from this list each day, and experiment with it. Write a script or build a tiny project around it. Your familiarity with these tools will grow with practice, and you’ll find that every line you enter gets you one step closer to command-line fluency!

0
Subscribe to my newsletter

Read articles from Munilakshmi G J directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Munilakshmi G J
Munilakshmi G J

"Aspiring DevOps Engineer on a 100-day journey to master the principles, tools, and practices of DevOps. Sharing daily insights, practical lessons, and hands-on projects to document my path from beginner to proficient. Passionate about continuous learning, automation, and bridging the gap between development and operations. Join me as I explore the world of DevOps, one day at a time!"