Instance Architecture   «Prev 

Head and tail of the log

Viewing Linux Files using tail command

Many times your only interest is in seeing the end of a file. To view just the last handful of lines in a file, use the tail command.
$ tail required_packages.txt  

 elfutils-libelf-devel-0.97.1-5.i386.rpm
 glibc-headers-2.3.4-2.41.i386.rpm
 glibc-kernheaders-2.4-9.1.103.EL.i386.rpm will be required as a
 prerequisite
 glibc-devel-2.3.4-2.41.i386.rpm
 gcc-3.4.6-10.i386.rpm
 libstdc++-devel-3.4.6-10.i386.rpm
 gcc-c++-3.4.6-10.i386.rpm
 libaio-devel-0.3.105-2.i386.rpm
 sysstat-5.0.5-19.el4.i386.rpm
 unixODBC-devel-2.2.11-1.RHEL4.1.i386.rpm
By default, tail displays the last 10 lines of a file. This is a great way to look at recent entries in Oracle database alert logs.
If more than 10 lines need to be seen, specify a number of lines as an option. For example, tail -15 required_packages.txt will show the last 15 lines of the file required_packages.txt.
When a log file is being actively written to, like with an alert log, displaying new lines on the screen as they are written to the file may be preferred. To do that, add the -f option to the tail command like this: tail -f alert_TEST.log. This allows the monitoring of a log in near real time, though sometimes lines may appear too quickly to read.

Viewing Linux Files using head command

$ head required_packages.txt  

REHEL4, OEL4: 
 Refer to Note 880211.1 

binutils-2.15.92.0.2-25
 compat-libstdc++-33-3.2.3-47.3
 elfutils-libelf-0.97.1-5
 glibc-2.3.4-2.41
 glibc-common-2.3.4-2.41
 libaio-0.3.105-2
 libgcc-3.4.6-10