Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
8  
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
5  
Linux is not Unix. –  RolandiXor May 17 '11 at 0:44
5  
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

5 Answers 5

up vote 53 down vote accepted

You can use:
gnome-open file2open.xxx (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
1  
That is another question. You can view with less. Example: less my-file.pdf –  desgua Nov 16 '13 at 21:34

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
2  
+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 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.

Enjoy;-)

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 at 13:07

Your Answer

 
discard

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.