More solaris commands

These commands are taken from various sources and are quite helpful for day to day work on solaris.

For find n grep

grep -i m_forwardingProxy `find . -name \\*cpp`

grep -i XVarBind `find . -name \\*h`

grep -i gSLEncodeMode `find .  -name \”*.cpp\” -o -name \”*.h\”`

 
 
Find:

find . \\( -name \”*.cpp\” -o -name \”*.h\” -o -name \”*.c\” -o -name \”*.cc\” -o -name \”*.inh\” -o -name \”*.inc\” -o -name \”*.sm\” -o -name \”*.asm\” \\)

 
ipcs – status of the shared memory segment: 

 
ipcrm -s id – To clear the shared memory segment (id can be got by ipcs command.)

 
uname -a

 
which xxx – path of the xxx

(or)

type xxx – path of the xxx

 
who am i – present user details

who|cut -f 1 -d \’ \’|sort |uniq

who | awk \'{print $1}\’ | sort | uniq

whoami

 
source <filename> – To execute the command

 
chmod -r 777 * – To change the permissions

 
id

 
 
 
nm

 
ldd

 
ctags -R . – To create tag file for code browsing

ctags -L <filelist> – To create tag file for all the file list

 
pushd . – Pushes the current path on the Stack

 
popd . – Pops the current path from the Stack

 
snoop -x -20 port <port number> [To check the packets on the port]

 
groupadd cworks

 
useradd -g cworks -d /export/home/cworks -m -c \”cworks\” cworks

useradd -g ccusers -d /export/home/naveenc -m -c \”Naveen\’s NIS Login\” -u 3224 naveenc

 
passwd cworks

passwd -s cworks

grep \”^cworks:\” /etc/shadow

 
 
nslookup [For querying DNS]

dig

 
ps -aef | grep -i <name of the process>

 
Debugging:

prstat -p <pid> –> Process Stat

pfiles <pid> –> File Descriptors of the process

pmap <pid> –> Memory Map of the process

pstack <pid>/<corefile> –> Stack Trace of the process

ps -p <pid> -L –> Threads of the process

gcore <pid> –> Snapshot of present core image of the process

 
 
 
useradd -g 5001 -d /export/home/skumar -m -c \”Sunil\’s NIS Login on Ripley\” -u 2002 skumar

 
useradd -d /export/home/skumar -m -c \”Sunil\’s NIS Login on Ripley\” -u 2002 skumar

 
ln -s <sourc file> <target file>

ln -s /pilgrimvobs/pilgrim/testbed/sparc/ptestbed ptestbed

 
 
To grep a particular column, PID in the below case:

ps -aef | awk \'{print $2}\’

 
To search descriptors in use:

pfiles `ps -aef | awk \'{print $2}\’` > descriptors.txt

 
 
prtconf — To get system information.

 
 
gcc/dcc compilation with -E option gives precompilaton output

gcc/dcc -E …… | less [This will help in seeing the output]

 
To change the date:

date mmddHHMM[[cc]yy]

cc – century

yy – year

 
wall – To broadcast message

 
ndd – get and set driver configuration parameters

ndd /dev/tcp

About Amit Agarwal

1 Trackback on “More solaris commands”