Saving Konsole/Terminal commands to double click

Discussion in 'all things UNIX' started by Palancar, Nov 21, 2013.

Thread Status:
Not open for further replies.
  1. Palancar

    Palancar Registered Member

    Joined:
    Oct 26, 2011
    Posts:
    1,591
    I am having a "brain lapse" today. I forgot how to save terminal/konsole commands for double clicking on later. KDE works for me.

    I have several things I do very repetitively like updates, upgrades, autoremove, autoclean, etc... I was thinking of just writing a simple list in a Konsole/Terminal and then saving it so that I can just double click on the desktop and walk away for a few minutes as needed. I hate typing these simple commands over and over each week. I don't want to automate the process. When I decide to update, etc... I'll manually launch my saved command structure. At least that is what I prefer.

    Lets make it super simple for this post. I use multiple lines but for here lets just look at these two commands:

    sudo apt-get update && sudo apt-get autoremove

    I don't want to save the root password. I'll type it each time to remain secure, but I only want to type it once and then let my 4-8 commands run.

    Can someone use my simple command above and give me a step by step. I must be missing something easy because its not working on this end. Again, KDE/Terminal if possible because all my distro's have it.
     
  2. UnknownK

    UnknownK Registered Member

    Joined:
    Nov 3, 2012
    Posts:
    160
    Location:
    Unknown
    Very easy. Create a text file with Kwrite or any other editor, write #!/bin/bash at the top, put all your commands below, save and rename the file as anyname.sh. Open Konsole, go to the directory of anyname.sh, chmod the file to make it executable.

    sudo chmod a+x anyname.sh

    That's it. Double click to open the file and all your commands should start their work.
     
  3. Palancar

    Palancar Registered Member

    Joined:
    Oct 26, 2011
    Posts:
    1,591
    Sorry it took a few days to get back here. For some reason this is not working. I easily create the .sh file and place it on my user Desktop. In terminal I change to cd Desktop and I can see the .sh file when I use the ls command. When I chmod command as you typed it doesn't work. Don't know why.

    Curious thing: In terminal when I do the ls inquiry the .sh file I created appears as a different color than all other files in the list of files found. Why? No idea. This is an OS operating in a VM. Would that account for why this isn't working? Such a simple thing but it isn't working. Frustrating.
     
  4. WSFuser

    WSFuser Registered Member

    Joined:
    Oct 7, 2004
    Posts:
    10,632
    I'm not sure what you mean by "doesn't work" but if you did it correctly you should not see any output (messages).
    Possibly because the command worked and executable files are marked a different color than non-executables.
     
Loading...
Thread Status:
Not open for further replies.