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.

Universal configuration monitoring and system of record for IT.

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



Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Commands by paulera from sorted by
Terminal - Commands by paulera - 11 results
tail -v -f $(php -i | grep "^[ \t]*error_log" | awk -F"=>" '{ print $2; }' | sed 's/^[ ]*//g')
2016-08-31 12:13:31
User: paulera
Functions: awk grep sed tail

Runs "php -i", filter the error_log location, then watches it using "tail"

git commit -m "$(curl -s http://whatthecommit.com/index.txt)";
wget -q -O - | strings | tail -n 2
2016-05-03 23:03:55
User: paulera
Functions: strings tail wget

The router Technicolor TC7200 has an exploit where the file is open for unauthenticated access. Even though it is binary, the 2 last strings are the username and password for the pages for router management. It can be read using the 'strings' command, 'hexdump -C' or a hexadecimal editor.

(default user/password = admin/admin)

Reveals more configuration, including SSID name and Key for the wifi network:

wget -q -O -

Hexadecimal dump of the file:

wget -q -O - | hexdump -C
find . -type f -printf '%T@ %TY-%Tm-%Td %TH:%TM:%.2TS %p\n' | sort -nr | head -n 5 | cut -f2- -d" "
2016-03-23 11:56:39
User: paulera
Functions: cut find head sort

The output format is given by the -printf parameter:

%T@ = modify time in seconds since Jan. 1, 1970, 00:00 GMT, with fractional part. Mandatory, hidden in the end.

%TY-%Tm-%Td %TH:%TM:%.2TS = modify time as YYYY-MM-DD HH:MM:SS. Optional.

%p = file path

Refer to http://linux.die.net/man/1/find for more about -printf formatting.


sort -nr = sort numerically and reverse (higher values - most recent timestamp - first)

head -n 5 = get only 5 first lines (change 5 to whatever you want)

cut -f2- -d" " = trim first field (timestamp, used only for sorting)


Very useful for building scripts for detecting malicious files upload and malware injections.

[ $[ $RANDOM % 6 ] == 0 ] && echo 'Bang!' || echo 'Click...'
2016-03-23 11:09:56
User: paulera
Functions: echo
Tags: bash fun

Shows "Bang!" in a chance of 1 out of 6, like in the original game with the gun (spin every round). Otherwise, echoes "Click...". If feeling brave you can also do:

[ $[ $RANDOM % 6 ] == 0 ] && echo 'Bang!' && a really killer command || echo 'Click...'
$if [[ "$(sleep 1 | telnet -c <host> <port> 2>&1 | grep '^SSH')" == SSH* ]]; then <command when up>; else <command when down>; fi;
2016-02-02 13:06:51
User: paulera

This command telnet and and looks for a line starting with "SSH" - works for OpenSSH since the SSH banner is something like "SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u3". Then it triggers an action accordingly.

It can be packed as a script file to echo 0/1 indicating the SSH service availability:

if [[ "$(sleep 1 | telnet -c <host> <port> 2>&1 | grep '^SSH')" == SSH* ]]; then echo 1; else echo 0; fi;

Alternative uses:

Trigger an action when server is UP (using &&):

[[ "$(sleep 1 | telnet -c <host> <port> 2>&1 | grep '^SSH')" == SSH* ]] && <command when up>

Trigger an action when server is DOWN (using ||):

[[ "$(sleep 1 | telnet -c <host> <port> 2>&1 | grep '^SSH')" == SSH* ]] || <command when down>
wget -q -O - http://www.example.com/automation/remotescript.sh | bash /dev/stdin parameter1 parameter2
2015-02-16 16:55:09
User: paulera
Functions: bash wget

Use this command to execute the contents of http://www.example.com/automation/remotescript.sh in the local environment. The parameters are optional.

Alterrnatives to wget:


curl -s http://www.example.com/automation/remotescript.sh | bash /dev/stdin param1 param2


w3m -dump http://www.example.com/automation/remotescript.sh | bash /dev/stdin [param1] [param2]


lynx -source http://www.example.com/automation/remotescript.sh | bash /dev/stdin [param1] [param2]
ip -o -4 a s | awk -F'[ /]+' '$2!~/lo/{print $4}'
2015-02-13 11:19:31
User: paulera
Functions: awk

To show ipv6 instead, use [[ -6 ]] instead of [[ -4 ]]

ip -o -6 a s | awk -F'[ /]+' '$2!~/lo/{print $4}'

To show only the IP of a specific interface, in case you get more than one result:

ip -o -4 a s eth0 | awk -F'[ /]+' '$2!~/lo/{print $4}' ip -o -4 a s wlan0 | awk -F'[ /]+' '$2!~/lo/{print $4}'
curl -XGET 'localhost:9200'
2015-01-23 15:01:29
User: paulera

Replace localhost:9200 with your server location and port. This is the ElasticSearch's default setup for local instances.

wmctrl -r :ACTIVE: -b add,maximized_vert; wmctrl -r :ACTIVE: -b add,maximized_horz
2013-04-24 16:59:04
User: paulera

Bind it to a shortcut key, using something like xbindkeys-config (if you do not have xbindkeys: apt-get install xbindkeys xbindkeys-config)

xdotool windowminimize $(xdotool getactivewindow)
2013-04-24 16:56:08
User: paulera

Bind it to some shortcut key, using something like xbindkeys-config (if you do not have xbindkeys: apt-get install xbindkeys xbindkeys-config)