Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Hoovering Linux - Housekeeping Benefits


  • Please log in to reply
42 replies to this topic

#1 wizardfromoz

wizardfromoz

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:40 PM

Posted 18 February 2016 - 04:03 AM

I was inspired to start this Topic by being a part of a Topic by friend rozzer, over at http://www.bleepingcomputer.com/forums/t/605137/remove-orphaned-packages

 

... which makes for good reading prior to or during reading this Topic.

 

I'll throw this one out there first:

 

 

RmgfqNk.png

 

 

The above features a partial list of the contents of my

 

/var/cache/apt/archives

 

folder, in one of my three Linux Mint installs currently run on the Toshiba. It was simply a case of cd-ing to the folder, then typing and entering

 

ls

 

for list files.

 

The 2nd part

 

du -h

 

provides a human-readable output of the space taken by the files, in this case it was several hundred files, consuming 408MiB of storage.

 

  • Each and every one is a result of the install process
  • Each and every one is a .deb and
  • Each and everyone can be blown away, if you so wish

Next screenshot

 

slI76Mn.png

 

 

... provides a graphical picture from one of the other Linux Mints - Linux Mint 17.1 Rebecca, MATE desktop environment, 64-bit, which is the closest I have currently to what rozzer had/has in the other Topic.

 

647 items, consuming 667.6MB. Each and every one, as above, can be blown away - if you so choose.

 

It is perfectly safe, none is system-related, none are irreplacable - they can be likened to .cab files/folders in Windows, and can be used for a reinstall, but unlike Windows (where you may not have install/reinstall media shipped with the unit, and may need certification details to install/reinstall), these can all be drawn down from the Linux Repositories if you need to reinstall (then blown away again).

 

Interested? There are many more savings to be made.

 

In my environment, I work with

 

  • Debian-based Distros
  • RPM-based Distros
  • Gentoo family Distros and
  • Arch-based Distros

so I will be providing tips for all in this regard.

 

:wizardball: Wizard

 

Edited typo


Edited by wizardfromoz, 18 February 2016 - 04:05 AM.


BC AdBot (Login to Remove)

 


#2 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:04:40 AM

Posted 18 February 2016 - 06:45 AM

Wiz, this is good.  Basically the end result of a person running a system update or software installer on a system.  The .deb files are the Debian equivalent of RPM files and are the "downloaded" package.  Once the package is installed, a good program usually has an option to delete the downloaded files.  It may be a command line switch or up under a preferences widget, but this is something that could (should) be done automatically.

 

find / -name "*.tgz" -print

 

Gzipped tar files are another common distribution, the above command will find them all and give you a list.  Replace .tgz with .deb or .rpm as desired.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#3 pcpunk

pcpunk

  • Members
  • 6,108 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:40 AM

Posted 18 February 2016 - 01:45 PM

Yeah but what is the process in which to "Blow them away"?

 

Here is my output, and clearly there are quite a few that could be blown away, but you don't mention how to do this?  For me, that post was not good, because I don't know where to go from there safely.  For those whom already know about all this it don't matter, and for those whom don't know how all this works, you cut it short by not completing the process imo.

chris@chris-HP-Compaq-nx7400-EN352UTR-ABA:/var/cache/apt/archives > du -h
16K     ./partial
2.7G    .

I can only assume that you are saying to "blow away" everything in the "/archives" directory? but I am hesitant to do anything like that with my Main pc.

 

pcpunk out


Edited by pcpunk, 18 February 2016 - 03:14 PM.

sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#4 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:04:40 AM

Posted 18 February 2016 - 02:35 PM

Yeah but what is the process in which to "Blow them away"?

 

Here is my output, and clearly there are quite a few that could be blown away, but you don't mention how to do this?  For me, that post was not good, because I don't know where to go from there safely.  For those whom already know about all this it don't matter, and for those whom don't know how all this works it you cut it short by not completing the process imo.

chris@chris-HP-Compaq-nx7400-EN352UTR-ABA:/var/cache/apt/archives > du -h
16K     ./partial
2.7G    .

I can only assume that you are saying to "blow away" everything in the "/archives" directory? but I am hesitant to do anything like that with my Main pc.

 

pcpunk out

One way would be to use whatever file manager you use, go to /var/cache/apt/archives, select all the files that end in .deb and delete them.

 

A way to do it from a terminal:

 

