Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Couldn't find a file descriptor referring to the console" on Ubuntu bash on Windows

I'm new in here and it's my first post.

I have a problem with Bash on Ubuntu on Windows. If I type "open (filename)" on Mac terminal, it opens the file with the right program but if I try to use it on Windows bash, it says: "Couldn't find a file descriptor referring to the console".

I have also tried xdg-open and gnome-open but none of them works. Can someone explain how to fix the issue and how open command works?
Thanks in advance!

like image 507
Pets Avatar asked Feb 26 '17 02:02

Pets


3 Answers

Instead of open u can use xdg-open which does the same thing, independently of application i.e. pdf, image, etc. It will open a new virtual terminal (I have tried this on Linux)

Example:

xdg-open ~/Pictures/Wallpapers/myPic.jpg

xdg-open ~/Docs/holidays.pdf

like image 196
Sharath BJ Avatar answered Nov 18 '22 21:11

Sharath BJ


For linux, use xdg-open. open is for Mac OS. open in linux is an name alias of openvt (open virtual terminal).

To simplify it, you can append the following line to ~/.bashrc or ~/.zshrc depends on the shell you are using.

alias o="xdg-open" # o stands for open 

Then next time you can just type like the following to reduce some keyboard strokes.

o file_name.pdf

like image 42
Lance Avatar answered Nov 18 '22 21:11

Lance


That's because open is a Mac specific command, it is not available under Linux (ubuntu), Mac open can execute a file (if the file is executable), or open the file into a text editor (if it is a document or text file) or open a directory.

like image 24
hcheung Avatar answered Nov 18 '22 20:11

hcheung