Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 am new to ubuntu and I would like to know how to open a simple text file or open a video or a picture via the terminal

share|improve this question

If you wish to open files in graphical applications from the command line, such as within gnome-terminal or xterm then simply run:

xdg-open $file

And it will open $file in an appropriate application for that file. The argument can also be a URL, so


will open this site in your browser, and:


should open your default mail program's composer, with in the To: field.

If what you want to view videos on a virtual terminal, without Xorg, you can use mplayer with the directfb, fbdev, fbdev2, sdl (with the frame buffer back-end), or svga as the video output, by running

mplayer -vo fbdev2 file.mpg

For example. For still images, you can install the fbi package, and use it to display images on a framebuffer.

share|improve this answer
I forgot about xdg-open. xD But they were not specific about whether they have only the terminal, or whether they have the GUI, so I assumed worst-case in that they only have a terminal and no GUI... – Thomas Ward Nov 30 '13 at 0:58

To open a text file, you can use nano /path/to/file where /path/to/file is the location on the computer your file is stored, with the actual name of the file at the end (so, if you downloaded it into your Downloads directory and your username is "example", and the file is named "test.txt", then you can do nano /home/example/Downloads/text.txt).

(This is a half-answer)

share|improve this answer

To open a video from terminal

  • First install vlc player by running the below commands on terminal

    sudo add-apt-repository ppa:videolan/stable-daily
    sudo apt-get update
    sudo apt-get install vlc
  • Then go into the directory which contains videos you want to play,

    cd /path/to/the/directory/which/contains/videos
  • Play the video from terminal using vlc player,

    vlc "videofilename.fileformat"

To open a picture from terminal,

  • Install shotwell to open a picture via terminal,

    sudo add-apt-repository ppa:yorba/ppa
    sudo apt-get update
    sudo apt-get install shotwell
  • Then go into the directory which contain picture you want to open,

    cd /path/to/the/directory/which/contains/picture
  • Open the picture via terminal using shotwell,

    shotwell "picturefilename.fileformat"
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.