« April 2008 | Main | June 2008 »

May 2008 Archives

May 1, 2008

Ripped XO keyboard

My picture of a ripped XO keyboard, which I posted on the olpc forum, was picked up by engadget, gizmodo, the eee pc blog, and pocket-lint. The comments on those articles lodge a number of accusations against me:

1) I should use a better camera and I'm an incompetent photographer. Huh? I think the ability to appreciate which camera is fastest, most readily available, and able to convey the information is pretty sophisticated thinking, but here's a fancy picture. Check. Of course, I think you'll agree the information conveyed by the photo really didn't change using a DSLR, macro lens, and putting it near an open window on the north side of the building so as to get that nice large-source sidelight.

what a 3 year old can to an olpc XO keyboard    What a three-year-old can do to an XO keyboard

2) People allege I live in a McMansion, my child is spoiled, I gave it to a child too young, and African kids won't do this because they'll be beaten. Even if I could live in a McMansion, I wouldn't, but I was an officer in the Navy for seven years and now I'm in medical school, so there's no McMansions in my near future. We live in a 3 bedroom slab in an average post-War burb full of three-bedroom slabs. We are living on student loans and I'll owe the Navy yet more time after medical school. When the Navy ships us off to someplace else for my residency, and possibly more time on a ship, hopefully we can sell the house at not too much of a loss. My wife and I agree we'd like to live in a more interesting neighborhood when we move. Living in New Orleans, post-storm, my son spent most of his first year of life an internally displaced refugee in College Station, Texas, where we crammed the four of us and my parents into their three-bedroom slab. We don't watch TV, there's no video games, both kids sleep in one room (after College Station they seem to prefer it, and the third bedroom is a study/guestroom), and their toys are relatively few and focused on creative play: lego, brio, drawing supplies, the creme-de-la-creme is an old chalkboard my dad rescued from a dumpster when I was a kid. Everything is blessed by my wife, a pediatric occupational therapist who works full-time with learning-disabled children. My son, thankfully, is quite bright and now three. He doesn't yet understand the monetary value of individual items and he is possibly the kindest child I've ever met. I left the computer out for my six-year-old daughter to play with, she got bored, went to play in the dirt outside; I was studying. I'm pretty sure he was just curious. Kids, they aren't nasty, nor do they understand the consequences of all their actions. That's part of what they learn. Anyone who says the African kids will take care of these computers because they get the sense beat into them has an awfully low valuation of people and an awfully high valuation of machines.

3) I've been accused of deliberately doing this and blaming my son. Um, no.

4) So what was my point? Well, for starters, it seems there really should be spare parts and high-failure rate parts should be identified. I could have sent it back and gotten my money back, it was within the RMA window, but I'd rather my kids get to play with an XO. If anyone knows how to fix these keys, I'd take that, but I've never heard of a rubberized anything this complex being easily or adequately repaired. Second, I really think I had a better idea for a keyboard design, which I posted in my original article. In fact, I even provided a letter-art diagram in the post on the olpcnews forum.

On the up side, I'm glad to see the new media companies sourcing their photographs.

I think Negroponte is trying to do right. I'm not sure, but it seems like OLPC may have bitten off more than they were ready to chew. I still think he's doing his best and all the people who spent braincells complaining about my picture or generally making completely non-contributory comments about the OLPC project in general should have spent those brain cells on the OLPC wiki or scrapping together some lunch money to buy an XO so they too could contribute to the learning process. If anything, I regret letting my original irritation leak through, but, if it gets OLPC to release some replacement keyboards, I'd really appreciate it.

May 29, 2008

Brief list of useful commands

So, the purpose of this is to provide a ready reference, a sort of ultimate *nix cheatsheet, something like a pocket thesaurus, for the newbie and the journeyman alike. If an expert finds something useful or wants to contribute, I'd certainly appreciate it, but I hope no truly arcane expert-only knowledge ends up here. Eg, rare tricks do not belong here, though I may very well find them fascinating in another context. Anyone can edit it, hopefully for the better.

A couple of key concepts that may help

Everything in a UNIX-like system is a file. As far as Linux is concerned, the mouse is a file.

What you write on the command line goes into a special file called stdin (standard input)

What the shell (the command line program) prints on the screen under the command you just executed, if anything, is written in a special file called stdout. Found in the /dev directory, like null. Errors go to a special file called stderr.

special punctuation

There are some privileged characters | -- pipeline commands, that is, use output of one command as input for the next: eg: ls -al | less

> -- put results in following file, eg: $ ls -al > listing. Another useful example: netstat > /dev/null (dumps stdout into a trashbin called the null device)

