Skip to content

Instantly share code, notes, and snippets.

@cahilfoley
Last active June 14, 2019 13:14
Show Gist options
  • Save cahilfoley/6c336300842c8bae4e67748c40999586 to your computer and use it in GitHub Desktop.
Save cahilfoley/6c336300842c8bae4e67748c40999586 to your computer and use it in GitHub Desktop.
[Linux Snippets] Useful snippets for developing in linux #linux #node

Linux Config Snippets

Bash Customization

Case Insensitive Tab Completion

echo "set completion-ignore-case on" >> ~/.inputrc
source ~/.bashrc

SSH

Setup Remote Access by SSH Key

  1. Create RSA Key Pair

    ssh-keygen

    NOTE: If an SSH key already exists you will be prompted to overwrite it - Don't do it

  2. Copy the Public Key to the Server Using the ssh-copy-id command if it's available

    ssh-copy-id username@remote_host

    If the ssh-copy-id command isn't available this is an alternative

    cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"
  3. Authenticate to the Server Using SSH Keys

    ssh username@remote_host
  4. Disable Password Authentication on the Server (Optional) Edit the /etc/ssh/sshd_config file and Add the following line (or update it if it exists)

    ...
    PasswordAuthentication no
    ...
    

    Save the file and restart the ssh service by running

    sudo systemctl restart ssh

    Before closing the terminal check that you are able to login from another terminal to avoid getting locked out


Node.js

Cleanup node_modules

Remove all node_modules directories from all subdirectories

find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment