Running out of space, looking for a way to remove unnecessary files

I am running out of space on my laptop and was looking for a way to remove unecessary files, I run this command regularly…

$ sudo pacman -Sc

this does help.

I found this website How to clean Arch Linux | Average Linux User

it suggests…

  1. Remove unused packages (orphans)
$ sudo pacman -Qtdq			# to find unused packages

$ sudo pacman -Rns $(pacman -Qtdq)	# to remove unused packages
  1. Clean the cache in /home directory
$ sudo du -sh ~/.cache/		# check size of cache folder

rm -rf ~/.cache/*		# remove all files inside cache folder

I would like to clear as much space as possible, but wondered is it safe to follow these instructions?

I only have limited knowledge of linux, but any advice would be appreciated.

I have two kernels, latest recommended running and one other installed.

I am running Manjaro Xfce on a DELL Inspiron 5559 laptop UEFI boot, with swap partition and "/ " partition.

I multiboot which is why I am running out of space.

1 Like

What about

sudo pacman -Scc

And/or paccache:

paccache -rvk3
paccache -ruvk0

Also, do you use an AUR helper?
Have you cleaned its cache?
What about SNAP, Flatpak, or any other kind of software format/management?

Have you looked to find what is taking the most space?
Maybe something like:

sudo du -Sh | sort -rh | head -20

These have a number of suggestions as well:
System Maintenance - Manjaro
System maintenance - ArchWiki

Also: List of applications - ArchWiki

That is safe to do.


  • sudo isn’t necessary here - it’s your $HOME directory
  • it’s just 1 GB in size for me at the moment - so not much to be gained
    1 GB at the most …

… do you have multiple partitions?
… or just one?

df -h

you might gain a little more if you do adjust the “reserved for “root” percentage”
which is 5% by default

sudo tune2fs -m1 /dev/sdXx

(whatever your device name is …)

man tune2fs
for more info on what that command does

Depending on the size of the HDD, the gain can be substantial

5% reserved for only root access
on a 1 TB disk
is quite a lot of unusable space … → in this case
the command above translates to: 50 GB …
or 40 GB more than you have available now …
and still have 10 GB for “root” exclusively - which is overkill still …
especially on a single user home system …

but the next iteration is -m0 (zero)
which then leaves no margin of error at all
and only leaves you with chroot from the outside to fix potential problems …

1 Like

Good overview in the Arch Wiki too: Ext4 - ArchWiki

A few thoughts.

  1. There are a few “running out of space” entries on this forum, so a search might produce additional ideas.

  2. Any core dumps: coredumpctl (they can be removed or eliminated altogether).

  3. journal disk usage: journalctl --disk-usage (can be managed). Other logs in /var/log are handled via logrotate.

  4. pacman -Sc is done for the user automatically provided by Manjaro (see systemctl list-timers; It runs pamac clean the first Sat of the month. See man pamac.conf for description of KeepNumPackages (default 3)).

  5. Regarding file size, I don’t install anything special, just use du, df, and find. Some desktop File Managers do better than others in this area.

    An application needs what it needs, but having said that some applications don’t manage these resources very well, some produce excess messages when there is a problem, and files are left behind.

    I look for files that haven’t been touched in awhile and files greater than 1G. Below the -printf could be replaced with -ls or removed entirely. If running on the root filesystem, a number of directories need to be pruned. I selectively remove files based on the results. Execute the last find command before and after you start your favorite application and see what files it is using. Examples below (see man find):

find $HOME -iname '*cache*' -ctime +360  -printf '[%y] %-100P +%1d b[%10s] m|%TD %.8TT|\n' | sort -k5n

find $HOME -size +1G -printf '[%y] %-100P +%1d b[%10s] m|%TD %.8TT|\n' | sort -k5n

find -newermt '1 minute ago'
  1. Regarding the rm command in the OP.

    Any time using remove with the option recursive (-r) and the globbing character (*) be careful, and extra, extra careful if you are root (sudo).

    I always list (ls) before and after. I want to know what I’m doing and then confirm what I thought I was doing. I use the up-arrow to recall the command from the bash history, ctl-a to get to the beginning of the line, and then with the cursor over ls I type alt-d and then rm. alt-d is kill-word. It may vary on your system. On bash (bind -P) will display key bindings for readline. Could also consider changing to the directory and then doing your remove. Maybe use the Desktop’s File Manager (click first file, hold the shift, click the last file, right-click, delete). After this command I would logoff/on.

  2. How many kernels installed: mhwd-kernel -li

PS: Next time mention the desktop in use. Some times that helps to get additional/specific help.

1 Like

Thank you all for your support. I will look at your remarks and read the links you have provided. I will let you know result when I have done this. Thanks again, much appreciated.


I have two kernels, latest recommended running and one other installed.

I am running Manjaro Xfce on a DELL Inspiron 5559 laptop UEFI boot, with swap partition and "/ " partition.

I multiboot which is why I am running out of space.

My File Manager showed only 1.5 GB free, so I decided to try to clean the cache in /home directory

    $ du -sh ~/.cache/		# check size of cache folder
    $ rm -rf ~/.cache/*		# remove all files inside cache folder
[hugh@DELL-INSP-MANJARO ~]$ du -sh ~/.cache/
2.6G	/home/hugh/.cache/

then I ran command

$ rm -rf ~/.cache/*		# remove all files inside cache folder

File Manager now shows 4.0 GB free # very good result !

I was wondering if it would be safe to run the other command, to remove unused packages (orphans)

$ sudo pacman -Qtdq			# to find unused packages

$ sudo pacman -Rns $(pacman -Qtdq)	# to remove unused packages

your input would be greatly appreciated.

thanks again for your help

I found in my case that aside of cleaning packages cache, the second thing was to limit journal size. By default, it grows and grows without limits, so after a few years it can use many GB of space. However, you can set in config to use 200 MB or less, so it will purge older data with time and keep it at that size.

I don’t remember the exact path to config, but it should be easily findable.

And the last space hog are apps themselves. Uninstall what you don’t need.

So to sum up:

  1. Packages cache - clean up regularly, keep at most 2 last versions
  2. Journal limit - set it once and forget
  3. Uninstall what you don’t use, some apps can take a lot of space.

My experience tells, that the comfortable size of a system partition is at least 100 GB. Anything less will be problematic with time. Recommendations about 30GB are fairy tales. I had 30GB, and quickly I hit the wall, and had to increase the size of this partition. Rolling systems require a lot of space for constant updates (you download a lot), apps (with easy access to almost all apps, it’s easy to clutter the system) and journal - longer life (my system is running 7 years after the installation, so my journal size was huge, journal defaults on Manjaro are stupid, or at least they were stupid 7 years ago, maybe that has changed, I don’t know, it’s worth to check thou).

1 Like

To restrict systemd to a limited amount of drive space open the configuration file with nano as root:
$ sudo nano /etc/systemd/journald.conf

Find the line in the file #SystemMaxUse=
Remove the # in front of the line and use a sensible value for your needs.

Suggested value from @michaldybczak : SystemMaxUse=200M

This setting limits systemd to the set value of log space and tell it to clean up the logs once in a while automatically, only keeping the most recent that fit in the given space. More info on all the log options in the config file and the defaults used.


Problem with emptying the caches, is that it will refill quickly so it is not a long term solution. Journals though take lot of space so that’s good to do (limit the size).

You can also use a toll like qdirstat from the AUR to inspect your home folder to see what is taking lot of space and decide then what to delete.

Keeping only one previous version of packages (or 0 if your don’t feel you’ll need to use your packages cache in the future) is also good to gain some space.

paccache -rvk1

Links above for system maintenance is good, read it all, also the reserved space command above let me gain as in the example 40GB. You should already be able to gain lot of space by following everything here.

The 3rd point of what @michaldybczak said and what @Hanzel said.
This will potentially free a lot of space - but not for your own use.
Just for the system overall.

Maybe the technical jargon of my comment wasn’t quite hitting the spot,
so let me put it like a commercial:

Just do:

sudo tune2fs -m1 /dev/sdXx

(for the partition where your /home resides
as well as for the system partition (if you have separate partitions for / and /home)

By doing that one command, you will instantly gain a lot of usable space for no additional cost - just like that …
without having to delete anything :wink:

… just because now only 1% is reserved for the root user
whereas it was 5% before …

1 Like

That’s not a command that should be done blindly.


Research it before doing it like anything done with sudo.

hmm - I did …
And I have done that for years to all my systems.
What could be the potential harm - if one doesn’t set it to zero?

That command needs to be run as root, else it won’t do anything
as it alters the reserved block percentage (which is 5% by default) of the ext4 filesystem.

The effect of it can also be undone in the same way
to restore the 5% of blocks reserved for root
sudo tune2fs -m 5 /dev/sdXx

If the filesystem isn’t ext(2/3/4) then this will of course not work.

I never said you didn’t. I’m talking to the folks who might blindly copy and paste that command. :wink:

Good question that can be answered by research.

Ah, ok. I have a knack for interpreting things the wrong way …
of course one should know what any command (especially run as root) is doing
before running it


thanks @Hanzel

I did as you suggested and manage to free up a further 3.1 GiB

So the total space recovered from ~/.cache/ is 2.5 GB, plus 3.1 GiB from /etc/systemd/journald.conf so that’s a total of 5.6 GiB that is a great result.

thanks for all the help and advice on my post. great feedback and learned a lot in the process :blush:

1 Like