Day 2: Linux For DevOps
What is Linux
Linux is an operating system which sits in the middle of hardware and user. User can run the application and it takes the commands from the user and translates them to hardware.
Advantages of Linux
Open source and used 91% of the applications on the internet.
Allow multiple users to carry out multiple tasks and come up with powerful shells and multiple flavors.
Provides high security and doesn’t need any anti virus software.
What is Kernel, Shell and Bootloader
Kernel - Kernel is the heart of the Linux, it is responsible for all the major activities of the OS. it consists of all the programs, files and processes required to run the OS. It has separate memory or space to work with the OS, which helps to work wisely between hardware and software without interruption.
Shell - Shell is the program which connects our application to the kernel, like a mediator or gateway through shell commands.
SOFTWARE —> SHELL —--> KERNEL—-----> HARDWARE
Bootloader - Bootloader is one of the processes of the kernel which starts our operating system. It plays a pivotal role in initiating the system and facilitating the loading of the Linux kernel.
Example - GRUB (Grand Unified Bootloader).
Linux has components like shell and kernel. We cannot directly talk to the kernel in Linux. We need shells to talk to the kernel by giving instructions.
Architecture Of Linux
History Of Linux
A popular open-source operating system is Linux. Linux came from unix family which was developed by Linus Torvalds in 1991.
At the time, Torvalds was a computer science student at the University of Helsinki, USA.
The name Linux is a combination of his first name, Linus, and Unix, the operating system that inspired his projects.
Linux is considered one of the most stable, secure and reliable operating systems and is widely used in servers, supercomputers and enterprise environments.
File System In Linux
In Linux/Unix operating system everything is represented as a file including a hardware program, the files are stored in a directory and every directory contain a file with a tree structure. This is called Linux file system.
Root directory is represented by a / (forward slash). It is a top level directory in a Linux.
/ - The base of the linux directory is root. Every directory arises from the root directory.
/home - Personal directories for each user account.
/bin - Common binary executables used by all users.
/etc - configuration files.
/var - Variable data files such as logs files are located in the var library.
/usr - The user directory contains applications and files used by users as opposed to application used by the system.
Basic Commands of Linux
whoami - Display the name of the current user.
$whoami
ls - Displays information about files and directories in the current directory.
$ls
pwd - Displays the current working directory.
$pwd
mkdir - Creates a directory.
$mkdir
cd - To navigate between different folders.
$cd
rmdir - Removes empty directories from the directory lists.
$rmdir filename
cp - Copy files from one directory to another.
$cp
mv - Rename and move the files.
$mv
rm - Remove or delete the files.
$rm filename
cat - Display file contents on terminal.
$cat filename
clear - clear terminal.
$clear
touch - Create empty files.
$touch filename
head - Return the specified numbers of lines from the top.
$head -n
tail - Return the specified numbers of lines from the bottom.
$tail -n
comm - Display the common element in two files.
$comm
Note: Before checking common element in two file we need to sort the files in alphabetical order.
wget - Direct download files from the internet.
$wget https://www.w3resource.com/python-exercises/pandas/excel/SaleData.xlsx
more - more command is used to view the text files in the command prompt, displaying one screen at a time in case the file is large (For example log files).
$more filename
less - Less command is a Linux utility that can be used to read the contents of a text file one page (one screen) at a time.
$less filename
Subscribe to my newsletter
Read articles from Vibhuti Jain directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Vibhuti Jain
Vibhuti Jain
Hi, I am Vibhuti Jain. A Devops Tools enthusiastic who keens on learning Devops tools and want to contribute my knowledge to build a community and collaborate with them. I have a acquired a knowledge of Linux, Shell Scripting, Python, Git, GitHub, AWS Cloud and ready to learn a lot more new Devops skills which help me build some real life project.