The question is published on by Tutorial Guruji team.
I just started using Linux and so far, I’ve only managed to get the server installed. My lecturer asked me the question below and I have no idea about it as I haven’t experienced such. Could anyone about help me answer the question, please? The question is as follows: Explain what could possibly be the problem when a command that was issued gave a different result from the last time it was used (Assume you are working on a Linux operating system environment)
Try the follwing in your home directory:
mkdir bin cd bin echo "#! /bin/bash" > top echo "echo "Monkeys Rulez"" >> top chmod a+x top cd ../ export PATH=./bin top
Instead of running the
top command (
man 1 top: for the manual describing
top) it will run the top file that you created in the
bin directory in your home directory – thus depending on your search path you can be made to run a command that is not the one you are expecting.
This is my guess at what your lecturer is getting at – if you are super paranoid you always run the full path to a command, ie
/usr/bin/top rather than just