Today I am doing a linux upgrade on an ubuntu server. One thing that commonly occurs (at least to me) is that the path:


doesn’t have enough space available for the upgrade. This necessitates cleaning it up. If you are working from the command line, learning how to do a simple “brace expansion” can save you a lot of time and typing. Let’s dive in!

Usually if you look in /bin you will see something like this:

typical ubuntu /bin directory

typical ubuntu /bin directory

The majority of the files eating up space can be removed. They are various versions of temporary kernel/core updates and stuff that are no longer being used by the system. As a rule of thumb I always keep the latest version of each file.

Now… typing out the command

rm -rf abi-3.8.0-19-generic

for each of the files could get a bit exhausting. However with brace-expansion we can speed it up greatly. Rather than typing out rm -rf for each individual file, we will say we want to delete a range of files with the same name aside from some minor differences… such as the number before -generic in the case above. That command then looks like this:

rm -rf abi-3.8.0-{19..34}-generic

Notice the {} section of the file name. That tells the server to delete all files with that name and that numerical range. The above command would delete all but the latest file in my scenario. Now rather than running 20 rm -rf commands I can run 4.

Enjoy! this should save you quite a bit of typing on the command-line as it has for me!

1 of 1

This post has no comments. Be the first to leave one!

Leave a Reply