If sometimes your Mac Multimedia Controls are not enough, and you don't want to change application scope or pause your work, iTunes CLI is the best way to do some basic stuff from your terminal.
itunes start - Starts iTunes if not yet started
itunes status - Shows iTunes' status, current artist, track and all tracks in current playlist.
itunes pause - Pause music
itunes play - Unpause music
itunes prev/next - Goes to previous/next song in the playlist
itunes mute/unmute - Nothing to say here :)
itunes vol <val> - Sets the volume to given value (0-100%)
itunes albums - Shows the full list of albums (takes some time)
itunes search - Plays given album, e.g.
itunes search 'Once Again' # Playing Barclay James Harvest - Once Again itunes search 'Pawn' # Playing Van der Graaf Generator - Pawn Hearts # etc...
itunes stop - Stops music
itunes quit - Quits the player
To use the script, you have to save it in a file and then include in the .bash_profile(Mac) / .bashrc(Linux) file.
cd ~ mkdir .termscripts cd .termscripts mkdir .itunes cd .itunes curl -O https://gist.github.com/mateuszgachowski-snippets/7833114/raw/302f866ce25de20a65ecd8d6491132cb23d661d8/itunes.sh vim ~/.bash_profile # iTunes alias itunes='~/.termscripts/itunes/itunes.sh' ## save the file source ~/.bash_profile
From now your
itunes command should be available everywhere ;)
That's all, I hope that helps!