Pages

Tuesday, February 19, 2013

Find the Size of Directory in Suse Linux

Try these


du -h ./


For the most part this works. If you have spaces in file/directory
names than you may get some errors, but I'm sure you can work around
those if needed:

ls -1drt *| xargs du -h --summarize



You could also try

du -hc --max-depth=1

This will give you all the directories in the current directory, and a total at the bottom. Play with the --max-depth to dig down further in the structure and get more fine-grained results.

You can run this with a pipe to grep "G" to do a quick search of folders that are large enough to be measured in gigabytes. It will pull any directories with a capital G in them, but there aren't many of those so it works for me.

du -hc --max-depth=1 | grep "G"


Friday, February 15, 2013

Where's the php.ini file




/etc/php.ini
Or here:
/etc/php/php.ini
/etc/php5/php.ini

Or here:
/usr/bin/php5/bin/php.ini
Anyway, you can always find any file named php.ini in this manner
find / -name php.ini
The simplest yet most powerful usage of the renowned find command. By its help I was able to locate the php.ini on my Ubuntu 9.04 Apache2 and PHP5:
/etc/php5/apache2/php.ini

Thursday, February 14, 2013

Show Processes Running on Linux, RAM process usage


ps command

Type the following ps command to display all running process:
# ps aux | less
Where,
  • -A: select all processes
  • a: select all processes on a terminal, including those of other users
  • x: select processes without controlling ttys

Task: see every process on the system

# ps -A
# ps -e

Task: See every process except those running as root

# ps -U root -u root -N

Task: See process run by user vivek

# ps -u vivek

Task: top command

The top program provides a dynamic real-time view of a running system. Type the top at command prompt:
# top


Free Disk Space / Disk usage on Linux


Q. How do I check free disk space in Linux or UNIX operating system? I've migrated from Windows NT to Linux and looking forward to get more information about free disk space.
A. Both Linux and UNIX offers two commands for checking out free disk space:
(a) df command : Report file system disk space usage
(b) du command : Estimate file space usage

df command examples - to check free disk space

Type df -h or df -k to list free disk space:
$ df -h
OR
$ df -k

Examples

linuxServer:/ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2            109038804  82892008  20610028  81% /
udev                   3864264        92   3864172   1% /dev
/dev/sda3             10079572   5955024   3612484  63% /home


or you can run this command to get the file sizes at depth 1
# du -hc --max-depth=1


Thanks