Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Notes about command lines functions from the "Data Science at the Command Line"
- `echo` is a command that outputs the strings it is being passed as arguments
- ```
- echo 'Hello World'
- Hello World
- ```
- `wc` - word count
- ```
- echo 'Hello World' | wc
- 1 2 12
- ```
- `alias` set an alias
- ```
- alias gp = 'git push origin master'
- ```
- `grep` used for regular expression
- ```
- seq 30 | grep 3
- 3
- 13
- 23
- 30
- ```
- Or
- ```
- seq 30 | grep 3 | wc -l
- 4
- ```
- Creating a new file using `>` operator
- Append for existing fill using the `>>` operator
- ```
- echo -n "Hello" > hello-world.txt
- echo " World" >> hello-world.txt
- ```
- `cat` print the conent of a file
- ```
- cat hello-world.txt | wc -w
- ```
- Move a file for a different directory with the `mv` command
- ```
- mv hello-world.txt ~/Downloads
- ```
- `cp` command for copy a file
- The `man` provides the command documentation
- ```
- man cat
- ```
- To show only the first 20 lines:
- ```
- man cat | head -n 20
- ```
- Similarly, the `help` command returns the help documentation of the command (not always the `man` is available)
- ```
- help cd | head -n 20
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement