Commands by seabre (1)

  • Extract a color palette from a image useful for designers. Example usage: extract-palette myawesomeimage.jpg 4 Where the first argument is the image you want to extract a palette from. The second argument is the number of colors you want. It may be the case where you want to change the search space. In that case, change the -resize argument to a bigger or smaller result. See the ImageMagick documentation for the -resize argument. Show Sample Output

    extract-palette() { convert "$1" -resize 300x -dither None -colors "$2" txt: | tail -n +2 | tr -s ' ' | cut -d ' ' -f 3 | sort | uniq -c | sort -rn | tr -s ' ' | cut -d ' ' -f 3;}
    seabre · 2017-06-21 22:07:26 0

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

Look for English words in /dev/urandom
* to get the English dictionary: wget

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Using bash inline
There are two ways to use "here documents" with bash to fill stdin: The following example shows use with the "bc" command. a) Using a delimiter at the end of data: $ less-than less-than eeooff bc > k=1024 > m=k*k > g=k*m > g > eeooff 1073741824 b) using the "inline" verion with three less-than symbols: $ less-than less-than less-than "k=1024; m=k*k; g=k*m; g" bc 1073741824 One nice advantage of using the triple less-than version is that the command can easily be recalled from command line history and re-executed. PS: in this "description", I had to use the name "less-than" to represent the less-than symbol because the commandlinefu input text box seems to eat up the real less-than symbols. Odd.

Stop Flash from tracking everything you do.
Brute force way to block all LSO cookies on a Linux system with the non-free Flash browser plugin. Works just fine for my needs. Enjoy.

Check syntax for all PHP files in the current directory and all subdirectories

Quickly get summary of sizes for files and folders
Use this as a quick and simple alternative to the slightly verbose "du -s --max-depth=1"

convert UNIX timestamp to UTC timestamp
date -ud @1320198157

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Say something out loud
Whatever arguments you pass will be spoken out loud. (Put it in a script or shell function.)

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: