As you know when we are use apt-get update
, it updates packages list .
So when we want to install an application or upgrade the older ones, it's better to run apt-get update
command to install the Latest application or upgrade to the Latest one .
And here is the question :
What can I do to run apt-get update
command automatically, when I run apt-get install Application
or apt-get upgrade
commands ?
Update : I'm using Ubuntu 16.04 distribution .
You could make aliases that you run instead of the real commands, like this:
To test, you can simply define the aliases for your current session only by running the two lines above directly in your terminal. If you are happy with them, make the definitions persistent for your user account by either appending them to the end of your
~/.bashrc
file or your~/.bash_aliases
file (which you have to create first in case it doesn't exist yet).After the aliases are defined one way or the other, you can use them like this:
running
apt-upgrade
will be equivalent to typingrunning
apt-install SOME PACKAGES
will be equivalent to typing