SlideShare una empresa de Scribd logo
1 de 42
LINUX
Presentation by Kallam Srinivas Reddy
•
•
•
•
•
•
•
•
•
•
•
•
•

Overview of Linux System
Vi editor
Basic Commands
Redirect, Append, and Pipe
Relative & Absolute Path
File System & Partitions
Permissions
Process Management
User Management
Group
Software Management
Backup and restore
Managing installed services

Outline
Overview of Linux System
Linux is an Operating system (OS).
Linux system is described as kernel & shell.
Kernel is the main program of Linux system. It controls hardware,
CPU, memory, hard disk, network card etc.
Shell is an interface between user and kernel. Shell interprets your
input as commands and pass them to kernel.
Overview of Linux System
Multiuser & Multiprocess:
Many people can use one machine at the same time.

File & Process:
Data, directory, process, hard disk etc (almost everything) are
expressed as a file.
Process is an running program identified by a unique id (PID).
Overview of Linux System
Directory Structure
Files are put in a directory.
All directories are in a hierarchical structure (tree structure).
User can create and remove any directories on the tree.
Top directory is “/”, which is called slash or root.
Users have the own directory. (home directory)
Overview of Linux System
Directory Structure
Overview of Linux System
Important Directories:/bin- This contains files that are essential for correct operation of the
system. These are available for all users to use.
/mnt- Provides a location for mounting devices, such as remote file
systems and removable media
/home- This is where user home directories are stored.
/var- This directory is used to store files which change frequently, and
must be available to be written to.
/etc- Various system configuration files are stored here.
Overview of Linux System
/dev- This contains various devices as files, e.g. harddisk, CDROM drive,
etc.
/root- This is the root (administrator) user's home directory
/sbin- Binaries which are only expected to be used by the super user.
/tmp- Temporary files.
/boot Has the bootable Linux kernel and bootloader configuration
files(GRUB)
/usr- Contains user documentation, games, graphical files,
libraries(lib),etc..
Overview of Linux System
Normal user and Super user
In Linux system, there is one special user for administration, who can
do anything. This special user is called root or superuser.
Case Sensitivity
Linux operating system is case sensitive.
Overview of Linux System
Run levels in Linux- refers to the mode of operation in the Linux
operating systems
Following are the run levels of some popular Linux versions
Following are the seven run levels in Ubuntu
 0 ->halt
 1 ->Single user mode
 2 ->Graphical multi-user with networking
3 – 5 -> Unused but configured the same as runlevel 2
6 -> Reboot
Overview of Linux System
Following are the seven run levels in Red Hat Linux and Fedora
 0 ->halt
 1 ->Single user text mode(without networking)
 2 ->Not used (user definable)
 3 -> Full multi-user text mode
 4 -> Not used (user definable)
 5 -> Full multi-user graphical mode (with an X-based login screen)
 6 -> Reboot
VI Editor
• Programs & configuration files are text files.
• There are two popular text editors vi and Emacs.
• vi is a screen-oriented text editor originally created for
the Unix operating system.
Basic Commands
How to run commands
When you log on Linux machine, you will see,
[cseos@hyperion001 srinu]$
 start typing the command next to the $ symbol
 One command consists of three parts, i.e. command name, options,
arguments.
Between command name, options and arguments, space is necessary.
For Example
[srinu~]$ command-name optionA optionB argument1 argument2
Basic Commands
Options always start with “ - ”.
For Example
• cd ..
• ls –l .bashrc
• mv fileA fileB
Basic Commands
Basic useful Commands
 ls - show files in current position
 cd - change directory
 cp - copy file or directory
 mv - move file or directory
 rm - remove file or directory
 pwd - show current position
 mkdir - create directory
 rmdir - remove directory
 cat - display file contents
less - display file contents pagewise
Basic Commands
man - display online manual
su - switch user
 passwd - change password
 useradd - create new user account
 userdel - delete user account
 mount - mount a file system
 umount - unmount a mounted file system
 df - show disk space usage
 shutdown - reboot or turn off machine
