Showing posts with label setup. Show all posts
Showing posts with label setup. Show all posts

Friday, 10 September 2010

Howto: Bind Keys In Nautilus To Scripts Or Other Menu Items.

I picked up this excellent tip from Webupd8.

First you should have installed Nautilus Open Terminal for an initial very useful shortcut. It adds a menu entry on the right click and in the File menu to do exactly what it says, open a terminal at the current folder you have open in the active Nautilus window. So enter the following into a terminal.

sudo apt-get install nautilus-open-terminal

If it is already installed it will just inform you of it in the text it spews, otherwise it will install it, and inform you of that too.

Open up gconf-editor from a terminal or Alt+F2 (you may also have it listed in your Applications/System Tools/ menu as Configuration Editor. Be a little bit careful in here, there is possibility of breaking stuff. Navigate in the left hand pane to Desktop/Gnome/Interface.

Change the toggle for "can_change_accels" to true/enabled. Leave the gconf-editor window open as you most likely want to disable it again after setting the keybindings you want. Be aware that you can only bind to the main Nautilus menu and not to its right click menu.

Press Alt+F2 and enter "nautilus -q" to restart Nautilus, then you may set any menu item or script to have a key bind simply by opening the Nautilus main menu and then pressing the key bind that would like to set it as while hovering over the item. For instance I hovered over Open Terminal and I have set to F4, I have also added bindings to other scripts I use fairly frequently.

I would suggest disabling the "can_change_accels" to false again to prevent accidental overwriting of key bindings, thats entirely up to you though, and be aware of what key binds you set of course, binding ctrl+c to close/quit nautilus is going to cause problems ;)

Sunday, 2 May 2010

Howto: Ubuntu 10.04 Lucid Post Install Acer Aspire One 110 (aka AAO & AA1) 8GB/16GB SSD Model

I need to clarify that this is on the Acer Aspire One 110, a couple of comments have indicated that the wifi fix did not work on their machines, one at least has a different model and its entirely my mistake I didn't state clearly which model it is I have, well the wife and I both have. Doing a lspci shows we have Atheros AR5001 wireless device.

Post install there are a number
of things that need tweaking. The wifi and media cards will not function correctly without some work, other things will improve performance or help the SSD longevity.

Wifi
Lets start by fixing the wireless, its probably the first thing you want to do as it will drop your connection like a butterfingered, blind juggler...... With one hand.

In your System / Admintration / Software Sources, enable any repo's that aren't enabled, though you can avoid the source ones if you want. The fire up synaptic, Reload the repository lists and add following package:

linux-backports-modules-wireless-lucid-generic

it will also select a similar named package with your kernel version in its name that we also want. Once that is done I would reboot and your wifi should be nearly done. Now I have installed on mine twice and the second install wouldn't automatically connect to the home wifi when I rebooted, I had to go into System / Preferences / Network Connections and delete the existing wireless connection there, and then Add the connection again. I am not sure why, but its not much trouble to correct and barely worth the time investigating. Yours may work without doing that.

Media Card Readers
You need to edit /etc/default/grub (as root ofc) and find the
line that starts:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change it to read

GRUB_CMDLINE_LINUX_DEFAULT="pciehp.pciehp_force=1 elevator=noop quiet splash"

The pciehp part fixes the card readers to be hot swappable and the
elevator=noop improves SSD performance, we'll add that now while we are dabbling in the right place. Anyone with a HD version who may be following this should omit the elevator=noop.

To then make the changes actually apply next boot they have to be applied to the Grub boot process so you should then perform :

sudo update-grub

Many thanks to Magrat G for pointing out the ommision in the comments.

Ramon in the comments made the following suggestion:

I've got a SD card in the storage expansion slot (where /home is mounted). To avoid suspend/hibernate failure, this is a nice tweak:

echo "SUSPEND_MODULES=\"sdhci sdhci_pci\"" | sudo tee -a /etc/pm/config.d/suspend_modules

It is reported in bug #477106 (see comment #35):
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/477106

I will add a disclaimer that I have not tested that but it seems like a good fix and has many reports of it working for many people.

