Linux Cheat Sheet:
Basic Commands:
ls
: List directory contents.cd
: Change directory.pwd
: Print the current working directory.mkdir
: Create a new directory.rmdir
: Remove a directory.rm
: Remove files or directories.cp
: Copy files or directories.mv
: Move files or directories.cat
: Display contents of a file.touch:
To make one or more empty files.vim/vi:
Editor for text files.nano:
Editor for text files.less
: Display the contents of a file one page at a time.head
: Display the first few lines of a file.tail
: Display the last few lines of a file.grep
: Search for a specific pattern in a file.find
: Find files or directories that match a specific pattern.chmod
: Change permissions of a file or directory.chown
: Change ownership of a file or directory.tar
: Create or extract a tar archive.git history:
To check the commands run till now.
System Information:
uname
: Display system information.df
: Display disk usage statistics.du
: Display disk usage of files and directories.top
: Display system processes and resource usage.ps
: Display running processes.free
: Display memory usage statistics.uptime
: Display how long the system has been running.
Network:
ping
: Test network connectivity.ifconfig
: Display network interface configuration.netstat
: Display network connections and statistics.traceroute
: Trace the route taken by packets across an IP network.ssh
: Connect to a remote server over SSH.scp
: Copy files to or from a remote server over SSH.curl
: Transfer data from or to a server using various protocols.wget
: Download files from the web.
Package Management:
apt-get
: Install, remove, or update packages on Debian-based systems.yum
: Install, remove, or update packages on Red Hat-based systems.pacman
: Install, remove, or update packages on Arch Linux.dnf
: Install, remove, or update packages on Fedora.
Git Cheat Sheet:
Basic Commands:
git init
: Initialize a new Git repository.git clone
: Clone an existing Git repository.git add
: Add files to the staging area.git commit
: Commit changes to the repository.git status
: Display the status of the repository.git log
: Display the commit history of the repository.git diff
: Show differences between commits, branches, or files.git checkout
: Switch to a different branch or commit.git reset
: Unstage changes or move the current branch to a different commit.git stash
: Save changes that are not ready to be committed yet.Branches:
git branch
: Display the available branches.git merge
: Merge changes from one branch to another.git rebase
: Apply changes from one branch onto another.git cherry-pick
: Apply a specific commit from one branch onto another.
Collaboration:
git pull
: Fetch and merge changes from a remote repository.git push
: Push changes to a remote repository.git remote
: Manage remote repositories.git fetch
: Fetch changes from a remote repository.git clone
: Clone a repository from GitHub.git pull-request
: Create a new pull request.
GitHub Cheat Sheet:
Basic Commands:
git clone
: Clone a repository from GitHub.git pull
: Fetch and merge changes from a remote repository on GitHub.git push
: Push changes to a remote repository on GitHub.git remote
: Manage remote repositories on GitHub.git branch
: Display the available branches on GitHub.git merge
: Merge changes from one branch to another on GitHub.
Issues and Pull requests:
git issue
: Open a new issue.git issue list
: List all issues in the repository.git issue close
: Close an issue.git pull-request
: Create a new pull request.git pull-request list
: List all pull requests in the repository.git pull-request checkout
: Check out a pull request.
Collaboration:
git remote
: Manage remote repositories.git fetch
: Fetch changes from a remote repository.git push
: Push changes to a remote repository.git merge
: Merge changes from one branch to another.git rebase
: Apply changes from one branch to another.git cherry-pick
: Apply a specific commit from one branch onto another.
Miscellaneous:
git tag
: Create or list tags in the repository.git blame
: Show who made changes to a file and when.git grep
: Search for a specific string in the repository.
Happy Learning!