Git Cheat Sheet
Command What is the purpose of each?
git config --global user.name “<name>” Set a global username for Git in your local system
git config --global user.email “<emailID>” Set a global email for Git in your local system
git init Initialize a new git repo
git clone <repository_url> Create a working copy of a remote git repo
git add <file_name> Move the changes to the staging area
git commit -m “<message>” Commit the changes to the repo
git push <remote> <branch_name> Push local changes to the remote repo
git branch <branch_name> Create a new branch in the repo
git checkout <branch_name> Switch to a different branch
git checkout -b <branch_name> Create and switch to a new branch
git branch List all branches of the repo
Delete a branch from the repo
-d: delete a branch that has been fully merged into the
git branch -d/-D <branch_name> current branch.
-D: forcefully delete a branch, even if it contains unmerged
changes.
git log View the commit history
git merge <branch_name> Merge changes from one branch to another
git pull <remote> <branch_name> Fetch and merge changes from the remote repo
git fetch Fetch changes from the remote repo
git status Check the state of the repo and the files within
Show differences between the current work and the last
git diff
saved snapshot in the repo
git reset Undo changes in the repo
git revert <commitID> Undo a specific commit by creating a new commit
git remote add <name> <repository_url> Connect the local repo to the remote repo
Displays the list of remote repos associated with local repo,
git remote -v
along with their corresponding URLs
git stash Temporarily save changes without committing
git stash pop Apply & remove the most recent stash changes
git stash apply Apply the most recent stash changes
git cherry-pick <commitID> Apply specific commits from one branch onto another
Remove untracked files and directories from the local
git clean
working directory
Bakul Warikoo
Linux Cheat Sheet
Command What is the purpose of each?
uname Display information about the system's name and details
free Display memory usage and details
df Display disk space usage
du Display space usage by files and directories
Provides real-time information about system processes and
top
resource usage
ps Provides information about currently running processes
kill To stop/terminate a currently running process
ifconfig Display network interface information
nslookup Perform DNS queries
ping For testing network connectivity to a remote host/server
ssh Secure shell to establish a connection to a remote server
pwd Print the present working directory
ls List files and directories
cd To change the present working directory
mkdir To make a new directory
rmdir To remove an empty directory
rm Remove files and directories
cp Copy files and directories
mv Rename or move files and directories
touch Create an empty file
vim/nano Text editors for files
cat To display the contents of a file
head To display the beginning of a file
tail To display the end of a file
find Search for files and directories
grep Search for a specific pattern in a file
chmod To change file permissions
chgrp To change the group owner
chown To change file ownership
usermod To modify user account properties
apt Package Manager for updates & installations
scp Securely copy files between hosts/servers
To view the history of the commands executed on the
history
server/instance
awk Data extracting and processing from files
wc Count characters, words, and lines in a file
wget/curl Download files from the web
shutdown To shut down the system
reboot To reboot the system
Bakul Warikoo