order directories by size
June 7th, 2010Problem
You want to see which directory is the biggest in size.
Solution
% du / | sort -nr
| NiceCabbage Blog |
| Life, Design, Web Application |
You want to see which directory is the biggest in size.
% du / | sort -nr
You want to apply multiple commands against the results of ‘find’
Just pass as many exec options as you want
.
The command below will run ‘id’, ‘echo’ and ‘file’
% find . -type f -exec id {} \; -exec echo ' and ' \; -exec file {} \;
Your SnowLeopard sometimes doesn’t respond to F8-F12. You cannot launch Spaces, Expose, and Dashboard via those keyboards.
I haven’t gone into this problem deeply yet, but the quick solution for this symptom is to type
% killall Dock
on your Terminal.app.
You want to install open-source softwares like phpmyadmin to your ubuntu 9.10, but you got errors.
E: Couldn't find package phpmyadmin.Add universe components to your sources.list
deb http://archive.ubuntu.com/ubuntu karmic main universe multiverse restricted deb-src http://archive.ubuntu.com/ubuntu karmic main universe multiverse restricted deb http://archive.ubuntu.com/ubuntu karmic-updates main universe multiverse restricted deb-src http://archive.ubuntu.com/ubuntu karmic-updates main universe multiverse restricted deb http://archive.ubuntu.com/ubuntu karmic-security main universe multiverse restricted deb-src http://archive.ubuntu.com/ubuntu karmic-security main universe multiverse restricted
You want to know which version of SIMBL is installed on your machine.
On Leopard,
% head /Library/InputManagers/SIMBL/SIMBL.bundle/Contents/Info.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleGetInfoString</key> <string>0.8.2, © 2007 Mike Solomon</string>
On Snow Leopard,
% head /Library/Receipts/SIMBL.pkg/Contents/Info.plist
In some cases, your wordpress do not generate a valid rss; Weirdly, your rss includes an empty line at the top of the feed. In such a case, when viewed on Firefox3.5 or validated with Feed Validator, your rss would fail.
What we have to do is just to remove an empty line, but to find the bug source is not easy. The output feed is generated through mulitple processes inside Wordpress, themes, and plugins.
The point is that
Hope your luck.
Today I uploaded a new Rubygem called “mw” (pronounced as [mi'u]).
mw is a tiny useful library to output the result of pp to Growl.The original idea of Growl printing comes from jugyo’s g. Though the concept is great, g does not work on my environment. I’ve got “connection errors” from Growl.
I suspect that “ruby-growl” library on my machine does not work well.
Anyway, to overcome this problem, I reinvented the same feature using Meow, a Growl notification wrapper for the rb-cocoa environment.
First, you need to be a Mac-user, and have installed rb-cocoa.
port install rb-cocoaSinece I uploaded mw.gem to gemcutter.org, installing mw is as easy as
gem install gemcutter gem tumble gem install mw
require 'mw' mw "message" mw YourClass.new
To change priority, you can use mw1~5. (mw3 is normal, mw1 is the lowest, and mw5 is the highest. mw4 and mw5 will fire the sticky notes, so that the note will live on your screen persitently.
begin do_dangerous_and_raise_some_exception rescue => e mw4 e end
all the sources can be seen at http://github.com/tomoya55/mw.
1. If you are still not sure what mw is, please take a look at jugyo’s presentation of g.
2. My mw requires rb-cocoa and meow. If you runs ruby on Linux or Windows, you cannot use this library. use g instead.
Yes, SnowLeopard is already out. But most of users including me still loves Leopard, right ?
In this small article, I would like to introduce 2 useful extensions for Terminal.app
With Visor, you can always show Terminal by typing one HotKey. Visor makes Terminal.app invisible when you don’t use, and makes it visible when you need. This is a great application if you are one of CUI freaks!


With TerminalColoreopard, you can change your color settings of ANSI colors in Terminal easily via OSX’s default Color dialog. I strongly recommend to use Adobe Kuler or see the entry “Terminal color schemes for .Xdefaults or .Xresources file” to arrange nice color combinations.
My webserver was down since 13th September. It was an accident, and I did not know that until today.
No apache2 processes alive. my web server has gone away by some reasons.
So I started a deep investigation on log files.
When I checking through auth.log files with
cd /var/log;sudo find auth.log -type f -exec grep Success {} /dev/null \;
and I found a lot of
auth.log.5.gz:Aug 29 10:46:03 Shaseki su[6944]: Successful su for nobody by root auth.log.5.gz:Aug 29 10:46:03 Shaseki su[6949]: Successful su for nobody by root auth.log.5.gz:Aug 29 10:46:03 Shaseki su[6951]: Successful su for nobody by root
Was my server hacked by someone…? Some clever guy attacked my server and got my root password anyhow, so that he can take full control over my machine??
At the first time I saw these messages, I was so astonished and could not say a word.
But in a few minutes I came to myself and googled that message, and I was relieved.
It was not by a unknown hacker. this is by cron. Open /etc/crontab and found that
11 * * * * root cd / && run-parts --report /etc/cron.hourly 46 10 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 15 10 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 50 10 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
As you can see, the time in log messages are almost same as that in crontab.
Hmmmm, So what the hell made my apache gone away?
When I tried to restart my apache like
sudo /usr/sbin/apache2ctl -k start
I got
(98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs
,so I could not start up my apache.
Obviously, some process already hold port 80. but
lsof -i :80
returns nothing. I also tried
nestat -an, but could not find any clues of por-80-riders.
At last, thoght this is what I did not like to, I rebooted the system.
In a few minutes, everything comes back well and, as you see, my apache2 starts running healthly again.
If you know something about such a phenomenon, please leave a comment below. Thank you in advance!
You want to delete all the messages in sending ques of Postfix.
$ sudo postsuper -d ALL