Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 866 Bytes

README.md

File metadata and controls

36 lines (29 loc) · 866 Bytes

Shell Commands

  1. Find file in a directory
find <directory> -name "<file name>"
find <directory> -regex "<regex>"
  1. Search file by keyword/regex
grep -R "<keyword>" <directory>
  1. Retrieve matching text in a file
grep -oEi '<regex>' <directory>
  1. Join multiple lines into one line with delimeter
<source of multiple lines> | paste -s -d "<delimiter>"
<source of multiple lines> | perl -pe 's/\n$/ <delimeter text> /'
  1. Curl with HTTP authentication
curl -u <username>:<password> <url>
  1. To redirect both STDOUT and STDERR to the same place, use the >& symbol. To redirect STDOUT only, use 1>. To redirect STDERR only, use 2>.
  2. Separate lines into fields according to delimiter and get selected portion
<source> | cut -d '<delimiter>' -f 1,3-5