Friday 24 January 2014

UNIX COMMANDS

 1. ls  list of files

2. cd ..   back

3.man   user manuals

4.listusers    all users list

5.listusers -l user*     to find the users in the list.

6. cd/home/schdrec    to find that particular user

7.ls -la     to see hidden files

8.vi editing

9.cat listing the file...

10.  pwd   present working directory

11. su -scpbatch    --- Super user Switch to another user.

12. chmod 755 filename    --- will give resd, write permissions

13. ls -ltr filname*  -- will give the latest modified files...

14. echo $WSF_HOME    to set the environment home

15. sh wdp000.sh wdp000b.sql      -- to run shell script by passing parameter..

16.  cat  mgx_funcs.sh|more    -- to view the file name by line by line...

17.     /UKDSPS01/bin> !       -- to stop viewing     
        /UKDSPS01/bin> exit

18.  How you will list all Hidden files
     Ans : ls -la|grep ^[.]

19. cmp -It compares two files byte by byte and displays first mismatch.
           diff -It displays all changes required to make files identical.






scpbatch    scpBATCH/01



--------------------------------------

Directory Commands

cd dir changes the working directory

ls -F lists files and subdirectories

pwd shows working directory

rmdir dir deletes an empty directory

mkdir dir makes a new directory

--------------------------------------

File Commands

cat filename displays the contents of a file

cp existing-filename new-filename makes a copy of a file with a new name

grep string filename displays the specified string within the file

head filename displays the first ten lines of a file

head -# filename displays the specified number of lines from the top

more filename displays the contents of a file one screen at a time

mv old-filename new-filename renames a file

rm filename removes or deletes a file

tail filename displays the last ten lines of a file

---------------------------------------------------------

Other pico commands

^I to insert a tab

^T to check your spelling

^W to search for a term

^J to justify or align the right margin

!@#



---------------------

Example :

/u01/app/scpo/UKDSPS01/bin/dp> echo $MGX_DIRS
sh: MGX_DIRS: Parameter not set.
/u01/app/scpo/UKDSPS01/bin/dp> echo $WSF_HOME
/u01/app/scpo/UKDSPS01
/u01/app/scpo/UKDSPS01/bin/dp> echo $MGX_DIRS
sh: MGX_DIRS: Parameter not set.
/u01/app/scpo/UKDSPS01/bin/dp> echo $MGX_COM
sh: MGX_COM: Parameter not set.
/u01/app/scpo/UKDSPS01/bin/dp> MGX_DIRS=/UKDSPS01
/u01/app/scpo/UKDSPS01/bin/dp> export MGX_DIRS
/u01/app/scpo/UKDSPS01/bin/dp> echo $MGX_DIRS
/UKDSPS01
/u01/app/scpo/UKDSPS01/bin/dp> echo MGX_COM
MGX_COM
/u01/app/scpo/UKDSPS01/bin/dp> export MGX_COM=$MGX_DIRS/bin
/u01/app/scpo/UKDSPS01/bin/dp> echo $MGX_COM
/UKDSPS01/bin


--------------------

After Running Shell Script :

/u01/app/scpo/UKDSPS01/bin/dp> sh wdp000.sh wdp000b.sql
09/03/10 10:11 wdp000 - DMDUnits flagged for deletion report started.
09/03/10 10:11 wdp000 - Updating the DMD Unit class = Z where maturity = D  starting.
09/03/10 10:11 wdp000 - Updating the DMD Unit class = Z where maturity = D  Completed successfully.
09/03/10 10:11 wdp000 - Execute SQL script to report on old DMDUnits as it is Tue starting.
09/03/10 10:11 wdp000 - Execute SQL script to report on old DMDUnits as it is Tue Completed successfully.
09/03/10 10:11 wdp000 - Execute SQL script to report potential DMDUnits for deletion as it is Tue starting.
09/03/10 10:11 wdp000 - Execute SQL script to report potential DMDUnits for deletion as it is Tue failed see /UKDSPS01/log/dp/0/wdp000_potential_DMUnits.log.
09/03/10 10:11 wdp000 - get_param_list returned no values
09/03/10 10:11 wdp000 - DMDUnits flagged for deletion report completed successfully.


--------------------

After running succesfully shell script :

/u01/app/scpo/UKDSPS01/bin/dp> sh wdp000.sh wdp000b.sql
09/03/10 12:10 wdp000 - DMDUnits flagged for deletion report started.
09/03/10 12:10 wdp000 - Updating the DMD Unit class = Z where maturity = D  starting.
09/03/10 12:10 wdp000 - Updating the DMD Unit class = Z where maturity = D  Completed successfully.
09/03/10 12:10 wdp000 - Execute SQL script to report on old DMDUnits as it is Tue starting.
09/03/10 12:10 wdp000 - Execute SQL script to report on old DMDUnits as it is Tue Completed successfully.
09/03/10 12:10 wdp000 - Execute SQL script to report potential DMDUnits for deletion as it is Tue starting.
09/03/10 12:10 wdp000 - Execute SQL script to report potential DMDUnits for deletion as it is Tue Completed successfully.
09/03/10 12:10 wdp000 - get_param_list returned no values
09/03/10 12:10 wdp000 - DMDUnits flagged for deletion report completed successfully.


---------------------------------------------------------------

After Sending mail

/u01/app/scpo/UKDSPS01/bin/dp> sh wdp000.sh wdp000b.sql
09/03/10 13:31 wdp000 - DMDUnits flagged for deletion report started.
09/03/10 13:31 wdp000 - Updating the DMD Unit class = Z where maturity = D  starting.
09/03/10 13:31 wdp000 - Updating the DMD Unit class = Z where maturity = D  Completed successfully.
09/03/10 13:31 wdp000 - Execute SQL script to report on old DMDUnits as it is Tue starting.
09/03/10 13:31 wdp000 - Execute SQL script to report on old DMDUnits as it is Tue Completed successfully.
09/03/10 13:31 wdp000 - Execute SQL script to report potential DMDUnits for deletion as it is Tue starting.
09/03/10 13:31 wdp000 - Execute SQL script to report potential DMDUnits for deletion as it is Tue Completed successfully.
Sending mail...
Mail sent!
09/03/10 13:31 wdp000 - DMDUnits flagged for deletion report completed successfully.






SELECT COUNT(*) FROM STSC.HISTFCST A WHERE EXISTS ( SELECT 1 FROM STSC.DMDUNIT WHERE DMDUNIT = A )



No comments:

Post a Comment