# Day 3 Task: Basic Linux Commands

**This is** [**#90DaysofDevops**](https://www.linkedin.com/feed/hashtag/?keywords=90daysofdevops&highlightedUpdateUrns=urn%3Ali%3Aactivity%3A7015419431497416704) **challenge under the guidance of** [**Shubham Londhe**](https://www.linkedin.com/in/ACoAABhZ4kMBt55axHJpEnVRp0UOUl-_JwwmPwk) **sir.**

Day 3 TASK

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706515247909/d2af2787-6715-4e2b-aeaf-7d7e74257f7a.png align="center")

**Are you ready to dive into the world of Linux commands? Let's explore some fundamental commands that every Linux user should know.**

![](https://tse3.mm.bing.net/th?id=OIP.LWdA65jkf_aChyhZ_JiAsQHaD4&pid=Api&P=0&h=220 align="center")

1. **Viewing the Contents of a File:** To see what's written in a file, you can use the `cat` command. For example:
    
    ```bash
    cat filename.txt
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706516057621/6f4bdac4-25c0-4946-b140-856d86cb8743.png align="center")
    
2. **Changing File Access Permissions:** To modify the access permissions of files, you can use the `chmod` command. For instance:
    
    ```bash
    chmod 700 filename
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706516352458/fb512539-91ac-4fae-9d7b-cd811dd49454.png align="center")
    
    * The first digit (7) indicates that the owner of the file (`supriya.txt`) has full permissions, meaning they can read, write, and execute the file.
        
    * The second digit (0) indicates that the group owner of the file does not have any permissions.
        
    * The third digit (0) indicates that other users (not the owner or in the group) also do not have any permissions.
        
    * So, in simple terms, the command `chmod 700 supriya.txt` grants the owner of the file `supriya.txt` full control over the file, while denying any access to the group owner and other users.
        
    * This ensures that only the owner has the ability to read from, write to, and execute the `supriya.txt` file.
        
    
3. **Checking Command History:** To review the commands you've executed previously, simply type:
    
    ```bash
    history
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706516405162/ba97bd61-ca06-418b-ab30-0e8f4c06abaf.png align="center")
    
4. **Removing a Directory/Folder:** To delete a directory, use the `rmdir` command. Be cautious, as it removes empty directories.
    
    ```bash
    rmdir directory_name
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706516511415/91dcf331-2cb4-4115-8551-ec1dbf56c01c.png align="center")
    
5. **Creating and Viewing a File:** To create a file named fruits.txt and view its content, execute:
    
    ```bash
    touch fruits.txt
    cat fruits.txt
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706516653051/a0d3449e-8b71-40c4-8f66-cfc51a6e55b6.png align="center")
    
6. **Adding Content to a File:** To add content to the devops.txt file, one item per line, you can use a text editor like `nano` or simply append with `echo`:
    
    ```bash
    echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" > devops.txt
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706516716194/3ae1e42d-6263-439e-beb9-80cff33b7fc4.png align="center")
    
7. **Displaying Top Three Fruits:** To display only the top three fruits from the file, you can use the `head` command:
    
    ```bash
    head -n 3 devops.txt
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706516738820/0d2944f1-404c-417c-92ee-411628d64b6e.png align="center")
    
8. **Showing Bottom Three Fruits:** To show only the bottom three fruits from the file, utilize the `tail` command:
    
    ```bash
    tail -n 3 devops.txt
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706516764992/ea66e0e3-0e7b-4959-b996-a4cc52815fa7.png align="center")
    
9. **Creating and Viewing Another File:** Create a file named Colors.txt and view its content:
    
    ```bash
    touch Colors.txt
    cat Colors.txt
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706517260382/4772e288-0a7c-4cce-ba4a-b7bbd0f6655d.png align="center")
    
10. **Adding Content to Colors.txt:** Add colors to the Colors.txt file, one per line:
    
    ```bash
    echo -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" > Colors.txt
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706517370974/a19f5b6d-e368-445c-9037-011f15bb57e6.png align="center")
    
11. **Finding Differences Between Files:** To identify the differences between fruits.txt and Colors.txt, use the `diff` command:
    
    ```bash
    diff fruits.txt Colors.txt
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1706517557767/592e1b34-e5c1-4037-b470-bea91e816460.png align="center")
    

* These Linux commands form the foundation of your journey into the world of Linux.
    

If you found this post useful, please consider giving it a follow and tapping the clap 👏 button to let us know! Your support means a lot.

Thank you for taking the time to read! 💚
