Summary of Useful Unix Commands (Geared to Oracle Tools.)

12
A script enabled browser is required for this page to function properly. Bookmark s Admin Profi le Feedbac k Sign O ut Hel p Headl ines Knowled ge Service Request Software Configuration Manager Patches & Updates Foru ms Cer tif y Knowledge Brow ser Advanced Search Bug Sear ch Secure Enterprise Search Quic k Find o Secure Enterprise Search Advanced Saved Searches Did this article help solve your problem? Would you recommend this document to others? T I P : Clic k help for a deta iled expl anat ion of this page . Boo kma rk Go to End Su bj ec t: Unix Commands Crib Sheet For Oracle Developer Doc ID : Not e:1 499 36. 1 T y p e : REF ERE NCE Last Revi sion 25- APR - S t a PUB LIS HED

Transcript of Summary of Useful Unix Commands (Geared to Oracle Tools.)

Page 1: Summary of Useful Unix Commands (Geared to Oracle Tools.)

A script enabled browser is required for this page to function properly. Bookmarks   Admin   Profile   Feedback   Sign   Out   Help  

   Headlines

Knowled

ge Service Request

Software Configuration Manager

Patches & Updates

Forums

Certify

  Knowledge   Browser     Advanced   Search  Bug   Search    Secure   Enterprise   Search    

Quick Find

Go

  Secure Enterprise Search

Advanced   Saved Searches

Did this article help solve your problem?

Would you recommend this document to others?

 

 TIP: 

Click help for a detailed explanation of this page.

Bookmark

Go to End

Subject:

Unix Commands Crib Sheet For Oracle Developer

 

Doc ID:

Note:149936.1

Type

:

REFERENCE

 

Last Revis

ion Date:

25-APR-2007

Status

:

PUBLISHED

Checked relevance 25-April-2007,the examples based on Developer6.x, but the commands still interesting for higher versions.

Summary of useful Unix commands (geared to oracle tools.)    

Page 2: Summary of Useful Unix Commands (Geared to Oracle Tools.)

The Essentials

env displays your current environment variables. env | grep FORMS60_PATH env | grep CDPATH display your CDPATH (where 'cd' looks for directories.)

cal displays a calendar of the current year.

date displays the date.

PS1= Changes your prompt. PS1="developer_6i:" Change your prompt to 'developer_6i:'

psshow processes local to you. Useful to show which 'shell' you are in. ps -eaf | grep f60 Check if any forms server processes are running. ps -eaf | grep wdb Check if any webDB processes running, e.g. the webdb listener. ps -eaf | grep rwmts Check if the reports server is running.

cshchange to the C shell The C shell is an irritating, less powerful shell with a weird syntax. Advice: avoid.

bshchange to bourne shell. The Bourne shell is the standard shell. Most scripts are designed to work in this shell.

kshchange to Korn shell Very similar to Bourne but with extra, more powerful commands - recommended. exec ksh start a new process as a korn shell. ksh ./forms60_server run the forms60_server script using the korn shell.. ./forms60_server As abovet but preserve the environmnt variables set within (very useful)ksh rwbld60 & run the rwbld60 executable in background (allows you to do more stuff at the prompt)

exitlogout / go back a process.

lsdo a directory listing. ls -al | pg do a full directory listing and prompt to stop stuff whizzing off the page. ls | wc -l count the files in the current directory.ls -lasi list files including unix node number (the true 'name' of a file, useful if say you have two files with the same text name) ls -alt list files in date orderls -alt | head -10 as above but only display the first 10 ls -l $ORACLE_HOME/reports60/printer/admin/spoolcmd.sh spoolcmd.sh file has execute permissions ls -s | awk '{if ($1 > 50) print $1 " " $2 }'

Page 3: Summary of Useful Unix Commands (Geared to Oracle Tools.)

ls -alq List files with hidden characters. Very useful when you cannot delete a file for an unknown reason, as sometimesa file can be created with hidden control characters. (very common when stty not set properly) ls -al | grep f60 See what forms executables have been installed (in bin directory.)

sttySet terminal characteristics. stty -a show all settings stty erase set erase : allows the delete key to work. Note after typing erase, you type a space, then hit the delete key and only then press enter to run the command. stty sane reset terminal to something useable. Very useful when your terminal or session has locked up for some reason. Note: you need to press control-j, then type the above command, then press control-j again to take effect - do not press return.

man display manual information. man finger Get instructions for the command 'finger.'

whoshow who is logged on

dateshow todays date

uname -ashow the machine you are on, plus sometimes other info like session ipaddress.

who am ishow who INITIALLY logged in to this terminal session

idshow who you REALLY are (after any su commands, for example.)

cat display / concatenate files. cat file1 file2 > file3 join file1 to file2 and output to file3. cat formsweb.cfg | pg display the contents of the webforms configuration file.

file File tells you what kind of file you are looking at, useful to know whether you can edit it or not.file f60ctl - have a look what the forms listener start script is.

viload a file in the VI editor vi base_jini.html View and Edit the base jinititator html file.

killKill processes. kill -9 34567 Kill the process ID 34567 (determined with ps -eaf | pg )

