You are not logged in.

#1 2021-04-03 22:11:33

webbja123
Member
Registered: 2021-03-31
Posts: 23

open command on bash [Solved]

Hi,

   I am transitioning away from Macintosh computers to linux.  On Macintosh, the bash terminal emulator recognizes the 'open' command and will graphically open a file or directory when I type the command `open test.txt`.  It appears that is not the case in the Terminal in Arch Linux with gnome.  Is their a way that I can add this capability to bash in Arch Linux?

Last edited by webbja123 (2021-04-08 00:19:06)

Offline

#2 2021-04-03 22:13:09

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: open command on bash [Solved]

There's no such thing as "graphically open a file or directory". You run a program. Pick one.

Offline

#3 2021-04-03 22:23:31

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,339

Re: open command on bash [Solved]

You are looking for xdg-open and the like: https://wiki.archlinux.org/index.php/De … plications

Online

#4 2021-04-04 05:08:37

NuSkool
Member
Registered: 2015-03-23
Posts: 295

Re: open command on bash [Solved]

V1del wrote:

You are looking for xdg-open

Interesting. xdg-utils got pulled into my system as a dependency.  I was slightly aware of a standard for XDG user and base but never paid much attention or set anything up AFAIK.

Now upon testing xdg-open in a terminal, it in fact does exactly as one would expect. It opens a file in my graphical editor and directories in my file browser. It does not work from the console, but with no setup is to be expected.

So op, you could possibly set up an alias for your shell.


There's no such thing as "graphically open a file or directory".

Must be difficult being so intelligent to miss the obvious based on such technicalities and coming across as rude in replying. lol (this is a joke, appropriate response would be slight smile and light chuckle)

Edit: to strike through inappropriate comment.

Last edited by NuSkool (2021-04-04 19:55:25)


Scripts I Use                                                 :  https://github.com/Cody-Learner
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 7 8745HS w/ Radeon 780M Graphics
grep -m1 'model name' /proc/cpuinfo    : Intel(R) N95
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 5 PRO 2400GE w/ Radeon Vega Graphics

Offline

#5 2021-04-04 12:59:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,505
Website

Re: open command on bash [Solved]

NuSkool wrote:

Must be difficult being so intelligent to miss the obvious based on such technicalities and coming across as rude in replying. lol (this is a joke, appropriate response would be slight smile and light chuckle)

WTF?  That part in parentheses is ridiculous.  You don't get to post a harsh critique of someone's behavior then just dodge responsibility for it by saying they are only alowed to smile and chuckle in reply.  That'd be foul-play whether or not the initial critique was valid.  In this case, it seems pretty valid - though perhaps not presented in a manner most likely to be accepted.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2021-04-04 18:59:51

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,527

Re: open command on bash [Solved]

macOS actually uses zsh since quite a while, not bash. And zsh supports suffix aliases where you don't have to "open" anything.
You just add "alias -s mp4=mpv" to your zshrc and then enter path/to/porn.mp4 and it opens it in mpv.
xdg-open tends to be convoluted, slow and not necessarily using the client you'd like it to (eg. gimp over feh if you actually just want to look at an image and not edit it)

----

That part in parentheses is ridiculous.

It's essentially https://youtu.be/OUXvrWeQU0g?t=10 (no, it's a different clip ;-)

@NuSkool, jokes are funny because the audience gets them.
If you have to explain the joke, you either need a better joke or a better audience.

Offline

#7 2021-04-04 19:17:25

NuSkool
Member
Registered: 2015-03-23
Posts: 295

Re: open command on bash [Solved]

Trilby, you're right. After a bit of self reflection I cannot disagree with you. Actually respect you for calling me out.

In fact I am likely more guilty in a rude delivery than the person I called out. For the fact that what I said was intentional and somewhat emotionally motivated. And myself being someone who rarely contributes here compared to those that do actually help a lot of people, makes it worse on my part as well.

That wouild make me more guilty of being an ahole without question. I had not considered any of this in my reply yesterday.

For some reason I feel I have a "stick up for the newbs" complex, probably because I still consider myself one after ten years compared to some of the talented regulars I see here.

I'm sorry if I thought what was being intentionally rude was not. In that case I owe Scimmia and any readers an apology and have no right to do what I'm calling out in the first place.

If it was intentional, I'd like to say this is not the first time I've thought you have came across that way and would say it's uncalled for.

In either case, my response was inappropriate and I'm sorry for that.


Scripts I Use                                                 :  https://github.com/Cody-Learner
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 7 8745HS w/ Radeon 780M Graphics
grep -m1 'model name' /proc/cpuinfo    : Intel(R) N95
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 5 PRO 2400GE w/ Radeon Vega Graphics

Offline

#8 2021-04-04 21:13:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,505
Website

Re: open command on bash [Solved]

NuSkool wrote:

For some reason I feel I have a "stick up for the newbs" complex

I'm not sure about that, and I don't think it (your intent) is something to be sorry for.  I don't think Scimmia's comment was accurate or appropriate.  My point was you should stick to your guns (and maybe start with small arms rather than nukes, though I'm hardly one to speak on this point).

Last edited by Trilby (2021-04-04 21:14:55)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2021-04-05 02:40:03

webbja123
Member
Registered: 2021-03-31
Posts: 23

Re: open command on bash [Solved]

I took the weekend off and am only now reading the responses.  First of all let me say thank you for the lively answers to my question.  Indeed the recommended package is what I was looking for and yes, while Mac, for the past 1.5-2 years has shipped computers with zsh as the default shell, my computer is older than that and uses bash as the default shell.  With respect to some of the answers, NuSkool, thank you for defending the intent of my question, and yes, while it is possible I have mistaken the intent, Scimmias answer seemed snide and a bit rude.  However, while it is unfortunate, I have come to expect that from time to time on platforms such as this one ask stack overflow.  I have found that you have to have thick skin, and while people may be snide in their responses, even when they are I still learn things from them, which I do appreciate.

Offline

Board footer

Powered by FluxBB