Don’t you need a pdf-viewer to view a pdf file?
$ evince name-of-the-file.pdf
You have two problems in your command …
For one you can’t add filenames with space, it’s better practice to use dash or underscores. However, if you have space you can use brackets or / I think to avoid problems with blank space in file name. I generally begin typing the filename in the directory of interest and hit
tab for autocomplete.
Something like that:
Also you may want to indicate with wich program to use to open your file. For example with okular you simply use
okular file.pdf else your terminal doesn’t know which program to use, could be xed, inkscape or other.
open is a MacOS command. It shouldn’t work on Linux distros (at least not without a plugin/ script)
To open files via a Linux terminal, you write name of application followed by the filename.
Of course, the application should be capable of opening given file/directory.
thunar ~/Desktop mpv video.mp4 feh picture.png zathura document.pdf firefox endeavouros.com
… and so on. You can use any other application you like.
Also, as @Zircon34 mentions in last post, you either enclose filename/ filepath in quotes (
evince "~/my file name.pdf" ) or prefix spaces with
\ . (
evince ~/my\ file\ name.pdf ).
open, the closest you can get on Linux without third party stuff is
xdg-open. It is used pretty much the same way as
xdg-open ~/Desktop xdg-open video.mp4 xdg-open picture.png xdg-open document.pdf xdg-open endeavouros.com
I’m not sure if
open detaches process from terminal or not.
xdg-open does not do that. You can achieve that using
nohup xdg-open ~/Desktop
Now, even if you close the terminal, your file manager won’t close.
Re. filenames in Linux:
alias open='xdg-open' ?
Nice to see someone using the terminal the proper way!
~/.bashrc file and add this line to it:
alias open='xdg-open >/dev/null 2>&1'
Close and open your terminal. Then you can just:
And it will be the same as opening it with your file manager of choice.
Yeah, you don’t want any
stderr polluting your terminal when you just want to open a file.
Linux is not unix!
@StarDust A practical solution to avoiding invalid paths/filenames on Linux is to use Tab-completion always. Try it by beginning to type a folder or file and press
Tab on your keyboard as often as it takes to display the name you want, then continue typing and start
tab-ing again. The more you type before
tab-ing, the better precision tab completion has.
Yo this worked! Thanks everyone
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.