Wednesday, May 16, 2012

How to compress/decompress different file types in AIX

  • .tar.Z file format
    • 壓縮
      • # compress filename.tar
    • 解壓 
      • # zcat filename.tar.Z | tar -xvf -
  • .tar.gz file format
    • 壓縮
      • # tar cvf - folder | gzip > filename.tar.gz
    • 解壓
      • # gunzip -c filename.tar.gz | tar -xvf -
  • .gz file format
    • 解壓
      • # gzip -d filename.gz
    • 壓縮
      • # gzip -v filename
  • .tgz file format
    • 解壓
      • # gzip -d filename.tgz | tar -xvf -
  • .zip file format
    • 解壓
      • # unzip

Sunday, April 22, 2012

How to cut/copy and paste in vi

1. use v to select the words/sentences you want.
2. use d to cut/ y to copy
3. move the input point to the area you want. Then press p to paste the cut/copy data.

ps: v > d/y > p

Thursday, April 12, 2012

How to mount usb flash disk in Linux?

We have to mount a usb flash disk first if we want to use it in Linux command line mode. So the procedure will be:
  1. Find out the device id.
  2. Mount it and use it.
  3. Un-mount it when you when to unplug it.
Here are the detailed procedures:
  1. Some commands can be used here:
    • Use "cat /proc/scsi/scsi" to check to scsi devices in your system.
    • Use "rescan-scsi-bus -l" to let system rescan attached devices. (The command can be used after install "scsitools")
    • Use "dmesg" to show the flash driver ID. ("dmesg | grpe sd")

  2. Use "mount" to mount the usb flash driver to a specific folder. Use -t to specify the file system type.
    example: mount -t vfat /dev/sdb1 /mnt/usb
    mount /dev/sdb1 to /mnt/usb and indicate its file system type is vfat.
  3. umount /mnt/usb

Wednesday, April 11, 2012

How to determind the network speed?

  • netstat -v | grep Speed

How to check CPU info and speed in AIX?

  1. lscfg
    Displays configuration, diagnostic, and vital product data (VPD) information about the system including CPU information:
  2. lsattr -E -l proc0 | grep "Processor Speed"
    returns the processor speed in hertz (Hz)
  3. pmcyclespmcycles command lists the processor speed

Thursday, April 5, 2012

How to find/use different commands in unix/linux?

In unix/linux, there are many commands can use. For example, we can use gnu make and/or system default make. The following are the location of two make commands.

location of system default make:
location of gnu make:

But how to specify which command we want to use?

  • Specify the path in the PATH variable, the first appear path will be use in the system. for example, PATH=/usr/bin:/opt/freeware/bin. It indicates that if we use make, system will use the default make.
  • to specify which command we are using currently. use which.
    which make
  • to override existing setting. export PATH=/opt/freeware/bin:$PATH

Monday, April 2, 2012

How to change shell in AIX?

  1. install new shell from rpm
    rpm --install bash-3.0-1.aix5.1.ppc.rpm
    ps. the file can be downloaded from IBM's website
  2. chsh, then indicate the new shell's location.
    ps. if the list doesn't contain bash, try to add bash in /etc/security/login.cfg
  3. re-login