[Techtalk] New to the list...new to linux

Kai MacTane kmactane at GothPunk.com
Sat Sep 29 19:00:29 EST 2001


At 9/29/01 06:08 PM , Tianna Thomas wrote:
>Ok, I think I got it but I've got one minor detail to clear up.  Where do I
>need to be in the tree?  Let me explain it like this.
>
>I need to copy the contents of (sub-dirs and everything)
>
>/hsphere/local/home/cpanel/shiva/shiva-templates
>to
>/hsphere/local/home/cpanel/shiva/custom-templates
>
>so that I can access and work with the files without affecting the live
>application.  Should I execute the command from the SHIVA or from within the
>SHIVA-TEMPLATES dir?

If you're copying rather than moving, you can do it from either place. 
However, it will be easier to explain and understand if you do it from the 
/hsphere/local/home/cpanel/shiva directory. Then the command is simply:

    cp -a shiva-templates custom-templates

You can include a trailing slash on shiva-templates/ or not, as you choose; 
in this case, it shouldn't make any difference.

You can quit reading now and run that command, if you just want to get 
things done. Or, if you want to really understand some stuff about the Unix 
file structure, read on...

If you want to run the command from the shiva-templates directory, the easy 
way to do it is:

    cp -a . ../custom-templates

This is because every Unix (including Linux) directory contains at least 
two entries, which you don't see in ls unless you throw the -a switch. 
Those entries are . and ..; . represents the current directory, while .. 
represents the parent directory. So, if you're in 
/hsphere/local/home/cpanel/shiva/shiva-templates, you can type "cd ..", and 
you'll be in /hsphere/local/home/cpanel/shiva/ . Another cd .. will bring 
you up to /hsphere/local/home/cpanel/ -- or, you could have gotten there in 
one shot by typing cd ../.. and executing that.

cd . is a perfectly legitimate command, too, although it's also a pretty 
useless one. For that matter, ls .. will show you the contents of the 
parent directory. I think you get the idea by now.

Finally, I should explain why I said "If you're copying rather than moving, 
you can do it from either place." What would be different if you were 
moving the directory? Simple: then you couldn't do it from within the 
directory, because once you'd moved it, your CWD (current working 
directory) would no longer exist. I *think* that mv would give you an error 
if you tried it, but I haven't checked.

>I appreciate all the detailed help.  This is worse than trying to learn a
>new programming language alone.

It's a fairly big project, I'll agree. When I was learning Unix, I had the 
advantage of previous DOS experience. This not only meant I had experience 
with a language that had been based on Unix; it also meant that I had 
experience with a command-line interface, which I think was actually much 
more important. If all you're used to is GUIs, the command-line way of 
thinking will take some time to get used to.

                                                 --Kai MacTane
----------------------------------------------------------------------
"Lucretia, my reflection, dance the ghost with me."
                                                 --Sisters of Mercy,
                                                  "Lucretia, My
                                                   Reflection"






More information about the Techtalk mailing list