Skip to content

Instantly share code, notes, and snippets.

@nicolasramy
Last active August 10, 2021 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolasramy/ea8f5b70abc23f136553 to your computer and use it in GitHub Desktop.
Save nicolasramy/ea8f5b70abc23f136553 to your computer and use it in GitHub Desktop.
[DRAFT] Useful commands and alias

Shell

Nohup

To run command silently

nohup command-with-options &

Kill

To kill a program base on its PROCESS_NAME (don't work perfectly and could be dangerous for some PROCESS_NAME)

ps -ef | grep PROCESS_NAME | grep -v grep | awk '{print $2}' | xargs kill -9

Grep

To search word1 and exclude a word2

grep "word1" | grep -v "word2"

Sed

Remove blank lines in a file

sed '/^$/d' file.input > file.output

OpenSSL

To generate .pem from a RSA key

openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem

To generate .pem from a DSA key

openssl dsa -in ~/.ssh/id_dsa -outform pem > id_dsa.pem

To got to the 21490th byte in the buffer

:goto 21490

To go to line 124

:124

Replace "search" by "replace" in buffer

:%s/search/replace/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment