Linux and GitHub-Cheat Sheet

Linux and GitHub-Cheat Sheet

day12 of #90daysofdevops

Linux Commands

  1. ls: List files and directories.

  2. cd [directory]: Change directory.

  3. pwd: Print working directory.

  4. mkdir [directory]: Create a directory.

  5. rm [file]: Remove a file.

  6. rm -r [directory]: Remove a directory and its contents.

  7. cp [source] [destination]: Copy files or directories.

  8. mv [source] [destination]: Move or rename files or directories.

  9. cat [file]: Display file contents.

  10. grep [pattern] [file]: Search for a pattern in files.

  11. chmod [permissions] [file]: Change file permissions.

  12. chown [user] [file]: Change file ownership.

  13. ssh [user@host]: Securely connect to a remote server.

  14. sudo [command]: Run a command with superuser privileges.

  15. apt-get [package]: Install or manage packages on Debian-based systems.

  16. yum [package]: Install or manage packages on RPM-based systems.

  17. man [command]: Display the manual page for a command.

  18. history: View command history.

  19. wget [URL]: Download files from the web.

  20. tar [options] [file]: Compress or extract files from an archive.

  21. df: Display disk space usage.

  22. du [directory]: Estimate file and directory space usage.

  23. find [directory] [options]: Search for files and directories.

  24. grep -r [pattern] [directory]: Recursively search for a pattern in files.

  25. ps: Display running processes.

  26. top: Monitor system activity and processes.

  27. kill [process_id]: Terminate a process.

  28. ifconfig: Display or configure network interfaces.

  29. ping [host]: Send ICMP echo requests to a host.

  30. ssh-keygen: Generate SSH key pairs.

  31. scp [file] [user@host:destination]: Securely copy files between hosts.

  32. mount [device] [directory]: Mount a filesystem.

  33. umount [directory]: Unmount a filesystem.

  34. chmod +x [file]: Make a file executable.

  35. df -h: Display disk space usage in human-readable format.

  36. uptime: Show system uptime and load average.

  37. head [file]: Display the first lines of a file.

  38. tail [file]: Display the last lines of a file.

  39. zip [options] [archive] [files]: Create a ZIP archive.

  40. unzip [archive]: Extract files from a ZIP archive.

  41. ln -s [source] [link_name]: Create a symbolic link.

  42. history [number]: Show the last [number] of commands from history.

  43. apt-cache search [keyword]: Search for packages by keyword.

  44. nc [options] [host] [port]: Connect and send data to a network host.

  45. rsync [options] [source] [destination]: Synchronize files and directories.

  46. dd [options] [if=input] [of=output]: Convert and copy a file.

  47. whoami: Display the current user.

  48. basename [path]: Get the base name of a file path.

  49. cut -d [delimiter] -f [fields] [file]: Extract specific fields from a file.

  50. date: Display the current date and time.

Git and Github Commands

  1. git init: Initialize a new Git repository.

  2. git clone [repository_url]: Clone a repository from a remote server.

  3. git add [file]: Add a file to the staging area.

  4. git add .: Add all files to the staging area.

  5. git commit -m "[message]": Commit changes to the repository.

  6. git commit -a -m "[message]": Stage and commit changes.

  7. git push: Push changes to a remote repository.

  8. git push -u [remote] [branch]: Push changes and set the upstream branch.

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

  10. git fetch: Download changes from a remote repository.

  11. git merge [branch_name]: Merge changes from another branch.

  12. git branch: List branches in the repository.

  13. git branch [branch_name]: Create a new branch.

  14. git branch -d [branch_name]: Delete a branch.

  15. git checkout [branch_name]: Switch to a different branch.

  16. git checkout -b [branch_name]: Create and switch to a new branch.

  17. git status: Show the status of the repository.

  18. git log: Display the commit history.

  19. git log --graph: Show the commit history with a graph.

  20. git remote: Manage remote repositories.

  21. git remote -v: List remote repositories and their URLs.

  22. git remote add [name] [url]: Add a new remote repository.

  23. git remote remove [name]: Remove a remote repository.

  24. git stash: Save changes that are not ready to be committed.

  25. git stash list: List stashed changes.

  26. git stash apply: Apply the most recent stash.

  27. git stash drop: Discard the most recent stash.

  28. git revert [commit]: Revert a commit.

  29. git reset [commit]: Reset the repository to a previous commit.

  30. git reset --hard [commit]: Reset the repository and discard changes.

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

  32. git tag [tag_name]: Create a new tag.

  33. git tag -a [tag_name] -m "[message]": Create an annotated tag.

  34. git tag -d [tag_name]: Delete a tag.

  35. git show [commit]: Show information about a commit.

  36. git diff: Show changes between commits, branches, or files.

  37. git blame [file]: Show who last modified each line of a file.

  38. git config --global user.name "[name]": Set the author name for commits.

  39. git config --global user.email "[email]": Set the author email for commits.

  40. git config --global alias.[alias_name] "[command]": Create a Git alias.

  41. git cherry-pick [commit]: Apply a specific commit to the current branch.

  42. git rebase [branch]: Reapply commits on top of another branch.

  43. git bisect [options]: Use binary search to find a faulty commit.

  44. git remote show [remote_name]: Show information about a remote repository.

  45. git submodule add [repository_url] [directory]: Add a submodule to the repository.

  46. git submodule update --init: Initialize and update submodules.

  47. git clean -n: Show files and directories that are not tracked.

  48. git clean -f: Remove untracked files and directories.

  49. git log --oneline: Show the commit history in a simplified format.

  50. git log --author="[author_name]": Show the commit history by a specific author.

Thanks for Reading!!

Prajwal~~