Skip to content

zhuwu/useful-shell-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published