Tuesday Feb 14, 2012

UNIX Useful Commands - Part 2

1). Find whether OS is 64/32 Bit Kernel in UNIX

OS

Command

AIX

getconf -a | grep –i KERN OR

bootinfo -K OR

file /usr/lib/boot/unix

HP-UX

getconf -a | grep -i KERN

Solaris

isainfo –kv

Linux

uname –a

2).Find Free Physical Memory in UNIX

OS

Command

AIX

bootinfo -r

HP-UX

grep -i Physical /var/adm/syslog/syslog.log

Solaris

prtconf

Linux

free -m

3).Find CPU details in UNIX

OS

Command

AIX

lsdev -Cc processor

HP-UX

ioscan –fnC processor

Solaris

psrinfo -v

Linux

cat /proc/cpuinfo

4).Find SWAP Size details in UNIX

OS

Command

AIX

lsps –a

HP-UX

                swapinfo -a

Solaris

swap –l

Linux

free -m

UNIX Useful Commands - FIND

1).Find files modified within specific time

Find files that have been modified less than 3 days ago.

find . -mtime -3

To be more specific and just check for the file change time, use:

find . -ctime -3

To be even more specific you can set a date range by using: Find all files changed, and thus modified, at least one day ago but within three days ago.

find . -ctime +1 -a -ctime -3

2).Find and Replace text in Multiple Files

Use,

                                find . -type f | xargs grep -l 'IBM' | xargs sed -i '' -e 's/IBM/ORACLE/g'

The first part of the command is find, which finds all files and excludes directories. That result is then piped to grep, which lists all files that contain IBM. The results of is then sent to sed, which replaces all occurances of IBM with ORACLE.

3).Find and Move files to a specific location

Use,

                              find . -newer *lmd.trc -exec cp '{}' /tmp/ \ ;

Above command find the file newer than the *lmd.trc and then copies all the files to the tmp directory.

About

I am Jagatheesh Ramakrishnan - Apps DBA currently part of Advanced Customer Services for Oracle Corp.Am based out in London and working for a major bank customer.

Search

Archives
« February 2012 »
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
15
18
19
20
21
22
23
24
25
26
27
28
29
   
       
Today