. Advertisement .
..3..
. Advertisement .
..4..
Hi everyone, I’m learning about programs. While working, I try typing “open (filename)” on Windows bash. As a result, I get the message:
Couldn't find a file descriptor referring to the console
What can I do about the “couldn’t get a file descriptor referring to the console” issue? Is there a better approach?
The cause:
This error occurs because
open
is command which is specific for Mac, you cannot use it under Linux (ubuntu). The functions of Macopen
are performing a file (if the file is executable), opening the file in a text editor (if the file is a text file or document) and opening a directory.Solution:
xdg-open. open
should be used for Mac OS in Linux.open
only is a alias of openvt (open terminal is unreal).To make it simple, you can add this line to ~/.bashrc or ~/.zshrc depending on the shell which is being used.
Next time, you can reduce some keyboard strokes by only typing as the following :
You can also use
xdg-open
instead of open, which does the exact same thing without regard to application. pdf, image, etc. It will open a virtual terminal (I’ve tried it on Linux).Example:
xdg-open ~/Pictures/Wallpapers/myPic.jpg
xdg-open ~/Docs/holidays.pdf