LinuxQuestions.org
Register a domain and help support LQ
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 02-06-2008, 07:53 AM   #1
babu198649
Member
 
Registered: Oct 2007
Posts: 160

Rep: Reputation: 30
uninstalling all files which have been installed using tar xjf


hi
i have downloaded a binary tar file and installed it by giving command shown below(which is told in the manual)

[root@localhost /]# tar xjf sourceryvsipl++-1.3-linux-x86.tar.bz2



now how to uninstall this package
 
Old 02-06-2008, 08:14 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
tar xjf does not "install' anything. It simply de-compresses and unpacks the archive. After running it, there should be a folder with the same or similar name. simply delete that folder and its contents.
 
Old 02-06-2008, 08:17 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
You can list the contents of the tarball with "tar --list -jf sourceryvsipl++-1.3-linux-x86.tar.bz2"
Consider piping the output to "less" and examining the contents. Make sure that none of the files look like something that you need to keep. Look at how the directories are listed. If they don't begin with a slash, then you need to cd to '/' before removing the files.

You can pipe the output of the listing to xargs to delete the files in the list. However, if any of the filenames contain spaces or other special characters, it would be better to use the NULL character as the line separator in xargs.

Code:
tar --list -jf  sourceryvsipl++-1.3-linux-x86.tar.bz2 | tr '\n' '\000' | xargs -0 rm -v
It would probably have been better if you used /usr/local/ as the base of the installation as per the installation instructions. That is the proper place to install non-distro packages, and you are also guaranteed that the distro won't touch these files.

Sometimes if there is a large number of files in various locations, using /opt/ is a good choice. For example, You might use /opt/kde4/ if you were to install kde4 from source.
 
