Uploaded by Tuấn Đoàn

Lesson 5 - Managing Files - Part 1

advertisement
Lesson 5: Managing Files
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 1
Objectives covered
o 103.3 Performing basic file management (weight: 4)
o 104.5 Manage file permissions and ownership (weight: 3)
o 104.6 Create and change hard and symbolic links (weight: 2)
o 104.7 Find system files and place files in correct location (w:2)
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 2
Performing basic
file management
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 3
File naming rules
- Case sensitive
- Limit to 255 characters
- No need to use dot “.”
- Character used as bellow conventions:
Could use
Do not use
characters A-Z, a-z
Meta characters: \ / < > ! $ % ^ & * | { } [ ] “ ‘ ` ; ~
numbers 0-9
Space “ “
dot “.”
dash “–”
underscore “_”
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 4
Creating empty files
touch filename
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 5
Displaying files
ls [Options] [File]
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 6
Displaying files using wildcards
* ? []
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 7
Specify file type
file, type, ls -F
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 8
Making directories
mkdir [Option] path-to-dir
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 9
Copying files and directories
cp [Option] Source Dest
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 10
Moving files and directories
mv [Option] Source Dest
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 11
deleting files and directories
rm [Option] File
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 12
Compressing/decompressing files
Compress
command
Uncompress
command
Notation
gzip
gunzip
Just compress one file at a time, replace the
original file with the compressed file with a .gz
file extension
bzip2
bunzip2
Just compress one file at a time, replace the
original file with the compressed file with a
.bz2 file extension
xz
unxz
Just compress one file at a time, replace the
original file with the compressed file with a .xz
file extension
zip
unzip
Can compress multiple file at a time, does not
replace the original file(s), create a new file
with .zip file extention
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 13
Viewing content of compressed file
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 14
Archiving files
cpio
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 15
Archiving files
tar
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 16
Extracting tarball
tar
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 17
Archiving files
dd if=InputDev of=outputDev [Operands]
LEVEL values:
- none
only display error messages
- noxfer
does not display final transfer statistics.
- progress displays periodic transfer statistics
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 18
Question...!
This document is created by Nguyen Hoang Chi
Chi.Nguyen.e4w@gmail.com
Page 19
Download