-5

Change the PATH variable in such way the command ls should not work.

Restore the PATH variables content. Check whether ls is working or not.

closed as off-topic by Jenny D, jasonwryan, garethTheRed, Anthon, peterph Sep 26 '14 at 11:32

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    This question appears to be off-topic because it is about us doing your homework – Jenny D Sep 26 '14 at 10:07
  • ok.. i displayed the content of PATH variable. but i'm not getting how to change its content such that ls wont work?? – Sahaj Baranwal Sep 26 '14 at 10:13
  • 1
    @SahajBaranwal What is the question? Some sentence with question mark at the end would be helpful. Update the question and use something more specific than "How do I do this?" – Anthon Sep 26 '14 at 11:17
4

I won't say exactly how to do it, because this is obviously homework and the point is that you should learn by yourself and not just copy off of answers here.

But I will give you some hints on how to figure it out.

  1. First, you need to find out which directory ls lives in. If you don't know how to do that, search the web. A good search term might be "how do I find the path for a unix program".

  2. You've already figured out how to see the current content of your PATH variable. Now, you need to change it so that it no longer contains the directory where ls lives. A good search term might be "how do I change an environment variable in bash"

  3. When you've done that, and you type ls, the computer should respond with something along the lines of ls: command not found.

  4. Now you know how to change your PATH - so you change it again, so that it this time contains the path to lsthat you found in step 2. Then, the next time you type ls, it will show you the contents of the directory you're in.

I hope this sets you on the way. If you run into problems, you can edit this question so that it contains the following information:

  • what you did
  • what you expected to happen
  • what happened instead.

Good luck.

Not the answer you're looking for? Browse other questions tagged or ask your own question.