Snippets about cmd
53 snippets
-
SNP153
Find the slowest pages in a Stati 2 build
The metrics count the templates each page really rendered now, and the cache manifest names them.
11 lines of sh in 2 blocks, 18 lines of explanation.
#64A -
SNP143
Trusted certificates for localhost with mkcert
HTTPS on your dev server without the browser warning, in three commands.
8 lines of sh and js in 2 blocks, 10 lines of explanation.
#46B -
SNP139
Tail CloudWatch logs
Watch a Lambda's logs live, from the terminal, like tail -f.
3 lines of sh in 3 blocks, 5 lines of explanation.
#369 -
SNP138
Resize images in bulk with ImageMagick
Shrink a folder of photos for the web in one command.
3 lines of sh in 2 blocks, 10 lines of explanation with 4 notes.
#13B -
SNP136
Open WSL folders in Explorer and the other way around
Moving between the Linux and the Windows side without copying files.
3 lines of sh in 3 blocks, 9 lines of explanation.
#A51 -
SNP130
Find the slowest pages in a Stati build
Build metrics, the HTML report, and two jq one-liners.
8 lines of sh in 2 blocks, 13 lines of explanation.
#316 -
SNP125
Run a throwaway container with the current folder mounted
Try a tool, a Node version or a Python version without installing anything.
2 lines of sh in 2 blocks, 10 lines of explanation with 4 notes.
#A45 -
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 -
SNP120
Reverse proxy a Node app with nginx
Your app listens on 3000, the world talks to nginx on 443.
18 lines of nginx and sh in 2 blocks, 3 lines of explanation.
#593 -
SNP119
Copy your public key to a server
One command instead of pasting into authorized_keys by hand.
3 lines of sh in 3 blocks, 5 lines of explanation.
#1B5 -
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 -
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 -
SNP109
stati invalidate cheat sheet
Clear Stati's build cache by tag, path, glob or age, and what each query really matches.
17 lines of sh in 1 block, 10 lines of explanation with 4 notes.
#942 -
SNP108
Purge the Cloudflare cache from the terminal
After a deploy, make Cloudflare forget the old pages, without clicking through the dashboard.
5 lines of sh in 2 blocks, 5 lines of explanation.
#3B6 -
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.
#64B -
SNP103
Scale pixel art video without blur in ffmpeg
Recording a 320 × 180 game and uploading it at 1080p without the smear.
2 lines of sh in 2 blocks, 5 lines of explanation.
#359 -
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 -
SNP097
Switch AWS CLI profiles
Work and personal accounts in one terminal without mixing them up.
5 lines of sh in 4 blocks, 6 lines of explanation.
#935 -
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 -
SNP095
jq basics
Read, filter and reshape JSON in the terminal.
7 lines of sh in 3 blocks, 6 lines of explanation.
#4B2 -
SNP086
Sync a folder to S3
Upload a built site to a bucket, sending only what changed.
5 lines of sh in 2 blocks, 5 lines of explanation.
#3B1 -
SNP083
Tunnel to a remote database over SSH
Use your local database tools on a server's database that isn't exposed to the internet.
2 lines of sh in 2 blocks, 7 lines of explanation.
#962 -
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.
#259 -
SNP074
Upscale pixel art with ImageMagick without blur
Turn a 32 px sprite into a 256 px image where every pixel stays a square.
2 lines of sh in 2 blocks, 7 lines of explanation.
#52B -
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 -
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 -
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.
#513 -
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 -
SNP058
Send JSON with curl
POST a JSON body to an API from the terminal, and read the answer.
5 lines of sh in 2 blocks, 4 lines of explanation.
#B12 -
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 -
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 -
SNP046
Open a shell in a running container
Poke around inside a container to see what it actually looks like in there.
3 lines of sh in 3 blocks, 4 lines of explanation.
#B27 -
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.
#591 -
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.
#369 -
SNP037
Redirect www and http to https in nginx
One canonical address for your site, everything else gets a 301.
23 lines of nginx and sh in 2 blocks, 1 line of explanation.
#529 -
SNP035
Trim a video without re-encoding with ffmpeg
Cut a clip out of a long recording in a second, with no quality loss.
2 lines of sh in 2 blocks, 4 lines of explanation.
#397 -
SNP033
Dump and restore a MariaDB database
Backups, moving a database to another server, or copying production to your machine.
4 lines of sh in 3 blocks, 6 lines of explanation.
#953 -
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 -
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 -
SNP025
Clean up Docker disk space
Docker quietly ate 40 GB of my disk. Here is how to get it back.
3 lines of sh in 3 blocks, 6 lines of explanation.
#A42 -
SNP023
SSH config aliases
Stop typing user@very-long-hostname.example.com -p 2222 every single time.
10 lines of sh in 2 blocks, 4 lines of explanation.
#159 -
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 -
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 -
SNP011
Add more VSFTPD virtual user accounts
How to add more virtual user accounts to your VSFTPD on linux.
7 lines of sh in 3 blocks, 3 lines of explanation.
#419 -
SNP010
Mount samba share on Ubuntu 20.04 server
How to mount samba shares on the latest Ubuntu LTS release.
3 lines of sh in 3 blocks, 4 lines of explanation.
#2B1 -
SNP009
Compress and extract TAR files on linux
How to compress and extract TAR files on linux with gzip easily.
3 lines of sh in 3 blocks, 8 lines of explanation with 4 notes.
#65B -
SNP008
File sizes on linux
See files sizes easily in megabyte or gigabyte values.
2 lines of sh in 2 blocks, 3 lines of explanation.
#513 -
SNP007
Reset MariaDB root password on linux
An easy way to reset the password of the root user on linux.
11 lines of sh in 8 blocks, 11 lines of explanation.
#139 -
SNP006
Fix MariaDB missing tables on Manjaro/Arch linux
Here is how to fix the missing tables in MariaDB that you may encounter on a fresh install on Manjaro or Arch linux.
8 lines of sh in 5 blocks, 8 lines of explanation.
#931 -
SNP005
List all users and groups on linux
Simple way to check your user list with your groups.
3 lines of sh in 3 blocks, 3 lines of explanation.
#962 -
SNP004
Chown basics on linux
Change the owner of files on a linux machine.
4 lines of sh in 4 blocks, 4 lines of explanation.
#523 -
SNP002
Ubuntu run command in the background
Sometimes you just need to run commands in the background.
1 line of sh in 1 block, 1 line of explanation.
#123 -
SNP001
Certbot snippets
Useful commands for SSL cert generation with Certbot.
4 lines of sh in 3 blocks, 3 lines of explanation.
#26A