LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cannot uninstall .tar/.bz2 file (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-uninstall-tar-bz2-file-662187/)

shipon_97 08-12-2008 04:12 AM

Cannot uninstall .tar/.bz2 file
 
Dear Friends

I have to install a tar file following way :

tar -xvf file1.tar
or
tar -jxvf file1.tar.bz2

But I dont know How to uninstall it ? Can anybody plz tell me how can I
uninstall tar file ?

indeliblestamp 08-12-2008 04:18 AM

tar will only extract the files to the same path that it was initially tarred from. e.g. If your files/folders are untarred to a new folder in the current working directory (this is usually the case), you can safely delete them as long as you have the tar file safe.

jschiwal 08-12-2008 04:19 AM

The command doesn't install a package. It justs expands the file. Most tarballs will expand into a directory, so you just need to delete that directory and all files in it.

If you have a tar file with a number of files that were extracted in the current directory, you can list the files in the original tarball with "tar --list -jf tar1.tar.bz2". The file list can be used to delete the files:
tar --list -jf tar1.tar.bz2 | tr '\n' '\0' | xargs -0 rm -v

The "tr" command will replace returns with the null character. The -0 option of xargs will use the null character to separate arguments. This is needed if the file names contain white space.

prakash.akumalla 08-12-2008 04:25 AM

Hi,
The command you used is to extract files from a tar ball. That command will create a directory which is a set of files or directories which are made as a tar ball.

To make the action of the above command nullify you just need to delete the directory.
You can use rmdir command for that if the directory is empty.
Else use

rm -rf directory_name

this will completely deletes the directory no maters how many other directories and files that directory contains.

Prakash.


All times are GMT -5. The time now is 12:07 PM.