Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How To Edit a File in the Unix?

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not familiar with the Unix. It so happens that I have to edit a file in the Unix.

The file is .kshre and all I have to do are

1. append a string to my path
2. add four lines to the .kshre file

I use the Putty to logon to my account. I think I should type

vi -r

in the command window. And I do not know what to do next. Could anybody guide me? Thanks.
 
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Despite being a unix dweeb from way back (and being told on multiple occasions that I "look" like a unix hacker -- whatever that means) I've never come to terms with vi.

You might find pico a more user-friendly alternative.
 
author
Posts: 23912
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I use the Putty to logon to my account. I think I should type

vi -r

in the command window. And I do not know what to do next. Could anybody guide me? Thanks.




Well, I'll give this one a shot...

First, just use... "vi filename.ext" instead of the "-r" option to open the file that you want.

Second, cursor controls may not work -- older version of "vi" did not really support it. Just try to move the cursor. If you get junk, just disconnect and try again.

If cursor control doesn't work, use the letters "h", "j", "k", and "l", to move the cursor around. I believe the leftmost key moves the cursor left, and the rightmost key move the cursor right. Don't remember which of the two remaining keys are for up and down.

Third, when you are over a letter, pressing "x" will delete the letter.

Fourth, when you want to insert something, pressing "i" will put you in insert mode. At this point, just type what you want to insert. Pressing the "esc" key should take you out of insert mode.

Fifth, pressing "a" will put you into append mode. This is the same as insert mode, except you will insert after the current letter. This is good for adding stuff at the end of the line.

And finally, when you are done... make sure you are not in insert or append mode.

Pressing ":" will make a prompt appear on the bottom. Entering a "w" followed by a return will save the file back.

Pressing ":q" followed by a return will exit vi.

Henry
[ May 13, 2006: Message edited by: Henry Wong ]
 
Bartender
Posts: 1094
19
Mac OS X IntelliJ IDE Oracle Spring VI Editor Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This Graphical vi/vim Cheat Sheet and Tutorial may help.

This vi basic editing should be a good start.
 
Daniel Gee
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for overwhelming responses. I think that I am able to do some editing on my own now.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic