Linux Cheat Sheetπ§:
Basic Commands
pwd
: Print working directoryls
: List files and directories in the present working Directorycd
: Change directorycd ..
: Move up one directory
mkdir
: Create a new directorytouch
: Create an empty filecp
: Copy files/directoriesmv
: Move or rename files/directoriesrm
: Remove files/directoriesrm -r
: Remove recursively (for directories)
File Operation Commands
cat
: Display file contentshead
/tail
: Display the beginning/end of a filegrep
: Search for a pattern in filesgrep -r
: Search recursively in directories
File Permission Commands
r
: Read Permissionw
: Write Permissionx
: Execute Permissionchown
: Command to change the owner of a file.chgrp
: Command to change the group ownership of a file.
Package Management:
apt
:apt update
: Update package listapt upgrade
: Upgrade installed packagesapt install
: Install a packageapt remove
: Remove a package
System Information:
uname -a
: Display system informationuname -r
: It shows a version of the kerneldf -h
: Display disk space usagefree -m
: Display free and used memory
Process Management:
ps
: Display information about processeskill
: Terminate a processkill -9
: Forcefully terminate a process
Text Editor
vim
: Text editors
Git/GitHub Cheat Sheet:
Basic Commands:
git init
: Initialize a new Git repositorygit clone
: Clone a repositorygit status
: Show the status of changesgit add
: Add changes to the staging areagit commit
: Commit changesgit commit -m "Commit message"
Branching:
git branch
: List branchesgit checkout
: Switch branchesgit checkout -b
: Create and switch to a new branch
git merge
: Merge branches
Remote Repositories (GitHub):
git remote add origin
: Add a remote repositorygit push
: Push changes to a remote repositorygit push -u origin branch-name
git pull
: Pull changes from a remote repository
Configuration:
git config
: Configure Git settings.--global
user.name
: Set username.--global
user.email
: Set email.--global core.editor
: Set default text editor.
Undoing Changes:
git log
: View commit historygit reset
: Reset the staging areagit revert
: Create a new commit that undoes changes
Logging and History:
git log
: Display commit history.git log --oneline
: Show concise log.