File system Summary 1
file system
File system structure:
/boot: directory where boot files are stored, kernel files and boot loaders are stored
/bin;/sbin: binary program
/lib;/lib64: library functions (/lib/modules: store kernel version number, driver)
/etc: Configuration file
/home: user home directory (root home directory: /root ; normal user home directory: /home/limuzi)
(Renaming possible, suggested for safety reasons)
/mnt: temporary file mount point
/media: Portable mobile device mount point
/misc: automatic mount point
/proc: Virtual file system that outputs process, kernel information
/sys: Virtual file system storing hardware device information (~]#echo "- - -" > /sys/class/scsi_host/host2/scan Triggers identification of hard disk after adding hard disk)
/opt: Third-party software
/tmp: temporary file
/usr:
/var:log www ftp mail
/dev: Hardware device directory
Block devices: random access, cached (physical devices) hard disk partitions
character device: sequential access, no cache (logical device) zero null random tty
/srv: Data used by system operation service
file type
- : General documentation
d: Catalog file
b: Block device file
c: Character device file
l: Symbolic link file
p: pipe file
s: socket file socket
File types represented by colors
Blue: catalog file
Green: executable program
×××: Block device file
Light blue: linked files
Red: compressed files
PS: Show only a list of directories under a directory: ~]#ls -d.*/ PATH */PATH (error if directory is empty)
Show only hidden files in a directory: l./ PATH (alias l.= 'ls -d .* --color=auto')
View file status
stat
Three timestamps: access time: access time-time, read file content, touch xxx can refresh file access time
Modify time: modify time-mtime, change file content (data)
Change time: change time-ctime, metadata changes
ls: Lists the contents of the current or specified directory
ls -a: Show all files (including hidden files)
ls -l: Display details
ls -R: Recursive display
ls -S: Sort by size
ls -r: reverse sort
ls -t: Sort by mtime
ls -1: file split display
file wildcard
* : Matches zero or more characters
?:Match any single character
~: Current user home directory
[0-9]: Any single number
[a-c]:a A b B c
touch: Create file, change file timestamp
-a: refresh atime and ctime
-m: Refresh mtime and ctime
-c: If the file exists, refresh the timestamp; if it does not exist, do not create it
-t: Specifies the timestamp in the format
[root@localhost testdir]# touch -t 200808080808.30 f1
[root@localhost testdir]# ls
f1
[root@localhost testdir]# stat f1
File: 'f1'
Size: 0 Blocks:0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode:134333666 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-08-08 08:08:30.000000000 +0800
Modify: 2008-08-08 08:08:30.000000000 +0800
Change: 2016-07-30 20:36:41.464871487 +0800
Birth: -
-d: Specify date
cp: Copy files and directories
PS :DEST object file, SRC source file
Default aliascp='cp -i' for root (alias profile: current user ~/.bashrc, all users/etc/bashrc)
common options
-i: Interactive
-r, -R: Recursively copy the directory and all its contents
-a: archive, equivalent to-dR --preserv=all, that is, retain all attributes of the original file
-p =mode,ownership,timestamp
-v: --verbose, showing the replication process
-f: --force, force overwrite if destination file exists