dacaprice.com from fitness to technology. mostly technology. sometimes fitness.

24May/110

dump packets with tcpdump

I always forget the parameters for this and have to look them up in the man page, so enough of that:

 tcpdump -nnXSs 0 host hostname (or IP)
  • "-nn" makes it not lookup hostnames in DNS and service names (in /etc/services) for respectively faster and cleaner output.
  • "-X" makes it print each packet in hex and ascii; that's really the useful bit for tracking headers and such
  • "-S" print absolute rather than relative TCP sequence numbers - If I remember right this is so you can compare tcpdump outputs from multiple users doing this at once
  • "-s 0" by default tcpdump will only capture the beginning of each packet, using 0 here will make it capture the full packets.

22Feb/100

Change uppercase filenames to lowercase

I needed to rename a handful of image files from my iPhone from all uppercase letters to lowercase.  I did this in a bash shell in Fedora linux. Here's how I did it:

[dacaprice@fedora10]$ for i in `ls *JPG`
do
mv $i `echo $i |  tr '[:upper:]' '[:lower:]'`
done

Tagged as: , No Comments
3Jan/100

How to run fsck on a Logical Volume in Linux.

I recently had a problem on my laptop running Fedora 11 where my X session just totally froze when trying to bring the laptop back from a hibernate state.  Outside of the occasional issues coming out of hibernate (usually X not restoring) I'd say Fedora 11 has been pretty solid.  This particular time, my X session restored but everything locked up.  I tried switching to another virtual terminal to log in and kill GDM but some sort of inode error just streamed down the console.  My only option was a hard reboot and after that I couldn't boot Fedora with any kernel.  To fix my problem I booted off the Fedora install CD into rescue mode without mounting  / .  I then performed the following:

# lvm pvscan
# lvm vgscan
# lvm lvchange -ay /dev/VolGroup00/LogVol_home
# lvm lvscan
# fsck -yfv /dev/VolGroup00/LogVol_home

Tagged as: , No Comments
14Aug/090

What is the “total” in ls -l ?

Today I had a bit of a brain fart. I might run 'ls -l' in my terminal 100 times a day and today I'm looking the output and asked what is that "total" actually mean?


[dacaprice@fedora10 ~]$ ls -l
total 54752
drwxrwxr-x  2 dacaprice dacaprice     4096 2009-06-02 22:26 bin
-rwxr-xr-x  1 dacaprice dacaprice   291106 2007-12-13 21:03 a.html

Straight from gnu.org, "for each directory that is listed, preface the files with a line `total blocks', where blocks is the total disk allocation for all files in that directory."

Tagged as: , No Comments