Play MP3’s and other music from the command line

Ever wanted to play music while you’re working in the command line? With the command line tool ‘afplay’ you can do just that, you can play practically any audio file from the Terminal, just type:

afplay /path/to/audiofile.mp3

You can then stop it with Control-C, otherwise the song will play itself through then terminate. If you’d rather afplay run in the background while playing audio, use this command:

afplay /path/to/audiofile.mp3 &

This launches afplay into the background, if you want to shut it up you can just kill the process with:

killall afplay

Not that I’m condoning this type of behavior, but I recently used the afplay command to play a pretty amusing prank on a coworker by SSHing into his work machine and forcing him to listen to a Miley Cyrus song, he didn’t figure out what was going on until it was over and I told him.

Related Posts with Thumbnails

One Comment

» Comments RSS Feed

  1. Tony says:

    kill, instead of killall should do it, also, you can bring the program to the foreground with fg, then crtl-c

Leave a Reply

 

Save big on Apple & Mac Deals from Amazon.com

Recent Comments

Shared on Facebook

Support Us

Mac Picks

iPhone & iPad Picks

Mac from PC Picks