Commands by Viperlin (2)

  • biggest->small directories, then biggest->smallest files Show Sample Output


    -3
    O=$IFS;IFS=$'\n'; D=$(for f in *;do [[ -d $f ]] && du -sh "$f";done | sort -gr);F=$(for f in *;do [[ -f $f ]] && du -sh "$f";done | sort -gr);IFS=$O;echo "$D";echo "$F"
    Viperlin · 2009-09-03 11:39:50 1
  • use manpages, they give you "ultimate commands" "ls -SshF --color" list by filesize (biggest at the top) "ls -SshFr --color" list by filesize in reverse order (biggest at the bottom) Show Sample Output


    -3
    ls -shF --color
    Viperlin · 2009-09-03 05:45:33 3

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

Display total Kb/Mb/Gb of a folder and each file

lsof - cleaned up for just open listening ports, the process, and the owner of the process
another formatting/oneliner for lsof User - Process - Port

Empty a file
For when you want to flush all content from a file without removing it (hat-tip to Marc Kilgus).

Watch the progress of 'dd'
need pv (pipe view) : http://www.ivarch.com/programs/pv.shtml

Copy a file structure without files
Taken from: http://www.webmasterworld.com/forum40/1310.htm

Print number of mb of free ram
Here we instead show a more real figure for how much free RAM you have when taking into consideration buffers that can be freed if needed. Unix machines leave data in memory but marked it free to overwrite, so using the first line from the "free" command will mostly give you back a reading showing you are almost out of memory, but in fact you are not, as the system can free up memory as soon as it is needed. I just noticed the free command is not on my OpenBSD box.

list all opened ports on host

find . -name

rename a file to its md5sum

count of files from each subfolder
Find the number of files from each folder


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: