Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Thursday, March 30, 2006

shell tip: which shell you currently using

how do you tell which shell you currently using?

just use:
$ echo $0
-ksh
$ bash
$ echo $0
bash
$ csh
% echo $0
csh
% zsh
% echo $0
zsh

Wednesday, March 29, 2006

shell tip: setting environment variables

below is the compilation on how to set environment variables for different shells

sh, ash, bsh, ksh, zsh, bash & bash2:
to set use - export TEST=test123
to unset use - unset TEST

csh, zsh & tcsh:
to set use - setenv TEST test123
to unset use - unsetenv TEST

is there any other shell out there?

Friday, March 03, 2006

unix tip: ksh hotkeys vs bash hotkeys

a few of our servers are running ksh shell instead of bash. sometimes i have
problems handling ksh hotkeys because getting used to bash hotkeys like below:

bash hotkeys:
ctrl-l -- clear screen
ctrl-r -- does a search in the previously given commands so that
you dont have to repeat long command.
ctrl-u -- clears the typing before the hotkey.
ctrl-a -- takes you to the begining of the command you are
currently typing.
ctrl-e -- takes you to the end of the command you are currently
typing in.
esc-b -- takes you back by one word while typing a command.
ctrl-c -- kills the current command or process.
ctrl-d -- kills the shell.
ctrl-h -- deletes one letter at a time from the command you are
typing in.
ctrl-z -- puts the currently running process in background, the
process can be brought back to run state by using fg
command.
esc-p -- like ctrl-r lets you search through the previously
given commands.
esc-. -- gives the last command you typed.
tab -- auto completion
Read more...

below are the hotkeys when i'm using ksh shell (you have to
set -o vi first)

ksh hotkeys:
esc-\ -- auto completion. only work if the file/command is in
current directory
esc-k -- scroll up
esc-j -- scroll down
esc-/ -- search in the previously given commands (esc-/ keyin
the command you want search & enter. press n or N to
go to the next or previous command, even ctrl-r in bash
can't go to the next or previous command or maybe i just
don't know how.
esc-= -- filename check - this is cool!!!


since its using vi mode, you can also edit the commands
using below keys
esc-l -- forward one character
esc-h -- backward one character
esc-x -- delete one character
esc-r -- replace one character
esc-e -- forward end of word
esc-b -- backward beginning of word
esc-d -- delete to end of line
esc-i -- insert text (current space)
esc-a -- insert text (adjacent space)
esc-^ -- move cursor to beginning of line
esc-$ -- move cursor to end of line

note:
esc key is not necessary if you are currently in command-mode