# 🚀Day 12 - Linux & Git Cheat-Sheet 💻

## **🐧 Linux Cheat-Sheet:**

### **Navigation:**

* `pwd`: Print the current working directory
    
* `ls`: List directory contents
    
* `ls -l`: Long listing format
    
* `ls -a`: Show hidden files
    
* `cd`: Change directory
    
* `mkdir`: Create a directory
    
* `rmdir`: Remove an empty directory
    
* `cp`**:Description:** Copy files or directories
    
* `mv`: Move or rename files/directories.
    
* `rm`: Remove files/directories
    
* `cat` : **Description:** Concatenate and display file content.
    
* `more`: Display content one screen at a time.
    
* `less`: Display content with navigation capabilities.
    

### **File Operations:**

* `touch`: Create an empty file
    
* `cp`: Copy files or directories
    
* `mv`: Move or rename files/directories
    
* `rm`: Remove files/directories
    
* `rm -r`: Remove the directory and its contents
    
* `cat`: Concatenate and display file content
    
* `nano` or `vim`: Text editors
    
* `vim`: Powerful text editor with modes.
    
* `head`: Display the first few lines of a file.
    
* `tail`: Display the last few lines of a file.
    

### **Permissions:**

* `chmod`: Change file permissions
    
* `chown`: Change file owner
    
* `chgrp`: Change file-group
    
* `unmask`: Set default permissions
    
* `su`: Switch user
    
* `sudo`: Execute a command as a superuser
    
* `passwd`: Change user password.
    
* `id`: Display user and group information.
    
* `groups`: Display groups a user is a member
    
* `adduser`: Create a new user
    
* `deluser`: Delete a user
    
* `addgroup`: Create a new group
    
* `delgroup`: Delete a group
    

### **System Information:**

* `uname`: Display system information
    
* `df`: Show disk space usage
    
* `free`: Display system memory usage
    
* `hostname`: Print or set system name
    
* `whoami`: Print the effective username
    
* `du`: Display file and directory space usage
    
* `ps`: Display information about processes
    
* `free`: Display the amount of free and used memory
    
* `top`: Display and update sorted information about
    
* `uptime`: Display how long the system has been running
    
* `date`: Display or set the system date and time
    
* `lsblk`: List information about block devices
    
* `lscpu`: Display information about the CPU architecture
    

### **Process Management:**

* `ps`: Display information about active processes
    
* `top`: Display and update sorted information about processes
    
* `kill`: Terminate a process
    
* `kill -9`: Forcefully terminate a process
    
* `uptime`: Display how long the system has been
    

## **🐙 Git-GitHub Command Cheat Sheet:**

### **Basic Commands:**

* `git init`: Initialize a new Git repository
    
* `git clone`: Clone a repository into a new directory
    
* `git add`: Add changes to the staging area
    
* `git commit`: Record changes to the repository
    
* `git commit -m "message"`: Commit with a message
    
* `git status`: Show the working tree status
    
* `git log`: Display commit history
    
* `git diff`: Show changes between commits
    
* `git merge`: Join two or more development histories together
    
* `git remote`: Manage a set of tracked repositories.
    
* `git push`: Update remote refs along with the associated
    
* `git pull`: Fetch from and integrate with another repository
    

### **Branching:**

* `git branch`: List, create, or delete branches
    
* `git branch branch_name`: Create a new branch
    
* `git branch -d branch_name`: Delete a branch
    
* `git checkout`: Switch branches or restore working tree files
    
* `git checkout -b branch_name`: Create and switch to a new branch
    
* `git switch`: Switch branches.
    
* `git restore`: Restore working tree files.
    

### **Merging and Rebasing:**

* `git merge`: Join two or more development histories together
    
* `git merge branch_name`: Merge changes from a branch
    
* `git rebase`: Reapply commits on top of another base tip
    
* `git rebase branch_name`: Rebase the current branch onto another
    

### **Remote Repositories:**

* `git remote`: Manage a set of tracked repositories
    
* `git fetch`: Download objects and refs from another repository
    
* `git pull`: Fetch from and integrate with another repository or a local branch
    
* `git push`: Update remote refs along with associated objects
    

**Happy Learning....!** 😎
