🚀Introduction
Mastering the command line is a fundamental skill for developers and IT professionals. This cheat sheet offers a consolidated list of vital Linux, Git, and GitHub commands that cover a wide range of categories, from basic operations to networking and version control. Organized for quick reference, this resource will empower you to navigate the command line with confidence and efficiency.
💻Linux Commands with Description & Usage
ls
: List all the directories and files.mkdir
: Makes a new directory.rmdir
: Remove a directory (only if it's empty).cd
: Change directory.cd ..
: Go back to the previous directory.pwd
: Print the current working directory.ls -l
: List files with more details.cat
: Show the content of a file.echo
: Shows the desired string and value.man
: Tells about all commands.touch
: Create a file.cp
: Copy files.mv
: Move files.rm
: Remove the file permanently.sudo
: Administrative commands (password).head
: Display the first 10 lines.tail
: Display the last 10 lines.zip
: Zip files in Linux.unzip
: Unzip files in Linux.ssh
: Secure Shell command in Linux.service
: Linux command to start and stop services.ps
: Display active processes.wget
: Download files from the internet.whoami
: Show the current user.grep
: Search for a string within an output.sort
: Sort the file content.cal
: View Calendar in the terminal.whereis
: View the exact location of any command types after this command.kill
andkillall
: Kill active processes by process ID or name.chmod
: Change file permissions.chown
: Change file ownership.history
: Shows history of command usage.useradd
andusermod
: Add a new user or change the existing user's data.passwd
: Create or update passwords for existing users.df
: Display disk space usage of file systems.du
: Estimate file and directory space usage.tar
: Archive files and directories into a single file.find
: Search for files and directories.grep
: Search for a pattern in files.chmod
: Change file permissions.chown
: Change file ownership.ln
: Create links between files.uptime
: Show system uptime and load averages.top
: Display system processes and resource usage.free
: Display memory usage statistics.ifconfig
: Display or configure network interfaces.netstat
: Display network statistics.ssh-keygen
: Generate SSH key pairs.scp
: Securely copy files between hosts.rsync
: Synchronize files and directories between two locations.cron
: Schedule tasks to run at specific intervals.crontab
: Manage user-specific cron jobs.history
: View and manage command history.sed
: Stream editor for text manipulation.awk
: Text processing and pattern matching.nano
orvi
: Text editors for file editing.ping
: Send network ICMP echo requests to a host.traceroute
: Trace the route packets take to a destination.shutdown
: Shutdown or reboot the system.kill
: Terminate processes by ID or name.ps aux
: Display detailed information about active processes.uptime
: Show system uptime and load averages.nc
: Netcat - network utility for reading/writing network connections.
Note: You can explore further by referring to their respective
man
pages or online Linux documentation.
🐙Git-GitHub Commands with Description & Usage
git init
: Initialize a new Git repository in the current directory.git clone <repository-url>
: Clone a remote repository to your local machine.git status
: Show the current status of the repository.git add <file>
: Add a file to the staging area.git commit -m "commit message"
: Create a new commit with a message.git diff
: View the differences between the working directory and the staging area.git log
: Display the commit history.git branch
: List all branches in the repository.git checkout <branch>
: Switch to a different branch.git merge <branch>
: Merge changes from a branch into the current branch.git pull
: Fetch and merge changes from a remote repository.git push
: Push local commits to a remote repository.git remote add origin <repository-url>
: Add a remote repository as the origin.git remote -v
: View a list of remote repositories and their URLs.git reset <file>
: Unstage changes for a file.git rm <file>
: Remove a file from the repository and staging area.git stash
: Temporarily store changes not ready for a commit.git cherry-pick <commit>
: Apply changes from a specific commit.git fetch
: Download objects and refs from another repository.git revert <commit>
: Create a new commit that undoes changes from a specific commit.git push origin <branch>
: Push local commits to a remote branch on GitHub.git pull origin <branch>
: Fetch and merge changes from a remote branch on GitHub.git fork
: Create a copy of a repository on your GitHub account.git pull-request
: Create a pull request to propose changes from your fork.git pull upstream <branch>
: Pull changes from the original repository after forking (upstream).git remote add upstream <original-repo-url>
: Add the original repository as the upstream remote for your fork.git branch -d <branch>
: Delete a local branch after it's merged and no longer needed.git push origin --delete <branch>
: Delete a remote branch on GitHub.git stash pop
: Apply and remove the most recently stashed changes.git stash list
: List all stashed changes.git stash apply
: Apply the changes from a specific stash.git stash drop
: Delete a specific stash.git stash clear
: Remove all stashes.git remote show <remote>
: Show detailed information about a remote.git tag
: Create, list, or delete tags.git blame <file>
: Show who changed each line in a file.git config
: Set or get repository or global configuration options.git log --graph
: Display the commit history in a graph view.git reflog
: Show a log of changes to branch references.git rebase
: Reapply commits on top of another base tip.git reset --hard <commit>
: Reset the repository to a specific commit.git clean
: Remove untracked files and directories.git bisect
: Find the commit that introduced a bug using binary search.git show
: Show the details and changes of a commit.git grep
: Search for a pattern in tracked files.git remote set-url <remote> <url>
: Update the URL of a remote repository.git submodule
: Manage submodules within a repository.git rebase -i
: Interactively rebase commits.git cherry-pick --continue
/--abort
: Continue or abort a cherry-pick sequence.git commit --amend
: Modify the most recent commit.git log --author=<author>
: Show commit history by a specific author.git log --since=<date>
: Show commit history since a specific date.git log --grep=<pattern>
: Show commits with messages matching a pattern.
🎉Conclusion
This cheat sheet of essential Linux, Git, and GitHub commands serves as a valuable resource for developers and IT enthusiasts at all levels. Whether you're managing files, working with networks, or handling version control, these commands provide the building blocks for efficient and effective command-line usage. By referring to this cheat sheet, you'll streamline your workflow, troubleshoot more effectively, and become a more proficient command-line user🚀💻.
Let's connect on LinkedIn - https://www.linkedin.com/in/arjunmenon-devops/