Find the answer to your Linux question:
Results 1 to 6 of 6
Ok so this all might be really basic stuff, but I'm new to linux so any help would be great. I'm using a terminal (putty) to connect to a server ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6

    Help Please

    Ok so this all might be really basic stuff, but I'm new to linux so any help would be great.
    I'm using a terminal (putty) to connect to a server in order to run a program called Mocadi (used to do simulations for high energy physics experiments). So I've gotten as far as connecting to the server (which I can tell you nothing about so I don't even know if this is the right place to be posting this) and navigating through the directories to find the file and program I need. I can run the program but then it says it can't find the file (which I believe is something else that needs to be sorted out). My biggest problem is I don't know how to open the input file as a text document in Vim (which is the text editor I have) and then how would I save it back to the server. I need to be modifying this input file and running it and seeing how the output is but my problem is really how to modify it because I don't know how to open it outside of the window and then how would I save it back to the server? Hopefully this is something simple and I just don't know because I'm new to Linux.

    Thanks for any help.

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,939
    I'm not sure if this is what you want but to use vi or vim you navigate to the directory where the file is in a konsole/terminal, then type vi (or vim, I've always used vi so not sure which way it will work for you) and the name of the file:
    vi nameoffile
    the file should open in the terminal and you need to hit the lower-case letter I (eye) to insert, make your changes (need to navigate in the document using the arrow keys), when you have finished, hit the ESC key and enter: :wq, to save and quit.
    Hope this helps.

  3. #3
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Hello,

    VIM is a character mode visual text editor. This means, it runs on the remote computer you are logged in and you control it directly over your terminal program, which is Putty. As a consequence, every file you save is automatically stored on that remote machine. No transfer of the file to your local computer and back to the server is needed. These are the advantages of such an editor.

    Unfortunately, the key combinations to control the editor are non-intuitive and have to be learned. Usually, you switch to the 'command' mode with ':' and type a shortcut command, e.g. 'w' to "write" and 'q' to "quit". Try 'help'.

  4. #4
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6
    thanks guys i'll give that stuff a try... this is my first time using linux and i'm just starting it for a research job and luckily my boss wont' be around until the 12th so i have a bit of time to sort it out and get some stuff done.

    thanks again (if there's any other stuff i should know... lay it on me)

  5. #5
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Maybe one more tip:

    In the command line part of the Unix world, the equivalent to the F1 key are the man[ual] pages, which are called with "man progname".

  6. #6
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    Quote Originally Posted by cheburns View Post
    thanks again (if there's any other stuff i should know... lay it on me)
    If the file you are editing is outside of your home directory then you will need to have root privileges to edit it (you can look at it without root)

    You don't say what distro your server runs so there are a couple of possibilities

    1. Ubuntu
    sudo vim yourfilename

    2. most others
    su
    vim yourfilename

    Remember vim is modal so you can't edit by default (press i and then escape to go back to command mode)

    http://www.viemu.com/vi-vim-cheat-sheet.gif may be useful
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...