Cheap Web Hosting   Cheap Web Hosting and Domain Registration Directory
Domain Registration

SALE: .com $7.47, .info $1.99, .net $6.49, .org $7.99

NEW: .bz $12.99, .nl $14.99, .es $14.99 .it $14.99

  • $7.47 .com domain
  • $6.49 .net domain
  • $1.99 .info domain
  • $7.99 .org domain
  • $3.40 web hosting
  • $9.99 .co.uk
  • Login
    Username:

    Password:


    Lost Password?

    Register now!
    Search
    Webmasters
    Hosting Article :: Technical & Security

    How To Not Break Your Config Files


    ev1
    After reading through this forum, I have noticed a dangerous trend. Every post I have read that suggests editing a file, suggests the use of pico. Some even point out where your cursor needs to be in order to save without breaking the file. Pico is a dangerous editor for system files and used by a new admin or used in a sloppy manner can leave line breaks that will even keep your system from booting.

    Installed on every RS image is a standard *nix text editor known as vi, vi is easy to use for simple things and much more powerful than pico ever thought of being. But I am not here to proselytize, I am posting this so new admins will not be left in the dark. This is a simple quick reference of how to open a file in vi, edit it, save, and exit; all without the danger of extra line breaks. (typos are your own problem)

    To open a file in vi for editing you simply type vi , this will open the file in view mode, you cannot make changes to the file yet.

    If it is a short file and you do not need to search for anything in the file, simply use the arrow keys to locate where you would like to make changes and hit i this puts you in insert mode, you can now change text.

    If you need to search for text in the file simply hit the / and then type the text you need to search for. If you need to repeat a search hititng / then will repeat the last search. If you are in insert mode, hit and then / to search.

    Once you are satisfied that you have made the changes you need to make and are ready to save hit the then : , this will put you in command mode after hitting the and : just type x and hit enter, and the file will save and you will exit vi. If you need to quit without saving all you have to do is type q! instead of x

    Vi is not easy to get used to, but with four simple commands I have shown you how to edit files easily. Aside from your own typos, there is no risk of vi adding line breaks that you do not want or even know about to your files. As in everything in life it is better to be safe than sorry.

    These are links to sites that will help you learn more about vi should you choose to do so:
    << IP Alert rule to put into iptables for the ping alert Dummy HOW-TO log into your server using SSH >>
    Trackback
    • URL: http://www.hostsdepot.com/modules/article/view.article.php/c14/14
    • Trackback: http://www.hostsdepot.com/modules/article/trackback.php/14
    API: Toolkit PM Email PDF Bookmark Print | RSS | RDF | ATOM
    Copyright© Hostsdepot & Web Hosting Directory
     
    The comments are owned by the poster. We aren't responsible for their content.
    Main Menu
    Hosting


    Powered by Cheap Web Hosting Directory     Cheap Web Hosting Domain Names Expired Domains