Day 2 : Basics of Linux

Day2: Introduction to Linux
What is Linux?
Linux is an open-source operating system, It is a freely available operating system that can be installed on a wide range of devices such as desktops, servers, smartphones and tablets, supercomputers etc.
An operating system (OS) is a system of software that manages computer hardware, software resources and provide common services for computer programs.
Linux File System Hierarchy - In Linux everything is represented as a file including a hardware program the files are stored in a directory and every directory contains a file with a tree structure that is called file system hierarchy.
/home - It creates home directory for other user.
/root - home directory for root user.
/boot - It contains bootable files for linux.
/etc - Contains all configuration files.
/user - By default software is installed in this directory.
/bin - It contains command used by all users.
/sbin - It contains command used by only root user.
/opt - Optional application software packages.
/dev - Essential device files.
/mnt - Temporarily mounted file systems.
Features of Linux
Open source
Secure
Simplified updates for all installed software.
Light weight
Multiple Distribution(Fedora,Debian,RedHat)
Basic Linux Commands
/ Is your root directory.
~ Is your home directory.
uname : It show name of kernal (OS).
uname -r : It show version of kernal.
clear : Is use for clear screen.
whoami : It shows currently login user name.
date : It shows time and date.
cal : Show this month's calendar
history : It show list of previously used command.
ubuntu@ip-172-31-205-241:~$ uname
Linux
ubuntu@ip-172-31-205-241:~$ uname -r
5.15.0-1028-aws
ubuntu@ip-172-31-205-241:~$ date
Mon Mar 27 11:59:37 UTC 2023
ls - The most frequently used command in Linux to list directories
pwd - Print working directory command in Linux
cd - Linux command to navigate through directories
mkdir - Command used to create directories in Linux
cd .. - Change the directory to one step back.
cd ../.. - Change directory to 2 lavels back.
mv - Move or rename files in Linux
ubuntu@ip-172-31-205-241:~$ whoami ubuntu ubuntu@ip-172-31-205-241:~$ touch my_file.txt ubuntu@ip-172-31-205-241:~$ ls my_file.txt ubuntu@ip-172-31-205-241:~$ pwd /home/ubuntu ubuntu@ip-172-31-205-241:~$ mkdir linux ubuntu@ip-172-31-205-241:~$ ls linux my_file.txt ubuntu@ip-172-31-205-241:~$ cd linux ubuntu@ip-172-31-205-241:~/linux$ pwd /home/ubuntu/linux ubuntu@ip-172-31-205-241:~/linux$ cd .. ubuntu@ip-172-31-205-241:~$ ls linux my_file.txt ubuntu@ip-172-31-205-241:~/linux$ mv ../my_file.txt . ubuntu@ip-172-31-205-241:~/linux$ ls my_file.txtListing commands
ls - The most frequently used command in Linux to list directories
ls -a - you can see the whole list of files, including the hidden files.
ls -l - The ls command will only display the files.
ls -d */ - If you only want to display the sub-directories excluding all other files, you can use this command
ls -g - If you don't want to display the owner information in your list
ls -lg - f you don't want to display the group information in your list
ls ../ - This command contains the list of the parent directory.
Linux Command to Create a Nested Directory :
command to create a nested directory is : mkdir -p A/B/C/D/E
-p is for no error if existing, make parent directories as needed
tree command is used to show the nested directory.
ubuntu@ip-172-31-205-241:~$ mkdir -p A/B/C/D/E
ubuntu@ip-172-31-205-241:~$ tree
.
├── A
│ └── B
│ └── C
│ └── D
│ └── E
├── dir
│ ├── dir1
│ └── dir2
├── linux
│ ├── linux
│ └── my_file.txt
└── snap
└── tree
├── 18
├── common
└── current -> 18
14 directories, 2 files
Thanks For Regarding*! :)*
Pooja Patil
About the author
Hey!! I am a Pooja Patil. I started writing articles on DevOps and cloud journey. My purpose is share the concept knowledge that i learn. the task that i perform regarding Devops. Welcome to my Blog!!!
Comments
Join the discussionNo comments yet. Be the first to comment.

