Перейти до вмісту
EuroVPSEuroVPS

Як редагувати файли за допомогою nano

FAQ EuroVPS

3 хв читання

Nano є простим текстовим редактором, що працює в терміналі. З його допомогою можна редагувати текстові файли на сервері з командного рядка, увійшовши через SSH.

Він встановлений за замовчуванням на кожному VPS і dedicated server від EuroVPS.

Як встановити текстовий редактор nano

Якщо його немає:

Встановлення nano на CentOS/RHEL

yum install nano

Встановлення nano на Debian/Ubuntu

sudo apt-get install nano

Як користуватися текстовим редактором nano

nano filename or nano /path/to/directory/filename

Приклади:

[root@eurovps ~]# nano  sample.txt
[root@eurovps ~]# nano /etc/nginx/nginx.conf

Натисніть Ctrl + O, щоб зберегти внесені зміни. Щоб вийти з nano, натисніть Ctrl + X.

Клавіатурні команди nano

^G  	(F1)        	Display this help text
^X  	(F2)        	Close the current file buffer / Exit from nano
^O  	(F3)        	Write the current file to disk
^J  	(F4)        	Justify the current paragraph

^R  	(F5)        	Insert another file into the current one
^W  	(F6)        	Search for a string or a regular expression
^Y  	(F7)        	Go to previous screen
^V  	(F8)        	Go to next screen

^K  	(F9)        	Cut the current line and store it in the cutbuffer
^U  	(F10)       	Uncut from the cutbuffer into the current line
^C  	(F11)       	Display the position of the cursor
^T  	(F12)       	Invoke the spell checker, if available
^_  	(F13) (M-G)   Go to line and column number
M-^ 	(M-6)       	Copy the current line and store it in the cutbuffer
^Space              	Go forward one word
^N               	   	Go to next line

^A                 	 	Go to beginning of current line
^E              	    	Go to end of current line
                                                             	 

M-( 	(M-9)       	Go to beginning of paragraph; then of previous paragraph
M-) 	(M-0)       	Go just beyond end of paragraph; then of next paragraph
M-]                 		Go to the matching bracket
M-- 	(M-_)       	Scroll up one line without scrolling the cursor
M-+ 	(M-=)       	Scroll down one line without scrolling the cursor
M-< 	(M-,)       	Switch to the previous file buffer
M-> 	(M-.)       	Switch to the next file buffer

M-V                 	Insert the next keystroke verbatim
^I                  		Insert a tab at the cursor position
^M               	   	Insert a newline at the cursor position
^D               	   	Delete the character under the cursor
^H                	  	Delete the character to the left of the cursor
M-T              	   	Cut from the cursor position to the end of the file

M-J               	  	Justify the entire file
M-D                 	Count the number of words, lines, and characters
^L                	  	Refresh (redraw) the current screen
^Z                 	 	Suspend the editor (if suspend is enabled)

(M-X)               	Help mode enable/disable
(M-C)               	Constant cursor position display enable/disable
(M-O)               	Use of one more line for editing enable/disable
(M-S)               	Smooth scrolling enable/disable
(M-P)               	Whitespace display enable/disable
(M-Y)               	Color syntax highlighting enable/disable
(M-H)               	Smart home key enable/disable
(M-I)              	 	Auto indent enable/disable
(M-K)               	Cut to end enable/disable
(M-L)               	Long line wrapping enable/disable
(M-Q)               	Conversion of typed tabs to spaces enable/disable
(M-B)               	Backup files enable/disable
(M-F)               	Multiple file buffers enable/disable
(M-M)               	Mouse support enable/disable
(M-N)               	No conversion from DOS/Mac format enable/disable
(M-Z)               	Suspension enable/disable
(M-$)               	Soft line wrapping enable/disable

Будь-яка команда з символом каретки (^) означає клавішу Ctrl (наприклад, ^K означає одночасне натискання Ctrl+K).

Будь-яка команда з літерою M означає клавішу Alt (наприклад, M-R означає одночасне натискання Alt+R).

Shared FAQ page chrome (breadcrumb, dates, read time, «Читати далі», enquiry block, category labels): see INDEX-AND-CHROME.md. Translate once.

З FAQ EuroVPS.

Більше в категорії «Інструкції»

Ваш наступний партнер з інфраструктури

Залишилося
запитання?

Розкажіть, що ви намагаєтеся зробити. Інженер прочитає і відповість.

+357 222 32280
Інженер EuroVPS несе серверний вузол у залі дата-центру
Розмова з людьми, які доглядатимуть за вашою інфраструктурою.

Почнімо з вашої інфраструктури.

Трохи контексту допомагає нам почати правильну розмову.

Ми використаємо ваші дані, щоб відповісти на ваш запит. Політика конфіденційності