My friend Sam posted a blog on his top 15 commands used from the commandline, so here are mine:
sontek@inspidell:~> history | awk ‘{print $2}’ | awk ‘BEGIN {FS=”|”} {print $1}’|sort|uniq -c | sort -n | tail -n 15 | sort -nr
143 ls
135 cd
84 vim
69 exit
57 ssh
56 su
35 svn
25 man
24 rm
24 python
22 sudo
22 jhbuild
18 make
17 grep
16 xrandr
You can tell a lot about a person by their top 15 commands and as you can see with mine, the majority of mine are used for coding!
You can see a break down of the command I used to list these here: http://czarism.com/my-top-ten-linux-comments-history
What are your top 15 commands?
I was helping a friend debug a problem with gksu (gnomesu alternative) today and we chose to use strace which allows you trace system calls an application makes.
To monitor all system calls an application makes you can redirect the output to a file like so:
strace <command> 2> <file name>
or
strace <command> -o <file name>
These commands return the exact same results, the first command redirects stderr (standard error, which has the file descriptor 2) to the file, strace sends all output to stderr by default, the second command uses the built in -o argument which is much cleaner.
One of the first things I like to do with strace is to check if it is having trouble accessing a file, which I see a lot because the file doesn’t exist or the user executing the command does not have permission to access it, you can do that with these commands:
strace <command> 2>&1 |grep open
or
strace <command> -e open
Again, these commands will return similar results. The first command redirects stderr to stdout so you can use grep to filter the output. The second command is the preferred method because it actually uses the built in -e argument which will trace only the named system call (this is a comma separated list so you can do strace -e open,read).
The only other arguments that I’ve found really helpful are -ff which when used with -o will append the pid (process id) to the file name and -F which will also trace children.
I’m lazy, so I just have this basic script I run that upgrades my wordpress:
#!/bin/bash
blog_directory=
update_url=
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
tar -zcvf blog-backup-$(date +’%F’).tar.gz $blog_directory
cp -rv wordpress/* $blog_directory
links $update_url
rm latest.tar.gz
How do you upgrade your wordpress?
I wrote a quick little perl script/irssi plugin that allows you to update twitter from irssi. It also has autocompletion for names from your friends and follower list. You can get it here: http://devtoo.net/svn/twitter/twitter.pl
To use this script place it in ~/.irssi/scripts and then type /load twitter.pl in irssi
Usage:
/twitter u I’m updating twitter from irssi
/twitter d sontek I’m direct messasging sontek from irssi
DISCLAIMER: First perl script I’ve ever written, i’m sure I’ve done things wrong.