Thursday, July 31, 2008
System configuration in solaris
To filter Details you can use grep
ex:
/usr/sbin/prtconf | grep Memory
Monday, June 16, 2008
od - dump files in octal and other formats
NAME
od - dump files in octal and other formatsSYNOPSIS
od [OPTION]... [FILE]...od --traditional [FILE] [[+]OFFSET [[+]LABEL]]
DESCRIPTION
Write an unambiguous representation, octal bytes by default, of FILE to standard output. With more than one FILE argument, concatenate them in the listed order to form the input. With no FILE, or when FILE is -, read standard input.
All arguments to long options are mandatory for short options.
- -A, --address-radix=RADIX
- decide how file offsets are printed
- -j, --skip-bytes=BYTES
- skip BYTES input bytes first
- -N, --read-bytes=BYTES
- limit dump to BYTES input bytes
- -s, --strings[=BYTES]
- output strings of at least BYTES graphic chars
- -t, --format=TYPE
- select output format or formats
- -v, --output-duplicates
- do not use * to mark line suppression
- -w, --width[=BYTES]
- output BYTES bytes per output line
- --traditional
- accept arguments in traditional form
- --help
- display this help and exit
- --version
- output version information and exit
Traditional format specifications may be intermixed; they accumulate:
- -a
- same as -t a, select named characters
- -b
- same as -t oC, select octal bytes
- -c
- same as -t c, select ASCII characters or backslash escapes
- -d
- same as -t u2, select unsigned decimal shorts
- -f
- same as -t fF, select floats
- -h
- same as -t x2, select hexadecimal shorts
- -i
- same as -t d2, select decimal shorts
- -l
- same as -t d4, select decimal longs
- -o
- same as -t o2, select octal shorts
- -x
- same as -t x2, select hexadecimal shorts
For older syntax (second call format), OFFSET means -j OFFSET. LABEL is the pseudo-address at first byte printed, incremented when dump is progressing. For OFFSET and LABEL, a 0x or 0X prefix indicates hexadecimal, suffixes may be . for octal and b for multiply by 512.
TYPE is made up of one or more of these specifications:
- a
- named character
- c
- ASCII character or backslash escape
- d[SIZE]
- signed decimal, SIZE bytes per integer
- f[SIZE]
- floating point, SIZE bytes per integer
- o[SIZE]
- octal, SIZE bytes per integer
- u[SIZE]
- unsigned decimal, SIZE bytes per integer
- x[SIZE]
- hexadecimal, SIZE bytes per integer
SIZE is a number. For TYPE in doux, SIZE may also be C for sizeof(char), S for sizeof(short), I for sizeof(int) or L for sizeof(long). If TYPE is f, SIZE may also be F for sizeof(float), D for sizeof(double) or L for sizeof(long double).
RADIX is d for decimal, o for octal, x for hexadecimal or n for none. BYTES is hexadecimal with 0x or 0X prefix, it is multiplied by 512 with b suffix, by 1024 with k and by 1048576 with m. Adding a z suffix to any type adds a display of printable characters to the end of each line of output. --string without a number implies 3. --width without a number implies 32. By default, od uses -A o -t d2 -w 16.
Wednesday, May 28, 2008
STOPPED JOBS and job control...
When you try to exit a window or logout, you may get a message:
There are stopped jobs.
This means that a program you were running has been suspended (usually by
typing Ctrl-Z) and has not been properly terminated. If you just try to exit
again, the system will automatically terminate those jobs. If you want to see
what those jobs are, use the 'jobs' command. Just type:
jobs
You will see a listing, which may look like this:
[1] - Stopped foo
[2] + Stopped bar
If you want to continue using one of the jobs in the list, use the 'fg'
command. For example, if you wanted to continue using 'foo' in the above
listing, type this:
fg %1
Actually, the 'fg' part is optional. So, you could just type:
%1
...and get the same effect. If instead you want to just terminate a job, use
the 'kill' command. For example, if you wanted to kill 'bar' in the above
listing, type this:
kill %2
The information below describes jobs in much more detail, if you're
interested.
The shell associates a job with each pipeline (most often a single
command/program) It keeps a table of current jobs, printed by the "jobs"
command, and assigns them small integer numbers. When a job is started
asynchronously with '&' (started in the background), the shell prints a line
which looks like:
[1] 1234
indicating that the job that was started asynchronously was job number 1 and
had one (top-level) process, whose process ID number was 1234.
If you are running a job and wish to do something else, you may type Ctrl-Z,
which sends a STOP signal to the current job. The shell will then normally
indicate that the job has been 'Stopped', and print another prompt. You can
then manipulate the state of this job, putting it in the background with the
'bg' command, or run some other commands and then eventually bring the job
back into the foreground with the foreground command 'fg'. A Ctrl-Z takes
effect immediately and is like an interrupt in that pending output and unread
input are discarded when it is typed. There is another special key, Ctrl-Y,
which does not generate a STOP signal until a program attempts to read(2) it.
This can be typed ahead when you have prepared some commands for a job which
you wish to stop after it has read them.
A job being run in the background will stop if it tries to read from the
terminal. Background jobs are normally allowed to produce output, but this
can be disabled by giving the command 'stty tostop'. If you set this tty
option, then background jobs will stop when they try to produce output like
they do when they try to read input.
There are several ways to refer to jobs in the shell. The character '%'
introduces a job name. If you wish to refer to job number 1, you can name it
as '%1'. Just naming a job brings it to the foreground; thus '%1' is a
synonym for 'fg %1', bringing job 1 back into the foreground. Similarly
saying '%1 &' resumes job 1 in the background. Jobs can also be named by
prefixes of the string typed in to start them, if these prefixes are
unambiguous, thus '%ex' would normally restart a suspended ex(1) job, if there
were only one suspended job whose name began with the string 'ex'. It is also
possible to say '%?string' which specifies a job whose text contains string,
if there is only one such job.
The shell maintains a notion of the current and previous jobs. In output
pertaining to jobs, the current job is marked with a '+' and the previous job
with a '-'. The abbreviation '%+' refers to the current job and '%-' refers
to the previous job. For close analogy with the syntax of the history
mechanism, '%%' is also a synonym for the current job.
Friday, May 09, 2008
cron job details...
>>> crontab -l
To add a new Cron job for a user u can use the command...
>>>> crontab -e
While adding one job to the crontab u have to follow following format...
Syntax of crontab
Your cron job looks like as follows:
1 2 3 4 5 /path/to/command arg1 arg2
Where,
- 1: Minute (0-59)
- 2: Hours (0-23)
- 3: Day (0-31)
- 4: Month (0-12 [12 == December])
- 5: Day of the week(0-7 [7 or 0 == sunday])
- /path/to/command - Script or command name to schedule
Same above five fields structure can be easily remembered with following diagram:
* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
Use of operators
An operator allows you to specifying multiple values in a field. There are three operators:
- The asterisk (*) : This operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to every hour or an asterisk in the month field would be equivalent to every month.
- The comma (,) : This operator specifies a list of values, for example: "1,5,10,15,20, 25".
- The dash (-) : This operator specifies a range of values, for example: "5-15" days , which is equivalent to typing "5,6,7,8,9,....,13,14,15" using the comma operator.
one example :
55 00 * * * env OMC_TOP=/usr/omc /usr/omc/sbin/maintain_script -r -d 7 /usr/omc/logs gpomcaudit\* #MOMC42 parser audit files +7 days
Thursday, March 27, 2008
Handling of signals in Shell scripting..
The command arg is to be read and executed when the shell receives signal(s) sigspec। If arg is absent or -, all specified signals are reset to their original values (the values they had upon entrance to the shell)।
If arg is the null string the signal specified by each sigspec is ignored by the shell and by the commands it invokes।
If arg is not present and -p has been supplied, then the trap commands associated with each sigspec are displayed।
If no arguments are supplied or if only -p is given, trap prints the list of commands associated with each signal number।
Each sigspec is either a signal name defined in <signal.h>, or a signal number।
If a sigspec is EXIT (0) the command arg is executed on exit from the shell। If a
sigspec is DEBUG, the command arg is executed after every simple command (see SHELL GRAMMAR above)।
If a sigspec is ERR, the command arg is executed whenever a simple command has a non-zero exit status।
The ERR trap is not executed if the failed command is part of an until or while loop, part of an if statement, part of a && or || list, or if the command's return value is being inverted via !. The -l option causes the shell to print a list of signal names and their corresponding numbers। Signals ignored upon entry to the shell cannot be trapped or reset। Trapped signals are reset to their original values in a child process when it is created। The return status is false if any sigspec is invalid; otherwise trap returns true.
Wednesday, March 19, 2008
waitpid()
waitpid - wait for process termination
Headers:
#include
#include
DESCRIPTION
The waitpid function suspends execution of the current
process until a child as specified by the pid argument has
exited, or until a signal is delivered whose action is to
terminate the current process or to call a signal handling
function. If a child as requested by pid has already
exited by the time of the call (a so-called "zombie" pro-
cess), the function returns immediately. Any system
resources used by the child are freed.
The value of pid can be one of:
< -1 which means to wait for any child process whose
process group ID is equal to the absolute value of
-1 which means to wait for any child process; this is
the same behaviour which wait exhibits.
0 which means to wait for any child process whose
process group ID is equal to that of the calling
process.
> 0 which means to wait for the child whose process ID
is equal to the value of pid.
The value of options is an exclusive OR of zero or more of
the following constants:
WNOHANG which means to return immediately if no child has
exited.
WUNTRACED
which means to also return for children which are
If status is not NULL, wait or waitpid store status infor-
mation in the location pointed to by statloc.
This status can be evaluated with the following macros
(these macros take the stat buffer as an argument -- not a
pointer to the buffer!):
WIFEXITED(status)
is non -zero if the child exited normally.
WEXITSTATUS(status)
evaluates to the least significant eight bits of
the return code of the child which terminated,
which may have been set as the argument to a call
to exit() or as the argument for a return state-
ment in the main program. This macro can only be
evaluated if WIFEXITED returned non-zero.
WIFSIGNALED(status)
returns true if the child process exited because
of a signal which was not caught.
WTERMSIG(status)
returns the number of the signal that caused the
child process to terminate. This macro can only be
evaluated if WIFSIGNALED returned non-zero.
WIFSTOPPED(status)
returns true if the child process which caused the
return is currently stopped; this is only possible
if the call was done using WUNTRACED.
WSTOPSIG(status)
returns the number of the signal which caused the
child to stop. This macro can only be evaluated
if WIFSTOPPED returned non-zero.
stopped, and whose status has not been reported.
signal management 1 in linux/+
#include <signal.h>
int sighold(int sig);
int sigignore(int sig);
int sigpause(int sig);
int sigrelse(int sig);
void (*sigset(int sig, void (*disp)(int)))(int);
Description :
The sighold(), sigignore(), sigpause(), sigrelse(), and sigset() functions provide simplified signal management.
The sigset() function shall modify signal dispositions. The sig argument specifies the signal, which may be any signal except SIGKILL and SIGSTOP. The disp argument specifies the signal's disposition, which may be SIG_DFL, SIG_IGN, or the address of a signal handler. If sigset() is used, and disp is the address of a signal handler, the system shall add sig to the calling process' signal mask before executing the signal handler; when the signal handler returns, the system shall restore the calling process' signal mask to its state prior to the delivery of the signal. In addition, if sigset() is used, and disp is equal to SIG_HOLD, sig shall be added to the calling process' signal mask and sig's disposition shall remain unchanged. If sigset() is used, and disp is not equal to SIG_HOLD, sig shall be removed from the calling process' signal mask.
The sighold() function shall add sig to the calling process' signal mask.
The sigrelse() function shall remove sig from the calling process' signal mask.
The sigignore() function shall set the disposition of sig to SIG_IGN.
The sigpause() function shall remove sig from the calling process' signal mask and suspend the calling process until a signal is received. The sigpause() function shall restore the process' signal mask to its original state before returning.
If the action for the SIGCHLD signal is set to SIG_IGN, child processes of the calling processes shall not be transformed into zombie processes when they terminate. If the calling process subsequently waits for its children, and the process has no unwaited-for children that were transformed into zombie processes, it shall block until all of its children terminate, and wait(), waitid(), and waitpid() shall fail and set errno to [ECHILD].
RETURN VALUE
pon successful completion, sigset() shall return SIG_HOLD if the signal had been blocked and the signal's previous disposition if it had not been blocked. Otherwise, SIG_ERR shall be returned and errno set to indicate the error.The sigpause() function shall suspend execution of the thread until a signal is received, whereupon it shall return -1 and set errno to [EINTR].
For all other functions, upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and errno set to indicate the error.
FAILING CONDITIONS :
These functions shall fail if:
- The sig argument is an illegal signal number.
- An attempt is made to catch a signal that cannot be caught, or to ignore a signal that cannot be ignored.
Xtem Syntax
Terminal emulator for X-windows Terminal
xterm [-toolkitoption ...] [-option]
| -help | This causes xterm to print out a verbose message describing its options. |
| -132 | Normally, the VT102 DECCOLM escape sequence that switches between 80 and 132 column mode is ignored. This option causes the DECCOLM escape sequence to be recognized, and the xterm window will resize appropriately. |
| -ah | This option indicates that xterm should always highlight the text cursor. By default, xterm will display a hollow text cursor whenever the focus is lost or the pointer leaves the window. |
| +ah | This option indicates that xterm should do text cursor highlighting based on focus. |
| -b number | This option specifies the size of the inner border (the distance between the outer edge of the characters and the window border) in pixels. The default is 2. |
| -cb | Set the vt100 resource cutToBeginningOfLine to FALSE. |
| +cb | Set the vt100 resource cutToBeginningOfLine to TRUE. |
| -cc | This sets classes indicated by the given ranges for using in selecting by words. See the section specifying character classes. |
| -cn | This option indicates that newlines should not be cut in line-mode selections. |
| +cn | This option indicates that newlines should be cut in line-mode selections. |
| -cr color | This option specifies the color to use for text cursor. The default is to use the same foreground color that is used for text. |
| -cu | This option indicates that xterm should work around a bug in the more program that causes it to incorrectly display lines that are exactly the width of the window and are followed by a line beginning with a tab (the leading tabs are not displayed). This option is so named because it was originally thought to be a bug in the curses(3x) cursor motion package. |
| +cu | This option indicates that xterm should not work around the more(3x) bug mentioned above. |
| -e program [arguments] | This option specifies the program (and its command line arguments) to be run in the xterm window. It also sets the window title and icon name to be the basename of the program being executed if neither -T nor -n are given on the command line. This must be the last option on the command line. |
| -fb font | This option specifies a font to be used when displaying bold text. This font must be the same height and width as the normal font. If only one of the normal or bold fonts is specified, it will be used as the normal font and the bold font will be produced by overstriking this font. The default is to do overstriking of the normal font. |
| -im | Turn on the useInsertMode resource. |
| +im | Turn off the useInsertMode resource. |
| -j | This option indicates that xterm should do jump scrolling. Normally, text is scrolled one line at a time; this option allows xterm to move multiple lines at a time so that it doesn't fall as far behind. Its use is strongly recommended since it make xterm much faster when scanning through large amounts of text. The VT100 escape sequences for enabling and disabling smooth scroll as well as the ``VT Options'' menu can be used to turn this feature on or off. |
| +j | This option indicates that xterm should not do jump scrolling. |
| -ls | This option indicates that the shell that is started in the xterm window will be a login shell (i.e., the first character of argv[0] will be a dash, indicating to the shell that it should read the user's .login or .profile). |
| +ls | This option indicates that the shell that is started should not be a login shell (i.e. it will be a normal ``subshell''). |
| -mb | This option indicates that xterm should ring a margin bell when the user types near the right end of a line. This option can be turned on and off from the ``VT Options'' menu. |
| +mb | This option indicates that margin bell should not be rung. |
| -mc milliseconds | This option specifies the maximum time between multi-click selections. |
| -ms color | This option specifies the color to be used for the pointer cursor. The default is to use the foreground color. |
| -nb number | This option specifies the number of characters from the right end of a line at which the margin bell, if enabled, will ring. The default is 10. |
| -rw | This option indicates that reverse-wraparound should be allowed. This allows the cursor to backup from the leftmost column of one line to the rightmost column of the previous line. This is very useful for editing long shell command lines and is encouraged. This option can be turned on and off from the ``VT Options'' menu. |
| +rw | This option indicates that reverse-wraparound should not be allowed. |
| -aw | This option indicates that auto-wraparound should be allowed. This allows the cursor to automatically wrap to the beginning of the next line when when it is at the rightmost position of a line and text is output. |
| +aw | This option indicates that auto-wraparound should not be allowed. |
| -s | This option indicates that xterm may scroll asynchronously, meaning that the screen does not have to be kept completely up to date while scrolling. This allows xterm to run faster when network latencies are very high and is typically useful when running across a very large Internet or many gateways. |
| +s | This option indicates that xterm should scroll synchronously. |
| -sb | This option indicates that some number of lines that are scrolled off the top of the window should be saved and that a scrollbar should be displayed so that those lines can be viewed. This option may be turned on and off from the ``VT Options'' menu. |
| +sb | This option indicates that a scrollbar should not be displayed. |
| -sf | This option indicates that Sun Function Key escape codes should be generated for function keys. |
| +sf | This option indicates that the standard escape codes should be generated for function keys. |
| -si | This option indicates that output to a window should not automatically reposition the screen to the bottom of the scrolling region. This option can be turned on and off from the ``VT Options'' menu. |
| +si | This option indicates that output to a window should cause it to scroll to the bottom. |
| -sk | This option indicates that pressing a key while using the scrollbar to review previous lines of text should cause the window to be repositioned automatically in the normal position at the bottom of the scroll region. |
| +sk | This option indicates that pressing a key while using the scrollbar should not cause the window to be repositioned. |
| -sl number | This option specifies the number of lines to save that have been scrolled off the top of the screen. The default is 64. |
| -t | This option indicates that xterm should start in Tektronix mode, rather than in VT102 mode. Switching between the two windows is done using the ``Options'' menus. |
| +t | This option indicates that xterm should start in VT102 mode. |
| -tm string | This option specifies a series of terminal setting keywords followed by the characters that should be bound to those functions, similar to the stty program. Allowable keywords include: intr, quit, erase, kill, eof, eol, swtch, start, stop, brk, susp, dsusp, rprnt, flush, weras, and lnext. Cotrol characters may be specified as ^char (e.g. ^c or ^u) and ^? may be used to indicate delete. |
| -tn name | This option specifies the name of the terminal type to be set in the TERM environment variable. This terminal type must exist in the termcap database and should have li# and co# entries. |
| -ut | This option indicates that xterm shouldn't write a record into the the system log file /etc/utmp. |
| +ut | This option indicates that xterm should write a record into the system log file /etc/utmp. |
| -vb | This option indicates that a visual bell is preferred over an audible one. Instead of ringing the terminal bell whenever a Control-G is received, the window will be flashed. |
| +vb | This option indicates that a visual bell should not be used. |
| -wf | This option indicates that xterm should wait for the window to be mapped the first time before starting the subprocess so that the initial terminal size settings and environment variables are correct. It is the application's responsibility to catch subsequent terminal size changes. |
| +wf | This option indicates that xterm show not wait before starting the subprocess. |
| -C | This option indicates that this window should receive console output. This is not supported on all systems. To obtain console output, you must be the owner of the console device, and you must have read and write permission for it. If you are running X under xdm on the console screen you may need to have the session startup and reset programs explicitly change the ownership of the console device in order to get this option to work. |
| Sccn | This option specifies the last two letters of the name of a pseudoterminal to use in slave mode, plus the number of the inherited file descriptor. The option is parsed ``%c%c%d''. This allows xterm to be used as an input and output channel for an existing program and is sometimes used in specialized applications. |
| %geom | This option specifies the preferred size and position of the Tektronix window. It is shorthand for specifying the ``*tekGeometry'' resource. |
| #geom | This option specifies the preferred position of the icon window. It is shorthand for specifying the ``*iconGeometry'' resource. |
| -T string | This option specifies the title for xterm's windows. It is equivalent to -title. |
| -n string | This option specifies the icon name for xterm's windows. It is shorthand for specifying the ``*icon- Name'' resource. Note that this is not the same as the toolkit option -name (see below). The default icon name is the application name. |
| -r | This option indicates that reverse video should be simulated by swapping the foreground and background colors. It is equivalent to -rv. |
| -w number | This option specifies the width in pixels of the border surrounding the window. It is equivalent to -borderwidth or -bw. |
| -bg color | This option specifies the color to use for the background of the window. The default is ``white.'' |
| -bd color | This option specifies the color to use for the border of the window. The default is ``black.'' |
| -bw color | This option specifies the width in pixels of the border surrounding the window. |
| -fg color | This option specifies the color to use for displaying text. The default is ``black.'' |
| -fn color | This option specifies the font to be used for displaying normal text. The default is fixed. |
| -fn font | This option specifies the font to be used for displaying normal text. The default is fixed. |
| -name name | This option specifies the application name under which resources are to be obtained, rather than the default executable file name. Name should not contain ``.'' or ``*'' characters. |
| -title string | This option specifies the window title string, which may be displayed by window managers if the user so chooses. The default title is the command line specified after the -e option, if any, otherwise the application name. |
| -rv | This option indicates that reverse video should be simulated by swapping the foreground and background colors. |
| -geometry geometry | This option specifies the preferred size and position of the VT102 window; see X(1). |
| -display display | This option specifies the X server to contact; see X. |
| -xrm resourcestring | This option specifies a resource string to be used. This is especially useful for setting resources that do not have separate command line options. |
| -iconic | This option indicates that xterm should ask the window manager to start it as an icon rather than as the normal window. |
| -dc | This option disables the escape sequence to change the vt100 foreground and background colors, the text cursor color, the mouse cursor foreground and background colors and the Tektronix emulator foreground and background colors. |
| +dc | This option enables the escape sequence to change the vt100 foreground and background colors, the text cursor color, the mouse cursor foreground and background colors and the Tektronix emulator foreground and background |
xterm - runs the X terminal (if supported).
Monday, March 17, 2008
Find the Free Physical Memory in Linux/+
free -m
in Solaries :
prtconf | awk'/^Memory/{print}'
(or)
prtconf | grep Memory