'man grep' caused my head to hurt
ok I just read the man pages for grep.. I am no further ahead than when I started.. could someone please explain in simple terms what it's use is and maybe a few examples of where you would use it... thanks in advance
ps I remember I copied a command from this form with grep in it to find files.. but I can't seem to locate it anymore.. like to search /etc for *.new files.. so I could update config files etc.. |
you try this...
http://www.tldp.org/LDP/Bash-Beginne...ect_04_02.html |
thanks... that guide helped but I still can't figure out how to find files.. from what I read grep only finds words or 'expressions' within a file.. I am thinking I need to look into the find command more..
but I bookmarked that site and learned a lot.. thank you again.. I am about to google to see if there is something similiar for the find command.. |
Let me give you the single most useful structure for "find":
Code:
find / -name bash I use some variant on this all the time to find files that aren't on my path. Another, similar command, that I truly adore is "which": Code:
which bash |
ok this is how i search files, for example mynotes.txt
code : find / -name *notes* find = find cmd / = start search from root. if you want to serch within your home dir then find /home/xxx/ -name *notes* *notes* = search any file name contains "notes" now for the grep things..for example in /etc you to list out lilo.conf code : ls -l /etc | grep lilo ls- l = you know right /etc = path | = this is called pipe means the output of ls -l /etc/ is directed to grep grep = filter out expression given (in this case is lilo) from ls -l /etc |
Quote:
edit: I have been playing around with the examples you guys have given me.. I think I have it worked out.. just one to clarify something ls -l /etc | grep lilo and find /etc -name '*lilo*' should give you the same results or ls -l /home/x/* | grep burning is the same as find /home/x/ -name '*burning*' is there one that is more appropriate? I am thinking that using find is better when there are subdirectories and ls is good if you know the directory? |
$PATH is an environment variable ... it contains a colon-
separated list of directories in which the shell will look for executables. Some things may not be "in your path", e.g. if you're logged in as a normal user you won't have iptables in your path ... Cheers, Tink |
you can add things to you path in the ~/.bashrc file, among other places
|
when you're done with those, another command to check out is "locate"
:cool: |
All times are GMT -5. The time now is 10:53 PM. |