Redirect, Append and Pipe
Redirect and append
 Output of command is displayed on screen by redirecting to a file.
 Using “>”, you can redirect the output from screen to a file.
 Using “>>” you can append the output to the bottom of the file.
Pipe
 Some commands require input from a file or other commands.
 Using “|”, you can use output from other command as input to the
command.
Redirect, Append and Pipe
Commands
head - show first several lines and omit other lines.
tail - show last several lines and omit other lines.
grep - show lines matching a pattern
Working with commands:
In home directory, type
->ls .bash_profile
->cp .bash_profile sample.txt
->less sample.txt
Redirect, Append and Pipe
Using redirect.
->head 3 sample.txt
->head 3 sample.txt > redirect.txt
Using append.
->tail 3 sample.txt tail 3
->sample.txt >> redirect.txt less redirect.txt
Using pipe.
less redirect.txt
grep PATH redirect.txt
tail redirect.txt | grep PATH
rm sample.txt
rm redirect.txt
Relative & Absolute Path
Path means a position in the directory tree.
 To express a path, you can use relative path or absolute path.
In relative path expression, the path is not defined uniquely, it
depends on your current path.
 In absolute path expression, the path is defined uniquely, it does not
depend on your current path.
File System & Partitions
Everything is a file in linux.
Mounting
Files related to mounting in linux
/etc/mtab(Current files mounted)
/etc/fstab(info about permanent mounting points)
File System & Partitions
Partitions
Commands to view existing partitions
 fdisk –l
 parted –l

Partition administration using fdisk
fdisk <partition name with location> eg:- fdisk /dev/sda.
Various options for fdisk are n,p,q,t,v,w,etc..
Updating the partition without restarting :partrobe /dev/sda or partx /dev/sda

Formatting a partition with file systems(eg- ext4 system)
mkfs.<file system type> <partition name>
Eg - mkfs.ext4 /dev/sda

Note:-After formatting the partition must me mounted in ordered to use
File System & Partitions
Mounting Partitions:-

Temporary mounting
mount <device name> <directory name(mount point)>
Eg:- mount /dev/sda oslab

Permanent mounting

Add the parameters for mounting point in the file /etc/fstab as follows

Umounting the partition

umount <mount point directory>
Eg:- umount /oslab

To view mount points use the command mount
Assigning label to the partition(giving some name to partition)
e2label <partition name> <label>
Eg:- e2label </dev/sda> <os>
File System & Partitions
Mounting a partition using label
mount LABEL=<label name> <partition name>
Eg:- mount LABEL=os /oslab

LVM(Logical volume management)
File System & Partitions
Components of LVM
Physical volume (PV)
Physical Extend (PE)
Volume Group (VG)
Logical Volume (LV)
Logical Extend (LE)

Commands in LVM
pvs, vgs, lvs – displays all PVs, VGs, and LVs in the system

Display detailed information
pvdisplay, vgdisplay, lvdisplay

 creating PVs, VGs, LVs
pvcreate, vgcreate, and lvcreate
File System & Partitions
lvresize – resizes a logical volume
lvreduce – reduces a logical volume
vgreduce – reduces a volume group
Removing/deleting PVs, VGs, LVs
pvremove, vgremove, lvremove
Permissions
All the files and directories have the permissions and owner assigned
to them.
There are three types of permission readable, writeable and
executable.
Permissions are given to three kinds of groups namely owner, group
member and others.
Example[cswug@hyperion001 cswug]$ ls l .bash_profile
-rw-r--r-- 1 cswug cswug 191 Jan 4 13:11 .bash_profile
Note-r : readable, w:writable, x: executable
Permissions
Commandschmod- change file mode, add or remove permission
chown- change owner of the file
Examplechmod a+w filename - add writable permission to all users
chmod o-x filename - remove executable permission from others
Note- u: user (owner), g: group, o: others a: all
Permissions
acl- access control lists
More secure way to secure the files.
The file system have to be mounted with the option acl in /etc/fstab
file.
Files with acls can be read only using the getfacl command.
Writing or changing acls can be done with setfacl or /usr/bin/setfacl.
To remove an acl of a file system use –x option for setfacl command.
Process Management
Process is a unit of running program.
Each process has some information, like process ID, owner, priority, etc.
CommandsKill - Sends specified signal to specified process .The process is specified by
process ID.
Killall – kills all the process with a particular name. The program is
specified by command name.
ps - Show process status
top - Show system usage statistics
Process Management
Check your process.
ps
ps –u
Check process of all users.
top (To quit top, press “q”)
ps –e
ps –ef
Find your process.
ps –ef | grep cseos
Process Management
Output of “ top” command
User Management
Commands to know

