This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!
Files commands¶
TODO: split this cheat sheet into dedicated ones (one per command)
Reference(s)
Table of contents¶
cat
chmod
chown
chgrp
cksum
cmp
cp
dd
du
df
file
fuser
ln
ls
mkdir
mv
pax
pwd
rm
rmdir
shred
split
tee
touch
type
umask
cat
¶
TODO
chmod
¶
TODO
chown
¶
TODO
chgrp
¶
TODO
cksum
¶
TODO
cmp
¶
TODO
cp
¶
TODO
dd
¶
WIP
- Erase the content of a disk (e.g.
/dev/sdx
) by overriding it with random characters:
Note
The coreutils
command shred
is more appropriate for this.
- Erase the content of a disk (e.g.
/dev/sdx
) by overriding it with zeros:
Note
The coreutils
command shred
is more appropriate for this.
du
¶
- Disk usage:
TODO
df
¶
- Disk file system:
TODO
file
¶
TODO
fuser
¶
TODO
ln
¶
TODO
ls
¶
TODO
- Sort sort newest files last:
mkdir
¶
TODO
mv
¶
TODO
pax
¶
TODO
pwd
¶
TODO
rm
¶
TODO
See shred (TODO add link to shred section below) to remove the content of a file and not just the "link" to the file.
rmdir
¶
TODO
shred
¶
A GNU Core Utility (coreutils
) command to overwrite a file to hide its contents, and
optionally delete it.
-
Full shred documentation: https://www.gnu.org/software/coreutils/shred
-
Overwrite the content of a file with random characters:
-
Overwrite the content of a file (with random chars), 10 times (instead of default 3 times):
-
Overwrite the content of a file with zeros after overwriting it with random characters:
-
Overwrite the content of a file you don't own (with random chars):
-
Delete a file after overwriting it's content (with random chars):
-
Overwrite the first bytes of a file (with random chars):
-
Overwrite the content of a full disk (e.g.
/dev/sdx
) with zeros after overwriting it with random chars (10 times), in verbose mode:
Warning
shred relies on a very important assumption: that the file system overwrites data in place. This is the traditional way to do things, but many modern file system designs do not satisfy this assumption. The following are examples of file systems on which shred is not effective, or is not guaranteed to be effective in all file system modes:
-
log structured or journaled file systems, such as those supplied with AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)
-
file systems that write redundant data and carry on even if some writes fail, such as RAID-based file systems
-
file systems that make snapshots, such as Network Appliance's NFS server
-
file systems that cache in temporary locations, such as NFS version 3 clients
-
compressed file systems
Note
Multiple algorithms exists to wipe your data: see here.
But all data erasure methods are quite similar apart from the number of passes and what or how
characters are written over existing data. There is actually no hard proof that those methods
are more effective than a few passes of random scrubbing, like shred
does (except for very
specific hardware): see https://en.wikipedia.org/wiki/Gutmann_method#Criticism.
split
¶
TODO
tee
¶
TODO
touch
¶
TODO
type
¶
TODO
umask
¶
TODO
If this cheat sheet has been useful to you, then please consider leaving a star here.