Commands cache

grub-install /dev/sda
grub-install –recheck /dev/sda
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)

grub-install /dev/sdagrub-install /dev/sda
grub-install --recheck /dev/sda
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
File system

Resources

Superblock general info

http://www.bellevuelinux.org/superblock

Convert to RAID 1

http://wiki.archlinux.org/index.php/Convert_a_single_drive_system_to_RAID
http://wiki.hpc.ufl.edu/index.php/System_mirror
http://www.howtoforge.com/software-raid1-grub-boot-debian-etch-p2

File system

broken databases

/bin/sh /usr/local/bin/els –mysqloptimizedb

mysqlcheck –optimize –repair –all-databases

Uncategorized

To change how PHP is configured

/usr/local/cpanel/bin/rebuild_phpconf –help

Uncategorized

netstat

Show all TCP connections, numeric (IP), process and app name, extended

netstat -antpe

Show all UDP connections, rest as above

netstat -anupe

Show all Unix, rest as above, full extended

netstat -anxpe

Crude DDoS test

netstat -an | grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | uniq -c | sort -n

List listening and non-listening connections, numerical, TCP & UDP, extract the IP column, separate from port, count the occurances and finally sort numerically.

Uncategorized

root su config

The config file (on FC) is /etc/pam.d/su.

One of the below lines must be uncommented

auth sufficient /lib/security//pam_wheel.so trust use_uid
auth required /lib/security//pam_wheel.so use_uid

Uncategorized

slabtop

to be investigated

Processes commands

nice

Starts a process with a custom priority. The default “nice level” is 0.

Runs command with minimum priority (when noting else runs)

nice -n 20 command

Runs command with maximum priority

nice -n -19 command

Processes commands

top

Parameter calls

Top a certain process by PID

top -p PID

Top a certain user

top -u user

Runtime commands

f choose fields listed

o changes the display order

O change the sort by column

<> move sort field

R normal/reverse sorting

H show threads

c command name / full command line

i idle/running

S cumulative time

x highlight sort field

y highlight running threads

z toggle color/mone

b toggle highlight

u show specific user only

k send signal to a process

r renice a process

M sort by memory usage

P sort by CPU usage

d delay

W write config file

q quit

Processes commands

pstree

Lists all processes unde the form of a tree

Lists the structure in ASCII form (otherwise it’ll probably get listed in a nasty form)

pstree -A

By default the processes are listed in a compact form (i.e.: no threads). To disable this add -c

pstree -Ac

To display PID you need to add -p (also removes compaction)

pstree -Ap

To show command line arguments add -a

pstree -Aa

Numeric sort

pstree -An

Processes commands