Saturday 28 May 2011

Don't accidentally open huge text files from the Command Line

In my line of work, I frequently deal with very very large text files, gigs in size. Every once in awhile, I inadvertently open such a file using the open -e command from the command line to view it in TextEdit (without checking the file size first).

Whenever I do this, my system crawls to a halt as TextEdit's virtual memory size bloats and the swap space goes crazy with page swaps. It takes minutes for me to go around saving open files before I can force-quit TextEdit. Here's a way I've found that can avoid these headache-inducing periods of no work getting done.

This hint, unfortunately, only works if you happen to (like me) use the C shell as your shell of preference, because there's no way of referencing arguments in a bash alias. Perhaps someone can post a bash equivalent in the comments. Also, there are many valid reasons to avoid aliasing actual commands (though I do so all the time without any problem) so you may want to change the alias name to s ...

Add to digg Add to Reddit Add to Slashdot Email this Article Add to StumbleUpon

Source: http://feeds.macosxhints.com/click.phdo?i=91f7044eac3abbab2912fea655b08fe8

macworld expo mac genius bar macintosh apple store uk

No comments:

Post a Comment