Detail the nano command in linux

  • 2020-06-15 10:59:18
  • OfStack

nano is a one-character terminal text editor, somewhat like editor under DOS. It is much simpler than vi/vim and is suitable for Linux beginners. The default editor for some Linux distributions is nano.

nano command to open the specified file for editing, and by default it will automatically line breaks, namely input in 1 row long content automatically split into a few lines, but in this way to deal with some files may be a problem, such as Linux system configuration files, automatic line breaks will make originally only written in the book of 1 row content broken into multiple lines, may cause the system block. So if you want to avoid this, add the -w option.

grammar

nano [options] [[+ rows, columns] filename]...

options

- h, - the & # 63; --help displays this information + rows, columns start with the number of columns and rows -ES25en --smarthome enables the smart HOME key -ES28en --backup stores a backup of existing files -C < directory > --backupdir= < directory > A directory used to store a single backup file -D -boldtext replaces color inversion with bold -ES38en --tabstospaces converts entered tabs to white space -ES40en --multibuffer enables multiple file buffers -ES42en --historylog records and reads search/replace history strings Do not refer to the nanorc file -K -rebindkeypad fixed number key area key confusion issue -L -nonewlines Do not add line feeds to the end of the file -N -noconvert do not convert from DOS/Mac format -ES55en --morespace USES 1 more line when editing -Q < string > --quotestr= < string > The reference represents the string -ES63en --restricted restricted mode -S -smooth scrolls by line instead of half screen -T < # the number of columns > --tabsize= < # the number of columns > Sets TAB width to # number of columns -U -quickblank status line flashes quickly -V -version displays version information and leaves -W -wordbounds detects word boundaries more correctly -Y < string > --syntax= < string > Syntax definitions for highlighting -c -const continuously displays cursor position -d -rebinddelete fixed backspace/delete key confusion -i -autoindent automatically indents new lines -ES91en --cut cut from cursor to end of line Do not join by sign, but overwrite -m -mouse enables mouse function -o < directory > --operatingdir= < directory > Set operation directory -ES103en --preserve retains the XON (^Q) and XOFF (^S) buttons -ES109en --quiet silently ignores startup problems, such as rc file errors -r < # the number of columns > --fill= < # the number of columns > Set the fold width to # number of columns -s < The program > --speller= < The program > Enable an alternative spell checker -t -tempfile stores automatically when leaving without prompting -u --undo allows generic undo [experimental features] -ES128en --view View (read only) mode Do not wrap lines automatically -x -nohelp do not display secondary areas -ES134en --suspend enables pause -$--softwrap enables soft line feeds -a, -b, -e, -ES138en, -ES139en, -ES140en (ignored, compatible with pico)

usage

Cursor control

Move cursor: Use arrow keys to move. Select text: Hold down the left mouse button and drag to.

Copy, cut, and paste

Copy 1 full line: Alt+6 Cut and paste 1 full line: Ctrl+K

Paste: Ctrl + U

If you need to copy/clip more than one line or part of one line, move the cursor to the beginning of the text you want to copy/clip, press Ctrl+6 (or Alt+A) to mark, and then move the cursor to the end of the text you want to copy/clip. The selected text is whitened, copied with Alt+6, and cut and pasted with Ctrl+K. To cancel during the text selection process, just press Ctrl+6 again.

search

Press Ctrl+W and enter the keyword you want to search for. Press Enter to confirm. This will locate the first matching text, which can then be used with Alt+W to locate the next matching text.

Turn the page

Ctrl+Y to previous page Ctrl+V to next page

save

Use Ctrl+O to save the changes

exit

According to the Ctrl + X

If you have made changes to the file, you will be asked if you need to save the changes. Enter Y to confirm save, enter N not to save, press Ctrl+C to cancel return. If you enter Y, the next step will ask you to enter the file name you want to save. If you don't need to change the file name, just press enter. If you want to save it as a different name, enter a new name and make sure. Ctrl+C can also be used to cancel the return.


Related articles: