Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
style Students:
CONTENTS
1 2 3 4 5 6
22
Exploring the Linux filesystem Examining Files File permissions File processing Demo Q&A
filesystem management in in Linux Filesystem management Linux
filesystem
1.1 Overview
l
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)
44
55
l l l
77
88
/home/nguyenxuanthuan/programs /home/guest/programs current directory directory immediately above the current directory
shorcut
. ..
99
Application-specific files
o o
Type of information
Text files
Device files
1010 Filesystem management Linux Filesystemmanagement inin Linux
1111
Linux treats all devices as files and uses a device just as it uses a file
Open file Close file Write file Read file
Device Driver: a special program that controls a particular type of hardware l Any application can access a device by opening the file specific to that device
Filesystem management Linux Filesystemmanagement inin Linux
1212
These special appear in the /dev directory in the Linux filesystem block devices b character devices c network devices ethx/pppx (x = 0, 1, ...)
1313
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
1414
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
Filesystem management Linux Filesystemmanagement inin Linux
1515
Mounting a device on the filesystem management in in Linux Filesystem management Linux filesystem
sd fd lp cdrom
l
Example fd0: the first floppy drive attached to your system sda2: the second partition on the first SCSI hard drive
Filesystem management Linux Filesystemmanagement inin Linux
1616
2. Examining Files
File information GUI: right-click the file icon and select properties. Command line: ls options: -l, -a operators: >,>> pwd
1818
3. File Permissions
l
Owner The account that owns the file Group Members of a group that owns the file All users All accounts on the system Read (r) Write (w) Execute (x)
Look at the contents of the file Save the file to the hard disk Run the file or enter the directory Example: drwxr-xr-Filesystem management Linux Filesystemmanagement inin Linux
4. File processing
4.1 Finding file 4.2 Creating Directories, Files, and Links 4.3 Copying, Renaming, and Moving Files 4.4 Viewing and Editing Text Files 4.5 Deleting Files and Directories 4.6 Backup and restoring files
Use: find command to find files by filename or properties and grep command to find files by content
To create a directory in any directory where you have write permission, use the mkdir command: mkdir path/dirname If path includes directories don't yet exist, you can create them in one command with the -p option: mkdir -p /usr/local/newparent/mydir
Filesystem management Linux Filesystemmanagement inin Linux
Files can be created by applications, such as a word processor, and cat command. Links can be created at the command line using the ln command
Applications: Kate, Kwrite, Command lines: cat filename: The entire file contents display on the screen at once less filename: display the contents one screen at a time vi filename: edit file
Vi options
Vi options (cont)
Vi options (cont)
Vi options (cont)
rm filename: delete a file rm *: delete all file in current directory rmdir dirname: remove a empty directory rm -r dirname: remove a directory Must have write permissions on the directory containing the files
3434
Tar options
5. DEMO
l l l
VMWare Workstation
Linux OS Demo
3939
Reference
1. 2. 3. 4. 5.
4040
Spring into Linux (AW), 2005 Linux All-In-One Desk Reference For Dummies 2e (Wiley, 2006) Beginning Linux Programming 4e (Wrox, 2007) Linux: The Complete Reference, Sixth Edition www.tinycore.com
Filesystem management Linux Filesystemmanagement inin Linux
6. Q&A
Thank You !
4141