Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

ln unix command?

 
   Web Hosting and Web Master Forums (Home) -> Webmaster RSS
Next:  looking for a good 3rd party forum  
Author Message
blackcat2

External


Since: Jun 28, 2003
Posts: 585



(Msg. 1) Posted: Sun Apr 25, 2004 8:19 am
Post subject: ln unix command?
Archived from groups: alt>www>webmaster (more info?)

The reason I want to figure out exactly how to use this is that I am trying
to include a file in a .shtml document that is not in that documents
directory.

I have to do this 10 times and it would be really pointless to have to
upload
it 10 times(once to each of 10 directories) and then do it again if I edit
the
include.

I found this information(and many more like it) on the web that tells how to
do it but doesn't say 'where' to do it.

Ln command.
Instead of copying you can also make links to existing files using ln
command.
If you want to create a link to a file called coolfile in /usr/local/bin
directory then you can enter this command.
ln mycoolfile /usr/local/bin/coolfile

Some examples:
a.. ln -s fileone filetwo will create a symbolic link and can exist across
machines.
b.. ln -n option will not overwrite existing files.
c.. ln -f will force the link to occur.
if anyone can shed some light on the 'where' (i.e. the page I want the
include on, somewhere else? etc. ) part I would be most grateful. Wink


--
Heidi
Recommended Hosting: http://www.page-zone.com/
Put a.w.w. in subject if you email me or it might be trashed

 >> Stay informed about: ln unix command? 
Back to top
Login to vote
nospam62

External


Since: Apr 24, 2004
Posts: 86



(Msg. 2) Posted: Sun Apr 25, 2004 11:16 am
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Heidi <blackcat2.RemoveThis@zwallet.com> wrote:
 > Ln command.
 > Instead of copying you can also make links to existing files using ln
 > command.
 > If you want to create a link to a file called coolfile in /usr/local/bin
 > directory then you can enter this command.
 > ln mycoolfile /usr/local/bin/coolfile

Symbolic (and hard) links are a very useful UNIX tool, however you
really need to be careful not to get too carried away with them or it
becomes impossible to figure out which file your editing! Smile (symlinks
can turn into a rats nest in a hurry)

ln -s source destination

Where source is the real file, (or, GASP another symbolic link)
and destination is where you'd like to place the symbolic link.

Try to keep everything relative if at all possible, because if your ISP
ever changes your HOME directory to another location or you need to move
the whole tree you'll have a bunch of broken symbolic links that need
fixing.

Symlinks are handy for times when a copy would work, but you don't want
to have to update each copy every time the source file is edited, or
want to avoid differences in versions.

Probably more than you wanted to know, but...

You can also use hard links, which is rare (won't work across
partitions) but useful if you want to prevent a file from being deleted:

ln source destination

rm source

cat destination

If you've ever heard someone say "unlink a file" instead of "delete a
file", hard links sort of illustrate how file systems work, and why the
term "unlink" is actually more appropriate.

Jamie

--
<a style='text-decoration: underline;' href="http://www.geniegate.com" target="_blank">http://www.geniegate.com</a> Custom web programming
User Management Solutions Perl / PHP / Java / UNIX<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: ln unix command? 
Back to top
Login to vote
leo

External


Since: Nov 27, 2003
Posts: 33



(Msg. 3) Posted: Sun Apr 25, 2004 11:16 am
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <5tKic.27928$aQ6.1567741@attbi_s51>, nospam DeleteThis @geniegate.com wrote:

 > You can also use hard links, which is rare (won't work across
 > partitions) but useful if you want to prevent a file from being deleted:

It's also dangerous if you're not exactly sure what it means and want to
learn what fsck means in a "crash course" from what I've read. Do you
care to expound on it's benefits? If there weren't any, it wouldn't be
available. I'm afraid enough of it to use symlinks only. I don't get it's
use, even from the manpages. Duh on me. Scares me to death.

leo

--
<http://web0.greatbasin.net/~leo/><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
carl1

External


Since: Mar 30, 2004
Posts: 5



(Msg. 4) Posted: Sun Apr 25, 2004 2:20 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Leonard Blaisdell" <leo DeleteThis @greatbasin.com> wrote in message
news:leo-2504040211120001@leosmac.sparks.nv.us...
 > In article <5tKic.27928$aQ6.1567741@attbi_s51>, nospam DeleteThis @geniegate.com
