7 ms·
The apt command: Combining apt-get and apt-cache and adds a progress bar (2014)
- ianlevesque 11y agoReally cool. Somehow I had missed the introduction of this but it's a friendlier interface and already on my Ubuntu systems.
- nherment 11y agoSame here, I can't believe we're a few years late. Much better than the apt-get / apt-cache stupidity.
- cryowaffle 11y agoHarsh, this must have really upset you.
- dave2000 11y agoPerhaps not upset, just intolerant of really lame, unintuitive crap software?
- enesunal 11y agov1.1: https://mvogt.wordpress.com/2015/11/30/apt-1-1-released/ https://mvogt.wordpress.com/2015/11/30/apt-1-1-released/
- mikelward 11y agoWhy not just alias apt=aptitude?
- deelowe 11y agoYea... My thoughts as well?
- quadrangle 11y agoapt has colors, aptitude doesn't… ?
- lorenzhs 11y agoaptitude has a nice curses interface, though, which is great for resolving conflicts or other changes that require planning
- pherq 11y agoIt 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).
- lorenzhs 11y agoThe 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.
- deelowe 11y agoI'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.
- CydeWeys 11y agoSame. 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.
- Drdrdrq 11y agoNot sure why you were downvoted, I agree 100%. I try to use aptitude CLI for exactly this reason.
- colejohnson66 11y agoI 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
- jafingi 11y agoAnd remove an application with apt-get? I prefer yum and dnf much over apt.
- adricnet 11y agoOnly 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.
- pherq 11y agoapt-get source works fine without super-user privileges, so it isn't just that some have to be run as root.
- yahyaheee 11y agoFinally! why has this taken so long? Common sense people
- exprI 11y agoI mostly use aptdaemon (with aptdcon), because you don't need to elevate privileges every time.
- Drdrdrq 11y agoIs 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.
- rincebrain 11y agoIt's provided by the same package as e.g. apt-get and apt-cache, so yes.
- Drdrdrq 11y agoThanks for the info, appreciate it!
- rcthompson 11y agoI've already been using wajig for years now. It combines these two and about a dozen other utilities into one command.
- joshstrange 11y agoWow, I've never heard of this, pretty neat! Thanks for sharing.
- jimrandomh 11y agoThere'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.
- matt_wulfeck 11y agoI 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.
- dsl 11y ago> If I find myself shelling out to grep with pcre flags, I am using unix pipes as intended Fixed that for you.
- davvolun 11y agoHmm...except that I would guess search should do one thing well -- searching. Which, incidentally, using --name-only and/or regex, it does.
- iam-TJ 11y agoSearch 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.html http://manpages.ubuntu.com/manpages/xenial/en/man8/apt.8.htm...
- robin__ 11y agoWill it take twice the amount of time with the progress bar enabled?
- clebio 11y agoI 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)
- jasonjayr 11y agoDid 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 ...
- clebio 11y agoAll valid points, but (anecdotally) over the past several years of work, this holds true.
- vacri 11y agoYou 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.
- tetraodonpuffer 11y agoalso 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
- mixmastamyk 11y agoIf 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/ 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
- esaym 11y agoWonder how it compares to aptitude? Used to be (10 years ago), aptitude was better and not orphaning packages on removal. Been using ever since..
- lobster_johnson 11y agoI 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.
- 0x006A 11y agoi like the recent changes in debian. finally most of the use cases are covered
- vmorgulis 11y agoHere 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.
- saltvedt 11y agohttps://wiki.debian.org/UnattendedUpgrades https://wiki.debian.org/UnattendedUpgrades
- vmorgulis 11y agoThank you a lot!
- newman314 11y agoYou 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.
- vmorgulis 11y agoThank 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).
- newman314 11y agoFYI http://askubuntu.com/questions/3167/what-is-difference-between-the-options-autoclean-autoremove-and-clean 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.
- 11y ago
- HeadlessChild 11y agoI had no idea about this and I maintain (only) Debian and Ubuntu based clients everyday..