Difference between revisions of "Talk:344: 1337: Part 4"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
(Created page with "It's the piping of "find ~" (all files in Mom's current login's home directory) and "find ~nomad" (all files in the home directory of user "nomad", presumably that's Elaine's ...")
 
Line 1: Line 1:
 
It's the piping of "find ~" (all files in Mom's current login's home directory) and "find ~nomad" (all files in the home directory of user "nomad", presumably that's Elaine's account also on Mom's machine, having recently been on a 'life journey' of self-discovery and learning) through the shred command that is doing the directory recursion, as part of the "find" command's default behaviour (IIRC).  I've never used the shredding command myself, but I'd say that it's operating on the list given it by the "find", rather than doing the directory-burrowing itself, for which I'd expect parameters of a "~/* ~/.* -r" (or "-R" or "-s") type of variant to activate the "all files, in all directories from here" inspection...  ICBW. Best to check the man pages, though... (Also Mom's obviously got maximum rights for herself, or is drilling through su, as I'd expect.) [[Special:Contributions/178.98.31.27|178.98.31.27]] 08:30, 19 June 2013 (UTC)
 
It's the piping of "find ~" (all files in Mom's current login's home directory) and "find ~nomad" (all files in the home directory of user "nomad", presumably that's Elaine's account also on Mom's machine, having recently been on a 'life journey' of self-discovery and learning) through the shred command that is doing the directory recursion, as part of the "find" command's default behaviour (IIRC).  I've never used the shredding command myself, but I'd say that it's operating on the list given it by the "find", rather than doing the directory-burrowing itself, for which I'd expect parameters of a "~/* ~/.* -r" (or "-R" or "-s") type of variant to activate the "all files, in all directories from here" inspection...  ICBW. Best to check the man pages, though... (Also Mom's obviously got maximum rights for herself, or is drilling through su, as I'd expect.) [[Special:Contributions/178.98.31.27|178.98.31.27]] 08:30, 19 June 2013 (UTC)
 +
 +
:"find" is passed a variety of arguments - an argument that is not part of an optional parameter (i.e. -name \*.php would specify all files ending with ".php" - the backslash is used to prevent bash or another shell from expanding the parameter into a full list of .php files) is treated as a file or directory to begin searching. So "find ~" would begin searching in the user's own home directory; "find ~nomad" would begin the search in the home directory of the user "nomad". All file and directory names are sent to stdout (standard output).
 +
 +
:Piping the result requires the use of the | symbol (shift-backslash). It's used to pipe data from stdout to stdin (standard input).
 +
 +
:"xargs" is a Linux command that constructs command lines by reading a list of files from stdin and treating each with a command (and optional arguments) specified after "xargs".
 +
 +
:"shred" is a program that takes a filename as a parameter and overwrites the file repeatedly to keep the original contents, which can be discerned using increasingly-expensive hardware solutions, from being pieced together.
 +
 +
:With this in mind:
 +
 +
::find ~ | xargs shred
 +
 +
:1) finds all files (and directories) in the hierarchy of the user's home directory, and sends the list to stdout;
 +
:2) the list gets piped to "xargs", which
 +
:3) passes each file to "shred" for shredding.
 +
 +
:Issues regarding symbolic links, filtering directory names from the operation, and modifying the operating parameters of "shred" will be left to the aspiring sysadmin to discover for theirself. [[User:Thokling|Thokling]] ([[User talk:Thokling|talk]]) 13:42, 21 September 2013 (UTC)

Revision as of 13:42, 21 September 2013

It's the piping of "find ~" (all files in Mom's current login's home directory) and "find ~nomad" (all files in the home directory of user "nomad", presumably that's Elaine's account also on Mom's machine, having recently been on a 'life journey' of self-discovery and learning) through the shred command that is doing the directory recursion, as part of the "find" command's default behaviour (IIRC). I've never used the shredding command myself, but I'd say that it's operating on the list given it by the "find", rather than doing the directory-burrowing itself, for which I'd expect parameters of a "~/* ~/.* -r" (or "-R" or "-s") type of variant to activate the "all files, in all directories from here" inspection... ICBW. Best to check the man pages, though... (Also Mom's obviously got maximum rights for herself, or is drilling through su, as I'd expect.) 178.98.31.27 08:30, 19 June 2013 (UTC)

"find" is passed a variety of arguments - an argument that is not part of an optional parameter (i.e. -name \*.php would specify all files ending with ".php" - the backslash is used to prevent bash or another shell from expanding the parameter into a full list of .php files) is treated as a file or directory to begin searching. So "find ~" would begin searching in the user's own home directory; "find ~nomad" would begin the search in the home directory of the user "nomad". All file and directory names are sent to stdout (standard output).
Piping the result requires the use of the | symbol (shift-backslash). It's used to pipe data from stdout to stdin (standard input).
"xargs" is a Linux command that constructs command lines by reading a list of files from stdin and treating each with a command (and optional arguments) specified after "xargs".
"shred" is a program that takes a filename as a parameter and overwrites the file repeatedly to keep the original contents, which can be discerned using increasingly-expensive hardware solutions, from being pieced together.
With this in mind:
find ~ | xargs shred
1) finds all files (and directories) in the hierarchy of the user's home directory, and sends the list to stdout;
2) the list gets piped to "xargs", which
3) passes each file to "shred" for shredding.
Issues regarding symbolic links, filtering directory names from the operation, and modifying the operating parameters of "shred" will be left to the aspiring sysadmin to discover for theirself. Thokling (talk) 13:42, 21 September 2013 (UTC)