unix commands

sorts by swap size

prstat -s rss

splits files into 100mb chunks

split -b 100m file_name

watch all tcp parameters at solaris level

netstat -s -P tcp

find number of open files for a particular process

 cd /proc/19915/fd ; ls -lrth | wc -l

check all open files for all process

ls -lrth /proc/*/fd | wc -l

check full number of open files

 /usr/sbin/lsof | wc -l

check virtual memory of a paricular process

ps -p  -o vsz

check RAM installed solaris Box

/usr/platform/`uname -i`/sbin/prtdiag

want to know which Linux thread library java is linked to?

ldd /usr/java/jre1.5.0_11/bin/java

make two commands communicate through a named pipe

mkfifo iHaveBeenPiped
ls -al split/* | head >iHaveBeenPiped

remote execution

ssh admin@127.0.0.8 '/export/home/user/user.sh'

show process working directory

pwdx

top in solaris

/usr/local/bin/top

find PIDs of a process and kill all instances

ps -ef | grep ws_sched_600.sh | awk '{print $2}' | xargs kill

Report fstat(2) and fcntl(2) information for all open files in each process. In addition, a path to the file is reported if the information is available from /proc/pid/path.

 pfiles

deletes files of a particular month

 ls -lrth | grep -i mar | awk '{print $9}' | xargs rm

deletes 5 days older logs everyday at 4am

0 4 * * * * find /apache/logs/error_log* -ctime +5 -exec rm {} \;

It allows access to the basic and privileged limits on the Process ID

prctl

find a pattern in files

find . -type f| xargs grep 8860087346

patches installed in weblogic

[WLS_HOME]\utils\bsu>bsu -report -bea_home=[WLS_HOME] -output_format=text

 

lists all jobs running in unix

jobs

brings background hob in foreground

fg

puts job in background

bg

kills nth number of process

kill %n

brings nth number process in foreground

fg %n

sar 3 10

sar number_of_intervals number_of_times

check script execution

bash -x

check reverse routing in solaris

netstat -nr

shift + F will continue to read ouptut from file

less

this directory contains many binries like openssl and gcc

/usr/sfw/bin

ethernet cards information

/usr/sbin/ifconfig -a

deletes 3 days old files under backup dir

/usr/bin/find /dir/folder/* -mtime +3 -exec rm {} \;

pattern search in multple path

 grep -i Error /weblogic/bea11/domain/servers/XYZ?/logs/XYZ?.log

grep one file in multiple paths

grep -i  ProxyService_56744  MS?/MS?.log

grep 2 patterns in a file

egrep -i 'bridge|stuck'  /dir_path/MS?/MS?.log

#find all pid for a port

netstat -tulpn | grep 80

find PID of port

/usr/sbin/lsof -t -i :8081

find PID of port

/sbin/fuser 8081/tcp

find present working directory of a PID

ls -l /proc/30375/cwd

executable file of a PID

ls -l /proc/30375/exe

grep only that word in a file

grep -w

//find the files whose timestamps are earlier than the reference file
find . ! -newer /tmp/timeref -exec ls -l {} \; | more

//Delete those files
find . ! -newer /tmp/timeref -exec rm {} \;

# find . -mtime 0 # find files modified within the past 24 hours
# find . -mtime -1 # find files modified within the past 24 hours
# find . -mtime 1 # find files modified between 24 and 48 hours ago
# find . -mtime +1 # find files modified more than 48 hours ago
# find . -mmin +5 -mmin -10 # find files modifed between 6 and 9 minutes ago

 

 

Leave a Reply

Your email address will not be published.