How can I create an alias for apt-get?

You can probably create an alias for that.

Assuming you are using Bash, create a .bash_aliases file in your Home directory, if it already doesn't exist.

Then, add a line with the following to the file:

alias apt='sudo apt-get'

Now close the shell and reopen it again.

Now you can install any new package with the syntax apt install <package-name>. Do note that autocompletion will not work with the alias.


It's probably a bad idea to creat an alias apt to apt-get with recent Debian based distros. Since Debbian Jessie (2015) and Ubuntu 15.10 (2015) there exists the apt command

http://www.debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html#s-apt-get http://manpages.ubuntu.com/manpages/wily/en/man8/apt.8.html

It actually can be used instead of apt-get and apt-cache

  apt-get update             ->  apt update
  apt-get upgrade            ->  apt upgrade
  apt-get dist-upgrade       ->  apt full-upgrade
  apt-get install package    ->  apt install package
  apt-get remove package     ->  apt remove package
  apt-get autoremove         ->  apt autoremove
  apt-cache search string    ->  apt search string
  apt-cache policy package   ->  apt list -a package
  apt-cache show package     ->  apt show package
  apt-cache showpkg package  ->  apt show -a package

It also includes new commans such as full-upgrade which is not in apt-get.