wrote:
 >
  > > You can also use hard links, which is rare (won't work across
  > > partitions) but useful if you want to prevent a file from being deleted:
 >
 > It's also dangerous if you're not exactly sure what it means and want to
 > learn what fsck means in a "crash course" from what I've read. Do you
 > care to expound on it's benefits? If there weren't any, it wouldn't be
 > available. I'm afraid enough of it to use symlinks only. I don't get it's
 > use, even from the manpages. Duh on me. Scares me to death.
 >
a hard link is as much a file as any other file is. A hardlink basically
puts two entries in the index if you like, pointing at the same area of
data. A symbolic link is just a symbolic link and appears as such.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
tobyink

External


Since: Apr 25, 2004
Posts: 148



(Msg. 5) Posted: Sun Apr 25, 2004 2:52 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Sun, 25 Apr 2004 02:11:12 -0700, Leonard Blaisdell wrote:

 > It's also dangerous if you're not exactly sure what it means and want to
 > learn what fsck means in a "crash course" from what I've read. Do you
 > care to expound on it's benefits? If there weren't any, it wouldn't be
 > available. I'm afraid enough of it to use symlinks only.

Some programs behave differently when operating on symlinks than when they
were operating on the real file (e.g. cp, du, tar, Apache, various GUI
file managers, etc).

With hard links they *are* operating on the real file.

See also "mount --bind", "mount --rbind" and "mount --move".

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - <a style='text-decoration: underline;' href="http://www.goddamn.co.uk/tobyink/?page=132" target="_blank">http://www.goddamn.co.uk/tobyink/?page=132</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
shit

External


Since: Dec 19, 2003
Posts: 355



(Msg. 6) Posted: Sun Apr 25, 2004 7:01 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

in post: <news:LTHic.24010$NR5.12314@fe1.texas.rr.com>
"Heidi" <blackcat2 DeleteThis @zwallet.com> said:

 > The reason I want to figure out exactly how to use this is that I am trying
 > to include a file in a .shtml document that is not in that documents
 > directory.

<!--#include virtual="/blah/de/blah/blah.ext" -->

although i would use php. easy peasy

 > Ln command.

only worth doing if the file you want to include is outside your public
bits. do it in the same directory that has your sexy little .shtml file
with the include directive.

ln -s /absolute/path/to/the/real/location/of/the/file/blah.ext blah.ext


--
b r u c i e<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
blackcat2

External


Since: Jun 28, 2003
Posts: 585



(Msg. 7) Posted: Sun Apr 25, 2004 7:01 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Charging up on a white horse brucie said:
: <!--#include virtual="/blah/de/blah/blah.ext" -->

I have tried this but for some odd reason it didn't work.
I am using an HTML file for the include.

: although i would use php. easy peasy

How is that easier? It is after 1am so I am a little slower now LOL.

: : Ln command.
:
: only worth doing if the file you want to include is outside your
: public bits. do it in the same directory that has your sexy little .shtml
: file with the include directive.

No it is more like this
usr/home/domain/public_html/directory1/ is where the file I want included is
and
usr/home/domain/public_html/directory1/sub-directory/ is where the page
is that I want to have the include.

: ln -s /absolute/path/to/the/real/location/of/the/file/blah.ext
: blah.ext

I will try it again in a bit. Taking a break away from the PC for a short
time.
*reaches for Advil*

Thank you brucie, *hugs*

--
Heidi
Recommended Hosting: http://www.page-zone.com/
Put a.w.w. in subject if you email me or it might be trashed
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
leo

External


Since: Nov 27, 2003
Posts: 33



(Msg. 8) Posted: Sun Apr 25, 2004 7:01 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <zxIic.24016$NR5.17763@fe1.texas.rr.com>, "Heidi"
<blackcat2 DeleteThis @zwallet.com> wrote:

 > No it is more like this
 > usr/home/domain/public_html/directory1/ is where the file I want included is
 > and
 > usr/home/domain/public_html/directory1/sub-directory/ is where the page
 > is that I want to have the include.

