UNIX commands useful for DBA
Vi commands
FILE manipulation:
:x
:wq
:q
:q!
Cursor Movements:
j or
k [or up-arrow] move cursor up one line
h
l or
0 (zero) move cursor to start of current line (the one with the cursor)
$ move cursor to end of current line
w move cursor to beginning of next word
b move cursor back to beginning of preceding word
:0
:n
:$
FIND command
find . -type f -mtime -200 -size +1000c -exec ls -l {} \; | awk '{print $5, $NF}'| sort -k 1,1n
-mtime +n --> not modified n days
-mtime -n --> modified within n days
The above example will search the file which is modified with 200 days and have size greater than speificed
Another example
find . -mtime +200 -exec ls -l {} \; listing not modified more than 200 days
find . –type f –exec grep –l “ORA-” {} \; | grep –v sample > loc_files.lst
this above example will search the ORA- matching string in the files which are searched
CPIO command
cpio -idmv <
example : cpio –idmv <>
Checking OS bit commands
solaris --> isainfo –kv
example:
> isainfo -kv
64-bit sparcv9 kernel modules
AIX à getconf -a|grep KERN
$ getconf -a|grep KERN
KERNEL_BITMODE: 64
Windowsà
- Click Start, then click on Run or Start Search.
- Type msinfo32.exe and then press Enter key.
- In “System Information”, review the value for the System Type item:
- For 32-bit editions of Windows, the value of the System Type item is x86-based PC.
- For 64-bit editions of Windows, the value of the System Type item is x64-based PC.
IP and servernames /etc/hosts
> more /etc/hosts
#
# Internet host table
#
127.0.0.1 localhost
10.231.5.24 xxx.admin xx-admin xxx.admin.telecom.co.nz xxx loghost
BASIC unix commands
- cat --- for creating and displaying short files
- chmod --- change permissions
- cd --- change directory
- cp --- for copying files
- date --- display date
- echo --- echo argument
- ftp --- connect to a remote machine to download or upload files
- grep --- search file
- head --- display first part of file
- ls --- see what files you have
- lpr --- standard print command (see also print )
- more --- use to read files
- mkdir --- create directory
- mv --- for moving and renaming files
- ncftp --- especially good for downloading files via anonymous ftp.
- print --- custom print command (see also lpr )
- pwd --- find out what directory you are in
- rm --- remove a file
- rmdir --- remove directory
- rsh --- remote shell
- setenv --- set an environment variable
- sort --- sort file
- tail --- display last part of file
- tar --- create an archive, add or extract files
- telnet --- log in to another machine
- wc --- count characters, words, lines
Shared memory and semaphores
Ipcs
To see what semaphores have been allocated, use the Unix command 'ipcs -b'.
Ipcrm
To remove the shared memory and semaphores
ipcrm -m <== Use for the Shared Memory entry
ipcrm -s <== Use for the Semaphore entry
TOP/TOPAS
This commands is used to check the top consuming resources
No comments:
Post a Comment