Search

Top Posts

Comments

  • mayank: i am having a problem with my macbook airport. it cannot open most of the sites, the reason always shown is...
  • Anon A Moose!: Working in Apple tech support, this tool is freaking invaluable. Do you know how many people call...
  • kyle: hi im mac and im a pc!!!!
  • TheWalrus: Great, thanks for this. Having just started using a Mac as well as my Ubuntu machine, it’s good to...
  • Imre: ….2048*1152

Categories

Recent Posts


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.

Posted by: Paul Horowitz

Share

Save big on Mac Deals from Amazon.com

Comments:

Comments: 1

Comment from Tony
Time: October 30, 2009, 5:29 am

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

Write a comment






October 27th, 2009