Tuesday, September 13, 2011

Commands in Linux for ORACLE DBA Part -I


cat command is used to display the contents of a small file
on terminal

$ cat first.txt

cat when supplied with more than one file will concatenate
the files without any header information

$ cat sample3.txt sample4.txt

More and less commands are used to view large files one
page at a time

$ more sample1.txt

/*sample1.txt will be displayed one page
at a time */

$ less sample1.txt

/*sample1.txt will be displayed one page
at a time */

gzip command is used to compress the file.

It provides the extension .gz and removes the original file

$ wc sample_copy.txt

65 2776 17333 sample_copy.txt

$ gzip sample_copy.txt

$ wc sample_copy.txt.gz

26 155 7095 sample_copy.txt.gz

gunzip is used to de-compress it.

$ gunzip sample_copy.txt.gz

head command displays the top of the file, when used without any option it will display first 10 lines of the file

$ head sample1.txt

Similarly tail command displays the end of the file. By
default it will display last 10 lines of the file

$ tail sample1.txt

/*display last 10 lines*/

tail or head with -n followed by a number will display that
many number of lines from last and from first respectively

$ head -n 20 sample1.txt

/* will display first 20 lines*/

$ tail -n 15 sample1.txt

/* will display last 15 lines */

Enjoy:-)

No comments: