Commands tagged korn shell (1)

  • Specify the size in bytes using the 'c' option for the -size flag. The + sign reads as "bigger than". Then execute du on the list; sort in reverse mode and show the first 10 occurrences. Show Sample Output

    find /myfs -size +209715200c -exec du -m {} \; |sort -nr |head -10
    arlequin · 2011-07-07 21:12:46 0

What's this? 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

gh or "grep history" - define a function gh combining history and grep to save typing
By defining a function "gh" as shown here, it saves me typing "history | grep" every time I need to search my shell history because now I only have to type "gh". A nifty time saver :-) You can also add the "gh" function definition to your .bashrc so it is defined each time you login. (updated 2015_01_29: changed from hg to gh to avoid clash with that other hg command. mnemonic: gh = grep history)

Get the size of all the directories in current directory (Sorted Human Readable)
as per eightmillion's comment. Simply economical :)

grep tab chars
mixing tabs and spaces for indentation in python would confuse the python interpreter, to avoid that, check if the file has any tab based indentation. "^V" => denotes press control + v and press tab within quotes. $ cat class Tux(object): print "Hello world.." $ grep " " print "Hello world.."

How to run X without any graphics hardware
This starts an X server using Xvfb(1) (no graphics hardware required), then starts a VNC server on the display. Change :1 if there's a conflict with an existing display, and change 800x600x24 to suit your tastes (24 is the bit depth, 800x600 is the size). This command obviously requires X be installed, and also x11vnc(1); both are available via your favourite package manager. You can also use another VNC server of your choosing, as long as DISPLAY is set to the display of Xvfb(1). To change your desktop environment (the default is twm(1), which is rather fail), you can add it to your ~/.xinitrc file (see the startx(1) manpage for details).

Store dirs to later be changed to independant of the last directory you were in. Also with managment tools.
Check out: help dirs help pushd help popd -- Cheers!

Chmod all directories (excluding files)
+ at the end means that many filenames will be passed to every chmod call, thus making it faster. And find own {} makes sure that it will work with spaces and other characters in filenames.

Batch edition of all Writer files in the current directory (body text)
This function does a batch edition of all OOO3 Writer files in current directory. It uses sed to search a FOO pattern into body text of each file, then replace it to foo pattern (only the first match) . I did it because I've some hundreds of OOO3 Writer files where I did need to edit one word in each ones and open up each file in OOO3 gui wasn't an option. Usage: bsro3 FOO foo

Binary difference of two files
Upload/download newer version of any file with less size and high speed. To remake the new file use $bspatch

Google verbatim search on your terminal
Put it in your ~/.bashrc usage: google word1 word2 word3... google '"this search gets quoted"'

Periodic Log Deletion
deletes logs not modified in over [#] days - modify to compress or move, as needed

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.


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: