12 Day: Linux & Git-GitHub Cheat Sheet
Here s a cheat sheet for commonly used Linux and Git/GitHub commands:
Linux Cheat Sheet:
File and Directory Operations:
ls
: List files and directories.pwd
: Print the working directory.cd
: Change directory.mkdir
: Create a new directory.touch
: Create an empty file.rm
: Remove files or directories.cp
: Copy files or directories.mv
: Move or rename files or directories.
File Manipulation:
cat
: Display the contents of a file.more
orless
: View file content page by page.head
: Display the beginning of a file.tail
: Display the end of a file.nano
orvim
oremacs
: Text editors to edit files.
File Permissions:
chmod
: Change file permissions.chown
: Change file ownership.
Process Management:
ps
: List running processes.kill
: Terminate processes.top
orhtop
: Monitor system resources and processes.
Package Management:
apt
(Debian/Ubuntu) oryum
(Fedora/CentOS): Install and manage software packages.
Networking:
ifconfig
orip
: Network configuration.ping
: Test network connectivity.ssh
: Secure shell for remote access.scp
: Securely copy files over SSH.
User Management:
useradd
: Create a new user.passwd
: Change user password.su
orsudo
: Switch users or run commands with superuser privileges.
File Compression and Archiving:
tar
: Archive files.gzip
orbzip2
: Compress files.zip
orunzip
: Create or extract ZIP archives.
Git & GitHub Cheat Sheet:
Git Basics:
git init
: Initialize a new Git repository.git clone
: Clone a remote repository.git add
: Stage changes for commit.git commit
: Commit changes.git status
: Check the status of the repository.git log
: View commit history.git branch
: List branches.git checkout
: Switch branches or commit versions.git merge
: Merge branches.git pull
: Fetch and merge changes from a remote repository.git push
: Push local changes to a remote repository.
GitHub Commands:
git remote add origin <repository_url>
: Link your local repository to a GitHub repository.git push -u origin <branch_name>
: Push your branch to GitHub.Pull requests, issues, and other GitHub-specific actions are typically performed through the GitHub web interface.
Git Branching and Merging:
git branch <branch_name>
: Create a new branch.git checkout -b <branch_name>
: Create and switch to a new branch.git merge <branch_name>
: Merge a branch into the current branch.git rebase <branch_name>
: Rebase the current branch onto another branch.
Git Collaboration:
git fetch
: Retrieve remote changes without merging.git pull
: Fetch and merge remote changes.git fetch --all
andgit pull --all
: Fetch and merge from all remote repositories.git clone --recursive
: Clone a repository and its submodules.
Remember to replace placeholders like <repository_url>
and <branch_name>
with the actual values you're working with. This cheat sheet should help you get started with common Linux and Git/GitHub commands.