Day 14 Task: Create a Linux & Git-GitHub Cheat Sheet

Hi, I’m Rakshita. A Cloud, DevOps, AI, and Python enthusiast passionate about learning and simplifying technology for others. I love exploring how modern tools and automation can make systems smarter and more efficient. Here, I write about: ☁️ Cloud & DevOps practices 🤖 AI in the world of automation 🐍 Python for real-world problem-solving 💡 Growth, consistency, and the learner’s mindset My goal is to bridge the gap between learning and doing, and help others grow confidently in the evolving tech landscape.
LINUX COMMANDS CHEAT SHEET
Directory Navigation
ls= list files and directories in current directoryls -a= list all files and directories including hidden files.ls -l= list files and directories in long format.pwd= shows the present working directory.cd [dir_path]= change location to specified directory.cd ~= directory to $HOME.cd ..= move up one directory level.
Files
mkdir [dir_name]\= create a new directory.rm [file_name]\= remove a file.rm -r [directory_name]\= remove a directory recursively.cp [source_file] [destination_file]\= copy the contents of one file to another file.mv [source_file] [destination_file]\= move or rename files or directories.touch [file_name]\= create a new file.cat [file_name]\= show the contents of a file.cat [source_file] >> [destination_file]\= append file contents to another file.nano [file_name]\= open or create a file using the nano text editor.vi [file_name],vim [file_name]\= open or create a file using the Vi/Vim text editor.head [file_name]= show the first ten lines of a file.tail [file_name]\= show the last ten lines of a file.
Users and Groups
sudo useradd [user_name]\= Create a new user account.sudo userdel [user_name\= Delete a user account.sudo usermod -aG [group_name] [user_name]\= Modify user information (add a user to a group).sudo passwd [user_name\= Change the current user's or another user's password.sudo groupadd [group_name]\= Add a new group.sudo groupdel [group_name]\= Delete a group.sudo [command]\= Temporarily elevate user privileges to superuser or root.su - [user_name]\= Switch the user account or become a superuser.
File Permissions
chmod 777 [file_name]\= Assign read, write, and execute file permission to everyone (rwxrwxrwx).chown [user_name] [file_name]\= Change the ownership of a file with chown command.chown [user_name]:[group_name] [file_name]\= Change the owner and group ownership of a file.chgrp [group_name] [file/directory]\= Change file or directory group.
Processes
ps\= List active processes.top\= See all running processeshtop\= Interactive and colorful process viewer.kill [process_id]\= Terminate a Linux process under a given ID.killall [label]\= Terminate all processes with a given label.nohup [command] &\= Run a Linux process in the background.bg\= List and resume stopped jobs in the background.fg\= Bring the most recently suspended job to the foreground.fg [job]\= Bring a particular job to the foreground.
System Management
uptime\= Display how long the system has been running, including the load average.hostname\= View system hostnamehostname -i\= Show the IP address of the systemdate\= See current date and time.cal\= Show current calendar (month and day).whoami\= See which user you are using.
Network
ifconfig\= Display IP addresses of all network interfaces.ping [remote_host]\= Ping remote host.netstat\= Show network statistics.nslookup [domain_name]\= Receive information about an internet domain.
SSH Login
ssh [user_name]@[host]\= Connect to a remote host as a user via SSH.ssh [host]\= Securely connect to a host via SSH default port 22.ssh-keygen\= Generate SSH key pairsscp [file_name] [user_name]@[host]:[rem ote_path]\= Securely copy files between local and remote systems via SSH.
Disk Usage
df -h\= Check free and used space on mounted systems.mount\= Show currently mounted file systems.mount [device_path] [mount_point]\= Mount a device.
File Transfer
scp [source_file] [user]@[remote_host]:[de stination_path]\= Copy a file to a server directory securely.wget [link]\= Download files from FTP or web servers.curl [link]\= Transfer data to or from a server.
File Compression
tar czf [archive.tar.gz]\= Create a .gz compressed tar archive.tar cf [archive.tar] [file/ directory]\= Archive an existing file or directorygzip [file_name],gunzip [file_name.gz]\= Compress or decompress .gz files.unzip [archive.zip]\= Extract a zip archive.
Packages
- (Debian/Ubuntu)
sudo apt update\= Update package list.sudo apt upgrade\= Upgrade installed packages.sudo apt install [package_name]\= Install an APT package.sudo apt remove [package_name]\= Remove an APT package.
- (RedHat/CentOS/Fedora)
sudo yum update\= Update package list and upgrade them.sudo yum install [package_name]\= Install a packagesudo yum remove [package_name]\= Remove a package.
Searching
find [path] -name [search_pattern]\= Find files and directories.grep [search_pattern] [file_name]\= Search for a specific pattern in a file.grep -r [search_pattern] [directory_name]\= Recursively search for a pattern in a directory.grep -i [search_pattern] [file_name]\= Case insensitive search.locate [name]\= Locate all files and directories related to a particular name.awk '[search_pattern] {print $0}' [file_name]\= Print all lines matching a pattern in a file.sed 's/[old_text]/ [new_text]/' [file_name]\= Find and replace text in a specified file.find [dir_name] -name [search_pattern]\= Find files by name.
Service Management
systemctl start [service_name]\= Start a service.systemctl stop [service_name]\= Stop a service.systemctl restart [service_name]\= Restart a service.systemctl status [service_name]\= Check service status.systemctl enable [service_name]\= Enable a service.systemctl disable [service_name]\= Disable a service.
Shell Scripting
Structure
#!/bin/bash echo "Hey! This is my Day14 of 90DaysOfDevOps"Variables
#!/bin/bash NAME="Rakshita" echo "Hey, $NAME"Conditional Statements
if [ condition ]; then # Commands elif [ condition ]; then # Commands else # Commands fiLoops
for i in {1..5}; do echo "Iteration $i" done while [ condition ]; do # Commands done
Additional useful shell commands
man [command]\= Display a built-in manual for a command.history\= Print the command history used in the terminal.echo [text]\= Display the text.who\= Show who is logged on.
GIT-GITHUB COMMANDS CHEAT SHEET
| COMMAND NAME | USE |
| git init | initialize a local git repository |
| git add <filename> | move a particular file to staging area |
| git add . | move all the files to staging area |
| git commit -m "commit message" | creates a new commit in git with a commit message |
| git status | check the status of current repository and list the files you have changed |
| git log | show the list of all the commits made on a branch |
| git log --oneline | view commit ID briefly |
| git diff | show the changes you have made in a file |
| git diff HEAD | show difference between working directory and last commit |
| git config --global user.name "name" | set global Git configuration for username |
| git config --global user.email "email" | set global Git configuration for email address |
| git push origin <branch name> | push the branch to thr remote repository |
| git push -d origin <branch_name> | delete remote branch in git |
| git clone <repository_URL> | copy a git repository from remote source |
| git branch <branch_name> | creates a new branch |
| git checkout <branch_name> | switch from one branch to another |
| git checkout -b <branch_name> | creates and switch to a new branch |
| git branch -d <branch_name> | deletes the branch |
| git branch | show your current branch |
| git merge <branch_name> | merge one branch to another |
| git rebase | combines a sequence of commits to a new base commit and maintains a linear project history |
| git stash | stores something safely in hidden place |
| git stash list | show the stashed items list |
| git stash pop | bring back the file to staging area |
| git stash clear | clear the stashed items |
| git pull | copies changes from remote repository to local |
| git fetch | copies changes into local git repository |
| git revert <commit ID> | revert commit changes |
| git restore --stages <filename> | resetting a staged file |
| git rm <filename> | move the file to staging area |
| git mv <old_filename> <new_filename> | change the file name and move to staging area |
| git reset --soft <commit_ID> | move back all the items to staging area |
| git reset --hard <commit_ID> | discards all history and changes back to the specified commit |
| git remote -v | check if we have connected to any remote repository |
| .gitignore | a text file in a git repository that specifies which files and folders should be ignored and not tracked by version control |
HAPPY LEARNING!😃



