I'm tired of always writing sudo apt-get install <package>
whenever I need to download something, so is there a way for me to make the terminal understand that when I write sagi <package>
, I really mean sudo apt-get install <package>
?
Asked
Active
Viewed 210 times
1

Ben Halford
- 15
1 Answers
4
Add this line to your ~/.bashrc
alias sagi='sudo apt-get install'
Then run source ~/.bashrc
for the change to take effect.
Alternatively, you could add the line to .bash_aliases
. This is a nice way to separate simple aliases from more substantive code that you might want to run when you start your bash shell. By default, your .bashrc
should load in any definitions you make in .bash_aliases
.
You may not have this file, so first:
touch ~/.bash_aliases
If the file already exists, touch will simply update its timestamp. If not, it will create it. Either way, open up your favorite text editor and add the alias line from above.
~/.bash_aliases
might be a more proper place. – heynnema May 24 '17 at 19:24
– jarleih May 24 '17 at 20:27if [ -f ~/.bash-aliases ]; then . ~/.bash-aliases fi