Monday, January 7, 2013
List Source for Bash Functions
If you use alias, then just typing alias will give you all the defined aliases, and alias alias_name will tell you what a particular alias does. For functions defined in .bashrc and other places, you can use:
declare -f
which will give you the names of all functions currently defined, and:
type function_name
which will give you the source for a particular function.
(declare -F will give names and sources, like alias does, but it's usually too much information)
Sunday, December 30, 2012
Mobile Broadband Auto Connect on Ubuntu 12.04.1 LTS
Ubuntu broke the auto-connect for a mobile broadband modem in 12.04.1 Apparently this is considered to be a bug, so it will get fixed one day. For now the instructions on this excellently written web page work:
http://www.thefanclub.co.za/ how-to/how-auto-connect- ubuntu-1204-gsm-mobile- broadband-connection-on-boot- startup-service
In short they have written a shell script which turns your broadband on as soon as possible
You put it in
/etc/init.d/mobile-broadband-connect
Make it executable:
sudo chmod +x /etc/init.d/mobile-broadband-connect
And run update-rc.d
sudo update-rc.d mobile-broadband-connect defaults
after which it can be controlled with:
sudo service mobile-broadband-connect status/start/stop
And should run at startup to connect your modem.
I found this works a treat, but in case you want to remove it I found that a combination of these commands seems to do it:
sudo service mobile-broadband-connect stop
sudo rm /etc/init.d/mobile-broadband-connect
http://www.thefanclub.co.za/
In short they have written a shell script which turns your broadband on as soon as possible
You put it in
/etc/init.d/mobile-broadband-connect
Make it executable:
sudo chmod +x /etc/init.d/mobile-broadband-connect
And run update-rc.d
sudo update-rc.d mobile-broadband-connect defaults
after which it can be controlled with:
sudo service mobile-broadband-connect status/start/stop
And should run at startup to connect your modem.
I found this works a treat, but in case you want to remove it I found that a combination of these commands seems to do it:
sudo service mobile-broadband-connect stop
sudo rm /etc/init.d/mobile-broadband-connect
sudo update-rc.d mobile-broadband-connect remove
Friday, December 21, 2012
epson scanners ubuntu 12.04.1
Amongst the commands I ran in order to get my Mother's Epson SX425W printer/scanner to work on Ubuntu 12.04.1 were:
(you can get the three .deb files from the epson or possible avasys.jp website)
19 apt-get install xsltproc
20 dpkg -i iscan-data_1.13.0-1_all.deb
21 dpkg -i iscan_2.28.1-3.ltdl7_i386.deb
22 dpkg -i iscan-network-nt_1.1.0-2_i386.deb
At that point the SX425W will scan nicely from simple-scan, but the older perfection 2480 still doesn't work, even though simple-scan lists it as an EPSON EPSON, so it obviously knows something about it.
Next I tried:
sudo apt-get install xsane sane libsane-extras
That didn't help but installed a much more complicated scanner app called xsane.
Xsane claims it can do OCR, but won't actually unless you also install
sudo apt-get install gocr
Here are some instructions for getting the 2480 working:
http://www.george-smart.co.uk/wiki/Epson_Perfection_2480_Linux
(you can get the three .deb files from the epson or possible avasys.jp website)
19 apt-get install xsltproc
20 dpkg -i iscan-data_1.13.0-1_all.deb
21 dpkg -i iscan_2.28.1-3.ltdl7_i386.deb
22 dpkg -i iscan-network-nt_1.1.0-2_i386.deb
At that point the SX425W will scan nicely from simple-scan, but the older perfection 2480 still doesn't work, even though simple-scan lists it as an EPSON EPSON, so it obviously knows something about it.
Next I tried:
sudo apt-get install xsane sane libsane-extras
That didn't help but installed a much more complicated scanner app called xsane.
Xsane claims it can do OCR, but won't actually unless you also install
sudo apt-get install gocr
Here are some instructions for getting the 2480 working:
http://www.george-smart.co.uk/wiki/Epson_Perfection_2480_Linux
They amount to editing:
/etc/sane.d/snapscan.conf
so that the firmware line reads:
firmware /usr/share/sane/snapscan/esfw41.bin
And then putting the esfw41.bin file that you can download from there in the right place and
getting the permissions right so that any user can read it.
sudo mkdir -p /usr/share/sane/snapscan
sudo cp esfw41.bin /usr/share/sane/snapscan/esfw41.bin
sudo chmod 444 /usr/share/sane/snapscan/esfw41.bin
Having done this I seem to have disabled the other one though. sigh..
Wednesday, December 12, 2012
Ubuntu Hibernate
In their mightiness and wisdom, the same twerps who mandated the appalling Unity interface have turned off hibernate in recent versions of Ubuntu. Because obviously no-one ever uses it.
You can cause hibernate manually
$ sudo pm-hibernate
You can cause hibernate manually
$ sudo pm-hibernate
In 12.04.1, at least, you can put it back on various menus by creating the file:
/etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
which should contain the lines:
[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
This information came from:
I really am starting to think that Ubuntu, which used to be a nice orange and brown version of Debian with proprietary drivers on the install disk and sensible choices of what to install, has jumped the shark.
Google's going the same way with all its hideous new ultra-slow and buggy javascript interfaces to things.
Can anyone think of a nice simple Linux (like, say Ubuntu 8 but with latest versions of things and up to date drivers) and a nice simple webmail now that Ubuntu and Gmail are rubbish?
Tuesday, December 11, 2012
feh
I really like the image viewer feh.
Install with:
$ sudo apt-get install feh
And then use:
$ feh --auto-zoom --no-jump-on-resort --recursive --randomize --fullscreen --slideshow-delay 30 .
in your home directory to get a slideshow of every image you have.
Cryptically but more typably:
$ feh -FZzrD 30 --no-jump-on-resort .
Ubuntu Install (12.04.1 LTS Precise Pangolin)
I've just made a new install of Ubuntu 12.04.1 on my two dell minis (a 10v and a 1018)
The installation goes a lot more smoothly now than it used to do, since all relevant drivers are already on the install CD, so Ubuntu just deals with it.
Unfortunately I hate the new Unity Interface, because it runs exceedingly slowly on these little machines. However that's easily solved by installing the xubuntu-desktop and logging into that instead, which provides a nice traditional desktop which runs fast.
Once the base system is installed, fix the boot process so that the kernel can explain what it's doing as it boots:
$ sudo vi /etc/default/grub
change
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
to
GRUB_CMDLINE_LINUX_DEFAULT=""
then run
$ sudo update-grub
Enable the root account
$ sudo passwd root
Add the medibuntu repository, instructions here: https://help.ubuntu.com/community/Medibuntu
Roughly, what they say to do is:
$ sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring
Also Damien Cassou's emacs24 repository:
$ sudo add-apt-repository ppa:cassou/emacs
Make sure that you've got the latest versions of everything:
$ sudo apt-get update
$ sudo apt-get upgrade
Install the restricted extras:
$ sudo apt-get install ubuntu-restricted-extras
which is a huge metapackage that adds all sorts of non-free goodies. At one point it asks to agree to some sort of microsoft font licence. Sigh....
Then do:
$ sudo /usr/share/doc/libdvdread4/install-css.sh
to give your new system DVD reading abilities.
Here's a list of packages that I always end up installing: might as well get them all at once. You can make a cup of tea while this is happening. It takes about ten minutes.
$ sudo apt-get install w32codecs gitk mplayer smplayer epiphany-browser chromium-browser maven2 xxdiff tree git-gui mercurial rlwrap vim-gnome nautilus-open-terminal loop-aes-utils xclip filelight htop gparted idle3 unison build-essential gparted imagemagick fail2ban kate vlc openjdk-6-jdk xine-ui arandr xubuntu-desktop feh xscreensaver xscreensaver-data xscreensaver-gl gnome-shell app-install-data-medibuntu apport-hooks-medibuntu emacs24 emacs24-el emacs24-common-non-dfsg aptitude emacs-goodies-el tig ack-grep
Turn the firewall on:
$ sudo ufw enable
to check:
$ sudo ufw status
Change the default umask so that files are private for all users
$ sudo vi /etc/login.defs
change umask from 022 to 077
(This used to be in /etc/profile. I'm not at all sure that it still works like it used to. In my user account I'm seeing a umask of 0007, and if I create files then they're group readable, so I think it's getting set somewhere else now.).
Encrypt the swap partition:
$ sudo vi /etc/fstab
Change /dev/sda5 none swap sw 0 0 to:
/dev/sda2 none swap sw,loop=/dev/loop7,encryption=AES256 0 0
and add cryptoloop to /etc/modules
If you want to run an ssh server (client is already installed)
Then go fix the config file
This completes system setup
Tweaks to a new user account
In firefox install adblock plus, xmarks, and video download helper
(I used to do these under gnome, not sure what the equivalents are in xfcd/xubuntu-desktop):
Clojure/EMACS setup
Install leiningen (version 2, the packaged version is only 1.7 at present)
M-x package-list-packages then i to mark packages, and x to do it.
to install clojure-mode, nrepl, and htmlize, undo-tree, ack
(Used to be slime, slime-repl for clojure, but nrepl seems to have won recently)
The installation goes a lot more smoothly now than it used to do, since all relevant drivers are already on the install CD, so Ubuntu just deals with it.
Unfortunately I hate the new Unity Interface, because it runs exceedingly slowly on these little machines. However that's easily solved by installing the xubuntu-desktop and logging into that instead, which provides a nice traditional desktop which runs fast.
Once the base system is installed, fix the boot process so that the kernel can explain what it's doing as it boots:
$ sudo vi /etc/default/grub
change
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
to
GRUB_CMDLINE_LINUX_DEFAULT=""
then run
$ sudo update-grub
Enable the root account
$ sudo passwd root
Add the medibuntu repository, instructions here: https://help.ubuntu.com/community/Medibuntu
Roughly, what they say to do is:
$ sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring
Also Damien Cassou's emacs24 repository:
$ sudo add-apt-repository ppa:cassou/emacs
Make sure that you've got the latest versions of everything:
$ sudo apt-get update
$ sudo apt-get upgrade
Install the restricted extras:
$ sudo apt-get install ubuntu-restricted-extras
which is a huge metapackage that adds all sorts of non-free goodies. At one point it asks to agree to some sort of microsoft font licence. Sigh....
Then do:
$ sudo /usr/share/doc/libdvdread4/install-css.sh
to give your new system DVD reading abilities.
Here's a list of packages that I always end up installing: might as well get them all at once. You can make a cup of tea while this is happening. It takes about ten minutes.
$ sudo apt-get install w32codecs gitk mplayer smplayer epiphany-browser chromium-browser maven2 xxdiff tree git-gui mercurial rlwrap vim-gnome nautilus-open-terminal loop-aes-utils xclip filelight htop gparted idle3 unison build-essential gparted imagemagick fail2ban kate vlc openjdk-6-jdk xine-ui arandr xubuntu-desktop feh xscreensaver xscreensaver-data xscreensaver-gl gnome-shell app-install-data-medibuntu apport-hooks-medibuntu emacs24 emacs24-el emacs24-common-non-dfsg aptitude emacs-goodies-el tig ack-grep
Turn the firewall on:
$ sudo ufw enable
to check:
$ sudo ufw status
Change the default umask so that files are private for all users
$ sudo vi /etc/login.defs
change umask from 022 to 077
(This used to be in /etc/profile. I'm not at all sure that it still works like it used to. In my user account I'm seeing a umask of 0007, and if I create files then they're group readable, so I think it's getting set somewhere else now.).
Encrypt the swap partition:
$ sudo vi /etc/fstab
Change /dev/sda5 none swap sw 0 0 to:
/dev/sda2 none swap sw,loop=/dev/loop7,encryption=AES256 0 0
and add cryptoloop to /etc/modules
If you want to run an ssh server (client is already installed)
$ sudo apt-get install ssh
Then go fix the config file
$ sudo vi /etc/ssh/sshd_config
Change UsePAM, PasswordAuthentication, PermitRootLogin to no
Also allow Port 443 for login over https port through captive portals
Then allow it through the firewall:
Also allow Port 443 for login over https port through captive portals
Then allow it through the firewall:
$ sudo ufw allow 22
(also 443, also fix the router to forward appropriately)
(also 443, also fix the router to forward appropriately)
This completes system setup
Tweaks to a new user account
In firefox install adblock plus, xmarks, and video download helper
Clone your repository from github:
$ ssh-keygen -t rsa -C "john@woc-desktop.aspden.com"
$ cat ~/.ssh/id_rsa.pub | xclip -sel clip
$ git clone git@github.com:johnlawrenceaspden/hobby-code.git
Make links to .bashrc etc
$ ~/hobby-code/makelinks.bash
(I used to do these under gnome, not sure what the equivalents are in xfcd/xubuntu-desktop):
System/Preferences/Keyboard/Typing Break to turn on typing break
System/Preferences/Keyboard/Layouts/Options/Ctrl key position/Make CapsLock an additional Ctrl
Use United Kingdom keyboard, with United Kingdom International with dead keys to type foreign.
Disable all the Ctrl-Alt- shortcuts in GNOME using System/Preferences/Keyboard Shortcuts
Make Alt+F11 mean 'toggle fullscreen mode'
Clojure/EMACS setup
Install leiningen (version 2, the packaged version is only 1.7 at present)
M-x package-list-packages then i to mark packages, and x to do it.
to install clojure-mode, nrepl, and htmlize, undo-tree, ack
(Used to be slime, slime-repl for clojure, but nrepl seems to have won recently)
Monday, November 26, 2012
Subscribe to:
Posts (Atom)
