Is there a way to make a file that would run a terminal command when you click it? Similar to a .bat extension in windows?
Open your text editor, and type the following line:
In Linux those are called scripts of more accurately shell scripts.
Linux does not care what extension the file, it will look at the file's permissions to find if the file is set as executable and will run it if so.
Normally you start your scripts by declaring which command interpreter you want to use,
After you have done editing, save your file and make it executable.
You can either open a terminal and type
When you are done you can double click on the file and your file manager should try to run it or ask if you want to run it. As an alternative you can also invoke your script in a terminal changing dir to where your script is and invoking it with
A good start to learn Linux shell scripting is LinuxCommand.org, they teach you what you need, how to do it and have a lot of good examples on scripts that you can have a look at.
If it is a simple, one-line command, you can create a
Put the command between quotes, save the file with a
You can make a
protected by Community♦ Jun 25 at 7:47
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?