|
#1
| ||||
| ||||
| How to make Symbolic Links
How would one go about making a Symbolic Link? Thanks |
|
#2
| ||||
| ||||
|
Here's an example. vi is in /usr/bin/vi . You want a sym link to point to it from the same directory called vii. While in /usr/bin, you would type: ln -s vi vii You could specify absolute pathnames as well, so if you wanted a sym link called 'vi' in /usr/local/bin pointing to /usr/bin/vi , if you were in /usr/local/bin, you could type: ln -s /usr/bin/vi vi Does this make sense? |
|
#3
| |||
| |||
|
Yes, what 'ln' basically does is to write arg1 into a file called arg2 and flag the latter as a symbolic link. Yet, by reading your post, I stumbled across some odds in MacOSX. I wanted to display the symbolic link as such, but not the file it is linked to. I know I was doing that somehow a whole while ago (not on MacOSX) and now I can't remember. I tried a lot... I pentrated cat, od, file; I messed with the "symlinks" option in tcsh. I tried to acces the file through its inode: find ./ -inum 374355 -exec cat "{}" \; But whatever I do, the system will always follow the symbolic link. HRRFF! The same for directories, MacOSX will not allow to dump a directory to stdout using "od -c" for example. Whatever I do here, it keeps saying ".. is a directory". The third question: Is any command line method known to you that flags a file as a symbolic link? Thanks a lot! |
|
#4
| ||||
| ||||
|
Eckhart's description of what ln does is not actually correct. The way that a symbolic link is recorded in the file system is dependent on that filesystem. You are assuming an implementation which does not correspond to what is done in HFS+. Now on my old AT&T 3B1 I could do what you describe but that would not work on many newer file systems because the representation of the directory is more complex. For instance some file systems directly record the symbolic link in the directory structure itself. Finally, the assumption that there is actually a "directory listing file" does not hold for all file systems. The implementation you are describing in particular does not handle accessing long absolute paths well. Each path component has to be looked up in each directory along the way by a linear search which is basically a O(n*m) operation where n is the number of path components and m is 1/2 the average number of files in a directory. In comparison OS/@'s old HPFS file system used a balanced B-tree so such a search would take O(log(total files)) time (IIRC). The latter case has much better performance characteristics but therein directories are not explicitly stored, they are built on the fly from the individual entries. (Another neat thing if you have ever used zsh doing wild-inferiors was just as cheap as globbing. That is /foo/*.c was a fast as /**/foo.c which normally under unix requires a call to find to compute.) -Eric
__________________ Wenn ist das Nunstruck git und Slotermeyer? Ja!... Beiherhund das Oder die Flipperwaldt gersput! |
|
#5
| ||||
| ||||
| Quote:
Quote:
Quote:
Quote:
-- Is now anyone here, who can answer my actual questions? Thanks again! |
|
#6
| ||||
| ||||
|
The easiest way to create a symbolic link I know of is to download & install Cocktail, click on Files and the Links tab, and drag a file onto the button with the terminal alias on it.
__________________ System: • 2.5 GHz MacBook Pro Core 2 Duo, 4 GB RAM, 200 GB hard drive, runs 10.5.6 • 1.6 GHz iMac G5, 1.5 GB RAM, 250 GB hard drive, runs 10.4.11 (slightly out of commission at this time) • iPhone, 4 GB, OS X 2.2.1 |
|
#7
| |||||
| |||||
| Quote:
Quote:
The real moral of this is that with all the different implementations of this stuff over the ages for almost any cockamamy way you can come up with doing something somebody did it. Quote:
I honestly just don't know what HFS+ does I haven't had reason to look it up. Quote:
Quote:
On a side note if I can write a directory via cat like you could in the old old days that also means that I can own the box. All I have to do is copy a shell into a directory, make it setuid me and then edit the directory file to change that little uid to root's. Now I am root and on my merry way. Note to moderators that is not really a description of how to hack a box as it would not work on any modern computer. So what are you really trying to do? Just make a symbolic link, that was already answered. Convert a normal file into a symlink using its contents as a target via some backdoor way? -Eric |
|
#8
| |||
| |||
|
Without bringing it up at large, my questions were: 1. How do I make the system (in whatsoever way - and regardless to all the implementations over the ages it is not working on) to stop following symbolic links? 2. Is any "hack" known to somebody how I can dump a directory to stdout? As it was once possible -and not only one system- with "od -c". Ok, and most about your point was basically that we cannot find a patent remedy due to all these different implementations and filesystems... -- which is an euphemism for "NO" to both questions. Well, anyways I didn't want to bother, if the answer doesn't come handy, I did not want to start a major thread. It was just the idea that somebody would know. |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems with Apache, symbolic links and permissions | Kinniken | Unix & X11 | 2 | August 31st, 2003 07:10 AM |
| symbolic links via web | macidiot | Design & Media | 0 | January 29th, 2003 05:05 PM |
| How to compile stuff | fintler | Unix & X11 | 1 | August 28th, 2002 07:57 AM |
| Apache config Q / symbolic links Q | andypeter | Mac OS X System & Mac Software | 2 | April 18th, 2001 01:33 PM |