Move /tmp to RAM and general fstab fiddling
Lets backup our fstab before we start messing with it, if anything breaks we can copy it back and start again.. By we, I mean *you* of course ;)

sudo cp /etc/fstab /etc/fstab-bak
sudo gedit /etc/fstab


then add these lines at the bottom

none /var/log tmpfs size=10M 0 0
none /tmp tmpfs size=100M 0 0
none /var/tmp tmpfs size=20M 0 0


That is all we do to move /tmp to RAM but we can make another change here to improve SSD lifespan and performance. Find the lines that mount your SSD partition/s and tweak the options to include noatime so the filesystem does not record access times, which is pretty useless and causes unnecessary writes. An editted line might look like this for root:

/dev/sda1 / ext2 defaults,noatime,errors=remount-ro 0 1

Or if the UUID scheme is in use /home might be:

UUID=10b794b3-78b6-44f1-b179-8e38302efe05 /home ext2 defaults,noatime 0 2

Notice the use of ext2 in the examples above, Its fairly important to not use a journalled filesystem on this older SSD. I'm not a filesystem guru and it may be fine to use ext3 or ext4 without journalling, but I am unsure so I formatted with what I knew was recommended.

You get the idea, if you have any doubts just leave it be or google for a more in depth guide on this point.

I will be adding further onto this post as time permits and I go through them myself, or remember what I did.

Tuesday, 17 November 2009

Howto: Stop Ubuntu 9.10 Karmic Mounting USB Devices With UUID Instead of a Name

Ubuntu 9.10 Karmic Koala changed the way USB devices get mounted a little bit. Instead of being mounted as /media/disk and then each other device becoming /media/disk-1, disk-2 and so forth, now the device is mounted with its UUID, a seemingly random string.

I never minded the disk-1, disk2 thing, though it was slightly annoying to not know which device was which sometimes it was seldom a problem as I had frequently just plugged it in and watched it mount. So the new change was a bt more of an annoyance as its harder to see which random string just appeared sometimes.

The solution as ever is pretty darned simple however, just label the device you lazy bum ;)

Pop along to the following page and read how to label different partition types, most likely fat16/32 or NTFS for your average thumbdrive of phone/mp3 player mounted as a mass storage.

https://help.ubuntu.com/community/RenameUSBDrive

Personally I use the Gparted method as mtools has an issue which means you have to add the device to a config file first (its detailed on the page) and while its not hard, its just an extra step I don't need.

So if you don't have Gparted installed already do the following or use Synaptic:

sudo apt-get install gparted

Start Gparted from the System/Administration menu, then select your device from the drop down list in the top right then unmount it by right clicking it in the lower frame and choose unmount. This is so you can make changes to it. Choose to "label" it from the same right click menu or from the Partition menu, finally you have to apply the changes by clicking the right most icon on the toolbar to "Apply all changes". It is done instantly and no longer will that device be known as /media/4169-87bb.

Sunday, 15 November 2009

Howto: Disable the 60 second delay in Logout/Restart/Shutdown

This new setting became a pet hate of mine within minutes of installing Ubuntu 9.10 Karmic Koala, there is a 60 second delay and confirmation dialog when logging out, restarting or shutting down. This default can be over-ridden to act instantly rather than waiting for 60 seconds or clicking a confirmation by setting the apps/indicator-session/suppress_logout_restart_shutdown boolean to true as follows:

gconftool-2 -s '/apps/indicator-session /suppress_logout_restart_shutdown' --type bool true


You can of course use gconf-editor if you want to use a GUI based tool, just navigate to /apps/indicator-session in the left tree and change the value of suppress_logout_restart_shutdown to enabled/ticked/true.



Tuesday, 25 August 2009

Make Pasword file Immutable - A Security tip

You can add a extra layer of protection to your machine, or in my case help to prevent wannabe haxx0r brothers at the parents house from changing to extremely short passwords with a little trick that not many are aware of.

What happened to me was my brother managed to shoulder surf the admin account on my parents PC, I normally update their PC by SSH from home, but I was around there visiting and mum had described a problem so I was fixing it while we chatted, my brother was lurking around and managed to shoulder read my 12 digit alpha numeric password (have to give the guy a bit of credit there, sadly)

Anyway I became aware that files on the admin account had incorrect accessed times afterwards and then looked deeper and found that someone had been in on the account and had changed my brothers password on his account from a sensible 10 digit alphanumeric (which was dead simple to bang in with two fingers as the digits were paired on the keyboard) into a rather less safe two letter password. He claimed that a friend had helped him break into my account as "you aren't the only one that knows linux", as if I ever imagined that I was some guru, I'm a self confessed learner still! As we "discussed" this further he came clean that he had simply watched me enter the password rather than "hacked" in.

Anyway lets get onto the crux of this, after setting your passwords open a terminal and enter:
chattr +i /etc/shadow

This will make the file immutable, which means that it cannot be deleted or renamed, no symlink can be made to this file and no data can be written to the file. The immutable flag must be cleared before passwords can be changed, if you try to do so without clearing it then it will appear to change the password, but in fact it would not write to the file, without error. Meaning the new password would never be written and the old password would continue being the active one.

If a fairly knowledgeable user tries to dig into why it won't write and they try:
$ ls -l /etc/shadow
-rw-r----- 1 root shadow 1027 2009-08-25 14:37 shadow


There is nothing obviously wrong with writing to the file, to check properly you would use:
$ sudo lsattr shadow
----i------------- shadow


Here we can see the +i flag set for immutable. If we clear that with:
chattr -i /etc/shadow
The password can now be changed as normal, using sudo passwd username
and then it can be set +i again to protect it.

A little bit sneaky and just a little bit safer.

Friday, 7 August 2009

How to use OTF fonts in Ubuntu

It isn't possible to use OTF fonts directly in Ubuntu without converting them into TTF's.

If we spend just a few minutes and install FontForge and make a very small script it becomes almost trivial to do.

sudo apt-get install fontforge

Now we should make the scripts, well it is two actually but one is a small config script for FontForge and the other is just a script to convert many OTF files in one go, rather than individually. First the FontForge settings file.

cd ~/bin
touch otf2ttf.conf

Then open otf2ttf.conf in your favourite text editor and paste the following into it.

#!/usr/local/bin/fontforge
# Quick and dirty hack: converts a font to truetype (.ttf)
Print("Opening "+$1);
Open($1);
Print("Saving "+$1:r+".ttf");
Generate($1:r+".ttf");
Quit(0);

Save the file, and now lets make the script to convert many fonts in one swoop.

cd ~/bin
touch otf2ttf
chmod +x otf2ttf

Again, open this file with your prefered text editor and paste the following in.

#!/bin/bash
#
# had to enable extglob
shopt -s extglob

# this uses globbing to match fiels ending in otf/OTF
for i in +(*.otf|*.OTF)

do fontforge -script /home/subbass/bin/otf2ttf.conf $i

done

To use this now (provided that your ~/bin folder is in your path) just open a terminal where your OTF files are, and issue the command otf2ttf. It will convert 20 files in just a couple of seconds to give you an idea of speed, you can then move all the resulting TTF files into ~/.fonts


Credit to http://www.stuermer.ch/blog/convert-otf-to-ttf-font-on-ubuntu.html where I found the script before re-typing the instructions. I put it here so I don't lose it next time I need it.

Tuesday, 4 August 2009

Howto make autohide panels smaller and hidden more in Gnome

Autohide panels in Gnome default to a 6 pixel strip remaining showing. I suspect this is done to "reduce confusion" which is a popular phrase from the Gnome guys, regardless its a little annoying to autohide a panel and still have it show around 20% of itself, so lets fix that.

The easiest way to do this is pop open a terminal and enter:

gconf-editor

This is quite a daunting program if you are fairly new to dabbling in the guts of OS's, and I must warn you to be a little careful in here, certainly don't go just changing stuff around to "see what happens"... Ok, no-one is that dumb... right?

Anyway, down the left hand side is a nice tree menu, navigate to:

/apps/panel/toplevels/

You should then see your panels on the left in the toplevels branch, possibly named bottom_panel_screen0, top_panel_screen0 or simply panel_0, panel_1 etc. Click on each of the panel entries and you will see the right pane populate with some "keys", locate the one auto_hide_size which is very likely set to 6 at the moment, change the 6 to a 1 by clicking on it.

