LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 08-24-2004, 04:54 PM   #1
zwyrbla
Member
 
Registered: Aug 2004
Location: MA
Distribution: Slack 10.1
Posts: 107

Rep: Reputation: 15
how do I copy a whoel folder form one directory to another form the command line?


HI im trying to learn how to use the command line in linux and right now im trying to install firefox to the /usr/local directory. Basicaly what im trying to do is copy the folder firefox from /home/me to /usr/local then run the install file in firefox once it is copies over and i want to do all this from the command line with root privelages instead of having to logout of x as user then login to x as root. Thanks,
 
Old 08-24-2004, 05:01 PM   #2
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 54
Try man cp from the command line,not sure why you want to copy it there but Its up to you?
 
Old 08-24-2004, 05:07 PM   #3
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
I'm not sure if you can copy a folder and execute an installation in one command line but you can try to tar the folder and then 'untar' it in the new location. This will keep the folder hierarchy intact.

From within the Firefox directory issue the following command:

tar cf - . | (cd /usr/local; tar xvf -)

This will copy the Firefox folder hierarchy to the new location intact. I got that one from my Running Linux 4th Edition book.
 
Old 08-24-2004, 05:24 PM   #4
mugstar
Member
 
Registered: Jun 2004
Location: Scotland
Distribution: Anything that'll install...
Posts: 305

Rep: Reputation: 30
Quote:
Originally posted by aznluvsmc
[B]I'm not sure if you can copy a folder and execute an installation in one command line
You can string commands together in two ways:

- typing a semicolon ( ; ) between commands will execute the next command no matter what the outcome of the first

- typing two ampersands ( && ) will execute the second command _only_ if the first executed with no errors.
 
Old 08-24-2004, 05:44 PM   #5
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
Ok, so then will this command tar the directory, then untar it in the proper location and execute Firefox afterwards?

tar cf - . | (cd /usr/local; tar xvf - && firefox/firefox)

I used the && to ensure that it will only try to run firefox if the untar succeeds. I think my path specification is right with firefox/firefox to inform the shell where the executable file is located in case the actual path is not part of $PATH.
 
Old 08-24-2004, 06:02 PM   #6
Khabi
Member
 
Registered: Aug 2003
Location: Arizona
Distribution: Gentoo
Posts: 142

Rep: Reputation: 15
cp -R [from dirctory] [to directory]
 
Old 08-24-2004, 06:08 PM   #7
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
I tend to use cp -a but it depends on how you wish to handle links and how links might be set up in the directory you are copying...
 
Old 08-24-2004, 06:17 PM   #8
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Erm, normally the make install command copies the compiled stuff into it's system-wide location at eg /usr/local, so putting the files there to start with and after you've compiled them with that directory free might not be the best move. What's telling you to move the files there? Why not just make install them?
 
Old 08-24-2004, 06:40 PM   #9
mugstar
Member
 
Registered: Jun 2004
Location: Scotland
Distribution: Anything that'll install...
Posts: 305

Rep: Reputation: 30
Because the firefox installer by default installs to the current working directory. Although I believe you could pass /usr/local as an argument to the installer, as an alternative to moving everything manually. You would still need to be root to have write access to /usr/local.

Why not do `su -` and do it the long way? Still saves you from logging in and out...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
my database export shell script run from command line but not form crontab saifee Linux - General 11 01-29-2012 09:24 AM
To call a new form from Current form in QT Desginer kiranbud Linux - Software 0 11-25-2005 11:56 PM
shell script works form command line but not form crontab saifee General 1 10-14-2004 10:27 AM
instant message form command line jonfa Linux - General 4 03-10-2004 09:45 PM
I want Linux source code for FAT file system in user readable form not in binary form ramya272 Linux - Newbie 5 02-05-2004 07:54 PM


All times are GMT -5. The time now is 01:55 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration