When you want a fast and simple way to execute short Terminal command lines, you can create new “Terminal command” item. Just enter the commands in editing window just as you would in Terminal, and they will get executed when you double click on an item or choose “Run command” from right click menu.
“Terminal command” items can accept arguments via drag and drop. You can drag and drop a file on a command item and fullpath to dropped file will get passed to the command through tag “<args>“. You can also drag multiple files on command item at once, command will be executed for each dragged file independently.
Example 1:
This set of commands will receive dragged image files, make a copy of each file, and resize each image proportionally so it fits the 512px x 512px size.
MYDIR=`dirname "<args>"` MYFILE=`basename "<args>"` DUPLICATE="$MYDIR/Copy of $MYFILE" cp "<args>" "$DUPLICATE" sips -Z 512 "$DUPLICATE"
Example 2:
Next command can be useful if you want to copy all filenames in dragged folder to clipboard.
ls '<args>' | pbcopy
Example 3:
This command will run PHP script with a path of a dragged file as an argument.
php /path/to/script/scriptToExecute.php '<args>'
That way, you can wrap complex processing commands and workflows into an external scripts that can easily be executed through Essentials.
Useful Shell scripts and Terminal commands
A Collection of 250+ Terminal Commands, Hacks, Tips and Tuts for Mac OS X
