Single Post

Header

Tuesday, September 1, 2015

Find and Grep Command in Unix/Linux - with Examples

Find Command in Unix/Linux:

[ivreddy@localhost practise]$ find -name test1.txt
./test1.txt
./test1/test1.txt
[ivreddy@localhost practise]$ find . -name test1.txt
./test1.txt
./test1/test1.txt
[ivreddy@localhost practise]$ cd ..
[ivreddy@localhost Desktop]$ cat >test1.txt
test
[ivreddy@localhost Desktop]$ cd practise/

[ivreddy@localhost practise]$ find . -name test1.txt
./test1.txt
./test1/test1.txt
[ivreddy@localhost practise]$ find ~ -name test1.txt
/home/ivreddy/Desktop/test1.txt
/home/ivreddy/Desktop/practise/test1.txt
/home/ivreddy/Desktop/practise/test1/test1.txt
[ivreddy@localhost practise]$

Grep command in Unix/Linux

[ivreddy@localhost practise]$ cat test1.txt
welcome to linux
goto linux commands
check the commands
learn grep and find
vi search word
one more linux
learn well
[ivreddy@localhost practise]$ grep learn test1.txt
learn grep and find
learn well

No comments:

Post a Comment