Monday, December 3, 2012

Encrypt files in UNIX

Openssl can be used to encrypt UNIX files. more information, example of openssl in progress.
man openssl in unix box.

encrypt can also be used in unix to encrypt  files in unix

List only Directory in UNIX

How to List Only Directory in UNIX
-------------------------------------------
Use the following command to list only directory structure or only directory

ls -al grep '^d'

This will list only directory

Thursday, September 20, 2012

Get Full path of Shared Drive in Windows

I always struggle to get the mapped drive path of any windows mapped drive. To get that we can use "NET USE" command from windows command prompt.

NET USE

This displays the full path.

Monday, August 6, 2012

Get size of the file in GB-AIX

I think, to list the size of the file in AIX is du -sg . This will display size in GB. Yet to confirm.

Alias name in UNIX

Alias of commands are used to make life easier by shortening commands the user uses often, and becomes tedious to type the entire command .

to view an alias

■execute: alias Alias_Name

to remove an alias
■execute: unalias Alias_Name

to make an alias permanent put in your shells startup script ie. ~/.bashrc ~/.bash_profile ~/.profile

Examples
■alias mntcd='mount /mnt/cdrom'

■alias umntcd='umount /mnt/cdrom;eject /mnt/cdrom'
■alias shut='/sbin/shutdown -hP 1'
■alias fmplayer='mplayer -fs'

Wednesday, March 28, 2012

mtime or find old files or delete old files

If you want to find old files, i.e. find files greater that 30 days using following command

Find and Print Files:-
find -type f -name <'Search pattern*'> -mtime +30 -print

Delete files greater than 30 days:-(Time is important in this)
find /cba_app/WSSORD01/DEV/archive/outbound -name DLMASY* -mtime +30 -exec rm {} \;

Good site for reference
http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html

Create Files as backdated files

If you want to create files in UNIX as backdated files, i.e. file creation date as old dates, follow below steps or commands.

Syntax:-
touch
This will create a file of that specific Month, Date for that year.

Example:-
touch 03302200 SAMPLE_20120330000000.txt;