Online command-line thesaurus?

This worked for me:

sudo apt install xclip notify-send dict

and then put this command on some keyboard shortcut

notify-send "$(dict -d moby-thesaurus "$(xclip -o -selection primary)")"

e.g in xfce4, where the above command is contained in the script "thesaurus.sh":

xfconf-query -c xfce4-keyboard-shortcuts -p "/commands/custom/<Super>t" -n -t string -s "thesaurus.sh"

Then highlight the word in question and press Super+t should pop up alternative words.


Wasn't able to run the proposed answer, failed in installation, also seems like thesaurus.com has gone javascript-only. So I quickly wrapped up this as I wanted this myself:

perl -wlE 'use Mojo::JSON qw/decode_json/; use Mojo::UserAgent; my $word = shift; my $tx = Mojo::UserAgent->new->get("https://www.thesaurus.com/browse/" . $word); if ($tx->res->body =~ /<script>window.INITIAL_STATE = (.*?);<\/script>/) { my $json = $1; $json =~ s/\bundefined\b/null/gmx; my @defs = @{ decode_json($json)->{searchData}->{relatedWordsApiData}->{data} }; print "$word:"; for my $def (@defs) { print "  $def->{definition}:"; print "    synonyms: " . join ", ", (map { $_->{term} } @{ $def->{synonyms} }); print "    antonyms: " . join ", ", (map { $_->{term} } @{ $def->{antonyms} }); } } else { die "$word not found" unless $word; }' clumsy
clumsy:
  crude, awkward:
    synonyms: bad-mannered, barbaric, bearish, cantankerous, churlish, cloddish, clodhopping, clownish, clumsy, coarse, countrified, gross, gruff, ill-bred, ill-mannered, impolite, inurbane, loud, loutish, lowbred, oafish, ornery, out-of-line, out-of-order, provincial, rough, rude, rustic, swinish, tasteless, ugly, uncivilized, uncouth, uncultured, uneducated, ungracious, unpoised, unpolished, unrefined, vulgar
    antonyms: delicate, gentle, smooth, sophisticated, refined, polished, nice, exciting, cultured, charming, pleasant, polite, mannerly, kind
  unskillful:
    synonyms: awkward, blundering, bungling, butterfingered, clumsy, gauche, graceless, inept, maladroit, unpolished
    antonyms: 
  vulgar, unpolished in manner:
    synonyms: awkward, backward, barnyard, boorish, cheap, cloddish, clumsy, coarse, crass, dirty, earthy, filthy, foul, grody, gross, ignorant, ill-bred, indecent, indelicate, inelegant, insensible, lewd, loud, loud-mouthed, loutish, lowbred, oafish, obscene, raunchy, raw, rough, rude, savage, smutty, tacky, tactless, uncouth, unenlightened, ungainly, unskillful
    antonyms: formal, polished, gentle, delicate, smooth, nice, pure, decent, clean, sophisticated, refined, stilted, planned, tasteful, moral, kind, polite
  vulgar, unpolished in manner:
    synonyms: awkward, backward, barnyard, boorish, cheap, cloddish, clumsy, coarse, crass, dirty, earthy, filthy, foul, grody, gross, ignorant, ill-bred, indecent, indelicate, inelegant, insensible, lewd, loud, loud-mouthed, loutish, lowbred, oafish, obscene, raunchy, raw, rough, rude, savage, smutty, tacky, tactless, uncouth, unenlightened, ungainly, unskillful
    antonyms: formal, polished, gentle, delicate, smooth, nice, pure, decent, clean, sophisticated, refined, stilted, planned, tasteful, moral, kind, polite
  cumbersome:
    synonyms: awkward, bulky, clumsy, heavy, hefty, ungainly, unmanageable, unwieldy
    antonyms: 
  tactless, unsophisticated:
    synonyms: awkward, bumbling, clumsy, crude, graceless, green, halting, ham-handed, heavy-handed, ignorant, ill-bred, ill-mannered, inelegant, inept, insensitive, lacking, maladroit, oafish, uncouth, uncultured, unhappy, unpolished, wooden
    antonyms: sophisticated, refined, polished, tasteful, tactful, mannerly, graceful, elegant