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



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 tagged solaris from sorted by
Terminal - Commands tagged solaris - 25 results
pkg update -nv | sed -n '/entire/{N;p;}'
2016-04-15 20:48:49
User: apaton
Functions: sed

Above example is upgrading Solaris from 11.1SRU20.0.5 to 11.2SRU15.0.5. Patches are not applied options "-nv" are for dryrun and verbose output.

find /some/directory/* -prune -type f -name *.log
2014-05-02 00:14:32
User: bigstupid
Functions: find

This find syntax seems a little easier to remember for me when I have to use -prune on AIX's find. It works with gnu find, too.

Add whatever other find options after -prune

wget -qO - http://www.asciiartfarts.com/random.cgi | sed -n '/<pre>/,/<\/pre>/p' | sed -n '/<table*/,/<\/table>/p' | sed '1d' | sed '$d' | recode html..ascii
pflags core.12462 | grep "core "
find . -type f -exec awk '/linux/ { printf "%s %s: %s\n",FILENAME,NR,$0; }' {} \;
truss date 2>&1 | awk '/^time/{print $3}'
perl -e 'foreach (@ARGV) [email protected]=stat($_); print localtime($T[8])." - ".$_."\n"}'
perl -e [email protected] = `ls -1`;while (<@F>)[email protected] = stat($_);print "$_ = " . localtime($T[8]) . "\n";}'
2010-05-20 15:02:51
User: hckhckhck
Functions: perl

Solaris 'ls' command does not have a nice '--full-time' arg to make the time show after a year has passed. So I spit this out quick. It hates spaces in file names.

utime(){ python -c "import time; print(time.strftime('%a %b %d %H:%M:%S %Y', time.localtime($1)))"; }
utime(){ awk -v d=$1 'BEGIN{print strftime("%a %b %d %H:%M:%S %Y", d)}'; }
utime(){ date -d "1970-01-01 GMT $1 seconds"; }
utime { date -d @$1; }
2010-05-12 12:21:15
User: deltaray
Functions: date

More recent versions of the date command finally have the ability to decode the unix epoch time into a human readable date. This function makes it simple to utilize this feature quickly.

utime(){ perl -e "print localtime($1).\"\n\"";}
2009-11-06 12:58:10
User: MoHaG
Functions: perl

A shell function using perl to easily convert Unix-time to text.

Put in in your ~/.bashrc or equivalent.

Tested on Linux / Solaris Bourne, bash and zsh. using perl 5.6 and higher.

(Does not require GNU date like some other commands)

lucreate -n be1 [-c be0] -p zpool1
find . \( ! -name . -prune \) \( -type f -o -type l \)
2009-09-12 15:58:56
User: mobidyc
Functions: find

you must be in the directory to analyse

report all files and links in the currect directory, not recursively.

this find command ahs been tested on hp-ux/linux/aix/solaris.

fuser -k `who -u | awk '$6 == "old" { print "/dev/"$2'}`
2009-09-07 03:36:43
User: lbonanomi
Functions: awk fuser
Tags: Linux solaris

Shell timeout variables (TMOUT) can be very liberal about what is classified as 'activity', like having an editor open. This command string will terminate the login shell for an user with more than a day's idle time.

perl -e 'print scalar(gmtime(1234567890)), "\n"'
echo "0t${currentEpoch}=Y" | /usr/bin/adb
2009-08-25 12:17:01
User: verboEse
Functions: echo

this works on Solaris, so not better than the "only-GNU"-tool :-(

I think, there is no one-liner for this, that will work on all *nix-es

/usr/proc/bin/pfiles $PID | egrep "sockname|port"
pkgchk -l -p <full path to the file>
2009-07-04 08:22:11
User: sengork
Tags: solaris

Find which package a file belongs to on Solaris along with it's packaging system metadata.

more /var/adm/messages
2009-05-29 12:10:18
User: miccaman
Functions: more
Tags: solaris

read system logs of sun solaris 9

init 6
2009-05-29 07:44:05
User: miccaman
Functions: init
Tags: solaris Reboot

init states on solaris are numbered

init 0 boot with prompt

init 5 shutdown

init 6 reboot

vmstat 1 10 | /usr/xpg4/bin/awk -f ph-vmstat.awk
2009-05-04 04:55:00
User: MarcoN
Functions: vmstat

% cat ph-vmstat.awk

# Return human readable numbers

function hrnum(a) {

b = a ;

if (a > 1000000) { b = sprintf("%2.2fM", a/1000000) ; }

else if (a > 1000) { b = sprintf("%2.2fK", a/1000) ; }

return(b) ;


# Return human readable storage

function hrstorage(a) {

b = a ;

if (a > 1024000) { b = sprintf("%2.2fG", a/1024/1024) ; }

else if (a > 1024) { b = sprintf("%2.2fM", a/1024) ; }

return(b) ;


OFS=" " ;

$1 !~ /[0-9].*/ {print}

$1 ~ /[0-9].*/ {

$4 = hrstorage($4) ;

$5 = hrstorage($5) ;

$9 = hrnum($9) ;

$10 = hrnum($10) ;

$17 = hrnum($17) ;

$18 = hrnum($18) ;

$19 = hrnum($19) ;

print ;


lockstat -I -i 977 -s 30 -h sleep 1 > /tmp/profile.out
2009-03-13 13:17:53
User: garylittle
Functions: sleep

Lockstat will sample the kernel 977 times per second, and print out the functions that it sees executing on the CPU during the sample. The -s 10 switch tells lockstsat to not only print that function, but also show the call stack (up to 10 deep).

ifconfig -a | nawk 'BEGIN {FS=" "}{RS="\n"}{ if($1~ /:/) {printf "%s ", $1}}{ if($1=="inet") {print " -- ",system("arp "$2)}}'|egrep -v "^[0-9]$"
2009-03-02 23:15:13
User: leprasmurf
Functions: ifconfig

Needed to get the Mac of various devices on a solaris box, but didn't have root. This command used awk to display the Network device, the IP, and the MAC a line at a time.