unzip all zip files in the current dir to a separate folder
for file in `ls *.zip`; do unzip $file -d `echo $file | cut -d "." -f 1`; done
March 16th, 2012
![]() |
![]() |
for file in `ls *.zip`; do unzip $file -d `echo $file | cut -d "." -f 1`; done
March 16th, 2012
e.g. /dev/sdb
partition disk:
fdisk /dev/sdb
new partition: key n
primary partition: key p
partition 1
default values
write: key w
format disk:
mkfs -t ext3 /dev/sdb1
edit /etc/fstab accordingly
February 2nd, 2012
to convert a file from utf-16 to utf-8 you can use recode (make a copy of the file first!):
recode UTF16..UTF8 myFile.txt
January 30th, 2012
diff -qr "path/to/first/dir" "/path/to/second/dir" | grep -v -e 'Thumbs' -e 'DS_Store' | sort > diff.txt
December 15th, 2011
sudo rm /etc/resolv.conf sudo ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf
December 5th, 2011
#!/bin/bash
files=(*)
echo "${files[RANDOM % ${#files[@]}]}"
November 3rd, 2011
open all files that contain “/sdk/” for edit:
grep -Rl "/sdk/" . | xargs p4 edit
replace all occurences of /sdk/ with /new_sdk/
grep -Rl "/sdk/" . | xargs sed -i "s#/sdk/#/new_sdk/#g"
September 17th, 2011
if your avi index is corrupt, you can use a tool included in MPlayer (on OSX: sudo port install MPlayer)
mencoder -idx corruptAvi.avi -ovc copy -oac copy -o ReIndexedAvi.avi
September 15th, 2011
for filename in *.xml; do newname=`echo $filename | tr -cd '\11\12\15\41-\176'`; mv "$filename" "$newname"; done
June 21st, 2011
OSX contains some tools for system level analysis originally developed for Solaris – one of them is opensnoop.
The tools’ descriptions can be found here: http://www.brendangregg.com/dtrace.html
May 23rd, 2011