Skip to main content

All About Linux

 File System


cd / It go to root dir. or main dir.

ls -ltr it show pre define folder or dir. shows

*Everything in linux is a File*

we used audio video in daily life that called file

but in linux command is also consider as a file

Whereis ls

cd /usr/bin

ls










All file avaible all commands avaible file also present

To manage all the data and file linux need a file system

Os store and manage data on disk or partitions using a

structure called filesystem

FileSystem includes files, directories and its related permissions.

Fs stores data in hierarchy of directories and files.


In Windows 


INSIDE THE FOLDER



LINUX FILE STRUCTURE












Types of file system/ versions

1. ext3 extended 3 

2. ext4

3. XFS

4. FAT

5. BTRFS etc..



How to check your linux filesystem?

lsblk -f

1. XFS (EXTENTS FILE SYSTEM)

XFS is 64bit high performance FS

support parallel I/O operations

works well with large files


<Which file we have to use>

its depends on application and user requirments


cd/ ----> root dirctory or main dir.








FS structure 

/boot   --> For butting OS  

/etc  ---> application config. file present system network ssh related file user file cong file also present

/usr/bin --> binaries file we not able to read bec, its present different format


switch from noraml to root user 

su -

cd/root/



/var --> system logs or applications logs presents 

for go /var

cd nginx/

ls -ltr

 

--------------------------------------------------------------------------------------------------------------------
Package Management 
use to install and remove software

Package files nothing but software files

Repositories
Trusted source repository
If you want to install anything we have repo. Trusted source
If admin update something he update into the repository 
Dependencies

Now the thing is that some of the package need other packages to work accurately.
A software is dependent on some other packages like one or more for 
the proper installation and working.

Insort it is a tool used to install and remove 
apt-get update ---> it install depencency automatically 
it a app store or playstore used to download software

2.for next apt-get upgrade ---> it upgrade 
3. apt-get clean --> it clean the cache data
4. apt-cache search (package name)
5. apt-get dist-upgrade --> it install kernal version


DPKG command
cat /etc/issue --> it show operating sytem
uname -a  --> package

dpkg -i zoom(app name)
apt-get update read
apt-get -f upgrade -->-f used to fixed broken files
dpkg -i (packagename)
zoom:- just write package name for installtion it working or not
dpkg --remove zoom :- for remove
dpkg -L zoom
to compley delete

Yum 
used for download dependency automatically
cd /var/log/
cat yum.log
yum update --> update and upgrade
yum check-update---> for check
yum install (package name)
yum install for multiple separted with commas
yum search gcc --> 
yum check-update telnet --> It show update msg
yum list samba
yum info samba
yum deplist samba --> depedecny list
yum list available-->
yum list available | grep httpd(name) --> used for filtering the data
yum installed
yum list all --> all list show
yum list kernel
uname -a
yum clean packages 
yum clean all
yum install httpd
yum remove httpd
yum grouplist
yum groupinstall "Netwrok"


---------------------------------------------------------------------------------------------------------------

Linux user Management

for doing this we need root access
not normal access
super user / root user
id uid 0
how we can manage the user 
1 graphically
2. cmd
3. configtion file making changs
---

all user information present in etc/passwd (dir/file)

useradd (username)
ex useradd pranav
cat/etc/passwd --> all the user information present

----------
for comment
useradd -c "Pranav Kshirsa" pranav


man --> Manual
man useradd


----
usermod-> usermodify
usermod -c "pranav" pranav
--------

useradd user1 
userdel user1
userdel -r pranav
ls
-r all delete dirc. also delete


-------------------------------------------------------------------------------------------------------


Sudo Privileages




$- Normal user
# - Root user
 

Sudo super user privileges


sudo ---> forcefully switch to user
for admin access

sudo su root 

without password 
su ubuntu

sudo command is used to access restricted files and operations in linux os.
sudo cat >file1.txt
sudo mkdir dir1
 permission din

sudo -s
password

cat > file1.txt
exit --> back to normal user

su --> switch form one user to other
su root

root user not required password
----------------------------->


Cron Job
is a time-based job scheduler in Unix-like computer operating systems.
Schedule jobs to run periodically at fixed times,day,dates, or intervals.
1. crontab -l (to show all the current jobs)
2. Crontab -e (to edit or add new jobs)

website for checking
crontab.cronhub.io

create a file
crontab -e
(pwd)
21 16 * * * cd /home/ubuntu && ./create_file.sh

crontab -l  for list 





Output:--->






------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Vi Editor
-------------
Basic editor in linux

To create a file
i  - to go to insert mode

:wq  -- save and exit

:q!  -- exit without saving

Default mode - command mode


Esc - to come out of insert mode  to command mode
dd   - to delete a line

yy  --  to copy the line
p  - to paste  below

++++++++++++++++++++++++++++++++++++++++++++++
Disk Management 

lsblk used to show disk block devices

sata s
nvme
1st alpha show type of disk and controller
2nd d means disk and last alpha show a means 1st b mean 2nd
ex sda
nvmr0n1
fdisk -l /dev/sda --> for particular
fdisk ---> for all disk
dmesg ---> disk message
dmesg | grep nvme --> for particular disk
lssw

