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

Generate MD5 of string and output only the hash checksum in a readable format
Generates the md5 hash, without the trailing " -" and with the output "broken" into pairs of hexs.

Convert ascii string to hex

Remount a usb disk in Gnome without physically removing and reinserting
Remounts a usb disk /dev/sdb, without having to physically remove and reinsert. (Gnome desktop)

Rename files in batch

Swap a file or dir with quick resotre
This lets you replace a file or directory and quickly revert if something goes wrong. For example, the current version of a website's files are in public_html. Put a new version of the site in public_html~ and execute the command. The names are swapped. If anything goes wrong, execute it again (up arrow or !!).

list files recursively by size

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

How to speedup the Ethernet device
ethtool is used for querying settings of an ethernet device and changing them. In this example I setup 100 Mb/s full duplex on my Linux Box

Most Commonly Used Grep Options
This is very helpful to place in a shell startup file and will make grep use those options all the time. This example is nice as it won't show those warning messages, skips devices like fifos and pipes, and ignores case by default.

Show a passive popup in KDE
Display a passive popup during seconds. Additionnaly, --title can be used to set the title of the popup. This is a nice way to communicate with a desktop user of a machine you have an SSH access on : DISPLAY=:0 sudo -u $user -H kdialog --passivepopup "Hello you" 10 --title "cli IM"


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: