Solaris one liners

2010-06-29 11 min read Solaris

http://www.unixguide.net/sun/sunoneliners.shtml

Unix/Solaris: One-Liners

Source: http://www.kevlo.com/~ebs/unix_commands.txt

Listed here are a bunch of unix commands.

–> change file date stamp

touch –t 199906042020 filename

–> move partitions

ufsdump 0f – /dev/rdsk/c0t0s0s0 | (cd /home; ufsrestore xv -)

–> lay down file system with 1% minfree and inode density

newfs –m1 –i81920 /dev/rdsk/c0t0d0s0

–> check file system

fsck /dev/rdsk/c0t0d0s0

Q: starting sybase

login as sybase, run: ./install/RUN_SYBASE

Q: logging in as sybase sa

isql -U sa

Continue reading

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” \)

Continue reading

ack on solaris – grep recursively.

2010-06-25 2 min read Solaris

<span style="background-color: #ffffff;">Some days back I posted an article on ack <a href="http://blog.amit-agarwal.co.in/2009/08/24/more-powerful-grep-ack/" target="_blank">here. Today I was working on Solaris 9 and the default grep installed on the system does not have the &#8221;-r&#8221; option to search recursively. So, you know for all the time I had to keep using find with grep to work with directories recursively. This was something similar to the one below:

<span style="background-color: #ffffff;">find . -type f -exec grep amit {} \;

Continue reading

Determine what process is listening on a port on Solaris, without lsof

2010-06-08 0 min read Linux Solaris
\"Desktop
Image by Metsuke iLife via Flickr

$ for x in `ptree | <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk '{print $1}&#8217;`; do pfiles $x | <a class="zem_slink freebase/en/grep" title="Grep" rel="wikipedia" href="http://en.wikipedia.org/wiki/Grep">grep ${PORT} > /dev/null 2>&1; if [ x&#8221;$?&#8221; == &#8221;x0&#8221; ]; then ps -ef | grep $x | grep -v grep; fi; done 2> /dev/null

Continue reading

Solaris Tips and Tricks

2010-05-19 1 min read Solaris

Find a list of Tips and Tricks <a href="http://sysunconfig.net/unixtips/solaris.html">here.

A nice trick to list the process which has opened a particular port is :

#!/bin/ksh

# 7-30-2003
# find from a port the pid that started the port

line=&#8217;————————————————————————-&#8217;
pids=`/usr/bin/ps -ef | sed 1d | awk '{print $2}&#8217;`

# Prompt users or use 1st cmdline argument
if [ $# -eq 0 ]; then
         read ans?&#8221;Enter port you like to know pid for:  &#8221;
else
         ans=$1
fi

Continue reading

Linux tip to find the pid/program using a particular port

2010-05-12 1 min read Solaris

netstat -lpn
Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/port" rel="tag">port, <a class="performancingtags" href="http://technorati.com/tag/pid" rel="tag">pid, <a class="performancingtags" href="http://technorati.com/tag/linux" rel="tag">linux, <a class="performancingtags" href="http://technorati.com/tag/netstat" rel="tag">netstat

Older posts Newer posts