Snippets about linux

20 snippets

Back to all snippets

  1. SNP124

    Rerun a command whenever a file changes

    A poor man's watch mode for anything that doesn't have one.

    3 lines of sh in 3 blocks, 6 lines of explanation.

    #316 cmd linux
  2. SNP115

    chmod numbers explained

    What 755 and 644 actually mean, so you stop copying them blindly.

    3 lines of sh in 1 block, 16 lines of explanation.

    #26B cmd linux
  3. SNP113

    Check when an SSL certificate expires from the terminal

    Before the browser warning does it for you.

    4 lines of sh in 3 blocks, 6 lines of explanation.

    #531 cmd ssl linux
  4. SNP104

    Run a Node app as a systemd service

    Start on boot, restart on crash, logs in journalctl. No pm2 needed.

    20 lines of ini and sh in 2 blocks, 6 lines of explanation.

  5. SNP100

    tmux basics

    Start a long job on a server, close the laptop, come back to it later.

    3 lines of sh in 2 blocks, 7 lines of explanation.

    #2B6 cmd tmux linux
  6. SNP096

    Resume a broken download with curl or wget

    The 8 GB ISO died at 97%. Don't start over.

    2 lines of sh in 2 blocks, 6 lines of explanation.

    #163 cmd linux
  7. SNP080

    List listening ports on linux

    What is this server actually exposing to the world?

    1 line of sh in 1 block, 9 lines of explanation with 4 notes.

  8. SNP071

    Find and replace text in many files with sed

    Rename a function across a project from the terminal.

    2 lines of sh in 2 blocks, 7 lines of explanation.

    #426 cmd linux
  9. SNP070

    Disable SSH password login on a server

    Once your key works, close the door the bots keep knocking on.

    5 lines of sh in 3 blocks, 6 lines of explanation.

    #15A cmd ssh linux
  10. SNP065

    Check if a port is open from the terminal

    Is it the firewall, the service, or me?

    2 lines of sh in 2 blocks, 4 lines of explanation.

  11. SNP062

    Find the processes eating your memory

    The server is swapping. Who's responsible?

    3 lines of sh in 3 blocks, 6 lines of explanation.

    #295 cmd linux
  12. SNP051

    Crontab cheat sheet

    The five fields, the shortcuts and the two mistakes everybody makes.

    11 lines of sh in 3 blocks, 5 lines of explanation.

    #941 cmd linux
  13. SNP047

    Copy files with rsync over SSH

    Like scp, but it only sends what changed, and it can resume.

    1 line of sh in 1 block, 9 lines of explanation with 4 notes.

    #459 cmd ssh linux
  14. SNP043

    Create a new user with sudo rights on Ubuntu

    Stop working as root on a fresh server.

    3 lines of sh in 2 blocks, 7 lines of explanation.

  15. SNP041

    Create a swap file on Ubuntu

    Small VPS, no swap, and npm install gets killed. Give it some room.

    7 lines of sh in 3 blocks, 2 lines of explanation.

  16. SNP032

    Generate a random password in the terminal

    No password generator website needed.

    3 lines of sh in 3 blocks, 4 lines of explanation.

    #42B cmd linux
  17. SNP029

    Follow a log file live

    Watch a log as it is being written, with and without systemd.

    2 lines of sh in 2 blocks, 5 lines of explanation.

    #269 cmd linux
  18. SNP021

    Find the largest files and folders on linux

    The disk is full again. Here is how to find what is eating it.

    2 lines of sh in 2 blocks, 8 lines of explanation.

    #24B cmd linux
  19. SNP019

    Kill the process that is using a port

    Find out what is squatting on port 3000 and get rid of it.

    5 lines of sh in 4 blocks, 6 lines of explanation.

    #395 cmd linux
  20. SNP014

    Auto mount Samba share on startup in Manjaro

    Mount your Samba network share on startup. It even works when you are using WiFi.

    1 line of sh in 1 block, 5 lines of explanation.