[FM Discuss] Book idea: useful command lines
Jeffrey Osier-Mixon
jefro at jefro.net
Fri Oct 30 11:17:29 PDT 2009
Hi all
I suggest an FAQ format rather than a manual. I am much more often
asked "how do I do X" than "what does this command do". Subsequent
entries can build on previous ones.
Here is a lame example:
___________________________________________________________________
Q: Of the hundreds of random text files on my desktop, how can I
determine where I wrote down how to spell my new niece's name?
$ cd $HOME/Desktop; grep niece *
That didn't locate anything. I don't think I used the term "niece", but
my brother's name is George.
$ grep George *
Q: That didn't work either, and her first birthday is coming up! What
shall I do? What shall I do?
$ grep -i george * | grep -i daughter
to-do1234.txt: george's daughter's name is Ezmerelda
___________________________________________________________________
The trick is figuring out what people are going to want to do, and
presenting the items in a logical order rather than just a random list
of "how do I" entries. This example is about guessing what one's past
self might have used as a search term that the future self would
remember, but it might make sense to then follow up with better advice,
and then explain what is going on in the example.
___________________________________________________________________
Q: How am I going to remember her name and birthday in the future?
One method is for your computer to remind you. This example uses
<code>cron</code>, a daemon that runs in the background and performs
periodic tasks. First, create a temporary text file to hold the entry
(see "man 5 crontab" for details on cron entry syntax). The example
shows storing a message in a temporary file and then popping it up at
the appropriate time, in this case noon on November 15 of any year.
Then install the new entry by running the <code>crontab</code> command.
$ cat > new-cron
0 12 15 11 * 'cat "Ezmereldas birthday coming up on 12/1" > /tmp/foo ;
xmore -display :0 /tmp/foo ; rm /tmp/foo'
^D
$ crontab ./new-cron
Note that these commands create a new crontab entry file, erasing
previous entries. To add more entries, or to edit this one:
$ crontab -e
To list all of your cron entries:
$ crontab -l
___________________________________________________________________
I would further suggest that this valuable subject could be best covered
in a wiki rather than in a manual, so that readers can contribute by
asking questions that the authors won't have considered.
I hope this is useful!
adam hyde wrote:
> i think this project, and Micks summation of the tourists guide to the
> command line is cool...it might be interesting to send out emails asking
> for peoples one-liners...there would be a tonne of interesting one
> liners out there that i am sure people would like to contrib...formating
> a good email and sending (where appropriate) to some lists might yield
> interesting returns
>
> shall we create an empty manual for this? if so, what do we call it?
>
> adam
>
More information about the Discuss
mailing list