# DevOps Linux & Git Commands Cheat Sheet 🚀🐧💻 | Day 12 of 90 Days of DevOps

Hi everyone, welcome to my #90DaysOfDevOps challenge! In this blog post, I will share with you a comprehensive cheat sheet of all the Linux commands and Git commands that I have learned and used from day 1 to day 11 of my online training on DevOps. This cheat sheet will help you master the basics of Linux, Git, and GitHub.

Let's get started! 🌟

### **Linux Commands:**

* 📂 `pwd`: Prints the current working directory.
    
    ```bash
    pwd
    ```
    
    This command displays the current directory you are in.
    
* 📄 `ls`: Lists files and directories.
    
    ```bash
    ls -l
    ```
    
    This command lists all files and directories in a long format.
    
* 📁 `mkdir`: Creates a new directory.
    
    ```bash
    mkdir new_directory
    ```
    
    This command creates a new directory with the specified name.
    
* ⬆️ `cd`: Changes directory.
    
    ```bash
    cd /path/to/directory
    ```
    
    This command changes your current directory to the specified path.
    
* ✏️ `touch`: Creates a new file.
    
    ```bash
    touch new_file.txt
    ```
    
    This command creates a new empty file with the given name.
    
* 📦 `cp`: Copies files and directories.
    
    ```bash
    cp file.txt /path/to/destination
    ```
    
    This command copies the file or directory to the specified destination.
    
* 🔄 `mv`: Moves or renames files/directories.
    
    ```bash
    mv old_name.txt new_name.txt
    ```
    
    This command renames the file or moves it to a new location.
    
* 🗑️ `rm`: Removes files/directories.
    
    ```bash
    rm file.txt
    ```
    
    This command deletes the specified file or directory.
    
* 🔎 `grep`: Searches for patterns in files.
    
    ```bash
    grep "keyword" file.txt
    ```
    
    This command searches for the specified keyword in the file.
    
* 🔒 `chmod`: Changes file permissions.
    
    ```bash
    chmod +x script.sh
    ```
    
    This command changes the permissions of the file to allow execution.
    
* ✏️ `nano`: Text editor for editing files.
    
    ```bash
    nano file.txt
    ```
    
    This command opens the file in the Nano text editor for editing.
    
* 👤 `useradd`: Adds a new user to the system.
    
    ```bash
    useradd john
    ```
    
    This command creates a new user with the given username.
    
* 👤 `userdel`: Deletes a user from the system.
    
    ```bash
    userdel john
    ```
    
    This command deletes the user with the specified username.
    
* 👥 `groupadd`: Adds a new group to the system.
    
    ```bash
    groupadd developers
    ```
    
    This command creates a new group with the given name.
    
* 👥 `groupdel`: Deletes a group from the system.
    
    ```bash
    groupdel developers
    ```
    
    This command deletes the group with the specified name.
    

### **Git Commands:**

* 🏁 `git init`: Initializes a new Git repository.
    
    ```bash
    git init
    ```
    
    This command creates a new Git repository in the current directory.
    
* 🔍 `git status`: Shows the status of the working tree and the staging area.
    
    ```bash
    git status
    ```
    
    This command shows which files are modified, staged, untracked, etc.
    
* ➕ `git add`: Adds files to the staging area.
    
    ```bash
    git add file.txt
    ```
    
    This command adds the specified file to the staging area for the next commit.
    
* 💾 `git commit`: Commits changes to the repository.
    
    ```bash
    git commit -m "Added new feature"
    ```
    
    This command commits the staged changes with the given commit message.
    
* 🔄 `git checkout`: Switches branches or restores files from a branch.
    
    ```bash
    git checkout feature_branch
    ```
    
    This command switches to the specified branch.
    
* 🗂️ `git branch`: Lists, creates, or deletes branches.
    
    ```bash
    git branch -d feature_branch
    ```
    
    This command deletes the specified branch.
    
* 🚀 `git push`: Pushes local changes to a remote repository.
    
    ```bash
    git push origin master
    ```
    
    This command pushes the local changes to the "master" branch of the remote repository.
    
* 🔀 `git merge`: Merges branches.
    
    ```bash
    git merge feature_branch
    ```
    
    This command merges the specified branch into the current branch.
    

### **GitHub Commands:**

* 🌐 `git clone`: Clones a remote repository to your local machine.
    
    ```bash
    git clone https://github.com/username/repo.git
    ```
    
    This command clones the repository to your local machine.
    
* ➕ `git remote add`: Adds a new remote repository.
    
    ```bash
    git remote add origin https://github.com/username/repo.git
    ```
    
    This command adds the remote repository with the specified name and URL.
    
* ➡️ `git pull`: Pulls changes from a remote repository.
    
    ```bash
    git pull origin master
    ```
    
    This command pulls the latest changes from the "master" branch of the remote repository.
    

And that's it! You now have a handy cheatsheet of all the essential Linux, Git, and GitHub commands that will support you in your DevOps journey. From managing files and directories to handling user accounts and mastering version control, these commands are fundamental for every DevOps engineer.

I hope you find this cheat sheet helpful and an excellent reference guide in your daily work.

If you have any questions, comments, or suggestions, feel free to leave them below or contact me on my 👔 [LinkedIn](https://www.linkedin.com/in/ajitfawade/) or 🐙 [GitHub](https://github.com/ajitfawade) profiles.

Thank you for joining me in my #90DaysOfDevOps challenge, and stay tuned for more exciting updates!
