39

Is there a way to open a file not from the workspace tree view but from the c9-terminal tab?

Background: c9 doesn´t allow me to set the workspace path to / for a user who doesn´t have write access there. But I´d like have a look around and change files outside of the main project directory (virtual hosts, php ini, etc). Using the terminal I can roam around everywhere my user has read access.

6 Answers 6

50

At the moment, the only way to open a file from the terminal is in vim or by using ls and then clicking on the file you'd like to open.

Edit: You can now open from the terminal by running npm install -g c9, restarting your workspace, then doing c9 file.ext or c9 open file.ext

5
  • Tried it, doesn´t work for files outside of the file tree (workspace path). Error: "No files found that match [FILENAME]"
    – perelin
    Jan 20, 2015 at 18:02
  • Oh I see, I also am unable to open anything below my ubuntu folder. It looks like this is a limitation at the moment and you'll need to use vim to open anything below the ubuntu folder. Jan 21, 2015 at 9:39
  • 1
    Just tried this and it worked great (without restarting the workspace even)!
    – Arel
    Sep 9, 2015 at 6:26
  • 2
    Old thread, but I was looking for this solution, too. Now this works without restarting the workspace.
    – Vince
    Mar 12, 2018 at 22:26
  • Hey, I have this working. However, when collaborating it opens the files for everyone logged into the environment. Is there a way to open files just for me?
    – trixtur
    Aug 16, 2018 at 21:49
14

Borrowing from here,

c9 open <filename>
2
  • I get a "bash: c9: command not found". Where do I find the c9 command line client?
    – perelin
    Aug 12, 2015 at 11:05
  • 2
    See Brady's answer... you may need to install c9 first with something like sudo npm install -g c9.
    – Arel
    Sep 9, 2015 at 6:29
9

You can do the next:

cd ~
ln -s / root

Then you can see the root link in the workspace. You can navigate through it and open any file (If you do not see the ~ folder in your favorites section, mark the 'Show Home in Favorites' option)

Root folder in ~

If you prefer, (once you've installed c9) you can open files from the terminal with:

c9 open ~/root/...

NOTE: You can open files but not save them if they require superuser permissions.

1

If you go to Preferences -> Settings -> Terminal, there is an option "Use Cloud9 as the Default Editor". If you enable this option and open a terminal, the EDITOR env variable will look like this:

$ echo $EDITOR
`which c9` open --wait

The path to c9 in my case is:

/mnt/shared/sbin/c9

For some reason, this didn't work for me initially, but now it works flawlessly. Perhaps the above default editor setting has to be enabled for it to work?

1

I've just written into /mnt/shared/plugins/google.cloud/etc/gitconfig. First I was not allowed to write it, in nano. But using "c9 open" - just closing the tab with .gitconfig saved my changes.

0

If you want to open any file from / the cloud 9 IDE must have permission. While configuring the C9 IDE give root as the user name and copy paste the public key in .ssh folder of root, allow root login in the ssh d config ,then you will be able to edit any file from the IDE.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.