!!
has nothing to do with apt-get
. It is a shell keyword that will be expanded to the previous command. This expansion is done by shell before the current command is interpreted.
From man bash
:
!! Refer to the previous command. This is a synonym
for `!-1'.
For example, if you run a command:
echo "foo"
Then if you run:
sudo apt-get install !!
it will be expanded to :
sudo apt-get install echo foo
As you can see it is expanded into two packages namely echo
and the other is foo
. There is no standalone package named foo
and echo
. Apart from the shell builtin echo
there is /bin/echo
executable that is a part of the GNU-coreutils package. So, you will get errors saying that no such packages are available.
On the other hand the other person might be doing something like this:
$ cowsay
The program 'cowsay' is currently not installed. You can install it by typing:
sudo apt-get install cowsay
$ sudo apt-get install !!
sudo apt-get install cowsay
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
filters
The following NEW packages will be installed:
cowsay
0 upgraded, 1 newly installed, 0 to remove and 119 not upgraded.
Need to get 18.5 kB of archives.
As you can see cowsay
is being installed.
I would suggest you to not doing this (unless you are sure), being explicit does not harm.