Is possible to write some "sudo" commands with text app and save it as terminal file ?

It should allows me to run the saved commands directly batter than line by line and I can run it at any time ?


You can create a .sh file using any text editor. Write the commands that you want to run each on it own line, and you can add -y to the end of the line for those that needs it, save the file with the extension .sh, and then you can run it from terminal. See example below.

sudo -u ls /home/user/files

List the contents of the /home/user/files directory.

sudo apt install chromium-browser -y

Installs Chromium browser

| improve this answer | |
  • Thanks, its works fine.. but as I understood, I can't run the commands when I double-clicked on the icon of file such as "cmd" or "bat" files in windows ? – Ali H Nov 5 '17 at 9:27
  • 1
    You can create a launcher to do that. See Here... – Mitch Nov 5 '17 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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