"I think I'm going crazy here!"
I recognized the voice at the other end of the phone line. "What's up?", I asked.
"I need to front-end ls, so I put my version in /specialstuff, but the stupid machine keeps using the ls in /bin. It's driving me nuts!"
Front-ending or front-loading is simply putting a special version of a command earlier in $PATH than a system command of the same name. Often the script or program calls the real system command with certain options or flags set to make it easier for users. Because the new version is earler in $PATH, it gets used rather than the system command.
"So you added /specialstuff at the front of $PATH ?". A rhetorical question, but I had to ask it.
"Duh, yes. What's really driving me crazy is that 'which ls' SAYS that ls is in /specialstuff, but when I type it, it doesn't use it. This machine hates me!"
I laughed. "Let me guess," I asked, "you changed $PATH and then put your ls into /specialstuff, right?"
"I don't know. Maybe. Why?"
"Because it matters. I also know that you typed ls after you changed $PATH but before you put your version in /specialstuff."
"Huh? How could you know that?
"Just trust me for a second. Type "hash -r" and then try your ls. Is it OK now?"
I heard keys clicking. "Son of a gun. Now it works. Why?"
Do you know why?
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
------------------------
Comments are closed for this page. You can comment at the "Answer" page.