π Day 17: Linux and Git/GitHub Cheat Sheet
#Day14ofDevOpsBlog

Hey there! π π Welcome to my DevOps journey! π
I'm Tanmaya Arora, an enthusiastic DevOps Engineer. Currently, on a learning adventure, I'm here to share my journey and Blogs about DevOps.
I believe in fostering a culture of resilience, transparency, and shared responsibility. Embracing agility and flexibility, in this adventure let's grow together in this vibrant DevOps space.
Join me in transforming software delivery through collaboration, innovation, and excellence! ππ§π‘
π Connect with me for friendly chats, group discussions, shared experiences and learning moments.
Finally!! π
You have completed the Linux & Git-GitHub hands-on tasks, and I hope you have learned something interesting from it. π
Now, let's create an interesting π blog that will benefit the DevOps community!
π» Linux Commands Cheat Sheet
π File and Directory Operations
ls: List files and directories in the current directory.cd <directory>: Change the current directory.pwd: Print the current working directory.mkdir <directory>: Create a new directory.rmdir <directory>: Remove an empty directory.touch <file>: Create an empty file or update the timestamp of an existing file.cp <source> <destination>: Copy files or directories.mv <source> <destination>: Move or rename files or directories.rm <file>: Remove files.cat <file>: View the content of a file.
π File Permissions
chmod <permissions> <file>: Change file or directory permissions (e.g.,chmod 777 <file>).chown <user>:<group> <file>: Change the owner and group of a file.
π Viewing and Searching
cat <file>: Display the contents of a file.less <file>: View the content of a file page by page.grep <pattern> <file>: Search for a specific pattern in a file.find <directory> -name <filename>: Search for a file by name in a directory.
π₯ System Monitoring
top: Display real-time system processes.ps: Display currently running processes.df -h: Show disk space usage in a human-readable format.free -m: Display memory usage in megabytes.
π Networking
ifconfig: Display network interfaces and IP addresses.ping <host>: Send ICMP echo requests to check connectivity to a host.netstat: Display network connections, routing tables, and interface statistics.
π¦ Package Management
apt update: Update package list (Debian/Ubuntu).apt upgrade: Upgrade installed packages (Debian/Ubuntu).yum update: Update packages (CentOS/RHEL).yum install <package>: Install a package (CentOS/RHEL).
π Process Management
kill <PID>: Terminate a process by PID.killall <process_name>: Terminate all processes with a specific name.nice -n <priority> <command>: Run a command with a specific priority.
π Shell Scripting
nano <script.sh>: Edit a script file using the Nano text editor../script.sh: Execute a shell script.echo "text": Print text to the terminal.
π Archiving and Compression
tar -cvf <archive.tar> <files>: Create a tar archive.tar -xvf <archive.tar>: Extract a tar archive.gzip <file>: Compress a file using gzip.gunzip <file.gz>: Decompress a gzip file.
βοΈ For more advanced commands, like AWK, GREP and SED, please refer my Advanced Linux blog :)
π Git and GitHub Commands Cheat Sheet
π± Getting Started with Git
git init: Initialize a new Git repository in the current directory.git config --global user.name <Name>andgit config --global user.email <Email>: Used to configure git and to help it recognize out machine.git clone <repo_url>: Clone a repository into a new directory.
π Working with Files
git add <file>: Add a file to the staging area.git add .: Add all changes in the current directory to the staging area.git commit -m "message": Commit changes in the staging area with a descriptive message.git status: Show the working tree status.git diff: View changes between the working directory and the staging area.
π Viewing History
git log: Show the commit history.git log --oneline: Show the commit history in a condensed, one-line format.
π Undoing Changes
git restore <file_name>: Discard changes in the working directory.git reset <file_name>: Unstage a file without losing its changes. Not recommended to do.git revert <commit_hash>: Create a new commit that undoes the changes of a specific commit.
πΏ Branching
git branch: List branches.git branch <branch_name>: Create a new branch.git checkout <branch_name>: Switch to an existing branch.git switch <branch_name>: Another way to switch branches.
π Merging & Rebase
git merge <branch_name>: Merge a branch into the current branch.git rebase <branch_name>: Reapply commits from the current branch onto another branch.
π Syncing with Remote
git remote add origin <repo_url>: Add a remote repository.git push origin <branch_name>: Push changes to the remote repository.git pull origin <branch_name>: Fetch and merge changes from the remote repository.
π GitHub Basics
git fork: Create a copy of a repository on your GitHub account.git clone <forked_repo_url>: Clone the forked repository.git push origin <branch_name>: Push changes to your forked repository.Pull Request (PR): After pushing changes to GitHub, create a PR to merge changes into the original repository.
π Github Advanced commands
git cherry-pick <commit_id>: Used to merge a particular commit from one branch to another rather than merging the complete branch.git stash <branch_name>: Reapply commits from the current branch onto another branch.
π SSH Setup
ssh-keygen -t rsa -b 4096 -C "your_email@example.com": Generate a new SSH key.eval "$(ssh-agent -s)": Start the SSH agent.ssh-add ~/.ssh/id_rsa: Add your SSH private key to the agent.
This bog covers the essentials of working with Linux, Git and GitHub, focusing on the most frequently used commands. π. I hope this helps, for any queries please feel free to reach me out on Linkedin :)