& -- background a task to get your command line back with the ampersand (particularly useful if you're in a non-windowing environment, eg make install lots of packages > /dev/null &)

Useful key combos for the command line

ctrl-c -- kill the last given command (I think this is technically a sighup) ctrl-z -- stop the last given command (I think this is technically a sigstop)

Useful key combos for text editors generally

These are so common, they persist even into the most backwoods, arcane, backwards Windows app, like AHLTA. If you are interested in the copious key combos for a particular text editor, go check that website. ctrl-z -- undo ctrl-x -- cut ctrl-c -- copy ctrl-v -- paste ctrl-a -- select all ctrl-b -- bold (not useful in true plain text editors, but I thought I'd throw it in) ctrl-i -- italic (not useful in true plain text editors, but I thought I'd throw it in)

commands

A bit on style. I'm not a linux guru. I started this list for my own benefit. If you quizzed me on this list tomorrow, I'd get some wrong. Some of the things I've put here may not by exactly correct. This is not meant to be a comprehensive list of every program in the Debian repositories, nor is it intended to be the complete set of man pages for all those programs. It's meant to be a bit like a pocket thesaurus. Easily searchable with ctrl-f, good enough to get the drift, with some pointers to other helpful ideas.

The commands and some examples are wrapped in tags. The input for that command is in plain text. A brief explanation, sometimes with a very useful example or a very useful flag or two, follows, finished with "See also" where appropriate.

apt -- debian's package manager. See also rpm, yum.

bg -- background a task. Typically used like this: 1) ctrl-z 2) bg 3) disown %1

cal -- displays calendar

cat filename -- Displays the contents of a file in the terminal. See also: head, less, more, tail

cd -- change directory

cp sourcefile detstinationfilename -- copies a file

chkconfig -- manages the services that start up and shut down in different runlevels (we are running in runlevel 3) the --list option is safe. Don't add or delete things unless you know what you're doing.

chgrp -- change group of a file or directory, usually need to do this before chown, as the owner must belong to the group that owns the files

chown -- change owner of a file or directory.

chmod -- change permissions of a file or directory. Usually better to change the owner and group. chmod 777 is not a command you should be using on a webserver.

clear -- clears the terminal window

curl -- a very useful http fetching tool. See the scripting section below.

date -- displays current date and time

diff -- compare two files. diff, grep, and the operators | and > can be very useful if you're trying to troubleshoot.

disown PID or %job number -- orphan a process. See also bg, screen.

df -- displays all mounted filesystems

echo string -- copies string to terminal, technically to stdout.

file filename -- displays information about file contents

finger username -- User information lookup program

finger username@hostname -- obtains detailed information about a user currently using the system

ftp -- utility to transfer files between systems on a network. See also

grep string filename -- look through file for following expression ('get regular expression'). To search all files in the working directory: grep -rl "string" . (don't forget the period or you'll search the whole filesystem!)

gunzip filename -- decompresses a compressed file. See also tar, gzip.

gzip filename - compresses a file. See also gunzip, tar.

head filename -- displays first 10 lines of file. See also: cat, less, more, tail

hostname -- Displays system identity name. See also uname, netstat, finger, nslookup.

info -- displays information and documentation on shells, utilities and programs

iptables -- poke holes in the firewall or plug them. Don't play with this unless you have nmap and wireshark and know how to use them.

jobs -- displays a list of current jobs

kill PID or %job number: Aborts a process by PID (Process Identification Number) or job number

kssh -- if you use KDE, you really need to check this one out. Provides most of the common but sometimes complex ssh commands in a GUI.

lcd -- change local directory while logged into a remote machine. See also cd, ftp, lls, rcp, sftp.

locate -- print location of certain system files, such as administrative commands (eg, locate ifconfig)

lls -- list local directory contents while logged into a remote machine. See also ftp, lcd, ls, rcp, sftp.