"ln -s /usr/home/domain/public_html/directory1/sub-directory/file-you-want
/usr/home/domain/public_html/directory1" will link the file you want into
directory1. I'm doing this from memory. Don't be too brutal. I'm also
assuming that usr is a subdirectory of "/" which Heidi didn't indicate.
Maybe it's a Windows thing.

leo

--
<http://web0.greatbasin.net/~leo/><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
shit

External


Since: Dec 19, 2003
Posts: 355



(Msg. 9) Posted: Sun Apr 25, 2004 7:23 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

in post: <news:zxIic.24016$NR5.17763@fe1.texas.rr.com>
"Heidi" <blackcat2.TakeThisOut@zwallet.com> said:

 >: <!--#include virtual="/blah/de/blah/blah.ext" -->

 > I have tried this but for some odd reason it didn't work.

some hosts don't allow 'include virtual' but i haven't come across it
for years.

 >: although i would use php. easy peasy

 > How is that easier?

they're both easy peasy i would just use php because its rare for me to
do a page without some php in it.

eventually you'll probably want a bit of functionality that SSIs cant
give so you'll probably change to PHP and then you need to run around
replacing all your SSIs when if you did PHP in the first place you
wouldn't need to.

prior planning and preparation prevents piss poor performance.

 > It is after 1am so I am a little slower now LOL.

theres no need to tease, you know i haven't got a hope in hell of
catching you. i'm looking at 24hrs to fly there minimum.

 > No it is more like this
 > usr/home/domain/public_html/directory1/ is where the file I want included is
 > and
 > usr/home/domain/public_html/directory1/sub-directory/ is where the page
 > is that I want to have the include.

in the ...public_html/directory1/sub-directory/ directory:

ln -s usr/home/domain/public_html/directory1/blah.ext blah.ext

but if this is a page-zone account last time i tried setting up symlinks
it wouldn't work but i didn't try that hard, i was just playing.

 > I will try it again in a bit. Taking a break away from the PC for a short
 > time.

you could have left your webcam on.

 > *reaches for Advil*

advil is a total prick thats just using you for his sick little
perversions. you do know hes married don't you?

 > Thank you brucie, *hugs*

i'm not married.

--
b r u c i e<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
user58

External


Since: Apr 27, 2004
Posts: 204



(Msg. 10) Posted: Sun Apr 25, 2004 7:23 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

brucie thought about life and then said:
: eventually you'll probably want a bit of functionality that SSIs cant
: give so you'll probably change to PHP and then you need to run around
: replacing all your SSIs when if you did PHP in the first place you
: wouldn't need to.

Yup, that's what happened to me. All you have to do is this: instead of

<!--#include virtual="/blah/de/blah/blah.ext" -->

use

<?php include "blah/de/blah/blah.ext"; ?>

or

<?php include "./blah/de/blah/blah.ext"; ?>

I think I had problems with some browsers when I did it the first way, but I
don't remember now.

And make sure PHP is enabled, of course. Also you have use more dots and
slashes when the pages are in directories, but that's easy to do.

If I can use it, it has to be easy.

Lois
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
tobyink

External


Since: Apr 25, 2004
Posts: 148



(Msg. 11) Posted: Sun Apr 25, 2004 7:23 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Sun, 25 Apr 2004 16:23:05 +1000, brucie wrote:

 > in the ...public_html/directory1/sub-directory/ directory:
 >
 > ln -s usr/home/domain/public_html/directory1/blah.ext blah.ext

Or easier, in the same directory:

  ln -s ../blah.ext

The second argument for "ln" is optional -- it will default to creating a
file with the same name as the old file, but in the current directory.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - <a style='text-decoration: underline;' href="http://www.goddamn.co.uk/tobyink/?page=132" target="_blank">http://www.goddamn.co.uk/tobyink/?page=132</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
no_miranda_spa

External


Since: Apr 25, 2004
Posts: 77



(Msg. 12) Posted: Sun Apr 25, 2004 7:23 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Lois" <auto-newsgroups RemoveThis @wordsweave.com> wrote in message
news:n0Jic.5914$3m2.2782@fe03.usenetserver.com...
 > brucie thought about life and then said:
 > : eventually you'll probably want a bit of functionality that SSIs cant
 > : give so you'll probably change to PHP and then you need to run around
 > : replacing all your SSIs when if you did PHP in the first place you
 > : wouldn't need to.
 >
 > Yup, that's what happened to me. All you have to do is this: instead of
 >
 > <!--#include virtual="/blah/de/blah/blah.ext" -->
 >
 > use
 >
 > <?php include "blah/de/blah/blah.ext"; ?>
 >
 > or
 >
 > <?php include "./blah/de/blah/blah.ext"; ?>
 >
 > I think I had problems with some browsers when I did it the first way, but
I
 > don't remember now.
 >
 > And make sure PHP is enabled, of course. Also you have use more dots and
 > slashes when the pages are in directories, but that's easy to do.
 >
 > If I can use it, it has to be easy.
 >
 > Lois


Ehhhh? How could you have a problem with the browser. These are server side
command... the browser never sees any of this code....<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
blackcat2

External


Since: Jun 28, 2003
Posts: 585



(Msg. 13) Posted: Sun Apr 25, 2004 7:23 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Charging up on a white horse Lois said:
: Yup, that's what happened to me. All you have to do is this: instead
: of
:
: <!--#include virtual="/blah/de/blah/blah.ext" -->
:
: use
:
: <?php include "blah/de/blah/blah.ext"; ?>
: Lois

Yeah I normally use PHP but these pages are in shtml.
Well maybe I can convince a change *grin*

Even if I do get to make the change from shtml to PHP
I still want to tinker around with this ln unix command
a bit with some non-essential, not public files and see
what happens. Smile

--
Heidi
Recommended Hosting: http://www.page-zone.com/
Put a.w.w. in subject if you email me or it might be trashed
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
nospam62

External


Since: Apr 24, 2004
Posts: 86



(Msg. 14) Posted: Sun Apr 25, 2004 10:53 pm
Post subject: Re: ln unix command? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Leonard Blaisdell <leo.DeleteThis@greatbasin.com> wrote:
 > In article <5tKic.27928$aQ6.1567741@attbi_s51>, nospam.DeleteThis@geniegate.com wrote:
 > It's also dangerous if you're not exactly sure what it means and want to
 > learn what fsck means in a "crash course" from what I've read. Do you
 > care to expound on it's benefits? If there weren't any, it wouldn't be
 > available. I'm afraid enough of it to use symlinks only. I don't get it's
 > use, even from the manpages. Duh on me. Scares me to death.

symlinks should be the choice 90% of the time, sometimes I think hard
links are more-or-less a way of learning how filesystems work. Smile

Each filename is something akin to an entry in a table of numbers that
point to the physical area (on disc) where the data is stored.

Kind of like how DNS points the hostname to an IP number, the filesystem
points a filename to a number on the hard drive. (Because hard drives
really don't know about filenames, they only know sectors and cylinders)

A "hard link" is a bit like pointing 2 hostnames to the same IP.

Taking an entry out of DNS doesn't really delete the physical computer,
it just makes it difficult to find. If you had 2 (or more) hostnames
pointing to the same IP number, you could still access it through the
other hostname. Same is true for hardlinks, the url points to the "same
file" (or same host)

Even after all the hostnames are deleted, you can still access if by way
of IP number, this is kind of how files can be "undeleted". Until that
computer is re-allocated it's still available, it just doesn't have any
"links" pointing to it.

A "symbolic link" is kind of like a web page redirect. Usually works,
but not always. Less dangerous, but the browser (or kernel) has to open
the first url (symlink) read where it points to, go to the next url
(filename) and open it.

(well, in concept only, of course it's totally different, but they have
similiar implications.) You can actually store data *in* a symlink by
pointing it to a bogus filename if you wanted to. (the bogus filename is
the data to be stored) this can work nicely for storing PID's, lock
files, small bits of data and the like.

Jamie


--
<a style='text-decoration: underline;' href="http://www.geniegate.com" target="_blank">http://www.geniegate.com</a> Custom web programming
User Management Solutions Perl / PHP / Java / UNIX<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ln unix command? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
unix permissons - ...which CHMOD .htpasswd and .htaccess have to set 740 ot 770..can anycody suggest..thanx
   Web Hosting and Web Master Forums (Home) -> Webmaster All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]