# Day 12 - Linux  and Git and github cheatsheet

**Linux:** Linux® is an [open-source](https://www.redhat.com/en/topics/open-source/what-is-open-source) operating system (OS). An [operating system](https://www.redhat.com/en/technologies/linux-platforms/old-enterprise-linux) is software that directly manages a system’s hardware and resources, like CPU, memory, and [storage](https://www.redhat.com/en/topics/data-storage/software-defined-storage). The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.

**Linux commands:**

1. **ls** - The most frequently used command in Linux to list directories
    
2. **pwd** - Print working directory command in Linux
    
3. **cd** - Linux command to navigate through directories
    
4. **mkdir** - Command used to create directories in Linux
    
5. **mv** - Move or rename files in Linux
    
6. **cp** - Similar usage as mv but for copying files in Linux
    
7. **rm** - Delete files or directories
    
8. **touch** - Create blank/empty files
    
9. **cat** - Display file contents on the terminal
    
10. **clear** - Clear the terminal display
    
11. **echo** - Print any text that follows the command
    
12. **man** - Access manual pages for all Linux commands
    
13. **uname** - Linux command to get basic information about the OS
    
14. **whoami** - Get the active username
    
15. **tar** - Command to extract and compress files in Linux
    
16. **grep** - Search for a string within an output
    
17. **head** - Return the specified number of lines from the top
    
18. **tail** - Return the specified number of lines from the bottom
    
19. **diff** - Find the difference between two files
    
20. **cmp** - Allows you to check if two files are identical
    
21. **sort** - Linux command to sort the content of a file while outputting
    
22. **export** - Export environment variables in Linux
    
23. **zip** - Zip files in Linux
    
24. **unzip** - Unzip files in Linux
    
25. **ssh** - Secure Shell command in Linux
    
26. **service** - Linux command to start and stop services
    
27. **ps** - Display active processes
    
28. **kill and kill all** - Kill active processes by process ID or name
    
29. **df** - Display disk filesystem information
    
30. **mount** - Mount file systems in Linux
    
31. **chmod** - Command to change file permissions
    
32. **wget** - Direct download files from the internet
    
33. **sudo** - Command to escalate privileges in Linux
    
34. **cal** - View a command-line calendar
    
35. **top** - View active processes live with their system usage
    
36. **useradd and usermod** - Add a new user or change existing users data
    
37. **passwd** - Create or update passwords for existing users
    

**Git and GitHub:**

Git is an open-source, version control tool created in 2005 by developers working on the Linux operating system.

GitHub is a company founded in 2008 that makes tools that integrate with git. You do not need GitHub to use git, but you cannot use GitHub without using git.

**Git commands:**

**git init** -- It is used for initializing a repository

**git add file.js** \---- it is used for staging a file

**git status** \--- it is used to viewing the status

**git commit -m "Message"** -- It is used for committing the staged files

**git rm file.js** --- it is used to remove the file

**git mv file1.js file1.txt** --- It is used to move the files

**git diff** --- It is used to show the unstaged changes

**git log** --- to view full history

**git log --online** \-- to get the summary

**git config --global user. name** ---- to give the user name

**git config --global user.email** --- to give the user mail

**GitHub commands:**

**git clone \[url\]** \-- clone a remote git repository to your local machine

**git fork ---** Create a copy of a repository in your local machine

**git remote add origin \[url\]:** add a remote repository as the origin for the local repository.

**git push -u origin \[branch\]:** Push the local branch to the remote repository.

**git pull-request:** Create a pull request to suggest changes to a repository.

Thanks for reading,

Mohammed Muqafamuddin
