Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want a command line to play a specific music file in terminal (or script) from my hard-disk. It would be better to do it without installing extra packages.

share|improve this question
MoC (Music on Console) is another option worth exploring. Here's a guide to set this up. – legends2k Feb 27 '14 at 16:58
up vote 8 down vote accepted

I think the default installation has no way to play audio files from command line, other than using aplay on WAV files (aplay also support other formats, but the man page is not clear in this regard).

To play, for example, MP3 files, you need restricted codecs available through ubuntu-restricted-extras, and a player like mplayer or cvlc, but there are many other: see What Media Players Are there? where text based and GUI based audio players are listed.

share|improve this answer
ubuntu-restricted-extras is considered as default in Ubuntu(as all have to install it with installation or after)i always install them when setting-up Ubuntu. – Black Block Nov 25 '11 at 18:02
The missed Sox! – Vorac Nov 25 '13 at 12:45
APlay does not play m4a files... or it does, but it sounds like a dialup connection. – Akiva Apr 16 '14 at 7:18

There are players such as cmus, mpg321, ogg123, etc.

enter image description here

share|improve this answer

There are several text based Media Players which play in the Terminal, which are not mentioned in "What Media Players Are There?" ---but they will all involve some download.

(You do say "It would be better to do it without installing extra packages" but you do not say it is a definite no-no)

Have a look at

Worthy of special mention are moc and cmus.

share|improve this answer
A very good collection, thanks. – Black Block Nov 25 '11 at 17:57

Try sudo apt-get install mocand then mocp in a new terminal window.

This will let you play the selected audio from the terminal.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.