| Julien Rioux | Sipe's Group | Quantum Optics | Department of Physics | University of Toronto |

Linux Tips

| awk | cluster | make | root | back

Awk quick tips

A few things learned while using awk.

  1. Massage files from a n-column format into an one-column format:
    • awk '{ for(i=1;i<=NF;i++) print $i }'
  2. Inverse the z coordinates in a list of points:
    • awk '{ printf " % 9.8F % 9.8F % 9.8F\n", $1, $2, -$3 }'
  3. Rescaling columns two and three of a data file by 1/2:
    • awk '{ printf " % 8.7E % 8.7E % 8.7E\n", $1, $2/2, $3/2 }'
  4. Substracting columns two and three from different data files, skipping empty lines and comments (#):
    • awk '{c2=$2; c3=$3; getline<f} NF>0 && $1!="#" {$2-=c2; $3-=c3} 1' f=file1 file2

Internal variables.

Cluster management tips

Getting the list of installed packages.

Reproducing the list of installed packages on the target machine (omitting i386 packages).

Make internal macros

For quick reference.

Advanced features.

Changing root's password

Changing the password for root using GRUB bootloader.

  1. Restart, wait for GRUB boot loader to load
  2. Select Kernel, type, "e" for edit
  3. Select the kernel line, type "e" to edit
  4. Add "single" at end of line, type Enter
  5. Type "b" to boot
  6. After boot, enter "password root" at command prompt
  7. Enter new password for root
  8. Reboot (can type "shutdown -r now")