• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 67746
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: 23951
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: 1155
20
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.
 
Just the other day, I was thinking ... about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic