Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


VPS compromised, what to do next? - Page 2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

VPS compromised, what to do next?

2»

Comments

  • laaevlaaev Member

    @NickM said: The first time I tried vi, I was a complete Linux noob. I was doing like my third install or so, and it was Gentoo. I was stuck on the command line, and had no clue how to do anything in vi or even how to close it. I ended up yanking out the power cord in frustration. I haven't touched vi since then.

    Lol, vi is pretty easy to use after you learn how to use it.

  • @FTN_Kevin said: Lol, vi is pretty easy to use after you learn how to use it.

    But is it better than nano?

  • raindog308raindog308 Administrator, Veteran

    @Kairus said: But is it better than nano?

    Yes. Even if it had nothing else, taking some lines and saying "pipe these to awk or sed or whatever with this command and return the result" makes it worth using. Ditto for regex in the editor.

    vi is highly optimized for speed. I'm willing to accept that emacs can be faster since it is infinitely extensible and you can make semantic commands, but otherwise it's vi.

    vi is a power tool. nano is a pretty good tool, too.

  • @raindog308 said: vi is highly optimized for speed.

    Why would i need speed for editing config files or so?

  • @gsrdgrdghd said: Why would i need speed for editing config files or so?

    I assume they mean editing speed. Once you grok vi(m) you can edit text very quickly especially in large files. I use vim exclusively now (apart from at work - .NET :()

  • raindog308raindog308 Administrator, Veteran

    @gsrdgrdghd said: Why would i need speed for editing config files or so?

    I am in the shell all day, popping in and out of files constantly. Anything that makes that faster saves me time.

    vim also allows you to have multiple files open at the same time. I spent last night switching constantly between css/html. oh, syntax highlighting is nice, too :-)

    @StolenToaster said: I use vim exclusively now (apart from at work - .NET :()

    vim runs on Windows :-)

  • netomxnetomx Moderator, Veteran

    @raindog308 said: I am in the shell all day, popping in and out of files constantly. Anything that makes that faster saves me time.

    I just use nano and then CONTROL W to search what I need :P

  • raindog308raindog308 Administrator, Veteran

    @netomx said: I just use nano and then CONTROL W to search what I need :P

    No, the point is that vi is so much faster to use.

    Example of something I did today:

    Had a text file with hundreds of lines like this:

    2012-04-03,1308,http://artemis.example.com/somepath/somefile.html
    

    Want to:

    • take the url alone
    • indent it by one tab
    • change all http to https
    • change the hostname for the first 20 only
    • and then for a dozen or so lines, edit the file name.

    In vi (recreating these commands from memory so please excuse any typos):

    :%!awk -F, '{ print $3 }'
    :s/^http/(control-V)(control-I)https/
    :1,20s/artemis/hades/
    

    ...and then make the other changes by hand as they were all different per line.

    In nano? Forget it. You'd have to edit every single line. What takes seconds turns into 5-10 minutes.

    Yes, you could do what I did with perl, shell, etc. outside the shell (and then I guess you could use nano to edit a shell script to do that :-) But the point is that if you're editing a file in vi, you always have regex, shell, sed/awk/anything you can pipe in/out, etc. at your disposal. That makes it very fast to work with.

    The only real alternative in my mind is emacs, which is a completely different approach.

  • thread derailed, mission accomplished!

    ":D"

    Thanked by 1netomx
  • @raindog308 said: :%!awk -F, '{ print $3 }'

    :s/^http/(control-V)(control-I)https/
    :1,20s/artemis/hades/

    So you can actually just use vi as a more powerful editor if you know dark wizardry

    Thanked by 1raindog308
  • @raindog308 said: vim runs on Windows :-)

    I have it installed for quick edits, but sadly writing C# without VS is like sawing your leg off with a toothpick.

Sign In or Register to comment.