Monday, January 11, 2010

Linux stuffs................

1. To create a file using cat command
cat >> filename
and after the contents are written press ctrl-d

2.grep command

grep -e pattern filename
this command looks for particular pattern remind u that it doesnt matches the word or line and prints out the filename:the line in which the pattern was found

grep -iwh pattern *

this command looks for particular word prints out the the line in which the pattern was found

here in this command it searche for all the files in the directory and
w: for matching the whole word
 i: it doesnt take into account the case of the letters
 h:it doesnt prints out the filename

grep -cv pattern *
this counts total no. of lines not containg the particular pattern
c:it counts the total no. of lines
v:except the pattern

grep -x pattern *
this matches the whole line for the pattern and then prints the filename:pattern
x:for the whole line the pattern is searched

3.sudo lshw -html > raj.html
this list the hardware information of your computer in html format