diff --git a/dot_config/private_fish/functions/random_free_port.fish b/dot_config/private_fish/functions/random_free_port.fish new file mode 100644 index 0000000000000000000000000000000000000000..8bdad7aa2409cbffee7a158edeae305729596e08 --- /dev/null +++ b/dot_config/private_fish/functions/random_free_port.fish @@ -0,0 +1,7 @@ +function random_free_port --description 'Print a random unprivileged port not currently in use' + set -l p (shuf -i 1024-65535 -n 1) + while ss -tuln | string match -qr ":$p\$" + set p (shuf -i 1024-65535 -n 1) + end + echo $p +end