Let's break it down.
First of all, few notes on how apt-get install
(and most other apt-get
arguments too) works:
You can input multiple package names:
sudo apt-get install foobar spamegg
The package names are actually Extended Regular Expression (ERE) (Check man 7 regex
) patterns so a package name foo.bar
means any package name that has a substring that starts with foo
and ends with bar
with any single character between foo
and bar
. Likely f.*r
means any package name that contains a substring that has f
and r
with any number of characters i.e. anything in between. To do the whole package name matching, use start and end tokens e.g. ^foo.bar$
. If you want any Regex token to be treat literally then you need to escape the token with \
e.g. for treating foo.bar
literally, you need:
sudo apt-get install 'foo\.bar'
Here the single quoting is to prevent shell interpretation of the pattern as a globbing pattern, not necessary in this case but would be needed e.g. for pattern foo.*bar
if you have a file in the current directory named e.g. foo.bar
.
There is a catch on the package name consideration. If there is any package matching the pattern, the pattern will be treated literally and no Regex interpretation will be done. For example, for a package pattern g++
, it will match the package g++
literally irrespective of the Regex token +
. If there were no package named g++
in the defined repositories, it will be treated as a ERE pattern.
Now, you have given the command:
sudo apt-get install g++ 5.0
This means:
You want to install two patterns provided packages namely g++
and 5.0
g++
matches the literal meta-package g++
as mentioned above
The remaining portion, 5.0
, has a Regex token, .
i.e. any single character. So this will match any package name that contains 5<any_character>0
. So all the packages that have the match has been selected to be installed and presumably virtualbox-5.0
has also been selected in the process.
Presumably you want to install g++
version 5
, so doing the following would do(already mentioned in this answer); The meta-package, g++-5
, will refer to the latest available minor released package of g++
version 5:
sudo apt-get install g++-5
To search for any packages, within the configured repositories, use apt-cache
(uses ERE like apt-get
):
apt-cache search 'g\+\+-[0-9]+'
If you do not want to Regex-ify it, use less
to scroll down the rather larger list:
apt-cache search g++ | less
Also before installing anything you are not sure about, do not use -y
(--assume-yes
) option and test it first with -s
(--simulate
/--dry-run
):
sudo apt-get install --dry-run foobar
apt-get
will ask confirmation from the user, so you could just insertn
and avoid installing VirtualBox... Also Ubuntu's repository are checked, so there shouldn't be any malware package that you can install in the first place. If you add random PPAs this might happen but that's because you told Ubuntu to install applications from an untrusted source.a major security issue with the Linux terminal
No, calm down. This was just (no offence!) you not reading/typing properly - not any problem with Linux,apt-get
, or any of the many different terminals that are available.