Cloud-9: How to open a file in the c9-editor from c9-terminal
Asked Answered
T

6

40

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.

Toh answered 19/1, 2015 at 15:34 Comment(0)
P
53

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, then doing c9 file.ext or c9 open file.ext

Protest answered 20/1, 2015 at 14:5 Comment(5)
Tried it, doesn´t work for files outside of the file tree (workspace path). Error: "No files found that match [FILENAME]"Toh
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.Protest
Just tried this and it worked great (without restarting the workspace even)!Sapient
Old thread, but I was looking for this solution, too. Now this works without restarting the workspace.Phaih
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?Tonetic
J
14

Borrowing from here,

c9 open <filename>
Javelin answered 10/8, 2015 at 0:29 Comment(2)
I get a "bash: c9: command not found". Where do I find the c9 command line client?Toh
See Brady's answer... you may need to install c9 first with something like sudo npm install -g c9.Sapient
C
10

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.

Crime answered 21/12, 2015 at 12:57 Comment(0)
P
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?

Pruritus answered 15/8, 2015 at 11:7 Comment(0)
S
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.

Subsocial answered 5/7, 2016 at 17:26 Comment(0)
P
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.

Phenobarbitone answered 13/2, 2018 at 11:16 Comment(1)
or install c9 as sudoPhenobarbitone

© 2022 - 2025 — McMap. All rights reserved.