Old 02-06-2008, 08:22 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Quote:
Originally Posted by pixellany View Post
tar xjf does not "install' anything. It simply de-compresses and unpacks the archive. After running it, there should be a folder with the same or similar name. simply delete that folder and its contents.
I searched on the web and looked in the quick start guide.
Code:
`-- usr
    `-- local
        |-- include
        |   `-- vsip                 // Sourcery VSIPL++ Headers
        |   `-- vsip_csl             // CodeSourcery extensions.
        |-- lib
        |   |-- [arch]               // Arch specific library files
        |   |   `-- [variant]      // Variant specific library files
        |   |        `-- pkgconfig // Variant specific pkg-config
        |   `-- pkgconfig            // Pkg-config links for all variants.
        `-- share                    // Documentation and user files
            |-- doc
            |   `-- sourceryvsipl++
            |        |-- quickstart // Quickstart (this document)
            |        |-- reference    // Interactive API documentation
            |        `-- tutorial     // Tutorial and Reference manual.
            `-- sourceryvsipl++
There are libraries that would be extracted into /usr/local/lib/. The others in /usr/local/include/{vsip,vsip_csl} and /usr/local/share/sourcerysipl++ could be deleted easily, if the file locations in the quickguide are correct.
 
Old 02-06-2008, 08:47 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Are you saying that tar -x unpacks an archive and puts files into the various directories? I've never seen this. What is the mechanism?
 
Old 02-06-2008, 08:49 AM   #6
babu198649
Member
 
Registered: Oct 2007
Posts: 160

Original Poster
Rep: Reputation: 30
thank u jschiwal

i was first shocked to find the directory structure of vsipl++ in this post.thanks for the risk taken.

and as for the command is considered its simply marvellous, this is what exactly i was looking.

what i understood from the command(
tar --list -jf sourceryvsipl++-1.3-linux-x86.tar.bz2 | tr '\n' '\000' | xargs -0 rm -v) is the directory strucure is sent to rm for deletion.
 
Old 02-06-2008, 09:06 AM   #7
babu198649
Member
 
Registered: Oct 2007
Posts: 160

Original Poster
Rep: Reputation: 30
hi

tar --list -jf sourceryvsipl++-1.3-linux-x86.tar.bz2 | tr '\n' '\000' | xargs -0 rm -v

this command worked well but the only prob was it was not removing the directories.
hence i added rm -Rfv which resulted in disaster.
ie,
tar --list -jf sourceryvsipl++-1.3-linux-x86.tar.bz2 | tr '\n' '\000' | xargs -0 rm -Rfv

i normally use -Rf option to remove directories.

now since i used these options without thinking my share folder started to delete.

is there any way to recover the deleted files.

the good news is it has just started to delete and possibly within 10 seconds i had stopped it.

is there any way to recover it.

snap shot of removed files.
removed `usr//share/locale/ru/LC_MESSAGES/knotes.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kabcformat_binary.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kdeprint_part.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kcmmidi.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kdbg.mo'
removed `usr//share/locale/ru/LC_MESSAGES/ffrs.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kwin_b2_config.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kcmlayout.mo'
removed `usr//share/locale/ru/LC_MESSAGES/alarmdaemonctrl.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kcmcrypto.mo'
removed `usr//share/locale/ru/LC_MESSAGES/qeditor.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kcmemail.mo'
removed `usr//share/locale/ru/LC_MESSAGES/system-config-keyboard.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kfile_gif.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kcmxinerama.mo'
removed `usr//share/locale/ru/LC_MESSAGES/kodo.mo'
removed `usr//share/locale/ru/LC_MESSAGES/system-config-nfs.mo'
removed `usr//share/locale/ru/LC_MESSAGES/synaescope.m
 
Old 02-08-2008, 06:32 AM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Which distro are you running?

If you have an rpm distro, and you know the name of the file, you can find out which package supplies the file this way:
rpm -qf <path/to/file/filename>

You can also validate all of your files with:
rpm -qaV

It will indicate which files are missing.

Of course if you have a current backup, you could restore from that.

I would get the list of directories like this:
tar --list -jf sourceryvsipl++-1.3-linux-x86.tar.bz2 | sed -e 's|/[^/]*$||' | sort | uniq

or to delete them if empty:
tar --list -jf sourceryvsipl++-1.3-linux-x86.tar.bz2 | sed -e 's|/[^/]*$||' | sort | uniq | tr '\n' '\000' | xargs -0 rmdir

If it would be OK to delete all of the empty directories found:
find /usr/share/ -type d -exec rmdir '{}' +;
This command will only remove the bottom layer of (empty) directories each time, so you may need to run it more than once.



I'll do something like this one step at a time, first getting the files listed. Then I'll write a filter to remove the filename parts, then the sort and uniq parts will remove the repeats.

I always use the "rmdir" command instead of "rm -R". That way if a directory isn't empty as I thought, it won't be deleted.

Something else you can use is the find command to locate empty directories:
find /usr/local -type d -empty

If you want to cross match these directories with the contents, I find the <(command ...) form as a handy stand-in for a filename:
comm -12 <(tar --list -jf sourceryvsipl++-1.3-linux-x86.tar.bz2 | sed -e 's|/[^/]*$||' | sort | uniq) <(find /usr/local -type d -empty | sort)

I could have used
grep -f <(find /usr/local -type d -empty | sort) <(tar --list -jf sourceryvsipl++-1.3-linux-x86.tar.bz2 | sed -e 's|/[^/]*$||' | sort | uniq)
instead.
But for directories, there where not so many so simply using the list from the tarball listing would have provided the info to remove the directories manually.

Last edited by jschiwal; 02-08-2008 at 06:50 AM.
 
Old 02-08-2008, 09:31 AM   #9
babu198649
Member
 
Registered: Oct 2007
Posts: 160

Original Poster
Rep: Reputation: 30
hi jschiwal



my distro is Red Hat 3.4.4-2

[babu@localhost ~]$ cat /proc/version
Linux version 2.6.9-22.ELsmp (bhcompile@porky.build.redhat.com) (gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)) #1 SMP Mon Sep 19 18:32:14 EDT 2005



u r post has been very useful . thank u for the post detailed explanation of the post .

i have found that my system uses ext3 file system and in one site i have seen that ext3 files can not be recovered .is it true . because most of the recovery s/w (which is commercial) says that they support ext3 file system also .
 
  


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
uninstalling tar.gz files. possible? ikinnu Linux - Software 6 09-07-2007 09:44 AM
uninstalling programs installed from .tar.gz durden2.0 Linux - Newbie 11 11-10-2004 01:26 PM
tar -xjf patch-2.6.4.bz2 ... cxtech Linux - Newbie 1 03-28-2004 10:35 PM
Uninstalling tar.gz packages david911 Linux - Software 3 10-17-2003 07:09 AM
how to remove installed tar files marvc Linux - Software 3 04-17-2003 08:35 PM


All times are GMT -5. The time now is 10:34 PM.

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