Showing posts with label /info/Quick_Notes. Show all posts
Showing posts with label /info/Quick_Notes. Show all posts

Wednesday, March 30, 2011

ypserv picks up random port which a pain when configuring your iptables

To configure NIS static port, add the following line in your /etc/sysconfig/network

YPSERV_ARGS=”-p 834″ YPXFRD_ARGS=”-p 835″

Then add iptables rules
 
#NIS
iptables -A custom-fw-input -p tcp --dport 834 -j ACCEPT
iptables -A custom-fw-input -p udp --dport 834 -j ACCEPT
iptables -A custom-fw-input -p tcp --dport 835 -j ACCEPT
iptables -A custom-fw-input -p udp --dport 835 -j ACCEPT



ref:http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/s2-server-nis-ports.html

Wednesday, March 23, 2011

Input-output redirection

: > filename #zero lenght
> filename #truncate file
>> filename #append stdout to a file
1>filename #redirect stdout to filename
1>>filename #append to filename
2>filename #redirect stderr to filename
2>>filename #append stderr to filename
&>filename #redirect both stdout and stderr to filename

ref: http://tldp.org/LDP/abs/html/io-redirection.html

Vi Commands

Start of the line    0
End of the line $
Start of the file  :1
End of the file  <esc>G
Save and quit :wq
Save and quit in a read-only file :wq!
Save and exit ZZ
Change globally in current line   :s/OLD/NEW/g
Search and delete line containing the pattern :g/Stress Inside/d
Search and replace word/delete word :%s/word/new word/g   >> gc--if you want confirmation
Change word   :cw
Change line :C
Show line numbers  :set number
Delete line numbers (example line 1 to 4 )  :1,4d
Copy line Y
Paste line P

Motion:
w move to the next word
W move to next delimeted word
b back to the word

Saturday, February 26, 2011

Quick Notes

Linux Runlevels
0 - system shut down
1 - single user mode
2 - multi-user setup w/o NFS
3 - multi-user and networking
4 - unused
5 - X11
6 - reboot

System boots

/etc/rc.d/rc.sysinit > start level speficied in /etc/inittab > /etc/rc.d/rc
K* - stop
S* - start