Sie sind auf Seite 1von 8
eons The Begioner's Guide to Nano, the Linux Command-Line Text Eater ‘The Beginner's Guide to Nano, the Linux Command-Line Text Editor text ects? How? New to the infuse by al ofthe other adv tutrial to Nano, a simple text-editor that’s very newbie-riendly ks got your back with this When geting used to the commandline, Linux novices are often put off by other, more advanced text editors such as vim and emacs. While they are excellent programs, they de have abit of a learning curve, Enter Nano, an easy-to-use text editor that proves itself versatile and simple. Nano is installed by default in Ubuntu and many other Linux distros and ‘works wellin conjunction with sudo, which is why we love itso much Running Nano You can run nane in te ways. Te open nano with an empty buffer, ust type “nano” acthe commane promt. You can also use the following syntax nano. /path/to/ilenane ipshvuw hawogeek com ota42980Nhe-besiners-gude-to ane theinut-command:inetex-editer 18 01s The Begioner's Guide to Nano, the Linux Command-Line Text Eater ot exis it start a new butfer with that filename in that ‘Nano will follow the path and open that fle ik exists. fit aicecory Lers take a look atthe default nano screen rs Fite: cae. filee/vesctile ‘Acthe top, youl see the name of the program and version number, the name ofthe fle you're eating, and whether the fle has been modified since it was lst saved. you nave a new file that isnt saved yet, you'll see "New Buffer” Nex, youll see The third-line from the battom isa “system message” line that d splays information relevant tothe program executing a function, Here, you can see that it says"New File” Lastly, the final two rows atthe bottom are what make ths program very user-friendly: the shortcut Ines, the contents of your document, a body of Its a WYSIWYG editor, "what you see's what you get What you type directly goes into the text input, unless you modi it with akey lke Control or Meta es pretty simple, 0 type some text out, or copy something and pas 0 we have something to play with aoa Shortcuts ipskwuw howogeek com iota42980Nhe-besiners-gude-to ane theinux-commandnetex-edter eons The Begioner's Guide to Nano, the Linux Command-Line Text Eater Program functions are referred to as “shortcuts” in nano, such as saving quitting, justifying ete. The mest common ones are listed atthe bottom of the screen, but there are many mare that aren't Note that nano does not use the Shift key in shorteuts,Allshort JOT CersShiteG. uts use lowercase letters and unmodified number keys, so Ctr¥G 5 N Hic Cul+G to bring yo the Help documentation and sell down to see allt of valid shortcuts aoa When you're done looking atthe fst hit Cristo ext help Lets say youre working on ane hitting Ctr-0, Youll be prompted fora filename to use, and the shortcuts at the bottom will change to enter to complete ths particular command, ex fle, or *butfer” and you want to save it. Ths is cal iting out” and js executed by at you can asi aoa ine Kane to Weivat cxteftea/cescfat cari, I¥you want to inser the contents of another file into your curren buffer, you'd ty ipskwuw howogeek com iota42980Nhe-besiners-gude-to ane theinux-commandnetex-edter 01s The Begioner's Guide to Nano, the Linux Command-Line Text Eater aoa You can cancel both of the previous commands by typing Cr. ‘You can hit Escape twice instead of holding down the Control key, ityou have trouble doing that, There are also some commands that requir use of the Meta key, On most keyboard layouts, Meta equates tothe Al button, When you want to quitnana, you just hit ireX. Nano will polit cancel this action as wel askyou ifyou stto save your buffer, and you can 192368350 TTY iss Navigation Now that we've got a hang of shortcuts, lets get used to moving around a text ile very quickly, Ofcourse, you can always Use the Home, End, Page Up, age Down, and the arrow keys to get around, but tnat requires moving your fingers from the letters that we al lve so much, To move the cursor forward of backward, you can type CtsliF and Ctri+8, Ta move up an down one ine tie, you can type Girl an CtrI+N, In other words, you ean use those keys instead of the Right, Le, Up, and Bown arrows, respectively, Missing the Home and End keys? You can use Ctrl-A.and Cli. Want to move pages ata time insteag? Ctel\V moves dawn a page, and Ctrl moves up a page ipskwuw howogeek com iota42980Nhe-besiners-gude-to ane theinux-commandnetex-edter 48 eons The Begioner's Guide to Nano, the Linux Command-Line Text Eater uc watt, there's more! ve forward and backward one word at atime, you can use Ctrl+Space and Meta*Space 2). Ang if you're really ina ush, you can hit Ctrl and then type inthe line nurmber, a cemma, lump straight there. (remember, that’s Al and the column nur aoa Same) you want to see where your cursor currenly is, sort of like nano-GPS, hit tr¥C yaviorga =| tel) 228), soc 35/68 (608) Copying, Cutting, and Pasting When we: nto copy textin graphical environment, we highlight withthe cursor. Similarly in nano we “mark” by Using the Cirle command. You simply move the cursor to where you want to start marking, and then you hit Ctrl" to “set i, Ths wil mark everything between the starting point up to and NOT including the cursor. ipskwuw howogeek com iota42980Nhe-besiners-gude-to ane theinux-commandnetex-edter 01s The Begioner's Guide to Nano, the Linux Command-Line Text Eater aoa Note that the cursor is onthe empty space, and copying/cuting wll nt include this space. You can also mark backwards from your set” point. Be careful, however, 5 you can act text while your marking you messed up, just hit Cel+ again ta unset the marker and you can start over. To cony the marked text hit Meta¥ I instead, you Want to cut the text it Ct ‘To Paste your text, move the cursor tea suitable position and hit Cer, aoa Ifyou want to remave an entire line of text, simply hit Cerl+K without highlighting anything, This sometimes comes in handy ‘shen editing configuration Some Extra Shortcuts You krow how in notepad, you can force long lines of text to wrap-around into what look Ike paragraphs? You can toggle that Feature in nano with the Metar. shortcut Since line wrapping \s set to “on” by default, his usually comes in handy in the opposte 3; for example, you're writing a cont file ana want to disable line-wrapping, ipskwuw howogeek com iota42980Nhe-besiners-gude-to ane theinux-commandnetex-edter ee 01s The Begioner's Guide to Nano, the Linux Command-Line Text Eater 192368350. aT "You can see that thellne the cursor is on has "8" at both the beginning and end, Ths signifies that there's more text both before and afer the portion being displayed on ser Ifyou want to search for ate string, hit Crl8W, and enter your search term. This search can chen be cancelled ric execution by hitting Ctrl+C without destroying your butter, 192368350. aT ‘The previous search term appears inthe square brackets and leaving the ine blank and hiting Enter will epeat that last search, ‘And after you get realy comfortable, you can un that helpful section at the bottom off by hitting MesaeX to get more screen space for eating! ipskwuw howogeek com iota42980Nhe-besiners-gude-to ane theinux-commandnetex-edter 78 01s The Begioner's Guide to Nano, the Linux Command-Line Text Eater er cx tiles/vescfile Taira Some History Nano was designed to be similar in look and feel to another program called Pico, Pico was the default text editor of Pine, an email program from back in the day that wasnt d'stnibuted with a GPL-tiendly icense. This meant that recstribution was somewhat of a fuzzy area, and so the TIP proj malty that Pca lacked and was licensed for fre distsbution, and overtime, became the nano we lave to use today, For more information, check cut the Nano Project's History section on thet FAQ. ‘twas born, “TIP Isnt Pica" added sore fu The strength af nano les in its simgliy of use. The shortcuts work ust kein GUL-based word processors Ike Ward and Open Office so t's justa matter of earning which ones do what, Everything outside of that i just simple tex-edting, Next time you have to edt stuff on the command-line, we hope that you'll be more comfortable with it now tat you've gotten familiar with nano, Jon THE DISCUSSION ctallinds hes haceng ond weak SHOW ARCHED READER COMMENTS (12) ipshwuw howogeek comota42980Nhe-besiners-gude-toane-the-inux-commandinetex-edter a8

Das könnte Ihnen auch gefallen