Day 12 Linux & Git-GitHub Cheat Sheet.

Harsh Rajotya is a technical blogger and a cloud DevOps engineer with a BE in Electronics and Computers from M.B.M. Engineering College, Jodhpur. He holds multiple certifications in AWS, Python, and RHCSA8, and is proficient in various cloud computing, infrastructure provisioning, containerization, CI/CD, and configuration management technologies and tools.
As a DevOps engineer at DevOpsFarm Inc, he deploys and manages end-to-end applications using Jenkins, Git, Terraform, Docker, and Kubernetes on AWS. He has experience in working with several AWS services, such as EC2, EBS, S3, VPC, autoscaling, and load balancing, and implements security policies using IAM, inline policies, and bucket policies. He also handles scheduled Cron jobs for snapshots and backups and is familiar with Ansible and Chef. He is passionate about learning new technologies and sharing his knowledge through technical blogging on Medium, where he has worked on projects involving deploying full-stack, Node.js, and MongoDB applications.
Linux Commands:
ls: List all the directories and files.mkdir: Makes a new directory.rmdir: Remove a directory (only if it's empty).cd: Change directory.cd..: Go back to the previous directory.pwd: Print the current working directory.ls -l: List files with more details.cat: Show the content of a file.echo: Shows the desired string and value.man: Tells about all commands.touch: Create a file.cp: Copy files.mv: Move files.rm: Remove the file permanently.sudo: Administrative commands (password).head: Display the first 10 lines.tail: Display the last 10 lines.zip: Zip files in Linux.unzip: Unzip files in Linux.ssh: Secure Shell command in Linux.service: Linux command to start and stop services.ps: Display active processes.wget: Download files from the internet.whoami: Show the current user.grep: Search for a string within an output.sort: Sort the file content.cal: View Calendar in the terminal.whereis: View the exact location of any command types after this command.killandkillall: Kill active processes by process ID or name.chmod: Change file permissions.chown: Change file ownership.history: Shows history of command usage.useraddandusermod: Add a new user or change the existing user's data.passwd: Create or update passwords for existing users.
Git-GitHub Commands:
git init: Initialize a new Git repository in the current directory.git clone <repository-url>: Clone a remote repository to your local machine.git status: Show the current status of the repository (modified files, staged changes, etc.).git add <file>: Add a file to the staging area to be included in the next commit.git commit -m "commit message": Create a new commit with the staged changes and a descriptive message.git diff: View the differences between the working directory and the staging area.git log: Display the commit history of the repository.git branch: List all branches in the repository.git checkout <branch>: Switch to a different branch.git merge <branch>: Merge changes from the specified branch into the current branch.git pull: Fetch and merge changes from a remote repository into the current branch.git push: Push local commits to a remote repository.git remote add origin <repository-url>: Add a remote repository as the origin (usually the main remote).git remote -v: View a list of remote repositories and their URLs.git reset <file>: Unstage changes for a file, removing them from the staging area.git rm <file>: Remove a file from the repository and staging area.git stash: Temporarily store changes not ready for a commit.git cherry-pick <commit>: Apply changes from a specific commit to the current branch.git fetch: Download objects and refs from another repository without merging.git revert <commit>: Create a new commit that undoes the changes from a specific commit.git remote -v: View a list of remote repositories and their URLs, including GitHub remotes.git push origin <branch>: Push local commits to a remote branch on GitHub.git pull origin <branch>: Fetch and merge changes from a remote branch on GitHub into the current branch.git clone <repository-url>: Clone a GitHub repository to your local machine.git fork: Create a copy of a repository on your GitHub account (forking).git pull-request: Create a pull request to propose changes from your fork to the original repository.git pull upstream <branch>: Pull changes from the original repository after forking (upstream).git remote add upstream <original-repo-url>: Add the original repository as the upstream remote for your fork.git branch -d <branch>: Delete a local branch after it's merged and no longer needed.git push origin --delete <branch>: Delete a remote branch on GitHub.
Conclusion
In this session, we covered a range of essential Linux and Git-GitHub commands. From navigating directories, managing files, and handling processes in Linux to initializing repositories, creating commits, and collaborating on GitHub, you now have a solid foundation to work effectively in both environments. Keep practicing these commands to become more proficient and efficient in your DevOps endeavors. Embrace the challenges ahead and stay excited for continued growth and learning! 💪😊🚀.