sudo find /var/cache/apt/archives -name "*.deb" -exec /bin/rm -v {} \;


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#5 pcpunk

pcpunk

  • Members
  • 6,108 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:40 AM

Posted 18 February 2016 - 03:16 PM

@mremski:  :thumbup2: Thank you! 

 

Wait! is this some kind of Alien language? lol.  I'll need to take a long look at that one.

sudo find /var/cache/apt/archives -name "*.deb" -exec /bin/rm -v {} \;


Edited by pcpunk, 18 February 2016 - 07:57 PM.

sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#6 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:04:40 AM

Posted 18 February 2016 - 04:06 PM

man find

 

find (starting at /var/cache/apt/archives) all files named (something).deb then execute the command /bin/rm -v on what you found.  

The "{}" means "what you found" and the "\;" ends the command.

 

find is a useful command to know;  look at the man page.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#7 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 13,563 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:07:40 PM

Posted 18 February 2016 - 04:27 PM

If you have questions about any process in this thread please start a new post.



#8 wizardfromoz

wizardfromoz
  • Topic Starter

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:40 PM

Posted 19 February 2016 - 02:15 AM

If you have questions about any process in this thread please start a new post.

 

My bad, in part. I was advised recently, I think by raw, to NOT start a Topic before I knocked off for the night, leaving people hanging. I will endeavour to follow that good advice.

 

I was going to cover the "rm" options, also "clean" and "autoclean" next, as part of removing these files, and that follows with the next Post

 

:wizardball: Wizard



#9 wizardfromoz

wizardfromoz
  • Topic Starter

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:40 PM

Posted 19 February 2016 - 03:14 AM

Read through to the bottom of this Post before taking any action, also check the linked articles as well.

 

https://help.ubuntu.com/community/AptGet/Howto

 

<apt-get clean> and <apt-get autoclean> are mentioned in the above article, as useful tools for this sort of exercise.

 

mremski has mentioned above

 

 

One way would be to use whatever file manager you use, go to /var/cache/apt/archives, select all the files that end in .deb and delete them.

 


 

 

... and that is the simplest method I might recommend - however, you will need to pause at the directory level above the files, that is "Archives", right-click and enter as Administrator. If you revisit my screenshot above with the red font, from an "ls" command - try that with <ls -l> and you will find that all the .deb's are Root-owned. Hence privileges are required.

 

mremski has also offered

 

 

sudo find /var/cache/apt/archives -name "*.deb" -exec /bin/rm -v {} \;

 

 

... as a Terminal alternative.

 

That certainly works. The screenshot below is taken from my MX-15 install

 

YFrKLk9.png

 

 

We'll look further, soon, at "what is lock?".

 

IMPORTANT

 

I'll mention here, two points, one of which you should always do, in circumstances such as these, the other related to the above:

 

  1. Before engaging in an exercise such as this, where you are using advice NOT, perhaps, from the official website of your Linux Distro, you should have performed a backup, &/or taken a snapshot (Timeshift or otherwise), that captures your current state, and safeguards it from loss of important data
  2. With the contents of the path under /var/cache/apt/archives - there is an empty folder named "partial". Do not delete that, although if you do, all is not lost and you can recreate it simply enough. I will explain a little more as this thread develops

 

I have to leave MX-15 for now, to revisit a Firefox tab in another Distro that I have not shared yet, but which features my own preference for the terminal approach mremski refers to. So you are not left hanging, I will be back in less than 18 hours to continue.

 

I hope you find the subject of housekeeping half as interesting as I do!

 

:wizardball: Wizard



#10 wizardfromoz

wizardfromoz
  • Topic Starter

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:40 PM

Posted 20 February 2016 - 02:17 AM

Hi

 

 

I have to leave MX-15 for now, to revisit a Firefox tab in another Distro... but which features my own preference for the terminal approach mremski refers to.

 

 

I've actually come across this in my scripting travels, but you don't have to get into the scripting field, or into the Bash shell, to use them – the commands are applicable from Terminal's prompt.

 

The command I have used, successfully, is similar to below

sudo find /var/cache/apt/archives -mtime +xy -print | xargs /bin/rm

In the above instance “xy” is a two-digit numeral of your choice, and relates to “days old”, or, with the plus sign, specifically, “days older than”. I usually use 30, 60, 90, etc.

 

This command features

xargs

and I will tell you why I prefer it over the

