Tuesday, March 25, 2008

Using tab in vi, vim

The new version of vi and vim supports tab function. Make sure your vi and vim version is 7.0 and above to do this. To open new tab, run :tabnew or :tabe in normal mode. T open a file in new tab, use :tabnew filename or :tabe filename. To move between tab, use ctrl+pgup and ctrl+pgdown. You can also use gt to and gT to move between tabs. To move to specific tab number use igt where i is the tab number

Picture shows tabs in vi

Monday, March 24, 2008

Boosting openoffice's performance

Some of you people out there that just started using OpenOffice(OO) complaints that this office suite is a bit slow and not suitable for old and low end computers. Here are a few tips on boosting your OO performance.
  1. Disable java environment
    • Tools -> Options -> OpenOffice.org -> java
    • Uncheck 'Use a java runtime environment'
  2. Add memory capacity of OO
    • Tools -> Options -> OpenOffice.org -> Memory
    • Under 'Graphics Cache', increase the 'Use for OpenOffice.org' memory. Increase accordingly depending on your system physical memory. For example, you can put it to 128 MB if your physical memory is 512MB
    • Increase also the 'Memory for object' value
    • For easier start of OO application, check the 'enable systray Quickstarter'. It will put one shortcut for all OO application at the right hand corner of your desktop

Wednesday, March 19, 2008

MAMPU of Malaysia migrates to openoffice

MAMPU, the Malaysian Administrative Modernisation and Management Planning Unit, will start adopting the Open Document Format (ODF) starting from 1st April 2008. They are also planning to use uninstall Microsoft Office suite from their computers by the end of this year. The main objective is to reduce cost in obtaining the proprietary software such as Microsoft Office.
The migration process will be assisted by Malaysian Government Open Source Competency Centre(OSCC) in the form of training all the staffs and new users of OpenOffice to smoothen the migration. This is a great news for the open source community. For further details, refer here

Tuesday, March 11, 2008

Redirecting stdout and stderr

Typing commands in shell will result in two output streams namely stdout and stderr. Stdout is the normal output stream while stderr is the output stream for error. For example, if you type the below command,

# ls /usr/ /user
ls: cannot access /user: No such file or directory
/usr/:
bin games java lib local share tmp
etc include kerberos libexec sbin src

The blue line is the stderr and the green lines are the stdout. By default, all output will be directed to the screen, but you can redirect both stdout and stderr to a file.
To redirect stdout to a file named /tmp/stdout and display the stderr to the screen:

# ls /usr /user > /tmp/stdout
ls: cannot access /user: No such file or directory

To redirect stderr to a file named /tmp/stderr and display stdout to the screen:

# ls /usr /user 2> /tmp/stderr
/usr:
bin games java lib local share tmp
etc include kerberos libexec sbin src

To redirect both to the file named /tmp/all:

# ls /usr /user > /tmp/all 2>&1

or

# ls /usr /user &> /tmp/all

To append the stderr and stdout to a file, simply:

# ls /usr /user >> /tmp/all 2>&1

To both redirect and display the stderr and stdout, use tee:

# ls /usr /user 2>&1 | tee /tmp/all
ls: cannot access /user: No such file or directory
/usr:
bin
etc
games
include
java
kerberos
lib
libexec
local
sbin
share
src
tmp

Instead of redirecting to a file or display, you can also redirect them to other command. For example, if you want to email your stderr and stdout to root user of the local machine(Make sure your mta service is on, if not the message will not be delivered):

# ls /usr /user 2>&1 | mail root@localhost

If you do not want to see any error display, just redirect the stderr to /dev/null

# ls /user 2> /dev/null

Tuesday, March 4, 2008

Getting help in linux

To remember every commands in linux is a very tough job. Even experienced user cannot boast that they have remembered every single command. To get help about commands in linux, a few commands can be used.

  1. # man command
    • format and display manual pages for commands
  2. # info command
    • information document about commands
  3. # command --help
    • help on commands
  4. # whatis command
    • search the whatis database for complete words
  5. # apropos string
    • search the whatis database for strings
  6. # man -k string
    • search manual pages for strings. similar to apropos
You have to change 'strings' to your desired strings and 'command' to your desired command