1) This document provides instructions for various Unix commands and tasks related to databases and applications.
2) It describes commands for editing files, compressing/extracting files, running strings utilities, finding files, changing variables, starting/stopping databases and applications, and more.
3) The commands are explained with examples appropriate for an Oracle database environment.
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
59 views
Unix Commands
1) This document provides instructions for various Unix commands and tasks related to databases and applications.
2) It describes commands for editing files, compressing/extracting files, running strings utilities, finding files, changing variables, starting/stopping databases and applications, and more.
3) The commands are explained with examples appropriate for an Oracle database environment.
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 13
Unix Commands
1) Editing the FILE:-
-------------------------- *) To come to end of file:- G *) To delete the single word(can be free space):- dw *) to delete the current single char:- (Esc and x) *) To delete the complete line:- dd *) To right over in the file:- cw *) To remove the case sensitive:- :set ic *) To Enable the case sensitive:- :set noic *) op! the complete line:- !! *) "aste what ever copied:- p #) GUN ZIP the file:- ----------------------------- g$ip file%name &ote:- 'hile tr!ing to download gun$ip file from server to local machine it should be done in binar! mode( Then it can exact using the wip$ip software in ')&*+', +perating ,!stem( -fter g$ip. if we want to un$ip the file then use the following( gun$ip file%name #(1) To unzip or gunzip the file : --------------------------------------------- gun$ip file%name Example:- gun$ip /01%1(2%3(tar(g$ #(#) To untar the file:- ------------------------------ tar -xvf file%name Example:- tar -xvf /01%1(2%3(tar 4) To run the strings for the spa!and program:- ------------------------------------------------------------- strings -a (shell%script%file%name) 5 (logfile(log) Example:- strings -a G6"78GE 5 9home9partners-home9hex9predd!9phani1(log 4(1) "asi# grep #ommand:- ----------------------------------- Example:- grep :*8+" index: adwor;221(log 5 9home9partners-home9x!$9predd!9dropindex(txt Note:- grep command is <ust li;e the search for some specfic word in !our windows file( )n 'indows +perating ,!stem. we use the (T86=>) and then we give the word we want to search( ,imilarl!. grep is used for 7&)/ or 6)&7/ +perating s!stem( )n the above Example. ) am searching for the :*8+" index: 'ord in adwor;221(log file( -nd ) want all the finding of this search stored in some file( ,o. ) have given the path and file name where it should save( ?) $pe#fi# to some pro%e#t:- ------------------------------------- To #he#& the num'er lst files:- ----------------------------------------- Example:- ls -altr *(lst @ wc -l Note:- )f some folder have some specfic extension files. then we can count the number of that specfic extension files then we can use the above command( )n the above example. ) am searching for the :lst: extension files count( To #he#& the num'er of s(l files !ith hit files :- ------------------------------------------------------------ grep :A(sBl: *(lst @ wc -l Note:- ,a!. we have some (sBl files names in all the lst files in some folder( Then we can use the grep command to count the sBl file names( To #he#& the num'er of files !ith hits in the lst file:- ------------------------------------------------------------------ grep :&umber of files with hits : C1-DE: *(lst Note:- 0ou can also give the count of the files with the range( )n the above example. ) have givne the range from 1 to D( )f it find an! number from this range then. it will get in the count( To #reate the file of the #omplete module :- -------------------------------------------------------- grep :A(sBl: *(lst 5 lst%sBl%:module%name:(txt Example:- grep :A(sBl: *(lst 5 lst%sBl%gl(txt Note:- The above example to do the search and to the search results in some given file name( 3) To find the file in the #urrent folder and su'folder:- --------------------------------------------------------------------- find ( -name Ffile%name*(sBlG -print Example:- find -i ( -name :po/'>7&T*(sBl: -print &ote:- P)*+FUNT,s(l is the file name which ) want to search( :i: in the above command indicates that. search should not be based on case sensitive( H) To grep the file for a spe#ifi# !ord:- ------------------------------------------------- grep -i :'+8*: >)6E%&-IE 5 log%file%name Example:- grep -i :-6TE8 table: adwor;221(log 5 altertable(txt J) To -no! the P).T num'er of En/ file:- ----------------------------------------------------- setenv @ grep "+8T Note:- 8un the above command after login to )nstance( -nd !ou have would have the read privileges for the file( This is mostl! useful for people. who are wor;ing in the +racle -pplication( J(1) For spe#fi# session !e #an #hange the /aria'le /alue: ------------------------------------------------------------------------- setenv variable%name variable%value Example :- The following was the current value( )&,T-&E%E&K)*L/011# (7sed the following command to chec; the value (seten/ 0 grep )"T))( seten/ )"T123IN4EN5I2 )"T467 The a'o/e #ommand has #hanged the /alue of the /aria'le( --------------------------------------------------------------------- +MT-*I)&%E&K)*L+MT%1# Note:- )f !ou exit from the session and then variable value will be revert bac;( N) To &no! the path of the log and out files of the appli#ation:- ------------------------------------------------------------------------------ 55cd O-""6,> There !ou will have the log and out folders( 0ou can also tr! the following command to ;now the value of the -""6,> variable( env @ grep log D) Turnon the appli#ation ser/er:- ---------------------------------------------- (9ora'eb-nd>orms(sh start )nstance name Example:- (9ora'eb-nd>orms(sh start /011# Note:- ------ 1) /011# is the )nstane name( #) -fter turnning the *atabase and concurrent manager up( still the application front end will not open( The !ou need to run the above script from the applmgr user To login to different user:- ------------------------------ sudo su - applmgr Note:- applmgr is the superuser name( This username can depends on the *M-. what the! have given at !our )nstance( D(1) If 8ou are getting 9:: Internal error message after 'oun#e 'a#& then tr8 this:- ----------------------------------------------------------------------------------------------------- Tr! to restart !our application and restart !our manage and see if it resolve the issue( >or the 1# 8elease. the above solution ma! not wor;( -fter !ou cleared %pages in 81#. !ou:ll need to recompile because the default mode is :<ustrun: instead of :recompile: as was in 11i( ) did the following while applmgr in m! )nstance /011# env and the login now wor;s: 1( cd O>&*%T+"9patch91139bin #( (9o<spompile(pl --compile --flush -p # (0ou can chec; if !ou are able to open the application or not)( )f !ou are still facing the issue then tr! rebounce the application and see if it resolve the issue)( 4( 9home9applmgr9ora'eb-nd>orms(sh bounce x!$1# ((9ora'eb-nd>orms(sh bounce $!x1#) Note:- ------ 0ou need to run the above script in the applmgr user sudo su - applmgr 12) To start or stop the Internal #on#urrent manager:- --------------------------------------------------------------------- cd O-*I)&%,8)"T,%P+IE9 (9adcmctl(sh start apps9apps (9adcmctl(sh stop apps9apps Note:- This need to be run from applmgr user ----- sudo su - applmgr 11) To stop the data'ase or start the data'ase:- ------------------------------------------------------------ cd O+8-6E%P+IE9appsutil9scripts9x!$1#%server9 &ote:- The above path is specfic to m! server )nstance( To stop the database:- adstopdb(sBl* To start the database:- adstrtdb(sBl* Note:- This need to be run from +racle user( ------ sudo su - oracle 1#) Con/erting all the ta's to spa#e in the file:- ----------------------------------------------------------- M! setting the following options in !our Q9(vimrc file. when !ou use tabs. spaces are actuall! entered into the file. although it RfeelsR li;e there are tabs because bac;spaces wor; as the! would with tabs( 0ou:ll never have to worr! about differing tabstop standards again( Tr! it out. ) promise !ouGll be completel! soldS set softtabstopL? set expandtab set shiftwidthL? &ote also that if !ou want to convert a file with tabs to all spaces. set the above options and then use: :retabS 14) To &no! the )perating s8stem on ser/er ;unix<:- ------------------------------------------------------------------ 5uname Example:- ----------- #22J(2N(2H-4:1N:24 predd!ToscarCHE9home9partners- home9x!$9phani9x!$%#4Uul9abc9la9utils 5 uname P"-7/ 1?) To &no! the )perating s8stem on ser/er from data'ase:- --------------------------------------------------------------------------- begin dbms%output(put%line(:"ort ,tring: :@@dbms%utilit!(port%string)V endV 13) 1dmin utilit8 to #ompile all the in/alid o'%e#ts:- ----------------------------------------------------------------- i) This utilit! is avilable for the applmgr user( 7se the following command to login with applmgr user( 55sudo su - applmgr ii) hoose the )ntance and then use the following command to run the adadmin utilit!( 55adadmin W &ote:- )t will as; for the O-""6%T+" path( )f the default path is not the correct one then provide the correct path( )t will as; for the 6og file name( (*efault name willl be (adadmin(log))( )t will as; if !ou can be notified b! email if a failure occurs( (*efault will be set for &+)( )t will as; for the Matchsi$e (*efault is 1222)( )t will as; for the correct database name( )t will as; to enter the password for !our :,0,TEI: +8-6E schema((RmanagerR will be the password)( (manager password will be onl! one !ou enter manuall!( 8est of things !ou ta;e the default values() )t will as; to enter the +8-6E password of -pplication +b<ect 6ibrar! (default will be C-"",E)( X iii) To !ill gi/e the menu !ith different options( ----------------------------------------------------- 'e will choose the Rompile98eload -pplications *atabase Entities menuR option( )t will be 4 option normall!( iv) To will again give the other set of menu optins( ----------------------------------------------- 'e will choose Rompile -"", schemaR option to compile all the )nvalid ob<ects in -"", schema( (&ote:- 0ou can also use O+8-6E%P+IE9rdbms9admin9utlrp(sBl (which will compile all invalid ob<ects thru ,K8IG86())( 1J) To &no! apps pass!ord:- -------------------------------------- cd O+8-6E%P+IE9reportsH29server more G)cmd(dat 0ou will find useridL-"",9apps%passT)nstance%name Note:- )f !ou have the >T" access for server files( Then we can ;now the -pps password( 1N) =U)T1:- --------------------- ,a! emplo!ees are allocated a certain amount of dis; space on the file s!stem for their personal files. sa! 1222Ib( )f !ou go over !our Buota. !ou are given some :n: da!s to remove excess files( To chec; !our current Buota and how much of it !ou have used( >or that !ou can use the following command( 5 (uota / 1D) 2F:- ------------ To find out how much space is left on the fileserver. use the following command( 5 df , #2) 2U:- ------------- The du command outputs the number of ;ilob!es used b! each subdirector!( 7seful if !ou have gone over Buota and !ou want to find out which director! has the most files( >rom !our home-director!. use the following command( 5 du s > The s flag will displa! onl! a summar! (total si$e) and the * means all files and directories( #1) GZIP:- --------------- This reduces the si$e of a file. thus freeing valuable dis; space( This is compress the file( )s it similar to the 'in$ip in the 'indows +perating s!stem( Example:- 5 ls l phani,txt note the si$e of the file using ls -l . then to compress phani(txt. use the following command( 5 gzip phani,txt This will compress the file and place it in a file called phani,txt,gz To see the change in si$e. use ls l again( To expand the file. use the gun$ip command( 5 gunzip phani,txt,gz This is similar to the 7n$ip the file in !our 'indows +perating s!stem( ##) ZC1T:- ---------------- $cat will read g$ipped files without needing to uncompress them first( 5 z#at phani,txt,gz )f the text scrolls too fast for !ou. pipe the output though less ( 5 z#at phani,txt,gz 0 less #4) FILE: >ile classifies the named files according to the t!pe of data the! contain. for example ascii (text). pictures. compressed data. etc(( To report on all files in !our home director!. use the following command( 5 file > #?) 2IFF:- ---------------- This command compares the contents of two files and displa!s the differences( ,a! !ou have a file called file6 and !ou edit some part of it and save it as file7( To see the differences use the following command( 5 diff file6 file7 #3) EC?):- ------------------ echo Ovariable%value The value of the environment variable can get from the echo command( Example:- echo O-""6%T+" )n the above command we get the -""6%T+" variable value set in the environment file( -""6%T+" is the environment variable in the environment file( #H) General Commands:- ------------------------------ Command 3eaning ls list files and directories ls -a list all files and directories m;dir ma;e a director! cd directory change to named director! cd change to home-director! cd Q change to home-director! cd (( change to parent director! pwd displa! the path of the current director! cp file1 file2 cop! file1 and call it file# mv file1 file2 move or rename file1 to file# rm file remove a file rmdir directory remove a director! cat file displa! a file less file displa! a file a page at a time head file displa! the first few lines of a file tail file displa! the last few lines of a file grep 'keyword' file search a file for ;e!words wc file count number of lines9words9characters in file command 5 file redirect standard output to a file command 55 file append standard output to a file command Y file redirect standard input from a file command1 @ command2 pipe the output of command1 to the input of command# cat file1 file2 5 file0 concatenate file1 and file# to file2 sort sort data who list users currentl! logged in * match an! number of characters Z match one character man command read the online manual page for a command whatis command brief description of a command apropos keyword match commands with ;e!word in their man pages ls -lag list access rights for all files chmod CoptionsE file change access rights for named file command [ run command in bac;ground \ ;ill the <ob running in the foreground \1 suspend the <ob running in the foreground bg bac;ground the suspended <ob <obs list current <obs fg ]1 foreground <ob number 1 ;ill ]1 ;ill <ob number 1 ps list current processes ;ill #H13# ;ill process number #H13# - @activate_user - activates developer user (pls. review/edit) - @add_resp <username> <partial resp. name> - add responsibilities - @ai - select resp. and do apps initialize - @api <partial package name> - generate xlsoracle template scripts !or all procedures in package - @csv <table name> - dumps a table to a csv !ile - @desc <partial ob"ect name> - dumps descriptions to editor !ile - @del_resp <part. user> <part. resp.name> - deletes (end dates) responsibilities - @disable_user <username> - disable user - @dump <tablename> - dumps table data in list !ormat - @ed <!ile name> - user de!ined editor in new session - @enable_user <username> - enable user - @env - s#ow connect in!o - @ext <ob"ect name> - extract source !rom database - @#elp - $#ow commands (t#is !ile) - @in!o - s#ow initialization in!o - @inx <partil index name> - index list - @kill <partial session in!o> - s#ows all session% wit# &alter s'stem kill command& - @locks - s#ow locks - @login - de!ault execution script - @ob" <partial ob"ect name> - !ind ob"ects - @org <partial org. name> - organization list - @par <partial parameter name> - s#ow parameter values - @password <new password> - new password !or current session - @proto <partial package name> - generate protot'pe scripts !or all procedures in package - @re( - s#ow conc. re(uest - @re() <re(uest id> - restart conc. re(uest - @re(!tp - s#ow conc. re(uest - submit re(!tp) - @re(!tp) <re(uest id> - !tp out and log !rom re(uest - @save_pro!ile_site <pro!.name> <value> - saves a pro!ile value on site level - @save_pro!ile_user <pro!.name> <value> - saves a pro!ile value on user level - @set_all - sets all parameters <*+, edit setup.s(l !or 'our re(uirements> - @set_client_in!o <org_id> - set client in!o - @setup - prompts !or username and generates new set_all.s(l - @sob - list all gl set o! books - @tab <partial table name> - table list - @tabinx <partial table name> - table index list - @trace - starts s(l trace - extecute s(l - end wit# @trace_end - @trace_end - ends s(l trace - start wit# @trace - @user_password <user> <password> - updates user password - @views <partial table name> - list views - @w - create new work script named work_----..//.s(l and open it in editor - @w!_oecogs <order no> <line no> - run oecogs work!low !or a order line - trace work!low !or cogs account generation