Wednesday, June 26, 2013

Linux - Starting a process at background

In order to start a Linux process on the background, just put & at the end of the command

For example, to run a sleep command at the background, you do the following

sleep 10000 &

The above will sleep for 10s at the background.

When this command being executed, it will return a PID for the background process.

So, to kill the background process, you can use kill command to kill the background process

kill -09 XXXX

where XXXX is the PID returned for the background process.

Below is a detail screenshot.


Thursday, June 20, 2013

Lotus Notes - Utility to Manually Run Mail Rule

Lotus Notes does not come with a Widget that allow you to run mail rules manually. In order to do so, you will need to install the following Widget which is nicely done by Bob Balfe

1. Download the Utility here

2. It is a zip file. So, after downloading it, unzip it to a folder. This post assume that you will unzip to it default folder MailUtilities-8.5.2.201010150920

3. Now, download the extension.xml here

4. After downloading extension.xml, copy your extension.xml to MailUtilities-8.5.2.201010150920\site\mail-rules-site for good practice.

5. Open your Lotus Notes, open up the Widget pane on your right


6. Drag extension.xml at MailUtilities-8.5.2.201010150920\site\mail-rules-site to your Widget pane.

7. A warning will be prompted. Select "Install this plugin" and click Ok



8. After installing, Lotus Notes will prompt you to restart your client. Alternatively, you can restart your client manually.



9. After restart, you will see Run Mail utility at your menu bar.





Reference:

Tuesday, June 18, 2013

Linux - Cifs "mount error 13 = Permission denied"

If you see the following error

mount error 13 = Permission denied Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

It simply means that mount command cannot access your network drive based on your given credential.

To solve the issue, use the following command

mount -o user=DOMAIN/USER_ID -t cifs "//Windows/share" "/Linux/share"


Friday, June 14, 2013

Cygwin - Setting up environment path in .profile for ksh

ksh provide a .profile file for personalizing your startup environment. Very often, you will use this to setup your personal Unix environment.

In Linux/Unix environment, you can set up environment variables by using export function

export YOUR_ENVIRONMENT_PATH="/root/to/your/path\"

In Windows environment, you will most likely use cygwin as your linux like environment. If you uses cygwin, you should have realized that there is a different on your path format

Windows - C:\Users\XXX
Cygwin - /cygdrive/c/Users/XXX

Thus, you need to handle the conversion of Windows form of path to Unix form of path

In this post, I will provide a .profile setting that setup some cygwin environment variables and start up bash shell with your ksh environment.

Below is the setting in .profile

#Setting up environment path
export YOUR_ENV_PATH="$(cygpath -u "c:\\Users\\XXX")"
#enable your bash environment
bash

cygwin provide a function call cygpath that helps to convert Windows form of path to Unix form of path

cygpath -u "c:\\Users\\XXX" convert "c:\\Users\\XXX" to /cygdrive/c/Users/XXX

Next, please note that your should only change to bash environment after setting up your path

If you enable your bash environment before exporting your path, your environmental path will NOT be set.

References:
http://cygwin.com/cygwin-ug-net/using-utils.html#cygpath

Thursday, June 13, 2013

ksh - .profile and bash

If you know that your ksh support bash and you prefer bash comparing to vi or emacs editior setting, you can enable your bash in ksh by typing bash in your shell interface







Above is an example to enabling bash in ksh. 

Comparing to vi or emacs editor mode, bash has the default functions such as tab-completion, up history and down history. 

If you prefer to use vi or emacs editor mode, see http://thompsonng.blogspot.sg/2013/06/ksh-vi-tab-completion.html

In ksh, your person setting will be store in .profile under your home directory.

You can use the following setting to go to your home directory and open .profile via vi editor


In your .profile, add the following to load bash when your ksh startup



Wednesday, June 5, 2013

ksh - VI tab completion

If you are used to bash shell in Linux, you will use tab completion very often. Tab completion basically is a in-build bash script that will complete your current command, file path, etc... when you press one the tab key on the keyboard.

ksh (Korn Shell) is a Unix shell and does not come with tab completion by default.

If you want to use tab completion, you can use the following command at the ksh prompt

For VI editor mode, do the following

1. set -o vi
2. set -o vi-tabcomplete

For EMACS editor mode, do the following

1. set -o emacs
2. bind ^I=complete

In addition, if you want to have complete listing, you can bind another key with the following

bind ^I=complete-list 

or use the default binding

bind ^X^Y=list-file

to list file

^ is Ctrl key on the keyboard. So, ^I is bind to tab key by default. Or, you can press and hold Ctrl then press I for the same effect.


Sed - Example guide

sed is a very useful stream editor to perform search and replace. Below are some useful tip 1. Usage sed 's/apple/orange/' file...