Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. ### Notes about command lines functions from the "Data Science at the Command Line"
  2.  
  3.  
  4. `echo` is a command that outputs the strings it is being passed as arguments
  5.  
  6. ```
  7. echo 'Hello World'
  8. Hello World
  9. ```
  10.  
  11. `wc` - word count
  12.  
  13. ```
  14. echo 'Hello World' | wc
  15. 1 2 12
  16. ```
  17.  
  18. `alias` set an alias
  19.  
  20. ```
  21. alias gp = 'git push origin master'
  22.  
  23. ```
  24.  
  25. `grep` used for regular expression
  26.  
  27. ```
  28. seq 30 | grep 3
  29. 3
  30. 13
  31. 23
  32. 30
  33. ```
  34.  
  35. Or
  36.  
  37. ```
  38. seq 30 | grep 3 | wc -l
  39. 4
  40. ```
  41.  
  42. Creating a new file using `>` operator
  43. Append for existing fill using the `>>` operator
  44.  
  45. ```
  46. echo -n "Hello" > hello-world.txt
  47. echo " World" >> hello-world.txt
  48. ```
  49.  
  50. `cat` print the conent of a file
  51.  
  52. ```
  53. cat hello-world.txt | wc -w
  54. ```
  55.  
  56. Move a file for a different directory with the `mv` command
  57.  
  58. ```
  59. mv hello-world.txt ~/Downloads
  60. ```
  61.  
  62. `cp` command for copy a file
  63.  
  64. The `man` provides the command documentation
  65.  
  66. ```
  67. man cat
  68. ```
  69. To show only the first 20 lines:
  70.  
  71. ```
  72. man cat | head -n 20
  73. ```
  74.  
  75. Similarly, the `help` command returns the help documentation of the command (not always the `man` is available)
  76.  
  77. ```
  78. help cd | head -n 20
  79. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement