Commands by simonbarkow (0)

  • bash: commands not found

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

Find the package that installed a command

Add a line to a file using sudo
This is the solution to the common mistake made by sudo newbies, since $ sudo echo "foo bar" >> /path/to/some/file does NOT add to the file as root. Alternatively, $ sudo echo "foo bar" > /path/to/some/file should be replaced by $ echo "foo bar" | sudo tee /path/to/some/file And you can add a >/dev/null in the end if you're not interested in the tee stdout : $ echo "foo bar" | sudo tee -a /path/to/some/file >/dev/null

Print every Nth line (to a maximum)
Thanks to knoppix5 for the idea :-) Print selected lines from a file or the output of a command. Usage: $ every NTH MAX [FILE] Print every NTH line (from the first MAX lines) of FILE. If FILE is omitted, stdin is used. The command simply passes the input to a sed script: $ sed -n -e "${2}q" -e "0~${1}p" ${3:-/dev/stdin} print no output $ sed -n quit after this many lines (controlled by the second parameter) $ -e "${2}q" print every NTH line (controlled by the first parameter) $ -e "0~${1}p" take input from $3 (if it exists) otherwise use /dev/stdin ${3:-/dev/stdin}

Create QR codes from a URL.
QR codes are those funny square 2d bar codes that everyone seems to be pointing their smart phones at. Try the following... $ qrurl Then open qr.*.png in your favorite image viewer. Point your the bar code reader on your smart phone at the code, and you'll shortly be reading xkcd on your phone. URLs are not the only thing that can be encoded by QR codes... short texts (to around 2K) can be encoded this way, although this function doesn't do any URL encoding, so unless you want to do that by hand it won't be useful for that.

Create md5sum of a directory

Download all images from a 4chan thread
Useful for ripping wallpaper from

Show all configured ipv4
Short list of all ip. Shows even the newly supported multiple ip address on the same interface (see eth1). For ipv6 use -6

list all opened ports on host

sum numbers in the file (or stdin)
add integers from the stdin and print out the result usually, cat /tmp/file | echo $(($(tr '\n' '+')0))

View user activity per directory.
View all files opened by a user in specified directory. The +D option makes lsof search all sub-directories to complete depth, while ignoring symbolic links.

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: