NetApp Filers – from the command line
Quite a few people use NetApp Filers. Not a lot of people like to use the command line to perform various ONTAP functions, but even less take advantage of the command line control options at the controller prompt. I’ve found that knowing the control options makes my command line work much faster as a general rule. Here’s a few you may or may not know about:
1. CTRL-W: My personal favorite. This will allow you to do a “word delete” so you don’t have to backspace through an entire string. For example, if I have the following text:
snap delete myvol this_is_a_really_long_snapshot_name_to_use
By using CTRL-W, I can change the command line to now look like:
snap delete myvol
This makes performing cut-and-paste operations with lots of snapshot names a breeze.
2. CTRL-A, CTRL-E, CTRL-F, CTRL-B: Go to the beginning of the line, end of the line, forward a character or back a character, respectively. CTRL-A and CTRL-E are pretty useful (CTRL-F and CTRL-B can be done with arrow keys) if you’re looking to prepend or append some text.
3. CTRL-K: Kill all following text. This is pretty nice if you want to move to the beginning of the line and delete a lot of add-on characters. If my command line looks like the following:
lun show -v /vol/exch_db1/exch_db1_g.lun
From this I would hit CTRL-A to go to the beginning of the line, CTRL-F (or arrow keys) to move forward to the “-v”, and hit CTRL-K. The line would turn into:
lun show
Of course, if you have a lot of text this can be useful, but going back to (1), I would just hit CTRL-W twice and perform the same step! It’s even faster than CTRL-A/CTRL-F/CTRL-K.
4. CTRL-N, CTRL-P: Go to the next or previous history command. This can really help you fly through repetitive commands. Let’s say you want to online three different volumes — myvol1, myvol2 and testvol3. You might typically type in:
vol online myvol1
vol online myvol2
vol online testvol3
There’s a fast way to iterate through these without typing everything in. First, type in the first command:
vol online myvol1
Once that’s done, type in CTRL-P and backspace, and type in the number 2. This will reload the previous command, backspace over the 1, and add a 2 to the end so you get the myvol2 appended text:
vol online myvol2
Finally, hit CTRL-P again, followed by CTRL-W (my favorite) and type in testvol3. This loads the last command, deleted the myvol2 text and allows you to type in testvol3 without having to re-type vol online:
vol online testvol3
I encourage you to download the ONTAP simulator and try a lot of these out for yourself. You’ll find they are pretty useful in general and with a little practice you’ll be flying on the command line.