Howdy, Stranger!

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


cat outputs different (outdated) result than vi editor
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.

cat outputs different (outdated) result than vi editor

trusty33trusty33 Member
edited September 2019 in Help

🙄 i am really confused by this
it is centos 6 default command line
any idea how to output up to date file content?

Thanked by 1uptime

Comments

  • uptimeuptime Member
    edited September 2019

    Are you actually editing the file in vi? Making changes? Saving the file?

    Some details beyond "I am confuse" might be helpful :smiley:

    EDIT2:

    My best guess without more details is that you might be unfamiliar with how vi works?

    If that is the case, check https://wikihow.com/Learn-vi for some basic instructions

    EDIT3:

    ah, sorry ... that wikihow page is actually pretty lame (but it has pictures, lol)

    Just do this whenever in doubt in vi:

    • press the escape key
    • type :w
    • press the enter key.

    This will save the current editor contents to the file on the disk.

    EDIT4:

    And by "press" I mean "press down briefly and then release" - don't keep holding the key down forever.

    Some people might tell you to "hit" the enter key but that could go wrong in so many ways.

    No hitting.

    Thanked by 1ITLabs
  • tail -F /path/to/file

    Thanked by 2uptime ITLabs
  • @uptime said:
    My best guess without more details is that you might be unfamiliar with how vi works?

    ^this. Probably you're not saving the file. ;-)

    Thanked by 2uptime skorous
  • As far as unclear questions go, this one is close to the top

    Thanked by 2uptime skorous
  • uptimeuptime Member
    edited September 2019

    I'm hoping for some interesting questions about emacs ....

    q: "Why do I have carpal tunnel syndrome in both my pinky fingers?"

    a: "Well obviously you need to remap the ctrl key to your capslock, duh!"

    Thanked by 1ITLabs
  • @ITLabs said:

    uptime said: No hitting.

    I haven't played MTG since 2006. I should make a laminate and wood tabletop from my old commons.

    Thanked by 2ITLabs uptime
  • vi is not too beginners friendly. Use nano instead

  • farsighter said: vi is not too beginners friendly. Use nano instead

    ah ... will reluctantly admit that there might be something to be said for that advice, I suppose

    on the other hand, vi (or vim) is pretty much guaranteed to be on any minimal installation, and if someone cares to take half an hour to learn the most basic dozen commands that might be well worth the effort.

    Thanked by 2farsighter skorous
  • raindog308raindog308 Administrator, Veteran

    Learn nano, become a beginner.

    Learn vi, become a power user.

    Learn emacs, become a god.

    uptime said: on the other hand, vi (or vim) is pretty much guaranteed to be on any minimal installation

    Amusingly, I once heard a talk by Bill Joy in which he said that when he sits down on a foreign system for the first time, he uses ed(1) because it's guaranteed to be there and is universally consistent, while vi varies from system to system. Of course, that was true much more when there were 1,000 different variants of Unix running around. vi is just ed(1) with a visual mode...indeed, even grep started life as a series of ed keystrokes (g/re/p - later backronymed).

    Thanked by 2uptime angstrom
  • It's been a long while since I last used ed, but I recently had the dubious (but gratifying) experience of effectively using sed via the console to change the IP address in /etc/network/interfaces so I could then ssh into a machine where the provider had reprovisioned the system - apparently defaulting to a German keyboard keymapping in the console that caused me too much confusion trying to use vi ... :)

    Thanked by 2raindog308 angstrom
  • If you install NetBSD, ed and vi (and sed) are all that you have until you learn how to install nano. :smile:

    (FreeBSD and OpenBSD include also a more user-friendly editor in their base, which arguably makes them less hardcore than NetBSD in this respect. :smiley: )

    Thanked by 1uptime
  • jsgjsg Member, Resident Benchmarker

    @raindog308 said:
    Learn nano, become a beginner.

    Learn vi, become a power user.

    Learn emacs, become a god.

    In a idiocracy world where the Visual Studio Code monstrosity is taking over the world and is becoming the most used "editor" for many, many languages?

    also @angstrom

    I'm not sure that nano was a good choice to throw at beginners. I personally feel reminded of old wordstar like "editors".

    @trusty33

    To just look at some file simply use more <filename>, e.g. more some.conf. That will show you the file, page by page.

  • @uptime said:
    Are you actually editing the file in vi? Making changes? Saving the file?

    Some details beyond "I am confuse" might be helpful :smiley:

    EDIT2:

    My best guess without more details is that you might be unfamiliar with how vi works?

    If that is the case, check https://wikihow.com/Learn-vi for some basic instructions

    EDIT3:

    ah, sorry ... that wikihow page is actually pretty lame (but it has pictures, lol)

    Just do this whenever in doubt in vi:

    • press the escape key
    • type :w
    • press the enter key.

    This will save the current editor contents to the file on the disk.

    EDIT4:

    And by "press" I mean "press down briefly and then release" - don't keep holding the key down forever.

    Some people might tell you to "hit" the enter key but that could go wrong in so many ways.

    No hitting.

    Just to make sure press esc several times.

    Thanked by 1uptime
  • farsighterfarsighter Member
    edited October 2019

    Can press ctrl+z ... everything will be saved to a hidden .swp file and you'll get terminal prompt back.

    To resume type fg , or vi -r filename if job is dead

    Thanked by 2uptime ITLabs
  • take the cat to the vet

Sign In or Register to comment.