ls -- list directory contents (ls -al lists all, including hidden, and shows permissions and owners

ln -- link one file to another. Remember, directories are files. Particularly, symbolic links, symlinks, are very handy:

$ mkdir pond
$ ln -s pond puddle
$ cd puddle
$ touch drizzle
$ cd ..
$ cd pond
$ ls
puddle

less filename -- read a file from the terminal. Use up/down to scroll, use f and b to jump half a page at a time less. See also: cat, head, more, tail

lpr filename -- sends file to printer

man -- manual page for the command (man w, man top, man less)

mc -- midnight commander, an ncurses file manager in your shell, similar to mutt, pine, elm, or yast.

mesg y/n -- sets options for letting other users write you messages. See also: talk, w, who, write.

more filename -- Displays the contents of a file in the terminal one page at a time

motd -- read the Message of the Day

mv existingfilename newfilename -- technically this moves a file or directory, but it's also used to rename things: eg, to rename the directory wordpress-2.5.1 as blogs : mv wordpress-2.5.1 blogs

nano filename -- simple test editor. See also edit, emacs, gedit, pico, vi, vim.

netstat -- displays network connections. See also finger, traceroute.

nslookup -- queries Internet domain name servers. See also finger, traceroute.

passwd username -- changes password

ping host -- utility used to test connection to a remote system

ps process number -- information about a task. Useful flag: -C process number by command name.

rcp file remotemachine -- used to copy from a remote computer. See also ftp, scp, sftp.

rlogin host -- utility to connect to a remote system. See also ftp, ssh, sftp, telnet.

rm filename: removes a file

rsh command -- utility to run a command on a remote system without logging in.

rsync -- a very powerful backup utility that runs via ssh. See also: cp, sftp, ssh.

screen -- opens a new teletype console within, say, an ssh session, which allows you to run commands and then detach from that terminal without killing the process. See also bg and disown.

sftp -- use the secure file transfer subsystem of the ssh protocol. Useful commands: put, get, cd (change directories in the remote machine) , lcd (local cd), ls, lls, you get the idea. Very useful flag: -oPort=####. See also ftp.

ssh -- a means of accessing a computer remotely. From an admin standpoint, this is as good as sitting in front of the box.

startx -- starts an X Window System server

strace -- useful for debugging, it logs every system call. If you're using this, something has probably gone wrong. Eg. to find out what happens while using rpm to install a package, you could run "strace -s 255 -o /tmp/rpm.log rpm -U your_rpm_file_name.rpm"

service -- commonly used on Red Hat systems to start and stop services.

tail filename -- displays last 10 lines of file. See also: cat, head, less, more.

talk user -- allows two way chat to other users. See also mesg, w, who, write.

tar -- extract an archive in the directory you're currently in, eg: to unpack a wordpress tarball, you might "tar -xzvf wordpress-2.5.1.tar.gz". See also gzip, gunzip.

telnet host -- utility to connect to a remote system (similar to rlogin but more interactive). See also ssh.

top -- displays updating list of running processes, sortable by cpu time, memory, etc

touch -- make an empty file

traceroute host -- prints the route packets take to the host. See also finger, netstat, nslookup.

tty -- displays the name of the terminal in which the command was issued

uname -- name of the operating system currently running. See also hostname.

vi -- the standard Unix text editor. Very good, but missing some basic user friendliness, like arrow keys. There is a command mode where keys do things, and an insert mode where keys leave characters in the buffer. In command mode, to move, use h, j, k, l. To enter insert mode, type i. To return to command mode, hit esc. There are lots of cheatsheets, google for them.

vim -- vi modified for humans with modern keyboards and color monitors. Because the backspace key doesn't suck.

w -- who's currently logged on, with processing usage

wget -- download a file from the internet to the directory you're currently in, eg: wget http://wordpress.org/wordpress-2.5.1.tar.gz. See also curl.

whereis command -- displays paths to locations of commands. See also which.

which command -- displays path to command. See also whereis.

who -- lists currently logged on users. See also mesg, talk, w, write.

write username -- exchange messages with someone else online. See also mesg, talk, w, who.

yum -- install a standard package maintained by CentOS in it's online repositories. eg: "yum install perl" will install perl. This very powerful package manager is the preferred way to install software in Red Hat based distros. It can get quite complicated, receiving packages from all sorts of non-standard repos, etc. See also apt, rpm.

zfs list -- list the user filesystems in a pool.

zpool -- manage a zfs storage pool and all the file systems in it.

Some other shells you might want to try

bash (default)

korn (the original)

zsh (Sun's be-all-end-all shell. According to them)

Regular expressions

I am woefully uninformed about the hallowed regex world. Those more informed souls, please contribute. * -- wildcard for any number of characters % -- wildcard for one character

Scripting -- the extreme basics

A basic shell script: #!/bin/sh echo "City Sky Tc Tl Th Wind Baro" curl -s http://www.srh.noaa.gov/data/LIX/RWRLA | grep "BELLE CHASSE"

What I'd really like to see in this section are scripts in python, php, perl, scheme, , etc, that can be dropped into a web-accessible directory, which will render a form that asks for your first and last names, take the input you submit, store it in a MySQL database, and then asks you to query a first name, and prints all associated last names in the database. Why? Because I have no idea how to do that in any language except I bought php and MySQL book once that showed the script for this in two pages of code, and I keep meaning to implement that to start really learning web programming, but I never get around to it.

About May 2008

This page contains all entries posted to The Haversian Canal in May 2008. They are listed from oldest to newest.

April 2008 is the previous archive.

June 2008 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.34