Summary of useful Unix commands (For oracle)
The Essentials
env displays your current environment variables. env | grep FORMS60_PATH display the value of 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:' |
ps show 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. |
csh change to the C shell The C shell is an irritating, less powerful shell with a weird syntax. Advice: avoid. |
bsh change to bourne shell. The Bourne shell is the standard shell. Most scripts are designed to work in this shell. |
ksh change 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) |
exit logout / go back a process. |
ls do 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 inode 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 order ls -alt | head -10 as above but only display the first 10 ls -l $ORACLE_HOME/reports60/printer/admin/spoolcmd.sh Verify that the spoolcmd.sh file has execute permissions ls -s | awk '{if ($1 > 50) print $1 " " $2 }' list all files over 50 blocks in size. ls -alq List files with hidden characters. Very useful when you cannot delete a file for an unknown reason, as sometimes a 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.) |
stty Set 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.' |
who show who is logged on |
date show todays date |
uname -a show the machine you are on, plus sometimes other info like session ipaddress. |
who am i show who INITIALLY logged in to this terminal session |
id show 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. |
vi load a file in the VI editor vi base_jini.html View and Edit the base jinititator html file. |
kill Kill processes. kill -9 34567 Kill the process ID 34567 (determined with ps -eaf | pg ) |
rm delete 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.' |
file Display 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't know what a files purpose is. |
su change user su - oracle switch user to oracle (prompts for a password) and set the oracle environment. su oracle switch user to oracle but DON'T 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 INCLUDE the value of FORMS60_PATH to the existing specified file. |
grep search for a specified string or pattern. ps -eaf | grep oracle Show all processes owned by oracle. cat myform.fmx | strings -a | grep -i forms Try to get forms version from a compiled (fmx) form (sometimes works.) cat $FORMS60/*.fmb | strings -a | grep ON-LOGON Try to find if ON-LOGON trigger used in any of the fmb files. cat forms60_server | grep NLS Check if NLS related environment variables are set. cat formsweb.cfg | grep -i clsid Get the jinitiator classid from the forms config file. find . -print | grep static_jinit.html Search everywhere for the specified file. find . -exec grep "DISPLAY" {} \; -print | pg search all files for the text string "DISPLAY" - takes a while to run ! |
chmod / chown / chgrp Change permissions / ownership / group on a file chmod 777 reports60_server give full access permissions to the reports server startup script. chmod 755 forms60_server give owner full permissions and all others read and execute only on the forms server startup script, i.e. they can't 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 Change ownership on every single file in 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 / df Display 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 ftp to ukp99999 (it will prompt you for a login.) - 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. |
lp general print command. cat repserv.ora | lp -dJIMBO print the reports server config file to the 'JIMBO' printer. lpstat -a | pg display statusus of print queues etc. |
make relink an executable. make -f ins_forms60w.sh install > myoutput 2> myerrors Relink oracle forms, but 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 search for WHEN triggers in all fmt's. |
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 search for all 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 Place the html command <br> at the end of each 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 Place an HTML bold marker at the start of each line of the result of the ls command. |
tr Translate Characters. cat basejini.html | tr -s "[\f]" "[\n]" > new.html Convert newline (formfeeds) into 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 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 Test whether g60desm and 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. split -10000 bug123456.z splits 'bug123456' into minifiles of 10000 lines each. cat aa ab ac ad ae af > new_bug123456.z Join the small bits back together again. |
tar Invoke the Tape Archive utility tar tvf /dev/mydevice > test_file Just read the contents of the tape on /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 Solaris: mount the CD in the /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 compresses a tarred patch file to a compressed .Z file. 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. at -l Lists pending 'at' jobs. at -r 992959200.a delete the 'at' job with the ID specified (given by the above.) |
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 |
SOLARIS: | admintool |
HPUX: | sam |
AIX: | smit |
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 | patchlevel | memory | diskspace | motif version | CPU / Memory | opsys version |
Sun Solaris | showrev -p | sysinfo | df -k <dir> | pkginfo -l | top | uname -a |
HP-UX | swlist | sam | df -k <dir> | sam | vmstat -n 2 200 | uname -a |
AIX/RS-6000 | instfix -ivqk | smit or sar | df -k <dir> | smit | uname -a | |
Windows NT | Explorer - help about | NT task manager | r-click on drive letter | n/a | NT task manager | Explorer - help about |