All commands (14,187)

What's this?

commandlinefu.com 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

Don't spam root. Log your cronjob output to syslog
This command will log the output of your simple cronjobs to syslog, and syslog will take it from there. Works great for monitoring scripts which only produce simple output. Advantages: * This can be used by regular users, without modifying system files like /etc/syslog.conf * Reduce cron spam to root@localhost (Please stop spaming the sysadmins) * Uses common tools like syslog (and logrotate) so that you don't need to maintain yet another krufty logfile. * Still ensures that the output is logged somewhere, for posterity. Perhaps it's stored the secure, central syslog server, for example. * Seems to work fine on Ubuntu, CentOS, FreeBSD & MacOSX

list block devices
Shows all block devices in a tree with descruptions of what they are.

Top 10 Memory Processes
It displays the top 10 processes sorted by memory usage

recursive base64 encoding -- Cipher for the Poor ?
Just for fun, I searched a simple way to encrypt some text. Simple base64 encoding seemed a good start so I decided to "amplify" encoding using repeted base64 encoding. Of course, this is not really secure but can be useful to hide datas to most part of humans ;). Do not hesitate to provide better solutions or else.

Colorized JSON pretty printing
Uses pygmentize and python to create indented and colorized JSON output

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

list files recursively by size

To Stop or Start (Restart) a Windows service from a Linux machine

Mount a VMware virtual disk (.vmdk) file on a Linux box
This does not require you to know the partition offset, kpartx will find all partitions in the image and create loopback devices for them automatically. This works for all types of images (dd of hard drives, img, etc) not just vmkd. You can also activate LVM volumes in the image by running $vgchange -a y and then you can mount the LV inside the image. To unmount the image, umount the partition/LV, deactivate the VG for the image $vgchange -a n then run $kpartx -dv to remove the partition mappings.

SSH to a machine's internet address if it is not present on your local network
Ping machine once, waiting 1 second for response until failing. Upon fail, ssh globally, otherwise ssh locally.


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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: