2023年8月2日发(作者:)

linux的vi编辑器的dd命令,linuxvi后dd命令Vim是从vi发展⽽来的⽂本编辑器,可以⽤颜⾊或底线等⽅式来显⽰⼀些特殊的信息。Vim是Linux中必不可少的⼯具,搭建⽹站修改配置⽂件时经常⽤到。本教程介绍Vim的模式和常⽤操作。背景信息 Vim的各个模式介绍如下表所⽰: 模式 作⽤ 模式转换 普通模式 (Normal Mode)在该模式下,您可以复制、粘贴、删除字符或⾏。 运⾏vim 打开⽂件时,即进⼊普通模式。 在其他四个模式下,按Esc键即进⼊普通模式。 插⼊模式 (Insert Mode)在该模式下,您可以插⼊字符。 在普通模式下,按i,I,a,A,o,O中任⼀字符即进⼊插⼊模式。 说明 进⼊插⼊模式后,编辑器左下⾓会显⽰--INSERT --。 替换模式 (Replace Mode)在该模式下,您可以替换字符。 在普通模式下,按R即进⼊替换模式。 说明 进⼊替换模式后,编辑器左下⾓会显⽰-- REPLACE --。 可视模式 (Visual Mode)在该模式下,您可以选择⽂本。命令(如,复制、替换、删除等)仅作⽤于选中的⽂档。 在普通模式下,按v即进⼊可视模式。 说明 进⼊可视模式后,编辑器左下⾓会显⽰-- VISUAL --。 命令模式 (Command Mode)在该模式下,您可以查找字符串、替换字符串、显⽰⾏号、保存修改、退出编辑器等。 在普通模式下,按:即进⼊命令模式。 Vim的常⽤操作包括以下三种: 插⼊ 替换 删除 插⼊ 基本命令: i:在当前字符的左边插⼊。 I:在当前⾏的⾏⾸插⼊ 。 a:在当前字符的右边插⼊。A:在当前⾏的⾏尾插⼊。 o:在当前⾏下⾯插⼊⼀个新⾏。 O:在当前⾏上⾯插⼊⼀个新⾏。 本⽰例中使⽤的⽂件,如下所⽰:To be able to use the functionality of a module which was built as a DSO youhave to place corresponding `LoadModule' lines at this location so thedirectives contained in it are actually available before they are ally compiled modules (those listed by `httpd -l') do not needto be loaded e:LoadModule foo_module modules/mod_ude s.d/*.conf ⽰例⼀:在配置⽂件的第⼀⾏,插⼊Location。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 按i进⼊插⼊模式。 输⼊Location。 按回车键换⾏。 按Esc键退出插⼊模式。 按:wq保存⽂件并退出。 插⼊完成后,⽂件如下所⽰: LocationTo be able to use the functionality of a module which was built as a DSO youhave to place corresponding `LoadModule' lines at this location so thedirectives contained in it are actually available before they are ally compiled modules (those listed by `httpd -l') do not needto be loaded e:LoadModule foo_module modules/mod_ude s.d/*.conf ⽰例⼆:在配置⽂件第⼗⾏的⾏⾸,插⼊#。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 按:10将光标定位到第10⾏。 按I进⼊插⼊模式。 输⼊#。 按Esc键退出插⼊模式。 按:wq保存⽂件并退出。 插⼊操作完成后,⽂件如下所⽰:To be able to use the functionality of a module which was built as a DSO youhave to place corresponding `LoadModule' lines at this location so thedirectives contained in it are actually available before they are ally compiled modules (those listed by `httpd -l') do not needto be loaded e:LoadModule foo_module modules/mod_#Include s.d/.conf ⽰例三:在配置⽂件中,在Include s.d/.conf⾏的下⼀⾏插⼊LoadModule rewrite_module modules/mod_。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 运⾏/Include s.d/*.conf找到⽬标⾏。 按o进⼊插⼊模式。 输⼊LoadModule rewrite_module modules/mod_。按Esc键退出插⼊模式。 按:wq保存⽂件并退出。 插⼊完成后,⽂件如下所⽰:To be able to use the functionality of a module which was built as a DSO youhave to place corresponding `LoadModule' lines at this location so thedirectives contained in it are actually available before they are ally compiled modules (those listed by `httpd -l') do not needto be loaded e:LoadModule foo_module modules/mod_ude s.d/*.conf LoadModule rewrite_module modules/mod_ 替换 基本命令:R:替换光标⾼亮的字符,直⾄按下Esc键退出替换模式。本⽰例使⽤的⽂件,如下所⽰:AllowOverride controls what directives may be placed in .htaccess can be "All", "None", or any combination of the keywords:Options FileInfo AuthConfig LimitAllowOverride None ⽰例:将配置⽂件中的AllowOverride None更改为AllowOverride All。运⾏vim 命令打开⽂件,进⼊普通模式。 运⾏/AllowOverride None找到⽬标。 移动光标⾄None的⾸字母。 按R进⼊替换模式。 输⼊All和⼀个空格。 说明 None中共包含4个字符,⽽All只包含3个字符,因此输⼊All之后,需再输⼊⼀个空格。 按Esc键退出替换模式。 按:wq保存⽂件并退出。 更改后的⽂件,如下所⽰:AllowOverride controls what directives may be placed in .htaccess can be "All", "None", or any combination of the keywords:Options FileInfo AuthConfig LimitAllowOverride All 删除 基本命令: x:删除光标⾼亮的那⼀个字符。 nx(n为数字): 删除光标⾼亮的字符及其后⾯的n-1个字符。 dd:删除光标所在的那⼀⾏。 ndd(n为数字):删除光标所在⾏及其下⾯的n-1⾏。 本⽰例中使⽤的⽂件如下所⽰:Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP addresses.#Listen 12.34.56.78:80 Listen 80 ⽰例⼀:在配置⽂件中,将#Listen 12.34.56.78:80⾏⾸的#删除。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 运⾏/#Listen 12.34.56.78:80找到⽬标,光标此时定位在#字符上。 按x删除#。按:wq保存⽂件并退出。 删除完成后,⽂件如下所⽰:Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP 12.34.56.78:80 Listen 80 ⽰例⼆:在配置⽂件中,将#Listen 12.34.56.78:80⾏和下⼀⾏的内容删掉。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 运⾏/#Listen 12.34.56.78:80找到⽬标。 按2dd删除以下内容。 #Listen12.34.56.78:80 Listen 80 按:wq保存⽂件并退出。 删除完成后,⽂件如下所⽰:Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP addresses.