rmdelete a file. rm install.log delete the install.log file. rm -rf * delete EVERY file in current directory and below. Use with caution !! rmdir myjunk delete the directory 'myjunk.'

Page 4: Summary of Useful Unix Commands (Geared to Oracle Tools.)

fileDisplay a files type, e.g. ascii text, data etc. file formsweb.cfg Confirm the filetype of formsweb.cfg. Note - 'file' is very useful if you are unsure about a file that you want to edit in VI, as editing / catting a data file / executable will just throw garbage at you and will likely hang your terminal or session. Never cat these types of files, and to avoid this pitfall use 'file' if you don not know what a files purpose is.

Intermediate stuff.

su change usersu - oracle switch user to oracle (prompts for a password) and set the oracle environment.su oracle switch user to oracle but DON NOT run the oracle environment script. Note: there is a peculiarity on solaris whereby doing this loses the LD_LIBRARY_PATH, so after doing su oracle make sure you reset this.su root switch user to root, keep old environment variables as above.

touch create a new file / update timestamp of existing file. touch repserver.ora Bring forward the timestamp on the reports server config file.touch deleteme Create a new, empty file called 'deleteme.'

echo echo strings to screen echo $DISPLAY display the contents of the DISPLAY xwindows setting to screen.

echo "ORACLE_HOME=$"$ORACLE_HOME"; export ORACLE_HOME > my_env_script create a new file 'my_env_script' with a line of code setting the ORACLE_HOME variable to whatever it is currently. echo $FORMS60_PATH >> my_env_script FORMS60_PATH to the existing specified file.

grepsearch for a specified string or pattern.ps -eaf | grep oracle Show all processes owned by oracle. cat myform.fmx | strings -a | grep -i forms compiled (fmx) form (sometimes works.) cat $FORMS60/*.fmb | strings -a | grep ON-LOGON trigger used in any of the fmb files. cat forms60_server | grep NLS set. cat formsweb.cfg | grep -i clsid find . -print | grep static_jinit.html find . -exec grep "DISPLAY" {} \; -print | pg "DISPLAY" - takes a while to run !

chmod / chown / chgrp Change permissions / ownership / group on a filechmod 777 reports60_server startup script. chmod 755 forms60_server

Page 5: Summary of Useful Unix Commands (Geared to Oracle Tools.)

execute only on the forms server startup script, i.e. they can not delete it. chgrp dba wdbstart Change the webdb startup scripts's group to dba. chown oracle rwcli60 change ownership on the reports webcient to oracle. find . -exec chown oracle {} \; -print current directory and lower directories to oracle (useful if someone has done an install erroneously as root.)

type / whence / which / alias locate a command / inform whether you can run it. type uncompress inform whether the uncompress command is known and thus runnable. whence compress inform whether the compress command is known and thus runnable. which cdb locate the cdb command be it a command OR an 'alias.' alias Display a list of aliases. Useful if something runs, but you cant find it as a script/ executable etc.

du / dfDisplay hard disk information. du display disk usage for all directories and subdirectories under the current directory. du -s displays one ?grand total? value for all the files under your current directory.

df -k display disk space free on each filesystem. Very useful.

ulimit shows / sets the maximum file size limits for a user. ulimit show your current file size limit. ulimit unlimited Attempt to set your ulimit to unlimited - may need root access. - useful to check if forms, reports etc is throwing errors when generating say a huge log file.

ftp Invoke the file transfer protocol file exchange program ftp ukp99999.uk.oracle.com - and then, once logged in and at the ftp> prompt: b Change to binary mode (essential for moving fmbs, fmx's, data files, executables etc.send myfile transfer 'myfile' from your local machine to ukp9999 get fred transfer file 'fred' from ukp99999 to your local machine. mget * transfer all files in current directory of ukp99999 to your local machine. !pwd check the directory of your local machine (if on unix.) pwd check current directory of ukp99999.

lpgeneral print command. cat repserv.ora | lp -dJIMBO printer.lpstat -a | pg display statusus of print queues etc.

Advanced commands.

Page 6: Summary of Useful Unix Commands (Geared to Oracle Tools.)

make relink an executable. make -f ins_forms60w.sh install > myoutput 2> myerrors write the screen output to the 'myoutput' file, and any errors to 'myerrors.' (Note - the 2> stderr redirect syntax can vary quite a bit between unix systems. )

find find a file find *.fmt -exec grep -i WHEN {} \; -print

ln create a link on a file. ln f60desm my_f60desm make a hard link called ?my_fred? for existing file ?f60desm.? ln -s rwbld60 my_rwbld60 make a symbolic link called ?my_rwbld60? for existing file ?rwbld60.?

sort sort a file into alphanumeric order (by lines.) sort file1 > file2 sort file1 into a new file, 'file2.' sort -u file > file3 sort file2 into a new file, 'file3,' but delete duplicate lines diff file2 file3 > file4 displays all duplicate lines in original file 'file1' (from above.)

sed Invoke the stream editor. cat forms60_server | sed 's/ORAKUL/ORACLE/g' > myNEWfile instances of ORAKUL in the forms60_server file and replace with ORACLE, writing the output to a new file, 'myNEWfile.' (How to do a global search and replace on a file.) ls | sed 's/$/<br>/g' > my_ls.html line of the output of 'ls.' Good for formatting the ouptut of unix commands into html for cgi scripts. ls | sed 's/^/<b>/g' > my_ls.html line of the result of the ls command.

tr Translate Characters. cat basejini.html | tr -s "[\f]" "[\n]" > new.html carriage-returns. This is very useful for fixing ascii files which have been ftp'd in bin mode. For example, some editors use carriage-return for the EOL marker, others use linefeed.

od Octal Dump. od -x tnsnames.ora | pg Display the tnsnames.ora file in hex. This is very useful for spotting if there is some spurious control characters in the file, rendering it unreadable or corrupt.od -c tnsnames.ora | pg similar to above, except instead of hex, the characters in the file are shown individually, with non-printing characters shown as escape sequences, e.g. \n .

strings Extract all printable strings from a file. strings -a myfile.fmx | pg hunt for interesting strings in the myfile.fmx file.

awk

Page 7: Summary of Useful Unix Commands (Geared to Oracle Tools.)

Invoke the awk scripting language. who am i | awk '{print $6}' Display only the 6th field of the output from 'who am i.' (Field 6 is the IP address of your own terminal session / PC.) This can be used to automatically set the DISPLAY environment variable for users' logins to a developer2000 / forms 6i area.

cksum provide a checksum of a file. Very useful for comparing two files of the same size that you suspect are different. cksum g60desm; cksum g60desm_patch g60desm_patch are actually different from eachother in some way.

split Split up a file into smaller chunks. Very useful for emailing big files to customers who have small email limits. You can email the small files instead. minifiles of 10000 lines each. cat aa ab ac ad ae af > new_bug123456.z

tar Invoke the Tape Archive utility tar tvf /dev/mydevice > test_file /dev/mydevice and write the contents to a test file. tar xvf /dev/mydevice extract all files from the tape and write them to the current directory. tar cvf /dev/mydevice * read all files in current directory and write them to tape. tar xvf patch123456.tar extract all files in archive file patch123456.tar to current directory.

mount Allows you to read a CD once insterted into the CD drive. The syntax for mount is vastly different between UNIX flavours. See the 'how to get started' booklet that comes inside the mini IDS and IAS CD packs - this shows examples of mount for many common platforms. On solaris, the CD may mount automatically if you are running 'volume manager.' mount -r -F hsfs /dev/my_cd_device /cdrom /my_cd_device CD drive and call the virtual CD directory 'cdrom.'

compress / uncompress Compress / uncompress a file to save space.Compressed files have the suffix .Z on them. compress patch123456.tar

uncompress newpatch.tar.Z -> uncompresses and re-creates the newpatch.tar file.

at Run a command / script at a specified time and date.at 23:00 < ./mybatch runs a command script 'mybatch' at 11pm Note: This is similar to the unix 'cron' command but easier to use. Note NT has the 'at' command as well. Tip: in the 'mybatch' batch script you could fire up 'at' itself again at the end, to repeat the process indefinately. jobs. at -r 992959200.a delete the 'at' job with the ID specified (given by the above.)

Page 8: Summary of Useful Unix Commands (Geared to Oracle Tools.)

finger lists tons of information on a specific user. finger usupport | pg display information on currect usupport logins. finger -l | pg gives a fuller listing for all users.

xclock Launch the motif clock window. Good for determining if xwindows installed + set up properly. Make sure your DISPLAY environment variable is set to <your-ip-address>:0.0

GUI-based system managers tools, allowing you to add users, add printers etc.

SOLARIS: admintool

HPUX: sam

AIX: smit

Differences between DOS and NT with environment variable syntax, particularly with regard to PATH.

In UNIX, directories are separated by forward-slashes and directory paths are separated by colons. On DOS/NT, the directory separator is a BACKSLASH and the directory paths are separated by SEMICOLONS.

Example1: How to add a hard-coded path : UNIX: export PATH=$PATH":/usr/mynewdirectory" DOS/NT: Path %PATH%;L:\csserver\bin

Example2: How to add an environment variable (note the colon in speech marks) :UNIX: export PATH=$PATH":"$ORACLE_HOME DOS/NT: Path %PATH%;%ORACLE_HOME

Example3: How to add your current working directory (again note the colon in speech marks) :UNIX: export PATH=$PATH":"`pwd`

Example4: Bringing it all together: UNIX: export PATH=$PATH":"$APPLE":/u/freddy/myfiles:"`pwd`

OS patch level / system

Page 9: Summary of Useful Unix Commands (Geared to Oracle Tools.)

info, memory, disk space etc

OS patchlevel memory

Sun Solaris

showrev -p sysinfo

HP-UX swlist sam

AIX/RS-6000

instfix -ivqk smit or sar

Windows NT

Explorer - help about

NT task manager

. Bookmarks   Admin   Profile   Feedback   Sign   Out   Help  

Copyright © 2006, Oracle. All rights reserved. Legal   Notices   and   Terms   of   Use | Privacy   Statement