Thursday, December 29, 2005

Samba Tips

Its been a long time since I have used samba the fie sharing for Linux on Windows.

smbtree --- find windows machines. See also findsmb

nmblookup -A --- find the windows (netbios) name associated with ip address.

smbclient -L windows_box --- list shares on windows machine or samba server.

mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share ---

The above command mounts a windows share.

echo 'message' | smbclient -M windows_box

Send popup to windows machine (off by default in XP sp2)

networking (Note ifconfig, route, mii-tool, nslookup commands are obsolete

netstat -tupl --- list internet services on a system

netstat -tup --- list active connections to/from system

ip link show --- list interfaces

ethtool interface --- list interface status

ip link set dev eth0 name wan --- ip link set dev eth0 name wan

ip addr add brd + dev eth0 --- add ip and mask(

ip link set dev interface up --- bring interface up (or down)

host --- lookup ip address for name or vice versa

hostname -i --- lookup local ip address (equivalent to host `hostname`)

How to - Rsync

Rsync :

1) rsync -P rsync:// file

Only get diffs. Do multiple times for troublesome downloads

2) rsync --bwlimit=1000 fromfile tofile

Locally copy with rate limit. It's like nice for I/O.

3) rsync -az -e ssh --delete ~/public_html/'~/public_html'

Mirror web site (using compression and encryption)

4) rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/

Synchronize current directory with remote one