why two commands?

Asked by Mark Faine

Why must I type apt-get ... to download, remove and then apt-cache for searches?

I'd like to suggest as a feature the ability to simply type apt-get search <package>

Sometimes when I try to install a package and I guess the wrong name I get annoyed that I then have to backspace through the entire command to change 'get' to 'cache'. It seems that it shouldn' be necessary. Furthermore, when I type a command that doesn't exist I get a list of possible packages I could install that would contain that command. The same should happen when I type:

sudo apt-get install <wrong package name>

.. possible matches include:
package a
package b
...

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
marcus aurelius (adbiz) said :
#1

you can use the software center or the synaptic package manager that's available on the gnome and kde desktops to search for packages. it's easier than using apt-get

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

aptitude can do all of them if you wish.

apt-get is for only installing and removing (etc) packages. It doesn't care about searching. Similarly apt-cache cannot install packages.

Software-centre is an abstraction for both and gives a single point of contact for both. You could create aliases for both commands to make it look similar/different as you wish

Personnal I have

package-search == apt-cache search
package-install == sudo apt-get install
package-remove == sudo apt-get --purge remove

Which makes life nice

Revision history for this message
Mark Faine (mark-faine) said :
#3

Not much of a gui guy. I use cli and often access desktops remotely over ssh. Two different issues really. I don't think that software center is meant to be a replacement for apt but an alternative.

Revision history for this message
mycae (mycae) said :
#4

Like actionparsnip said, you probably want to install and use aptitude. I find its dependency resolution to be better (in problematic scenarios), and it has a nice CLI-UI (CLUI?) based upon ncurses, if that floats your boat.

I have seen claims that you should not mix apt-get and aptitude though -- not sure why.

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

When I read manpage I'd say the difference is active and passive.
In other words with apt-get I can break my system actively while apt-cache is rather passive.

apt-get - APT package handling utility -- command-line interface
...tool for handling packages, and may be considered the user's "back-end" to other tools using the APT library...
...Several "front-end" interfaces exist, such as dselect(1), aptitude(8), synaptic(8) and wajig(1).

apt-cache - APT package handling utility -- cache manipulator
apt-cache does not manipulate the state of the system

> try to install a package and I guess the wrong name

For me I do it the other way around, I search first, cause I like to read description and learn about dependencies and conflicts.

> backspace through the entire command

Or just use arrow keys, at least it feels faster.
Anyway alias are very helpful e.g.:
alias acs='apt-cache search'
alias sag='sudo apt-get'

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

apt-cache also does NOT require sudo as you are only querying the known package lists (both the installed list and available, to give the status of a package). apt-get actively manipulates the files, deleting files or adding new files so needs sudo

Can you help with this problem?

Provide an answer of your own, or ask Mark Faine for more information if necessary.

To post a message you must log in.