Day 2:Basics of Linux (Part 1)

Day 2:Basics of Linux (Part 1)

What is Linux?

Linux is a free and open-source operating system that was developed in the early 1990s by Linus Torvalds. It is based on the Unix operating system and has become a popular choice for both personal and enterprise use due to its stability, security, and flexibility.

Linux Architecture

Hardware layer:- Linux operating system contains a hardware layer that consists of several peripheral devices like a Monitor, Keyboard, CPU, HDD, and RAM.

Kernel Layer:-
The Linux kernel is the core component of the Linux operating system. It serves as the bridge between the hardware and the software, enabling communication and coordination between the two.

The kernel manages system resources, handles hardware devices, and provides various essential services to applications and other parts of the operating system.

Shell:- The shell is a program that provides an interface for users to enter commands, which are then interpreted and executed by the operating system. It is an essential tool for working with the system directly, performing various tasks, and automating repetitive tasks through scripts.

Applications:- This is the topmost layer of the Linux architecture and consists of the various applications that run on the operating system. These can be anything from productivity software and games to web browsers and media players.

Basic Linux commands

Listing commands

ls option_flag arguments --> list the subdirectories and files available in the present directory

Examples:

  • ls -l--> list the files and directories in 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.

Directory commands

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

  • cd <path_to_directory> --> change directory to the provided path

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

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

  • cd .. --> change directory to one step back.

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

  • mkdir <directoryName> --> to make a directory in a specific location

Examples

mkdir newFolder # make a new folder 'newFolder'

mkdir .90daysofdevops # make a hidden directory (also . before a file to make it hidden)

mkdir A B C D #make multiple directories at the same time

mkdir /home/user/Mydirectory #make a new folder in a specific location

mkdir -p A/B/C/D/E # make a nested directory