Bash Command Line Tips to Help You Work Faster
Refer to: https://www.freecodecamp.org/news/bash-command-line-tips-to-help-you-work-faster
- Continue add items to this article to help me record some useful commands
1. Use Control + L to clear the screen and Control + D to exit
2. Use the nohup command to spawn processes that don’t end with the terminal session
1 | nohup firefox https://freecodecamp.org & |
3. Use pkill to kill processes by typing in only a part of the name
1 | killall firefox |
4. Prepend the time command to know how fast something executes
1 | time python3 concalate_nonce.py |
5. Know the public IP address of your computer using curl
1 | curl ifconfig.me ; echo |
6. Use Ctrl + R (⌘ + R) for reverse search
1 | crtl + r |
7. show file count by directory
1 | find . -type f | sed 's%/[^/]*$%%' | sort | uniq -c |
8. Show folder size
1 | #Show specify folder |
9. Find matched line from csv file
1 | grep ,1 abc.csv |
10. Find filename in csv file and mv to new folder
1 | grep ,1 abc.csv | cut -d "," -f1 | xargs -I {} mv {} new_folder |