Commands by kseistrup (3)

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

Reset hosed terminal,
stty sane resets the tty to basic usable function. The ^J is a newline -- sometimes CR/LF interpretation is broken so use the ^J explicitly.

Create an test virus
Test whether real-time virus detection is working by running this command and checking for in /tmp. Requires real-time scanning to be enabled and active on the /tmp directory. If scanning is active, the file should be quarantined/deleted (depending on your settings) moments after running this command. If not, the (harmless) test file should remain in your /tmp directory.

Remove all HTML tags from a file

Dump snapshot of UFS2 filesystem, then gzip it
Opens a snapshot of a live UFS2 filesystem, runs dump to generate a full filesystem backup which is run through gzip. The filesystem must support snapshots and have a .snap directory in the filesystem root. To restore the backup, one can do $ zcat /path/to/adXsYz.dump.gz | restore -rf -

phpdoc shortcut
A shortcut to generate documentation with phpdoc. Defaults to HTML; optionally to PDF if third argument is given. Stores documentation in cwd under ./docs/. I forget the syntax to the output, -o, option, so this is easier.

Recursively search and replace old with new string, inside every instance of filename.ext
This is a slightly modified version of (which did not work due to incorrect syntax) with the added option to sed inside only files named filename.ext

Create a new file

Recursively grep thorugh directory for string in file.
Print line numbers also, so you don't have to search through the files once its open for the string you already grepped for.

parted - scripted partitioning (of all multipathed SAN LUNs)
`multipath -ll` requires Device Mapper multipath.conf configuration. And of course, replace "3PARdata,VV" with your disk array's SCSI vendor,LUN name. - GPT partition table allows you to create >2TB partitions

Prints total line count contribution per user for an SVN repository
make usable on OSX with filenames containing spaces. note: will still break if filenames contain newlines... possible, but who does that?!

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: