Mastering Linux, Git, and GitHub: The Ultimate Command Cheat Sheet for DevOps Engineers

Mastering Linux, Git, and GitHub: The Ultimate Command Cheat Sheet for DevOps Engineers

Day 12: Cheat Sheet for Linux, Git and GitHub

Introduction

For developers and other IT professionals, learning how to use the command line is essential. Condensed lists of essential Linux, Git, and GitHub commands covering a broad range of topics, such as networking and version control, are provided by this cheat sheet. This resource, which is arranged for easy access, will enable you to use the command line with assurance and effectiveness.

Linux Commands with Description & Usage

  1. ls: List all the directories and files.

  2. mkdir: Makes a new directory.

  3. rmdir: Remove a directory (only if it's empty).

  4. cd: Change directory.

  5. cd ..: Go back to the previous directory.

  6. pwd: Print the current working directory.

  7. ls -l: List files with more details.

  8. cat: Show the content of a file.

  9. echo: Shows the desired string and value.

  10. man: Tells about all commands.

  11. touch: Create a file.

  12. cp: Copy files.

  13. mv: Move files.

  14. rm: Remove the file permanently.

  15. sudo: Administrative commands (password).

  16. head: Display the first 10 lines.

  17. tail: Display the last 10 lines.

  18. zip: Zip files in Linux.

  19. unzip: Unzip files in Linux.

  20. ssh: Secure Shell command in Linux.

  21. service: Linux command to start and stop services.

  22. ps: Display active processes.

  23. wget: Download files from the internet.

  24. whoami: Show the current user.

  25. grep: Search for a string within an output.

  26. sort: Sort the file content.

  27. cal: View Calendar in the terminal.

  28. whereis: View the exact location of any command types after this command.

  29. kill and killall: Kill active processes by process ID or name.

  30. chmod: Change file permissions.

  31. chown: Change file ownership.

  32. history: Shows history of command usage.

  33. uptime: Show system uptime and load averages.

  34. top: Display system processes and resource usage.

  35. free: Display memory usage statistics.

  36. ifconfig: Display or configure network interfaces.

  37. netstat: Display network statistics.

  38. ssh-keygen: Generate SSH key pairs.

  39. scp: Securely copy files between hosts.

  40. rsync: Synchronize files and directories between two locations.

  41. cron: Schedule tasks to run at specific intervals.

  42. crontab: Manage user-specific cron jobs.

  43. history: View and manage command history.

  44. sed: Stream editor for text manipulation.

  45. awk: Text processing and pattern matching.

  46. nano or vi: Text editors for file editing.

  47. ping: Send network ICMP echo requests to a host.

  48. traceroute: Trace the route packets take to a destination.

  49. shutdown: Shut down or reboot the system.

  50. useradd and usermod: Add a new user or change the existing user's data.

  51. passwd: Create or update passwords for existing users.

  52. df: Display disk space usage of file systems.

  53. du: Estimate file and directory space usage.

  54. tar: Archive files and directories into a single file.

  55. find: Search for files and directories.

  56. grep: Search for a pattern in files.

  57. chmod: Change file permissions.

  58. chown: Change file ownership.

  59. ln: Create links between files.

  60. kill: Terminate processes by ID or name.

  61. ps aux: Display detailed information about active processes.

  62. uptime: Show system uptime and load averages.

  63. nc: Netcat - network utility for reading/writing network connections.

Note: You can explore further by referring to their respectiveman pages or online Linux documentation.

Git-GitHub Commands with Description & Usage

  1. git init: Initialize a new Git repository in the current directory.

  2. git clone <repository-url>: Clone a remote repository to your local machine.

  3. git status: Show the current status of the repository.

  4. git add <file>: Add a file to the staging area.

  5. git commit -m "commit message": Create a new commit with a message.

  6. git diff: View the differences between the working directory and the staging area.

  7. git log: Display the commit history.

  8. git branch: List all branches in the repository.

  9. git checkout <branch>: Switch to a different branch.

  10. git merge <branch>: Merge changes from a branch into the current branch.

  11. git pull: Fetch and merge changes from a remote repository.

  12. git push: Push local commits to a remote repository.

  13. git remote add origin <repository-url>: Add a remote repository as the origin.

  14. git remote -v: View a list of remote repositories and their URLs.

  15. git reset <file>: Unstage changes for a file.

  16. git rm <file>: Remove a file from the repository and staging area.

  17. git stash: Temporarily store changes not ready for a commit.

  18. git cherry-pick <commit>: Apply changes from a specific commit.

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

  20. git revert <commit>: Create a new commit that undoes changes from a specific commit.

  21. git push origin <branch>: Push local commits to a remote branch on GitHub.

  22. git pull origin <branch>: Fetch and merge changes from a remote branch on GitHub.

  23. git fork: Create a copy of a repository on your GitHub account.

  24. git pull-request: Create a pull request to propose changes from your fork.

  25. git pull upstream <branch>: Pull changes from the original repository after forking (upstream).

  26. git remote add upstream <original-repo-url>: Add the original repository as the upstream remote for your fork.

  27. git branch -d <branch>: Delete a local branch after it's merged and no longer needed.

  28. git push origin --delete <branch>: Delete a remote branch on GitHub.

  29. git remote show <remote>: Show detailed information about a remote.

  30. git tag: Create, list, or delete tags.

  31. git blame <file>: Show who changed each line in a file.

  32. git config: Set or get repository or global configuration options.

  33. git log --graph: Display the commit history in a graph view.

  34. git reflog: Show a log of changes to branch references.

  35. git rebase: Reapply commits on top of another base tip.

  36. git reset --hard <commit>: Reset the repository to a specific commit.

  37. git stash pop: Apply and remove the most recently stashed changes.

  38. git stash list: List all stashed changes.

  39. git stash apply: Apply the changes from a specific stash.

  40. git stash drop: Delete a specific stash.

  41. git stash clear: Remove all stashes.

  42. git clean: Remove untracked files and directories.

  43. git bisect: Find the commit that introduced a bug using binary search.

  44. git show: Show the details and changes of a commit.

  45. git grep: Search for a pattern in tracked files.

  46. git remote set-url <remote> <url>: Update the URL of a remote repository.

  47. git submodule: Manage submodules within a repository.

  48. git rebase -i: Interactively rebase commits.

  49. git cherry-pick --continue / --abort: Continue or abort a cherry-pick sequence.

  50. git commit --amend: Modify the most recent commit.

  51. git log --author=<author>: Show commit history by a specific author.

  52. git log --since=<date>: Show commit history since a specific date.

  53. git log --grep=<pattern>: Show commits with messages matching a pattern.

Conclusion

This comprehensive cheat sheet serves as an invaluable resource for developers and IT professionals seeking to enhance their command-line proficiency with Linux, Git, and GitHub. Covering a wide range of essential commands for networking, version control, and system administration, this resource provides condensed lists and usage descriptions for easy reference and quick access. Whether you're navigating file systems, managing repositories, or collaborating on projects, mastering these commands will empower you to work with confidence and efficiency in your DevOps endeavors.

Happy Learning!

To connect on LinkedIn click here.