How to Solve Couldn't Get a File Descriptor Referring to the Console Error in Ubuntu Bash
We can use the command line to open a file in Linux. However, use the suitable command according to the file type you open.
This article will explain how to solve the Couldn't get a file descriptor referring to the console
error when using the open
command in Ubuntu.
Solve Couldn't get a file descriptor referring to the console
Error in Ubuntu Bash
The open
command on Ubuntu does not perform the same function as the open
command on MAC. It is an alias for the openvt
command and opens virtual terminals, not files.
If you try to open a file with this command, you will get the Couldn't get a file descriptor referring to the console
error. You should use the xdg-open
command in Ubuntu to open files correctly.
The xdg-open
command opens a file or URL in the default application. If a URL is provided, the URL will be opened in the default web browser.
If a file is provided, the file will be opened in the default application for files of that type.
xdg-open filename
In addition to this command, you can also use different commands for different file types.
For example, nano
is a text editor application for the terminal. Use the command below to open text files.
nano file.txt
Shotwell
is a digital photo organizer designed for the GNOME
desktop environment. It supports JPEG
, PNG
, TIFF
, BMP
, GIF
, WebP
, RAW
photo files and video files.
You can use the following command to open image and video files.
shotwell image.png
The Evince
is a document viewer application for the GNOME
desktop environment. It supports PDF
, Postscript
, djvu
, tiff
, dvi
, XPS
, and many other document formats.
You can use the following command to open pdf files.
evince file.pdf
You can also open all other files of different types in Linux Bash by selecting the appropriate application.
Yahya Irmak has experience in full stack technologies such as Java, Spring Boot, JavaScript, CSS, HTML.
LinkedIn