This is a draft cheat sheet. It is a work in progress and is not finished yet.
Commands and Tasks
Kernel Information |
uname -sr |
CPU Info |
cat /proc/cpuinfo |
Memory Info |
free -h |
Reboots Info |
last reboot |
List Block Devices |
lsblk |
Get BIOS settings |
racadm get BIOS.SysProfileSettings |
Look for Attack Scripts |
strings root/dos64 | grep -i attack |
Look for Spam - Subjects |
tcpdump -nn -i SRVID##### -A "dst port 25" | grep -i subject |
Dead Processes |
ps aux | awk '$8 ~ /D/' |
Limit IOPS |
virsh blkdeviotune SRVID##### sda --total_iops_sec=100 |
Look for port in use |
netstat -lp | grep <PORT TO FIND> |
Add IPTables rules |
iptables -I INPUT -s <YOUR_IP> -j ACCEPT |
Remove IPTables rules |
iptables -D INPUT -s <YOUR_IP> -j ACCEPT |
Gracefully shut down all guests |
virsh list | awk '{print $2}' | grep SRVID | xargs -n1 virsh shutdown |
Earliest sign of disk failure |
cat /var/log/messages | grep exception |
Get Serials |
smartctl --info /dev/sda | fgrep -i Serial |
Get Serials and Firmware |
hdparm -I /dev/sd[a-d] | grep 'Number\|Revision' |
|
|
Ceph
Ceph Health |
ceph health detail |
List Ceph Disks |
ceph-disk list |
Setting 'noout' |
ceph osd set noout |
Removing 'noout' |
ceph osd unset noout |
Fix Inconsistant PGs |
ceph pg repair {id} |
Start Ceph OSD (Centos 6) |
service ceph (start|stop|restart) osd.{id} |
Start Ceph OSD (Centos 7) |
systemctl (start|stop|restart) ceph-osd@{id} |
List down OSDs |
ceph osd tree | grep down |
Locate host of an OSD |
ceph osd find {id} |
SmartMon Tools
Check Health |
smartctl -H /dev/<DISK> |
Short Test |
smartctl -t short /dev/<DISK> |
Check Results of Test |
smartctl -a /dev/<DISK> |
TCPDUMP
Capture all traffic |
tcpdump -nn -i SRVID##### |
Capture Outbound SMTP |
tcpdump -nn -i SRVID##### -A "dst port 25" |
Capture new TCP connections |
tcpdump -nn -i SRVID##### "tcp[tcpflags] & (tcp-syn) != 0" |
|
|
DNS
Lookup records of domain |
dig +answer <DOMAIN> |
Look for A records of domain |
dig +noall +answer <DOMAIN> |
Reverse DNS of an IP |
dig -X +noall +answer <IP_ADDRESS> |
Lookup domain information |
whois <DOMAIN> |
Lookup MX records |
dig +noall +answer <DOMAIN> MX |
Lookup TXT records |
dig +noall +answer <DOMAIN> TXT |
Lookup nameservers |
dig +noall +answer <DOMAIN> NS |
VIRSH
List all VMs |
virsh list --all |
Start a VM |
virsh start <VM_NAME> |
Stop a VM |
virsh destroy <VM_NAME> |
Undefine a VM |
virsh undefine <VM_NAME> |
Define a VM |
virsh define <PATH_TO_XML> |
Dump the configuration |
virsh dumpxml <VM_NAME> |
|
|
LVM
Display physical volumes |
pvs |
Display volume groups |
vgs |
Display logical volumes |
lvs |
List VGs and their UUIDs |
vgs -o +pv_name,uuid |
Rename an LV |
vgrename <UUID> <New_Name> |
Activate an VG |
lvchange -a y <volume_group> |
Activate and ensure working VG |
lvs | awk 'BEGIN {OFS = ";"} {print $2,$1}' | sed 's/;/\//g' | grep <logical_volume> | xargs -n1 lvchange -ay |
Deactive a VG |
vgchange -a n <volume_group>.bak |
Create an LV |
lvcreate <volume_group> --name <new_lv_name> --size ##G |
Remove an LV forcefully |
lvremove -f /dev/<volume_group>/<logical_volume> |
|