News for hackers. Stuff that matters.
Re:The apt command: Combining apt-get and apt-cache and adds... by deelowe on Saturday March 05, 2016 @11:28AM (#11229912)
I've never understood why debian insists on having these be different commands. It would make sense if install, search, upgrade and uninstall were all discrete, but the way it is today feels half implemented.
Re:The apt command: Combining apt-get and apt-cache and adds... by CydeWeys on Saturday March 05, 2016 @11:36AM (#11229936)
Same. Having to search for what you wanted to install via apt-cache, but then actually install it via apt-get, was a triumph of some unexplainable factor over usability.
Re:The apt command: Combining apt-get and apt-cache and adds... by Drdrdrq on Saturday March 05, 2016 @11:43AM (#11229960)
Not sure why you were downvoted, I agree 100%. I try to use aptitude CLI for exactly this reason.
Re:The apt command: Combining apt-get and apt-cache and adds... by colejohnson66 on Saturday March 05, 2016 @01:01PM (#11230211)
I want to say it has to do with keeping each "idea" as a separate program, but the fact that apt-get can install, uninstall, list packages, etc. seems to go against that idea
Re:The apt command: Combining apt-get and apt-cache and adds... by jafingi on Saturday March 05, 2016 @05:06PM (#11231293)
And remove an application with apt-get? I prefer yum and dnf much over apt.
Re:The apt command: Combining apt-get and apt-cache and adds... by adricnet on Saturday March 05, 2016 @11:39AM (#11229944)
Only one of them requires readwrite system administrator privileges (eg sudo). apt-cache can be run by any user as it doesn't expose any secret data and can't be used to make changes. apt-get can install and uninstall software as well as download packages and thus needs root privileges in the classic UNIX model.
Re:The apt command: Combining apt-get and apt-cache and adds... by CydeWeys on Saturday March 05, 2016 @11:53AM (#11229999)
apt-get doesn't fail when run as non-root, it only fails when you run it as non-root when you try to some of the commands that require root privileges (such as installing system level packages). It has lots of commands that don't need root privileges. I don't see much reason why "list all the packages available for installation", as well as the other commands in apt-cache, aren't included in that list.
Re:The apt command: Combining apt-get and apt-cache and adds... by pherq on Saturday March 05, 2016 @11:48AM (#11229980)
apt-get source works fine without super-user privileges, so it isn't just that some have to be run as root.
Re:The apt command: Combining apt-get and apt-cache and adds... by krylon on Sunday March 06, 2016 @04:16AM (#11233037)
On CentOS, I can do "yum search something" as a regular user, while "yum install something" or "yum upgrade" require root privileges.

I think it's similar with the pkg command on FreeBSD.

Re:The apt command: Combining apt-get and apt-cache and adds... by konfou on Sunday March 06, 2016 @06:22AM (#11233334)
and same with pacman on Arch (and derivatives)
Re:The apt command: Combining apt-get and apt-cache and adds... by currysausage on Saturday March 05, 2016 @12:58PM (#11230200)
"aptitude [...] is a friendly frontend to apt."

"The primary command line tool is aptitude. apt-get fulfills a similar purpose and although it is no longer the recommended primary tool some still use it."

If you prefer the apt-* commands: "You can also use Wajig, for an unified and more logical command-line interface to all package management functions." (Apparently, apt is the new Wajig, except that apt doesn't automagically sudo, which Wajig did.)

See https://wiki.debian.org/DebianPackageManagement

Re:The apt command: Combining apt-get and apt-cache and adds... by miken123 on Saturday March 05, 2016 @03:08PM (#11230828)
Yeah, until you do an upgrade:

"The upgrade process for some previous releases recommended the use of aptitude for the upgrade. This tool is not recommended for upgrades from wheezy to jessie."

See https://www.debian.org/releases/stable/amd64/release-notes/c...

Re:The apt command: Combining apt-get and apt-cache and adds... by creshal on Saturday March 05, 2016 @04:23PM (#11231151)
Debian's zigzagging between package management frontends (dselect, apt-*, aptitude, dpkg, now apt?, … all in use in parallel) is incredibly frustrating. Pacman e.g. is so much easier to use because everything's in one well-structured command.
Re:The apt command: Combining apt-get and apt-cache and adds... by toyg on Saturday March 05, 2016 @05:48PM (#11231463)
It probably reflects the classic problem of developer turnover in OSS projects and the resulting approach to technical debt. Old developers fade away, young guns come through (often still in academia), "this code is all crap, let's chuck it out and build something better, how hard can it be?"...
Re:The apt command: Combining apt-get and apt-cache and adds... by julian-klode on Sunday March 06, 2016 @06:55AM (#11233448)
Well, just use apt(8):

apt install - Install packages

apt remove - Remove packages

apt upgrade - Upgrade packages without removing

apt full-upgrade - Upgrade packages, allowing removals

apt update - Refresh sources

apt show - Show a package

apt list - List packages, you can filter by stuff like --installed or --upgradable

Re:The apt command: Combining apt-get and apt-cache and adds... by creshal on Sunday March 06, 2016 @12:00PM (#11234455)
1. "Just use $newtool" has been Debian's spiel for every past release, and every time it's a different one.

2. Why full-upgrade and not dist-upgrade like in all the other debian package managers? Would that little bit of internal consistency really have hurt?

3. Still does not seem to cover all use cases.

Re:The apt command: Combining apt-get and apt-cache and adds... by __david__ on Monday March 07, 2016 @02:50AM (#11237648)
I don't know what you mean. dselect is like 2000 era, and was replaced by "aptitude" at least 15 years ago. "apt" has been around since the beginning and still works just fine. The fact that "aptitude" has some overlap with "apt" is a detail--its real strength is that its curses ui (which was a massive improvement over dselect).
Re:The apt command: Combining apt-get and apt-cache and adds... by nextos on Saturday March 05, 2016 @12:08PM (#11230039)
Same here, I've always found them strange.

In contrast, pacman or guix are quite intuitive and feel better designed.

Re:The apt command: Combining apt-get and apt-cache and adds... by hndl on Saturday March 05, 2016 @12:17PM (#11230064)
I hear you. Back when I was on debian I had a small script I called apt-o ('o' for oblivious) which combined the two -- as you mention.
Re:The apt command: Combining apt-get and apt-cache and adds... by asymmetric on Saturday March 05, 2016 @02:29PM (#11230646)
The way I see it, the distinction is that apt-get requires the network to be up, whereas apt-cache, as the name suggests, doesn't.
Re:The apt command: Combining apt-get and apt-cache and adds... by __david__ on Saturday March 05, 2016 @03:24PM (#11230910)
Except for "apt-get remove".
Re:The apt command: Combining apt-get and apt-cache and adds... by jimrandomh on Saturday March 05, 2016 @12:05PM (#11230029)
There's another thing about apt that's bothered me: apt-cache search isn't a very good search engine. Its most common use case is finding the exact name of some library/framework package, ie, "apt-cache search someframework". For common frameworks, this produces hundred of search results for packages that use the framework and mention this in their description, while the framework itself is in the list but very difficult to find. The --names-only flag fixes this, but it's not the default so it's one more thing to worry about.
Re:The apt command: Combining apt-get and apt-cache and adds... by matt_wulfeck on Saturday March 05, 2016 @12:15PM (#11230056)
I have this problem too. If I did myself shelling out to grep with pcre flags to find a simple library then there's a UX issue.
Re:The apt command: Combining apt-get and apt-cache and adds... by iam-TJ on Saturday March 05, 2016 @01:35PM (#11230388)
Search uses regular expressions so generally no need for grep unless you need more complex filters; --names-only has the -n short-form:

  apt-cache search -n <regexp>
More generally apt-get and apt-cache are designed to be backward-compatible for use in scripts whereas apt is not[0]:

  SCRIPT USAGE AND DIFFERENCES FROM OTHER APT TOOLS

       The apt(8) commandline is designed as an end-user tool and it may change behavior between versions. While it tries not to break backward compatibility this is not guaranteed either if a change seems beneficial for interactive use.
[0] http://manpages.ubuntu.com/manpages/xenial/en/man8/apt.8.htm...
Re:The apt command: Combining apt-get and apt-cache and adds... by matt_wulfeck on Sunday March 06, 2016 @01:02AM (#11232677)
Great tip thank you!
Re:The apt command: Combining apt-get and apt-cache and adds... by dsl on Saturday March 05, 2016 @01:09PM (#11230251)
> If I find myself shelling out to grep with pcre flags, I am using unix pipes as intended

Fixed that for you.

Re:The apt command: Combining apt-get and apt-cache and adds... by davvolun on Monday March 07, 2016 @04:57PM (#11242070)
Hmm...except that I would guess search should do one thing well -- searching. Which, incidentally, using --name-only and/or regex, it does.
Re:The apt command: Combining apt-get and apt-cache and adds... by robin__ on Saturday March 05, 2016 @12:13PM (#11230053)
Will it take twice the amount of time with the progress bar enabled?
Re:The apt command: Combining apt-get and apt-cache and adds... by clebio on Saturday March 05, 2016 @12:29PM (#11230097)
I can't answer specifically for `apt`, but many commands take significantly longer if you let them display to stdout versus piping their output to a file or `/dev/null`. cf.:

  $ time ls -R /usr
  real    0m7.570s
  user    0m0.104s
  sys     0m2.286s

  $ time ls -R /usr > /dev/null
  real    0m0.193s
  user    0m0.036s
  sys     0m0.154s

(edit: when will I grok HN markup?? cough support markdown cough)
Re:The apt command: Combining apt-get and apt-cache and adds... by jasonjayr on Saturday March 05, 2016 @12:45PM (#11230152)
Did you run those two commands in sequence? Did you account for disk-cache effects? Try running it 4 times, alternating the versions and see what your last 2 times are ...
Re:The apt command: Combining apt-get and apt-cache and adds... by vacri on Saturday March 05, 2016 @06:46PM (#11231691)
You can actually show different speeds in different terminals - the speed of terminal rendering affects the duration of the test. In the tests below, I have no custom terminal prompts or similar (no git status lines etc) - they're all distribution defaults running bash.

    # all the below run in the same MATE desktop
    # lxterm (from lxde - is easiest on my eye)
    $ time ls -R /usr
    real    0m19.974s
    user    0m0.860s
    sys	    0m0.832s

    # gnome terminal
    $ time ls -R /usr
    real    0m19.902s
    user    0m0.800s
    sys     0m0.776s

    # xterm (yes, it really is 10x the speed)
    $ time ls -R /usr
    real    0m1.872s
    user    0m0.856s
    sys     0m0.800s

    # rerun in the first terminal, and the time hasn't changed - still 19s

    # now in lxterm redirecting to null
    # (and xterm gives similar results here)
    $ time ls -R /usr > /dev/null

    real    0m0.418s
    user    0m0.256s
    sys     0m0.156s

All that prettification and rendering takes time; if you want raw speed, use xterm... or pipe output to /dev/null.

Interestingly, 'time' on gterm and lxterm had tabs between the above field:value pairs (I had to reformat to show them nicely), but xterm used spaces. I don't know enough about the terminal underpinnings to guess as to why.

Re:The apt command: Combining apt-get and apt-cache and adds... by clebio on Saturday March 05, 2016 @02:48PM (#11230733)
All valid points, but (anecdotally) over the past several years of work, this holds true.
Re:The apt command: Combining apt-get and apt-cache and adds... by josho on Saturday March 05, 2016 @03:46PM (#11231017)
I've always assumed something like the above is slow due to the terminal blocking the program to perform updates to the display.

Whereas a status indicator isn't exactly pushing much data to the terminal. So, It shouldn't impact run time.

Re:The apt command: Combining apt-get and apt-cache and adds... by clebio on Saturday March 05, 2016 @07:28PM (#11231840)
I also suspect (though have not verified) that any output to terminal is quite a bit slower than the raw operation -- that sort of difference that we should all know, as programmers.

http://norvig.com/21-days.html#answers

Re:The apt command: Combining apt-get and apt-cache and adds... by clebio on Saturday March 05, 2016 @05:13PM (#11231314)
Yes, that's a reasonable assumption. I am by no means a terminal guru, but my understanding is that, for something like a progress bar or spinner (anything that is updated in-place in the terminal), the entire "screen" is being redrawn on update.
Re:The apt command: Combining apt-get and apt-cache and adds... by tetraodonpuffer on Saturday March 05, 2016 @01:07PM (#11230241)
also don't forget apt-file (very useful to find out which package contains the library/binary you want to install) and dpkg -L to figure out what a particular package installed on your system.

I switched to debian some time ago and it's interesting so many different commands are used for package management, this said I personally have an alias ap=sudo aptitude -t jessie-backports alias and use that as a command line interface for search/install, and run the full aptitude gui only when doing updates

Re:The apt command: Combining apt-get and apt-cache and adds... by pbhjpbhj on Sunday March 06, 2016 @07:58AM (#11233599)
Yes to apt-file, and 'apropos' seems to fit in there too (searches for keywords in package descriptions).
Re:The apt command: Combining apt-get and apt-cache and adds... by pbhjpbhj on Monday March 07, 2016 @08:23AM (#11238695)
Replying because can't edit: "apt search $keyword" works like apropos but isn't in the tab completion on my Kubuntu 15.10.
Re:The apt command: Combining apt-get and apt-cache and adds... by enesunal on Saturday March 05, 2016 @11:18AM (#11229885)
Re:The apt command: Combining apt-get and apt-cache and adds... by rcthompson on Saturday March 05, 2016 @11:54AM (#11230000)
I've already been using wajig for years now. It combines these two and about a dozen other utilities into one command.
Re:The apt command: Combining apt-get and apt-cache and adds... by joshstrange on Saturday March 05, 2016 @12:51PM (#11230173)
Wow, I've never heard of this, pretty neat! Thanks for sharing.
Re:The apt command: Combining apt-get and apt-cache and adds... by esaym on Saturday March 05, 2016 @01:20PM (#11230304)
Wonder how it compares to aptitude? Used to be (10 years ago), aptitude was better and not orphaning packages on removal. Been using ever since..
Re:The apt command: Combining apt-get and apt-cache and adds... by ianlevesque on Saturday March 05, 2016 @10:36AM (#11229728)
Really cool. Somehow I had missed the introduction of this but it's a friendlier interface and already on my Ubuntu systems.
Re:The apt command: Combining apt-get and apt-cache and adds... by nherment on Saturday March 05, 2016 @11:13AM (#11229869)
Same here, I can't believe we're a few years late. Much better than the apt-get / apt-cache stupidity.
Re:The apt command: Combining apt-get and apt-cache and adds... by cryowaffle on Saturday March 05, 2016 @11:18AM (#11229886)
Harsh, this must have really upset you.
Re:The apt command: Combining apt-get and apt-cache and adds... by dave2000 on Saturday March 05, 2016 @01:00PM (#11230207)
Perhaps not upset, just intolerant of really lame, unintuitive crap software?
Re:The apt command: Combining apt-get and apt-cache and adds... by mixmastamyk on Saturday March 05, 2016 @01:11PM (#11230259)
If you'd like to try this right away (not have to wait) on any version of Debian/Ubuntu (just need pip) try this script I wrote several years ago:

https://pypi.python.org/pypi/apt-wrapper/

No prog bar but it handles all common tasks, ppa's, and elevates with sudo automatically. For example:

    > pip install apt-wrapper 
    > apt in foobar
Re:The apt command: Combining apt-get and apt-cache and adds... by vmorgulis on Saturday March 05, 2016 @02:10PM (#11230564)
Here is my "apt-upgrade.sh"

    apt-get -y update
    apt-get -y upgrade
    apt-get -y dist-upgrade
    apt-get -y autoremove
I run that everyday.
Re:The apt command: Combining apt-get and apt-cache and adds... by saltvedt on Saturday March 05, 2016 @02:16PM (#11230587)
Re:The apt command: Combining apt-get and apt-cache and adds... by vmorgulis on Saturday March 05, 2016 @02:29PM (#11230643)
Thank you a lot!
Re:The apt command: Combining apt-get and apt-cache and adds... by newman314 on Saturday March 05, 2016 @02:18PM (#11230599)
You missed autoclean. I typically only run autoremove upon reboot.

You can also set the update to happen automatically so that all you have to do is run upgrade.

Re:The apt command: Combining apt-get and apt-cache and adds... by vmorgulis on Saturday March 05, 2016 @02:23PM (#11230624)
Thank you for "autoclean". I'll check that.

> You can also set the update to happen automatically so that all you have to do is run upgrade.

I'm in "testing". Sometimes, even with "-y", I'm asked to validate some messages (often inside a vi prompt).

Re:The apt command: Combining apt-get and apt-cache and adds... by newman314 on Saturday March 05, 2016 @03:04PM (#11230809)
FYI

http://askubuntu.com/questions/3167/what-is-difference-betwe...

It cleans out unnecessary packages.

All the update does is download the latest available updates so it should not be prompting. My experience is that only upgrade/dist-upgrade will prompt.

I've got a VM running ubuntu 16.04-beta and it seems to be fine.

Re:The apt command: Combining apt-get and apt-cache and adds... by vmorgulis on Saturday March 05, 2016 @03:23PM (#11230903)
Thank you for the link.

> My experience is that only upgrade/dist-upgrade will prompt.

Re:The apt command: Combining apt-get and apt-cache and adds... by __david__ on Saturday March 05, 2016 @03:28PM (#11230933)
I do something similar, but use

    aptitude -y safe-upgrade
...which is less likely to break things. Every month or so I go into aptitude to manually sort things out that have gotten their dependencies wedged.
Re:The apt command: Combining apt-get and apt-cache and adds... by vmorgulis on Saturday March 05, 2016 @03:37PM (#11230968)
> aptitude -y safe-upgrade

Interesting. My use of aptitude is limited to "search" so far.

Did you see that?

https://news.ycombinator.com/item?id=11230828

Re:The apt command: Combining apt-get and apt-cache and adds... by toyg on Saturday March 05, 2016 @02:23PM (#11230620)
dist-upgrade every day, really ? That's a recipe for trouble, unless you're running Sid, which means you're already in trouble.

Source: my previous life.

Re:The apt command: Combining apt-get and apt-cache and adds... by vmorgulis on Saturday March 05, 2016 @02:28PM (#11230636)
Sid is unstable, isn't it?

I tried it a bit but it's very (very) unstable :-)

I come from Fedora and have few months only on debian. Still a rookie.

Re:The apt command: Combining apt-get and apt-cache and adds... by toyg on Saturday March 05, 2016 @03:15PM (#11230870)
Yeah, Sid is the rolling unstable. It's still slower and relatively more stable than most rolling distributions, but it's constantly changing here and there and everywhere. Using it as your main desktop machine is a recipe for trouble, especially when major changes start rolling in. The only certainty with Sid is that your disk will work a lot because of the firehose of updated packages streaming in at every hour...
Re:The apt command: Combining apt-get and apt-cache and adds... by vmorgulis on Saturday March 05, 2016 @03:31PM (#11230945)
> .. It's still slower and relatively more stable than most rolling distributions ...

My experience is a "non-beta" Fedora is less stable than a "testing" debian.

> ...Using it as your main desktop machine is a recipe for trouble ...

Yes! It's a nightmare especially with Gnome Shell.

I see memory corruptions for months in Gnome windows. I wonder if it's related to Wayland stuff. It often occurs in Firefox.

Re:The apt command: Combining apt-get and apt-cache and adds... by JBReefer on Saturday March 05, 2016 @03:09PM (#11230840)
I'd run a distributed for the fact that all was one command alone
Re:The apt command: Combining apt-get and apt-cache and adds... by lobster_johnson on Saturday March 05, 2016 @01:33PM (#11230378)
I love this, but its terminal magic isn't working properly for me. "apt install stuff" places a progress bar at the moment, then prints some misaligned stuff and then finally manages to clear the screen (!).

Any terminal settings I need to adjust? I'm using OS X's Terminal.app, terminal declared as xterm-256color, via SSH, under zsh.

Re:The apt command: Combining apt-get and apt-cache and adds... by mikelward on Saturday March 05, 2016 @11:18AM (#11229889)
Why not just alias apt=aptitude?
Re:The apt command: Combining apt-get and apt-cache and adds... by quadrangle on Saturday March 05, 2016 @11:34AM (#11229928)
apt has colors, aptitude doesn't… ?
Re:The apt command: Combining apt-get and apt-cache and adds... by lorenzhs on Saturday March 05, 2016 @11:45AM (#11229970)
aptitude has a nice curses interface, though, which is great for resolving conflicts or other changes that require planning
Re:The apt command: Combining apt-get and apt-cache and adds... by pherq on Saturday March 05, 2016 @11:49AM (#11229984)
It also usually seems to be slower to start (at least in my experience) -- I tend to not like to use it except for resolving broken packages (since it's the nicest way to do that).
Re:The apt command: Combining apt-get and apt-cache and adds... by lorenzhs on Saturday March 05, 2016 @02:31PM (#11230653)
The latest version in Debian unstable (0.7.7) seems to have brought some improvements in startup time. Generally the recent progress has been very nice.
Re:The apt command: Combining apt-get and apt-cache and adds... by deelowe on Saturday March 05, 2016 @11:27AM (#11229910)
Yea... My thoughts as well?
Re:The apt command: Combining apt-get and apt-cache and adds... by HeadlessChild on Saturday March 05, 2016 @02:45PM (#11230718)
I had no idea about this and I maintain (only) Debian and Ubuntu based clients everyday..
Re:The apt command: Combining apt-get and apt-cache and adds... by Drdrdrq on Saturday March 05, 2016 @11:41AM (#11229950)
Is this installed by default on Debian? If not, then this is a deal-breaker for me. I might as well install aptitude which also provides a similar command line interface.
Re:The apt command: Combining apt-get and apt-cache and adds... by rincebrain on Saturday March 05, 2016 @11:45AM (#11229967)
It's provided by the same package as e.g. apt-get and apt-cache, so yes.
Re:The apt command: Combining apt-get and apt-cache and adds... by Drdrdrq on Sunday March 06, 2016 @04:47PM (#11235705)
Thanks for the info, appreciate it!
Re:The apt command: Combining apt-get and apt-cache and adds... by 0x006A on Saturday March 05, 2016 @02:07PM (#11230550)
i like the recent changes in debian. finally most of the use cases are covered
Re:The apt command: Combining apt-get and apt-cache and adds... by yahyaheee on Saturday March 05, 2016 @11:39AM (#11229945)
Finally! why has this taken so long? Common sense people