Skip to content

Linux: Stopping tar command?

Uh I badly messed up today, I was going to backup my whole website folder (public_html) and didn’t realize that it was 24GB, now it’s eating up disk usage and I have no idea how to stop it. The command I used was:

tar -cvpzf  /home/mywebsite/public_html/backup.tar.gz /home/mywebsite/public_html/

I deleted the existing backup.tar.gz from the directory but the command is still running and is still eating up disk space (even though the .tar.gz file no longer exists). How do I stop this?



ps -ef | grep tar

Figure out the tar command’s PID, then kill it with.

kill <pid>

For instance, kill 1234 if it is PID 1234. Wait a bit, and if it hasn’t died gracefully from that then hit it with the sledgehammer.

kill -9 <pid>

Alternatively, you could kill all running tar commands with a single command.

pkill tar

# if necessary
pkill -9 tar

Either way, once the process dies, the disk space will clear up. Deleting the file didn’t help because a running process still has the file open. Files aren’t truly deleted until they’re removed and they’re not open in any process.

User contributions licensed under: CC BY-SA
6 People found this is helpful