Table of contents
💻Linux Commands:
ls: List directory contents. Usage:
ls [options] [file/directory]
-l
: Long listing format.-a
: Include hidden files.-h
: Human-readable sizes.
cd: Change directory. Usage:
cd [directory]
cd ~
: Navigate to the home directory.cd ..
: Move up one directory.
pwd: Print working directory. Usage:
pwd
- Displays the current directory path.
mkdir: Make directory. Usage:
mkdir [directory]
mkdir -p
: Create parent directories if they do not exist.
rm: Remove files or directories. Usage:
rm [options] [file/directory]
-r
: Recursive deletion for directories.-f
: Force deletion without confirmation.
grep: Search text. Usage:
grep [options] [pattern] [file]
-i
: Ignore case.-r
: Recursive search in directories.
chmod: Change file permissions. Usage:
chmod [options] [permissions] [file]
chmod +x filename
: Make a file executable.
💻Git Commands:
git init: Initialize a Git repository. Usage:
git init
git clone: Clone a repository into a new directory. Usage:
git clone [repository_url]
git clone [repository_url] [directory_name]
: Clone with a different directory name.
git add: Add file changes to the staging area. Usage:
git add [file(s)]
git add .
: Add all changes in the current directory.
git commit: Record changes to the repository. Usage:
git commit -m "Commit message"
-m
: Specify a commit message.
git push: Update remote refs. Usage:
git push [remote] [branch]
git push origin main
: Push changes to the main branch on the origin remote.
git pull: Fetch from and integrate with another repository or a local branch. Usage:
git pull [remote] [branch]
git pull origin main
: Pull changes from the main branch on the origin remote.
💻GitHub Commands:
git remote: Manage set of tracked repositories. Usage:
git remote [options] [command] [remote_name] [remote_url]
git remote add origin [repository_url]
: Add a remote named origin.
git branch: List, create, or delete branches. Usage:
git branch [options] [branch_name]
git branch -d [branch_name]
: Delete a branch.
git checkout: Switch branches or restore working tree files. Usage:
git checkout [branch_name]
git checkout -b [new_branch]
: Create and switch to a new branch.
git merge: Join two or more development histories together. Usage:
git merge [branch_name]
git merge [source_branch] [target_branch]
: Merge changes from source to target branch.
This cheat sheet covers essential commands for Linux, Git, and GitHub, providing a quick reference for developers and DevOps professionals. Feel free to share and spread the knowledge! 🌟
😊Enjoy Learning:)