Day 2 - Basics Linux command

Day 2 - Basics Linux command

➡What is Linux?

Linux is an open-source operating system. An operating system is the software that directly manages a system's hardware and resources, like CPU, memory, and storage. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.

Architecture of Linux

The architecture of the Linux system is a layered structure that comprises several components, each with a specific function.

The main components of the Linux operating system are:

  1. Application: This is the topmost layer of the Linux architecture and consists of the various applications that run on top of the operating system and interact with its components.

  2. Shell: The shell is a command-line interface that allows users to interact with the system through a set of commands.

  3. Kernel: The kernel is the central component of the Linux operating system architecture. It manages system resources and provides services to applications and processes running on the system.

  4. Hardware: This is the bottommost layer of the Linux architecture and represents the physical hardware components of the computer, such as the processor, memory, and storage. The hardware layer is responsible for interacting with the various hardware devices and providing access to them for the rest of the operating system.

➡Basic Linux Commands

Listing commands

ls option_flag arguments --> List the sub-directories and files available in the present directory

Examples:

  • ls -l--> List the files and directories in a long list format with extra information

  • ls -a --> List all including hidden files and directory

  • ls *.sh --> List all the files having .sh extension.

  • ls -i --> List the files and directories with index numbers inodes

  • ls -d */ --> list only directories.(we can also specify a pattern)

Directory commands

  • pwd --> print work directory. Gives the present working directory.

  • cd path_to_directory --> Change the directory to the provided path

  • cd ~ or just cd --> change directory to the home directory

  • cd - --> Go to the last working directory.

  • cd .. --> Change the directory to one step back.

  • cd ../.. --> Change directory to 2 levels back.

  • mkdir directoryName --> To make a directory in a specific location

Day 2 Task: Basics Linux command

Task: What is the Linux command to

Q1. Check your present working directory.

This command will display the current directory path on the terminal.

Q2. List all the files or directories including hidden files.

The Is command lists files and directories, and the -a flag ensures that hidden files and directories (those starting with a dot) are displayed.

Q3. Create a nested directory A/B/C/D/E

The mkdir command is used to create directories, and the -p option allows you to create parent directories as needed, ensuring the entire nested structure is created.