whoami – Gives the current Username.
 who – gives the information about who is logged on the system.
 who am i – gives the details about current session in a line.
 w – shows you who is logged on and what they are doing.
 id – gives the user id, primary group id, and a list of the groups that
you belong to.
User Management
Root user-The root user is also called the superuser is the most
powerful account on the Linux system(userid 0)
User management on any Unix can be done in three ways.
1. Graphical
2. Command line tools
3. Edit the local configuration files
User Management
Important files in user management/etc/shadow- User passwords are encrypted and kept in /etc/shadow
/etc/passwd –Contains the local user database on Linux
/etc/default/useradd - contains some default user options.
Home directories(Two ways of creating home directories)
1. useradd –m to create a home directory for user.
2. Create a directory using mkdir and setting the owner as user using
chmod and restricting the permissions.
User Management
Commands for user management
useradd- to add a user
usermod – to modify the properties of a user
gpasswd – to manage the users
userdel – to delete a user
passwd – to manage passwords for users).
chage – to change the attributes of the passwords of users
su – allows a user to run a shell of other users
Sudo-The sudo program allows a user to start a program with the credentials
of another user.
Group
Users can be listed in groups.
Groups allows you to set permissions on the group level instead of having to
set permissions for every individual user.
/etc/group – file in which group membership is defined.

Commands for group management
group – to view the list of groups to which user belongs to.
groupadd – to add new groups
usermod - Group membership can be modified
groupmod – to change the group name
groupdel – to remove a group permanently
Software Management
RPM utility is used to manage soft wares in linux
RPM – Red Hat Package Manager
Tool used for installing, uninstalling, verifying, querying, and updating software packages.

Commands for RPM
 rpm –qa (q- query and a- all) > gives all the installed packages on the system
 rpm –q <package name>
> to check whether a package is installed or not.
 rpm –ivh <package name> > to install a package(i-install, v- verbose view, hhash progress)
Note:- to install a package, first navigate to the directory in which packages are
stored
 rpm –e <package name> >to uninstall/ remove a package(e- erase)
Software Management
 rpm –qf <package directory> > to install the package forcefully
 rpm –qlc <packager name>
> to see the configuration files of installed
package(q-query, l-local, c-configuration)
 rpm –qld <package name>
> to see which directory is associated with a
particular package (q-query, l- local, d- directory)
Dependency- some packages requires some other packages to be installed
before it can be installed.
 rpm -ivh <package name> --nodeps > to install packages without dependicies.
 rpm -uvh <package name>
> to update a package(u- update, v-verbose, h-hash
progress)
Backup and restore
Backup using tar
 tar – cvf <destination and name to be> <source file>
>creating a tar backup
for source file (note: c-create, v-verbose, f-name of tar file)
eg:- tar – cvf /opt/etc.tar /etc
 gzip <file name> >applying gzip on the tar file
eg:- gzip /opt/etc.tar
 scp <gzip file> <destination address> > transferring the file to another system
using secure copy (scr) (destination address is the IP address of the target system
followed by the target directory)
eg:- scp /opt/etc.tar.gz 192.XXX.XX.X/root/
 gunzip <file name> > to unzip the file
 tar – xvf <file name> > to untar the file (x-remove)
