23.7.08

How to strat and stop the some service in solaris

How to start and stop the services in solaris-10.

previous to solaris 10 we used to control the services using /etc/.init.d/ but soalris 10 provide svcadm to enable or disable service.

svcadm
Example to enable ftp serivce

#svcadm enable ftp

Check whether "ftp" service enable or not by using

#svcs -a | grep ftp
online 18:41:06 svc:/network/ftp:default

know your terminal

How to know through which terminal we connected to particular machine or present terminal type.

we have "who -a" commands which list the all the users presently logged in system. but how you will come to know with which terminal presently we connected.

let say the "who -a" output is:

. system boot Jun 30 19:51
. run-level 3 Jun 30 19:51 3 0 S
rc2 . Jun 30 19:54 old 89 id= s2 term=0 exit=0
rc3 . Jun 30 19:54 old 1750 id= s3 term=0 exit=0
LOGIN console Jun 30 19:54 1:53 2225 id= dt term=15 exit=0 (:0)
sac . Jun 30 19:54 old 2443 id= sc
root + console Jun 30 20:40 1:53 2444
sctpd . Jun 30 19:54 old 2447 id= US
start_DF + null Jun 30 19:54 . 2448
sufd_rc_ . Jun 30 19:54 old 2449 id=SUFD
zsmon . Jun 30 19:54 old 2503
.telnet /dev/pts/3 Jul 15 14:24 2349 id=t100 term=0 exit=0
root + pts/3 Jul 22 16:27 . 578 (10.143.64.25)
root pts/2 Jul 22 18:46 old 20139 id=ts/2 term=0 exit=0
.telnet /dev/pts/4 Jul 15 14:21 29587 id=tt/2 term=0 exit=0
.telnet /dev/pts/6 Jul 15 14:21 29594 id=tu/2 term=0 exit=0
root pts/4 Jul 22 18:46 old 5089 id=ts/4 term=0 exit=0

to know with which terminal we connected
use "tty" commnad.

#tty
/dev/pts/3



Use TTY commnad to know on wich terminal u are working now or what is ur terminal.

shared library comes with which package

How to know to which package the specified shared library belongs.

Sometimes it's required to know with which package particular shared library came.
There is a way to find this in solaris.

grep <> "/var/sadm/install/contents"


example to know with which package "libc.so" came

#grep libc.so /var/sadm/install/contents

Recursive grep in solaris

In solaris "grep" tool don't have option to grep the specified "pattern" recursively(not like linux) under current directory.
Generally "grep" tool grep the pattern in current directory only.

Workaround for this is:
Have to use "find" command to get the all the files and "piped" this data to grep command.
#find . -type f | xargs grep "pattern"

How to add User in Soalris ( Unix)

Adding user in solaris

useradd -d -m -s username.

Here adding user name called "raj", having home directory "/export/home/raj" and shell as "sh"
# useradd -d /export/home/raj -m -s /bin/sh raj