SlideShare a Scribd company logo
1 of 42
Que. Describe the following disc space management
a. df
b. du
df :- In this guide, we are going to learn to use df command. The df command, stands for Disk Free, reports
file system disk space usage. It displays the amount of disk space available on the file system in a Linux system.
The df command is not to be confused with du command. Both serves different purposes. The df command
reports how much disk space we have (i.e free space) whereas the du command reports how much disk space
is being consumed by the files and folders. Hope I made myself clear. Let us go ahead and see some more tools
for checking disk space utilization in Linux. However, Linux has a strong built in utility called ‘df‘. The ‘df‘ command
stand for “disk filesystem“, it is used to get full summary of available and used disk space usage of file system on
Linux system.
Using ‘-h‘ parameter with (df -h) will shows the file system disk space statistics in “human readable” format,
means it gives the details in bytes, mega bytes and gigabyte. This article explain a way to get the full
information of Linux disk space usage with the help of ‘df‘ command with their practical examples. So, you
could better understand the usage of df command in Linux.
Syntax :-
SGN.
1. Check File System Disk Space Usage
On the internet you will find plenty of
tools for checking disk space utilization in
Linux. However, Linux has a strong built in
utility called ‘df‘. The ‘df‘ command stand
for “disk filesystem“, it is used to get full
summary of available and used disk space
usage of file system on Linux system.
Using ‘-h‘ parameter with (df -h) will shows
the file system disk space statistics in
“human readable” format, means it gives
the details in bytes, mega bytes and
gigabyte.
The “df” command displays the
information of device name, total blocks,
total disk space, used disk space, available
disk space and mount points on a file
system.
[root@tecmint ~]# df
Filesystem 1K-blocks
Used Available Use% Mounted on
/dev/cciss/c0d0p2 78361192
23185840 51130588 32% /
/dev/cciss/c0d0p5 24797380
22273432 1243972 95% /home
/dev/cciss/c0d0p3 29753588
25503792 2713984 91% /data
/dev/cciss/c0d0p1 295561
21531 258770 8% /boot
tmpfs 257476
0 257476 0% /dev/shm
SGN.
Display Information of all File
System Disk Space Usage
The same as above, but it
also displays information of
dummy file systems along
all the file system disk usage
and their memory utilization.
[root@tecmint ~]# df -a
Filesystem 1K-blocks Used Available
Use% Mounted on
/dev/cciss/c0d0p2 78361192 23186116
51130312 32% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 -
/dev/pts
/dev/cciss/c0d0p5 24797380 22273432
1243972 95% /home
/dev/cciss/c0d0p3 29753588 25503792
2713984 91% /data
/dev/cciss/c0d0p1 295561 21531
258770 8% /boot
tmpfs 257476 0 257476
0% /dev/shm
none 0 0 0 -
/proc/sys/fs/binfmt_misc
sunrpc 0 0 0 -
/var/lib/nfs/rpc_pipefs
SGN.
Show Disk Space Usage in Human
Readable Format
Have you noticed that above
commands displays information in
bytes, which is not readable yet all,
because we are in a habit of reading
the sizes in megabytes, gigabytes etc.
it makes very easy to understand
and remember.
The df command provides an
option to display sizes in Human
Readable formats by using ‘-h’
the results in human readable format
(e.g., 1K 2M 3G))
tecmint ~]# df -h
Filesystem Size
Used Avail Use% Mounted on
/dev/cciss/c0d0p2 75G
23G 49G 32% /
/dev/cciss/c0d0p5 24G
22G 1.2G 95% /home
/dev/cciss/c0d0p3 29G
25G 2.6G 91% /data
/dev/cciss/c0d0p1 289M
22M 253M 8% /boot
tmpfs 252M
0 252M 0% /dev/shm
SGN.
Display Information of
/home File System
To see the information
of only,
device /home file
system in human
format use the following
command.
[root@tecmint ~]# df -hT /home
Filesystem Type Size Used
Avail Use% Mounted on
/dev/cciss/c0d0p5ext3 24G 22G
1.2G 95% /home
SGN.
Display Information
of File System in
Bytes.
To display all file system
information and usage
in 1024- byte blocks, use
option ‘-k‘ (e.g. – block-
size=1K) as follows.
[root@tecmint ~]# df -k
Filesystem 1K-blocks
Used Available Use% Mounted on
/dev/cciss/c0d0p2 78361192
23187212 51129216 32% /
/dev/cciss/c0d0p5 24797380
22273432 1243972 95% /home
/dev/cciss/c0d0p3 29753588
25503792 2713984 91% /data
/dev/cciss/c0d0p1 295561
21531 258770 8% /boot
tmpfs 257476
0 257476 0% /dev/shm
SGN.
Display Information of
File System in MB
To display information
of all file system
usage in MB (Mega Byte)
use the option as ‘-m‘.
[root@tecmint ~]# df -m
Filesystem 1M-blocks
Used Available Use% Mounted on
/dev/cciss/c0d0p2 76525
22644 49931 32% /
/dev/cciss/c0d0p5 24217
21752 1215 95% /home
/dev/cciss/c0d0p3 29057
24907 2651 91% /data
/dev/cciss/c0d0p1 289
22 253 8% /boot
tmpfs 252
0 252 0% /dev/shm
SGN.
Display Information of
File System in GB
To display
information of all
file system statistics
in GB (Gigabyte) use
the option as ‘df -h‘.
[root@tecmint ~]# df -h
Filesystem Size Used
Avail Use% Mounted on
/dev/cciss/c0d0p2 75G 23G
49G 32% /
/dev/cciss/c0d0p5 24G 22G
1.2G 95% /home
/dev/cciss/c0d0p3 29G 25G
2.6G 91% /data
/dev/cciss/c0d0p1 289M 22M
253M 8% /boot
tmpfs 252M 0
252M 0% /dev/shm
SGN.
Display Information of df
Command.
Using ‘–help‘ switch will
display a list of
available option that
are used
with df command.
SGN.
[root@tecmint ~]# df --help
Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.
Mandatory arguments to long options are mandatory for short options too.
-a, --all include dummy file systems
-B, --block-size=SIZE use SIZE-byte blocks
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
-H, --si likewise, but use powers of 1000 not 1024
-i, --inodes list inode information instead of block usage
-k like --block-size=1K
-l, --local limit listing to local file systems
--no-sync do not invoke sync before getting usage info (default)
-P, --portability use the POSIX output format
--sync invoke sync before getting usage info
-t, --type=TYPE limit listing to file systems of type TYPE
-T, --print-type print file system type
-x, --exclude-type=TYPE limit listing to file systems not of type TYPE
-v (ignored)
--help display this help and exit
--version output version information and exit
SIZE may be (or may be an integer optionally followed by) one of following:
kB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.
Report bugs to <bug-coreutils@gnu.org>.
SGN.
b. du:- du command, short for disk usage, is used to estimate
file space usage.
The du command can be used to track the files and directories
which are consuming excessive amount of space on hard disk
drive.
SYNTAX:- du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F
SGN.
Examples :
du /home/sameer/test
Output:
44 /home/sameer/test/data
2012 /home/sameer/test/system design
24 /home/sameer/test/table/sample_table/tree
28 /home/sameer/test/table/sample_table
32 /home/sameer/test/table
100104 /home/sameer/test
SGN.
OPTIONS:
-0, –null : end each output line with NULL
-a, –all : write count of all files, not just directories
–apparent-size : print apparent sizes, rather than disk usage.
-B, –block-size=SIZE : scale sizes to SIZE before printing on console
-c, –total : produce grand total
-d, –max-depth=N : print total for directory only if it is N or fewer levels
below command line argument
-h, –human-readable : print sizes in human readable format
-S, -separate-dirs : for directories, don’t include size of subdirectories
-s, –summarize : display only total for each directory
–time : show time of of last modification of any file or directory.
–exclude=PATTERN : exclude files that match PATTERN
SGN.
Command usage examples with options :
If we want to print sizes in human readable format(Kb, Mb, Gb), use -h
option:
du -h /home/sameer/test
Output:
44K /home/sameer/test/data
2.0M /home/sameer/test/system design
24K /home/sameer/test/table/sample_table/tree
28K /home/sameer/test/table/sample_table
32K /home/sameer/test/table
98M /home/sameer/test
SGN.
Use -a option for printing all files including
directories.
du -a -h /home/sameer/test
Output:
This is partial output of above command.
4.0K /home/sameer/test/blah1-new
4.0K /home/sameer/test/fbtest.py
8.0K /home/sameer/test/data/4.txt
4.0K /home/sameer/test/data/7.txt
4.0K /home/sameer/test/data/1.txt
4.0K /home/sameer/test/data/3.txt
4.0K /home/sameer/test/data/6.txt
4.0K /home/sameer/test/data/2.txt
4.0K /home/sameer/test/data/8.txt
8.0K /home/sameer/test/data/5.txt
44K /home/sameer/test/data
4.0K /home/sameer/test/notifier.py
SGN.
Use -c option to print total size
du -c -h /home/sameer/test
Output:
44K /home/sameer/test/data
2.0M /home/sameer/test/system design
24K/home/sameer/test/table/sample_table/tree
28K /home/sameer/test/table/sample_table
32K /home/sameer/test/table
98M /home/sameer/test
98M total
SGN.
To print sizes till particular level, use -d option with level no.
du -d 1 /home/sameer/test
Output:
44 /home/sameer/test/data
2012 /home/sameer/test/system design
32 /home/sameer/test/table
100104 /home/sameer/test
SGN.
Now try with level 2, you will get some extra directories
du -d 2 /home/sameer/test
Output:
44 /home/sameer/test/data
2012 /home/sameer/test/system design
28 /home/sameer/test/table/sample_table
32 /home/sameer/test/table
100104 /home/sameer/test
SGN.
Get summary of file system using -s option
du -s /home/sameer/test
Output :-
100104 /home/sameer/test
SGN.
Get the timestamp of last modified using
--time option
du --time -h /home/sameer/test
Output:-
44K 2018-01-14 22:22 /home/sameer/test/data
2.0M 2017-12-24 23:06 /home/sameer/test/system design
24K 2017-12-30 10:20 /home/sameer/test/table/sample_table/tree
28K 2017-12-30 10:20 /home/sameer/test/table/sample_table
32K 2017-12-30 10:20 /home/sameer/test/table
98M 2018-02-02 17:32 /home/sameer/test
SGN.
Que. Discuss Command
i. who ii. Who i am
iii. finger iv. mesg
v. wall vi. Talk
SGN.
i. who
who command is used to find out the following
information :
1. Time of last system boot
2. Current run level of the system
3. List of logged in users and more
Description :
The who command is used to get information about
currently logged in user on to system.
Syntax : $who [options] [filename]
SGN.
Examples :
1. The who command displays the following
information for each user currently logged in to the
system if no option is provided :
1.Login name of the users
2.Terminal line numbers
3.Login time of the users in to system
4.Remote host name of the user
SGN.
Displays the username, line, and
time of all currently logged-in
sessions. For example:
SGN.
ii. who am i
whoami command is used both in UNIX
OPERATING SYSTEM and as well as in WINDOWS
OPERATING SYSTEM .
It is basically the concatenation of the
strings “who”,”am”,”i” as whoami.
It displays the username of the current user when this
command is invoked.
It is similar as running the id command with the
options -un.
SGN.
Syntax:
whoami [option]
Related commands
w - Show who is logged on and what they are doing.
who - Report which users are logged in to the system.
SGN.
We've already discussed a command called who. It basically
provides information about all users who are currently
logged in. However, what if you are only interested in the
user who is currently logged in? Well, for this, you can use
the whoami command.
SGN.
iii. Finger
On the Linux operating system, you can simply check
the information of any user from remote or local command
line interface. That is ‘finger’ command.
This article will focus on usage of ‘finger’ command and its
options with demonstration command run on Ubuntu
Linux.
Syntax:
SGN.
iv. mesg
The mesg command allows you control write access to
your terminal by other users.
The write command allows other users to send a message to
your terminal session; the mesg command is used to toggle these
messages on or off.
Syntax :
mesg [n|y]
SGN.
-n
Prevents the display of terminal messages from other
users. This option is like using a "do not disturb" sign.
Syntax:
mesg n
-y
Allows messages to be displayed on your screen.
Syntax:
mesg y
If no option is given, mesg displays the current
access state of your terminal.
SGN.
mesg examples :
mesg y
Allow other users to send you messages.
mesg n
Disallow other users from being able to send
you messages.
mesg
Display the current write status of your terminal.
SGN.
v. Wall
Chat with other logged-in users.
Description:
Talk is a visual communication program which copies lines
from your terminal to that of another user, much like an instant
messenger service. When first called, talk contacts
the talk daemon on the other user's machine, which sends
the message below.
SGN.
wall -- send a message to everybody’s terminal.
Syntax:
wall [-n] [ message ]
Wall sends a message to everybody logged in with their mesg(1)
permission set to yes. The message can be given as an argument
to wall, or it can be sent to wall’s standard input. When using the
standard input from a terminal, the message should be terminated
with the EOF key (usually Control-D).The length of the message is
limited to 22 lines. For every invocation of wall a notification will be
written to syslog, with facility LOG_USER and level LOG_INFO.
SGN.
wall –n
Suppresses the normal banner printed by wall, changing it to
"Remote broadcast message". This option is only available for
root if wall is installed set-group-id, and is used by rpc.walld(8).
SGN.
vi. Talk :
Chat with other logged-in users
Description
Talk is a visual communication program which copies lines
from your terminal to that of another user, much like an instant
messenger service. When first called, talk contacts
the talk daemon on the other user’s machine, which sends the
message below.
Syntax
talk person [ttyname]
SGN.
Message from TalkDaemon@his_machine...
talk: connection requested by
your_name@your_machine.
talk: respond with: talk your_name@your_machine
to that user. At this point, he then replies by
typing
talk your_name@your_machine
SGN.
It doesn't matter from which machine the recipient replies,
as long as his login name is the same. Once communication is
established, the two parties may type simultaneously; their
output will appear in separate windows. Typing control-L (^L)
will cause the screen to be reprinted. The erase, kill line,
and word erase characters (normally ^H, ^U, and ^W,
respectively) will behave normally. To exit, just type the
interrupt character (normally ^C); talk then moves the
cursor to the bottom of the screen and restores
the terminal to its previous state
SGN.
talk supports scrollback; use esc-p and esc-n to scroll your
window, and ctrl-p and ctrl-n to scroll the other window.
If you do not want to receive talk requests, you may block
using the mesgcommand. By default, talk requests are normally not
blocked. Certain commands, in particular nroff, pine, and pr,
block messages temporarily to preserve their own output.
SGN.
person
If you want to talk to someone on your machine,
then person is just the person's login name. If you
want to talk to a user on another host,
then person is of the form 'user@host'.
ttyname
If you want to talk to a user who is logged in more
than once, the ttyname argument may be used to
indicate the appropriate terminal name, where
ttyname is of the form 'ttyXX' or 'pts/X'.
SGN.
Talk examples :
talk hope
Talk to user hope.
SGN.
THANK
YOU
S.G.N

