Delete files in /var/cache/apt/archives?

Asked by Henry Peters

Little by little I am finding the structure & inner workings of Linux/Ubuntu 8.04.1. Recently, on a problem solving mission, I came across '/var/cache/apt/archives' & saw a whole bunch of compressed download/installed packages, some that were pre-upgrade. My questions are these (probably embarrassingly obvious):

1.) Is it ok (& safe) to delete any or all of these files in this directory that seem passed potential usefulness? & if so, can I just use 'send to trash,' etc.

2.) Can I use this directory to extract files that I wish to use for reinstallation, etc.? Or do I need to use 'apt-get' etc.? In other words, is this a user, directly workable space (i.e., not necessarily through the command line/terminal)?

Thanks much for any insights.

Henry

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andrew (and471) said :
#1

1) Yes, you can safely delete files in here as they are just for cache (ie. if you need to install something previously fetched, these can be used for quick access), however I would recommend using the command:

sudo apt-get clean

As this deletes only the files that need to be, using apt-get. (you can also replace 'clean' for 'autoclean', to only delete *old* packages).

2) Could you explain this question again as I think i see what you mean, but I am not sure

Revision history for this message
jacobS (jacsalomon) said :
#2

Answers:

1) A save mode to delete this files is an apt option: autoclean

sudo apt-get autoclean

2) You can install a pakages with extension .deb only with:

sudo dpkg -i <nameofpackage.deb>

Revision history for this message
Sam_ (and-sam) said :
#3

Hi Henry,
in addition to suggestions above there is also a graphical way, if e.g. you are using a package manager like Synaptic to install or search for applications. There is a history available and options if downloaded packages should be deleted right away, kept or removed manually.
https://help.ubuntu.com/community/SynapticHowto#How%20to%20free%20disk%20space

Enjoy Ubuntu

Revision history for this message
Henry Peters (hwpeters) said :
#4

Hi Rugby & Jacob,

First, I think there are files I do wish to hang on to (for the moment, anyway), & while I do appreciate knowing about the 'sudo apt-get autoclean', as I am sure this will come in handy when my system is a little less chaotic than it currently is, due to massive trial & error, etc., kinds of installations I have been doing presently, to get to know about Linux & its limitations, getting various dependencies for compilation, etc., I would like also like to know if I may go thru the various files in that directory & take each one, I do not wish to archive, & send it to the trash for deletion, one by one. UPDATE: I just checked, & 'move to trash' is apparently not an option with a right click on the file in the /apt directory... & if I try to drag a file to the trash, it says it will be deleted immediately (this might be ok for what I (think I) wish to do? but I did not actually try it yet.

Second question rephrased (sort of); I have been downloading various programs, .gz, .deb, etc., into my /home/henry directory, extracting to there (the only option when you right click a compressed file (?)), & then configuring/building, & so forth. I was wondering, can I do this with some of the files, all ready in the apt archive, or perhaps non of those files, can you do a user compile/build/install? In other words, I think I may now be answering my own question? But barring this, what are the allowable, workable ways to install applications, programs, & etc. in the /apt directory? UPDATE: I now see that the menu options change in the /apt directory when you right click, it says "extract to,,," & perhaps that is the answer to my question? i.e., you have to use 'apt-get' or extract the file to another location?

Thanks much for your help!

Henry

Revision history for this message
Henry Peters (hwpeters) said :
#5

Hi Sam,

You replied while I was writing my previous message. Thanks much! That looks like an excellent reference. I'm sure it will help here, & especially when things go wrong & or get confusing, & one needs reminders & or clues as what to do or not do (& to appease the itch to put the finger on the panic button/s :) ).

Thanks again.

Henry

Revision history for this message
Sam_ (and-sam) said :
#6

Hi again,
on personal I wouldn't make experiments within /var directory.
Experimental install and uninstall operations can implement dependencies which a common user might not overlook, it's just a matter of time not indication so to speak. Therefore Ubuntu offers tools like a package manager which handles dependencies.

However a good idea would be having the home/user directory on a separate partition so experiments don't harm the rest of the system, in particular root directories. Others even prefer to have separate partitions for boot, var, etc.

For install and uninstall matters are directory options like /opt or .local (dot means hidden in home/user).
Here is an overview of usability
https://help.ubuntu.com/community/LinuxFilesystemTreeOverview

To avoid panic the solution is: backup

Have fun

Revision history for this message
mfauzirahman (mfauzirahman) said :
#7

Any update on this issue?
How can we solved it?

Can you help with this problem?

Provide an answer of your own, or ask Henry Peters for more information if necessary.

To post a message you must log in.