GenWikiLinux

From birchyHistory
Jump to: navigation, search
(Create shortcuts in Linux (symbolic links))
 
Line 3: Line 3:
  
 
== GREP ==
 
== GREP ==
  grep [OPTIONS] "foo" [FILES(s)]
+
  grep [OPTIONS] "REGEXP" [FILES(s)]
  
 +
*"REGEXP" can be any [[Regular Expression]]
 
*Single or double quotes can be used.
 
*Single or double quotes can be used.
*Quotes can be omitted if there are no spaces in the search term.  
+
*Quotes can be omitted if there are no spaces in the search term.
 +
 
 
*If file is omitted, all files in current dir are searched.
 
*If file is omitted, all files in current dir are searched.
 
*Multiple files can be specified separated by spaces or wildcarded (*.txt)
 
*Multiple files can be specified separated by spaces or wildcarded (*.txt)
Line 13: Line 15:
 
  OPTIONS:
 
  OPTIONS:
 
  -i  ignore case
 
  -i  ignore case
 +
-r  recursive files inclusion
 +
-F  Fast search using literal search term, not regEx
 
  -n  print line #s
 
  -n  print line #s
 
  -l  just show filenames
 
  -l  just show filenames
Line 19: Line 23:
 
  -m, --max-count=NUM      stop after NUM matches
 
  -m, --max-count=NUM      stop after NUM matches
 
  -a  text files only
 
  -a  text files only
  -r recursive files inclusion
+
   
 +
  -iFr ignore case, simple string search, search current directory and subdirectories
  
 +
'''egrep''' is replaced with '''grep -E''')
 +
'''fgrep''' is replaced with '''grep -F''')
  
"foo" can be any [[Regular Expression]]
+
Can pipe the output of another command
 +
ls |grep blah lists all files in the current directory whose names contain the string "blah"
  
egrep supports pipes ("or") (= grep -E)
+
==Create shortcuts in Linux (symbolic links)==
  
  egrep "fruit|bread"
+
  ln -s /pathToTarget nameOfTheLink
 
+
fgrep (fast grep, simple text, no RegEXp) (- grep -F)
+
e.g.  ln -s /var/www/html/public_html/ webDirectory
 
+
ln creates hard and soft links. The -s option create soft (symbolic) links to resources in other directories, even other drives.
Can pipe the output of another command
+
 
+
ls |grep blah lists all files in the current directory whose names contain the string "blah"
+

Latest revision as of 14:28, 12 September 2015

Personal tools
Namespaces

Variants
Actions
Navigation
Tools