More Related Content

What's hot

101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystemsAcácio Oliveira
 
Useful linux-commands
Useful linux-commandsUseful linux-commands
Useful linux-commandsHimani Singh
 
2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-iLogesh Kumar Anandhan
 
Linux Commands - 3
Linux Commands - 3Linux Commands - 3
Linux Commands - 3Kanchilug
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsYusuf Felly
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manualdummy
 
Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands Raghav Arora
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unixsouthees
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file managementAcácio Oliveira
 
101 2.4 use debian package management
101 2.4 use debian package management101 2.4 use debian package management
101 2.4 use debian package managementAcácio Oliveira
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic CommandsHanan Nmr
 
101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirectsAcácio Oliveira
 
Devops for beginners
Devops for beginnersDevops for beginners
Devops for beginnersVivek Parihar
 
คำสั่งยูนิกส์ Command line
คำสั่งยูนิกส์ Command lineคำสั่งยูนิกส์ Command line
คำสั่งยูนิกส์ Command lineSopit Pairo
 

What's hot (19)

101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
 
Useful linux-commands
Useful linux-commandsUseful linux-commands
Useful linux-commands
 
2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i
 
Group13
Group13Group13
Group13
 
Linux Commands - 3
Linux Commands - 3Linux Commands - 3
Linux Commands - 3
 
