Command Line Love

A big thanks to Adam Jefferiss for compiling this page!

Ubuntu UK Podcast – Command line Love

S04 E10 – Sun and Steel

Check when your current password expires

expiry -c

S04 E09 – Brave New World

Puts the last few commands into a bash script.

history | tail -n+1 | head -n | sed ‘s/^[0-9 ]\{7\}//’ >> ~/

S04 E05 – The Nomad

Copy *everything* in the current directory and subdirectories (including hidden files, symlinks and so on) with permissions intact.

find . -depth -print0 | cpio –null –sparse -pvd /new/dir/

S04 E03 – Lightning Strikes Twice

Clear out your old tweets and dents from Gwibber

echo "delete from messages;vacuum;" | sqlite3 ~/.config/gwibber/gwibber.sqlite

S04 E01 – New Frontier

Russ Philips sent us this command to help generate secure passwords

while [ `expr length "$WORD"` -lt 8 ]; do WORD=`shuf -n1 /usr/share/dict/words`; done; echo $WORD; WORD=""

S03 E23 – Departure of a grand old man

Check status of Ubuntu One file transfers

TOTAL=`u1sdtool –current-transfers | grep deflated | head -n 1 | cut -f7 -d’ ‘`
PROGRESS=`u1sdtool –current-transfers | grep read | head -n 1 | cut -f7 -d’ ‘`

expr \( $PROGRESS \* 100 \) / $TOTAL

S03 E22 – Long may it wave

Scan the network for machines running SSH from David Leadbeater, also see

After listening live to our command line love above, Graham Bleach told us how to turn broadcast ping back on by tweaking:

nmap -A -v -p 22 x.x.x.x/x
e.g. (nmap -A -v -p 22

S03 E21 – The Pipers Price

Process runtime

ps -eo stime,pid,cmd

S03 E20 – The Midnight Flyer

Multiple Firefox sessions

firefox -ProfileManager -no-remote
(Set up several profiles)
firefox -P [profilename] -no-remote

S03 E19 – If we only knew

Colour Man Pages from Greg Thompson

1) install the "most" pager utility. sudo apt-get install most

2) put export PAGER="most" in your ~/.bashrc
3) Logout, Login
4) man

S03 E18 – Laughing Gas

Simplify reading your email:


S03 E15 – Sharp Shooters

Command line love this week was contributed by loyal listener Mark Johnson. Bashish is a theme enviroment for text terminals. It can change colors, font,
transparency and background image on a per-application basis.


S03 E13 – Three Wise Fools

We have a double-whammy of Command Line Love, first upgrade the OS from the command line and second to reset your terminal


S03 E04 – Capturing Bad Bill

Stringing together a couple of commands into a script is easy enough to do. In this example Ciemon puts together the commands to update your Ubuntu system:

# A script to update and dist-uprade

echo "Updating software sources and then uprading the distro"

sudo aptitude update && sudo aptitude dist-upgrade

S03 E03 – Behind the screen

Josh Holland contributed the following: Bash stores your most recent commands as a command history. Most people are aware of being able to press the up and down arrow keys and Ctrl-R to scan through this history, but there are a couple of other ways to use it too.

You can type !cp and bash will repeat the last command that started with cp. As a special case, you can use !! to repeat the last command and !-n to go back n lines. You can also use ^string1^string2^ to repeat the last command with string1 replaced by string2.

S03 E02 – Their Purple Moment

xrandr -q | grep -w Screen

S02 E19 – The Final Test

Show a list of logged in users and what they’re doing with these two commands!



S02 E15 – Beautiful Chaos

Eject your CD/DVD drive and then close the tray 1 second later!

eject /dev/sdb; sleep 1; eject -t /dev/sdb

S02 E14 – The Centre

List open connections and ports.

lsof -i
watch -d "netstat -ntauple"

S02 E13 – The Tribe of Gum

Ciemon gets a well deserved break from Command Linux Luurve, with a submission from Alan Bell.

Pop the following text in a text file called in your home directory

if [ -z $DISPLAY ]
#not in X so starting man in the foreground

man $1
#X is running so we can pop up the man page in a pretty window
gnome-help man:$1 2>/dev/null &

chmod +x

Edit your .bashrc file and at the end add
alias man="~/"

S02 E11 – Slipback

Produce nicely formatted printable man pages:

man -t byobu | ps2pdf – > man_byobu.pdf
man byobu | col -b > man_byobu.txt

S02 E10 – Day of Reckoning

Checking net connections and throttling other peoples computers

sudo mii-tool

S02 E09 – The Dimensions of Time

Combining the watch, date and figlet commands to make a terminal based, configurable clock

watch -t -n1 "date +%T|figlet"

S02 E08 – The Stolen Earth

Tweeting and Denting from the command line.

BONUS TIP!: Putting a space before a command in the bash shell prevents it from being kept in the history

curl -u user:pass -d status="Tweeting from the shell"

curl -u user:pass -d status="Denting from the shell"

S02 E07 – The Crusaders

Get details of your hardware in a HTML document.

lshw -html > hardware.html