Quick Look: The Vi editor
I've had plenty of exposure to Linux over my years of working with computers but I have a confession: I've never used the Vi editor until recently. I bought a Raspberry Pi 3 to build a small Web-dev environment and reacquaint myself with Linux. I installed an ARM build of CentOS v7 on it and when I went to go through the initial configuration, I learned real quick that nano was not installed by default. Nano has always been my text editor of choice since the entirety of my Linux experience has been Ubuntu or Debian, (which is why I've installed CentOS). This isn't going to be a deep dive into Vi, just a basic intro to how to use it.
At a BASH prompt or SSH/PuTTY connection, simply type the command below:
vi newfile
When you first open Vi, you're in Command Mode. This is the mode you'll use for cutting/pasting, finding and replacing text, saving the file you're working on, etc. Type "i" to enter Insert Mode. Insert Mode is how you'll insert text into the file.
In order to get out of Insert Mode, hit the ESC key. To save the file, in Command Mode, type "ZZ"
If you'd like to look at a txt file in read-only mode, you can use
view filename
If you want to quit out of the editor without saving the file, in Command Mode, type ":q!"
There's plenty more to discuss for the Vi editor but each topic could be it's own dedicated post. I'll very likely delve deeper into the future.
At a BASH prompt or SSH/PuTTY connection, simply type the command below:
vi newfile
When you first open Vi, you're in Command Mode. This is the mode you'll use for cutting/pasting, finding and replacing text, saving the file you're working on, etc. Type "i" to enter Insert Mode. Insert Mode is how you'll insert text into the file.
In order to get out of Insert Mode, hit the ESC key. To save the file, in Command Mode, type "ZZ"
If you'd like to look at a txt file in read-only mode, you can use
view filename
If you want to quit out of the editor without saving the file, in Command Mode, type ":q!"
There's plenty more to discuss for the Vi editor but each topic could be it's own dedicated post. I'll very likely delve deeper into the future.
Comments
Post a Comment