Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Friday, June 01, 2007

Unix : DOS format on a Unix box

Quite often I use an IDE on Windows to edit the file and then FTP the file to a Linux box. (Mainly because vi sucks major league, big time!)

Anyway, the Unix compiler sometimes complains about rogue characters. An easy way to fix this is to use the

dos2unix

utility which reads the text file and converts to Unix format.

Enjoy!

Wednesday, April 11, 2007

Unix : sum

Often transfer large files around using FTP or whatever e.g. ear and war files and it's useful to see if they were transferred without error.

sum is a useful utility to use for this.

It calculates and prints a 16-bit checksum for the named file and the number of 512-byte blocks in the file.


sum abcd.ear
05612 25680


Enjoy!

Tuesday, December 19, 2006

Unix : Exporting a schema / stored procedure packages

Often you need to update the stored procedure packages for a schema.

So you laboriously export them via DDL and pretty them up and then run them on the target schema and then commit them.

Sometimes it's just easier to export the schema as an Oracle dump (which includes all the related stored procedures) and then import them on the target schema.

An example of the export command is:

exp login/password@schema file=target file directory/export name.dmp

Enjoy!

Friday, November 10, 2006

Unix : Libraries in an executable

A useful command to do this is:

ldd executable name

This will list out all the libraries required by that executable.

Enjoy!

Friday, October 20, 2006

Unix : Finding files that start with a .

The classic "ls -l" doesn't show you any files that start with . (which is legal) (e.g. .param) and which are effectively hidden.

You need "ls -al" to ferret out these elusive beasts.

Enjoy!

Monday, July 03, 2006

Unix : List symbols from object files

Often when adding a method to a shared library, the method can't be found when accessed from another program. You start to wonder whether you made a mistake and whether the new method was indeed added. A simple way to check is to use the "nm" command e.g.

nm libraryname.sl

This lists all the symbols so best to do something like:

nm libraryname.sl | grep nameofmethod

Enjoy!

Unix : Sorting directory by date (ls -ltr)

Almost everyone knows the

ls -l

command to display information about the contents of a directory. Sometimes you need to display it in date order so

ls -lt

To display in ascending date order (i.e. most recent last)

ls -ltr

Enjoy!

Thursday, May 25, 2006

Unix : bdf - free disc space

To see a report of free disc space, the "df" command is the UNIX standard. However, for HP-UX use "bdf". It's more useful.

Enjoy!

Monday, May 08, 2006

Unix : httpget

Very useful utility to check if a server can access URL's programmatically i.e. without using standard IE browser port 80. Useful if you think firewalls, proxies etc. will get in the way.

Usage : httpget http://www.testsite.com

Enjoy!

Monday, May 01, 2006

Unix : Find a list of files and compile them

Very easy way to find a list of files in a directory and compile them all via a shell script without having to manually find and compile each one:

for i in $(ls *.c); do

compile $i

done

This looks for a list of C files and then compiles them. You need to substitute the actual name of your compiler for the "compile" part of the script.

Enjoy!

Friday, April 28, 2006

Unix : Find files modified within a certain time period

So there I was trying to find where this application stored its @#$% log file.

Eventually had a brainwave and decided to search for all files recently modified.

A quick Google bought up the Find command:

Find / -mtime [+|-] value

The "+" or "-" indicates before or after e.g.

-4 indicates all files modified within the last 4 days

+4 indicates all files modified more than 4 days ago

4 indicates all files modified 4 days ago only

0 indicates all files modified in the last 24 hours.

Enjoy!