5

Can anyone explain me how to uninstall the applications that are installed by extracting using tar command (tar files) .

I am really struggling to find an uninstall file . Surprisingly, I dont't find make file , (make related files) .

When I extract the tar file directly a binary file and its related files are distributed in my Linux PC .

1 Answer 1

8

@JosephR. is on the right track. But don't use recursive rm - you'll find that the smallest bug suddenly removes your entire home directory (or worse). And to be extra safe, you might want to ensure that all the files exist before removing any of them. Untested code along these lines:

$ cat deletar.sh
#!/bin/sh

set -o errexit -o noclobber -o nounset

tar tf "$1" | while read -r path
do
    if ! [ -e "$path" ]
    then
        echo "$0: Path does not exist: $path" >&2
        exit 1
    fi
done

tar tf "$1" | grep -v '/$' | xargs rm -f

tar tf "$1" | grep '/$' | xargs rmdir
2
  • Why is a recursive rm not preferred?
    – Joseph R.
    Oct 18, 2013 at 16:02
  • 3
    @JosephR. Such tar files often include the root directory of where things get installed, such as usr/local. The recursive rm -rf would then blow away all of /usr/local.
    – kurtm
    Oct 18, 2013 at 17:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .