APT vs APT-GET
Hi
I am using a Nanode with Ubuntu.
Recently I read that apt is newer than apt-get,
and so it is more recommended to use, than the older apt-get.
In your Guides and Tutorials, I see you always use apt-get, and not apt, for various operations.
So shoud I stick to apt-get like you do in your tutorials,
or can I simply replace every "apt-get" with "apt", when doing the tutorials in Linode?
Thank you
6 Replies
Great question. I found this It's Foss article particularly helpful in explaining the differences between "apt" and "apt-get" — "apt" is indeed newer and meant to be more user friendly.
Most of our docs were written before "apt" became a more common command for package management. I'd stick with "apt-get" when it's referenced since that's what was tested on for the docs.
If you're feeling adventurous, though, go ahead and use "apt" and see what happens. You'll probably see "apt" used in online guides more frequently, and seeing how it differs from "apt-get" through trial could be useful experience.
Sure thing @spaceman, this was a fun rabbit hole to fall down. I did some more digging, and a quick tip on getting a sense of the difference between "apt" and "apt-get" is to run them with the help option to review their respective, most-used commands and additional sources of info:
apt help
apt-get help
As always, man pages are good to review if you really want to dig deep:
man apt
man apt-get
To highlight the usefulness of man pages, I pulled this helpful piece of advice from the "apt" man page:
All features of apt(8) are available in dedicated APT tools like apt-get(8) and apt-cache(8) as well. apt(8) just changes the default value of some options (see apt.conf(5) and specifically the Binary scope). So you should prefer using these commands (potentially with some additional options enabled) in your scripts as they keep backward compatibility as much as possible.
I generally use apt
– I prefer its output compared to apt-get
, and I like that apt
allows me to search, so I don't need to remember to use apt-cache
:
$ apt search ncdu
Sorting... Done
Full Text Search... Done
ncdu/stable 1.13-1+b1 amd64
ncurses disk usage viewer
netcdf-bin/stable 1:4.6.2-1 amd64
Programs for reading and writing NetCDF files
$ apt-cache search ncdu
ncdu - ncurses disk usage viewer
netcdf-bin - Programs for reading and writing NetCDF files