Basic Linux commands
Basic Linux commandsBasic Linux commands
Basic Linux commands
 
Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu Commands
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manual
 
Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
101 2.4 use debian package management
101 2.4 use debian package management101 2.4 use debian package management
101 2.4 use debian package management
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects
 
Devops for beginners
Devops for beginnersDevops for beginners
Devops for beginners
 
Unix slideshare
Unix slideshareUnix slideshare
Unix slideshare
 
คำสั่งยูนิกส์ Command line
คำสั่งยูนิกส์ Command lineคำสั่งยูนิกส์ Command line
คำสั่งยูนิกส์ Command line
 

Similar to Linux Shell Scripting Presantion

Similar to Linux Shell Scripting Presantion (20)

50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
101 2.1 design hard disk layout
101 2.1 design hard disk layout101 2.1 design hard disk layout
101 2.1 design hard disk layout
 
Linux
LinuxLinux
Linux
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
Linux
Linux Linux
Linux
 
Unix Administration 4
Unix Administration 4Unix Administration 4
Unix Administration 4
 
Linux
LinuxLinux
Linux
 
Divya
DivyaDivya
Divya
 
Divya
DivyaDivya
Divya
 
Linux conf-admin
Linux conf-adminLinux conf-admin
Linux conf-admin
 
Linux Conf Admin
Linux Conf AdminLinux Conf Admin
Linux Conf Admin
 
