linux命令行界面_Linux中的命令行界面
linux命令行界面If you are like most people, you are probably most familiar with using a Graphical User Interface (GUI) to control your computer. Introduced to the masses by Apple on the Macintosh computer
linux命令行界面
If you are like most people, you are probably most familiar with using a Graphical User Interface (GUI) to control your computer. Introduced to the masses by Apple on the Macintosh computer and popularized by Microsoft, a GUI provides an easy, discoverable way to manage your system. Without a GUI, some tools for graphics and video would not be practical.
如果您像大多数人一样,可能最熟悉使用图形用户界面(GUI)来控制计算机。 GUI在Macintosh计算机上由Apple引入并由Microsoft广泛使用,GUI提供了一种易于发现的管理系统的方法。 没有GUI,某些用于图形和视频的工具将不实用。
Prior to the popularity of the GUI, the Command Line Interface (CLI) was the preferred way to control a computer. The CLI relies solely on keyboard input. Everything you want the computer to do is relayed by typing commands rather than clicking on icons.
在GUI流行之前, 命令行界面(CLI)是控制计算机的首选方法。 CLI仅依靠键盘输入。 您希望计算机执行的所有操作都通过键入命令(而不是单击图标)进行中继。
If you are new to a CLI, it is very tedious to memorizing commands and their options, but with time you can master it. However, a CLI provides more precise control, greater speed and the ability to easily automate tasks through scripting (see sidebar). Although Linux does have many GUI environments, there can be things which are not possible with GUI but with CLI everything is possible ( except graphical tools *wink*).
如果您不熟悉CLI ,则记住命令及其选项非常繁琐,但是随着时间的流逝您就可以掌握它。 但是, CLI提供了更精确的控制,更快的速度以及通过脚本轻松自动化任务的能力(请参见侧栏)。 尽管Linux确实有很多GUI环境,但有些地方是GUI不可能实现的,但是CLI可以实现所有功能(图形工具* wink *除外)。
命令行界面(CLI) (Command Line Interface (CLI))
The Command Line Interface (CLI), is a text-based interface to the computer, where the user types in a command and the computer then executes it. The CLI environment is provided by an application on the computer known as a terminal.
命令行界面(CLI)是计算机的基于文本的界面,用户在其中键入命令,然后计算机将执行该命令。 CLI环境由称为终端的计算机上的应用程序提供。
The terminal accepts what the user types and passes to a shell. The shell interprets what the user has typed into instructions that can be executed by the operating system. If the output is produced by the command, then this text is displayed in the terminal. If problems with the command are encountered, then an error message is displayed.
终端接受用户输入的内容并传递给外壳。 该外壳程序将用户键入的内容解释为可由操作系统执行的指令。 如果输出是由命令产生的,那么此文本将显示在终端中。 如果遇到命令问题,则会显示错误消息。
访问终端 (Accessing a Terminal)
There are many ways to access a terminal window. Some systems will boot directly to a terminal. This is often the case with servers, as a Graphical User Interface (GUI) can be resource intensive and may not be needed to perform server-based operations.
有很多方法可以访问终端窗口。 某些系统将直接引导到终端。 服务器通常是这种情况,因为图形用户界面(GUI)可能会占用大量资源,并且可能不需要执行基于服务器的操作。
A good example of a server that doesn't necessarily require a GUI is a web server. Web servers need to be as fast as possible and a GUI would just slow the system down.
Web服务器是不一定需要GUI的服务器的一个很好的例子。 Web服务器需要尽可能快,而GUI只会降低系统速度。
On systems that boot to a GUI, comes with two ways to access a terminal, a GUI-based terminal, and a virtual terminal:
在引导至GUI的系统上,提供了两种访问终端的方法:基于GUI的终端和虚拟终端:
1) A GUI terminal is a program within the GUI environment that emulates a terminal window. GUI terminals can be accessed through the menu system. For example, on a CentOS machine, you could click on Applications on the menu bar, then System Tools → and, finally, Terminal:
1) GUI终端是GUI环境中模拟终端窗口的程序。 可以通过菜单系统访问GUI终端。 例如,在CentOS机器上,您可以单击菜单栏上的应用程序,然后单击系统工具 →,最后单击终端 :
2) A virtual terminal can be run at the same time as a GUI but requires the user to log in via the virtual terminal before they can execute commands (as they would before accessing the GUI interface). Most systems have multiple virtual terminals that can be accessed by pressing a combination of keys, for example, CTRL+ALT+F1.
2)虚拟终端可以与GUI同时运行,但是要求用户通过虚拟终端登录才能执行命令(就像访问GUI界面之前一样)。 大多数系统具有多个虚拟终端,可以通过按组合键来访问这些终端,例如CTRL + ALT + F1 。
提示 (Prompt)
A terminal window displays a prompt; the prompt appears when no commands are being run and when all command output has been printed to the screen. The prompt is designed to tell the user to enter a command.
终端窗口显示提示; 当没有命令正在运行并且所有命令输出都已打印到屏幕上时,将出现提示。 该提示旨在告诉用户输入命令。
The structure of the prompt may vary between distributions, but will typically contain information about the user and the system. Below is a common prompt structure:
提示的结构在各个发行版之间可能会有所不同,但通常会包含有关用户和系统的信息。 下面是一个常见的提示结构:
The previous prompt provides the name of the user that is logged in (sysadmin), the name of the system (localhost) and the current directory (~). The ~ symbol is used as shorthand for the user's home directory (typically the home directory for the user is under the /homedirectory and named after the user account name, for example: /home/sysadmin).
上一个提示提供了登录用户的名称( sysadmin ),系统名称( localhost )和当前目录( 〜 )。 该符号〜用作简写为用户的主目录(通常是用户的主目录是/ home目录下和用户帐户名称命名,例如:/家庭/系统管理员 )。
贝壳 (Shell)
A shell is an interpreter that translates commands entered by a user into actions to be performed by the operating system. The most commonly used shell for Linux distributions is called the BASH shell. Shell provides many advanced features, such as command history, which can be re-execute previously executed commands.
Shell是解释器,可将用户输入的命令转换为操作系统要执行的操作。 Linux发行版中最常用的外壳称为BASH外壳 。 Shell提供了许多高级功能,例如命令历史记录,可以重新执行以前执行的命令。
The BASH shell also has other popular features:
BASH shell还具有其他受欢迎的功能:
Scripting:
脚本编写:
The ability to place commands in a file and execute the file, resulting in all of the commands being executed. This feature also has some programming features, such as conditional statements and the ability to create functions (AKA, subroutines).
将命令放置在文件中并执行文件的能力,导致所有命令都被执行。 此功能还具有一些编程功能,例如条件语句和创建函数(AKA,子例程)的能力。
Aliases:
别名:
The ability to create short "nicknames" for longer commands.
为较长的命令创建简短的“昵称”的功能。
Variables:
变量:
Variables are used to store information for the BASH shell. These variables can be used to modify commands and features.
变量用于存储BASH Shell的信息。 这些变量可用于修改命令和功能。
翻译自: https://www.includehelp.com/linux/command-line-interface.aspx
linux命令行界面
更多推荐
所有评论(0)