Linux and Git Cheatsheets
#90daysofdevops
LINUX Cheatsheet - 01 @jagrati-kushwaha
ls echo
List all the directories and files. Shows the desired string and value.
mkdir man
Makes a new directory. Tells about all commands.
rmdir touch
Remove a directory (only if it's empty). Create a file.
cd cp
Change directory. Copy files.
cd.. mv
Go back to the previous directory. Move files.
pwd rm
Print the current working directory. Remove the file permanently.
ls -l rmdir
List files with more details. Administrative commands (password).
cat head
Show the content of a file. Display the first 10 lines. JK
LINUX Cheatsheet - 02 @jagrati-kushwaha
tail grep
Display the last 10 lines. Search for a string within an output.
zip sort
Zip files in Linux. Sort the file content.
unzip cal
Unzip files in Linux. View Calendar in the terminal.
ssh whereis
Secure Shell command in Linux. View the exact location of any command
types after this command.
service
Linux command to start and stop services. kill and killall
Kill active processes by process ID or
name.
ps
Display active processes.
chmod
Change file permissions.
wget
Download files from the internet.
chown
Change file ownership.
whoami
Show the current user. JK
LINUX Cheatsheet - 03 @jagrati-kushwaha
history
Shows history of command usage.
useradd and usermod
Add a new user or change the existing
user's data.
passwd
Create or update passwords for existing
users.
JK
Git-GitHub Cheatsheet
Git-GitHub Cheatsheet - 01 @jagrati-kushwaha
git init git diff
Initialize a new Git repository in the
View the differences between the
current directory. working directory and the staging area.
git clone <repository-url> git log
Clone a remote repository to your local
Display the commit history of the
machine. repository.
git status git checkout <branch>
Show the current status of the repository
Switch to a different branch.
(modified files, staged changes, etc.).
git merge <branch>
Merge changes from the specified
git add <file> branch into the current branch.
Add a file to the staging area to be
included in the next commit.
git pull
Fetch and merge changes from a remote
git commit -m "commit
repository into the current branch.
message"
Create a new commit with the staged
git push
changes and a descriptive message.
Push local commits to a remote
repository.
git branch
List all branches in the repository. JK
Git-GitHub Cheatsheet - 02 @jagrati-kushwaha
git remote add origin
git cherry-pick <commit>
<repository-url> Apply changes from a specific commit to
Add a remote repository as the origin
the current branch.
(usually the main remote).
git revert <commit>
git remote -v Create a new commit that undoes the
View a list of remote repositories and their
changes from a specific commit.
URLs.
git remote -v
git reset <file> View a list of remote repositories and
Unstage changes for a file, removing them
their URLs, including GitHub remotes.
from the staging area.
git push origin <branch>
git rm <file> Push local commits to a remote branch
Remove a file from the repository and
on GitHub.
staging area.
git pull origin <branch>
git stash Fetch and merge changes from a remote
Temporarily store changes not ready for a
branch on GitHub into the current branch.
commit.
git clone <repository-url>
git fetch Clone a GitHub repository to your local
Download objects and refs from another
machine.
repository without merging. JK
Git-GitHub Cheatsheet - 03 @jagrati-kushwaha
git fork
Create a copy of a repository on your
GitHub account (forking).
git pull-request
Create a pull request to propose changes
from your fork to the original repository.
git pull upstream <branch>
Pull changes from the original repository
after forking (upstream).
git remote add upstream
<original-repo-url>
Add the original repository as the upstream
remote for your fork.
git push origin --delete <branch>
Delete a remote branch on GitHub
git branch -d <branch>
Delete a local branch after it's merged
and no longer needed.
JK
save for later