Linux and Git &Github Commands Cheatsheet🐧

File and Directory Operation

ls: List directory contents
cd: Change directory
pwd: Print working directory
mkdir: Make a directory
cp: Copy files or directories
mv: Move or rename files or directories
rm: Remove files or directories

File Manipulation

cat: Concatenate and display file content
touch: Create an empty file or update file timestamp
nano or vim: Text editors for file editing
grep: Search for a pattern in files
chmod: Change file permissions
chown: Change file owner

System Information

uname -a: Display system information
top: Display and manage processes
ps: Show information about active processes

Package Management

sudo apt-get update: Update package lists
sudo apt-get install [package]: Install a package
sudo apt-get remove [package]: Remove a package

Networking

ifconfig or ip: Display network configuration
ping: Test network connectivity
nslookup or dig: Query DNS information

Users and Permissions

whoami: Display the current user
passwd: Change user password
sudo: Execute a command as the superuser

Git-GitHub Commands Cheatsheet 🌐

Git Basics

git init: Initialize a new Git repository
git clone [repository]: Clone a repository
git add [file]: Add changes to the staging area
git commit -m "[message]": Commit changes with a message

Branching and Merging

git branch: List branches
git checkout [branch]: Switch to a branch
git merge [branch]: Merge changes from another branch
git branch -d [branch]: Delete a branch

Remote Repositories

git remote add origin [repository]: Add a remote repository
git push origin [branch]: Push changes to a remote repository
git pull origin [branch]: Pull changes from a remote repository

GitHub

git remote -v: View remote repositories
git pull origin main: Pull changes from the main branch
git push origin main: Push changes to the main branch

Collaboration

git clone [repository]: Clone a repository
git fork: Create a fork of a repository on GitHub
git pull-request: Open a pull request on GitHub

0
Subscribe to my newsletter

Read articles from Aakanksha Deshmukh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aakanksha Deshmukh
Aakanksha Deshmukh

I am a Devops Engineer