Simple bash script to shorten URLs with YOURLS
Go to file
Sophia Atkinson d7b733fd39
2024-04-12 20:37:50 -07:00
LICENSE Initial commit 2021-06-06 17:28:35 +02:00 Update 2024-04-12 20:37:50 -07:00
yourls Made the script a tad bit better 2024-04-03 17:51:34 -07:00

YOURLS BASH Listed in Awesome YOURLS!

A simple bash script to shorten URLs with YOURLS



# using wget
$> wget -q
# using curl
$> curl -s -o yourls

Then, edit the two parameters at the beginning of the script (YOURLS_HOST and YOURLS_KEY) to match your setup.

Depending on your setup, you may want to make this file executable (chmod +x yourls) and in your $PATH (eg ~/bin maybe)


Shorten a long URL :

$> yourls

Shorten a long URL and provide a custom keyword and a custom title :

$> yourls -k test12 --title "Some title"

Shorten a URL and receive JSON output, for instance to display with jq :

$> yourls -f json | jq
  "url": {
    "keyword": "Nzs",
    "url": "",
    "title": "Example Domain",
    "date": "2021-06-06 16:03:44",
    "ip": ""
  "status": "success",
  "message": " added to database",
  "title": "Example Domain",
  "shorturl": "http://sho.rt/Nzs",
  "statusCode": 200

Display help message :

$> yourls --help


Do whatever the hell you want with it