webOS Nation Forums > webOS apps and software > webOS development > Opening files within command line?
Member: sspster
at: 02:40 AM 06/14/2009
Hey everybody, sorry for the amateurish question, but how do you get a file open from within the command line?

For instance, i want to edit the devmode enabler to make it visible, and i know i have to edit this file: /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js


but, when i enter the command
root@castle:/home/user# vi /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js

it simply displays the contents within the command window, leaving me unable to edit it. How do I get them to open within a text editor or something?
Reply
Member: buyrihn
at: 02:49 AM 06/14/2009
I was wondering the same thing. I was going to enable SFTP, but I don't think I should have to, just to edit a file.
Reply
Member: sspster
at: 02:50 AM 06/14/2009
I'm just rooting via usb on a mac. Hopefully it won't have to get that complicated. Most of the instructions i see imply that no file browser is needed.
Reply
Member: joshewah
at: 03:15 AM 06/14/2009
You just have to learn how to use vi, it has an insert mode to change the actual file. I would suggest finding a vi tutorial online if you really want to learn the basics of how it works.
Reply
Member: sspster
at: 03:20 AM 06/14/2009
So if i install a VI client, entering

vi /usr/palm/applications/com.palm.app.devmodeswitcher/appinfo.json

should open the file within Vi instead of just displaying the contents in the terminal window?
Reply
Member: mdmogren
at: 04:20 AM 06/14/2009
Originally Posted by sspster:
So if i install a VI client, entering

vi /usr/palm/applications/com.palm.app.devmodeswitcher/appinfo.json

should open the file within Vi instead of just displaying the contents in the terminal window?
when you see the contents you are using vi - vi defaults to command mode - move to the location where you want to make an edit and press i to change to insert mode - start by googling: vi how to
Reply
Member: joshewah
at: 04:23 AM 06/14/2009
Originally Posted by sspster:
So if i install a VI client, entering

vi /usr/palm/applications/com.palm.app.devmodeswitcher/appinfo.json

should open the file within Vi instead of just displaying the contents in the terminal window?
sspster,
It has vi built in. You just need to know what to type to edit what its displaying is what I meant.

I found a tutorial on youtube:
YouTube - Vi - Vim Tutorial. Howto video for the amazing vim editor.
(vi on the pre won't have the line numbers like theirs but it should work the same)

vi in 10 minutes - part 1
There are lots more tutorials on the web if that ones not clear enough.
Reply
Member: hchavarria
at: 09:22 AM 06/14/2009
Does the pre allow sftp connections? I was trying to transfer some files but couldn't seem to connect. If I transfer a file through usb where is this in root so I can move the file?
Reply
Member: apolzon
at: 10:12 AM 06/14/2009
Personally, I find vi incredibly difficult to use (the thing you're missing is both having perms to edit the file -- sudo will fix this, and you need to hit i in vi in order to enter INSERT mode).
But jove (a slimmed down emacs build) is available in the optware repo, so I would recommend that if you're looking for something a little easier. And nano is there as well, which I would say is the simplest of the unix command line editors.
Reply
Member: buyrihn
at: 12:38 PM 06/14/2009
Originally Posted by apolzon:
Personally, I find vi incredibly difficult to use (the thing you're missing is both having perms to edit the file -- sudo will fix this, and you need to hit i in vi in order to enter INSERT mode).
But jove (a slimmed down emacs build) is available in the optware repo, so I would recommend that if you're looking for something a little easier. And nano is there as well, which I would say is the simplest of the unix command line editors.
I tried to use nano on the Pre, but it didn't work. You mention it being available in the optware repository- could you explain?
Reply

webOS Nation Forums > webOS apps and software > webOS development > Opening files within command line?