1

Which command should I use to open an MP3 file? For example, "abcd.mp3"

hamza@ubuntu:/media/hamza/Elements/mmc$ cd abcd.mp3
bash: cd: abcd.mp3: Not a directory

3 Answers 3

11

If you want to use the App set as preferred, from the directory containing the MP3 file, use xdg-open:

xdg-open abcd.mp3

From man xdg-open:

xdg-open - opens a file or URL in the user's preferred application

If you know the application you want the MP3 file to be opened with, for example, rhythmbox:

rhythmbox abcd.mp3

or VLC media player:

vlc abcd.mp3
2
  • if you don't have xdg-open, you may have gnome-open Commented Aug 11, 2015 at 14:34
  • 2
    @CiprianTomoiaga gnome-open comes with libreoffice-gtk, xdg-open comes with xdg-utils..it should come by default in Ubuntu..
    – heemayl
    Commented Aug 11, 2015 at 14:36
8

cd means "change directory". A file is not a directory so a cd will not work on your mp3. To open a `.mp3 you need to start a music or video player. The method @heemayl uses will open the player you have set as the default.

If you want you can also use aplay. The command

aplay abcd.mp3

will play the mp3 from command line and stop when it is done playing. "aplay" is probably the lightest music player around since it does not have a GUI (and can also work on a server >:-D )

1
  • aplay does not play mp3 files. It can play voc, wav, raw and au files.
    – Haggra
    Commented Oct 31, 2020 at 15:52
1

If you want to run an MP3 file with a particular application, then run it like:

 application_name audio_file_name

For example, if you want to run in the MPlayer application then install it using:

 sudo apt-get install mplayer

Then run the audio file using the command:

 mplayer  abcd.mp3

or

 sudo apt-get install mpg123
 mpg123 abcd.mp3

or

 sudo apt-get install sox
 play abcd.mp3

or

sudo apt-get install vlc 
vlc abcd.mp3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .