Day 2: Fundamentals of Linux

Day 2: Fundamentals of Linux

Here is the Day 2 of 90 days of DevOps challenge. In this blog we will learn about the basics of Linux and its file system.

Linux Fundamental

Linux is free and an open source software operating system developed by Linus Torvalds. It is based on Unix and run on command line interface. From the day Linux was developed, there are numerous flavors came into existence such as ubuntu, RedHat, CentOS and Kali Linux etc.

Structure of Linux

Linux architecture consists of various layer that communicate with each other to provide a secure and stable environment. Kernel is the heart of Linux. User communicate to the kernel through the commands written on shell.

File System Hierarchy

Every thing in Linux is stored either as a file or directory. Linux file system is a single rooted inverted tree like structure starting with the root directory. Root directory is a top level directory that represents as /. Here are few directories and their functions:

/bin: user binaries
/sbin: system binaries
/etc: configuration files
/dev: device files
/proc: process information
/var: variable files
/tmp: temporary files
/usr: user programs
/home: home directories
/boot: boot loader files
/lib: system libraries
/opt: optional addons apps
/mnt: mount directories
/media: removable media
/src: service data

Basic Linux Commands

$pwd: check current working directory

$ls: list all the files and directories

$cd: change directory

$uname: show the name of the kernel

$uname -r: show the version of the kernel

$whoami: show the current user

$date: show the date of the system

$mkdir newfolder: create a directory with the name newfolder

$mkdir .newfolder: create a hidden directory with the name newfolder

$ls -l: list the files and directories in long list format with extra information

$ls -a: list all including hidden files and directory

$mkdir A B C: create multiple directories

$mkdir -p /home/ubuntu/myfolder: create nested directories

$mkdir students{1..5}: create 5 directories with the name student1...student5

$cd .. : change directory to one level back

$cd ../.. : change directory to two levels back

$rm -rvf /home/ubuntu/D: remove a directory named D recursive verbose and forcefully

touch file1.txt: create a file with name file1.txt

touch file2.txt file3.txt: create two files with names file2.txt and file3.txt

touch file{4..7}: create multiple files file4...file7

$sudo su: do as super user

$cp /home/ubuntu/*.txt /home: copy all the files with extension '.txt' in ubuntu to home directory

$mv /home/f* /home/ubuntu/A: move all files starting with 'f' from home to directory A under /home/ubuntu

$mv file3.txt file: rename a file named file3.txt to file

Here we hands on all the fundamental commands of Linux. Hope you find it helpful. In the next blog we will learn the Advance commands of Linux. So stay tuned.

Thanks for reading my blog. Hope you find it interesting and helpful. - Neha Bhardwaj