Day 2 Task : Basic linux commands

Basic Commands

Syntax: ls

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

  • Examples:

  • ls -l: Lists the files and directories in long list format with extra information.

  • ls -d */: Lists only directories (you can specify a pattern to filter results).

  • ls -a: Lists all files and directories, including hidden ones.

  • ls *.sh: Lists all files with a .sh extension.

  • ls -i: Lists files and directories with their index numbers (inodes).

  • ls -d */: Lists only directories (you can specify a pattern to filter results).

Directory Commands

  • pwd

  • Description: Prints the present working directory.

  • cd

    • Syntax: cd [path_to_directory]

    • Description: Changes the current directory to the provided path.

      • Examples:

        • cd ~ or cd: Changes directory to the home directory.

      • cd -: Goes to the last working directory.

        • cd .. : Changes directory one level up.

        • cd ../..: Changes directory two levels up.

  • mkdir

    • Syntax: mkdir [directoryName]

    • Description: Creates a new directory with the specified name at the current location.