Wednesday, September 14, 2016

Find all files containing given string in unix

$ grep -r  "string to search"  /directoryPath

It will list all the files which contains given search string under the directory 

Tuesday, September 13, 2016

List TAR file content without extracting in unix

$ tar -tf  filename.tar

If TAR contains more files and directories, you can use "less" option for easier viewing

$ tar -tf  filename.tar | less

If you wish to see file directory information then you can use "tvf" option

$ tar -tvf  filename.tar | less

Friday, September 9, 2016

vi editor copy, paste and new line

Copy and paste command in vi editor

yy - It will copy the entire line
p - It will paste the copied line after current line
P - It will paste the copied line before current line


Create new blank line in vi editor

o - It will open new line after the current line
O - It will open new line before the current line

Thursday, September 8, 2016

Friday, September 2, 2016

Creating directory trees in unix

$ mkdir -p /test1/test2/test3

It will create directory trees like below

$ cd /test1/test2/test3
$ pwd
/test1/test2/test3