The change is nearly instant and you will hopefully see the relevant autohidden panel sneak a little further offscreen, setting the value to 0 (zero) will not have the desired effect incidently so stick to 1 please.


Monday, 3 August 2009

How to create Debian menu for Openbox

This may also work for other WM like Fluxbox and TWM.

The Debian menu builds a menu from all the installed applications on your system and nicely organises them. I believe it also keeps it updated when you install new software so you do not have to manually add items to your Openbox menu.

To install it use:

sudo aptitude install menu

After it is installed run:

sudo update-menus

To enable the menu in Gnome go to the desktop panel menu:

System / Preferences / Main Menu and enable the Debian menu under Applications.


Tuesday, 14 July 2009

Set up rxvt terminal with unicode and clickable URL's

Rxvt is a super fast unicode terminal which I have recently switched to away from Eterm for my transparent desktop terminal.

sudo apt-get install rxvt-unicode-ml

Next is to create a configuration file for it in your home folder.

touch .Xdefaults

Now paste this lot in...

URxvt*termName: rxvt

## borderless and no scrollbar
URxvt*scrollBar_right: false
URxvt*scrollBar: false
URxvt*borderLess: false

## teh transparency stuff
URxvt*inheritPixmap: true
URxvt*tintColor: white
URxvt*shading: 100

##
## These 3 lines make links clickable
##
URxvt.urlLauncher: firefox
URxvt.matcher.button: 1
URxvt.perl-ext-common: matcher,readline

## geometry and font
URxvt*geometry: 80×15
URxvt*font: xft:Terminus:pixelsize=12

## change default colors
URxvt*background: #000000
URxvt*foreground: #A8A8A8
URxvt*color0: #000000
URxvt*color1: #A80000

## URxvt*color2: #00A800
URxvt*color2: #ED254F

URxvt*color3: #A85400
## main bars in irssi
URxvt*color4: #020202
URxvt*color5: #A800A8
URxvt*color6: #00A8A8
URxvt*color7: #A8A8A8
URxvt*color8: #545054
URxvt*color9: #F85450

## Time in Irssi
URxvt*color10: #ED254F
## URxvt*color10: #50FC50

## URxvt*color11: #F2FC50
URxvt*color11: #ED254F

URxvt*color12: #5054F8

URxvt*color13: #ED254F
## URxvt*color13: #F854F8

URxvt*color14: #50FCF8
URxvt*color15: #F8FCF8

Note that some of the colours have been changed to coordinate with my current desktop theme, the original colours are commented out so you can easily revert. Also the line defining the window geometry seems to have no effect, I shall look into that and correct it when I get some time and inclination. At the moment I don't mind because the default window size is fine, and the launcher I use to start the transparent terminal I use on the desktop mainly for my screen with irssi, hellanzb and mediatomb in has the geometry set on it. the launcher command is:


rxvt -g 80x15

Last job is to tell compiz to not decorate this window, this will get rid of the title bar, borders and shadow etc.

Hopefully you have installed the advanced compiz settings (ccsm), so just open that up and go to the section for window decorations
in Effects, Window Decorations.

Add the rxvt window to be excluded from shadows and decorations, and that should see you done.



Wednesday, 8 July 2009

Logitech G9 on Ubuntu 9.04 Jaunty

Logitech G9 on Ubuntu 9.04 Jaunty


Info taken from : http://ubuntuforums.org/showthread.php?t=1092352

Firstly we need to install a couple of extra programs so open up a terminal and copy/paste the following line:

sudo apt-get install xvkbd xbindkeys
Next up we need to make a ~/.xbindkeysrc and put the next few lines into it:
"/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[left]""
b:6
"/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[right]""
b:7
"/usr/X11R6/bin/xvkbd -xsendevent -text "\[Control_L]\[Page_Up]""
m:0x0 + b:11
"/usr/X11R6/bin/xvkbd -xsendevent -text "\[Control_L]\[Page_Down]""
m:0x0 + b:12
Then make another file called ~/.Xmodmap which contains the single line:

