Unix Commands

Unix Commands

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

Bca7defe7b8087d8e261d32b29cf425e?s=128

Joshua Paling

March 15, 2018
Tweet

Transcript

  1. 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 %'
  2. 3.
  3. 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 %'
  4. 5.

    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. 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 %'
  6. 7.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

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

    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. 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 %'
  9. 10.
  10. 12.
  11. 16.
  12. 17.
  13. 19.
  14. 20.
  15. 21.
  16. 33.
  17. 34.
  18. 35.
  19. 36.
  20. 37.
  21. 38.
  22. 39.
  23. 40.
  24. 41.
  25. 42.
  26. 43.
  27. 44.
  28. 45.
  29. 46.
  30. 47.
  31. 48.
  32. 49.
  33. 50.
  34. 51.
  35. 56.
  36. 57.
  37. 58.
  38. 59.
  39. 60.
  40. 61.
  41. 62.
  42. 63.
  43. 64.
  44. 65.
  45. 66.
  46. 67.
  47. 68.
  48. 69.
  49. 70.
  50. 71.
  51. 72.
  52. 73.
  53. 75.
  54. 76.
  55. 77.
  56. 78.
  57. 79.
  58. 80.
  59. 81.
  60. 82.
  61. 83.
  62. 84.
  63. 85.
  64. 86.
  65. 87.
  66. 88.
  67. 89.
  68. 90.
  69. 91.
  70. 92.

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

    streams: IN, OUT, ERR 4. ↔ with <, >, 2>
  71. 93.

    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 %'
  72. 94.
  73. 95.
  74. 96.

    |

  75. 98.
  76. 99.
  77. 100.
  78. 101.
  79. 102.
  80. 103.
  81. 104.
  82. 105.
  83. 106.
  84. 107.
  85. 108.
  86. 109.
  87. 110.
  88. 111.
  89. 112.
  90. 113.
  91. 114.
  92. 115.
  93. 116.
  94. 117.
  95. 118.
  96. 119.
  97. 120.

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

    streams: IN, OUT, ERR 4. ↔ with <, >, 2> 5. | | |
  98. 121.

    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 %'
  99. 122.
  100. 123.
  101. 124.
  102. 125.
  103. 127.
  104. 128.
  105. 129.
  106. 130.
  107. 131.
  108. 132.
  109. 133.
  110. 134.
  111. 135.
  112. 136.
  113. 137.
  114. 138.
  115. 139.
  116. 140.
  117. 141.
  118. 142.
  119. 143.
  120. 144.
  121. 145.
  122. 146.
  123. 147.
  124. 148.
  125. 149.
  126. 150.
  127. 151.
  128. 152.
  129. 153.
  130. 154.
  131. 155.
  132. 156.
  133. 157.

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

    streams: IN, OUT, ERR 4. ↔ with <, >, 2> 5. | | | 6. xargs: STDIN to ARGUMENTS
  134. 158.

    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 %'
  135. 159.

    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 %'
  136. 160.

    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 %'
  137. 161.

    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 %'
  138. 162.

    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 %'
  139. 163.
  140. 164.
  141. 165.
  142. 166.
  143. 168.

    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 %'
  144. 169.

    <STAGED FILES> | grep -E '.*\\.(js|jsx)$' | grep -v ^public/

    | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  145. 170.

    <STAGED FILES> | grep -E '.*\\.(js|jsx)$' | grep -v ^public/

    | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  146. 171.

    <STAGED FILES> | grep -E '.*\\.(js|jsx)$' | grep -v ^public/

    | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  147. 172.

    <STAGED FILES> | <THAT ARE JS / JSX> | grep

    -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  148. 176.

    <STAGED FILES> | <THAT ARE JS / JSX> | grep

    -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  149. 177.

    <STAGED FILES> | <THAT ARE JS / JSX> | grep

    -v ^public/ | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  150. 182.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  151. 183.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  152. 185.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | xargs -I % sh -c ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  153. 186.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  154. 187.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  155. 188.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %'
  156. 189.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

    IN PUBLIC DIR> | <AND FOR THOSE FILES AS %…> ‘ prettier --single-quote -- trailing-comma es5 --write %; git add %’
  157. 190.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

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

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

    streams: IN, OUT, ERR 4. ↔ with <, >, 2> 5. | | | 6. xargs: STDIN to ARGUMENTS
  159. 192.

    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 %'
  160. 193.

    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 %'
  161. 194.

    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 %'
  162. 195.

    <STAGED FILES> | <THAT ARE JS / JSX> | <NOT

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