Day12:Linux and GitHub-Cheat Sheet 🚀

Day12:Linux and GitHub-Cheat Sheet 🚀

😊Linux Basic Commands :

  1. ls : List all the files or directories

  2. ls -a : Lists hidden files or directories

  3. ls -l : Long listing format

  4. ls -la : Lists files and directories with detailed information like permissions, size, owner,etc:

  5. mkdir : Create new directory

  6. mkdir -p A/B/C/D : Multiple directory creation

  7. rmdir : Remove directory(Empty directories only)

  8. rm -rf : Remove multiple directories(the write-protected directory contains other files and subdirectories):

  9. cd : Change directory

  10. cd ..: Go back to the previous directory.

  11. cd/ : Move to the root directory

  12. pwd: Print the current working directory

  13. sudo : Allows regular users to run programs as root user

  14. touch : create an empty file

  15. rm : Deletes a file

  16. mv : move file

  17. cp : Copy file

  18. cat : Displays the file contents

  19. history : list of all past commands typed in the current terminal session

  20. clear : Clears the terminal

  21. grep : Search for a pattern in files

  22. find: Search for files and directories

  23. man : Display the user manual of any command

  24. hostname : List the hostname of the server

  25. whoami: Show the current user

  26. wget: Download files from the internet

  27. ssh: Secure Shell command in Linux

  28. zip: Zip files in Linux

  29. unzip: Unzip files in Linux.

  30. apt-get - APT package handling utility

📒File Permission commands :

  1. chmod : Change file permissions

  2. chown : Change file ownership

  3. chgrp : Change file group ownership

🙎‍♂️User management commands of Linux :

  1. useradd : Create a new user

  2. passwd : Set password for the user

  3. usermod : change the existing user's data

  4. userdel : delete a Linux user

  5. usermod -a -G <groupname> <username> : Add a user to a group

  6. deluser <username> <groupname> : Remove a user from a group

  7. finger : information about a particular user

⚙️Process management commands of Linux :

  1. ps : Display active processes

  2. kill and killall : Kill active processes by process ID or name

  3. top : View active processes live with their system usage

  4. df : Check free disk space

  5. free : Shows free and used memory (RAM)

  6. nice : Starts a process with a given priority

  7. renice **:**Changes priority of an already running process

💥Git Commands :

Git Configuration :

  1. git config --global user.name "<name>" : set author name to be used for all commits by the current user

  2. git config --global user.email "<email address>" : set author email to be used for all commits by the current user

  3. git config --list : show config information

Git Basics :

  1. git init : Initialize a new Git repository in the current directory

  2. git add <file> : Add a file to the staging area

  3. git commit -m "commit message" : Create a new commit with a message

  4. git clone <repository url> : Clone a remote repository to your local machine.

  5. git status : Show the current status of the repository

  6. git log : Display the commit history

  7. git log --oneline : Displays the commit history in a single line

  8. git diff : View the differences between the working directory and the staging area.

  9. git rm <file> : Remove a file from the repository and staging area

🌿Git Branching :

  1. git branch : list all of the branches

  2. git branch <branch> : Create a new branch

  3. git checkout -b <branch> : creating and going to that branch

  4. git checkout/switch <branch> : For going to specific branch

  5. git branch -d <branch> : For deleting branch

  6. git merge <branch> : Merge branch into the current branch

💻Remote Repositories :

  1. git remote -v : View a list of remote repositories

  2. git remote add origin <remote repo_url> : Add remote origin URL

  3. git remote remove origin : Remove the remote origin URL

  4. git push origin <branch> : Push local repository to remote repository

  5. git pull origin <branch> : Pull remote repository to local repository

  6. git remote set-url <remote> <url> : Update the URL of a remote repository

  7. git fork : Create a copy of a repository on your GitHub account (forking)

🍒Cherry-pick :

git cherry-pick [commit_id] : Merge specific commit from another branch to your current branch

Git revert :

git revert <commit_id> : Undo a single given commit, without modifying commits that come after it

Git reset :

Go back to specific commit

git reset <commit_id>

Git rebase :

git rebase : Reapply commits on top of another base tip.

Git stash :

  1. git stash : Temporarily store changes not ready for a commit

  2. git stash list : List all stashed changes

  3. git stash pop : Apply and remove the most recently stashed changes

  4. git stash drop : Delete a specific stash

  5. git stash apply : Apply the changes from a specific stash

  6. git stash clear : Remove all stashes

📍 Conclusion :

In this session, we have prepared some essential Linux and Git Command Cheat Sheet. on this blog we explore how to navigating directories, managing files, user managment and processes managment in Linux & in Git initializing repositories, Configuration of git creating commits, and collaborating on remote repositories.

Thank you for reading!

Contact me at :

linkedin: https://www.linkedin.com/in/sutish-pradhan/

E-mail: