Unix commands part-2


little detailed in commands.. for shel script use
-----There are many commands will add few and update it day by day----
--date command in different way use in shel
$ date
Fri Oct 27 09:27:04 EAT 2017
$ date '+%a'
Fri
$ date '+%d-%b-%y'
27-Oct-17
$ date '+%d-%b-%y %a'
27-Oct-17 Fri
----------same in capital letter 
$ date '+%d-%b-%y %a' | tr '[a-z]' '[A-Z]'
27-OCT-17 FRI
=================================================================
chmod
=================================================================
Change file permissions
there are 3type of permisons read, write, ande xecute

EXAMPLE: chmod u=rwx,g=rx,o=r filename
The letters ug, and o stand for "user", "group", and "other".
("=") means "set the permissions exactly like this
letters "r", "w", and "x" stand for "read", "write", and "execute"

we can use same command with numbers also 
example :- chmod 644 file name
Out of 3 numbers in exaple  "user(6= read+write)", "group(4= read)", and "other(4= read)".
=======================
4 stands for "read",
2 stands for "write",
1 stands for "execute", and

0 stands for "no permission."
So 7 is the combination of permissions 4+2+1 (read, write, and execute), like this you can choose number depends on required permission.
-------------simple way i explained to minimize text size------------

=================================================================
chown
=================================================================
The chown command is used to change the owner and group of filesdirectories and links

chown user file
chown user:group file

chown user:group directory

have many sub commands to explain all it need seperate article as dba this system admin job(not dba) so am not explain much here 

====================================================================
 Cleanup any unwanted trace files more than seven days old
====================================================================
find . *.trc -mtime +7 -exec rm {} \;
=========================

tar and un tar

To create a tar from a directory and its subdirectories:
tar -cvf packed_files.tar dir_to_pack
To unpack tar files, use the following commands:
For an uncompressed tar file:
tar -xvf file_to_unpack.tar
=================================================
mailq  ==> to check mails in mail queue





Comments

Popular posts from this blog

Shareplex some commands

SQL Tuning Task Creation ORA-13780: SQL statement does not exist.

ORA 700 [kskvmstatact: excessive swapping observed]