Useful Commands

Generate RSA Key
ssh-keygen -t rsa

Place them in .ssh/authorized_keys2 on an other system to get authorized.

Delete Files Older than X Days
find . -mtime +60  -exec rm -r {} \;
Check MX DNS and PTR Record
host -t mx careforyourproperty.com
host -t a webmail.careforyourproperty.com
host -t ptr 74.41.92.198

Stats/Analyze

Demon RAM usage
ps -ylC httpd2-prefork --sort:rss

RRS = Memory consumption in KB

Applications RAM usage
ps axu --sort:command
mpstat

This shows what the CPU's are doing, a bit like in top. You can also do

mpstat -P ALL

to see each individual processor.

sar

This dumps info that the system stores every 10 minutes, to give a history of what the CPU has been doing. Probably not of massive use. http://www.cyberciti.biz/tips/how-do...ilization.html

free

This shows how much memory is in use, and in the cache etc.

vmstat

This one shows info like in free, also some CPU utilisation etc. One interesting bit is under io it has bi and bo, that's blocks in and blocks out for the disk.

man vmstat

has a nice list a couple of pages down that says what all the abbreviations mean.

iostat

Draws a nice table of all the disks and various stats. I wont list them all here as man iostat has nice descriptions of them all.

top

Top is a text mode system monitor, like when you press Ctrl-Alt-Del on a windoze computer. The list of processes can mostly be ignored. The info we want is at the top. (You press q to exit, it will keep refreshing.)

top - 18:09:19 up 34 days,  7:02,  2 users,  load average: 1.06, 1.33, 1.54
Tasks: 287 total,   1 running, 286 sleeping,   0 stopped,   0 zombie
Cpu(s): 26.9% us, 11.9% sy,  0.5% ni, 53.3% id,  7.4% wa,  0.1% hi,  0.0% si
Mem:   4151384k total,  3985148k used,   166236k free,   157152k buffers
Swap:  2097136k total,   124100k used,  1973036k free,  1963828k cached

The top line is the same as from the uptime command. The next line shows the total number of processes on the system, how many are running, and how many are sleeping. The first total should equal the sum of the other number on this line. Running one are running now, sleeping are waiting for something. Zombie and stopped can be ignored. (Assume sleeping) The Cpu(s) line shows stats about what the processors are doing. The percentages are how long they spent in each state, and the states mean: us: user space, processes run by users. Most things fall here. sy: system, the kernel and its things. Not really sure what goes here. ni: nice, time spent on priority processes. id: idle, doing nothing. wa: iowait, waiting for a disk or network device to get data. hi & si: No idea. sorry. The next two rows are for memory, like mentioned above. If you want to know about the process listing, or any of the rest of it, you can do “man top”. Its very powerful and customizable.

Partition Cloning

Boot from CDROM

Run fdisk to create partition

sudo fdisk /dev/sda

p //

 

Prepare to copy

<code>
sudo mkfs -t ext3 /dev/sda6 //

 

Start cloning

<code>
sudo cp -a * /tmp/sda6 //

 

Now setup grub and the menu.lst file so you can boot the new partition.

In this example, we put in an entry in menu.lst like this:

<code>
#Proposed 7.04 on /dev/sda6:
#------------------------------------------
title Linux, kernel 2.6.21.1 on /dev/sda6 80GB Partition
root (hd0,5)
kernel /boot/vmlinuz-2.6.21.1 root=/dev/sda6 ro quiet splash
initrd /boot/initrd.img-2.6.21.1
quiet
savedefault

Now this creates a copy of your Linux in another partition but it is not bootable yet. To make it bootable, you can use Grub like the following:

Grub

Boot Loader = on the boot drive
/boot/grub/menu.lst = on the Linux Partition

Note: If you need to install Grub, boot the Linux CDROM, click on the Terminal, to get a shell prompt.

sudo grub
grub> find /boot/grub/stage1 // root (hd1,2) // setup (hd0) // quit

Edit /boot/grub/menu.lst

#Proposed Linux 7.04 on /dev/sda6:
#------------------------------------------
title Linux, kernel 2.6.21.1 on /dev/sda6 80GB Partition
root (hd0,5)
kernel /boot/vmlinuz-2.6.21.1 root=/dev/sda6 ro quiet splash
initrd /boot/initrd.img-2.6.21.1
quiet
savedefault

Set the default variable in /boot/grub/menu.lst so that the default is as you prefer. </code> </code> </code>

Enter your comment. Wiki syntax is allowed:
  _   __   ____   ____   __ __   ____
 | | / /  / __/  /  _/  / // /  / __/
 | |/ /  / _/   _/ /   / _  /  / _/  
 |___/  /_/    /___/  /_//_/  /___/