Posts

Showing posts with the label Unix

Can't open crontab, 447

Today I logged on to one of my servers I rarely use to create a crontab script to be run by the oracle user.  I ran the command crontab -l to view the contents of crontab.  I then entered crontab -e to edit it.  No dice.  The cursor hung on a new line and '447' was outputed to the screen.  I had to do CTRL+C to get out of it. oracle@server:~ > crontab -e 447 The fix was to set the EDITOR environment variable to vi.  I added this to the oracle's .profile: export EDITOR=vi

Unix find command with mtime

So, how can you find files in Unix older than a specified number of days? The solution is the find command with the option mtime. mtime is the modified time of a file. It's the last time the data in the file was changed. Simple enough. Find any file in /oback and all of its subdirectories that were last modified 1 day ago: find /oback/ -mtime +1 Find any file in /oback, excluding subdirectories , that were last modified 2 days ago: find /oback/* ! -name . -prune -type f -mtime 2

Checking memory usage with vmstat

My sys admin doesn't have top available for us so I've had to get used to using vmstat to check memory usage on Unix. It's definitely less user friendly than top, but you can find you need from it. Here's some sample output from vmstat: kthr          memory     page   disk faults   cpu r b w swap    free re mf pi po fr de sr m0 m1 m3 m1 in sy cs us sy id 0 0 0 6344224 925064 90 1188 68 0 0 0 0 0 0 0 0 693 6219 2155 13 2 85 0 0 0 6344416 924360 94 753 880 0 0 0 0 0 0 0 0 526 4779 1575 5 1 93 0 0 0 6348552 928080 94 1223 147 0 0 0 0 0 0 0 0 706 8063 2139 19 2 79 The swap column shows the amount of available swap space. The free column is the amount of memory available from the free list (physical memory). Both are listed in kilobytes.

SCP multiple files

To push all of the files in your current directory to a remote folder, use the following command: $ scp * username@server:/u01/

How to uncompress a .trz file

So, what is a .trz file? Simply a zipped tar file. Patches from SunGard are often compressed with the extension .trz. To uncompress, use the following command: gunzip -c patch_name .trz | tar xvf -