when we normally delete only path deleted

badblocks -ws /dev/Sda(disk name)


#MBR = 4 primary partition
3 pri. 1 extended


fdisk -l /dev/sd  --> it show the partion of disk
 cat /proc/partitions

logical and extended partitions

lsblk -f
df ---> disk file

---------------------------
How to create a partion





fdisk /dev/loop0
m
n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p):

enter size
: +10M 


Mounting after creation of partion how linux will identify that the we used mounting
mount the device to the directory
mkdir/documents/
mount /dev/sdb1
mount -a --> eveything you did its working or not


if you want remove partion
we directly not remove we have 1st unmount it then remove

unmount/documents

rm -rf /documents/

Refer this link for more info.

https://youtu.be/cP1TqdOJNj8


----------------------------------------------------------------------------------->



Service management

service is a group of process that run continusly on the background
and wait for a event to trigger
so service conitnusly lisen wait for a trigger to perform a task
Ex:- webhosting using apache
user asked for particular page 
TYPES:-
SSH 
NETWORK MANAGER 
ANYDESK
BLUETOOTH
 
To mange this service we need a program
EX:- 
systemctl status apache

systemctl start/stop/reload and restart
enable and disable you can do it



----------------------------------------------------------------------------->

Hard and Soft Link

what are link in linux ?

A connection between a file name and the actual data on the disk.

Ex:- desktop app icon and orginal file

we can call it a shortcut

Soft Link:-
Link will be removed if orginal file removed or deleted.
ln -s (path)/home/ubuntu/test (name)


Hard link
Renaming, deleting or removing the file will not effect the link
ln


----------------------------------------------------------------------------------------------------


Networking in linux









a group of interconnet networking that are conneted to each other and sharing the resounce and file
Share resources across the network
communicate across the ntw with other users
1. Ifconfig & ping

to show the particular port 
ifconfig (package name)
1.enp-- ethernet connectivity
2.lo -- Local host
3.virb-- local ip address

to start and stop the internet connectivity

sudo ifdown enp
sudo ifup enp..







2. Ping 
to check the internet connection active or not
ping google.com
connected or not
to check other network connnected or not
communicate or not






3.
wget 
if you have a server and you want to download that file
$ wget<>

wget only do http and https
but









4.curl
it used for every single type





------------------------------>


Apache nginx install and configure 

steps
sudo apt-get install nginx
sudo apt-get install apache2




--------------------------------------->>





 

Comments

Popular posts from this blog

Day 04 — Basic Linux Shell Scripting

Explain in your own words and examples, what is Shell Scripting for DevOps. What is #!/bin/bash? can we write #!/bin/sh as well? Write a Shell Script which prints I will complete #90DaysOofDevOps challenge Write a Shell Script to take user input, input from arguments and print the variables. Write an Example of If else in Shell Scripting by comparing 2 numbers Was it difficult? 1. What is Kernel The kernel is a computer program that is the core of a computer’s operating system, with complete control over everything in the system. 2. What is Shell A shell is special user program which provide an interface to user to use operating system services. Shell accept human readable commands from user and convert them into something which kernel can understand. It is a command language interpreter that execute commands read from input devices such as keyboards or from files. The shell gets started when the user logs in or start the terminal. 3. What is Linux Shell Scripting? A shell script is a

NGINX Web App Deployment for DevOps

  Step 1: Create AWS instance. Step 2: Install NGINX Step 3: Install docker and create a Container for note-app. Step 4: Set up a reverse proxy. Step 5: Copy the code to the root folder. Step 6: Connect the database nginx specification Step 1: Create AWS instance. Log in to the AWS account and create an ec2 server. Nginx is a web server that will serve you static web files. So we require a server. - Create an EC2 instance and name it 'nginx-project-demo'. Also, don't forget to allow HTTP and HTTPS traffic. ( For sake of practice, let's select an Ubuntu machine with t2.micro instance type) Update your server using the command.   sudo apt-get update Step 2: Install NGINX Now install Nginx using the command below. sudo apt install nginx Check the status of nginx. systemctl status nginx Restart the nginx server with root user permission. sudo systemctl restart nginx To check further nginx is successfully installed on your server is to use the server IP and paste it into the

Day 2 Task: Basics Linux command

 Day 2 Task: Basics Linux command Task: What is the linux command to  1. Check your present working directory. 2. List all the files or directories including hidden files. 3. Create a nested directory A/B/C/D/E Ans:- 1. "pwd" is command to check present working directory on linux machine. 2. "ls -la" is command to list all the files or directories including hidden files. in above command, "-l" is use for list the files and directories in long list format with extra information and "a" is use for list all including hidden files and directory in linux machine. 3. To create a nested directory use following command :- "mkdir -p A/B/C/D/E"  "-p" stands for "no error if existing, make parent directories as needed" showing the nested directory in linux machine use "tree" command.. Listing commands - ls -l --> list the files and directories in long list format with extra information - ls -a --> list all inclu