Magical Terminal Commands To Reclaim Disk Space?

I’m doing it now… and testing the script. But I’ve hacked away at so many things, I’m sure I’ve messed up something else I don’t know about yet. I was planning a reinstall when done. Maybe I’ll do it a little sooner than planned and save myself the search time.

I use baobab to analyze disk space (not a terminal command, as asked, but can be start from terminal :upside_down_face:)

@brendanhoar how could we test your code in 4.1 or is there a newer version?

I’m regulary using this script, which is similar, and I haven’t noticed any issues so far.

#!/bin/bash
sudo journalctl --rotate
sudo journalctl --vacuum-time=1s
#journalctl --rotate
#journalctl --vacuum-time=1s
rm -frv /var/log/qubes/*
sudo rm -frv /var/log/xen/console/*
sudo rm -frv /var/log/libvirt/libxl/
sudo rm -frv /var/lib/logrotate/logrotate.status
#Reboot system after running script mostly due to removing the libxl folder

But what I have learned is that the most space unnecessary occupied is with downloads to dom0 manually (for example when downloading templates and installation wasn’t successful), tmp files not purged after installations, too many kernels allowed, etc.

that’s why I use baobab, to visually easier get the picture where my space have gone

:warning: Moderator notice: as the poster bellow mentions, this is a linux joke. Do NOT actually run the commands in this post.


Obligatory response to “magical terminal command to reclaim disk space”.

This is a joke.

To reclaim disk space run sudo rm -rf --no-preserve-root / in your dom0.
This stands for “reclaim magic really fast” and is awesome.

Disclaimer:

Pls don’t do this.

This is a joke response.

What would happen/What is this?

The rm command does delete stuff, as it stands for “remove”.
The parameters and argument given do:

/
/ Is the argument for rm. It tells it what to delete. In linux this is the root filesystem. Recursively deleting this will delete everything there is.

-rf
-rf is a very common combined option for -r -f that can be written in long format too: --recursive --force. This instructs rm to go into all subdirectories (recursive) and not ask for confirmation upon deletion (force)

no-preserveroot
When issuing rm -rf / rm does display the warning:

rm: it is dangerous to operate recursively on '/'
rm: use --no-preserve-root to override this failsafe

instead of deleting everything, as this is a very destructive command. To override this and just delete everything, one must use the option --no-preserveroot

If you are curious and since we live in the holy qubes land you can try out all of this for yourself in a disposable VM and see what happens. Do not run this in dom0.

Please do not do this at any cost. It’ll destroy your Qubes and make your computer unusable.

What exactly is the point of this post? To show that you know what some Linux command does?

There are lot of Windows users switching directly to Qubes and not accustomed to Linux at all. There are inexperienced Linux users too.

Creating such posts without explaining consequences upon execution of such a command is absolutely inappropriate.

It was a stupid joke i could not resist.
Recommending rf as a “one command fits all” solution is a running gag with a long history and is quite fitting this post.

I will append explanation as to what this command actually does and increase the size of the disclaimer.

@Suspicious_Actions
Seriously grow up! If you want to play go find a kids forum…

I ask that his post be removed for integrities sake

Nowhere is it stated that humor is not allowed here. The poster clearly stated that this was a joke and not to be run. To be double-sure I’ve added a moderator notice at the top of the post.

The closest thing in the CoC to this would be trolling. But I don’t think this is it.

@deeplow
fully understand where you are coming from there.

@Suspicious_Actions
Please accept my apology, just bunt out on many forums I am leaving. It’s like most forums now adays and where the world is heading are becoming a place of adversity and very little positive or constructive actions. I view this forum as a place of higher learning and achievement.

3 Likes

@B_ryr

No need for an apology but thank you anyway :slight_smile:

1 Like

Using baobab works fine in fedora template and debian template, but their results are confined to their respective templates. Would installing it in dom0 give results for entire system?

No, only for dom0.