Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email 



AGAIN, HANDY FILE COMMANDS


head
Sometimes textfiles shown with <cat > are much to long to fit on your screen, this command will show you the top 10 lines of a file, with an -20 option you can let it show the first 20.

CODE
$ head -15  fileA

( For the first 15 lines )


tail
Does the same as head, but guess. . . . it shows the last 10.

CODE
$ tail -25  fileA

( For the last 25 lines )


cmp
If you typed a long text, saved it and later the file gets edited and saved again. There is a command to compare the two files and show the differences:

CODE
$ cmp -l  fileA  fileB

( The l option is to show all differences )


diff
Also checks two files on differences but in another way, just try:

CODE
$ diff -by  fileA fileB

( The b option is for ignoring black space the y option to sort the output side by side )


lpr
This is a simple one, as you´re in the commandline might as well print with it:

CODE
$ lpr fileA

( Will print the fileA )

CODE
$ lpr -#5 fileA

( Will print the file 5 times )


touch
Will create an empty file ( you can write to that file later )

CODE
$ touch fileA




A FEW TIME RELATED COMMANDS: ( useless but nice to know )

date
Will show you the current date

time
Will show you the current time

NOTE: you can run several commands on one line seperating them with an ¨;¨ so

CODE
$ date; time  

Will show you: ¨Fri May 9 21:34:37 CEST 2003¨


Bruno


-- May 9 2003 ( Revised Dec 10 2005 ) --


Tips Linux Explorers   All Things Linux Forum   Great Linux Links   LinuxClues.com   Hometown   Email