Scripting
Bash Commands

(Useful) Bash Commands

CommandWhat it doesUsage ExampleUse caseReferencesNotes
findFinds files by filenamefind image.pngLooking for specific files in node libraries
grepFinds specific text in a a specific file grep some_text index.jssearch for code references inside a specific fileReference (opens in a new tab)
grep to a fileCopy results of a grep search into a text filegrep some_text index.js > grep_result.txtIf the grep results are too large to properly analyze, such as grepping in a log file, dump into a text file for ease of useCan also use the 'pipe' instead of the 'right carrot' > to 'pipe' out text to a file, it just doens't work in this markdown syntax for reasons only I know, or you can look at the code in github (opens in a new tab) and you'll get what I mean. Or peek the raw code (opens in a new tab)
touchCreates a new filetouch blah.txtWhile working in Bash, if you need to create a placeholder file quickly, use this commandReference (opens in a new tab)Typically I use this when writing a new app and need an index.js file to get started, I will type touch index.js and can write a quick hello world script using VIM and run the app.
topShows list of all running servicestopIf your app is running slow, type top to see if any processes are eating up too much CPU, it could even be your app. Find the PID (process id) and kill it.See kill command below to actually kill a process
killKills a specific processkill 9999If you need to stop a specific process