diff --git a/filesystem.pdf b/filesystem.pdf index 7bc14c4c6a578a6c36a4908dee55ff0a72dac9f7..53f29c571f5548df5c8a8298ee3b40f6306748b5 100644 Binary files a/filesystem.pdf and b/filesystem.pdf differ diff --git a/filesystem.txt b/filesystem.txt index 3d7c0d1eb812ae8ae8fb9dc8a01373395d44f6d1..05928afa34e782953bd866987bec7b40a814b93c 100644 --- a/filesystem.txt +++ b/filesystem.txt @@ -38,6 +38,39 @@ Moving Around | popd | Pop the top of the directory stack, cd'ing to the new top | +Moving, Copying, and Extracting Pieces of Files +----------------------------------------------- + +| *Command* | *Result* | +| --------- | -------- | +| cp *a* *b* | Create a copy of file *a* named *b* | +| mv *a* *b* | Rename file *a* so that it is now *b* | +| dd if=*a* of=*b* | Dump the contents of input file *a* to output file *b* | + +For all of these the files may be in any directory, so to move a +file `foo` up a directory, you could run + + mv foo ../foo + +or just + + mv foo ../ + +`dd` is an extremely powerful tool, and `if` and `of` are only the +beginning of its options. Either can be omitted, and use STDIN or +STDOUT as the default. Here's another simple example: + + dd if=/dev/zero of=foo bs=1024 count=5 + +This will create a file `foo` with the first 5kB of `/dev/zero`, +which will provide you with as many NULL bytes as you request. Give +this a try, and then run + + xxd foo + +See the manpage for `dd` for all options. It's well worth you time +to learn more about this command! + File Permissions ----------------