Skip to content

Instantly share code, notes, and snippets.

@alannakelly
Last active October 25, 2017 17:46
Show Gist options
  • Save alannakelly/eba0dad5ed4ca4d9389150118504b3e1 to your computer and use it in GitHub Desktop.
Save alannakelly/eba0dad5ed4ca4d9389150118504b3e1 to your computer and use it in GitHub Desktop.
Useful shell commands

List files containing text

grep -rin '[SEARCH_TEXT]' app | cut -f 1 -d ":"

Delete specific text from file

sed -i '' '/[SEARCH_TEXT]/d' [FILENAME]

Delete specific text from

sed -i '' '/[SEARCH_TEXT]/d' $(grep -rin '[SEARCH_TEXT]' [SEARCH_PATH] | cut -f 1 -d ":")

Delete specfied line from file

sed -i '' -e '[LINE#]d' [FILENAME]

Brutally kill all Rails processes

kill -9 $(ps aux | grep rails | tr -s " " | cut -d " " -f 2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment