nmap -V
Nmap version 7.80 ( https://nmap.org )
Platform: x86_64-pc-linux-gnu
Compiled with: liblua-5.3.3 openssl-1.1.1d nmap-libssh2-1.8.2 libz-1.2.11 libpcre-8.39 libpcap-1.9.1 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select
which nmap
/usr/bin/nmap
-
wgetis a good tool to download things from the internet.wget -v https://nmap.org/dist/nmap-7.80.tar.bz2 -
tar --exclude='*/*' -tf nmap-7.80.tar.bz2to list only the top level contents of this tarball. Use*/*/*to list two levels. -
After installing from source,
which nmappoints to
/usr/local/bin/nmap
and /usr/local/bin/nmap -V returns
Nmap version 7.80 ( https://nmap.org )
Platform: x86_64-unknown-linux-gnu
Compiled with: nmap-liblua-5.3.5 nmap-libz-1.2.11 nmap-libpcre-7.6 nmap-libpcap-1.9.0 nmap-libdnet-1.12 ipv6
Compiled without: openssl libssh2
Available nsock engines: epoll poll select
But, nmap -V returns the one from /usr/bin/nmap
I don't know why it returned different once, but now it returns from the /usr/local/bin/nmap.
Is it okay to do the following things?
cd /usr/bin
sudo mv nmap nmap.bak
sudo ln -s /usr/local/bin/nmap nmap
You shouldn't do this - "which nmap" should show that the version that you've just installed will load in preference to the default.
Takeaways -
- The prefixes
/usr/local/should be before/usr/in thePATHvariable. Both of which should be before,/binprefixes. The first match to the binary is returned (withwhichcommand, for example), so this makes sense. - Apparently, there is no way to keep track of the packages installed from source for updates. (unless the package itself has some option of doing it, like masterpdfeditor notifies for an update available)
- You can also run the non-default (as in PATH ) version of the software you want from
/usr/binby running it like/usr/bin/nmap -V, etc.
None of these is typically used in production servers, but investigating any of them will certainly increase your knowledge of how Linux works "under the covers" - asking you to make many choices that the production-ready distros such as RHEL and Ubuntu do on your behalf by choosing what they see as sensible defaults.