pointer = 1 2 3 4 5 8 9 6 7
Then give it a quick test by starting xbindkeys up in a terminal, the buttons should all work correctly. It could be tested in nautilus by seeing if the back button will move back a folder.

Tuesday, 26 August 2008

rTorrent, light and fast bittorrent client.

I use two torrent clients almost every day, Transmission on my own box with a gnome desktop, and for a long time now rTorrent in a shell via SSH to a spare machine I have use of on a separate connection. Setting up rTorrent on an Ubuntu machine is what I am going to discuss here.

First step is to install the program, open a terminal and enter:

sudo apt-get install rtorrent

Or use Synaptic and search for 'rtorrent', install it. A basic config file is located /usr/share/doc/rtorrent/examples for you to tweak to your own liking, at its simplest you may want to change the download folder in it and the 'watch' folder. The watch folder is a place that rTorrent will monitor for *.torrent files coming into so it can automatically start, and when the download has completed and achieved a ratio you are happy with, you can just delete the torrent file from this folder to remove it from rTorrent. Dead simple stuff :]

cp /usr/share/doc/rtorrent/examples/rtorrent.rc ~/.rtorrent.rc

then edit this file with your prefered text editor, mine is usually nano, use gedit if you prefer a GUI editor:.

cd ~/
nano .rtorrent.rc

Now we can make the most basic of changes, first up is the download folder, look for the line:

# Default directory to save the downloaded torrents.

change the line after it to the folder you want to be your download folder and remove the # so you have something like this:

# Default directory to save the downloaded torrents.
directory = ~/torrents

This makes my download folder /torrents/ in my home, the default without editting is simply your home folder which you may be happy with.

Next lets tell it what folder to watch for torrent files. I have defined mine to be this same ~/torrents/ folder, you may prefer to leave it as your home folder. Either way find these lines just slightly down from the previous:

# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=~/torrents/*.torrent
schedule = untied_directory,5,5,stop_untied=

Yours will look very slightly different as I have shown how I changed mine to watch the ~/torrents/ folder. You should now save the file and close the editor, ctrl+o to save in nano if you used my prefered editor from above and don't know it, press enter to save wit hthe same name, then ctrl+x to close it.

You should now be free to start rTorrent with the command:

rtorrent

Not very impressive at first look is it, but download a torrent file to the watch folder and see rtorrent leap into action all by itself. You can adjust the upload and download speeds using the keys

a/s/dIncrease the upload throttle by 1/5/50 KB.
z/x/cDecrease the upload throttle by 1/5/50 KB.
A/S/DIncrease the download throttle by 1/5/50 KB.
Z/X/CDecrease the download throttle by 1/5/50 KB.


There are other keys to pause and resume torrents and many other facilities that you may require, for that I would point you at the User Guide page at http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide


As I use this remotely I also run it inside a screen so I can safely detach from it and break the connection leaving it running on the remote machine, to do this enter in a terminal:

screen

then you will just see another command prompt on a clear terminal at which point enter:

rtorrent

rTorrent will start as normal but if you use the keys ctrl+a then d it will detach, that is it will drop you back at your original shell, leaving rtorrent running in the backgroun still. You can attach to it again with:

screen -r

You can then see rTorrent again to check your downloads or ratios. Check 'man screen' for more help on using screen, there are a *lot* of things you can do with it, and that might be a worthwhile post for me some time soon.

Thursday, 14 August 2008

Enable DVD playback and other 'restricted' extras.

This information is taken from the Ubuntu Documentation (here) and any copyright remains with them. This is here for my own use.

Playing Restricted Formats in Ubuntu.

Follow these steps to play most common multimedia formats, including MP3, DVD, Flash, Quicktime, WMA and WMV, including both standalone files and content embedded in web pages.

Using the GUI (Synaptic)

  • Go to ApplicationsAdd/Remove...

  • Set Show: to All available applications

  • Search for ubuntu-restricted-extras and install it. Note that there is also xubuntu-restricted-extras (for Xubuntu) and kubuntu-restricted-extras (for Kubuntu.)

Or open the Terminal (much faster), and execute the following command:

sudo apt-get install ubuntu-restricted-extras