utility
How to Check Disk Space and Directory Space in Linux
Surprisingly, I often run into the problem of running out of disk space in Linux.
Here are some simple commands to check what consumes the most space:
- "df -k" shows the percentage of disk consumption for each partition
- "du --max-depth 1 -h /" shows how much space each directory under "/" consumes in megabytes
- "du -sm * | sort -n" does the same thing as the previous command
stackoverflow has a good discussion as well.
Get Rid of Duplicated Entries/Processes in htop Display
htop is a "top" on steroid Linux utility for interactively viewing processes.
What puzzled me was that some of the process counts seem to be doubled.
I know for a fact that I run two Thin servers(BTW, Thin seems to use less memory than Mongrel). But htop shows 4 processes
3895 root 20 0 187M 95484 3732 S 0.0 9.1 0:55.42 thin server (/tmp/site.1.sock) 3899 root 20 0 187M 95484 3732 S 0.0 9.1 0:03.26 thin server (/tmp/site.1.sock)
Linux/Unix Console Tricks: Multiple Screens within One Console, Tailling Multiple Files with multitail
I find the following Linux/Unix console tricks really handy:
Multiple screens within one console
You need to SSH into a Linux server and work with multiple screens(eg: tailing a log, vi a source file, etc). Instead of opening multiple SSH sessions(multiple putty in Windows, or terminal windows in Mac), you can open multiple screens within one console window by using "screen" command.
yum install screen screen
Here are the shortcuts:
- ctrl+a + ctrl+c to add a new screens
- ctrl+a + ctrl+a to switch between screens
- ctrl+a + " to see a list of screens
- ctrl+a + (a number) to switch to the "numbered" screen
Tags: linux console utility screen trick logging shell command











