Linux Software
Boot
lilo
grub
Kernel
iptables
iptables -L -v -n
iptables -t nat -L -v -n
iptables -t nat -I PREROUTING -p tcp -s 1.2.3.4 --dport 10550 -j DNAT --to-destination 10.11.12.13:10550
iptables -I FORWARD -s 1.2.3.4 -d 10.11.12.13 -j ACCEPT iptables -t nat -I POSTROUTING -s 1.2.3.4 -d 10.11.12.13 -j SNAT --to-source 10.11.12.1 iptables -t nat -I PREROUTING -p tcp -s 1.2.3.4 --dport 10521 -j DNAT --to-destination 10.11.12.13:21 iptables -t nat -I POSTROUTING -s 1.2.3.4 -d 10.11.12.13 -j SNAT --to-source 10.11.12.1 iptables -I FORWARD -s 1.2.3.4 -d 10.11.12.13 -j ACCEPT
Chroot:
rescuecd chroot problem - je treba nastavit vychozi shell :
chroot /mnt/gentoo /bin/bash
pro funkcnost beznych prikazu chrootu:
mount -t proc proc /mnt/gentoo/proc mount --rbind /sys /mnt/gentoo/sys mount --rbind /dev /mnt/gentoo/dev
Netstat - list all processes with port numbers and pids
netstat -anp
Gentoo
reset crashed/stuck service
/etc/init.d/service zap
get all crashed services
for i in /etc/init.d/*; do $i status 2>&1 > /dev/null; j=$?; if [ "$j" -eq 32 ]; then echo CRASHED $i; fi; done
Samba
Vi editor
Useful commands
substitute : for - in mac address selected block
:'<,'>g/-/s//:/g
visual block indent - odsazeni tabulatorem - > nebo <
Colors of comments in putty
into .vimrc:
hi Comment ctermfg=LightBlue
disable auto indenting
:setlocal noautoindent :setlocal nocindent :setlocal nosmartindent :setlocal indentexpr=
thttpd
/etc/thttpd/thttpd.conf
default port 80, default web directory /etc/thttpd
kickstart
linux ks=floppy (pokud kernel nezna sitovku, na floppy musi byt "ks.cfg")
pokud zna a mame web server linux ks=http://10.1.1.1/ks.cfg pozor! - rozdeleni disku nefunguje jak by melo (casto vubec) pokud chceme jinou ip (misto nfs muze byt http) linux ks=nfs:1.2.3.4/my/ks ip=9.9.9.9 gateway=9.9.9.1 netmask=255.255.255.0 .... nebo pro jinou eth linux ks=nfs:10.32.14.46:/KS/ks.cfg ksdevice=eth0
linux ks=hd:fd0/anaconda.ks
pokud mam konfiguraci libovolneho jmena na nejakem zarizeni, napr. i na fd0
mdadm
cat /proc/mdstat
mdadm -A /dev/md0 /dev/sda1
mdadm -S /dev/md0
mdadm --zero-superblock /dev/sda1
less - gentoo lessopen problem (shows hexdump output)
LESSOPEN="" or unset LESSOPEN
serial over net
ser2net - allows network port connection to local serial port
socat PTY,link=/dev/YPort TCP:127.0.0.1:33600 - creates local virtual serial port from remote networked serial port
minicom -D /dev/YPort - test real connection (crtl-A X leaves minicom)
generovani hesla
head -c 8 /dev/urandom | uuencode -m /dev/stdin
|