What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



Commands using set from sorted by
Terminal - Commands using set - 47 results
convert input.png -alpha set -channel A -fx 0.5 output.png
esxcli network ip interface ipv4 set -i vmk1 -I -N -t static
set +e +u; dd if=/dev/urandom of="/media/usb1/$$";sync;sync
2013-12-22 14:35:53
User: warkruid
Functions: dd set

I sometimes have use an usb stick to distribute files to several standalone "internet" pc's. I don't trust these machines period. The sticks I have do not have a write protection. So as a added security measure I fill the unused space on the (small) usb stick with a file with randomly generated bits. Any malware that tries to write to this stick will find no space on it.

Tested on slackware 14

Note: you may need root access to write to the device. This depends on your mount options.

(amixer get Master | grep off > /dev/null && amixer -q set Master unmute) || amixer -q set Master mute
amixer -c 0 set Master 1dB+
2013-07-25 15:28:45
User: chrisp6825
Functions: amixer set

adjusts the 'Master' channel's volume up by 1dB.

Can use command 'amixer' to see other channels :

Simple mixer control 'Master',0


Simple mixer control 'Capture',0

convert infile.png \( +clone -channel GB -evaluate set 0 +channel \) +append -region 50%x100% -channel R -evaluate set 0 +channel outfile.png
2013-04-30 20:46:02
User: bugmenot
Functions: set

Converts red-cyan 3D anaglyphs to side-by-side format viewable by crossing your eyes. Useful for people who don't have 3D glasses or prefer not to use one.

amixer -c 0 set Master 100%
2013-03-28 16:30:10
User: thewarden
Functions: amixer set

Replace "Master" with desired control name (e.g. Front, Earphone, PCM, etc.).

color()(set -o pipefail;"[email protected]" 2>&1>&3|sed $'s,.*,\e[31m&\e[m,'>&2)3>&1
set -o vi
2013-01-08 11:21:52
User: bman
Functions: set

For if you want to use vi key bindings in the terminal

for i in $(multipath -ll | grep "3PARdata,VV"|awk '{print $1}') ; do parted -a optimal /dev/mapper/$i --script -- mklabel gpt mkpart primary 1 -1 set 1 lvm on ; done
2012-09-12 15:30:36
User: mhs
Functions: awk grep set

`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

set -x && PS4='+\t '
amixer -c 0 set Master toggle | tail -1 | awk '{print $4}' | sed "s/[^0-9]//g" ; amixer -c 0 set Speaker toggle >/dev/null; amixer -c 0 set Front toggle >/dev/null
amixer -c 0 set Master toggle | sed -n "$ p" | awk '{print $4}' | sed "s/[^0-9]//g"
set str=user_pref("browser.startup.homepage", "http://www.fcisolutions.com/"); cd = "%APPDATA%\Mozilla\Firefox\Profiles\*.default\" echo %str%>>prefs.js
2012-05-30 18:50:15
User: Micool777
Functions: cd echo set

Pros: Works in all Windows computers, most updated and compatible command.

Cons: 3 liner

Replace fcisolutions.com with your site name.

(set -o noglob;while sleep 0.05;do for r in `grep -ao '[[:print:]]' /dev/urandom|head -$((COLUMNS/3))`;do [ $((RANDOM%6)) -le 1 ] && r=\ ;echo -ne "\e[$((RANDOM%7/-6+2));32m $r ";done;echo;done)
2012-04-13 02:09:10
User: khopesh
Functions: echo head set sleep

A tweak using Patola's code as a base, this full-width green matrix display has all the frills (and all the printable characters).

You don't need the surrounding parens if you don't care about losing globbing capabilities. Z-shell (/bin/zsh) needs neither the parens nor the `set -o noglob`

Screen shot (animated): http://desmond.imageshack.us/Himg32/scaled.php?server=32&filename=matrixh.gif&res=landing

If it's too slow, try lowering the `sleep 0.05` or even replacing it with `true` (which is faster than `sleep 0`).

I squashed it as narrow as I could to conserve space, though somebody could probably squeeze a char or two out.


gsettings set org.gnome.desktop.background show-desktop-icons true
check(){ power=$(acpi -a) ; if [[ $power == *on-line* ]] ; then echo "supply is on"; else echo "somebody is steeling your laptop"; amixer -c0 set Master 100+ unmute ; mpg123 nuclear-alarm.mp3 ; fi } ;while true; do check ; sleep 2 ; done
2011-12-10 13:42:52
User: hoodie

Checks whether your power supply is still plugged in.

If not it will trigger an alarm at maximum volume.

gsettings set org.gnome.desktop.background picture-uri file://"$(find ~/Wallpapers -type f | shuf -n1)"
2011-10-21 12:24:58
User: Bonster
Functions: set

Change Random Wallpaper on Gnome 3

(set -e; while true; do TEST_COMMAND; done) | tee log
2011-09-06 12:29:11
User: wipu
Functions: set tee
Tags: tee while set

If you need to fix a randomly failing test (race condition), you need to run it until you get that hard-to-reproduce failure.

convert input.png -alpha set -channel A -fx 0.5 output.png
cd() { if [ -n "$1" ]; then [ -f "$1" ] && set -- "${1%/*}"; else [ -n "$CDDIR" ] && set -- "$CDDIR"; fi; command cd "[email protected]"; }
2011-06-24 08:48:13
User: flatcap
Functions: cd command set
Tags: cd test set

Move efficiently between directories.


This command adds a couple of extra features to cd, without affecting normal use.

CDPATH use is also unaffected. It introduces and environment variable CDDIR which is used as an alternate home directory.


Note: I don't want to alter $HOME because then all my dot files will move.




cd dir

Change directory to "dir" (using CDPATH if necessary)


cd dir/file.txt

Change directory to "dir" (containing folder of "file.txt")

This allows you to cut'n'paste, or use


CDDIR is unset


Change directory to $HOME




Change directory to /home/flatcap/work


For convenience, put the command, and the following, in your .bashrc or .bash_profile

export CDDIR="/home/flatcap/work"

alias cdd="CDDIR=$(pwd)"

gsettings set org.gnome.desktop.background picture-uri 'file://<path-to-image>'
set colsep "{char}"
2011-04-05 10:48:48
User: EBAH
Functions: set
Tags: oracle

set colsep "&TAB" -- for tab separator

set colsep "|" -- for pipe separator


set list / set nolist
sleep 3600; amixer set Master mute
2011-02-06 03:14:33
User: kenbarbour
Functions: amixer set sleep

Mutes the speakers after an hour, in case you fall asleep watching a video...