Question:
I have noticed that while on Ubuntu, if I type the following:
mc
and it isnt installed, I get the message below:
The program 'mc' is currently not installed. You can install it by typing: sudo apt-get install mc
However in Debian, that is not available. It just gives a “-bash: /usr/bin/mc: No such file or directory” message. How can I implement the same functionality in bash command line on Debian? Yes, I know that if it is package suggestion that I want, I can simply do a regex search using *apt-cache search*. However I was hoping for the simpler suggestion immediately on typing the name of the program.
As per discussions, the functionality is provided by the package command-not-found. However even after installing it, and also installing bash-completion package, this isnt available on the Debian bash shell.
Answer:
The suggestions are definitely provided by the package command-not-found.
However after installing the package, one needs to run the following command once to initialize the database:
update-command-not-found
After doing this, bash starts providing suggestions to install the correct package.
$htop Could not find the database of available applications, run update-command-not-found as root to fix this htop: command not found $update-command-not-found Downloading complete file http://ftp.de.debian.org/debian/dists/squeeze/Contents-i386.gz I: Writing data for ftp.de.debian.org_debian_dists_squeeze_Contents-i386.gz ... . done $htop The program 'htop' is currently not installed. You can install it by typing: apt-get install htop htop: command not found
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.