eg:- tar – xvf etc.tar
Managing installed services
Services/programs
Two commands to control the services
1. Service
Temporary control(changes only for current session / after booting the
changes will be erased from the service)
Commands
 service <name of the service> status -> used to check the status of the service
service <name of the service> start -> used to start the service
service <name of the service> stop -> used to stop the service
service <name of the service> reload -> used to reload the service
service <name of the service> restart -> used to restart the service
Managing installed services
2. Chkconfig
Permanent control(changes are carried until they are changed again no
matter of booting).
Commands
 chkconfig - - list >to check the availability of the service
chkconfig <service> on > to make the service available after restart
chkconfig <service> off > to make the service unavailable after restart

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Introduction to LINUX
Introduction to LINUXIntroduction to LINUX
Introduction to LINUX
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
Applecmdlista zs
Applecmdlista zsApplecmdlista zs
Applecmdlista zs
 
Unix cmd
Unix cmdUnix cmd
Unix cmd
 
basic-unix.pdf
basic-unix.pdfbasic-unix.pdf
basic-unix.pdf
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Introduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examplesIntroduction to UNIX Command-Lines with examples
Introduction to UNIX Command-Lines with examples
 
Unix command
Unix commandUnix command
Unix command
 
Learning Linux v2.1
Learning Linux v2.1Learning Linux v2.1
Learning Linux v2.1
 
Tool Development 08 - Windows Command Prompt
Tool Development 08 - Windows Command PromptTool Development 08 - Windows Command Prompt
Tool Development 08 - Windows Command Prompt
 
Linux class 8 tar
Linux class 8   tar  Linux class 8   tar
Linux class 8 tar
 
3. intro
3. intro3. intro
3. intro
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Linux command line cheatsheet
Linux command line cheatsheetLinux command line cheatsheet
Linux command line cheatsheet
 
Linux
Linux Linux
Linux
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 
Windows command prompt a to z
Windows command prompt a to zWindows command prompt a to z
Windows command prompt a to z
 
Basic Unix
Basic UnixBasic Unix
Basic Unix
 
Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Rhel1
Rhel1Rhel1
Rhel1
 

Similar a Linux System Overview and Commands

Similar a Linux System Overview and Commands (20)

Basics of Linux
Basics of LinuxBasics of Linux
Basics of Linux
 
Linux
LinuxLinux
Linux
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
cisco
ciscocisco
cisco
 
Linux file commands and shell scripts
Linux file commands and shell scriptsLinux file commands and shell scripts
Linux file commands and shell scripts
 
Group13
Group13Group13
Group13
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
Linux file system nevigation
Linux file system nevigationLinux file system nevigation
Linux file system nevigation
 
Unix_Introduction_BCA.pptx the very basi
Unix_Introduction_BCA.pptx the very basiUnix_Introduction_BCA.pptx the very basi
Unix_Introduction_BCA.pptx the very basi
 
50 Most Frequently Used UNIX Linux Commands -hmftj
50 Most Frequently Used UNIX  Linux Commands -hmftj50 Most Frequently Used UNIX  Linux Commands -hmftj
50 Most Frequently Used UNIX Linux Commands -hmftj
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Linux lecture5
Linux lecture5Linux lecture5
Linux lecture5
 
Unix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptxUnix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptx
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
Linux command for beginners
Linux command for beginnersLinux command for beginners
Linux command for beginners
 

Último

Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 

Último (20)

Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 

