101 Linux hacks – free Linux Ebook

Go and grab your copy of the free ebook.

Quite nice book with small little hacks but sometimes the details are too much, specially the one on the cd command. I think there was no need for 3-4 examples of the same thing, but then nice collection and nice ebook.

Bash script to view log and config file in different server and paths.

I was working on a project, where I need to open file from different servers and different paths. I do it with the command:

vim ftp://username@server/path/filename

This is okay when the path is short but when the path gets longer and I have different config files to open from the same path or their associated logs, then it becomes un-necessary typing. So, I did the following:

Have a file with some aliase\’s like the below and source it from the bashrc file:

conf_app1=dns #this is with path

conf_app2=host

log_app1=dns #this too is with path

log_app2=hosts

And then I have a bash script that will use these variables to open the file required. I use the format as

view.sh c/l app1

where c/l denotes whether I want to open the config file or the log file. Download the script here.

Mount and unmount/umount images(iso/img) from nautilus (Fixed not mounting in Fedora)

Get the Nautilus Script here. So what is required is that you have the necessary permission to run mount and umount as normal user with sudo command. If you are using gksu or gnomesu then you can change this in the script that you will get. Once you have got the script then you can run the installer for the script that comes in the package.

If you are running this is Fedora then you would need to make one more change other than the ones done by the installer, which is to allow sudo from non tty devices. Since this will be running from the nautilus so the script will not have any tty device and hence you would need to comment the following in the /etc/sudoers file:

so you should change

Defaults    requiretty

to

#Defaults    requiretty

Also note that the script add group called moiso and adds the user to this group and then allows this group to run mount and umount command. If you have already allowed the username to run all commands via sudo then you can skip all the steps of the script and directly copy the script moiso and umoiso to the \”~/.gnome2/nautilus-scripts\” directory and you are done.

If you don\’t feel like doing all this work of downloading and installing then you can simply create one temp diretory in directory of choice (lets say /tmp/mount) and create a new file called \”mount_iso\” in ~/.gnome2/nautilus-scripts with the content below:

sudo mount \”$1\” /tmp/mount

And create umount_iso in the same directory with the below content:

sudo umount /tmp/mount

But I would strongly advise that you use the moiso available at the gnome-look link given above.