Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I remember that on one Debian system, I used apt install package to install a package. It asked for a password afterwards and was more convenient than sudo apt-get install.

Now I am not sure how I managed to use the first command. Can you help?

share|improve this question
up vote 10 down vote accepted

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.

share|improve this answer
    
you are right, and since i'am using zsh autocompletion still works, that's great thanks. – Jeremia Aug 22 '12 at 11:14
1  
The question mentions Debian which does not use sudo by default. In Debian, you have to create alias which use root privilege in /root/.bashrc. – ppr Dec 12 '15 at 23:50

Open up your bash_profile or bashrc. (Probably in ~/.bashrc or ~/.bash_profile). Now add the line alias apt='sudo apt-get'. Now save the file, quit your terminal, and reopen it.

share|improve this answer
    
jokerdino beat me to the answer. Using .bash_aliases is probably better than using .bashrc, but jokerdino's answer won't give you the exact syntax you wanted. If you type my line into .bash_aliases (or .bashrc), then you will be able to use the command 'apt install <package>' rather than 'aptinstall <package>'. – daviewales Aug 22 '12 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .