리눅스 파일, 디렉토리 명령어(linux file/directory command) 2. modifying
1. copy file
cp src dst
-
src, dst can be multiple files delimited with spacebar(‘ ‘)
-
src must exist
-
if dst not exist, create(can be renamed)
-
if dst exist, replace(overwrite)
* option
-p | preserve time/permission |
-i | interactive prompt(asking overwrite) |
-r | recursive(all files/directories under directory) copying |
2. move file
cp src dst
-
src, dst can be multiple files delimited with spacebar(‘ ‘)
-
src must exist
-
if dst not exist, create(can be renamed)
-
if dst exist, flush its contents(data)
* option
-f | force |
-i | interactive prompt(asking flushing) |
3. file system
- Boot block
load kernel into memory
- Super Block
file system information
disk size, free blocks, bad block locations
- Inode Block
information node for each file
owner, type, permission, address
- Data Block
real files
link is logical relationship between filename Inode number
4. remove
rm file
* option
-f | force |
-i | interactive prompt(asking flushing) |
-r | recursive(all files/directories under target) |
rm
doen not delete a file. It’s just remove the link.
Such that file
can be recovered
5. link
if edit original file, linked file is also changed.
5-1 hard link vs soft(symbolic) link
hard link
ln shared_file link_name
same inode: same data on dist
if delete original file, hard linked file remain its data
symbolic link
ln -s shared_file link_name
different inode: file pointer
if delete original file, symbolic linked file makes error(broken link)
Leave a comment