More solaris commands

2010-06-29 2 min read Solaris

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 – 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 – 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 [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

 
Debugging:

prstat -p –> Process Stat

pfiles –> File Descriptors of the process

pmap –> Memory Map of the process

pstack / –> Stack Trace of the process

ps -p -L –> Threads of the process

gcore –> 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

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

comments powered by Disqus