Working quicker in Ubuntu by using bash scripts

I’m sure that there are a couple of commands you use on a regular basis when working in Ubuntu. I for instance often open the file browser by pressing ALT+F2 and entering ‘gksu nautilus’ which opens the file browser as root. The same goes for the ‘gksu gnome-terminal’ command. Entering commands with ALT+F2 is cool and all but when the commands start to leave a lot of room for typo’s it can be annoying.

I knew that I could make bash scripts in Linux to execute certain commands so I figured I’d simply make some bash scripts for these commands. The way to do that is like so:

Press ALT+F2 and enter ‘gksu gedit /usr/local/bin/sunau’. This opens the text editor with new file called ‘sunau’ in the location /usr/local/bin. We’ll make a script in this file that opens the file browser as root. Enter the following into the empty file:

#!/bin/bash
gksu nautilus

Now save the script and close the editor. The only thing left now is to make the script executable. Press ALT+F2 again and enter ‘sudo chmod +x /usr/local/bin/sunau’. After this you can call your script by pressing ALT+F2 and entering ‘sunau’. This will start the file browser as root. By changing the contents of the file you can execute all kinds of commands with bash scripts.

2 comments on Working quicker in Ubuntu by using bash scripts

  1. Hi, I was very interested in using this to deploy websites, but the windows version of lftp seems to have disappeared off the internet. Any idea where it is, or could you somehow make it available? Thanks for any help.

  2. Hi Daniel,

    I still had the zip just in case this would happen. I updated the link in my post. Will this get me in trouble though? It’s open source right?

    Good luck with it!

    Walter

Leave a response: