Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unix Commands

Unix Commands

Explains how to understand complex unix commands. Covers pipes, stdin, stdout, stderr, xargs, etc.

Joshua Paling

March 15, 2018

Transcript

196 slides
  1. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  2. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  3. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  4. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  5. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ <FORMAT THEM WITH PRETTIER> ; <STAGE THEM FOR THIS COMMIT>'
  6. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  7. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  8. 1. Small, composable ⚒ 2. = Stream of 3. 3

    streams: IN, OUT, ERR 4. ↔ with <, >, 2>
  9. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  10. |

  11. 1. Small, composable ⚒ 2. = Stream of 3. 3

    streams: IN, OUT, ERR 4. ↔ with <, >, 2> 5. | | |
  12. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  13. 1. Small, composable ⚒ 2. = Stream of 3. 3

    streams: IN, OUT, ERR 4. ↔ with <, >, 2> 5. | | | 6. xargs: STDIN to ARGUMENTS
  14. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  15. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  16. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  17. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  18. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  19. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  20. <STAGED FILES> | grep -E '.*\\.(js|jsx)$' | grep -v ^public/

    | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  21. <STAGED FILES> | grep -E '.*\\.(js|jsx)$' | grep -v ^public/

    | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  22. <STAGED FILES> | grep -E '.*\\.(js|jsx)$' | grep -v ^public/

    | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  23. <STAGED FILES> | <THAT ARE JS / JSX> | grep

    -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  24. <STAGED FILES> | <THAT ARE JS / JSX> | grep

    -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  25. <STAGED FILES> | <THAT ARE JS / JSX> | grep

    -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  26. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  27. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  28. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  29. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  30. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  31. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  32. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %’
  33. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ <FORMAT THEM WITH PRETTIER> ; <STAGE THEM FOR THIS COMMIT>'
  34. 1. Small, composable ⚒ 2. = Stream of 3. 3

    streams: IN, OUT, ERR 4. ↔ with <, >, 2> 5. | | | 6. xargs: STDIN to ARGUMENTS
  35. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  36. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c 'prettier --single- quote --trailing-comma es5 --write %; git add %'
  37. git diff --staged --diff- filter=dx --name-only HEAD | grep -E

    '.*\\.(js|jsx)$' | grep -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  38. <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ <FORMAT THEM WITH PRETTIER> ; <STAGE THEM FOR THIS COMMIT>'

More Decks by Joshua Paling

Other Decks in Programming