This question already has an answer here:

I want to shutdown with terminal, so I created .sh file with command sudo poweroff. I want to run this with terminal. How do I do that?

marked as duplicate by Zanna, Anwar, Jacob Vlijm, Byte Commander, mikewhatever Sep 5 '16 at 17:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Anyway, the command to run the script will be longer than the command it runs :) – Jacob Vlijm Sep 5 '16 at 16:14
  • Also, check this. – Szczepan Sep 5 '16 at 16:20

Well to execute a script file in terminal , open a terminal and go the place where script file is located and execute it as follows:

cd /path/to/file

Thats it.

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