Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A simple method of note taking in the Terminal UNIX
For those that (like me) always have a Terminal open anyway, and that are looking for an easy way to make notes, try this alias:
 alias note 'date >> ~/unix/notes.txt; tee -a ~/unix/notes.txt > /dev/null' 
This alias appends date and time information to the file described, and then appends everything you type in the terminal until you stop with Control-C. The tee command actually forks input to a file and to standard output; we don't need the latter, so we send it into oblivion. Obviously, you can have several of those writing to different files. To me, this is easier than opening a text editor.
    •    
  • Currently 2.40 / 5
  You rated: 2 / 5 (5 votes cast)
 
[8,222 views]  

A simple method of note taking in the Terminal | 13 comments | Create New Account
Click here to return to the 'A simple method of note taking in the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Another way, which avoids 'tee'
Authored by: sharumpe on May 01, '03 11:22:19AM
alias note "date >> /tmp/notes.txt; cat >> /tmp/notes.txt"

Does the same thing, but without the unnecessary second copy sent to /dev/null.

Mr. Sharumpe



[ Reply to This | # ]
Another way, which avoids 'tee'
Authored by: ospfguru on May 01, '03 08:44:32PM

I have tried this command as shown and it does not appear to
be working, terminal accept either of the two solutions presented
here but neither is working. Might I be doing something wrong? I
tried as a normal user and root.

alias note 'date >> ~/users/topkick/ssh.txt; tee -a ~/users/
topkick/ssh.txt > /dev/null'

alias note "date >> /tmp/notes.txt; cat >> /tmp/notes.txt"

---
Always do Right - This will gratify some people and astonish others ~ Mark Twain



[ Reply to This | # ]
Another way, which avoids 'tee'
Authored by: pink on May 02, '03 06:36:12AM

I suppose the following:
- the folder you are writing to does exist
- permissions are ok
- you restarted Terminal.app after introducing the aliases

if so, try writing the code as one line into /usr/share/tcsh/examples/aliases
and try again.
HTH, pink



[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: terceiro on May 01, '03 11:53:26AM

Either way, this rocks. Very, very useful, since I have terminal
open all the time, and don't always like to switch to Stickies (or
whatever) to jot something down.



[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: bluehz on May 01, '03 12:05:35PM

This is a great tip, but is their anyway to control the
keymapping. For example - there is no way to backspace...



[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: tandemrepeat on May 01, '03 12:19:25PM

Set the Delete key to Del via the VT menu (control key + left
click on an xterm window) - this lets me delete text using del
rather than backspace. Also, make sure you hit return after
typing any text and before Ctl-C'ing out otherwise you lose the
text...



[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: osxpounder on May 01, '03 03:36:37PM

For those of us accustomed to remembering such restrictions in conjunction with Unix terminals, this tip could be handy, but I'd never bother remembering the minutiae. That's why I find it handier to go to the Services menu and choose "TextEdit --> Open File", even if there is no file I want opened. TextEdit merely complains, but it does so after opening up a nice, blank text file for me to type in. Easy: one menu, one more menu, one item, and one click later I've got a text editor on screen.

---
--
osxpounder



[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: bluehz on May 01, '03 05:46:47PM

That sounds good and all - but I don't really want to keep
XDarwin/X11 running simply to use the terminal (xterm). Just
seems a little too much for running a terminal, and especially
since copy/pasting between OSX/X11 is anything but tenuous...
yes I know there are key+cmds, but for me they never seem to
work (prob because I run X11 with Blackbox instead of quartz-
wm).



[ Reply to This | # ]
Better than Cntl-c
Authored by: mj on May 01, '03 06:07:31PM

If you use Cntl-D instead, you won't risk forgetting to terminate the last line.



[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: exu on May 01, '03 05:49:16PM

how do i get this so it remembers the alias. if i quit terminal or
open a new terminal window i have to reissue

alias note "date >> /tmp/notes.txt; cat >> /tmp/notes.txt"

i just want it to remember!

thanks



[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: mj on May 01, '03 06:14:35PM

Aliases defined in ~/Library/init/tcsh/aliases.mine are defined when you start new terms if you use tcsh. It uses the normal syntax for aliases. I use zsh, so I have aliases in ~/.zshrc .



[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: ncianca on May 02, '03 02:42:56AM
Here is another variation. This one will work save your note up until you hit the return key. You can also edit the line(s) using cursor keys or binded keys (ctrl-a, ctrl-d, etc) . I've also added a timestamp format in the form of YYYY- MM-DD HH:MM. Each entry would appear after the time stamp. Very useful for short things, like urls, etc. The ${1} variable tell's echo to take the keyboard input of anything you type after the alias name of note, as in

% note this is a note[RETURN]
Keep in mind that you can make some pretty long notes this way.

alias note "echo `date +'%Y%m%d %H:%M - '` ${1} >> /tmp/notes.txt"


[ Reply to This | # ]
A simple method of note taking in the Terminal
Authored by: bluehz on May 06, '03 12:26:09PM

This has become for me a roundabout method of copy/paste
between Aqua and X11. I use Apple X11 but not Quartz-qm,
instead I prefer Blackbox. Something is broken in Apple's X11
that it will not copy/paste between Aqua and Apple X11 if you
are not using Quartz-qm (and yes I know the special key cmds).
So what I have done is setup this "notes" cmd then in X11, I
just open an XTerm and tail -f ~/Documents/notes.txt. Now if I
want to copy something to X11 - I just "note" it and then switch
to X11 and there it is available for paste....



[ Reply to This | # ]