Linux Commands: Making Bash Error Messages Friendlier
Apr 01, 2010, 13:32 (0 Talkback[s])
(Other stories by Carla Schroder)
"The command line! The bane of the novice Linux user! It's so
useful -- yet it can be challenging to learn.
"The error messages don't help much. "Command not found."
"Permission denied." As a newbie, you need to know more. Isn't that
the right command? Why was permission denied? How are you to figure
out what the real problem was? And why can't the shell help you
with that?
"Ubuntu has taken some steps in that direction already. They've
set up the bash shell so that if you get "Command not found", most
of the time you'll also see suggestions on what you might have
meant: commands that are spelled similarly, or commands that aren't
installed along with which package you need to install to get them.
It looks like this:
$ catt /etc/fstab
No command 'catt' found, did you mean:
Command 'cat' from package 'coreutils' (main)
Command 'cant' from package 'swap-cwm' (universe)
catt: command not found
"It's an excellent step. Perhaps still not 100% clear -- you
still need to know what those packages are and how to install them
-- but it's a good start!
"But what about other errors, like the all too common
"Permission denied"? Ubuntu's error handling uses a function built
into bash for that specific purpose, a function called
command_not_found_handle that can't be used for other types of
errors."
Complete
Story
Related Stories:
- Linux Boot Camp: How Linux Boots (part 1)(Mar 25, 2010)
- Why Use GRUB2? Good Question! (part 3)
(Mar 11, 2010)
- Linux Howto: Cleaning up Your GRUB 2 Menu (part 2)(Feb 25, 2010)
- Grub2 Worms Into Ubuntu (part 1)(Feb 11, 2010)
- Make Pretty GUI Apps Fast with Python-Qt(Jan 28, 2010)
- Print Beautiful Custom Calendars in Linux With Photo Calendar(Jan 14, 2010)
- Fixing Your Holiday Photos With GIMP(Dec 22, 2009)
- Mastering Characters Sets in Linux (Weird Characters, part 2)(Nov 25, 2009)
- Character Sets in Linux or: Why do I See Those Weird Characters?(Nov 12, 2009)