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

Use the command line to access files faster UNIX
The 'open' command from Terminal command line is like a double-click on an object, and sometimes it is much faster than using the Finder, at least for me. I've been a CLI user for decades and while I appreciate the GUI, many times it is too slow. Often the Finder requires far too many operations to get to the file or folder that I need to work on. Why 'Find' a location in the directory tree when I already know where it is?

Read the rest of this article for an interesting write-up on using the command line to improve the efficiency of the OS X GUI.

Since I typically already have a Terminal shell session already open, I have begun using 'open' as a shortcut. 'open ~' opens my Home folder. 'open /Applications/' launches the browser. Yes, of course, I could (and do) use the Dock for this kind of quick access, but consider my workfiles...

I am a writer with many dozens of stories, each in their own folder contained in a parent folder five levels deep. I can't overload the dock with a folder for each -- that way lies madness. I have put the parent folder in the Dock, but even then, click and scrolling takes time, especially since the folder's are numbered instead of named.
[Side note to other writers: Instead of trying to track and file all your work by titles which can often change on the fly, assign each an 'opus' number and file them that way.]
I put the following in my .cshrc:
set opus=/Users/hmelton/Henry/works/opus
Now all I have to do, if I know the number, is:
open $opus/0073
Since I have in each story folder a simple one-line text file named 'title' containing the title, I also created this little 'opname' shell-script:

grep -i $1 $opus/*/title|sed -e 's//title:.*//'
To open a folder containing the word Catacomb in the title, all I have to do is:
open `opname catacomb`
(note the backquotes) and up it comes.

The mix of CLI and GUI is my favorite environment, and I have been waiting for OSX since A/UX bit the dust.
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)

Use the command line to access files faster | 4 comments | Create New Account
Click here to return to the 'Use the command line to access files faster' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
2 other advantages
Authored by: saywake on Oct 09, '01 02:21:40PM
1) If you su to root, then you can open apps and docs AS root.
2) If you use "open -e filename" then the file is opened in TextEdit automatically.

Example: to quickly modify httpd.conf (requires root access), just do this:

open -e httpd.conf

[ Reply to This | # ]
2 other advantages - window error
Authored by: baba on Oct 09, '01 08:57:15PM

But how to deal with problem of the app already being open? I always get the following error when using 'open -a'
when the application is open:

kCGSErrorNoneAvailable : CGSReorderWindows: error retrieving current process

Also, has anyone figured out how to change the default application called with 'open -e' ?

[ Reply to This | # ]
Take full advantage of the Finder - it's faster!
Authored by: sjonke on Oct 09, '01 02:53:14PM
Rather than clicking and holding on a folder in the dock or using the command-line and this type of error-prone shortcut, a faster and easier way to do things (IMHO :) is to just set the folder's view options to "Keep Arranged By Name" (in the "View" menu choose "Show View Options..."). Now, just open the folder however you like. If you put it in the dock just click-and-release rather than holding to display the pop-up menu - you want to open the folder in the Finder, not pick from the pop-up menu. Then just type in the first 2 or 3 characters of the name and the Finder will select the file in the Finder with those initial letters. Press command-o (for "open") to open it. Use tab/shift-tab to move alphabetically forward/back if it doesn't select the right file due to more than one having the same starting letters. If you are way off and mistyped, just wait a second and then retype the letters correctly. Also, of course, you can use up/down/left/right as well, but that's less useful than tab and command-tab. You can use any view if you are running 10.1 (in 10.0.x only the Icon view works properly), but I find that Icon view works best for most situations - don't forget to set the Icon view options to Keep Arranged By Name. As a plus, if you are forced to use OS 9 (let us hope not) this technique will work the same there. If you have $20 to spend and are a bit savvy, I recommend LaunchBar which can do the same kind of thing globally (without need of the Finder.) Press command-space and LB pops to the top, type in a few letters of the name of the document and LB dynamically searches for the file(s) with that name. Press return to open (or up/down to scroll alphabetically). However, you will have to add your story folder(s) to its configuration ("Configuration" in LaunchBar's pop-up menu.) Indeed, if you only want to use it to open your stories you might want to remove all folders from its configuration except for your story folder(s). Also a tip for searching the content of your stories: if you add the folder containing your stories/folders to Sherlock it will index it quickly and then you can quickly search on the content of just your story folder(s) as opposed to your entire user folder or drive.

[ Reply to This | # ]
Sherlock sucks!
Authored by: semios on Oct 09, '01 04:59:09PM

My experience with sherlock so far is it's too slow, does too much, and you can't even stop the search once it starts. He'd be far better off doing a recursive grep than trying to use

[ Reply to This | # ]