1 minute read

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



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.

ln shared_file link_name

   same inode: same data on dist

   if delete original file, hard linked file remain its data

ln -s shared_file link_name

   different inode: file pointer

   if delete original file, symbolic linked file makes error(broken link)

Categories:

Updated:

Leave a comment