2023年8月2日发(作者:)

linux的vi编辑器的dd命令,linuxvi后dd命令Vim是从vi发展⽽来的⽂本编辑器,可以⽤颜⾊或底线等⽅式来显⽰⼀些特殊的信息。Vim是Linux中必不可少的⼯具,搭建⽹站修改配置⽂件时经常⽤到。本教程介绍Vim的模式和常⽤操作。背景信息 Vim的各个模式介绍如下表所⽰: 模式 作⽤ 模式转换 普通模式 (Normal Mode)在该模式下,您可以复制、粘贴、删除字符或⾏。 运⾏vim 打开⽂件时,即进⼊普通模式。 在其他四个模式下,按Esc键即进⼊普通模式。 插⼊模式 (Insert Mode)在该模式下,您可以插⼊字符。 在普通模式下,按i,I,a,A,o,O中任⼀字符即进⼊插⼊模式。 说明 进⼊插⼊模式后,编辑器左下⾓会显⽰--INSERT --。 替换模式 (Replace Mode)在该模式下,您可以替换字符。 在普通模式下,按R即进⼊替换模式。 说明 进⼊替换模式后,编辑器左下⾓会显⽰-- REPLACE --。 可视模式 (Visual Mode)在该模式下,您可以选择⽂本。命令(如,复制、替换、删除等)仅作⽤于选中的⽂档。 在普通模式下,按v即进⼊可视模式。 说明 进⼊可视模式后,编辑器左下⾓会显⽰-- VISUAL --。 命令模式 (Command Mode)在该模式下,您可以查找字符串、替换字符串、显⽰⾏号、保存修改、退出编辑器等。 在普通模式下,按:即进⼊命令模式。 Vim的常⽤操作包括以下三种: 插⼊ 替换 删除 插⼊ 基本命令: i:在当前字符的左边插⼊。 I:在当前⾏的⾏⾸插⼊ 。 a:在当前字符的右边插⼊。A:在当前⾏的⾏尾插⼊。 o:在当前⾏下⾯插⼊⼀个新⾏。 O:在当前⾏上⾯插⼊⼀个新⾏。 本⽰例中使⽤的⽂件,如下所⽰:To be able to use the functionality of a module which was built as a DSO youhave to place corresponding `LoadModule' lines at this location so thedirectives contained in it are actually available before they are ally compiled modules (those listed by `httpd -l') do not needto be loaded e:LoadModule foo_module modules/mod_ude s.d/*.conf ⽰例⼀:在配置⽂件的第⼀⾏,插⼊Location。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 按i进⼊插⼊模式。 输⼊Location。 按回车键换⾏。 按Esc键退出插⼊模式。 按:wq保存⽂件并退出。 插⼊完成后,⽂件如下所⽰: LocationTo be able to use the functionality of a module which was built as a DSO youhave to place corresponding `LoadModule' lines at this location so thedirectives contained in it are actually available before they are ally compiled modules (those listed by `httpd -l') do not needto be loaded e:LoadModule foo_module modules/mod_ude s.d/*.conf ⽰例⼆:在配置⽂件第⼗⾏的⾏⾸,插⼊#。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 按:10将光标定位到第10⾏。 按I进⼊插⼊模式。 输⼊#。 按Esc键退出插⼊模式。 按:wq保存⽂件并退出。 插⼊操作完成后,⽂件如下所⽰:To be able to use the functionality of a module which was built as a DSO youhave to place corresponding `LoadModule' lines at this location so thedirectives contained in it are actually available before they are ally compiled modules (those listed by `httpd -l') do not needto be loaded e:LoadModule foo_module modules/mod_#Include s.d/.conf ⽰例三:在配置⽂件中,在Include s.d/.conf⾏的下⼀⾏插⼊LoadModule rewrite_module modules/mod_。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 运⾏/Include s.d/*.conf找到⽬标⾏。 按o进⼊插⼊模式。 输⼊LoadModule rewrite_module modules/mod_。按Esc键退出插⼊模式。 按:wq保存⽂件并退出。 插⼊完成后,⽂件如下所⽰:To be able to use the functionality of a module which was built as a DSO youhave to place corresponding `LoadModule' lines at this location so thedirectives contained in it are actually available before they are ally compiled modules (those listed by `httpd -l') do not needto be loaded e:LoadModule foo_module modules/mod_ude s.d/*.conf LoadModule rewrite_module modules/mod_ 替换 基本命令:R:替换光标⾼亮的字符,直⾄按下Esc键退出替换模式。本⽰例使⽤的⽂件,如下所⽰:AllowOverride controls what directives may be placed in .htaccess can be "All", "None", or any combination of the keywords:Options FileInfo AuthConfig LimitAllowOverride None ⽰例:将配置⽂件中的AllowOverride None更改为AllowOverride All。运⾏vim 命令打开⽂件,进⼊普通模式。 运⾏/AllowOverride None找到⽬标。 移动光标⾄None的⾸字母。 按R进⼊替换模式。 输⼊All和⼀个空格。 说明 None中共包含4个字符,⽽All只包含3个字符,因此输⼊All之后,需再输⼊⼀个空格。 按Esc键退出替换模式。 按:wq保存⽂件并退出。 更改后的⽂件,如下所⽰:AllowOverride controls what directives may be placed in .htaccess can be "All", "None", or any combination of the keywords:Options FileInfo AuthConfig LimitAllowOverride All 删除 基本命令: x:删除光标⾼亮的那⼀个字符。 nx(n为数字): 删除光标⾼亮的字符及其后⾯的n-1个字符。 dd:删除光标所在的那⼀⾏。 ndd(n为数字):删除光标所在⾏及其下⾯的n-1⾏。 本⽰例中使⽤的⽂件如下所⽰:Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP addresses.#Listen 12.34.56.78:80 Listen 80 ⽰例⼀:在配置⽂件中,将#Listen 12.34.56.78:80⾏⾸的#删除。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 运⾏/#Listen 12.34.56.78:80找到⽬标,光标此时定位在#字符上。 按x删除#。按:wq保存⽂件并退出。 删除完成后,⽂件如下所⽰:Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP 12.34.56.78:80 Listen 80 ⽰例⼆:在配置⽂件中,将#Listen 12.34.56.78:80⾏和下⼀⾏的内容删掉。步骤如下: 运⾏vim 命令打开⽂件,进⼊普通模式。 运⾏/#Listen 12.34.56.78:80找到⽬标。 按2dd删除以下内容。 #Listen12.34.56.78:80 Listen 80 按:wq保存⽂件并退出。 删除完成后,⽂件如下所⽰:Listen: Allows you to bind Apache to specific IP addresses and/orports, instead of the default. See also this to Listen on specific IP addresses as shown below toprevent Apache from glomming onto all bound IP addresses.