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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
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.
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
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:
Also:
* find . -type f -exec ls -s {} \; | sort -n -r | head -5
* find . -type f -exec ls -l {} \; | awk '{print $5 "\t" $9}' | sort -n -r | head -5
Output made so that it will match initial suggestion for this task. Personally, I think that output of du -h is more readable.
This Command will list files & folders which are in GBs.
G can be replace by M to get files in MBs.
Alias to produce a list of all subdir sizes in current dir, in reverse order and human readable units. du is executed only once. Remove the slash after the asterisk to include files.
du -m option to not go across mounts (you usually want to run that command to find what to destroy in that partition)
-a option to also list . files
-k to display in kilobytes
sort -n to sort in numerical order, biggest files last
tail -10 to only display biggest 10
This combines the above two command into one. Note that you can leave off the last two commands and simply run the command as
"find /home/ -type f -exec du {} \; 2>/dev/null | sort -n | tail -n 10"
The last two commands above just convert the output into human readable format.
Often you need to find the files that are taking up the most disk space in order to free up space asap. This script can be run on the enitre filesystem as root or on a home directory to find the largest files.
Display the size (human reading) of all the directories in your home path (~).
Calculate foldersize for each website on an ISPConfig environment. It doesn't add the jail size. Just the "public_html".
sudo is optional, but to find out about all files, it is nice, or else run as superuser, ie: su -c 'du -sm * | sort -n'
very handy if you copy or download a/some file(s) and want to know how big it is at the moment
shows only folders, that are MB or GB in total size
Just shortened the awk a bit and removed sed. Edit: I'm assuming there are no spaces in the path. To support white space in pathname try:
awk '($1 < 2048) {sub(/^[0-9]+[ \t]+/,""); print $0}'