Tag bash

Capturing whole packet with tcpdump for analysis with wireshark

Capturing the hole packet on your NIC for later analysis with wireshark $tcpdump -nnvvXSs 1514 -i em0 -w /tmp/em0.dumptcp Will capture 1514 bytes of all packets on interface “em0” and dump it to the file “/tmp/em0.dumptcp”. You can then import the file into wireshark for analysis. Explanation of Parameters Text below is copied from tcpdump man page -nn Don’t convert protocol and port numbers etc. to names either. -vv Even more verbose output.

List all mass storage devices with FreeBSD

Get a list of installed mass storage devices with FreeBSD egrep 'ad[0-9]|da[0-9]|cd[0-9]|acd[0-9]' /var/run/dmesg.boot where: ad -> IDE HDD da -> SCSI HDD cd -> IDE CD/DVD acd-> SCSI CD/DVD Here’s an example output: da0 at ciss0 bus 0 scbus0 target 0 lun 0 da0: <COMPAQ RAID 0 VOLUME OK> Fixed Direct Access SCSI-5 device da0: 135.168MB/s transfers da0: Command Queueing enabled da0: 139979MB (286677120 512 byte sectors: 255H 32S/T 35132C) da1 at ciss0 bus 0 scbus0 target 1 lun 0 da1: <COMPAQ RAID 0 VOLUME OK> Fixed Direct Access SCSI-5 device da1: 135.

FreeBSD watch network interface usage

If you want to know the current network bandwith usage on a FreeBSD host, this will help you. systat -ifstat 1 $systat -ifstat 1 /0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /10 Load Average |||||| Interface Traffic Peak Total lo0 in 0.000 KB/s 0.000 KB/s 308.224 MB out 0.000 KB/s 0.000 KB/s 308.224 MB bce1 in 2.850 MB/s 2.850 MB/s 157.746 GB out 234.496 KB/s 234.496 KB/s 19.

Show all files in OS X’s finder

By default the finder in OS X does not show all the files. You can still see the files if you use a terminal and type ls -la but sometimes you may need the finder to point to a particularly file. e.g. you want to load a hidden file in to an application. To force finder to show all files, just type the following into a terminal: defaults write com.apple.Finder AppleShowAllFiles YES

Howto converting UNIX timestamp into readable format using bash

Howto converting UNIX timestamp into readable format using bash. date -j -f "%s" 1299452400 Mon Mar 7 00:00:00 CET 2011 Get current UNIX timestamp date -j +%s