Linux conf-admin
Linux conf-adminLinux conf-admin
Linux conf-admin
 
LINUX
LINUXLINUX
LINUX
 
Inspection and maintenance tools (Linux / OpenStack)
Inspection and maintenance tools (Linux / OpenStack)Inspection and maintenance tools (Linux / OpenStack)
Inspection and maintenance tools (Linux / OpenStack)
 
Working with core dump
Working with core dumpWorking with core dump
Working with core dump
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration training
 
linux installation.pdf
linux installation.pdflinux installation.pdf
linux installation.pdf
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 

Recently uploaded

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Recently uploaded (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

Linux Shell Scripting Presantion

  • 1.
  • 2. Que. Describe the following disc space management a. df b. du df :- In this guide, we are going to learn to use df command. The df command, stands for Disk Free, reports file system disk space usage. It displays the amount of disk space available on the file system in a Linux system. The df command is not to be confused with du command. Both serves different purposes. The df command reports how much disk space we have (i.e free space) whereas the du command reports how much disk space is being consumed by the files and folders. Hope I made myself clear. Let us go ahead and see some more tools for checking disk space utilization in Linux. However, Linux has a strong built in utility called ‘df‘. The ‘df‘ command stand for “disk filesystem“, it is used to get full summary of available and used disk space usage of file system on Linux system. Using ‘-h‘ parameter with (df -h) will shows the file system disk space statistics in “human readable” format, means it gives the details in bytes, mega bytes and gigabyte. This article explain a way to get the full information of Linux disk space usage with the help of ‘df‘ command with their practical examples. So, you could better understand the usage of df command in Linux. Syntax :- SGN.
  • 3. 1. Check File System Disk Space Usage On the internet you will find plenty of tools for checking disk space utilization in Linux. However, Linux has a strong built in utility called ‘df‘. The ‘df‘ command stand for “disk filesystem“, it is used to get full summary of available and used disk space usage of file system on Linux system. Using ‘-h‘ parameter with (df -h) will shows the file system disk space statistics in “human readable” format, means it gives the details in bytes, mega bytes and gigabyte. The “df” command displays the information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system. [root@tecmint ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 78361192 23185840 51130588 32% / /dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home /dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data /dev/cciss/c0d0p1 295561 21531 258770 8% /boot tmpfs 257476 0 257476 0% /dev/shm SGN.
  • 4. Display Information of all File System Disk Space Usage The same as above, but it also displays information of dummy file systems along all the file system disk usage and their memory utilization. [root@tecmint ~]# df -a Filesystem 1K-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 78361192 23186116 51130312 32% / proc 0 0 0 - /proc sysfs 0 0 0 - /sys devpts 0 0 0 - /dev/pts /dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home /dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data /dev/cciss/c0d0p1 295561 21531 258770 8% /boot tmpfs 257476 0 257476 0% /dev/shm none 0 0 0 - /proc/sys/fs/binfmt_misc sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs SGN.
  • 5. Show Disk Space Usage in Human Readable Format Have you noticed that above commands displays information in bytes, which is not readable yet all, because we are in a habit of reading the sizes in megabytes, gigabytes etc. it makes very easy to understand and remember. The df command provides an option to display sizes in Human Readable formats by using ‘-h’ the results in human readable format (e.g., 1K 2M 3G)) tecmint ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/cciss/c0d0p2 75G 23G 49G 32% / /dev/cciss/c0d0p5 24G 22G 1.2G 95% /home /dev/cciss/c0d0p3 29G 25G 2.6G 91% /data /dev/cciss/c0d0p1 289M 22M 253M 8% /boot tmpfs 252M 0 252M 0% /dev/shm SGN.
  • 6. Display Information of /home File System To see the information of only, device /home file system in human format use the following command. [root@tecmint ~]# df -hT /home Filesystem Type Size Used Avail Use% Mounted on /dev/cciss/c0d0p5ext3 24G 22G 1.2G 95% /home SGN.
  • 7. Display Information of File System in Bytes. To display all file system information and usage in 1024- byte blocks, use option ‘-k‘ (e.g. – block- size=1K) as follows. [root@tecmint ~]# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 78361192 23187212 51129216 32% / /dev/cciss/c0d0p5 24797380 22273432 1243972 95% /home /dev/cciss/c0d0p3 29753588 25503792 2713984 91% /data /dev/cciss/c0d0p1 295561 21531 258770 8% /boot tmpfs 257476 0 257476 0% /dev/shm SGN.
  • 8. Display Information of File System in MB To display information of all file system usage in MB (Mega Byte) use the option as ‘-m‘. [root@tecmint ~]# df -m Filesystem 1M-blocks Used Available Use% Mounted on /dev/cciss/c0d0p2 76525 22644 49931 32% / /dev/cciss/c0d0p5 24217 21752 1215 95% /home /dev/cciss/c0d0p3 29057 24907 2651 91% /data /dev/cciss/c0d0p1 289 22 253 8% /boot tmpfs 252 0 252 0% /dev/shm SGN.
  • 9. Display Information of File System in GB To display information of all file system statistics in GB (Gigabyte) use the option as ‘df -h‘. [root@tecmint ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/cciss/c0d0p2 75G 23G 49G 32% / /dev/cciss/c0d0p5 24G 22G 1.2G 95% /home /dev/cciss/c0d0p3 29G 25G 2.6G 91% /data /dev/cciss/c0d0p1 289M 22M 253M 8% /boot tmpfs 252M 0 252M 0% /dev/shm SGN.
  • 10. Display Information of df Command. Using ‘–help‘ switch will display a list of available option that are used with df command. SGN.
  • 11. [root@tecmint ~]# df --help Usage: df [OPTION]... [FILE]... Show information about the file system on which each FILE resides, or all file systems by default. Mandatory arguments to long options are mandatory for short options too. -a, --all include dummy file systems -B, --block-size=SIZE use SIZE-byte blocks -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) -H, --si likewise, but use powers of 1000 not 1024 -i, --inodes list inode information instead of block usage -k like --block-size=1K -l, --local limit listing to local file systems --no-sync do not invoke sync before getting usage info (default) -P, --portability use the POSIX output format --sync invoke sync before getting usage info -t, --type=TYPE limit listing to file systems of type TYPE -T, --print-type print file system type -x, --exclude-type=TYPE limit listing to file systems not of type TYPE -v (ignored) --help display this help and exit --version output version information and exit SIZE may be (or may be an integer optionally followed by) one of following: kB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y. Report bugs to <bug-coreutils@gnu.org>. SGN.
  • 12. b. du:- du command, short for disk usage, is used to estimate file space usage. The du command can be used to track the files and directories which are consuming excessive amount of space on hard disk drive. SYNTAX:- du [OPTION]... [FILE]... du [OPTION]... --files0-from=F SGN.
  • 13. Examples : du /home/sameer/test Output: 44 /home/sameer/test/data 2012 /home/sameer/test/system design 24 /home/sameer/test/table/sample_table/tree 28 /home/sameer/test/table/sample_table 32 /home/sameer/test/table 100104 /home/sameer/test SGN.
  • 14. OPTIONS: -0, –null : end each output line with NULL -a, –all : write count of all files, not just directories –apparent-size : print apparent sizes, rather than disk usage. -B, –block-size=SIZE : scale sizes to SIZE before printing on console -c, –total : produce grand total -d, –max-depth=N : print total for directory only if it is N or fewer levels below command line argument -h, –human-readable : print sizes in human readable format -S, -separate-dirs : for directories, don’t include size of subdirectories -s, –summarize : display only total for each directory –time : show time of of last modification of any file or directory. –exclude=PATTERN : exclude files that match PATTERN SGN.
  • 15. Command usage examples with options : If we want to print sizes in human readable format(Kb, Mb, Gb), use -h option: du -h /home/sameer/test Output: 44K /home/sameer/test/data 2.0M /home/sameer/test/system design 24K /home/sameer/test/table/sample_table/tree 28K /home/sameer/test/table/sample_table 32K /home/sameer/test/table 98M /home/sameer/test SGN.
  • 16. Use -a option for printing all files including directories. du -a -h /home/sameer/test Output: This is partial output of above command. 4.0K /home/sameer/test/blah1-new 4.0K /home/sameer/test/fbtest.py 8.0K /home/sameer/test/data/4.txt 4.0K /home/sameer/test/data/7.txt 4.0K /home/sameer/test/data/1.txt 4.0K /home/sameer/test/data/3.txt 4.0K /home/sameer/test/data/6.txt 4.0K /home/sameer/test/data/2.txt 4.0K /home/sameer/test/data/8.txt 8.0K /home/sameer/test/data/5.txt 44K /home/sameer/test/data 4.0K /home/sameer/test/notifier.py SGN.
  • 17. Use -c option to print total size du -c -h /home/sameer/test Output: 44K /home/sameer/test/data 2.0M /home/sameer/test/system design 24K/home/sameer/test/table/sample_table/tree 28K /home/sameer/test/table/sample_table 32K /home/sameer/test/table 98M /home/sameer/test 98M total SGN.
  • 18. To print sizes till particular level, use -d option with level no. du -d 1 /home/sameer/test Output: 44 /home/sameer/test/data 2012 /home/sameer/test/system design 32 /home/sameer/test/table 100104 /home/sameer/test SGN.
  • 19. Now try with level 2, you will get some extra directories du -d 2 /home/sameer/test Output: 44 /home/sameer/test/data 2012 /home/sameer/test/system design 28 /home/sameer/test/table/sample_table 32 /home/sameer/test/table 100104 /home/sameer/test SGN.
  • 20. Get summary of file system using -s option du -s /home/sameer/test Output :- 100104 /home/sameer/test SGN.
  • 21. Get the timestamp of last modified using --time option du --time -h /home/sameer/test Output:- 44K 2018-01-14 22:22 /home/sameer/test/data 2.0M 2017-12-24 23:06 /home/sameer/test/system design 24K 2017-12-30 10:20 /home/sameer/test/table/sample_table/tree 28K 2017-12-30 10:20 /home/sameer/test/table/sample_table 32K 2017-12-30 10:20 /home/sameer/test/table 98M 2018-02-02 17:32 /home/sameer/test SGN.
  • 22. Que. Discuss Command i. who ii. Who i am iii. finger iv. mesg v. wall vi. Talk SGN.
  • 23. i. who who command is used to find out the following information : 1. Time of last system boot 2. Current run level of the system 3. List of logged in users and more Description : The who command is used to get information about currently logged in user on to system. Syntax : $who [options] [filename] SGN.
  • 24. Examples : 1. The who command displays the following information for each user currently logged in to the system if no option is provided : 1.Login name of the users 2.Terminal line numbers 3.Login time of the users in to system 4.Remote host name of the user SGN.
  • 25. Displays the username, line, and time of all currently logged-in sessions. For example: SGN.
  • 26. ii. who am i whoami command is used both in UNIX OPERATING SYSTEM and as well as in WINDOWS OPERATING SYSTEM . It is basically the concatenation of the strings “who”,”am”,”i” as whoami. It displays the username of the current user when this command is invoked. It is similar as running the id command with the options -un. SGN.
  • 27. Syntax: whoami [option] Related commands w - Show who is logged on and what they are doing. who - Report which users are logged in to the system. SGN.
  • 28. We've already discussed a command called who. It basically provides information about all users who are currently logged in. However, what if you are only interested in the user who is currently logged in? Well, for this, you can use the whoami command. SGN.
  • 29. iii. Finger On the Linux operating system, you can simply check the information of any user from remote or local command line interface. That is ‘finger’ command. This article will focus on usage of ‘finger’ command and its options with demonstration command run on Ubuntu Linux. Syntax: SGN.
  • 30. iv. mesg The mesg command allows you control write access to your terminal by other users. The write command allows other users to send a message to your terminal session; the mesg command is used to toggle these messages on or off. Syntax : mesg [n|y] SGN.
  • 31. -n Prevents the display of terminal messages from other users. This option is like using a "do not disturb" sign. Syntax: mesg n -y Allows messages to be displayed on your screen. Syntax: mesg y If no option is given, mesg displays the current access state of your terminal. SGN.
  • 32. mesg examples : mesg y Allow other users to send you messages. mesg n Disallow other users from being able to send you messages. mesg Display the current write status of your terminal. SGN.
  • 33. v. Wall Chat with other logged-in users. Description: Talk is a visual communication program which copies lines from your terminal to that of another user, much like an instant messenger service. When first called, talk contacts the talk daemon on the other user's machine, which sends the message below. SGN.
  • 34. wall -- send a message to everybody’s terminal. Syntax: wall [-n] [ message ] Wall sends a message to everybody logged in with their mesg(1) permission set to yes. The message can be given as an argument to wall, or it can be sent to wall’s standard input. When using the standard input from a terminal, the message should be terminated with the EOF key (usually Control-D).The length of the message is limited to 22 lines. For every invocation of wall a notification will be written to syslog, with facility LOG_USER and level LOG_INFO. SGN.
  • 35. wall –n Suppresses the normal banner printed by wall, changing it to "Remote broadcast message". This option is only available for root if wall is installed set-group-id, and is used by rpc.walld(8). SGN.
  • 36. vi. Talk : Chat with other logged-in users Description Talk is a visual communication program which copies lines from your terminal to that of another user, much like an instant messenger service. When first called, talk contacts the talk daemon on the other user’s machine, which sends the message below. Syntax talk person [ttyname] SGN.
  • 37. Message from TalkDaemon@his_machine... talk: connection requested by your_name@your_machine. talk: respond with: talk your_name@your_machine to that user. At this point, he then replies by typing talk your_name@your_machine SGN.
  • 38. It doesn't matter from which machine the recipient replies, as long as his login name is the same. Once communication is established, the two parties may type simultaneously; their output will appear in separate windows. Typing control-L (^L) will cause the screen to be reprinted. The erase, kill line, and word erase characters (normally ^H, ^U, and ^W, respectively) will behave normally. To exit, just type the interrupt character (normally ^C); talk then moves the cursor to the bottom of the screen and restores the terminal to its previous state SGN.
  • 39. talk supports scrollback; use esc-p and esc-n to scroll your window, and ctrl-p and ctrl-n to scroll the other window. If you do not want to receive talk requests, you may block using the mesgcommand. By default, talk requests are normally not blocked. Certain commands, in particular nroff, pine, and pr, block messages temporarily to preserve their own output. SGN.
  • 40. person If you want to talk to someone on your machine, then person is just the person's login name. If you want to talk to a user on another host, then person is of the form 'user@host'. ttyname If you want to talk to a user who is logged in more than once, the ttyname argument may be used to indicate the appropriate terminal name, where ttyname is of the form 'ttyXX' or 'pts/X'. SGN.
  • 41. Talk examples : talk hope Talk to user hope. SGN.