Day 12 : A Cheat Sheet for Linux and Git-GitHub
In the world of programming and system administration, proficiency in Linux commands and Git-GitHub is indispensable. Whether you're a seasoned developer or just starting your journey, having a comprehensive cheat sheet at your disposal can significantly boost your productivity and efficiency. In this blog post, we'll compile a well-organized cheat sheet covering essential Linux commands and Git-GitHub operations along with brief explanations of their usage.
Linux Commands ๐ง
pwd: Prints the current working directory.
$ pwd
This command displays the absolute path of the current working directory.
ls: Lists directory contents.
$ ls
Use this command to view the files and directories within the current location.
cd: Changes the current directory.
$ cd /path/to/directory
Navigate to a specific directory by providing its path after the cd command.
mkdir: Creates a new directory.
$ mkdir new_directory
Make a new directory with the specified name.
touch: Creates a new file.
$ touch new_file.txt
This command creates a new file with the specified name.
cp: Copies files and directories.
$ cp file1.txt file2.txt /path/to/destination
Copy files or directories from one location to another.
mv: Moves or renames files and directories.
$ mv file1.txt /path/to/destination
Use this command to move files to a new location or rename them.
rm: Removes files or directories.
$ rm file.txt
Be cautious with this command as it permanently deletes files.
grep: Searches for patterns in files.
$ grep "pattern" file.txt
Find specific patterns within text files.
man: Displays the manual for commands.
$ man command
Access detailed information about a specific command.
Git-GitHub Commands ๐**:**
git init: Initializes a new Git repository.
$ git init
Start tracking changes in your project directory.
git clone: Clones a repository into a new directory.
$ git clone https://github.com/user/repository.git
Make a copy of a repository from GitHub onto your local machine.
git add: Adds changes to the staging area.
$ git add file.txt
Prepare changes for commit by adding them to the staging area.
git commit: Records changes to the repository.
$ git commit -m "Commit message"
Save staged changes to the repository with a descriptive message.
git push: Uploads local repository content to a remote repository.
$ git push origin main
Send committed changes to a remote repository, typically on GitHub.
git pull: Fetches and merges changes from a remote repository.
$ git pull origin main
Update your local repository with changes from the remote repository.
git status: Displays the status of the working directory and staging area.
$ git status
Check the current state of your repository, including tracked and untracked files.
git branch: Lists, creates, or deletes branches.
$ git branch new_branch
Manage branches within your Git repository.
git merge: Combines changes from different branches.
$ git merge branch_name
Integrate changes from one branch into another.
git log: Displays commit history.
$ git log
View a chronological list of commits in the repository.
Now that you have this comprehensive cheat sheet at your disposal, you can breeze through your Linux and Git-GitHub tasks with ease. Bookmark this page, print it out, or keep it handy in your terminal for quick reference. Happy coding! ๐
I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching .
thank you : )
Subscribe to my newsletter
Read articles from Prathmesh Vibhute directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by