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命令行界面