Lecturer:
MS. Võ Minh Sơn
Students:
Nguyễn Đức Tiến 0620076
Nguyễn Xuân Thuận 0620069
1 Exploring the Linux filesystem
2 Examining Files
3 File permissions
4 File processing
5 Demo
6 Q&A
2
1.1 Overview
1.2 Filesystem hierarchy
1.3 Type of information
1.4 Linux device files
1.5 Mounting and unmounting a device on the
filesystem
3
Physical storage device: HDD, DVD-ROM
sector, track, cylinder
• HDDs can be divided into separate storage
devices called partitions
A filesystem is the methods and data
structures that an operating system uses to
keep track of files on a disk or partition (the
way the files are organized on the disk)
• ext3 (third extended filesystem)
4
5
File properties (Administrative information)
Name Data created/
Location accessed/modified
Size Permissions
Owner/Group Desktop
Type Command line
file‟s inode
File manager KDE Konqueror
(Windows Explorer) GNOME Nautilus
6
7
8
path (pathname)
absolute name vs relative name
• /home/nguyenxuanthuan/programs
• /home/guest/programs
shorcut
• “ . ” current directory
• “ .. ” directory immediately above the
current directory
9
Data files
Application-specific files
o Program Applications
o Image files
Text files
Type of
Configuration files
information
Directory files
Link files
Device files
10
11
Linux treats all devices as files and uses a
device just as it uses a file
Open file Write file
Close file Read file
Device Driver: a special program that
controls a particular type of hardware
Any application can access a device by
opening the file specific to that device
12
Device file: the file which applications use to
access a device
• These special appear in the /dev directory in
the Linux filesystem
• block devices „b‟
character devices „c‟
network devices „ethx‟/„pppx‟ (x = 0, 1, ...)
13
Each of storage device has own filesystem
• when you want to add a new storage device, you need to
format it as a filesystem and then attach it to your Linux file
structure
Mounting is the operation you perform to
cause the filesystem on a physical storage
device to appear as part of the Linux filesystem
Mounting point is a specified directory that
contains the mount command to mount a
device on the Linux filesystem
14
Mounting a
device on the
filesystem
15
hd IDE hard drive
1 – 4 are primary partitions
5 and up are logical partitions
sd SCSI hard drives
fd Floppy disks
lp Printer ports
cdrom Links to your CD-ROM device file
Example
• fd0: the first floppy drive attached to your system
• sda2: the second partition on the first SCSI hard drive
16
2. Examining Files
File information
GUI: right-click Command line:
the file icon and •ls
select properties. •options: -l, -a…
•operators: >,>>
•pwd
18
3. File Permissions
Three types of user accounts
• Owner The account that owns the file
• Group Members of a group that owns the file
• All users All accounts on the system
Do one or more of three things to the
file
• Read (r) Look at the contents of the file
• Write (w) Save the file to the hard disk
• Execute (x) Run the file or enter the directory
Example: drwxr-xr--
3. File Permissions (cont)
Format:
chmod who action permission filename
Example: chmod u+x nguyen.txt