Linux System Overview and Commands

  • 2. • • • • • • • • • • • • • Overview of Linux System Vi editor Basic Commands Redirect, Append, and Pipe Relative & Absolute Path File System & Partitions Permissions Process Management User Management Group Software Management Backup and restore Managing installed services Outline
  • 3. Overview of Linux System Linux is an Operating system (OS). Linux system is described as kernel & shell. Kernel is the main program of Linux system. It controls hardware, CPU, memory, hard disk, network card etc. Shell is an interface between user and kernel. Shell interprets your input as commands and pass them to kernel.
  • 4. Overview of Linux System Multiuser & Multiprocess: Many people can use one machine at the same time. File & Process: Data, directory, process, hard disk etc (almost everything) are expressed as a file. Process is an running program identified by a unique id (PID).
  • 5. Overview of Linux System Directory Structure Files are put in a directory. All directories are in a hierarchical structure (tree structure). User can create and remove any directories on the tree. Top directory is “/”, which is called slash or root. Users have the own directory. (home directory)
  • 6. Overview of Linux System Directory Structure
  • 7. Overview of Linux System Important Directories:/bin- This contains files that are essential for correct operation of the system. These are available for all users to use. /mnt- Provides a location for mounting devices, such as remote file systems and removable media /home- This is where user home directories are stored. /var- This directory is used to store files which change frequently, and must be available to be written to. /etc- Various system configuration files are stored here.
  • 8. Overview of Linux System /dev- This contains various devices as files, e.g. harddisk, CDROM drive, etc. /root- This is the root (administrator) user's home directory /sbin- Binaries which are only expected to be used by the super user. /tmp- Temporary files. /boot Has the bootable Linux kernel and bootloader configuration files(GRUB) /usr- Contains user documentation, games, graphical files, libraries(lib),etc..
  • 9. Overview of Linux System Normal user and Super user In Linux system, there is one special user for administration, who can do anything. This special user is called root or superuser. Case Sensitivity Linux operating system is case sensitive.
  • 10. Overview of Linux System Run levels in Linux- refers to the mode of operation in the Linux operating systems Following are the run levels of some popular Linux versions Following are the seven run levels in Ubuntu  0 ->halt  1 ->Single user mode  2 ->Graphical multi-user with networking 3 – 5 -> Unused but configured the same as runlevel 2 6 -> Reboot
  • 11. Overview of Linux System Following are the seven run levels in Red Hat Linux and Fedora  0 ->halt  1 ->Single user text mode(without networking)  2 ->Not used (user definable)  3 -> Full multi-user text mode  4 -> Not used (user definable)  5 -> Full multi-user graphical mode (with an X-based login screen)  6 -> Reboot
  • 12. VI Editor • Programs & configuration files are text files. • There are two popular text editors vi and Emacs. • vi is a screen-oriented text editor originally created for the Unix operating system.
  • 13. Basic Commands How to run commands When you log on Linux machine, you will see, [cseos@hyperion001 srinu]$  start typing the command next to the $ symbol  One command consists of three parts, i.e. command name, options, arguments. Between command name, options and arguments, space is necessary. For Example [srinu~]$ command-name optionA optionB argument1 argument2
  • 14. Basic Commands Options always start with “ - ”. For Example • cd .. • ls –l .bashrc • mv fileA fileB
  • 15. Basic Commands Basic useful Commands  ls - show files in current position  cd - change directory  cp - copy file or directory  mv - move file or directory  rm - remove file or directory  pwd - show current position  mkdir - create directory  rmdir - remove directory  cat - display file contents less - display file contents pagewise
  • 16. Basic Commands man - display online manual su - switch user  passwd - change password  useradd - create new user account  userdel - delete user account  mount - mount a file system  umount - unmount a mounted file system  df - show disk space usage  shutdown - reboot or turn off machine
  • 17. Redirect, Append and Pipe Redirect and append  Output of command is displayed on screen by redirecting to a file.  Using “>”, you can redirect the output from screen to a file.  Using “>>” you can append the output to the bottom of the file. Pipe  Some commands require input from a file or other commands.  Using “|”, you can use output from other command as input to the command.
  • 18. Redirect, Append and Pipe Commands head - show first several lines and omit other lines. tail - show last several lines and omit other lines. grep - show lines matching a pattern Working with commands: In home directory, type ->ls .bash_profile ->cp .bash_profile sample.txt ->less sample.txt
  • 19. Redirect, Append and Pipe Using redirect. ->head 3 sample.txt ->head 3 sample.txt > redirect.txt Using append. ->tail 3 sample.txt tail 3 ->sample.txt >> redirect.txt less redirect.txt Using pipe. less redirect.txt grep PATH redirect.txt tail redirect.txt | grep PATH rm sample.txt rm redirect.txt
  • 20. Relative & Absolute Path Path means a position in the directory tree.  To express a path, you can use relative path or absolute path. In relative path expression, the path is not defined uniquely, it depends on your current path.  In absolute path expression, the path is defined uniquely, it does not depend on your current path.
  • 21. File System & Partitions Everything is a file in linux. Mounting Files related to mounting in linux /etc/mtab(Current files mounted) /etc/fstab(info about permanent mounting points)
  • 22. File System & Partitions Partitions Commands to view existing partitions  fdisk –l  parted –l Partition administration using fdisk fdisk <partition name with location> eg:- fdisk /dev/sda. Various options for fdisk are n,p,q,t,v,w,etc.. Updating the partition without restarting :partrobe /dev/sda or partx /dev/sda Formatting a partition with file systems(eg- ext4 system) mkfs.<file system type> <partition name> Eg - mkfs.ext4 /dev/sda Note:-After formatting the partition must me mounted in ordered to use
  • 23. File System & Partitions Mounting Partitions:- Temporary mounting mount <device name> <directory name(mount point)> Eg:- mount /dev/sda oslab Permanent mounting Add the parameters for mounting point in the file /etc/fstab as follows Umounting the partition umount <mount point directory> Eg:- umount /oslab To view mount points use the command mount Assigning label to the partition(giving some name to partition) e2label <partition name> <label> Eg:- e2label </dev/sda> <os>
  • 24. File System & Partitions Mounting a partition using label mount LABEL=<label name> <partition name> Eg:- mount LABEL=os /oslab LVM(Logical volume management)
  • 25. File System & Partitions Components of LVM Physical volume (PV) Physical Extend (PE) Volume Group (VG) Logical Volume (LV) Logical Extend (LE) Commands in LVM pvs, vgs, lvs – displays all PVs, VGs, and LVs in the system Display detailed information pvdisplay, vgdisplay, lvdisplay  creating PVs, VGs, LVs pvcreate, vgcreate, and lvcreate
  • 26. File System & Partitions lvresize – resizes a logical volume lvreduce – reduces a logical volume vgreduce – reduces a volume group Removing/deleting PVs, VGs, LVs pvremove, vgremove, lvremove
  • 27. Permissions All the files and directories have the permissions and owner assigned to them. There are three types of permission readable, writeable and executable. Permissions are given to three kinds of groups namely owner, group member and others. Example[cswug@hyperion001 cswug]$ ls l .bash_profile -rw-r--r-- 1 cswug cswug 191 Jan 4 13:11 .bash_profile Note-r : readable, w:writable, x: executable
  • 28. Permissions Commandschmod- change file mode, add or remove permission chown- change owner of the file Examplechmod a+w filename - add writable permission to all users chmod o-x filename - remove executable permission from others Note- u: user (owner), g: group, o: others a: all
  • 29. Permissions acl- access control lists More secure way to secure the files. The file system have to be mounted with the option acl in /etc/fstab file. Files with acls can be read only using the getfacl command. Writing or changing acls can be done with setfacl or /usr/bin/setfacl. To remove an acl of a file system use –x option for setfacl command.
  • 30. Process Management Process is a unit of running program. Each process has some information, like process ID, owner, priority, etc. CommandsKill - Sends specified signal to specified process .The process is specified by process ID. Killall – kills all the process with a particular name. The program is specified by command name. ps - Show process status top - Show system usage statistics
  • 31. Process Management Check your process. ps ps –u Check process of all users. top (To quit top, press “q”) ps –e ps –ef Find your process. ps –ef | grep cseos
  • 32. Process Management Output of “ top” command
  • 33. User Management Commands to know whoami – Gives the current Username.  who – gives the information about who is logged on the system.  who am i – gives the details about current session in a line.  w – shows you who is logged on and what they are doing.  id – gives the user id, primary group id, and a list of the groups that you belong to.
  • 34. User Management Root user-The root user is also called the superuser is the most powerful account on the Linux system(userid 0) User management on any Unix can be done in three ways. 1. Graphical 2. Command line tools 3. Edit the local configuration files
  • 35. User Management Important files in user management/etc/shadow- User passwords are encrypted and kept in /etc/shadow /etc/passwd –Contains the local user database on Linux /etc/default/useradd - contains some default user options. Home directories(Two ways of creating home directories) 1. useradd –m to create a home directory for user. 2. Create a directory using mkdir and setting the owner as user using chmod and restricting the permissions.
  • 36. User Management Commands for user management useradd- to add a user usermod – to modify the properties of a user gpasswd – to manage the users userdel – to delete a user passwd – to manage passwords for users). chage – to change the attributes of the passwords of users su – allows a user to run a shell of other users Sudo-The sudo program allows a user to start a program with the credentials of another user.
  • 37. Group Users can be listed in groups. Groups allows you to set permissions on the group level instead of having to set permissions for every individual user. /etc/group – file in which group membership is defined. Commands for group management group – to view the list of groups to which user belongs to. groupadd – to add new groups usermod - Group membership can be modified groupmod – to change the group name groupdel – to remove a group permanently
  • 38. Software Management RPM utility is used to manage soft wares in linux RPM – Red Hat Package Manager Tool used for installing, uninstalling, verifying, querying, and updating software packages. Commands for RPM  rpm –qa (q- query and a- all) > gives all the installed packages on the system  rpm –q <package name> > to check whether a package is installed or not.  rpm –ivh <package name> > to install a package(i-install, v- verbose view, hhash progress) Note:- to install a package, first navigate to the directory in which packages are stored  rpm –e <package name> >to uninstall/ remove a package(e- erase)
  • 39. Software Management  rpm –qf <package directory> > to install the package forcefully  rpm –qlc <packager name> > to see the configuration files of installed package(q-query, l-local, c-configuration)  rpm –qld <package name> > to see which directory is associated with a particular package (q-query, l- local, d- directory) Dependency- some packages requires some other packages to be installed before it can be installed.  rpm -ivh <package name> --nodeps > to install packages without dependicies.  rpm -uvh <package name> > to update a package(u- update, v-verbose, h-hash progress)
  • 40. Backup and restore Backup using tar  tar – cvf <destination and name to be> <source file> >creating a tar backup for source file (note: c-create, v-verbose, f-name of tar file) eg:- tar – cvf /opt/etc.tar /etc  gzip <file name> >applying gzip on the tar file eg:- gzip /opt/etc.tar  scp <gzip file> <destination address> > transferring the file to another system using secure copy (scr) (destination address is the IP address of the target system followed by the target directory) eg:- scp /opt/etc.tar.gz 192.XXX.XX.X/root/  gunzip <file name> > to unzip the file  tar – xvf <file name> > to untar the file (x-remove) eg:- tar – xvf etc.tar
  • 41. Managing installed services Services/programs Two commands to control the services 1. Service Temporary control(changes only for current session / after booting the changes will be erased from the service) Commands  service <name of the service> status -> used to check the status of the service service <name of the service> start -> used to start the service service <name of the service> stop -> used to stop the service service <name of the service> reload -> used to reload the service service <name of the service> restart -> used to restart the service
  • 42. Managing installed services 2. Chkconfig Permanent control(changes are carried until they are changed again no matter of booting). Commands  chkconfig - - list >to check the availability of the service chkconfig <service> on > to make the service available after restart chkconfig <service> off > to make the service unavailable after restart