Wednesday, June 28, 2006
Modifying the kernel's make install initrd image
# mkdir myinitrd
# cd myinitrd
# gzip -dc < /boot/initrd-your-version-here.img | cpio -i
# edit init do what you want at the top of the script. Usually custom scripts added after mounting /proc but before mounting any drives
# find . | cpio -o -c |gzip -9 > /boot/initrd-your-version-here.img
Tuesday, June 27, 2006
Single Writer Multiple Readers using Anonymous Pipes
scan_nets(){
echo "Going to scan nets"
rm -rf *.trace
iwlist $wintf scanning | tee >(grep "ESSID" |cut -d ':' -f 2 > essid.trace ) >(grep "Encryption"|cut -d ':' -f 2 > enc.trace ) | (grep "Quality"|cut -d '=' -f 2 > quality.trace)
paste -d " :" essid.trace enc.trace <(cut -d " " -f 1,3 quality.trace) > table
availnets=`cat table`
selected_net=$($DIALOG --stdout --title "Scanned Networks Available. " --radiolist "Press Cancel to enter your own ESSID
ESSID Encypted? Signal Strength" 18 45 12 $availnets)
retval1=$?
case $retval1 in
0)
echo "Input string is $selected_net";;
1)
echo "Cancel pressed.";;
#No problem will prompt for essid later
255)
$DIALOG --no-close --no-buttons --title "Disable Network" --infobox "User Interrupt going to disable the network" 8 32 10
;;
esac
}
Saturday, June 10, 2006
Creating symbolic links for bootup scripts
cd /etc/rc4.d
ln -s ../init.d/vmware S90vmware
The S (as apposed to K) signifies that you want this script to run and the 90 determines the order of being called in this folder.
Friday, June 09, 2006
Coping folders between Machines
/etc/init.d/ssh start
Regenerate host keys for ssh if necessary
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
package your folder
tar -cvf folder.tar folder | gzip > folder.tgz
copy it
scp folder.tgz root@192.168.1.5:/home/anwar/myfiles
extract it
gunzip folder.tgz
tar -xvf folder.tar
Alternatively you can also use
smbmount //ipaddress/path/to/folder /mountfolder -o username=anwar
Linux Managing multiple Network interfaces
ifconfig eth1 down and force the other to take over using the pump command.
# pump -i eth0 --status
Check the status / get details of dhcp on eth0
# pump -i eth0 --release
Release dhcp IP on eth0
# pump -i eth0
Request a dhcp ip for eth0
Wednesday, June 07, 2006
Setting up Knoppix file system on a hard drive
mount -t unionfs -o dirs=/ramdisk=rw:/KNOPPIX=rw unionfs /
Normally you can only write in the /KNOPPIX folder and therefore you will need to remount it to be writable via
mount -o remount, rw /KNOPPIX/
Another thing you might want to do is chroot /KNOPPIX/ so that you don't confuse / with /KNOPPIX
Before chrooting you can mount the /proc and /dev to the new folders.
mount -o bind /proc /KNOPPIX/proc
Tuesday, June 06, 2006
Setting up and Formatting encrypted Partitions
format
mke2fs -j /dev/loop7
Monday, June 05, 2006
changing & formatting partitions
format boot via
mkfs.vfat -F 16 -n NAME -v /dev/hda1
format linux via
mke2fs -j -L KNOPPIX /dev/hda5
turn off filesystem checking via
tune2fs -c 0 /dev/hda5
set up swap via
mkswap /dev/hda6
changing a label of partition after you put your data on it
tune2fs -L NEWLABEL /dev/hda5
Friday, June 02, 2006
Disk Space Remaining
and
du -hsc
Mounting a compressed image
insmod cloop.o file=/path/to/compressed/image
mount -o ro -t whatever /dev/cloop /mnt/compressed