Same Linux command with different results [closed] Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Same Linux command with different results [closed] without wasting too much if your time.

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


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 top.


We are here to answer your question about Same Linux command with different results [closed] - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji