Jono's Linux Top Tips

Jono’s Linux Top Tips by Jono Woodhouse————————-14 May 2008 : Jono WoodhouseVersion 2.22———————————————————————————————————————————————–Document Title: Jono’s Linux Top TipsHandy Linux Commands.The following is a bunch of useful linux commands and tip I have gathered over the years while I’ve been using an assortment of unix/linux operating systems.Most of them should work for Slax (Slax 6 and Slax 5) and Fedora Core 8, Fedora Core 7, Fedora Core 6, Fedora Core 5, Fedora Core 4 and Fedora Core 3 builds (FC8, FC7, FC6, FC5, FC4, FC3) etc.A number of commands and tips have also been included for the Fox Board which is an Axis Cris board capable of running cris-axis-linux-gnu.www.capesoft.comwww.capefox.comSource URL for this document: http://www.capefox.com/howto/JonosLinuxTopTips.htmContacting the Author: I have a gmail account, which starts with jonoistall, then the at sign – you should be able to work out the rest.———————————————————————————————————————————————————————————————————————————————————————————————-su and sudo————–To become root:su -orsudo su -To issue commands as rootsudo <command>———————————————————————————————————————————————–RPM—–rpm –install <package-name>———————————————————————————————————————————————–YUM—–Docs on yum: http://fedora.redhat.com/docs/yum/en/1) To import the GPG Keys rpm –import /etc/pki/rpm-gpg/* (optional in FC6)rpm –import /usr/share/doc/fedora-release-3/RPM-GPG-KEY* (in FC3 or above for example)2) To check for updates:yum check-update3) To list packages:yum list hddtempyum list availableyum list updatesyum list allyum groupinfo “Games and Entertainment”4) To instalyum install mdadm5) To updateyum update mdadm6) To Searchyum list package_nameyum search package_name7) To Search inside packagesyum provides program_name8) to run yum on the cacheyum -C <command>9) Other bits and peices / Yum GUI etc.yum install yumexyum install kyumpirut (FC5+)pupyum install yum-utilsyumex (Yum Extender)kyum———————————————————————————————————————————————–yum – Livna————–rpm -ivh http://rpm.livna.org/livna-release-6.rpmrpm –import http://rpm.livna.org/RPM-LIVNA-GPG-KEY———————————————————————————————————————————————–yum – Fedora Extras————————-see http://fedoraproject.org/extras/readme.extrasrpm –import http://download.fedora.redhat.com/pub/fedora/linux/extras/RPM-GPG-KEY-Fedora-ExtrasTo use this repository in yum add a file (fedora-extras.repo) in your /etc/yum.repos.d dir with these contents:[extras]name=Fedora Extras – $releasever – $basearchbaseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/gpgcheck=1gpgkey=http://download.fedora.redhat.com/pub/fedora/linux/extras/RPM-GPG-KEY-Fedora-Extras[extras-debug]name=Fedora Extras – $releasever – $basearch – Debugging packagesbaseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/debug/gpgcheck=1gpgkey=http://download.fedora.redhat.com/pub/fedora/linux/extras/RPM-GPG-KEY-Fedora-Extrasenabled=0———————————————————————————————————————————————–yum – DAG—–rpm –import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txtMake a file like dag.repo in your /etc/yum.repos.d with the following:[dag]name=Dag RPM Repository for Fedora Corebaseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/daggpgcheck=1enabled=1———————————————————————————————————————————————–Linux Directory Structure / FileSystem Structure—————————————————————-You can google around, but these are also adequate:http://emerald.obsidian.com.au:8083/hosts/computerbank/computerbank/tutorials/linuxdirectorystructure/http://www.debianadmin.com/linux-directory-structure-overview.html———————————————————————————————————————————————–eee linux———–http://wiki.eeeuser.com/http://www.downloadsquad.com/2007/11/06/eee-pc-tips-a-crash-course-in-linux/Terminal Ctrl-Alt-Tsudo su -wget http://download.tuxfamily.org/eeepcrepos/key.asc sudo apt-key add key.ascFull Desktop – from wiki.eeeuser.com/howto:getkde* From Easy Mode, press Ctrl-Alt-t. This will open a terminal.OPTIONAL: this will simplify the following steps, but it means explicitly trusting the Community Repository. Type the following two lines at the prompt within the terminal, pressing Enter after each:wget http://download.tuxfamily.org/eeepcrepos/key.asc sudo apt-key add key.asc * Staying within terminal, type sudo synaptic and press enter. This will open Synaptic in “Administrator” mode.* Within Synaptic, choose Settings…Repositories* Press New…* Enter the URIhttp://download.tuxfamily.org/eeepcrepos* Enter the distribution: p701* Enter the section: main (or main etch, if you want access to additional software)* Press OK* Press Reload* Scroll down to advanced-desktop-eeepc – if you don’t find it this way, search for it!* Mark for installation* If you didn’t complete the optional step above, you will see a warning that the public key is not available. This is normal and you can proceed.* Click Apply (if it’s off the bottom of the screen, press and hold ALT, left-click anywhere on the window and drag it up)* in case the installation through synaptic does not work for you, try this:$ sudo apt-get install advanced-desktop-eeepc* When you shut down, choose the Full Desktop option on the left of the shutdown dialogFull Desktop – from: http://www.downloadsquad.com/2007/11/06/eee-pc-tips-a-crash-course-in-linux/1. Open up a terminal buy pressing Ctrl+Alt+T2. Type “sudo bash” to gain root access (Be careful what you do with root access. The only reason we’re using it now is so that you don’t have to type sudo before each command. But you could easily mess up your machine if you perform every command as an administrator)3. Type “apt-get update” to make sure you have access to the most up to date packages4. Type “apt-get install kicker” and answer “y” when asked if you want to install5. Type “apt-get install ksmserver” and answer “y” when asked if you want to install6. Type exit to leave the root account7. Type exit to close your terminal windowKeyboard Layout——————–Easy Mode -> Settings | Personalisation Advanced Mode -> Launch | Control Center | Peripheral Devices | Keyboard Layout | United Kingdom | Add | Layout Variant: eeepc | Apply | Remove US | ApplyAdvanced Mode – Keyboard Shortcuts———————————————Control Center | General Settings | Key Assignment | Keyboard Shortcuts | Command Shortcuts | Applications | System | Console | Double Click | Ctrl-Alt-T | ApplyNetwork Adapter (for Slax / Slackware maybe also fedora) for eee pc———————————————————————– Download http://launchpadlibrarian.net/7382416/L2-linux-driver_new.rar- cd to src foldermake install (you’ll probably get errors)edit the at_main.c file and comment out all the bits inside functions at_restore_vlan() and at_vlan_rx_kill_vid (these are debug functions)make install insmod /lib/modules/<2.6.21.5>/kernel/drivers/net/atl2/atl2.koifconfig -a (the see the bit on changing network address elsewhere in this document)See also: http://ubuntuforums.org/showthread.php?s=65589fe8e969cd5aff547ec7046973d8&t=429845#post2781580See also: http://ihatecubicle.blogspot.com/2007/08/how-to-install-attansic-l2-network.html———————————————————————————————————————————————–ksensors———–yum install ksensorsvmware tips————–If you are running hamachi you may find your vmware virtual machines automatically bind to the 5.x.x.x subnet. To change this run the vmware virtual network editor – Host Virtual Network Mapping (tab) | VMnet0 – change this to the correct network adapter. There you go.lm_sensors————- A bit of a mission but here goes:sensors-detect (then hit enter a lot). You’ll want to save the output of this too.To set this up to run often follow the instructions, otherwise for a once off run just copy the commands into a terminal window.For example the output on my machine (beast) wants me to run:modprobe i2c-isa && modprobe w83627ehf && /usr/bin/sensors -ssensors(you will now also see that ksensors can display these probes)———————————————————————————————————————————————–Hibernate———–pm-hibernate———————————————————————————————————————————————–Sed—-Simple Search and Replacesed ‘s/IP/Cool/’ fileGrep Behavioursed -n ‘s/IP/&/p’ file2nd DNS Serversed -n ‘2 p’ /etc/resolv.conf | sed ‘ s/nameserver //;q’Clever Replace sed ‘s/^IP=/”[0-9,.]*/”/IP=/”192.168.2.80/”/’ fileSubstitute “foo” with “bar” ONLY for lines which contain “baz”sed ‘/baz/s/foo/bar/g’Substitute “foo” with “bar” EXCEPT for lines which contain “baz”sed ‘/baz/!s/foo/bar/g’More: sed /IP/d /etc/conf.d/net.eth0 | sed /NETMASK/d | sed /BROADCAST/d | sed /GATEWAY/d > /etc/conf.d/net.eth0.tmpsed -e /IP/d -e /NETMASK/d -e /BROADCAST/d -e /GATEWAY/d /etc/conf.d/net.eth0sed ‘/^IP=/”/!d s/^IP=/”//;q’ /etc/conf.d/net.eth0 | sed ‘//”$/!d s//”$//;q’ > filenameMore:sed -n ‘/RE/{p;q;}’ file # print only the first matchsed ‘0,/RE/{//d;}’ file # delete only the first matchsed ‘0,/RE/s//to_that/’ file # change only the first matchsed -i -e ‘/^;.*/d’ -e ‘/^$/d’ $(prefix)/etc/php.ini # remove comments and blank lines (use $$ for $ in a Makefile – if you need)———————————————————————————————————————————————–Awk—–ps | grep [b]lueshark | awk ‘{print $1}’ps | grep blueshark | grep -v grep | awk ‘{print $1}’———————————————————————————————————————————————–Qemu——-You want to download Qemu, the kqemu accelerator and the Qemu Manager.To start the accelerator install it and then type: net start kqemu———————————————————————————————————————————————–Qemu Manager——————- Can start the accelerator for you.- Create a new Virtual Disk- Then edit the properties of this Virtual Disk and choose Boot from CD-ROM and click on the Folder icon in the CD-ROM Section to specify the location of the ISO file.———————————————————————————————————————————————–DOS To Unix————–cat helloworld.sh | tr -d ‘/r’ > helloworld1.shcp helloworld1.sh helloworld.sh———————————————————————————————————————————————–Katapult———-Like QuickSilver (for Mac) or Launchy (for Windows)yum install katapult (from Extras)LaunchBox – is the Gnome equivalent.———————————————————————————————————————————————–KDE – AutoStart – like Start Group—————————————-/root/.kde/AutoStart———————————————————————————————————————————————–Smart——-smartctl -a /dev/hdd1smartctl -t short /dev/hdd1smartctl -t long /dev/hdd1———————————————————————————————————————————————–AddUser / UserAdd————————useradd -c “John Smith” -d /home/johnsmith johnpasswd john———————————————————————————————————————————————–DNS—-Set in the Network Configuration util it’s on it’s own Tab192.168.2.202196.43.1.13196.43.3.206196.25.1.9Stored in resolv.conf like:nameserver 192.168.2.202nameserver 196.43.1.13nameserver 196.25.1.9———————————————————————————————————————————————–Smoothwall—————Smoothwall DNS – /etc/resolv.dnsmasq (Removed on next boot)Smoothwall DNS Settings : /var/smoothwall/ethernet/settings (Used on next boot to create resolve.dnsmasq – I think)Smoothwall Squidsquid.conf – in /var/smoothwall/proxy/squid.conf (but don’t edit it – see description in this file where to put persistent changes)Cache in /var/spool/squid/cachee.g. du -sh /var/spool/squid/cache———————————————————————————————————————————————–Network IP Address————————system-config-networkor network-adminFedore – you can edit this file:/etc/sysconfig/network-scripts/ifcfg-eth0or you can call something like this:ifconfig eth0 192.168.2.90 netmask 255.255.255.0 broadcast 192.168.2.255 upifconfig eth0 192.168.2.90In fox-board: need to also edit /etc/conf.d/net.eth0 (on the fox board)or better – edit devboard-R2_01/packages/initscripts/net.eth0-static/conf – before making the fimage———————————————————————————————————————————————–Slax on a USB Key———————N.B. The Memory Stick must be formatted as FAT (or FAT16) not FAT32 !!This will get rid of the syslinux errorcould not find kernel image: linuxFAT – not FAT32See also:http://slax.hosting4p.com/forum/viewtopic.php?p=92334&sid=eb63d5d0121706ea072d5a08cacfa20dhttp://forum.nimblex.net/viewtopic.php?t=1667http://www.justlinux.com/forum/showthread.php?threadid=151156http://damnsmalllinux.org/cgi-bin/forums/ikonboard.cgi?act=Print;f=17;t=3932http://www.debuntu.org/how-to-install-ubuntu-linux-on-usb-bar-p2———————————————————————————————————————————————–Configuring IP in Slax——————-ifconfig eth0 down # to drop any existing settingsifconfig eth0 192.168.2.98 netmask 255.255.255.0route add default gateway 192.168.2.202echo “nameserver 192.168.2.202” >> /etc/resolv.conf———————————————————————————————————————————————–Intel PRO/Wireless 3945 WiFi Wireless Adapter in Slax——————————————————————I kept getting the following errors (run dmesg):iwl3945: Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux, 1.1.17ksiwl3945: Copyright(c) 2003-2007 Intel Corporationiwl3945: Detected Intel PRO/Wireless 3945ABG Network Connectioniwl3945: iwlwifi-3945-1.ucode firmware file req failed: Reason -2iwl3945: Could not read microcode: -2iwl3945: probe of 0000:02:00.0 failed with error -2 The problem is a missing iwlwifi-3945.ucode firmware file (but in this case even the default filename needs changing too)!! – [Fixed in Slax 6.0.3]Download the following into, for example /mnt/sda1/temp/3945wget http://intellinuxwireless.org/iwlwifi/downloads/iwlwifi-3945-ucode-2.14.4.tgztar xvf iwlwifi-3945-ucode-2.14.4.tgz cp /mnt/sda1/temp/3945/iwlwifi-3945-ucode-2.14.4/iwlwifi-3945.ucode /lib/firmware/iwlwifi-3945-1.ucodemodprobe -r iwl3945modprobe iwl3945With help from: http://intellinuxwireless.org/?p=iwlwifi&n=HOWTO-iwlwifi———————————————————————————————————————————————–WiFi in Slax————-ifconfig wlan0 upiwlist wlan0 scaniwconfig wlan0 channel 6iwconfig wlan0 essid NAME_OF_SSID iwconfig wlan0 key [1] HEX_KEY_HEREiwconfig wlan0 ap anyiwconfig dhcpcd -d -t 15 wlan0Some more info:——————How to connect to WIFI network with WEPIf there is a native kernel driver for your WIFI card in Slax, these three simple commands should connect you to your access-point:ifconfig eth0 upiwconfig eth0 essid NAMEOFAP mode managed key WEPKEYINHEXdhcpcdIf your card requires a different driver, you may use the driver for Windows, see below.How to load Windows driver in SLAX for wifi cardIn general, you need to load the windows driver by using ndiswrapper command. Then modprobe the ndiswrapper.ko kernel module and configure the card, like in the following example:ndiswrapper -i rt2500.infmodprobe ndiswrapperiwconfig wlan0 ap 00:00:00:00:00:00iwconfig wlan0 essid SomeESSIDiwconfig wlan0 key open 111x111x11iwconfig wlan0 channel xifconfig wlan0 upFinally setup the wlan0 interface the same like in the previous howto, either by starting dhcp or by ifconfig+route.———————————————————————————————————————————————–rdesktop (works in Slax)—————————–Grab the rdesktop modulerdesktop SERVER -f(Then use Ctl-Alt-Enter to switch between full screen and not)———————————————————————————————————————————————–Slax Save & Restore in Slax 5 (Slax 6 stores changes into slaxsave.dat (by default) you can unzip this from slaxsave.zip)————————To save your settings, run “configsave” command with one argument – the storage location. So type for example configsave /mnt/sda1/slaxconf.mo to save your configs in USB flash drive into slaxconf.mo file. It will save all changed files from /root, /etc, /home and /var directories. Note that that network settings (assigned IP address, etc) won’t be saved because they are not kept in any file. If you wish to save network settings then add apropriate commands to /etc/rc.d/rc.local.This file will be saved/restored, and it’s executed automatically (so your network settings will be set up).To restore your previously saved backup, use “configrestore” command. You can also save settings to the root directory of your existing disk partition (for example to /mnt/hda1/slaxconf.mo). All settings found in the root folder of any of your disk partitions ( under the name slaxconf.mo) will be restored automatically when SLAX boots.———————————————————————————————————————————————–Network Adapters in Slax —————————–ifconfig -a(on the laptop TRL 8139 – the network adapter is eth1)———————————————————————————————————————————————–SSHD on Slax—————-1) If you get sshd re-exec requires execution with a absolute path – this means you need to start sshd with the full path. e.g. /usr/sbin/sshd2) If you get Could not load host key – then you’ll need to ssh-keygen -b 1024 -t rsa -f /etc/ssh/ssh_host_keyssh-keygen -b 1024 -t rsa -f /etc/ssh/ssh_host_rsa_keyssh-keygen -b 1024 -t rsa -f /etc/ssh/ssh_host_dsa_key3) /usr/sbin/sshd———————————————————————————————————————————————–vncserver and vncviewer in Slax 6.0——————————————-I got error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared objectso I did the following:cd /usr/libln -sf /usr/i486-slackware-linux/lib/libstdc++-libc6.1-2.so.3 libstdc++-libc6.1-1.so.2or ln -sf /usr/i486-slackware-linux/lib/libstdc++-libc6.1-2.so.3 /usr/lib/libstdc++-libc6.1-1.so.2Then I got could not open default font ‘fixed’In a KDE shell type xset qcopy the fonts path (all of them) and then edit /usr/bin/vncserver and use these in the # $cmd .= ” -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/”;as follows:# $cmd .= ” -fp /usr/lib/X11/fonts/misc/,/usr/lib/X11/fonts/75dpi/”;$cmd .= ” -fp /usr/share/fonts/override,/usr/share/fonts/TTF,/usr/share/fonts/misc,/usr/share/fonts/75dpi/”;vncserver<first time>vncserver -kill :1edit ~/.vnc/xstartup and add the following on line 2:unset SESSION_MANAGERexec /etc/X11/xinit/xinitrcThen try: vncserver :0</first time>———————————————————————————————————————————————–Slax Default Password—————–root/toor———————————————————————————————————————————————–IPv4 Classes—————Class A – Range:1-126 Private:10.x.x.x (CIDR /8)Class B – Range:128-191 Private: 172.16.x.x – 172.31.x.x (CIDR /16)Class C – Range:192-223 Private: 192.168.x.x (CIDR /24)Subnet masks and Classless INter-Domain Routing notation (CIDR)CIDR /24 = subnet mask of 255.0.0.0CIDR /16 = subnet mask of 255.255.0.0CIDR /24 = subnet mask of 255.255.255.0———————————————————————————————————————————————–Gateway———-To see the gateway(s) typenetstat -rnor routeto change the gateway type:route add default gw 192.168.2.202———————————————————————————————————————————————–netstat——–netstat -anetstat -b 5 > connections.txt———————————————————————————————————————————————–Defrag——–Check files for Fragmentationfilefrag *Info: ext2 and ext3 – should keep themselves fairly defragged if there is 20% empty spacedf -h (or df -hlx cifs)Windows Defrag——————–JKDefrag is prett cool.Just remember to turn off the Windows Auto Defrag:Windows 2000 & 2003:The built-in defragger is not started automatically. Windows XP:1. Download the free * Tweak UI utility from Micorosft.2. Click on ‘General’ and untick the ‘Optimise hard disk when idle’ box. Windows Vista:1. Start -> All Programs -> Accessories -> System Tools -> Disk Defragmenter2. Untick the “Run on a schedule (recommended)” box. (Although I also went into the scheduler and turned it off there too)———————————————————————————————————————————————–Desktop Color (Colour)—————————XP Color LCDR0G78B152XP – Nice one CRTR58G110B165Another Cool BlueR35R100R200———————————————————————————————————————————————–fstab——Note: I’ve had better results with changing cifs to smbfs – as the cifs cache seems to be too strong, so that changes to the files are cached in the linux system.Bahamas /etc/fstab# This file is edited by fstab-sync – see ‘man fstab-sync’ for details/dev/VolGroup00/LogVol00 / ext3 defaults 1 1LABEL=/boot /boot ext3 defaults 1 2none /dev/pts devpts gid=5,mode=620 0 0none /dev/shm tmpfs defaults 0 0none /proc proc defaults 0 0none /sys sysfs defaults 0 0/dev/VolGroup00/LogVol01 swap swap defaults 0 0//192.168.2.208/c /mnt/beach/c cifs defaults,user=UserName,password=Password 0 0//192.168.2.199/q-drive /mnt/beast/q-drive cifs defaults,user=UserName,password=Password 0 0/dev/hdc /media/cdrom auto pamconsole,ro,exec,noauto,managed 0 0———————————————————————————————————————————————–SSH Keys – To setup a machine to allow logins via SSH Keys – when you have a SSH Key———— You’ll need to enter your SSH Key (which starts with something like ssh-rsa xxxx) in ~/.ssh/authorized_keys or ~/.ssh/authorized_keys2- If you had to create the file, then apply the following – otherwise you may find ssh doesn’t allow you to automatically log in.chmod 644 authorized_keys2———————————————————————————————————————————————–SSH Keys – How to make a SSH Key and how to copy it to the desired host———–ssh-keygen -t rsa(Don’t use a PassPhrase)cat ~/.ssh/id_rsa.pub | ssh -l root localhost “cat – >>.ssh/authorized_keys2” (you’ll want to replace localhost with the hostname)(for fedora)(you may need to chmod 644 ~/.ssh/authorized_keys2)cat ~/.ssh/id_rsa.pub | ssh -l root 192.168.2.90 “cat – >>.ssh/authorized_keys”(for fox)———————————————————————————————————————————————–SSH Tunneling—————–From: http://www.rzg.mpg.de/networking/tunnelling.htmlssh -l myuserid -L 7777:work:22 gate cat -ssh -p 7777 localhost uname -aslogin -p 7777 localhostscp -p -P 7777 localhost:data/file1.txt .sftp -oPort=7777 localhostssh -l myuserid -L 7777:work1:22 -L 7778:work2:22 -L 7779:work3:22 gate cat – (muliple tunnels)———————————————————————————————————————————————–SSH—-ssh root@192.168.2.90 /mnt/flash/file1 (executes this file on the remote machine)———————————————————————————————————————————————–SSHD on Windows———————There may be some more info in this document, otherwise have a look at:http://pigtail.net/LRP/printsrv/cygwin-sshd.html———————————————————————————————————————————————–SCP—-scp file1 root@192.168.2.90:/mnt/flash (copies file1 to remote machine)———————————————————————————————————————————————–rsync——rsync -av –delete-after -e ssh dir1 root@machinename:/workdrive/tmp/dir2-av –stats –progress –delete-after–delete-beforersync -av –stats –progress –modify-window=1 root@192.168.1.1:/workdrive/q-drive/ /workdrive/q-drive/”C:/Program Files/cwRsync/bin/rsync” -av –stats –progress –modify-window=1 –delete-during ‘/cygdrive/q/’ ‘/cygdrive/j/Sync/Q-Drive/’———————————————————————————————————————————————–xcopy (doesn’t delete)——-xcopy q:/*.* j:/Sync/Q-Drive /D /E /H /R /G /I /K /Y /C———————————————————————————————————————————————–LD–LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH my_prog (runs my_prog with . as included in the Library Path)export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/libexport LD_LIBRARY_PATH=/mnt/flash/lib:/libexport LD_DEBUG=filesexport LD_DEBUG=helpThe correct thing is to have /etc/ld.so.conf setup correctlyThe 2 alternates are LD_LIBRARY_PATH and linking with the -rpath option. Both of these have some severe disadvantages. Rather set up /etc/ld.so.confIn emergencies you can specify specific libraries that must be loaded in /etc/ld.so.preloadSee also: /etc/ld.so.cacheSee also ldconfig which may be used to “install” new librariesSee also /lib/ld.so.1 which can be run wit /lib/ld.so.1 /lib/ld.so.1 –list clockos/lib/ld.so.1 –library-path /usr/local/lib /usr/local/bin/sqlite3shellTo see which librares a program requires you can use either:ldd filenameobjdump -x filenamereadelf -a filename———————————————————————————————————————————————–Lowercase FileNames————————-for f in *; do mv “$f” “`echo $f | tr ‘[:upper:]’ ‘[:lower:]’`”; done (Handles files with spaces)for f in *; do mv $f `echo $f | tr ‘[:upper:]’ ‘[:lower:]’`; done———————————————————————————————————————————————–Bash Script————-#!/bin/bashxxxxchmod u+x./scriptg# if a file existsif [ -f “$file” ] ; thenelsefiBash If——–From: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html[ -a FILE ] True if FILE exists.[ -b FILE ] True if FILE exists and is a block-special file.[ -c FILE ] True if FILE exists and is a character-special file.[ -d FILE ] True if FILE exists and is a directory.[ -e FILE ] True if FILE exists.[ -f FILE ] True if FILE exists and is a regular file.[ -g FILE ] True if FILE exists and its SGID bit is set.[ -h FILE ] True if FILE exists and is a symbolic link.[ -k FILE ] True if FILE exists and its sticky bit is set.[ -p FILE ] True if FILE exists and is a named pipe (FIFO).[ -r FILE ] True if FILE exists and is readable.[ -s FILE ] True if FILE exists and has a size greater than zero.[ -t FD ] True if file descriptor FD is open and refers to a terminal.[ -u FILE ] True if FILE exists and its SUID (set user ID) bit is set.[ -w FILE ] True if FILE True if FILE exists and is writable.[ -x FILE ] True if FILE exists and is executable.[ -O FILE ] True if FILE exists and is owned by the effective user ID.[ -G FILE ] True if FILE exists and is owned by the effective group ID.[ -L FILE ] True if FILE exists and is a symbolic link.[ -N FILE ] True if FILE exists and has been modified since it was last read.[ -S FILE ] True if FILE exists and is a socket.[ FILE1 -nt FILE2 ] True if FILE1 has been changed more recently than FILE2, or if FILE1 exists and FILE2 does not.[ FILE1 -ot FILE2 ] True if FILE1 is older than FILE2, or is FILE2 exists and FILE1 does not.[ FILE1 -ef FILE2 ] True if FILE1 and FILE2 refer to the same device and inode numbers.[ -o OPTIONNAME ] True if shell option “OPTIONNAME” is enabled.[ -z STRING ] True of the length of “STRING” is zero.[ -n STRING ] or [ STRING ] True of the length of “STRING” is non-zero.[ STRING1 == STRING2 ] True if the strings are equal. “=” may be used instead of “==” for strict POSIX compliance.[ STRING1 != STRING2 ] True if the strings are not equal.[ STRING1 < STRING2 ] True if “STRING1” sorts before “STRING2” lexicographically in the current locale.[ STRING1 > STRING2 ] True if “STRING1” sorts after “STRING2” lexicographically in the current locale.[ ARG1 OP ARG2 ] “OP” is one of -eq, -ne, -lt, -le, -gt or -ge. These arithmetic binary operators return true if “ARG1” is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to “ARG2”, respectively. “ARG1” and “ARG2” are integers.———————————————————————————————————————————————–Date & Time————–datedate -R date -s “18:00:00” (Works on Fedora)date -s “Dec 31” (Works on Fedora)date -s “Dec 31 2006” (Works on Fedora)date -s “Dec 31 18:00” (Works on Fedora)date -s “Dec 31 2006 18:00:00″ (Works on Fedora)———————————————————————————————————————————————–Date & Time Setting (on Fedora)————————————–rdate -s 129.6.15.29 date; hwclock; hwclock -w; hwclockDate & Time Setting (on Foxboard)————————————–rdate -s 129.6.15.29 date; hwclock; hwclock -w -u; hwclock———————————————————————————————————————————————–Date & Time on FoxBoard——————————date 123118002007.30 (31 Dec 2007 18:00.30) – only works on Foxdate -u 011903132038.45 (Linux Y2K GMT 19 Jan 2038 03:14:07) – only works on Foxdate 123118002006.30date 010118002007.30(date MMDDhhmmYYYY.ss)hwclock -w (write date to rtc chip – if you have one)On another linux machine…scp /usr/share/zoneinfo/Africa/Johannesburg root@192.168.2.90:/etc/localtimeBack on the Fox (you can also use time.nist.gov)rdate -s 129.6.15.29 -t 3rdate -s time-b.nist.govrdate -s time-c.timefreq.bldrdoc.govrdate -s nist1.symmetricom.comrdate -s 129.6.15.29date/sbin/hwclock -w -u———————————————————————————————————————————————–Time and TimeZones————————1) cat /etc/sysconfig/clockZONE=”Africa/Johannesburg”UTC=falseARC=false2) ln -sf /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime3) date or date MMDDhhmm4) /sbin/hwclock or /sbin/hwclock –systohcYou can check your timezone info with:zdump -v /etc/localtimezic – can be used to compile timezones———————————————————————————————————————————————–KDevelop (kdevelop)———–./configure –with-qt-dir=/usr/lib/qt-3.3 (check where yours is though)———————————————————————————————————————————————–Find & Locate—————-FC5+locate file-to-locateupdatedb file-to-locateFC4-slocateslocate -u (rebuild locate database)find . -name xxx -printfind / -name xxx -print———————————————————————————————————————————————–Man Pages————-In Konqueror use man:man———————————————————————————————————————————————–Konqueror————man:mansmb://spiffmedia://———————————————————————————————————————————————–System Monitors——————-ksysguardkinfocentergnome-system-monitortopfree -m (or free -mt)cat /proc/meminfodf -h (or df -hlx cifs)df | grep /mnt/flash | cut -c41-50vmstat (-a)ps aux –sort -pmem | lessslabtopyum install systemtap (FC4+) [Developer library I think]———————————————————————————————————————————————–Hard Drive Disk Temp————————-yum install hddtemp.i386(ubuntu: sudo apt-get install hddtemp)hddtemp /dev/hdahddtemp /dev/hdbhddtemp /dev/hd?hddtemp -q /dev/sd? ———————————————————————————————————————————————–Hard Drives————-/dev/hda master device on primary IDE channel/dev/hdb slave device on primary IDE channel/dev/hdc master device on secondary IDE channel/dev/hdd slave device on secondary IDE channel/dev/sda first SCSI hard drive/dev/sdb second SCSI hard drive———————————————————————————————————————————————–Keyboard Shortcuts————————Ctrl-Escape – Process ManagerCtrl-Alt-Backspace – kills xdm———————————————————————————————————————————————–VNC Once-off Config————————-vncserver (starts it all and generates /root/.vnc/xstartup if needed)vncserver -kill :1vi ~/.vnc/xstartup (you need to uncomment the first two real lines)vi /etc/kde/kdm/kdmrc (see below)vi /etc/sysconfig/desktop (see below)I’ve also had to tweak the following:vi ~/.xinitrcexec startkderebootvncserver ———————————————————————————————————————————————–Using VNC————vncserver (starts server – connect to a linux machine like this machinename:1)vncviewer———————————————————————————————————————————————–Other VNC options (which I don’t use)———————————————vncpasswd (sets password)vncconfigXvnc – should only be run from vncserver/etc/sysconfig/vncservers – uncomment VNCSERVER=”1:root”———————————————————————————————————————————————–Switching Desktops———————–See also KUbuntuswitchdeskswitchdesk kdesee also:/etc/kde/kdm/kdmrc and change the line AllowRootLogin=true (you may need to set this in both places)/etc/sysconfig/desktop:(you may need to add the following / or change it) (the settings in this file are used from either: /etc/X11/prefdm or /etc/X11/xinit/Xclients or ~/.Xclients) :(remove the tabs!! – and only use the options you want from this list)DESKTOP=GNOMEDESKTOP=KDEDISPLAY=GNOMEDISPLAY=KDEDISPLAYMANAGER=GNOMEDISPLAYMANAGER=XDMDISPLAYMANAGER=KDEkdmgdmstartxfce4———————————————————————————————————————————————–Init—-Default Init mode in /etc/inittab (id:5:initdefault:)init 0 = haltinit 1 = single userinit 2 = multiuser no NFSinit 3 = multiuserinit 4 = unusedinit 5 = X11init 6 = rebootSee also /etc/init.d and /etc/rc.dchkconfig –list (will list which init modes a service is started in)chkconfig –level 5 vncserver on (must be root – although I never seem to be able to get VNC to work as a service)———————————————————————————————————————————————–Mail Aliases————-Edit /etc/mail/aliasesroot:someone@example.comrun newaliasesmail -s Test rootxxxx^D———————————————————————————————————————————————–Tar—-tar zxvf xxx.tar.gztar jxvf xxx.targ.bz2Create tar file…tar cvf newfile.tar directoryname/ ———————————————————————————————————————————————–PGP / GPG————% pgpk -a KEYS% pgpv james-version.tar.gz.ascor% pgp -ka KEYS% pgp james-version.tar.gz.ascor% gpg –import KEYS% gpg –verify james-version.tar.gz.asc———————————————————————————————————————————————–TrueCrypt————yum install truecryptrpm -i truecryptxx.rpm [install]rpm -e truecryptxx.rpm [uninstall]man truecrypttruecrypt –helptruecrypt /root/volume.tc /mnt/tctruecrypt -r /root/volume.tc /mnt/tc [read-only]truecrypt -i [interactive mode]truecrypt -d /mnt/tc [dismount]truecrypt -vl [list mapped volumes]———————————————————————————————————————————————–TrueCrypt 5.1a Source Compile (for Slax 6)————————————————-See Also: http://meandubuntu.wordpress.com/2008/02/07/my-first-compile-truecrypt-50/Download:TrueCrypt 5.1a Source.tar.gzwxWidgets-2.8.7.tar.gzfuse-2.7.3.tar.gz (I didn’t end up using this – as it’s already in Slax)tar zxvf wxWidgets-2.8.7.tar.gzcopy this wxWidgets-2.8.7 folder to /usr/src/wxWidgets-2.8.7tar zxvf TrueCrypt 5.1a Source.tar.gzcd truecrypt-5.1a-sourcemake WX_ROOT=/usr/src/wxWidgets-2.8.7 wxbuildmake———————————————————————————————————————————————–Ethernet Speeds——————-ethtool eth0 (shows current settings)ethtool -s eth0 speed 100 duplex full autoneg offormii-tool eth0 (or mii-tool -v eth0)mii-tool -F 100baseTx-FD eth0lspcimore /proc/net/dev (network stats)———————————————————————————————————————————————–LogWatch————Run from Cron (/etc/cron.daily folder)Setup in /etc/log.d/logwatch.conf———————————————————————————————————————————————–USB Drives & Mount———————–mkdir -p /mnt/usbkeymount -tvfat -oumask=0000 /dev/sda1 /mnt/usbkeyOn Fox:mount -t vfat -o umask=0000 /dev/sda1 /mnt/1 mount -t cifs //192.168.2.208/c /mnt/beach/c -o user=jono =o pass=Jono//192.168.2.208/c /mnt/beach/c cifs defaults,user=Jono,password=Jono 0 0On Fox:mount -t jffs2 /dev/flash2 /mnt/2On Fedora:mount -t cramfs -o loop rootfs.img /mnt/junk———————————————————————————————————————————————–NTFS Mount on Linux————————-1) Check you have the ntfs driver:dmesg | grep -i ntfsorgrep -i ntfs /var/log/messagesand/orcat /proc/filesystems | more2) You may need to install the ntfs driveryum install ntfs-3g (for read-write)oryum install kernel-module-ntfs (for read-only) (older fedoras)yum install kmod-ntfs (for fc5 fc6 – will need Livna Repo) 3) mkdir /mnt/j-drivemount -t ntfs-4g /dev/sdb1 /mnt/j-drive -o force (note this uses the force mode)mount /dev/sda1 /mnt/j-drive -t ntfs-3g -r (for read-only)mount /dev/sda1 /mnt/j-drive -t ntfs-3g -r (for read-only)ormount /dev/sda1 /mnt/j-drive -t ntfs -r (for read-only) [note: this didn’t work for me in fc5]4) (Optional0 /etc/fstab/dev/sdb1 /mnt/j-drive ntfs-3g defaults,force 0 0 (note this uses the force mode)or/dev/sda1 /mnt/j-drive ntfs-3g defaults 0 0or/dev/sda1 /mnt/j-drive ntfs nodev,noexec,nosuid,ro,umask=222 0 0———————————————————————————————————————————————–Read-Only File System – how to change this to Read-Write———————————————————————-mount -o remount,rw / (or whatever other devices need remounting e.g. /dev/hdd1)———————————————————————————————————————————————–HardDisk Parameters————————-hdparm -v /dev/hdashould give something like:/dev/hdd:multcount = 16 (on)IO_support = 1 (32-bit)unmaskirq = 1 (on)using_dma = 1 (on)keepsettings = 0 (off)readonly = 0 (off)readahead = 256 (on)———————————————————————————————————————————————–HardDisks – checking & info————————————e2fsck /dev/hdb1 (Checks the harddrive)dumpe2fs -h /dev/hdb1 (shows info) or dumpe2fs -h /dev/mapper/VolGroup00-LogVol00dumpe2fs -b /dev/hdb1 (shows bad block info)tune2fs /dev/hdb1 (has more options to change the auto intervals for calling e2fsck – e.g. -i 3m or -c 10)———————————————————————————————————————————————–HardDisks – checking for Bad Sectors————————————badblocks (but rather use e2fsck -c) (See man badblocks for why)e2fsck -c -k -n /dev/hdb1 (won’t change filesystem – but does read-only bad disk check – will preserve last list and will add to list) or e2fsck -c -k -n /dev/mapper/VolGroup00-LogVol00e2fsck -c -k /dev/hdb1 (read-only bad disk check – will preserve last list and will add to list) or e2fsck -c -k /dev/mapper/VolGroup00-LogVol00e2fsck -c -c -k /dev/hdb1 (read/write check – non destructive)———————————————————————————————————————————————–HardDisks ext3 Formatting————————-1) Partition the disksinit 1 (optional)fdisk -l (to see what’s detected) (or you can run blkid)fdisk /dev/hdb(m = help, t, 1, L, fd, p, w) – by default it sets the partition type to 83 (Linux) – correct(I created a primary partition – full size)2) Format the ext3 diskmke2fs -j -b 4096 /dev/hdb13) To check the formating before mounting–e2fsck /dev/hdb14) Mount it:mkdir /workdrive edit etc/fstab:/dev/hdb1 /workdrive ext3 defaults 1 2 mount /dev/hdb1 /workdrive(or mount -a)———————————————————————————————————————————————–RAID 5——–To create the raid set:1) Get the disks readyinit 1fdisk -lfdisk /dev/hdb(m = help, [new or delete first] then t, 1, L, fd, p, w) – set the partition type to fd (Linux raid autodetect)NB: Physically label your disks in your machine as /dev/hda1 etc. (I know from experience this is a good thing to do, when a disk fails!!!)2) Create the Raid arraymdadm –create /dev/md0 –chunk 64 –level 5 –raid-devices 3 /dev/hdb1 /dev/hdc1 /dev/hdd13) Show statuscat /proc/mdstatmdadm –examine /dev/hdb1mdadm –detail /dev/md04) Format the Raid5 Arraymkswapmke2fs -j -b 4096 -R stride=16 /dev/md0(The -R is the same as -E – but is for older systems – which means an extended command in this case the stride=16 command – which is a RAID configuration)(Note: stride = [mdadm — create chunk size] / ([mke2fs -b size] / 1024)5) To check the formating before mounting–e2fsck /dev/md06) Mount it:mkdir /mnt/raid (I changed /mnt/raid to /workdrive)edit etc/fstab:/dev/md0 /mnt/raid ext3 defaults 1 2 (I changed /mnt/raid to /workdrive)mount /dev/md0 /mnt/raid (or mount -a)7) Recovery (It’s best to fail a device before removing it).To remove a device:mdadm /dev/md0 –fail /dev/hdd1mdadm /dev/md0 –remove /dev/hdd1To add a new device:fdisk -lYou may need to partition a new drive to Linux Raid Auto Detectfdisk /dev/hdd(m = help, t, 1, L, fd, p, w) – set the partition type to fd (Linux raid autodetect)mdadm /dev/md0 –add /dev/hdd1Now if you mdadm –detail /dev/md0 you should see this drive as spare drive and further up in the output your should see the rebuild percentage.Or you can cat /proc/mdstat and it also shows the percentage.If you reinstalled the OS – you would probably use “assemble” to setup a raid array of existing disksmdadm –assemble –scanmdadm –assemble /dev/md0 /dev/hdb1 /dev/hdc1 /dev/hdd1 (-f does a force if some blocks are out of sync)(-R attempt to run the array even if less devices are present)8) Getting it to load on boot: (Done automatically in Fedora Core 3 – possible by a service)mdadm –assemble –scanmd9) Raid MonitoringEdit the /etc/mdadm.conf file and add:MAILADDR someone@example.comor for once off (won’t remember after boot)mdadm –monitor –mail=root@localhost –delay=1800 /dev/md0mdadm –monitor –mail=root@localhost –delay=1800 –daemonise /dev/md0Also see the Pam configuration———————————————————————————————————————————————–RAID 1——–Pretty similar to RAID 5 (as above)1) Adding a new drive to a RAID 1 setup.For example you have 2 drives configured as RAID 1, now you want to add a third drivefdisk the new drive (as above)mdadm –grow /dev/md0 -n3 (n3 = number of devices – set this to one more than you currently have)mdadm /dev/md0 –add /dev/hdc1 (of whatever the new drive is called)———————————————————————————————————————————————–WUS – Windows Update Services—————————————-Sorry – this isn’t Unix I know – just didn’t have any other place to put this. hehefrom: http://www.wsus.info/forums/lofiversion/index.php?t8353.htmlMake sure BITS Service is runningStop automatic updates service then delete the c:/windows/softwaredistribution folder, then delete c:/windows/WindowsUpdate.logthen delete c:/windows/Windows Update.log (if it exists)then start the service back up. Run wuauclt.exe /detectnowto tell it to check in right now. That should fix it.Try reinstalling the automatic updates service first, go to a command promt and run regsvr32 /u wuaueng.dll, you will get a pompt to that the dll was unregistered. Now that you have removed automatic updates reinstall by typing in regsvr32 wuaueng.dll. Once this is done start the automatic updates service and run wuauclt.exe /detectnow and see if the error persists.If that doesnt help try to repair bits by following the instructions at the following website http://blogs.msdn.com/astebner/archive/200…/06/489726.aspxThird make sure the Cryptographic Services is runningMake sure your Content folder allows downloading on .exe extensions !!0x8024400Aregsvr32 MSXML.DLLregsvr32 MSXML2.DLLregsvr32 MSXML3.DLL———————————————————————————————————————————————–How to start a low priority task in Windows—————————————————cmd.exe /c start “JkDefrag” /BelowNormal “jkdefragCmd.exe”———————————————————————————————————————————————–PAM—-Config in /etc/logwatch/conf/logwatch.conf (or /etc/log.d/logwatch.conf (old FCs))MailTo = jono@example.com———————————————————————————————————————————————–KUbuntu———-sudo apt-get install kubuntu-desktop (or xcfe)sudo dpkg-reconfigure kdm (or gdm)———————————————————————————————————————————————–dd—From: http://www.pendrivelinux.com/2007/11/22/permanently-remove-information-from-your-usb-drive/deleted information non-recoverable:1. Create a dummy file named junk.bin on the USB flash drive2. Open a terminal and type sudo su3. Type fdisk -l and locate the partition you would like to zero out4. Type mkdir /tmp/ddusb5. Type mount -o loop /dev/sdxx /tmp/ddsdb (replacing sdxxx with your partition)6. Type dd if=/dev/zero of=/tmp/ddusb/junk.bin7. Type rm /tmp/ddusb/junk.binThats all. Now any empty space on this partition has been filled with zeros and the deleted information that was once on your USB flash drive has been overwritten.———————————————————————————————————————————————–Grub.conf———–default=0timeout=5splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitle Fedora Core (2.6.9-1.667)root (hd0,0)kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 rhgb quietinitrd /initrd-2.6.9-1.667.imgtitle Fedora Core (2.6.9-1.667) Single User Moderoot (hd0,0)kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 rhgb quiet singleinitrd /initrd-2.6.9-1.667.imgtitle Otherrootnoverify (hd1,0)chainloader +1(Note you can add the “single” on the fly – in Grub loader – use e to edit and add single to the kernel line – these changes aren’t permanent). ———————————————————————————————————————————————–StressLinux————–(Press Space when choosing Keyboard to select the US one)burnMMX – Intel MMX – Brings CPU usage to 100% – if your system is still running after 10 minutes – life is good.burnBX – another Intel burn teststress – same sort of idea:stress -c 8-i 4 -m 2 –vm-bytes 128M –timeout 60sstress -c 1Ksmartctrl -a /dev/hdasmartctrl -t short /dev/hdasmartctrl -t long /dev/hdasmartctrl -a /dev/hdalshw – shows a bunch of infox86info – shows CPU infohddtemp /dev/hdanbench – Bench mark application (should take 10 mins or less to run)———————————————————————————————————————————————–Some more piping things—————————–rdate -s 129.6.15.29 -t 3 > /dev/null 2>&1# Send errors from commands to the console.exec 2> /dev/console========================================================================================================================================================================================================================================================================================================================================================================================================Fedora Core 7 (FC7) Installation Notes:———————————————–If you are looking for in-depth notes have a look at this great resource: http://www.mjmwired.net/resources/mjm-fedora-f7.html And: http://www.mjmwired.net/resources/mjm-services-f7.html1) My install starts off with the the usual kind of stuff – I like Logical Volumes & Grub.2) I chose Office and Productivity, Software Development, and Web Server3) Choose the Customize Now option – It seems to me that once installed any further updates use your Internet connection, not your installation CD.4) Then I added the following:Desktop Environments – KDE (ie Both Gnome and KDE)Applications – Sound and Video – mikmod, [NB Remove totem-mozplugin (causes problems later)]Development – You may optionally want Java, KDE Development & RubyServers – Server Configuration ToolsServers – Windows File ServerBase System – (Turn off) Dial-Up SupportBase System – System Tools (for samba client & BackupPC & ntfs-3g) & turn on fuseBase System – NB Leave Virtualization Off (I installed Xen on FC6 and it croaked on first boot – just kept rebooting my system) – If you need Xen install it later.5) For what I am doing (Linux on LAN), I am comfortable with turning off the firewall and Disabling SELinux 6) System User – it’s worth adding 1 user in here. (be careful the username is case sensitive!)7) add ssh keys (see below) 8) Configure sudosu(optional – you may or may not need this) chmod u+w /etc/sudoersecho ‘jono ALL=(ALL) NOPASSWD:ALL’ >> /etc/sudoers(optional – you may or may not need this) chmod u-w /etc/sudoersexit9) yum install yum hddtemp katapult yumex kyum switchdesk10) [switchdesk kde – or do this from the login menu – options]then I move the taskbar to the left around – and make it wider (Size Large)move the launch pager down and set the number of colums to 2 (I also only use 2 virtual windows)change the clock’s to type plain and add a date (any condensed font size size 6 works well if you are using 1024×768)add an “external taskbar” to the top. (You may need to configure this from Control Center | Dekstop | Panels) – 90% Top Centered, Tiny (You may need to go to Control Center – Desktop – Panels)add the following menus to the KMenu – Network Folders, Quick Launcher, Recent Documents, Settings, ShowDesktop, System Menu & Terminal SessionsControl Center | Regional & Accessibility | Country/Region & Language – tweak date and time formats etc.13) vncserver stuff…/switchdesk kdevncserver (starts it all and generates /root/.vnc/xstartup if needed)vncserver -kill :1vi ~/.vnc/xstartup (you need to uncomment the first two real lines)vncserver (you can now connect to this machine via vnc to machine:1)*14) yum – add any extra repositories (see below)*15) edit fstab and configure mounts16) edit /etc/profile and add any aliases likealias lt=’ls -lrthFh’17) Configure warning email addresses. For example:If you are using RAID – then edit /etc/mdadm.conf (see below)pam – email – edit /etc/logwatch/conf/logwatch.conf (see below)MailTo = jono@example.comOptional extras:19) Sambayum update samba samba-client samba-commonsamba – call kcmsambaconf (see below for more details)then add it as a service using either the graphical service manager or chkconfig –level 35 smb onif you are running the firewall – you’ll need to add samba to the firewall…20) install hamachi – if you use hamachi (see further down for details)21) if gcc 3 is needed:sudo yum install compat-gcc-34 compat-gcc-34-c++22) install backuppc – if you use it23) Read-write NTFS mounting is supported if you:yum install fuse fuse-libs ntfs-3g ntfsprogs ntfsprogs-gnomevfs24) Add this machine to the backup program. 25) Install Graphics Driver….nvidia graphics driver————————-Best to look here: http://www.mjmwired.net/resources/mjm-fedora-fc7.htmlYumThe following is just a quick summary:Use Livna Reporpm -ivh http://rpm.livna.org/livna-release-7.rpmrpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-livnayum install kmod-nvidiaIf you are unfortunate enough to have an old nvidia card (like my old nvidia Vanta TNT2) (see: http://www.nvidia.com/object/IO_32667.html or http://www.nvidia.com/object/unix.html (look in the legacy section))- if you installed the stuff above then: yum remove xorg-x11-drv-nvidiayum install kmod-nvidia-legacyI also had to tweak my /etc/X11/xorg.conf (and just when you thought setting up linux was going to be easy!! haha)# Xorg configuration created by livna-config-displaySection “ServerLayout”Identifier “Default Layout”Screen 0 “Screen0” 0 0InputDevice “Keyboard0” “CoreKeyboard”EndSectionSection “Files”ModulePath “/usr/lib/xorg/modules/extensions/nvidia”ModulePath “/usr/lib/xorg/modules”EndSectionSection “ServerFlags”Option “AIGLX” “on”EndSectionSection “InputDevice”Identifier “Keyboard0″Driver “kbd”Option “XkbModel” “pc105″Option “XkbLayout” “us”EndSectionSection “Monitor”Identifier “Jono Default Monitor”HorizSync 30.0 – 70.0VertRefresh 50.0 – 85.0Option “DPMS”EndSectionSection “Device”Identifier “Videocard0″Driver “nvidia”Option “AddARGBGLXVisuals” “True”Option “DisableGLXRootClipping” “True”EndSectionSection “Screen”Identifier “Screen0″Device “Videocard0″Monitor “Jono Default Monitor”DefaultDepth 24SubSection “Display”Depth 24Modes “1152×864” “1024×768” “800×600” “640×480″EndSubSectionEndSectionSection “Extensions”Option “Composite” “Enable”EndSection==================================================================================================Fedora Core 6 (FC6) Installation Notes:———————————————–If you are looking for in-depth notes have a look at this great resource: http://www.mjmwired.net/resources/mjm-fedora-fc6.html1) My install starts off with the the usual kind of stuff – I like Logical Volumes & Grub.2) Edit or network settings – as this allows you to turn off IPv6 if you aren’t going to be using it.3) Tip: I found that ticking on the “Fedora Extras” crashed my install.4) Tip: I also found that clicking “Add Additional Software Repositories” also crashed my install.5) I chose Office and Productivity, Software Development, and Web Server6) Choose the Customize Now option – It seems to me that once installed any further updates use your Internet connection, not your installation CD.7) Then I added the following:Desktop Environments – KDE (ie Both Gnome and KDE)Applications – Games and Entertainment – (Options) I turn them all onApplications – Graphicsal Internet – (Options) thunderbird, kdewebdevApplications – Office/Productivity – (Options) gnucash (although I’ve never used it seriously)Applications – Sound and Video – k3b, mikmodDevelopment – You may optionally want Eclipse, Java, KDE Development, Legacy Software Development (recommended) & RubyServers – Server Configuration ToolsServers – Windows File ServerBase System – (Turn off) Dial-Up SupportBase System – Legacy Software SupportBase System – System Tools (for samba client) – (and add) rdesktopBase System – Virtualization (Make sure this is off – I installed Xen and it croaked on first boot – just kept rebooting my system) – If you need Xen install it later.[Base System – X Windows System – switchdesk (Why would anyone installing KDE and Gnome not want this installed by default?)]8) For what I am doing (Linux on LAN), I am comfortable with turning off the firewall and disabling SELinux 9) System User – it’s worth adding 1 user in here. (be careful the username is case sensitive!)After Reboot10) add ssh keys (see below) 11) Configure sudosu(optional – you may or may not need this) chmod u+w /etc/sudoersecho ‘jono ALL=(ALL) NOPASSWD:ALL’ >> /etc/sudoers(optional – you may or may not need this) chmod u-w /etc/sudoersexit12) switchdesk kdethen I move the taskbar to the left aroundmove the launch pager down and set the number of colums to 2change the clock’s date font to a condensed size 6 font, so it fitsadd an “external taskbar” to the top. (You may need to configure this from Control Center | Dekstop | Panels) – 80% Top Centered, Tinyadd the following menus to the KMenu – rk Folders, Quick Browser, Recent Documents, Settings, System Menu & Terminal Sessionsremove the word, spreadsheet, presentation buttonsAdd Applet:Quick LauncherRecent DocumentsShowDesktopTerminal SessionsSystem MenuControl Center | Regional & Accessibility | Country/Region & Language – tweak date and time formats etc.13) vncserver (see below)14) yum – add any extra repositories15) edit fstab and configure mounts16) edit /etc/profile and add any aliases likealias lt=’ls -lrthF’17) Configure warning email addresses. For example:If you are using RAID – then edit /etc/mdadm.conf (see below)pam – email – edit /etc/logwatch/conf/logwatch.conf (see below)MailTo = jono@example.comOptional extras:18) yum install hddtemp katapult yumex kyum19) samba – call kcmsambaconf (see below for more details)then add it as a service using either the graphical service manager or chkconfig –level 35 smb onif you are running the firewall – you’ll need to add samba to the firewall…20) install hamachi – if you use hamachi (see further down for details)21) if gcc 3 is needed:sudo yum install compat-gcc-34 compat-gcc-34-c++22) install backuppc – if you use it23) Read-write NTFS mounting is supported if you:yum install fuse fuse-libs ntfs-3g ntfsprogs ntfsprogs-gnomevfs24) Add this machine to the backup program. 25) Install Graphics Driver….nvidia graphics driver————————-Best to look here: http://www.mjmwired.net/resources/mjm-fedora-fc6.htmlYumThe following is just a quick summary:Use Livna Reporpm -ivh http://rpm.livna.org/livna-release-6.rpmrpm –import http://rpm.livna.org/RPM-LIVNA-GPG-KEYyum install kmod-nvidia==================================================================================================Fedora Core 5 (good install options)—————–choose all 3 broad catogories & tick:Desktop Environments: + KDEDevelopment Tools: + eclipse+ Java dev + KDE dev+ RubyServers:+ Server Config Tools+ Windows File ServerBase: System tools: + rdesktop+ tsclientX Window System: + switchdesk==================================================================================================rsync GUI (on Linux)————————qsync (http://transamrit.net/projects/qsync/)rsync server (daemon) on Windows—————————I prefer using the cygwin-rsyncd package which is available for download from: http://backuppc.sourceforge.net/But you can also configure cwrsync from: http://www.itefix.no/cwrsync/cygwin-rsyncd setup: (I had to add C:/ProgramData/rsyncd/rsync.exe & C:/ProgramData/rsyncd/cygrunsrv.exe to the Windows Firewall Execption list)[c-drive]path = c:comment = Entire Driveauth users = backuppcsecrets file = c:/ProgramData/rsyncd/rsyncd.secrets# hosts allow = 172.16.0.17strict modes = falseread only = truelist = falseTesting:Once you’ve set this up you can Test it with (from your Linux machine to your Windows machine):rsync rsync://username@192.168.2.8:873/c-driversync rsync://username@192.168.2.107:873/temprsync -av username@192.168.4.81::temprsync 192.168.2.7:: (doesn’t work on Windows machines)On XP:Had to add rsync.exe and C:/Program Files/cwRsyncServer/bin/cygrunsrv.exe to the firewall exception list – maybe this is not necc?cwRsync setupMy rsyncd.conf file is:[s-drive]path = /cygdrive/j/Sync/S-Driveread only = truetransfer logging = false[test]path = /cygdrive/c/Tempread only = falsetransfer logging = yesTo get SSH and RSync-Server installed on one XP machine (only on cwRsync)1) just install the rsync-server with the OpenSSH option on. I just installed into c:/Cygwin2) Run the install activate-user.sh script (you’ll need to run a bash script first).3) Edit your rsyncd.conf file.4) Start both services (there are two)5) Add the rsync.exe and the sshd.exe files to the Windows Firewall list.6) You may want to add a key to .ssh/authorized_keys in the home directory of the user you’ll use.7) You can test your SSH connection using WinSCP – if you like8) You can test your RSyncD using rsync localhost:: rsync rsync://banana@192.168.2.107:873/temp==================================================================================================Samba Config—————-Encrypt Passwords must be on !!In KDE: kcmsambaconfFrom Dos: net use s: /delete (may need to reboot after this)From Dos: net use x: //penguin/x-drive /user:jono *net use h: //192.168.2.198/home /user:jono *smbstatusTo access another machines share in Linux use Konqueror with smb://spiff/desktop (or whatever the share is)or you can use nautilus (File | Connect to Server)nmblookup beach – to lookup beach’s address….smbclient -L beach -U YourUsersmbclient ////beach//Temp -I 192.168.2.207 -U YourUserEmperor smb.conf (clip)————————-[home]comment = Hdrivepath = /homeread only = noguest ok = yesforce user = rootforce group = rootcase sensitive = nomsdfs proxy = nocreate mask = 0777directory mask = 0777Penguin smb.conf (full)————————[global]server string = penguinpassword server = Noneguest ok = yesguest account = capesoftguestworkgroup = capesoftlocal master = nopreferred master = nousername map = /etc/samba/smbusersdomain master = norestrict anonymous = nomax protocol = NTldap ssl = Noserver signing = Autosocket options = TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=8192 SO_RCVBUF=8192 max xmit = 65535syslog = 0log level = 1[tmp]path = /tmpread only = nocase sensitive = nomsdfs proxy = no[p-drive]path = /workdrive/p-driveread only = nocase sensitive = nomsdfs proxy = nocreate mask = 0777directory mask = 0777force group = capesoft[x-drive]path = /workdrive/x-driveread only = nocase sensitive = nomsdfs proxy = nocreate mask = 0777directory mask = 0777force group = capesoft[linuxroot]path = /[s-drive]path = /workdrive/s-drivecase sensitive = nomsdfs proxy = nocreate mask = 0775directory mask = 01775read only = nosecurity mask = 0775directory security mask = 01775valid users = suzy,backup,backuppc,vaderbackup,brucehome,trevor,tnacompiler,jono,bruce,sean,lesley,robert,gary,paul,geoff,derek,eliza,simonread list = suzy,backup,backuppc,vaderbackup,brucehome,trevor,tnacompilerforce directory security mode = 01000force directory mode = 01000[raidtest]case sensitive = nomsdfs proxy = noread only = nopath = /workdrive/raidtest/block size = 4096force group = capesoftcreate mask = 0777directory mask = 0777[n-drive]case sensitive = nomsdfs proxy = noread only = nocreate mask = 0777directory mask = 0777path = /workdrive/n-driveforce group = capesoft[z_dont_use_q-drive-old]case sensitive = nomsdfs proxy = nopath = /workdrive/q-drivecreate mask = 0777directory mask = 0777force group = capesoftcomment = (Read Only – Use Beast now)[v-drive]case sensitive = nomsdfs proxy = nopath = /workdrive/v-drive/read only = nocreate mask = 0777directory mask = 0777force group = rootforce user = rootcomment = SVN Repositories[u-drive]case sensitive = nomsdfs proxy = noread only = nocomment = Un-Backed Up Drivecreate mask = 0777directory mask = 0777path = /workdrive/u-drive/force group = capesoft==================================================================================================nbench———http://www.tux.org/~mayer/linux/bmark.htmlhttp://www.byte.com/bmark/download.htmhttp://www.tux.org/~mayer/linux/results2.htmlhttp://www.tux.org/~mayer/linux/compare/index.html http://fresh.t-systems-sfr.com/linux/src/nbench-byte-2.2.2.tar.gz/From the notes:If you run all the tests (as you’ll see, it is possible to perform “customruns”, which execute only a subset of the tests) the BYTEmark will alsoproduce two overall index figures: Integer index and Floating-point index.The Integer index is the geometric mean of those tests that involve onlyinteger processing — numeric sort, string sort, bitfield, emulatedfloating-point, assignment, Huffman, and IDEA — while the Floating-pointindex is the geometric mean of those tests that require the floating-pointcoprocessor — Fourier, neural net, and LU decomposition. You can use thesescores to get a general feel for the performance of the machine under testas compared to the baseline 90 Mhz Pentium.The Linux/Unix port has a second baseline machine, it is an AMD K6/233 with32 MB RAM and 512 KB L2-cache running Linux 2.0.32 and using GNU gccversion 2.7.2.3 and libc-5.4.38. The integer index was split as suggestedby Andrew D. Balsa <andrewbalsa@usa.net>, and reflects the realization thatmemory management is important in CPU design. The original tests have beenleft alone, however, the geometric mean of the tests NUMERIC SORT, FPEMULATION, IDEA, and HUFFMAN now constitutes the integer-arithmetic focusedbenchmark index, while the geometric mean of the tests STRING SORT,BITFIELD, and ASSIGNMENT makes up the new memory index. The floating pointindex has been left alone, it is still the geometric mean of FOURIER,NEURAL NET, and LU DECOMPOSITION.Running on: FoxBoardBYTEmark* Native Mode Benchmark ver. 2 (10/95)Index-split by Andrew D. Balsa (11/97)Linux/Unix* port by Uwe F. Mayer (12/96,11/97)TEST : Iterations/sec. : Old Index : New Index: : Pentium 90* : AMD K6/233*——————–:——————:————-:————NUMERIC SORT : 19.298 : 0.49 : 0.16STRING SORT : 1.0669 : 0.48 : 0.07BITFIELD : 4.5541e+06 : 0.78 : 0.16FP EMULATION : 2.0007 : 0.96 : 0.22FOURIER : 1.5784 : 0.00 : 0.00ASSIGNMENT : 0.29735 : 1.13 : 0.29IDEA : 79.239 : 1.21 : 0.36HUFFMAN : 14.771 : 0.41 : 0.13NEURAL NET : 0.0028459 : 0.00 : 0.00LU DECOMPOSITION : 0.12801 : 0.01 : 0.00==========================ORIGINAL BYTEMARK RESULTS==========================INTEGER INDEX : 0.719FLOATING-POINT INDEX: 0.004Baseline (MSDOS*) : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0==============================LINUX DATA BELOW===============================CPU :L2 Cache : 8 kBOS : Linux 2.6.15C compiler : cris-axis-elf-gcc (GCC) 3.2.1 Axis release R63/1.63libc : ??MEMORY INDEX : 0.152INTEGER INDEX : 0.203FLOATING-POINT INDEX: 0.002Baseline (LINUX) : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38==================================================================================================Hamachi———-tuncfghamachi starthamachi –helphamachi login/logout go-online <network>/go-offline <network>hamachi get-nickshamachi list(Windows – seeing lots of orange connections? – try disabling other network adapters)wget http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gztar zxvf hamachi-0.9.9.9-20-lnx.tar.gzcd hamachi-0.9.9.9-20-lnxRun ‘make install’ and then ‘tuncfg’ from under the root accountcd ..Run ‘hamachi-init’ to generate crypto identity (any account).copy the script below to /etc/init.d/hamachichmod a+x /etc/init.d/hamachichkconfig –level 35 hamachi on/etc/init.d/hamachi starthamachi set-nick YourNamehamachi join <network>hamachi go-online <network>Other Commands:Run ‘hamachi start’ to launch Hamachi daemon.Run ‘hamachi login’ to put the daemon online and to create an account.Run ‘hamachi list’ to list network members and their status.!!!!!!!!!!!! —————————-#!/bin/bash## hamachi Startup script for the Hamachi## chkconfig: – 91 35# description: Starts and stops the Hamachi Service## Version 1.20 Jono Woodhouse 18 August 2006# Copyright (c) 2006 CapeSoft Software (Pty) Ltd# Use a own Risk# Permission is granted to use this script## install with:# chkconfig –add hamachi# chkconfig –level 345 hamachi on# chkconfig –list hamachi##RETVAL=0#start() {tuncfghamachi -c /root/.hamachi starthamachi -c /root/.hamachi login}#stop() {hamachi -c /root/.hamachi logouthamachi -c /root/.hamachi stop}#install() {chkconfig –add hamachichkconfig –level 345 hamachi onchkconfig –list hamachi}#status() {hamachi -c /root/.hamachi get-nickssleep 3hamachi -c /root/.hamachi list}# See how we were called.case “$1” instart)start;;stop)stop;;status)status;;install)install;;restart)stopstart;;*)echo $”Usage: $prog {start|stop|restart|status|install}”exit 1esacexit $RETVAL!!!!!!!!!!!! ——————————-==================================================================================================TortoiseSVN———————————————————————————-Jono’s SVN Notes – Subversion and TortoiseSVNInstall File: Here———————————————————————————-TortoiseSVN Installation———————————————————————————-1) Install TortoiseSVN (on Windows Machine)2) A couple of good settings are:2a) In TortoiseSVN | Settings | Look & Feel- Tick on the options for Cascaded Context Menu for CheckOut, Update & Commit- Turn off the “Fetch status for context menu” – this makes Tortoise SVN much faster.2b) I’m using a Network Drive (Q:/) so Right-Click on a folder and Choose TortoiseSVN | Settings | Choose the Icon Overlays and add the following:Turn on – Unversioned files mark parent folder as modifiedTurn off – Fixed DrivesInclude paths:q:/*———————————————————————————-TortoiseSVN Setting up a Repository———————————————————————————-1) Make a folder where you want the Repository created. Right-click on folder and choose TortoiseSVN | Create Repository Here | FSFS(In my case //penguin/v-drive/SVN_Repositories/ProductName)2) Using //penguin/v-drive/SVN Layout, which contains the following empty folder structuresTrunkBranchesTagsRight-click on //penguin/v-drive/SVN Layoutand choose Import.URL of Repository = file:////penguin/v-drive/SVN_Repositories/ProductNameImport Message = Repository Layout3) Locate your source code in say: Q:/ProductName(Note you don’t use the Trunch, Branch, Tags folders in here).Right-click on Q:/ProductNameand choose Import.URL of Repository = file:////penguin/v-drive/SVN_Repositories/ProductName/Trunk (note the Trunk part at the end !!)Import Message = Initial Source Import4) In my case I want my working folder the same location as my original source, so backup and then delete the files in your original source folder.You basically want a empty folder like this: Q:/ProductNameThen right-click on the working folder, and choose Check-OutURL of Repository = file:////penguin/v-drive/SVN_Repositories/ProductName/Trunk (note the Trunk part at the end !!)5) Unrecommended Extra Options ARight-click on your Q:/ProductName folder and choose Propeties | Go to the Subversion tab and enter the following Propertiestsvn:logminsize 3 (tick on Recursive and press Set)Optionaltsvn:lockmsgminsize 3 (you have to type in the property name, again click on Recursive and press Set)Press OKNow commit these changes with a Message of SVN Configuration6) Unrecommended Extra Options BIf you want any files (.app files or graphics files) to have to be locked before they can be changed, then select a file and Right-click Properties and add the following Propertysvn:needs-lock *Now commit these changes with a Message of SVN ConfigurationOther well useful commands- Check for Modifications- Show Log- Lock etc.- Add to Ignored List- Right-click Properties – also has a TortoiseSVN tab on it- svn:needs-lock- tsvn:logminsize- tsvn:lockmsgminsize- Branching and TaggingSVN – linux SVN Commands——————————–* To update to the latest binaryyum update subversion.i386yum update mod_dav_svn (should be included in the above)yum install kdesvn (optional)* Create Repositorysvnadmin create /workdrive/svn/repo1 (Tip – it’s probably better to create a FSFS type repository !!)svnadmin create –fs-type fsfs /workdrive/svn/repo1* Importsvn import /tmp/test1 file:///workdrive/svn/repo1 -m “initial import”* Renamemv /tmp/test1 /tmp/.test1* Initial Checkoutsvn checkout file:///workdrive/svn/repo1 /tmp/test1cd /tmp/test1svn checkout file:///mnt/penguin/v-drive/SVN_Repositories/Fox/gio/Trunk /home/foxcode/gio* Check Differencessvn diff* Commitsvn commit -m “Version 2″* Add & Commitsvn add * –forcesvn commit -m “next version”* Verifysvadmin verify /workdrive/svn/repo1* Revertsvn revert -R .* Moving Repository / Rename RepositorySee: http://maisonbisson.com/blog/post/11905/moving-a-subversion-repositorysvnadmin dump /path/to/repository > repository-name.dmpsvnadmin load repository-name < repository-name.dmp==================================================================================================Git—See: http://git.or.cz/See: http://git.or.cz/course/svn.htmlSee: http://www.kernel.org/pub/software/scm/git/docs/user-manual.htmlsetup—git config –global user.name “Your Name Comes Here”git config –global user.email you@yourdomain.example.comgit config –global color.diff autogit config –global color.status autogit config –global color.branch autonew repository——————git initgit add . (svnadmin create repo)git commit (svn import file://repo)checkout & update——————git clone url (svn checkout url)git pull (svn update)advanced checkout———————–git checkout –track -b branch origin/branch (svn switch url)misc commands——————git help (svn help)git status (svn status)git tag -lgit branchgit branch -rgit diff (svn diff | less)git diff rev path (svn diff -rrev path)git apply (patch -p0)git checkout path (svn revert path)git add file (svn add file)git rm file (svn rm file)git mv file (svn mv file)git commit -a (svn commit)git commit –amend (tweak last commit)git reset HEAD^ (reverse last commit)git log (svn log | less)git blame file (svn blame file)git show rev:path/to/filegit show rev:path/to/directorygit show revgit checkout rev (svn update -r rev)git checkout prevbranch (svn update)gitkgit-guipatches———see: git format-patch originsee: git am -3 patches.mbox==================================================================================================rdiff-backup (Using jonordiff-backup scripts)————-*** Step One ***In FC6 you can just runyum install rdiff-backupOtherwise you’ll need to compile it from source First of all you need to compile librsync (0.9.7). Copy the librsync-0.9.7.tar.gz file to /home/jono/ extract to Here(doesn’t work if you nest it too far down)./configuremake all checkmake make installIf you don’t do the last 2 steps, you’ll need to: cp libr*.h /usr/local/includecp libr* /usr/local/lib (Can probably just copy .a and .la files)cp ./libs /usr/local/lib (Can probably just copy .a and .la files)Now extract rdiff-backup(1.03).rpm’s rdiff-backup-1.0.3.tar.gz file to /home/jono/python setup.py buildpython setup.py installrdiff-backup –version (Should show build number!!)man rdiff-backup*** Step Two *** Create Mount Point folders e.g.mkdir /mnt/beach/cEdit fstab and add the following kind of mount points//192.168.2.208/c /mnt/beach/c cifs defaults,user=Jono,password=Jono 0 0*** Step Three *** (Using jonordiff-backup scripts)Edit the backupthis file and include all your locationsNB: Keep the last line as Place_Entries_Above_Here*** Step Four ***Add a KeepMeHereForBackupToRun.txt file to the folder locations of all places you want backed up.*** Step Five ***Configure and check Email XXXXX – needs FIXING !!! XXXXXXXXXXXXXXXXXXXXXXXcd /etc/mailedit /etc/mail/sendmail.mc and change this line to:dnl # Uncomment and edit the following line if your outgoing mail needs todnl # be sent out through an external mail server:dnl #define(`SMART_HOST’,`192.168.2.208′)make -C /etc/mailTest with:mail -s ‘Subject Goes Here’ bob@example.comtext goes here^D*** Step Six ***Example jonobackup usage:jonobackup backupjonobackup statusjonobackup restore “/mnt/beach/c/My Documents” nowjonobackup truncate 10B (keep at most 10 copies)jonobackup truncate 4W (keep backups for up to 4 Weeks)./jonobackup restore 192.168.2.55/workdrive/x-drive/InetPub/capesoft/*** Step Seven *** XXXXXXXXXXXXXXXXXXXXXXAdd the following Cron entries:20 4,6,8,10,12,14,16,18,20,22 * * * root /home/capesoft/jonordiff-backup/jonobackup backup >> /var/log/jonobackup.log 2>&110 3 * * * root /home/capesoft/jonordiff-backup/jonobackup syncbackup >> /var/log/jonobackup.log 2>&1@daily root /home/capesoft/jonordiff-backup/jonobackup maintenance 6M 1000B /var/log/jonobackup.log >> /var/log/jonobackup.log 2>&1@reboot root /home/capesoft/jonordiff-backup/jonobackup onboot >> /var/log/jonobackup.log 2>&1==================================================================================================backuppc (http://backuppc.sourceforge.net/)———–BackupPC Tips—————–Tip 1: If your smb (samba) smbclient backups are giving you session setup failed: NT_STATUS_LOGON_FAILURE(see http://www.mail-archive.com/backuppc-users@lists.sourceforge.net/msg02746.html)Then if you aren’t worried about security then add the share password after -U $userName in $Conf{SmbClientFullCmd}, for example:$Conf{SmbClientFullCmd} = ‘$smbClientPath ////$host//$shareName $I_option -U $userName PASSWORD_GOES_HERE -E -N -d 1 -c tarmode// full -Tc$X_option – $fileList’;Tip 2: After editing the config file with the web editor I once got “$ENV{REMOTE_USER} is not set” errors. Check your config.pl file. Mine had an extra ‘; in it after $Conf{EMailHeaders}Tip 3: If you are using rsync in v2.12 and are getting “fileListReceive failed”, for example:Running: /usr/bin/ssh -q -x -l root <snip…> /home/fileListReceive() failedDone: 0 files, 0 bytesGot fatal error during xfer (fileListReceive failed)Backup aborted (fileListReceive failed)then you probably need to change the –devices to -D in your config file for the $Conf{RsyncArgs} and $Conf{RsyncRestoreArgs}Tip 4: Windows Vista does not work with all versions of smbclient. I am using rsync to backup all our Windows Vista machines nowTip 5: Starting BackupPC: No language settingIn my setup I run everything on this backup box as root (holly ha… I know – but it works fine on our LAN)Change the /etc/init.d/BackupPC file to run BackupPC as root(alternatively – make sure you backuppc user has sufficient priveledges to be able to read your config.pl file)Tip 6:I like to change BackupPC_stnd.css (in /usr/share/BackupPC/html) as follows:font-size:10pt; => font-size:11px;then change the font size for:.fviewheader .fviewborder.fview.fviewboldtofont-size:11px;Tip 7: Here’s my backup exclusion list (note the forward slashes for rsync – change these to backslashes for smb):$Conf{BackupFilesExclude} = {‘*’ => [‘*.tmp’,’*.iso’,’*.obj’,’*.mp3′,’*.wma’,’*.wmv’,’*.avi’,’*.wav’,’*.mpg’,’*.rmj’,’___CustomList___.start’,’/Your Custom List In Here/*’,’___CustomList___.end’,’*/Games/*’,’/Games/*’,’*/Music/*’,’/Music/*’,’*/Downloads/*’,’/Downloads/*’,’*/My Music/*’,’/My Music/*’,’*/Google/Google Desktop/*’,’*/Google/GoogleEarth/*’,’*/Google/Picasa2/*’,’*/Microsoft/Media Player/*’,’*/My Virtual Machines/*’,’/My Virtual Machines/*’,’pagefile.sys’,’hibefil.sys’,’/Temp/*’,’/temp/*’,’*/Local Settings/Temp/*’,’*/AppData/Local/Temp/*’,’/Windows/Temp/*’,’/WINDOWS/Temp/*’,’/WUTemp/*’,’*/Temporary Internet Files/*’,’/Windows/winsxs/*’,’/WINDOWS/winsxs/*’,’/Windows/$NtUninstall*’,’/WINDOWS/$NtUninstall*’,’/$RECYCLE.BIN/*’,’/RECYCLER/*’,’/RECYCLED/*’,’/Recycled/*’,’/MSOCache/*’,’/System Volume Information/*’,’Thumbs.db’]};==================================================================================================BackupPC v3.00 (Gold) – Install – Notes for Fedora Core 7 – FC7—————————–1) su – (to become root if you aren’t logged in already)2) BackupPC is available when you install Fedora Core 7 (even though it says it’s an FC6 rpm), I spotted this during the Fedora install and installed it, otherwise you can install it now with:yum install BackupPC (case sensitive)This gets the following (from 2.1.2-7.fc6):=============================================================================Package Arch Version Repository Size=============================================================================Installing:BackupPC noarch 2.1.2-7.fc6 extras 472 kInstalling for dependencies:perl-Archive-Zip noarch 1.16-1.2.1 core 138 kperl-File-RsyncP i386 0.62-3.fc6 extras 107 kperl-suidperl i386 4:5.8.8-10 core 57 k—-This installs BackupPC v2.12 into:/usr/share/BackupPC (Application)/usr/share/doc/BackupPC (Docs)/etc/BackupPC (Config)/var/log/BackupPC (Logs)/var/lib/BackupPC (Data)3) Now we upgrade this to v3.00 (Gold)1 – stop the BackupPC daemon/etc/init.d/BackupPC stop (or /etc/init.d/backuppc stop)2 – I made a folder /root/Downloads/BackupPC_Source and copied in File-RsyncP-0.68.tar.gz & BackupPC-3.0.0.tar.gzcd /root/Download/BackupPC_Source3 – Install par2yum install par2cmdline4 – update File::RsyncP (manually or via the ‘cpan’ command) – if you aren’t already running 0.68 (more /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/File/RsyncP.pm – to get version number you may need to change 5.8.8 to your perl version)tar zxvf File-RsyncP-0.68.tar.gzcd File-RsyncP-0.68perl Makefile.PLmakemake testmake installcd ..5 – update BackupPCtar zvxf BackupPC-3.0.0.tar.gzcd BackupPC-3.0.0perl ./configure.plThen answer the following question:”Is this a new installation or upgrade for BackupPC? If this isan upgrade please tell me the full path of the existing BackupPCconfiguration file (eg: /etc/BackupPC/config.pl). Otherwise, justhit return.”-> /full/path/to/your/current/config.pl (if you have a current config file)(default values for other parameters should be OK – other than the following)- I give my hostname for the machine name e.g. adam- I run my setup as root (not the backuppc user) – this is a security risk – but saves hassels later.- I remove one of the // in the install directory e.g. /usr/share/BackupPC- I also put my data into /workdrive2/backuppcdata- I also remove the double // from the CGI bin folder etc.4) Configuration- I also needed to edit in config.pl in the $Conf{EMailHeaders} section. And change this to read as follows:$Conf{EMailHeaders} = ‘MIME-Version: 1.0Content-Type: text/plain; charset=”iso-8859-1″‘;- In config.pl:I had entries for //usr – so I searched and replaced all //usr with /usr$Conf{CgiAdminUserGroup} = ‘*’;$Conf{CgiAdminUsers} = ‘*’;$Conf{BackupPCUser} = ‘root’;also make sure you set: $Conf{FullKeepCnt} & $Conf{IncrLevels} & all the settings in between…I could uncomment the –checksum-seed option… (x 3)$Conf{CompressLevel} = 3;$Conf{PingMaxMsec} = 500;set $Conf{EMailFromUserName}- then I did the following:cp /root/Download/BackupPC_Source/BackupPC-3.0.0/init.d/linux-backuppc /etc/init.d/BackupPCthen change BackupPC to run as: root – Change this (again) in:/etc/init.d/BackupPC (this may have been done for you when you installed if you did this correct the first time)(warning this is a security risk – which I am not cared about but you may be)/etc/init.d/httpd restart/etc/init.d/BackupPC restartchkconfig –level 35 BackupPC onchkconfig –level 35 httpd oncd /var/www/cgi-bin/cp /usr/share/BackupPC/sbin/BackupPC_Admin BackupPC_Adminchown root:apache BackupPC_Adminchmod a+r BackupPC_Adminchmod a+x BackupPC_Adminchmod u+s BackupPC_Admin- I like the following too:I like to change BackupPC_stnd.css (in /usr/share/BackupPC/html) as follows:(note spot the px not the pt !!)font-size:10pt; => font-size:11px; then change the font size for:.fviewheader .fviewborder.fview.fviewboldtofont-size:11px;- Now go and test your setup by connecting to (you’ll need to change the IP address)http://192.168.4.205/cgi-bin/BackupPC_Admin==================================================================================================BackupPC v3.0.0 (Gold or beta3) – Upgrading from v3.0.0beta2 —————————————————————–1 – stop the BackupPC daemon/etc/init.d/BackupPC stop (or /etc/init.d/backuppc stop)2 – update File::RsyncP (manually or via the ‘cpan’ command) – if you aren’t already running 0.68 (more /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/File/RsyncP.pm – to get version number you may need to change 5.8.8 to your perl version)tar zxvf File-RsyncP-0.68.tar.gzcd File-RsyncP-0.68perl Makefile.PLmakemake testmake install3 – update BackupPCtar zvxf BackupPC-3.0.0.tar.gzcd BackupPC-3.0.0perl ./configure.plThen answer the following question:”Is this a new installation or upgrade for BackupPC? If this isan upgrade please tell me the full path of the existing BackupPCconfiguration file (eg: /etc/BackupPC/config.pl). Otherwise, justhit return.”-> /full/path/to/your/current/config.pl(default values for other parameters should be OK)4 – start the BackupPC daemon/etc/init.d/backuppc start(or /etc/init.d/BackupPC start)NOTE: you may have to adjust file permissions for the Web GUI to work.Take a look at your running config and take notes before you upgrade.– VincentExtra Notes:My (Jono) web permissions needed no tweaking between upgrades, but I am sure this depends on how you’ve configured your web setup in the first place.I like to change BackupPC_Stnd.css as follows:font-size:10pt; => font-size:11px;then change the font size for:.fviewheader .fviewborder.fview.fviewboldtofont-size:11px;==================================================================================================BackupPC v3.00beta 2 – Upgrading from v3.00beta 1 (with input from Vincent Fleuranceau) – (I used FC5)———————————————————————–1 – stop the BackupPC daemon/etc/init.d/backuppc stop (or /etc/init.d/BackupPC stop)2 – update File::RsyncP (manually or via the ‘cpan’ command)tar zxvf File-RsyncP-0.68.tar.gzcd File-RsyncP-0.68perl Makefile.PLmakemake testmake install3 – update BackupPCtar zvxf BackupPC-3.0.0beta2.tar.gzcd BackupPC-3.0.0beta2perl ./configure.plThen answer the following question:”Is this a new installation or upgrade for BackupPC? If this isan upgrade please tell me the full path of the existing BackupPCconfiguration file (eg: /etc/BackupPC/config.pl). Otherwise, justhit return.”-> /full/path/to/your/current/config.pl(default values for other parameters should be OK)4 – start the BackupPC daemon/etc/init.d/backuppc start(or /etc/init.d/BackupPC start)NOTE: you may have to adjust file permissions for the Web GUI to work.Take a look at your running config and take notes before you upgrade.– VincentExtra Notes:My (Jono) web permissions needed no tweaking between upgrades, but I am sure this depends on how you’ve configured your web setup in the first place.I like to change BackupPC_Stnd.css as follows:font-size:10pt; => font-size:11px;then change the font size for:.fviewheader .fviewborder.fviewborder.fview.fviewboldtofont-size:11px;==================================================================================================BackupPC v3.00beta1 – Upgrading from v2.12 – Notes for Fedora Core 5- FC5——————————————————-* upgrade File::RSync to v0.64* install XML::RSS (optional)tar zxvf XML-RSS-1.10.tar.gzcd XML-RSS-1.10perl Makefile.PL- Warning: prerequisite Test::Manifest 0.9 not found. (I just ignored this)makemake install* tar zxvf BackupPC-3.0.0beta1.tar.gz* cd BackupPC-3.0.0beta1* perl configure.pl- Path to config.pl (I’m upgrading so I had to point it to my existing location – new installation use /etc/BackupPC/config.pl): /workdrive2/backuppcdata/conf/config.pl- Paths: y- Hostname:- Root:- Install path (Put yours in here): /home/capesoft/backuppc- ….* All worked very smoothly.BackupPC v3.00beta1 – Fresh Install – Notes for Fedora Core 6 – FC6—————————–In Fedora Core 6 backuppc v2.12 is now available for download via yum1) su – (to become root if you aren’t logged in already)2) yum install BackupPC (case sensitive)This gets the following:=============================================================================Package Arch Version Repository Size=============================================================================Installing:BackupPC noarch 2.1.2-7.fc6 extras 472 kInstalling for dependencies:perl-Archive-Zip noarch 1.16-1.2.1 core 138 kperl-File-RsyncP i386 0.62-3.fc6 extras 107 kperl-suidperl i386 4:5.8.8-10 core 57 k—-This installs BackupPC v2.12 into:/usr/share/BackupPC (Application)/usr/share/doc/BackupPC (Docs)/etc/BackupPC (Config)/var/log/BackupPC (Logs)/var/lib/BackupPC (Data)3) I’ve got an existing v2.12 Config file – so I am backing up the existing one, and then merge in my original settings.4) However this isn’t enough to get the CGI-Admin to work I needed to make the following tweaks:(Note I’m not worried about the security of my backup machine, it runs on a LAN and is mainly for the office programmers – if you are concerned about security read the BackupPC docs and good luck…)- Change BackupPC to run as: root – Change in config.pl and in /etc/init.d/BackupPC(warning this is a security risk – which I am not cared about but you may be)/etc/init.d/httpd restart/etc/init.d/BackupPC restartcd /var/www/cgi-bin/cp /usr/share/BackupPC/sbin/BackupPC_Admin BackupPC_Adminchown root:apache BackupPC_Adminchmod a+r BackupPC_Adminchmod a+x BackupPC_Adminchmod u+s BackupPC_Admin5) —Now we just need to update to BackupPC v3.00… (http://heanet.dl.sourceforge.net/sourceforge/backuppc/BackupPC-3.0.0beta1_doc.html#installing_backuppc)* upgrade File::RSync to v0.64* install XML::RSS (optional)tar zxvf XML-RSS-1.10.tar.gzcd XML-RSS-1.10perl Makefile.PL- Warning: prerequisite Test::Manifest 0.9 not found. (I just ignored this)makemake install* Install par2 (cp par2 /usr/bin/par2)* tar zxvf BackupPC-3.0.0beta1.tar.gz* cd BackupPC-3.0.0beta1* perl configure.pl- Path to config.pl (Check this is correct): /etc/BackupPC/config.pl- Paths: y- Hostname:- Root:- Install path (Put yours in here): /usr/share/BackupPC- Data directory (You may want this somewhere else): – (Finish install)- Then tweak the cgi-bin file again:(I suppose you could probably tell BackupPC to use /var/www/cgi-bin as the CGI folder, and then you wouldn’t need this step)cd /var/www/cgi-bin/cp /usr/share/BackupPC/sbin/BackupPC_Admin BackupPC_Adminchown root:apache BackupPC_Adminchmod a+r BackupPC_Adminchmod a+x BackupPC_Adminchmod u+s BackupPC_Admin – Browse through the config file, /etc/BackupPC/config.pl,and make sure all the settings are correct. In particular,you will need to set $Conf{CgiAdminUsers} so you haveadministration privileges in the CGI interface.- Edit the list of hosts to backup in /etc/BackupPC/hosts.- Read the documentation in //usr/share/BackupPC/doc/BackupPC.html.Please pay special attention to the security section.6) This all worked very smoothly for me. Bear in mind that the new config.pl file is in /etc/BackupPCAnd that the per machine override settings are in /etc/BackupPC/pc/<machinename>.plYou should also no longer have a perl include at the top of this file!!(i.e. Remove this line — do “/etc/BackupPC/config.pl”;)==================================================================================================Jono’s rsync notes for BackupPC:————————1) Turn on the –checksum-seed option2) Prior to 2.1.2pl2 you need to change to -D (note only one minus) instead of –devices (in $Conf{RsyncArgs} and $Conf{RsyncRestoreArgs})3) Admin| Reload ==================================================================================================BackupPC v2.12 – Notes for Fedora Core 5- FC5———————See below for the specifics:* Installed Archive::Zip* Installed File::RSync* Installed par2* yum install perl-suid-perl (nb: this is NB)* tar zxvf BackupPC-2.1.2.tar.gz* cd BackupPC-2.1.2* patch -p0 < ../BackupPC-2.1.2pl1.diff* perl configure.pl- BackupPC should run as: root- Install: /home/capesoft/backuppc- Data: /workdrive2/backuppcdata- cgi: /var/www/cgi-bin- html: /var/www/html/backuppc- image: /backuppc* cd init.d* chmod a+x linux-backuppc* cp linux-backuppc /etc/init.d/backuppc* cd /var/www/cgi-bin* chmod u+x BackupPC_admin* edit /workdrive2/backuppcdata/conf/configure.pl – to suit your needs:Also change the following:$Conf{CgiAdminUserGroup} = ‘*’;$Conf{CgiAdminUsers} = ‘*’;(next two changes not the inlcusion of the password… as in -U $userName backuppc ….)$Conf{SmbClientFullCmd} = ‘$smbClientPath ////$host//$shareName’. ‘ $I_option -U $userName backuppc -E -N -d 1’. ‘ -c tarmode// full -Tc$X_option – $fileList’;$Conf{SmbClientIncrCmd} = ‘$smbClientPath ////$host//$shareName’. ‘ $I_option -U $userName backuppc -E -N -d 1’. ‘ -c tarmode// full -TcN$X_option $timeStampFile – $fileList’;* /etc/init.d/httpd start (also add to services if needed see below)* /etc/init.d/backuppc start (also add to services if needed see below)* You may want to replace the css file in /var/www/html/backuppc with Jono’s one* chkconfig –add backuppcchkconfig –level 345 backuppc onchkconfig –list backuppc==================================================================================================BackupPC v2.12 – Notes for Fedora Core 4———————- FC3 seems to be missing more modules than FC4 at the time of writing this.* I ran a couple of yum updatese.g. yum update httpd http-suexec http-manual gcc gcc-c++ perl python mod_python mod_ssl*** TIP of the year: ****yum install perl-suidperl* Follow the backuppc instructions starting with checking for the different perl modules e.g.tar zxvf File-RsyncP-0.52.tar.gzcd File-RsyncP-0.52.tar.gzperl Makefile.PLmakemake testmake install* Download tar filetar zxf BackupPC-2.1.2.tar.gzcd BackupPC-2.1.2perl configure.pl* At this point I didn’t have a par2http://parchive.sourceforge.netIn the end used RH9 buildhttp://prdownloads.sourceforge.net/parchive/par2cmdline-0.4-x86-Linux-2.4.20-Redhat-9.0.tar.gz?downloadJust unzipped it and put it in /usr/bin (Thanks Tiembo)chmod a+x /usr/bin/par2* Also to configure apache- turn httpd service on- run /init.d/httpd start (or restart)Put the following into /var/www/cgi-bin/jonotest.pl (and chmod a+x it)#!/usr/bin/perlprint “Content-type: text/html/n/n”;print “Hello, World.”;* SettingsI just ran it as rootInstalled in : /home/capesoft/backupData in: /backuppcdataCompression: 3cgi-bin : /var/www/cgi-binApache image directory: /var/www/html/backuppcURL for image directory: /backuppc* Ok, it looks like we are finished. There are several more things youwill need to do:- Browse through the config file, /workdrive/backuppcdata/conf/config.pl,and make sure all the settings are correct. In particular, youwill need to set the smb share password and user name, backuppolicies and check the email message headers and bodies.- Edit the list of hosts to backup in /workdrive/backuppcdata/conf/hosts.- Read the documentation in /home/capesoft/backuppc/doc/BackupPC.html.Please pay special attention to the security section.- Verify that the CGI script BackupPC_Admin runs correctly. You mightneed to change the permissions or group ownership of BackupPC_Admin.- BackupPC should be ready to start. Don’t forget to run itas user root! The installation also contains aninit.d/backuppc script that can be copied to /etc/init.dso that BackupPC can auto-start on boot. This will also enableadministrative users to start the server from the CGI interface.See init.d/README.* config.pl (master file)I turned off the $Conf{SmbShareName} = ‘C$’;And set SmbShareUserName and Password(I also added a backuppc user to my Windows XP machine)* hostsspiff 0 jono@example.com roothobbes 0 bruce@example.com root* I had to chmod a+x /var/www/cgi-bin/BackupPC_Admin(This is not recommended for security reasons – but this doesn’t faze me for this installation).* Then copy the linux-backuppc (from your original Installation Folder area in a folder called init.d) to /etc/init.d/backuppcthen chmod a+x itAfter copying it, you can test it by running these commands as root:/etc/init.d/backuppc start/etc/init.d/backuppc status/etc/init.d/backuppc stopYou should then run the following commands as root:chkconfig –add backuppcchkconfig –level 345 backuppc onchkconfig –list backuppcThis will auto-start backuppc at run levels 3, 4 and 5.* You can then access it (hopefully) via http://127.0.0.1/cgi-bin/BackupPC_Admin* I chose to create multiple config files in /workdrive/backuppcdata/conf with the following at the tope.g. config_machinename.pldo “/workdrive/backuppcdata/conf/config.pl”;and then link them into the PC area e.g.ln -s ../../conf/config_machinename.pl config.plI changed the $Conf{SmbShareName} = ‘C$’;And set SmbShareUserName and Password(I also added a backuppc user to my Windows XP machine)XXX – what to change* I also changed the CSS stylesheet in the cgi directory* File / Directory OverviewConfiguration/etc/backuppc/config.pl/var/lib/backuppc/pc/$host/config.pl/etc/backuppc/hostsData/var/lib/backuppc/pc/$host – 1 directory per host/var/lib/backuppc/pool – uncompressed pool/var/lib/backuppc/cpool – compressed pool files/var/lib/backuppc/log – log and statusl files/var/lib/backuppc/trash – files to be deletedRemoving a clientIf there is a machine that no longer needs to be backed up (eg: a retired machine) you have two choices. First, you can keep the backups accessible and browsable, but disable all new backups. Alternatively, you can completely remove the client and all its backups.To disable backups for a client there are two special values for $Conf{FullPeriod} in that client’s per-PC config.pl file:-1 Don’t do any regular backups on this machine. Manually requested backups (via the CGI interface) will still occur.-2 Don’t do any backups on this machine. Manually requested backups (via the CGI interface) will be ignored.This will still allow that client’s old backups to be browsable and restorable.To completely remove a client and all its backups, you should remove its entry in the conf/hosts file, and then delete the /workdrive/backuppcdata/pc/$host directory. Whenever you change the hosts file, you should send BackupPC a HUP (-1) signal so that it re-reads the hosts file. If you don’t do this, BackupPC will automatically re-read the hosts file at the next regular wakeup.Note that when you remove a client’s backups you won’t initially recover a lot of disk space. That’s because the client’s files are still in the pool. Overnight, when BackupPC_nightly next runs, all the unused pool files will be deleted and this will recover the disk space used by the client’s backups.* Cleaning up- I changed the backup share to a real share called NoWhere- Ran a backup- Changed :$Conf{FullKeepCnt} = 1;$Conf{FullKeepCntMin} = 0;$Conf{FullAgeMax} = 1;$Conf{IncrKeepCnt} = 6;$Conf{IncrKeepCntMin} = 0;$Conf{IncrAgeMax} = 1;/etc/init.d/backuppc restart/usr/share/BackupPC/bin/BackupPC_dump -v -f spiff_rsyncd/usr/share/BackupPC/bin/BackupPC_nightly 0 255/usr/share/BackupPC/bin/BackupPC_trashClean(repeat these 3 instructions a good number of times, until it does cull the stuff)/usr/share/BackupPC/bin/BackupPC_dump -v -f spiff_rsyncd;/usr/share/BackupPC/bin/BackupPC_nightly 0 255;/usr/share/BackupPC/bin/BackupPC_trashCleanThen restore your original settings————————————————————————————————————————————-****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************Understanding the Linux Kernel by Daniel P. Bovet & Marco Cesati (Oreilly) 3rd Edition——————————————————————————————————– SIGTTIN / SIGTTOUT / bg / fg operations- IPC- signals- semaphores [ semget() semop() ]- message queue [ <sys/msg.h> msgget() msgsnd() msgrcv() ]- shared memory (fastest) [ <sys/shm.h> shmget() shmat() – ipcs / ipcrm ]- memory mapped files (or anonymously mapped filed)- pipes [ popen() or pipe() ]- sockets – list_add- asm volatile (inline assembler)****************************************************************************************************************Jono on Pointers : Pointer Tips————————————int32 *pint;int32 p;header = malloc(sizeof(*header));if (header == NULL) {log_errorf(“Could not allocate memory in main()/n”);return -1;}if (my_struct) {memset(header, 0, sizeof(*header));printf(“&(header->x) = %d &(header->y) = %d /n”, (int32)&(header->x), (int32)&(header->y));memcpy(&(header->x), my_struct, 12);pint = (int32*)my_struct;printf(“Jono!!!!!! X = %d [%d]/n”, (int32)(*pint), (int32)pint);pint = (int32*)((int32)my_struct + 4); // works//pint = my_struct + 1; // this adds 22 bytes to pint!!//pint = 1 + (my_struct); // this adds 22 bytes to pint!!//p = (int32)my_struct; p += 4; pint = p; // works//pint += 1; // works//pint++; // worksprintf(“Jono!!!!!! Y = %d [%d]/n”, (int32)(*pint), (int32)pint);//memcpy(&(header->x), my_struct, 12); // Works//memcpy(&(header->x), my_struct, 4); // Works//memcpy(&(header->y), my_struct + 4, 4); // Won’t work//memcpy(&(header->z), my_struct + 8, 4); // Won’t workmemcpy(&(header->x), (void*)((int32)my_struct + 0), 4); // Worksmemcpy(&(header->y), (void*)((int32)my_struct + 4), 4); // Worksmemcpy(&(header->z), (void*)((int32)my_struct + 8), 4); // Worksheader->data_length = header->x * header->y;printf(“Creating Packet. X = %d, Y = %d, Z = %d, datalen = %d/n”, header->x, header->y, header->z, header->data_length);}****************************************************************************************************************fork—– // — here goes our fork code ============================================================================printf (“About to Start Child Process…/n”);signal(SIGCHLD, handle_finished_child_process); // or have done this at least once, somewhere elseparent_pid = getpid();child_pid = fork(); // The child is given 0, the parent gets the real child pidif (child_pid == 0) {// — Start Child Code ———————————-xxx// — End Child Code ———————————-exit(result); // Exit Child Process – All cool// End Child process}// — here goes our fork code ============================================================================****************************************************************************************************************Bit packing————-struct mystruct {unsigned int bit1:1;unsigned int bit2:1;unsigned int int4:4;};****************************************************************************************************************Function Attributes———————-See http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Function-Attributes.htmlhttp://www.ohse.de/uwe/articles/gcc-attributes.htmle.g. __attribute__ ((noinline)****************************************************************************************************************GLib Macros————–http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Macros.html——————-[Document End]——————-

FOX Related Links: ACMESystems :: YahooGroup :: CapeSoft

Search CapeFox.com: Powered by Google.

Jono's Linux Top Tips

相关文章:

你感兴趣的文章:

标签云: