Helping people get started with Linux shells, I've noticed they tend to make two common mistakes vastly more than any others:
But as a newbie, all you know is that you type a command and get some message like "Permission denied." 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?
That's what this bash function is all about. Add it to your .bashrc (or the .bashrc belonging to a friend you're introducing to Linux) and it will give you some help as you learn.
Download: bash-errs-0.1
$ geosched.html bash: ./geosched.html: Permission denied geosched.html is an HTML file. Did you want to run: firefox geosched.html $ screenshot.jpg bash: ./screenshot.jpg: Permission denied screenshot.jpg is an image file. Did you want to run: pho screenshot.jpg gimp screenshot.jpg $ .bashrc bash: ./.bashrc: Permission denied .bashrc is a text file. Did you want to run: less .bashrc vim .bashrc $ ls etc/fstab /bin/ls: cannot access etc/fstab: No such file or directory Did you forget the leading slash? etc/fstab doesn't exist, but /etc/fstab does.
Enjoy! Of course, consider this GPLed free software, share, modify, and by all means send me any improvements so I can include them here.
Those of you trying to learn the shell might be interested in some of my short Linux Planet articles: