7

I am trying to follow Introduction to bash for data analysis. It has a line of commands as: open ~/.bash_profile.

The tutorial is on Mac computers, but on the comments section it says that I can also do it on Ubuntu through VirtualBox

But this command is not recognized on Ubuntu:

the command 'Open' not working on Ubuntu Terminal

Is there any alternative on Ubuntu that I can use instead of open command?

Kulfy
  • 18,154
hmd
  • 73

3 Answers3

9

In linux, xdg-open will open a file with the associated application.

xdg-open ~/.bashrc

will open the configuration file .bashrc located in your home folder (represented here by the shortcut notation ~/ with your default text editor.

vanadium
  • 97,564
2

You can try gedit instead. I believe what you're trying to do is opening the file in a text editor.

1

From man open on macos:

The open command opens a file (or a directory or URL), just as if you had
double-clicked the file's icon. If no application name is specified, the
default application as determined via LaunchServices is used to open the
specified files.

So what that commend is doing is just opening the file in whatever the default editor is. Since ~/bash_profile is a plain text config file, you can open it directly using whatever text editor you prefer (e.g. gedit ~/bash_profile , nano ~/bash_profile, etc.).

There are also a few options for opening with an automatic default editor

  • xdg-open
  • gnome-open

My personal preference is to be more intentional with what programs I'm using. However you can try out those options and see what works, and what works best for you.