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

Differences in aliases and symbolic links in 10.2 UNIX
I use the UNIX underpinnings extensively and I use the Finder a lot to do development. Based on earlier Mac OS X Hints about not moving any Apple installed Folders or Apps, I have tried to organize things a little more efficiently.

I started by moving to /Applications in the Finder and created aliases to several places. The Utilities directory is too far down to be helpful if you have a lot of apps, so I made an alias (option-cmd) to Utilities and renamed the alias "1Utilities".

Oddity #1 - Unix does not know about what a Finder alias is supposed to behave like.
  1. In the Finder make a folder called TEST
  2. Select the folder and make an alias (cmd-L) creating "TEST alias".
  3. In the Terminal, look at the file listing:
    bash2.05a lfk@localhost ~ % ls -ld TEST*
    drwxr-xr-x 2 lfk staff 68 Sep 10 12:32 TEST
    -rw-r--r-- 1 lfk staff 0 Sep 10 12:32 TEST alias
    bash2.05a % cd TEST ;
    bash2.05a TEST % cd ../TEST\ alias
    bash: cd: ../TEST alias: Not a directory
How can we fix this? Use UNIX symbolic links (read the man pages for symlinks(7) and ln(1).
  1. In the Finder drag "TEST alias" to the Trash
  2. In the Terminal create a symlink to TEST (note you cannot hard link directories (Folders)
  3. Check the behavior of the Symlink
    bash2.05a % ln -s TEST "TEST alias"
    bash2.05a % ls -ld TEST*
    drwxr-xr-x 2 lfk staff 68 Sep 10 12:32 TEST
    lrwxr-xr-x 1 lfk staff 4 Sep 10 12:45 TEST alias -> TEST
    bash2.05a % cd TEST
    bash2.05a TEST % cd ../TEST\ alias
    bash2.05a TEST alias %
    All is fine with the world.
Oddity #2 - The Finder does not always know what a symlink is supposed to behave like. In Linux, a symlink to a directory almost always behaves like a directory as it does in the Terminal in OS X. But in the Finder, we have some strangeness (twice).
  1. In the Finder in column mode look at "TEST alias" and TEST. They are both there, "TEST alias" looks like a Finder-type alias, and it has an arrow allowing you to move into the Folder.
  2. Switch to the list mode, TEST has an arrow allowing the Folder to toggled open, but "TEST alias", just like Finder aliases, does not.
  3. In the Icon mode it looks like an alias to a Folder.
  4. If you drag a file into "TEST alias", when it automatically opens up, the target is TEST (not like unix where it is "TEST alias"
So, I can't have the same behavior in both worlds, but links are better, so this is how I have setup my Applications folder links:
bash2.05a /Applications % ls -ld * | head -6
lrwxrwxr-x 1 root admin 23 Sep 10 11:37 1Utilities -> /Applications/Utilities
drwxrwxr-x 18 root admin 612 Sep 10 11:37 2NonA_Utilities
drwxrwxr-x 9 root admin 306 Aug 20 11:03 3CocoaUnix
lrwxrwxr-x 1 root admin 3 Sep 10 11:37 4Fink -> /sw
lrwxrwxr-x 1 root admin 10 Sep 10 11:37 5UsrLocal -> /usr/local
drwxrwxr-x 4 root admin 136 Aug 28 22:53 Acrobat Reader 5.0
P.S. While writing this hint, I noticed the following non-UNIX (but good behavior in the shell - bash). I use completion (TAB) a lot, but with all the spaces in names, it is not as helpful. But if you type a double-quote and then TAB, the shell will complete the filename including spaces, and put a second double-quote at the end. Cool! I don't remember this working like this in 10.1.5.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[8,063 views]  

Differences in aliases and symbolic links in 10.2 | 3 comments | Create New Account
Click here to return to the 'Differences in aliases and symbolic links in 10.2' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
command completion
Authored by: juanfc on Sep 17, '02 03:14:48PM

command completion did work with "quotes - and has some other options that you can find in the corresponding man manuals (tclsh, at least explain it in detail). That is independent of Mac OS versions...

But the problem that Apple should address IMHO is the one that concerns non ascii chars, that are seem as double non-understandable bytes in the shell and making then unusable items with, before X where so usual...



[ Reply to This | # ]
command completion
Authored by: ngb on Sep 19, '02 08:55:22PM

Add this to your .cshrc for improved TAB completion.

bindkey "^I" complete-word-fwd

Hitting tab completes the first possible option. Hitting tab repeatedly cycles through all possible completion options. So, if your directory contains

aplomb
apomatox
apple

typing "ap" and hitting tab will give you "aplomb" hitting tab again will give you "apomatox" and so on.



[ Reply to This | # ]
Forgot to mention
Authored by: ngb on Sep 19, '02 08:58:31PM

The method mentioned above eliminates the need to use quotes for filenames with spaces or to preface spaces with "\", as the command completion takes care of inserting the blackslash escape character.



[ Reply to This | # ]