Commands by jmorganwalker (12)

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

archive all files containing local changes (svn)
Create a tgz archive of all the files containing local changes relative to a subversion repository. Add the '-q' option to only include files under version control: $svn st -q | cut -c 8- | sed 's/^/\"/;s/$/\"/' | xargs tar -czvf ../backup.tgz Useful if you are not able to commit yet but want to create a quick backup of your work. Of course if you find yourself needing this it's probably a sign you should be using a branch, patches or distributed version control (git, mercurial, etc..)

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Read choice from user instantaneously
Usage exaple cmd $echo 'Sure to continue ??'; read -n1 choi; if [ "$choi" = 'y' ] || [ "$choi" = 'Y' ]; then echo -e '\nExecuting..'; else echo 'Aborted'; fi

Arch Linux: Search for missing libraries using pacman
If, while using a program, you get an error similar to: error while loading shared libraries: cannot open shared object file: No such file or directory Use pacman or pkgfile to search for the package that owns the missing library

Arch Linux sort installed packages by size
This one-liner will output installed packages sorted by size in Kilobytes.

Capitalize first letter of each word in a string - A ruby alternative
"-n" loops around ; "-e" executes the given quoted string ; "$_" is the current line ; "split" creates an array on white space; each item of the array is "collected" to be then "capitalized" ; the array is "joined" back into a string.

Change wallpaper

Display a block of text with AWK

a trash function for bash
Every rm'ed a file you needed? Of course you haven't. But I have. I got sick of it so I created a bash function. Here it is. It'll put trashed files into a $HOME/.Trash/"date" folder according to the date. I have rm aliased to it as well in my bashrc so that I still use the rm command. It'll choke if you attempt to trash a directory if that directory name is already in the Trash. This rarely happens in my case but it's easy enough to add another test and to mv the old dir if necessary. function trash(){ if [ -z "$*" ] ; then echo "Usage: trash filename" else DATE=$( date +%F ) [ -d "${HOME}/.Trash/${DATE}" ] || mkdir -p ${HOME}/.Trash/${DATE} for FILE in $@ ; do mv "${FILE}" "${HOME}/.Trash/${DATE}" echo "${FILE} trashed!" done fi }

alias for psql command line; works similar for Oracles sqlplus commandline interface. if you do not provide stdin you will end up in the db shell.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: