Problem exiting sudo vi /etc/fstab

I was following along with the video Jetson AI Fundamentals - S1E1 - First Time Setup with JetPack. At 12:17, the presenter entered sudo vi /etc/fstab, which took us to a different screen. In that screen, the presenter entered: “/mnt/4GB.swap swap swap defaults 0 0” then says “and close it up okay now I’m set colon wq to close” starting at 12:54. Unfortunately, she never explained how to get down to the bottom of the screen (where it previously said “INSERT”) when she said “and close it up”, so I never could enter “:wq” and get back to the command window. What key strokes are needed to do what she did starting at 12:54 in the video?

Edit: I finally figured out that she hit ESC, then SHIFT: before typing wq to get back to the home screen.

You don’t need to use vi, but it is incredibly useful (I tend to use vi even when I have other GUI apps). vi uses the escape key to exit most steps and return to viewing. It is hard to describe because mostly I just use type by touch and instinct. Here are some hints though:

  • If in doubt, hit escape a few times to start over on something.
  • SHIFT-g to go to the bottom of page if viewing.
  • j to go down one line.
  • k to go up one line.
  • CONTROL-g to see status.
  • CONTROL-u to go to top.
  • To go back and forth top and bottom, alternate SHIFT-g and CONTROL-u.
  • l (lower case L) to go right one character.
  • h to go left one character.
  • w to go forward one word.
  • b to go back one word.
  • Some form of regular expression search after entering /. You probably want to avoid that until you know what regular expressions are, although you can search for literal words like “/swap” (then enter) would search for the word swap. n would go to the next match of the word swap, and SHIFT-n to go to previous match.

Anyone who will live in a *NIX/Linux world will find it useful to learn vi, but it isn’t an easy learning curve.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.