Home > Linux > Note-Taking in the Terminal

Note-Taking in the Terminal

sticky_note_id_by_choujiswirlz
Given that the terminal is a productive environment and notes are productive objects, putting the two together can yield productive environment-objects…err, notes in the terminal.  The first day I got my Linux machine I set this handy tool up – since the notes are in a text file and you’re in terminal, you can use all sorts of text-related command-line tools to search your notes.

To begin, you’ll need to make a basic text file somewhere on your machine, preferably in the directory that your terminal opens to.  No need to figure out where that is exactly, simply open your terminal and create the file, i.e.

you@your-computer:~$ touch notes

Now you should see an empty file named “notes” in your home directory.

Here are 2 ways to write notes to the file.  The first way is easier if your note is small enough:

you@your-computer:~$ echo “this is a note” >> notes

Your note goes within the quotes, and at the end the text is appended to the end of the notes file.


BE CAREFUL!

Be sure to use the double arrows >> instead of a single arrow > or you will erase all your previous notes!

The >> means to append the text to the end, where the > means to replace the entire file with the text.


The second way is more interactive and is best used for entering multiple notes or long notes:

you@your-computer:~$ cat >> notes

This will move your cursor to the next line and wait for input.  Simply start typing the note – hitting Enter will move you to the next line.

  • To save and finish entering notes, hit Ctrl-d
  • To abort, hit Ctrl-c
  • To cut text from cursor to end of line, hit Ctrl-k
  • To paste text at cursor, hit Ctrl-y

It’s a good idea to pre-pend each note with a topic/category/tag name so they’re easy to find with grep.  For example, say you’re entering some notes on terminal keystrokes, then your notes would look like:

terminal keystrokes: Ctrl-d to finish

terminal keystrokes: Ctrl-c to abort

Now to find all of your notes on keystrokes:

you@your-computer:~$ cat notes | grep keystrokes

And the output would be:

terminal keystrokes: Ctrl-d to finish

terminal keystrokes: Ctrl-c to abort


Now remember to use those productive environment-objects!

Got a better way to take notes with the terminal?  Share it in a comment.

Advertisements
Categories: Linux Tags: , ,
  1. February 8, 2010 at 8:55 am

    OP: I could be slow (lord knows I have been told lol) but that made totally no sense…

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: