-
Notifications
You must be signed in to change notification settings - Fork 0
lcd Command Help
lcd <some_string>
Searches in the locate database for a directory which starts with the string <some_string>. If there is only a single file found, you will immediately be switched to that directory. If there are more than one directory found, you will receive a list of matching directories and you can choose one.
Note that lcd supports the autocompletion functionality in bash. Just use the tab key to complete a word you are typing. This will invoke find on the entire directory tree under your current word, so use it wisely.
This command works great on machines where the locate database is updated frequently. If you are unfamiliar with it, the locate database is often found at /var/db/locate.database. Some sysadmins turn this database off, making it useless for this command.
The locate database is usually updated on something like an hourly cycle. If your directory was created more recently than that, this command will not be able to see it. Also, if a directory was deleted since then, this command may erroneously try to change to a directory which is not around anymore.
Finally, OS X users should skip right on over the mcd instead. The locate database is not updated by default on OS X machines, but the mdfind database is -- it is a faster and superior choice for os x boxes.
/Users/mflower$ lcd man3
Please choose a directory to change to
--------------------------------------
1. /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/usr/share/man/man3
2. /Developer/usr/X11/share/man/man3
3. /Developer/usr/share/man/man3
4. /opt/local/share/man/man3
5. /opt/local/share/man/man3p
6. /opt/subversion/man/man3
7. /opt/subversion_backup.09192012155729/man/man3
8. /usr/X11/share/man/man3
9. /usr/share/man/man3
Your choice: