DD-WRT Optware

John Connor

Lifer
Nov 30, 2012
22,757
617
121
I am reading about installing Optware into a router and have read that if I want to modify the Asiablock IP addresses I need to use VI editor. What is VI editor and how do I use it?

This is what I'm reading. http://www.dd-wrt.com/wiki/index.php/Optware%2C_the_Right_Way#Getting_Started

I'm a Linux noob.

Here is the relevant info I read that doesn't explain how to use VI. It just says search the Internet. I don't won't to block Australia, but I do want to add countries.

Countries that are blocked by default are:

  1. cn = China
  2. af = Afghanistan
  3. au = Australia
  4. pk = Pakistan
  5. in = India
  6. my = Malaysia
  7. ua = Ukrain
  8. ng = Nigeria
  9. kh = Cambodia
  10. li = Liechtenstein
You can also add or remove countries by editing the Asiablock Script using VIM. To do this, shutdown Asiablock with the stop and off parameters, then type vi /opt/etc/init.d/S95asiablock
It is wise to know what you are doing before you do this though. Search the forums or the net for instructions.
 
Last edited:

lxskllr

No Lifer
Nov 30, 2004
57,867
8,119
126
vi is an editor built in to pretty much every Unix-like system. I've honestly never used it, and prefer nano for a light editor. That doesn't help you though since you don't have nano.

What they're saying is to edit S95aasiablock with vi, and they're giving you the file path to it. This tutorial might help a bit getting started with vi...

http://www.unix-manuals.com/tutorials/vi/vi-in-10-1.html
 

John Connor

Lifer
Nov 30, 2012
22,757
617
121
So if I telnet into the router and enter vi /opt/etc/init.d/S95asiablock this will open VI and I can edit?

Just read the tutorial. That looks easy, but I have a felling there's more to it with how to edit the Asiablock script.
 
Last edited:

lxskllr

No Lifer
Nov 30, 2004
57,867
8,119
126
So if I telnet into the router and enter vi /opt/etc/init.d/S95asiablock this will open VI and I can edit?

Just read the tutorial. That looks easy, but I have a felling there's more to it with how to edit the Asiablock script.

Yup, that's it. The script doesn't look bad from the bit you've posted, just a list of variables to add or remove. The only hard part is getting the country code right, but you should be able to find that online.
 

John Connor

Lifer
Nov 30, 2012
22,757
617
121
Well, when I buy the router I'm looking at and dive into this I'll see what happens. I just have no use for the Asian pacific. LOL
 

scoob8000

Member
Dec 20, 2004
28
0
0
vi /home/me/whatever.conf

Use your arrow keys to move the cursor.

Hit lowercase a to go into edit mode (so you can type), and escape to get out of edit mode.

backspace usually doesn't work, instead arrow left and use delete.

dd will delete the whole line your on.

:q! will exit without making changes (if you mess up)
:wq will save, and exit.
 

Fallen Kell

Diamond Member
Oct 9, 1999
6,088
450
126
Yeah pretty much what scoob8000 said (at least for the basics). I use it all the time. It is in fact my preferred editor of choice now for text documents.

There are tons of shortcuts for searching/find-replace, etc. All of which are more advanced, but very easy once you understand it more.

Essentially you need to think of the editor as having 2 modes, a command mode (which is the mode it is in when you first open a file), and "insert mode" which is the mode where you can actually insert/edit data. The ESC key will exit from "insert mode" and bring you back to "command mode".

There are actually multiple keys that will take you from "command mode" into "insert mode", all of them have their own uses. For instance, the "a" key stands for "append" so it will place you in insert mode at the "right side" of the cursor. The "i" key stands for insert, so it will put you into "insert mode" at the "left side" of the cursor (think of it like inserting a bunch of characters before your cursor, or appending characters behind your cursor). Then there is "I" (capital "i"), which will start the "insert" at the beginning of the line your cursor is on. And there is the "A" (capital "a"), which will let you append data to the end of the line. Finally there is the "o", which will create a new line below the current one you are on and put you in insert mode.

The above combination of things makes it very quick and easy to make changes to files without needing to move a mouse/cursor around all over the place. You can replace a character by hitting "r" and then type the character you want it to be. You can also repeat the previous command by hitting the "." (period) key. This is very useful when you want to change say add a tab at the beginning of a bunch of lines to indent them (or comment out the line by adding a "#" at the beginning). Simply make your change once (from command mode: "I<TAB><ESC>", then move your cursor to the next line with the down arrow, and then hit "." and it will add the tab to the beginning of that line as well).

Copy/cut/paste uses the "yy" (yank line), "dd" (delete line, but more appropriately cut line (it serves as both)), and "p" (paste below), or "P" (paste above) (think of them like the difference between "a" and "i"). You can perform the action against multiple lines by typing a number before the command. Say cut 10 lines is "10dd". Please note these are all done from "command mode".

The ":" will do other things as well as save and quit. If you type ":1" it will move the cursor to the first line in the file. Substitute the "1" for any line number you want to use.

You can search for a string from command mode by typing "/" followed by whatever you are searching for and hit enter. Once you have searched the first time you can hit the "n" key for the next match, or the "N" for the previous match.
 

Fallen Kell

Diamond Member
Oct 9, 1999
6,088
450
126
It may be old, but it will save your skin when something seriously goes wrong with your Unix/Linux system. Vi will typically be one of the few things that you have available to you to fix it.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |