Day 12 of 90DaysOfDevOps Challenge: Crafting Your Essential Linux and Git-GitHub Cheat Sheet ๐ ๏ธ
This is #90DaysofDevops challenge under the guidance of Shubham Londhe sir.
Day 12 TASK
Introduction
Welcome to Day 12 of the #90DaysOfDevOps challenge! Today, we're diving into the world of Linux and Git-GitHub commands, and I'm excited to share with you a comprehensive cheat sheet that will be your go-to guide throughout your DevOps journey.
Let's get started!
Linux & Git Cheat-Sheet ๐
๐ง Linux Cheat-Sheet
Navigation:
cd [directory]
: Move to a different directory.ls
: List files and directories.pwd
: Display the current directory's path.mkdir [directory]
: Create a new directory.rm [file]
: Delete a file.rm -r [directory]
: Remove a directory and its contents.
File Operations:
touch [file]
: Create a new file.cat [file]
: View file contents.cp [source] [destination]
: Copy files.mv [source] [destination]
: Move or rename files.
User and Group Management:
sudo [command]
: Execute a command with superuser privileges.useradd [username]
: Create a new user.passwd [username]
: Set a password for a user.su [username]
: Switch to another user.userdel [username]
: Delete a user.chmod [permissions] [file]
: Change file permissions.chown [owner:group] [file]
: Change file owner and group.chgrp [group] [file]
: Change file group.
Process Management:
ps
: Display running processes.top
: Monitor system resources and processes.kill [pid]
: Terminate a process.
Networking:
ping [host]
: Check network connectivity.ifconfig
: View network interfaces.netstat
: Display network connections and statistics.
System Monitoring:
df -h
: Show disk space usage.free -h
: Display available memory.top
: Display CPU utilization and other process information.
Additional Commands:
tar -czvf [archive.tar.gz] [files/directories]
: Create a compressed tarball.tar -xzvf [archive.tar.gz]
: Extract a tarball.grep [pattern] [file]
: Search for a pattern in a file.sed 's/old/new/g' [file]
: Replace text in a file.uname -a
: Display system information.apt update
: Update package lists.apt install [package]
: Install a package.apt remove [package]
: Uninstall a package.
๐ Git-GitHub Cheat-Sheet
Repository Management:
git init
: Initialize a new Git repository.git clone [repository]
: Clone a repository from GitHub.git add [file]
: Add a file to the staging area.git commit -m "[message]"
: Commit changes with a message.git push
: Push commits to a remote repository.git pull
: Fetch and merge changes from a remote repository.
Branching and Merging:
git branch
: List branches.git branch [branch]
: Create a new branch.git checkout [branch]
: Switch to a branch.git merge [branch]
: Merge changes from a branch.git rebase [branch]
: Rebase changes onto another branch.
Stashing and Cleaning:
git stash
: Temporarily shelve changes.git stash pop
: Apply stashed changes and remove from stash.
Cherry-Picking:
git cherry-pick [commit]
: Apply a specific commit to the current branch.
Collaboration:
git remote add [name] [url]
: Add a remote repository.git fetch [remote]
: Fetch changes from a remote repository.git pull [remote] [branch]
: Pull changes from a remote branch.git push [remote] [branch]
: Push commits to a remote branch.
Undoing Changes:
git reset --hard [commit]
: Reset to a specific commit, discarding changes.git revert [commit]
: Revert changes introduced by a commit.
Feel free to keep this cheat sheet handy for quick reference during your DevOps journey. Let it remind you of the important commands and concepts we've covered together.