🔹 Common Linux/Git Bash Commands
Cheat Sheet
1. Navigation Commands
● cd → Change directory.
cd Documents # go into Documents folder
cd .. # go back one folder (parent)
cd ~ # go to home directory
pwd → Print working directory (shows where you are).
pwd # /home/user/Documents
ls → List files and folders.
ls # list contents
ls -a # list all (including hidden files)
ls -l # detailed list with permissions
●
2. File Management
touch → Create an empty file.
touch notes.txt
●
cp → Copy files.
cp notes.txt backup.txt # copy file
cp file.txt ~/Documents # copy to Documents folder
●
mv → Move or rename files.
mv notes.txt ~/Documents # move file
mv old.txt new.txt # rename file
●
rm → Remove (delete) files.
rm file.txt # delete file
rm -r foldername # delete folder and its contents
●
cat → Show file content.
cat notes.txt
●
less → View file content one screen at a time.
less longfile.txt
●
nano → Open file in text editor (if installed).
nano notes.txt
●
vim → Open file in vim editor (advanced).
vim notes.txt
●
3. Directory Management
mkdir → Make a new directory.
mkdir projects
●
rmdir → Remove an empty directory.
rmdir oldfolder
●
tree → Show folder structure in a tree format (if installed).
tree
●
4. System Info
whoami → Show current logged-in user.
whoami
●
uname → Show system info.
uname -a
●
date → Show current date and time.
date
●
uptime → Show how long the system has been running.
uptime
●
5. Permissions
chmod → Change file permissions.
chmod 755 script.sh # give read/write/execute permissions
●
chown → Change file owner.
sudo chown user:user file.txt
●
6. Processes
ps → Show running processes.
ps
ps aux | grep python # find python processes
●
kill → Kill a process by ID.
kill 1234 # end process with PID 1234
●
top → Show live list of running processes.
top
●
7. Networking
ping → Test connection to a host.
ping google.com
●
curl → Transfer data from/to a server.
curl https://example.com
●
wget → Download files from the internet.
wget https://example.com/file.zip
●
ssh → Connect to a remote server.
ssh user@hostname
●
8. Git Commands (for repositories)
git init → Start a new Git repository.
git init
●
git add → Add files to staging area.
git add file.txt
git add . # add all files
●
git commit → Save changes with a message.
git commit -m "Initial commit"
●
git push → Send changes to remote repository.
git push origin main
●
● git pull → Get updates from remote repository.
git pull origin main