beep -f 340 -l 1000 -e /dev/input/event0
env EDITOR=nano crontab -e
sudo cat /dev/mtdblock* > backup.img
and then copy this flash to your PC. If anything goes wrong with the
upgrade, you can then use upslug2  to reflash the NSLU2 the image
stored in backup.img. To do this, you would
1. Put the NSLU2 into upgrade mode .
2. On the PC run 'upslug2 -i backup.img
apt-get install linux-headers-$(uname -r)
sudo apt-get install build-essential
Where there is a choice of version, the
command `uname -r` will tell you which is the right one.
remove folder and contents
sudo rm -rf path
In order to automatically start the init script on boot, it must be installed into /etc/rc.d/
Invoke the "enable" command to run the initscript on boot:
# /etc/init.d/example enable
Re: boot process slow when 'Starting MTA' offline
1. Go to /etc/rc2.d/ (which is your normal multiuser init state)
2. You should have a bunch of symlinks that start with S, then two digits (XX) and then the name of the service it starts
3. Search for SXXexim4 (where XX is a two-digit number... in my case it was 20)
4. Rename it so that instead of starting with S, it starts with a K (leave the two digits intact):
Be sure the clock is up to date -
apt-get install rdate
16 */2 * * * /usr/sbin/rdate -s clock-1.cs.cmu.edu
While executing the shell script using “dot space dot slash”, as shown below, it will execute the script in the current shell without forking a sub shell.
$ . ./scriptfile
Cyberduck - use binary - if ASCI it adds a Ctrl-M to all lines when duplicating or editing
remove ctrl-m at line ends
sed -e 's/.$//g' file > file2
get IP address - ifconfig
cp -R -v /mnt/hgfs/Users/fgmarshall/Documents/Linux_VM_store/Sweex20101118/* /media/disk-1
Copies all the files, directories, and subdirectories in the Mac stick Sweex20101118 backup directory into the memory stick mounted as disk-1
You have directory called /home/jerry/prog and you would like to compress this directory then you can type tar command as follows:
$ tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog
Above command will create an archive file called prog-1-jan-2005.tar.gz in current directory.
If you wish to restore your archive then you need to use following command (it will extract all files in current directory):
$ tar -zxvf prog-1-jan-2005.tar.gz
tar -cf destinationfilename.tar directorytobetarred/
Ubuntu allow root to use the GUI
sudo passwd root
After setting the root password enable the root login. Click on System> Administration> Login Window. Click on Security tab. Check “Allow local administrator login“
aptitude install open-vm-tools
sudo su -
VMWARE TOOLS FOR LINUX
aptitude install autoconf automake binutils cpp gcc linux-headers-$(uname -r) make psmisc
ls -d /usr/src/linux-headers-$(uname -r)*/include
apt-get install gdm
The operator are && for the and-operation, || for the or-operation and ! for the not-operation. Example: d = ! ( a && b ) || c
ls or any action
Control a -
_____c new screen
_____p go to previous
_____d detach - (that program will run even if ssh terminal is closed down
_____later do - screen -r re attach
_____S split the screen
_____Tab then n or p in the empty window
_____X remove current section of split window
to close screen app type -> exit screen
to clean up kill -9 `pidof SCREEN`
detach: C-a d
detach and logout (quick exit): C-a D D
exit screen: exit all of the programs in screen.
force-exit screen: C-a C-\ (not recommended)
alias ,i='cd /home/graham/i2c'
Processor: Intel XScale-IXP425, 133MHz (266MHz with de-underclock)
Memory: 32MB RAM, 8MB Flash
webmin to administer from web
Using the Webmin APT repository
If you like to install and update Webmin via APT, edit the /etc/apt/sources.list file on your system and add the line : deb http://download.webmin.com/download/repository sarge contrib You should also fetch and install my GPG key with which the repository is signed, with the commands : cd /root
apt-key add jcameron-key.asc You will now be able to install with the commands : apt-get update
apt-get install webmin All dependencies should be resolved automatically.
To change the SSH port number login as root, and edit /etc/ssh/sshd_config
Find the line that says Port 22 and change 22 to any number between 1024->65535 (above 30000 is best) and save the file.
Once done, run:
Now start a new SSH session (don’t close your existing one), to make sure that you can get in.
rdiff-backup /var/www 192.168.0.51::/home/backup52/www
apt-get install sg3-utils
/usr/bin/sg_start --stop /dev/sda
New Key Layout Ubuntu
sudo dpkg-reconfigure -plow console-setup
ln - make symbolic links
A symbolic link is a "file" pointing to another file.
To make a symbolic link :
ln /original/file /new/link
This makes /original/file and /new/link the same file - edit one and the other will change. The file will not be gone until both /original/file and /new/link are deleted.
You can only do this with files. For folders, you must make a "soft" link.
To make a soft symbolic link :
ln -s /original/file /new/link
ln -s /usr/local/apache/htdocs /var/www/htdocs
Note that -s makes an "empty" file pointing to the original file/folder. So if you delete the folder a symlink points to, you will be stuck with a dead symlink (just rm it).
What kernal? - - uname -a
Slug52local:~# cat /proc/cpuinfo
Processor : XScale-IXP42x Family rev 1 (v5l)
BogoMIPS : 266.24
I2C Slave is implemented in hardware on an 18F819/819.
mount -o size=2M -t tmpfs tmpfs /var/www/ramdisk
Change the line:
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now
('-r' means reboot, '-h' means 'halt')
apt-get install lm-sensors
$festival --tts filename.txt
screen /dev/tty.usbserial-FTDMZU2G 115200
To uncompress - tar zxvf bob.tgz - tar xvf bob.tar - tar xvjf bob.tar.bz2 - tar xvzf bob.tar.gz
mkdr - - - make directory
locate - - - find files
Install from source
apt-get install g++ - - - also gets gcc
apt-get install make
# tar xvzf package.tar.gz (or tar xvjf package.tar.bz2)
# cd package
# make install
Save Slug contents to .bin
cat /dev/mtdblock* > image.bin
Set Slug for upgrade - hold reset and power switch on
count to 10 - see Ready status flashing between 2 colours
apt-get remove apache
apt-get install lighttpd
* Configuration files can be found in /etc/lighttpd. Please read /etc/lighttpd/conf-available/README file.
* The DocumentRoot, which is the directory under which all your HTML files should exist, is set to /var/www.
* CGI scripts are looked for in /usr/lib/cgi-bin, which is where Debian packages will place their scripts.
You can enable cgi module by using command "lighty-enable-mod cgi".
* Log files are placed in /var/log/lighttpd, and will be rotated weekly.
The frequency of rotation can be easily changed by editing /etc/logrotate.d/lighttpd.
* The default directory index is index.html, meaning that requests for a directory /foo/bar/
will give the contents of the file /var/www/foo/bar/index.html if it exists (assuming that /var/www is your DocumentRoot).
* You can enable user directories by using command "lighty-enable-mod userdir"
Run /etc/init.d/lighttpd force-reload to enable changes
add PHP scripting
apt-get install php5
apt-get install php5-cgi
Edit the file /etc/lighttpd/lighttpd.conf to include
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php5-cgi",
"socket" => "/tmp/php.socket",
No need to do lighty etc etc - this is enough for php use -
put php scripts in
e.g. phpinfo.php containing just
[?php phpinfo(); ?] - - - replace [ ] with greater-than/less-than tags
./configure --disable-graphics --disable-curses
Beep - echo -e "\007" >/dev/tty10
apt-get install madplay
apt-get install alsa-utils
apt-get install alsa-base
apt-get install libncurses5-dev
2.5" notebook install sg3-utils ("apt-get install sg3-utils")
then you can spin down the drives when not in use.
This makes then absolutely silent, and saves power too.
Issue the command "sg-start /dev/sda 0" to spin down (or /dev/sdb or sdc, etc..)
put this command in cron to run every half hour or so to re-spin down.
Setting Up Swap Space
Normally, there are only two steps to setting up swap space, creating the partition and adding it to /etc/fstab. A typical fstab entry for a swap partition at /dev/hda6 would look like this:
/dev/hda6 swap swap defaults 0 0
The next time you reboot, the initialization scripts will activate it automatically and there's nothing more to be done.
However, if you want to make use of it right away, you'll need to activate it maually. As root, type:
mkswap -f /dev/hda6
There might be times when you've run out of swap space and it is not practical to repartition a drive or add a new one. In this case, you can use a regular file in an ordinary partition. All you have to do is create a file of the size you want
dd if=/dev/zero of=/var/my_swap bs=1024 count=131072
and activate it
mkswap -f /var/my_swap
This invocation creates a file called my_swap in /var. It is 128 Mb long (128 x 1024 = 131072). Initially, it is filled with zeros. However, mkswap marks it as swap space and swapon tells the kernel to start using it as swap space. When you are done with it,
src release http://downloads.openwrt.org/kamikaze/7.09/ixp4xx-2.6/packages
src packages http://downloads.openwrt.org/kamikaze/packages/armeb
src nslu2 http://ipkg.nslu2-linux.org/feeds/openwrt/kamikaze-7.09
src optware http://ipkg.nslu2-linux.org/feeds/optware/openwrt-ixp4xx/cross/unstable
dest root /
dest ram /tmp
Make your own Makefiles:
1. in openwrt-midge directory make helloworld dir
2. Copy files from some else package, for example atftp
2.1 Edit /package/hellohorld/Makefile
2.2 Edit /package/hellohorld/Config.in
3. add to /package/Config.in link to your /package/hellohorld/Config.in
4. add to /package/Makefile name of your package
then you'll see you helloworld in software make menuconfig
# cat /proc/version
copy folder and contents to a USB stick in Ubuntu
cp -R /home/graham/deb_bif_sticks/develop1 /media/disk folder with contents
cp -R /home/graham/deb_bif_sticks/develop1/* /media/disk contents only
Compress a folder and all contents
tar -cf destination_filename.tar folder_to_be_tarred/
To split large file into several smaller files, you can use split command in linux. Just follow the steps below and you will be able to split large file into smaller files.
* in your shell key in
$ split –bytes=1m /path/to/large/file
* Done. You just split your large file into several smaller files
* You can change the output file size by changing the –bytes=1m to your preference. You can use b, k, or m. b represent bytes, k represent kilobytes, m represent megabytes.
To restore the original file, you can use cat command.
To join all the smaller file to restore the original file type:-
$ cat prefix* > NEWFILENAME
copy 160G (swap at start on it) to 3G disk (swap at end on it)
Slug52local:~# dd if=/dev/sda2 of=/dev/sdb1
what disks are running?
find -name lighttpd
dump a program output
readlightsensor >> /dev/null 2>&1
minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command
55 20 * * * flite -t 'it is 5 to 9, time to watch TV'
*/1 * * * * /home/graham/motion/pictures_archived.sh - every minute
mv directory_name_now directory_name_new
rmdir - remove
mkdir - make new
curl http://192.168.0.9:8099/?action=snapshot -o /var/www/ramdisk/BB_HD.jpg
dd if=/dev/sdc of=/dev/sdb bs=10M clone from c to b
dd if=/mnt/hgfs/Documents/LinuxCommon/Joggler/kitchenJog110306.img of=/dev/sdb bs=10M
Copy a stick folder contents
Skype_Ubuntu110309 does not yet exist - it is created and filled
cp -R -v /media/disk-1 /mnt/hgfs/Users/fgmarshall/Documents/LinuxCommon/Joggler/Skype_Ubuntu110309
Notes on routers in home LAN
Sweex on kitchen wall
/etc/crontab does a reboot at 22.30 every evening
at boot time etc/init.d/S99start_i2c
starts i2c and runs the background Blassic program -
every 12 minutes starting at 0 real time this does -
It reads the beecount voltage every six seconds until the next 12 minute point
then divides the total by the number of measurements it fitted into the 12 minute window
it also can read i2c temperature every 6 seconds by running
/home/graham/i2c/thermometers/SE95_i2ctools_read_once.bas 79 and storing the value at
Also every 6 seconds it uses
to display on the i2c 4 x 20 LCD (right hand screen)
then it does other things at the 12 minute point as below
it stores the bee count value as inverted pixel count (0 at the screen top) for the graphic plot at
and the value for the 192.168.0.52 nslu2 to grab for use on the solar hot water web page display at
Weather plot for Wessex test
Bifferboard looking at chicken perches and
as a cron job it sends the current IP address to file IP_address.txt in www.sunspot.co.uk
(edit with crontab -e)
# on 31st minute of every hour upload the IP address to sunspot
31 * * * * /home/graham/upload_IP_address/IP_address_to_sunspot.bas
# every 10 minutes send LAN data to sunspot
*/10 * * * * /home/graham/upload_IP_address/data_to_sunspot.sh
/home/graham/upload_IP_address/IP_address_to_sunspot.bas grabs the IP address from
and puts it into
which uses ncftp to send the address to sunspot
live display on own screen -
page built from
nslu2 running updated openwrt with 2 cameras
NB can only run 2 Logitech webcam pro 9000s or one 9000 plus one Logitech C270 HD
KAMIKAZE (8.09, r14511)
not secure ftp on 5121
nslu2 running updated openwrt
runs HD camera and controls bee hive scanner
Runs SE95 .1 deg resolution thermometer with python and i2c tools
# measure temperatures every minute
*/1 * * * * /www/python/SE95_i2ctools_read_once.py 72 ; /www/python/SE95_i2ctools_read_once.py 73 ; /www/python/SE95_i2ctools_read_once.py 75
use secure ftp
at boot time -
creates the ramdisk and starts -
and it uses CANVAS to make a web page that plots solar heater data etc -