LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
  Search this Thread
Old 04-23-2010, 08:34 PM   #1
seflyer
Member
 
Registered: Apr 2010
Distribution: Slackware32-13.37
Posts: 58

Rep: Reputation: 16
what can I do if I forgot adding '-C' option when extracting files?


I describe what happened:
I tried to install gfortran on my computer. When I extract the tarball, I forgot the '-C' option of the command 'tar', which should be added, according to the instruction of installation. That is to say, I wrote in the \tmp directory:

$tar -zxvf gfortran.tar.gz

which should be:

$tar -zxvf gfortran.tar.gz -C /

Then, the tarball creates a '/usr' directory under '/tmp' directory, and it contains only a /local directory, which contains only a /gfortran directory.
The thing is, when I modify the name of this directory, for example, from /usr to /usr-modi, I found that the name of the directory /usr under the root directory is also changed from /usr to /usr-modi.

How can I delete this annoying /usr directory under /tmp, without tragically affect /usr under the root directory? Any idea?
Thanks!

Last edited by seflyer; 04-23-2010 at 08:35 PM.
 
Old 04-23-2010, 09:48 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
You need to be aware of the difference between relative and absolute paths... a directory with a leading '/' is an absolute path

'/usr' means the 'usr' directory under '/' (the root)
'usr' means the 'usr' directory in your current directory

To modify the 'usr' directory under '/tmp', it's absolute path is '/tmp/usr'

eg.
$ pwd
/home/me
$ mv /tmp/usr /tmp/usr-modi
$ ls /tmp
usr-modi


If your current directory was '/tmp' then you could also refer to it by the relative path 'usr' or './usr'

eg.
$ pwd
/tmp
$ ls
usr
$ mv usr usr-modi

To fix your current problem, try these steps:

$ mv /usr-modi /usr
$ cd /tmp
$ tar -zxvf gfortran.tar.gz -C /

hth
 
1 members found this post helpful.
Old 04-24-2010, 09:36 AM   #3
seflyer
Member
 
Registered: Apr 2010
Distribution: Slackware32-13.37
Posts: 58

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by kbp View Post
You need to be aware of the difference between relative and absolute paths... a directory with a leading '/' is an absolute path

'/usr' means the 'usr' directory under '/' (the root)
'usr' means the 'usr' directory in your current directory

To modify the 'usr' directory under '/tmp', it's absolute path is '/tmp/usr'

eg.
$ pwd
/home/me
$ mv /tmp/usr /tmp/usr-modi
$ ls /tmp
usr-modi


If your current directory was '/tmp' then you could also refer to it by the relative path 'usr' or './usr'

eg.
$ pwd
/tmp
$ ls
usr
$ mv usr usr-modi

To fix your current problem, try these steps:

$ mv /usr-modi /usr
$ cd /tmp
$ tar -zxvf gfortran.tar.gz -C /

hth
Thanks! But I guess I didn't explain clearly.
In fact, when I said I try to modify the name of the directory '/usr', I did mean that I modified the one under /tmp.
So the problem is that, when I input:

#mv /tmp/usr /tmp/usr-modi

then, not only '/usr' under /tmp changed its name, '/usr' under the root directory also did.
It seems that the misused 'tar -zxvf gfortran.tar.gz' has constructed a connection between these two '\usr' directories. I want to delete the one under \tmp, but I am afraid I would delete the one under \root at the same time...

Last edited by seflyer; 04-24-2010 at 01:46 PM.
 
Old 04-24-2010, 01:48 PM   #4
seflyer
Member
 
Registered: Apr 2010
Distribution: Slackware32-13.37
Posts: 58

Original Poster
Rep: Reputation: 16
Now the problem disappears! I guess, after all, I made a mistake pointed out above by kbp without knowing it. Thanks again!
 
Old 04-25-2010, 10:34 AM   #5
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
If you could post the output of:

'ls -l /tmp/u*'

and

'ls -l /usr*'
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
extracting a beta Kernel rpm and adding to it Shadowmeph Linux - General 1 09-26-2008 01:42 PM
Extracting all files willz06jw Linux From Scratch 3 09-11-2008 01:26 AM
extracting .gz files MACSRULE Linux - Newbie 2 04-13-2004 07:16 PM
Extracting files BriceM Linux - General 3 08-15-2003 04:00 PM
extracting files jester_69 Linux - General 5 05-20-2002 12:21 AM


All times are GMT -5. The time now is 06:44 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration