# Day 2 Task : Basic linux commands

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722524713474/45adb15f-c06f-411b-b5aa-4ae8e6508746.jpeg align="center")

**Basic Commands**

**Syntax:**  ls

**Description:** Lists the subdirectories and files available in the present directory.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525741073/4fc7148e-9905-40b6-895e-531c66930da8.png align="left")

* **Examples:**
    
* ls -l: Lists the files and directories in long list format with extra information.
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722524936667/121e3ec5-9560-4e27-ac35-684b9378c6a5.png align="left")
    
* ls -d \*/: Lists only directories (you can specify a pattern to filter results).
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525073544/5f6749bf-9148-41bf-a7ce-988fc0ecfee4.png align="left")
    
* ls -a: Lists all files and directories, including hidden ones.
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525202589/eb877294-6c9b-49d5-b4c9-064a56decbda.png align="left")
    
* ls \*.sh: Lists all files with a .sh extension.
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525537063/bd4c5e03-7026-408e-a4eb-66e476e25f77.png align="left")
    

* ls -i: Lists files and directories with their index numbers (inodes).
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525508063/c683e276-7cff-470d-a8aa-c7a16400403b.png align="left")
    
* ls -d \*/: Lists only directories (you can specify a pattern to filter results).
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525476111/14dd0baf-e694-4a69-ab88-76dde3e058e0.png align="left")
    

**Directory Commands**

* **pwd**
    
* **Description:** Prints the present working directory.
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525864390/603ac1ed-ca8e-436d-8e90-2441506f3cf8.png align="left")
    

* **cd**
    
    * **Syntax:** cd \[path\_to\_directory\]
        
    * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525914244/5fed4ed9-6871-437c-b56a-12a311223164.png align="left")
        

* * **Description:** Changes the current directory to the provided path.
        
    * **Examples:**
        
        * cd ~ or cd: Changes directory to the home directory.
            
        * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525948149/b72129c1-9fd2-49de-bf6b-5e5dc4433941.png align="left")
            
* * * cd -: Goes to the last working directory.
            
        * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722525975802/8929a95f-cf57-417f-ae0d-07494ca8f7ec.png align="left")
            
        * cd .. : Changes directory one level up.
            
        * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722526191262/ba13d625-27ef-4f46-adbe-320370d1dda3.png align="center")
            
        * cd ../..: Changes directory two levels up.
            
        * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722526176052/9a597b98-ccd3-4111-978b-d671ee68b529.png align="center")
            
    
    * **mkdir**
        
        * **Syntax:** mkdir \[directoryName\]
            
        * **Description:** Creates a new directory with the specified name at the current location.
            
        * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722526162632/c3cd7a21-7057-426a-9c47-66645165215a.png align="center")
