Wednesday, August 6, 2008

Commands Continued...

Backup
dump -0aj -f /tmp/home0.bak /home make a full backup of directory '/home'
dump -1aj -f /tmp/home0.bak /home make a incremental backup of directory '/home'
restore -if /tmp/home0.bak restoring a backup interactively
rsync -rogpav --delete /home /tmp synchronization between directories
rsync -rogpav -e ssh --delete /home ip_address:/tmp rsync via SSH tunnel
rsync -az -e ssh --delete ip_addr:/home/public /home/local synchronize a local directory with a remote directory via ssh and compression
rsync -az -e ssh --delete /home/local ip_addr:/home/public synchronize a remote directory with a local directory via ssh and compression
dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' make a backup of a local hard disk on remote host via ssh
dd if=/dev/sda of=/tmp/file1 backup content of the harddrive to a file
tar -Puf backup.tar /home/user make a incremental backup of directory '/home/user'
( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' copy content of a directory on remote directory via ssh
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p' copy a local directory on remote directory via ssh
tar cf - . | (cd /tmp/backup ; tar xf - ) local copy preserving permits and links from a directory to another
find /home/user1 -name \*.txt | xargs cp -av --target-directory=/home/backup/ --parents find and copy all files with '.txt' extention from a directory to another
find /var/log -name *.log | tar cv --files-from=- | bzip2 > log.tar.bz2 find all files with '.log' extention and make an bzip archive
dd if=/dev/hda of=/dev/fd0 bs=512 count=1 make a copy of MBR (Master Boot Record) to floppy
dd if=/dev/fd0 of=/dev/hda bs=512 count=1 restore MBR from backup copy saved to floppy

CDROM
cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force clean a rewritable cdrom
mkisofs /dev/cdrom > cd.iso create an iso image of cdrom on disk
mkisofs /dev/cdrom | gzip > cd_iso.gz create a compressed iso image of cdrom on disk
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd create an iso image of a directory
cdrecord -v dev=/dev/cdrom cd.iso burn an ISO image
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom - burn a compressed ISO image
mount -o loop cd.iso /mnt/iso mount an ISO image
cd-paranoia -B rip audio tracks from a CD to wav files
cd-paranoia -- "-3" rip first three audio tracks from a CD to wav files
cdrecord --scanbus scan bus to identify the channel scsi
dd if=/dev/hdc | md5sum perform an md5sum on a device, like a CD


Networking (LAN and WiFi)
ifconfig eth0 show configuration of an ethernet network card
ifup eth0 activate an interface 'eth0'
ifdown eth0 disable an interface 'eth0'
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 configure IP Address
ifconfig eth0 promisc configure 'eth0' in promiscuous mode to gather packets (sniffing)
dhclient eth0 active interface 'eth0' in dhcp mode
route -n show routing table
route add -net 0/0 gw IP_Gateway configura default gateway
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 configure static route to reach network '192.168.0.0/16'
route del 0/0 gw IP_gateway remove static route
echo "1" > /proc/sys/net/ipv4/ip_forward activate ip routing
hostname show hostname of system
host www.example.com lookup hostname to resolve name to ip address and viceversa(1)
nslookup www.example.com lookup hostname to resolve name to ip address and viceversa(2)
ip link show show link status of all interfaces
mii-tool eth0 show link status of 'eth0'
ethtool eth0 show statistics of network card 'eth0'
netstat -tup show all active network connections and their PID
netstat -tupl show all network services listening on the system and their PID
tcpdump tcp port 80 show all HTTP traffic
iwlist scan show wireless networks
iwconfig eth1 show configuration of a wireless network card
hostname show hostname
host www.example.com lookup hostname to resolve name to ip address and viceversa
nslookup www.example.com lookup hostname to resolve name to ip address and viceversa
whois www.example.com lookup on Whois database

No comments: