π Day 14: Ultimate Linux & Git-GitHub Cheat Sheet for DevOps Engineers π
π¨βπ» Chintamani Tare | DevOps Enthusiast & Linux Advocate π I'm a passionate DevOps engineer with a solid foundation in Linux system administration. With a deep interest in automation, cloud technologies, and CI/CD pipelines, I love simplifying complex tasks and building scalable infrastructure. Whether it's scripting in Bash, managing servers with Ansible, or deploying applications with Docker and Kubernetes, I'm always eager to explore the latest tools and practices in the DevOps space.
Congratulations on reaching Day 14 of your DevOps journey! π You've been learning Linux and Git-GitHub, two critical skills for any DevOps engineer. Now, it's time to consolidate all that knowledge into an awesome cheat sheet that you can reference anytime.
Letβs create a well-organized, easy-to-follow, and comprehensive cheat sheet with all the important commands youβve learned so far. This will not only help you in the future, but will also be a great resource for the DevOps community! Letβs dive in. π
π Linux Cheat Sheet π
Linux is the backbone of most cloud and DevOps environments. Mastering basic and advanced Linux commands is essential for system administration, scripting, and automation. Below is your go-to cheat sheet with all the Linux commands from basic to advanced.
π§ Basic Linux Commands for Beginners
| Command | Description |
pwd | Prints the current directory path you're working in. |
ls | Lists files and directories in the current directory. Add -l for a detailed view. |
cd [directory] | Changes the current directory to the one specified. |
mkdir [folder_name] | Creates a new directory. |
rmdir [folder_name] | Removes an empty directory. |
rm [file_name] | Removes a file. Use rm -r [folder_name] to remove directories recursively. |
touch [file_name] | Creates a new, empty file. |
cat [file_name] | Displays the content of a file. |
echo "[text]" | Prints text to the terminal or writes it to a file (e.g., echo "Hello" > file.txt). |
cp [source] [destination] | Copies a file or directory from source to destination. |
mv [source] [destination] | Moves or renames a file or directory. |
man [command] | Opens the manual for a command. Use this to learn about any command's options. |
clear | Clears the terminal screen. |
π File Permissions & Users
File permissions are crucial when working on shared systems or production servers. Understanding user roles and how to control access is key.
| Command | Description |
chmod [permissions] [file_name] | Changes file permissions (e.g., chmod 755 file.txt gives read/write/execute access to the owner and read/execute access to others). |
chown [user]:[group] [file_name] | Changes the owner and/or group of a file. |
sudo [command] | Executes a command as a superuser. Use with caution! |
useradd [username] | Adds a new user to the system. |
passwd [username] | Sets or changes the password for a user. |
whoami | Displays the current logged-in user. |
su [username] | Switches to another user. |
βοΈ System Management Commands
These commands will help you monitor and manage your system resources, processes, and services.
| Command | Description |
ps | Displays the currently running processes. |
top | Displays real-time system resource usage (like CPU and memory). |
htop | An improved version of top, providing a cleaner interface for process management. |
df -h | Shows disk space usage in a human-readable format. |
du -sh [directory] | Shows the size of a directory or file. |
free -h | Displays memory (RAM) usage in a human-readable format. |
uptime | Shows how long the system has been running. |
reboot | Reboots the system. |
shutdown now | Shuts down the system immediately. |
kill [PID] | Terminates a process by its Process ID (PID). |
π§ Networking in Linux
As a DevOps engineer, networking is a critical skill. Here are commands that help you configure and troubleshoot network issues.
| Command | Description |
ping [host] | Sends ICMP echo requests to check the connectivity with another machine or server. |
ifconfig | Displays network interface configurations. |
ip a | Another way to view IP address information, commonly used in newer Linux distributions. |
netstat -tuln | Lists all active network connections. |
curl [URL] | Transfers data from or to a server (used to interact with APIs, download files, etc.). |
wget [URL] | Downloads files from the web. |
nslookup [domain] | Queries the DNS to get information about a domain or IP address. |
π Git & GitHub Cheat Sheet π
Git and GitHub are essential for version control and collaboration in any DevOps environment. Hereβs your cheat sheet for basic to advanced Git commands.
π Basic Git Commands
| Command | Description |
git init | Initializes a new Git repository. |
git clone [URL] | Clones a repository from GitHub or another location to your local machine. |
git add [file_name] | Adds changes in the working directory to the staging area. |
git commit -m "[message]" | Commits changes with a message describing the update. |
git status | Shows the current status of your repository, including staged and unstaged changes. |
git log | Displays the commit history. Use git log --oneline for a simpler view. |
git diff | Shows differences between your working directory and the last commit. |
πΏ Branching & Merging
Branches allow you to isolate your work. Hereβs how to create, switch, and merge branches.
| Command | Description |
git branch | Lists all branches in your repository. |
git branch [branch_name] | Creates a new branch. |
git checkout [branch_name] | Switches to the specified branch. |
git merge [branch_name] | Merges the specified branch into the current branch. |
git branch -d [branch_name] | Deletes the specified branch. |
git branch -m [old_name] [new_name] | Renames a branch. |
π Undoing Changes in Git
Sometimes mistakes happen. Hereβs how to undo changes safely.
| Command | Description |
git reset --soft HEAD~1 | Moves the current branch pointer back by one commit, keeping the changes in your working directory. |
git reset --hard HEAD~1 | Moves the current branch pointer back by one commit, and discards all changes. |
git revert [commit_hash] | Reverts the changes made by a specific commit (use this when you want to undo changes in a shared repository). |
git stash | Temporarily saves your uncommitted changes. |
git stash apply | Re-applies your stashed changes. |
π Working with Remote Repositories (GitHub)
To collaborate with others, youβll need to interact with remote repositories like those on GitHub.
| Command | Description |
git remote add origin [URL] | Adds a remote repository (usually GitHub). |
git push [remote] [branch] | Pushes your local changes to the specified remote branch. |
git pull [remote] [branch] | Fetches and merges changes from the remote repository. |
git fetch | Fetches changes from the remote repository without merging. |
β¨ Advanced Git Commands
For advanced users, here are some powerful commands to keep your repository clean and your history organized.
| Command | Description |
git rebase [branch_name] | Re-applies your commits on top of another branchβs history. Useful for keeping your branch up-to-date without creating a merge commit. |
git cherry-pick [commit_hash] | Applies the changes introduced by an existing commit to your current branch. |
git reflog | Shows a history of all your Git operations, including branch switches, merges, and resets. |
git bisect | Finds which commit introduced a bug by performing a binary search. |
π Conclusion
Mastering Linux and Git-GitHub commands is fundamental for any DevOps engineer. Whether youβre building pipelines, deploying applications, or collaborating on open-source projects, having these commands at your fingertips will make your workflow smoother and more efficient.
By using this cheat sheet, you can:
Automate system administration tasks using Linux.
Manage source code efficiently with Git.
Collaborate and deploy code to GitHub with ease.
Happy learning and coding! π
#LinuxCheatSheet #GitCheatSheet #DevOps #DevOpsTools #LinuxCommands #GitHubTips #GitCommands #SystemAdministration #CloudComputing #90DaysOfDevOps



