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 used to work on the Mac terminal before and I used:

open file2open.pdf

and the PDF file would be opened on preview or whatever my default viewer was. When I use it in the terminal in Ubuntu I get this error message:

Couldn't get a file descriptor referring to the console
share|improve this question
Ubuntu is not Mac (just pointing that out). – RolandiXor May 16 '11 at 21:24
@Roland but mac claims to be a unix based system, so I assumed the terminal would behave the same atleast – yayu May 16 '11 at 22:47
Linux is not Unix. – RolandiXor May 17 '11 at 0:44
Linux is what Unix wanted to be, when it was growing up. – david6 Nov 20 '11 at 21:51
You can use fbi (Linux frame buffer image viewer) apt-get -y install fbi fbgs arch.pdf man fbgs for color and resolutions. – user195833 Sep 24 '13 at 21:45
up vote 105 down vote accepted

You can use:


(xxx = some file extension). With this command gnome will invoke the default app for "xxx" (for example evince if you want to open pdf).

Or specifically:

evince file2open.pdf

Or (default for KDE):

okular file2open.pdf
share|improve this answer
So there is absolutely no way to view the text of a pdf file inside the terminal? With the pictures removed or converted to ASCII art? – Vorac Nov 14 '13 at 12:27
That is another question. You can view with less. Example: less my-file.pdf – desgua Nov 16 '13 at 21:34
when using evince your document closes after you close the terminal. xdg-open per the elmicha's answer worked wll for me. – Jon49 Oct 30 '14 at 4:11
For gnome (3) this needs libgnome2-bin which is not installed by default. – Lode Nov 17 '15 at 13:57

You can also use:

xdg-open foo.pdf

xdg-open works in Gnome, KDE, xfce, LXDE and perhaps on other desktops.

You can put an alias in your ~/.bash_aliases:

alias open=xdg-open
share|improve this answer
+1. This is what chrome for one uses. It supports URIS as well (e.g. xdg-open irc://...). Pretty cool. – crazy2be May 16 '11 at 23:59
this is the proper answer not the one above, and this will work with all modern DEs. – OneOfOne May 17 '11 at 4:57

For all those lost Mac users in Ubuntu-land ..

Edit your .bashrc file, and add:

alias open='gnome-open'

Then you can just use:

open file2open.pdf
share|improve this answer

if you have Document Viewer installed type the following command:

evince Name_of_pdf_file

if it is not already installed you can install it firstly using the following command:

sudo apt-get install evince
share|improve this answer
You could add on how to install it when it isn't – MadMike Oct 23 '14 at 9:51

If you want to view PDF within Terminal (Command Line Interface), try to use zathura.

Install Zathura sudo apt-get install zathura -y.

To view a PDF file just run => zathura /path/to/xxx.pdf

BTW: zathura requires X11 anyway, it doesn't work on Servers with no X installed.

share|improve this answer

You can also use

ooffice filename.pdf

to open your file in open office.

share|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – Pilot6 Jun 19 '15 at 9:10
@Pilot6 This looks like an answer to me. – Seth Jun 20 '15 at 2:57

I personally use a shell script:

$ cat pdf
#! /bin/bash

gnome-open ${1:-*.pdf}

When you call pdf it will open all pdfs in the current directory, specify which pdf by supplying an argument. I have many directories containing but one pdf file (e.g. so many LaTeX directories) so only having to write pdf saves me quite some time and keystrokes.

share|improve this answer

if the pdf is simple...

pdftotext -layout file2open.pdf - | more
share|improve this answer

You can define the following function in your ~/.bashrc

open () {
     read -p "Enter File Name: " ; xdg-open "$REPLY"
share|improve this answer
open () { read -p "Enter File /location/Name: " ; ''xdg-open $REPLY'' } – user277818 May 4 '14 at 13:07

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.