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 peshay from sorted by
Terminal - Commands by peshay - 11 results
export PS1="[\u@`curl icanhazip.com` \W]$ "
ssh [email protected] "cd /somedir/tocopy/ && tar -cf - ." | ssh [email protected] "cd /samedir/tocopyto/ && tar -xf -"
2010-04-16 06:48:47
User: peshay
Functions: ssh

Good if only you have access to host1 and host2, but they have no access to your host (so ncat won't work) and they have no direct access to each other.

expdp user/password FLASHBACK_SCN=$(echo -e "select current_scn from v\$database;" | sqlplus / as sysdba 2>/dev/null| grep [0-9][0-9][0-9][0-9][0-9][0-9]*)
2009-10-01 08:55:20
User: peshay
Functions: as echo grep

Creates a consistent datapumpt export on an Oracle database with the current sequence number, while the system is running and changes happens on the database.

ls -lct /etc/ | tail -1 | awk '{print $6, $7, $8}'
2009-09-04 16:52:50
User: peshay
Functions: awk ls tail

shows also time if its the same year or shows year if installed before actual year and also works if /etc is a link (mac os)

rsync -az /home/user/test [email protected]:/tmp/
2009-08-25 10:45:15
User: peshay
Functions: rsync
Tags: ssh file move

copy files to a ssh server with gzip compression

mirror=ftp://somemirror.com/with/alot/versions/but/no/latest/link; latest=$(curl -l $mirror/ 2>/dev/null | grep util | tail -1); wget $mirror/$latest
2009-08-24 15:58:31
User: peshay
Functions: grep tail wget

to download latest version of "util", maybe insert a sort if they wont be shown in right order.

curl lists all files on mirror, grep your util, tail -1 will gets the one lists on the bottom and get it with wget

find /backup/directory -name "FILENAME_*" -mtime +15 -exec rm -vf {};
watch() { while test :; do clear; date=$(date); echo -e "Every "$1"s: $2 \t\t\t\t $date"; $2; sleep $1; done }
host -t mx foo.org
2009-08-14 09:55:19
User: peshay
Functions: host

command is shorter, output unnecessary longer

egrep "^lease" /var/lib/dhcp/db/dhcpd.leases |awk '{ print $2 }'
2009-08-14 07:31:00
User: peshay
Functions: awk egrep

You can use that to create a excludefile for nmap, to find hosts, with no DHCP lease in your DHCP range.

find . -name "*.[ch]" -exec grep "TODO" {} +
2009-08-13 06:17:22
User: peshay
Functions: find grep
Tags: grep

-exec works better and faster then using a pipe