exec

option mremski has provided us – it is not a competition, each effects a result through slightly different protocols.

 

But first, a little background reading can be found here, only found this yesterday my time -

 

https://www.gnu.org/software/findutils/manual/html_node/find_html/Deleting-Files.html

 

I find this “little background reading” actually to be a mine full of gems. If you read it, it will cover a lot of things I was GOING to say, and things I had not yet THOUGHT of saying, lol.

 

In my mind, anything that is headed up “Gnu”, has just GOT to be “Gnood” (good – really bad pun), they are one of the key planks upon which our wonderful world of Linux lies.

 

 

 

:wizardball: Wizard



#11 mremski

mremski

  • Members
  • 498 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NH
  • Local time:04:40 AM

Posted 20 February 2016 - 02:53 AM

xargs, doing the job when your shell expansion doesn't, as I had a Scot tell me once "it's 6's and 3's".  All tools we should at least be aware of, even if we have to look up how to use it.  

 

*nix typically has multiple ways of getting the same job done, in fact you can get overwhelmed at times.  The trick is if you find a command you like, master it.  Really learn it.  Alternatives, keep a list because they will come in handy.

 

Very good reading at that link.


FreeBSD since 3.3, only time I touch Windows is to fix my wife's computer


#12 wizardfromoz

wizardfromoz
  • Topic Starter

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:40 PM

Posted 20 February 2016 - 03:37 AM

:thumbsup: to all the above.

 

I find there are always at least five (5) ways you can do something (Windows was an example) and 5 ways you can travel somewhere - I call it "The Power of Five", lol.

 

Speaking of "lists"

 

@pcpunk

 

friend punk, back at

 

http://www.bleepingcomputer.com/forums/t/605768/hoovering-linux-housekeeping-benefits/?p=3937984

 

... where you revealed the output of your .../archives folder -

 

Can you dive into that folder "partial" and reveal any contents thereof? Either use -

ls -all

or through File Manager, press ^h (Ctrl-h)

 

... either of which will reveal any hidden files.

 

I am anticipating that that folder will be empty - but do not "blow it away". Yet, at least.

 

That's all I have time for right now, next instalment is what do I do with this info?

 

Cheers

 

:wizardball: Wizard

 

Edit - sorry meant

ls -a

or

ls --all

... although the one listed does work, just shows more than I need, lol - my bad


Edited by wizardfromoz, 20 February 2016 - 03:42 AM.


#13 Captain_Chicken

Captain_Chicken

  • BC Advisor
  • 1,366 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:40 AM

Posted 20 February 2016 - 10:40 PM

This is neat. Thanks!
Next thing they need is ccleaner for linux.

Computer Collection:

Spoiler

Spoiler

Spoiler

Spoiler

#14 NickAu

NickAu

    Bleepin' Fish Doctor


  • Moderator
  • 13,563 posts
  • ONLINE
  •  
  • Gender:Male
  • Location:127.0.0.1 Australia
  • Local time:07:40 PM

Posted 20 February 2016 - 10:46 PM

 

Next thing they need is ccleaner for linux.

Bleach Bit 

 

BleachBit quickly frees disk space and tirelessly guards your privacy. Free cache, delete cookies, clear Internet history, shred temporary files, delete logs, and discard junk you didn't know was there. Designed for Linux and Windows systems, it wipes clean 90 applications including Firefox, Internet Explorer, Adobe Flash, Google Chrome, Opera, Safari,and more. Beyond simply deleting files, BleachBit includes advanced features such as shredding files to prevent recovery, wiping free disk space to hide traces of files deleted by other applications, and vacuuming Firefox to make it faster. Better than free, BleachBit is open source.

https://apps.ubuntu.com/cat/applications/precise/bleachbit/

 

 

Ubuntu Tweak

Ubuntu Tweak is an application to config Ubuntu easier for everyone.

It provides many useful desktop and system options that the default desktop environment doesn't provide.

With its help, you will enjoy with the experience of Ubuntu!

http://ubuntu-tweak.com/



#15 wizardfromoz

wizardfromoz
  • Topic Starter

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:40 PM

Posted 21 February 2016 - 02:57 AM

I'm currently writing from “Hermes”, the dud Acer All-In-One, which keeps falling over, so I reformatted the HDD and installed

 

Ubuntu 15.04 Vivid Vervet 64-bit Media Center (Unity desktop)

 

… it's a good environment to test in as I have not added any apps yet.

 

Contents of /var/cache/apt/archives are:

 

  • 400 files, consuming

  • 412. MB of space, which du -h in Terminal reveals is

  • 395 MiB

  • and the ever-present subfolder “partial” which is empty (always is) but has an overhead determined by du -h of 4 KiB on this sytem (figure will vary from 4 KiB to 16 KiB dependent on your hardware)

 

So 401 items, but for now I am only looking at the 400 files, which I will shortly delete. Nearly all of these are from the install, and I will explain “nearly all” in a few lines down.

 

Now I have been meaning to try a File Manager known as Muon for a while now, having heard good reports on it. Ubuntu Unity uses an FM called simply “Files”, but it is actually Nautilus.

 

For purposes of this exercise, I have established that

 

  1. Muon is in the Ubuntu Repositories, and thus can be installed using

    1. Synaptic Package Manager

    2. Ubuntu Software Centre and/or

    3. from Terminal using the appropriate command/s

  2. Muon comprises, in its install, at least one .deb package and

  3. there are other alternatives you might try for yourself

 

I am also aware that an Update Manager can be included if you check a box in Software Centre, also that there is a 3rd element you can choose (a software centre, I think) which effectively makes it a Suite.

 

For now, I have chosen 1.c), that is Terminal.

 

I have already performed an apt-get update, and now I type in and enter

sudo apt-get install muon

The process kicks off, and tells me that there will be 184 packages installed, that 79.0 MB of archives will be downloaded, and that in the end 284 MB additional space will be used. I agree and proceed.

 

The 79.0 MB for me was downloaded in 8 min 12 secs @ 160 kB/s average, but with unpacking, installing, processing of triggers etc, whole op took about 20 mins.

 

Once completed, I go to The Dash (Ubuntu Unity users are familiar with this), and type in “Muon”. See screenshot below.

 

 

7Sh2ao7.png

 

 

 

… both Muon Package Manager and Muon Update Manager (icon is same us Ubuntu's, I think) are there, so the process has mirrored what could have been performed through Software Centre.

 

 

A click on each shows both work, interestingly enough, Update Manager tells me a new version of Kubuntu is available (??) - I will look at these elsewhere, another time.

 

 

NOW is where it gets interesting, I hope.

 

 

Under Files (Nautilus) I revisit /var/cache/apt/archives.

 

 

A cursory scroll reveals four (4) .deb packages starting with “Muon”, but is that all?

 

Blocking (highlighting) all files in the folder other than the subfolder “partial reveals:

 

There are now:

 

  • 584 .deb files (a nett increase of 184)

  • space consumed is 491.5 MB and a du -h at Terminal shows

  • 470 MiB consumed

 

Look at those figures, and compare with what I showed above, where I said

 

 

 

The process kicks off, and tells me that there will be 184 packages installed, that 79.0 MB of archives will be downloaded, and that in the end 284 MB additional space will be used. I agree and proceed.

 

 

… and you will see all figures match – the size of var/cache/apt/archives has been increased by exactly the amount of space it takes to download a new app or package.

 

 

We now know that this folder is where the .deb files “go to live”, perhaps nearly every time we install something new that does not include binary files or alternatives. Exceptions to this might be where you might visit a site and be presented with a choice of a .deb file or a .rpm file to download, click download and choose a download venue eg Downloads, whatever.

 

 

Linux is by reputation not supposed to have a lot of “bloat” about it, but in this area – there is, or can be. In this example, I was only talking about 412.5 MB from a pretty new install. Then you can get examples such as friend pcpunk has shown us, where 2.7 GB is consumed. And I mentioned earlier that my research found one instance of 15 GB being consumed/saved. And there will be larger amounts some of you will likely find (punk knows I am not singling him out, we are Mates, eh? - but I know HE is going to benefit – if he chooses, from these procedures and protocols, as can many of us).

 

I am running out of time now, but I will be -

 

  • “blowing away” all of those .deb files and we will see what happens

  • … using one of at least five (5) different methods (and will ultimately use all five in different environments)

  • blowing away that subfolder “partial” and see what happens – don't do this at home unless you wish an error next time you go to install, I will explain a simple alternative/remedy.

  • having, and entertaining from you, I hope, many more good housekeeping tips

 

:wizardball:  Wizard






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users