Getting Started with Linux Fundamentals | Fundamentals in Fundamentals

foreword
This article mainly introduces some very basic introductory knowledge to help friends who have no linux foundation, or friends who have switched from windows to linux to establish some basic concepts, so as to facilitate the development of subsequent learning.

terminal
The generalized terminal refers to the general term of all input/output devices, such as keyboard, mouse, monitor, printer, etc. But in many cases, the terminal generally refers to the "virtual terminal", that is, the black window displayed on the screen, similar to the command prompt under Windows.
Shortcuts related to virtual terminal under ubuntu:
1. ctrl + alt + T to open a new terminal
2. shitf + ctrl + T to open a new tab under the current terminal
3. alt + 1/2/3... switch to the first/second/third tab of the current terminal

command parser
Under the virtual terminal, you can type some commands and get the corresponding return results. For example, if you type in data, the current date will be returned. How does a virtual terminal do this? This is where the command parser comes into play. The command parser is actually an application. It accepts commands from the virtual terminal, parses and executes the corresponding programs in the /usr/bin directory, and echoes the results in the virtual terminal.
Common command parsers are: shell/bash/C shell, of which bash is particularly widely used. Different command parsers will have subtle differences, but generally the same.

command/path completion
Sometimes the command is very long or difficult to remember, you can use the completion function. For example, for the command history, in the terminal we only need to type the three letters of his and then the tab key, and the history command will be automatically completed in the terminal. If we only hit the two letters hi and then hit the tab key, there will be no response. Why doesn't it respond? Because there are multiple commands starting with hi, the command parser doesn't know which one you want to enter, so it simply doesn't display it. At this point, tap the tab key again, that is, after typing hi, tap the tab key twice (the interval cannot be too long), and all commands starting with hi will be displayed: hipercdecode hipstopgm history, then add another s, and then Hit the tab key again to complete the history command.
当然补齐功能不仅仅适用于命令,还适用于路径,这对长路径而言尤为有用,而且不易出错。但是不是所有的命令解析器都支持补齐功能,使用时应该注意。

绝对路径/相对路径
绝对路径:从根目录(/)开始描述的路径;
相对路径:从当前目录开始描述的路径。.表示当前目录,..表示当前目录的上一级目录,-两个邻近目录相互切换(cd -)

超级用户
超级用户具体至高无上的权力,可以对系统进行随心所欲的操作,而普通用户则被限制了相关权限,涉及到一些敏感的操作将被拒绝。我们在日常操作中,为了保证安全,一般使用普通用户登入系统。但在普通用户身份下想要临时获取超级用户权限,可在命令前加sudo,比如:sudo mv aa bb。使用此命令将在5分钟内得到超级用户权限,也就是说在5分钟内,不需要再重复输入sudo就可以具有超级用户权限。
此外,可以直接通过sudo su切换到超级用户。想要退出超级用户,输入exit即可。

终端提示符
我们登入到linux系统后,会出现类似于这样的提示符:alvin@alvin-pc:~$,含义如下:
1. alvin: 表示当前登入的用户;
2. @: 读作at,在的意思;
3. alvin-pc: 主机名;
4. ~: 当前目录(~表示为用户主目录);
5. $: 表示当前以普通用户身份登入,如果是#的话表示root(超级用户)身份。

文件或目录的颜色
Linux环境下,系统是通过颜色来区分文件类型的,具体如下:
白色:普通文件
蓝色:目录
绿色:可执行程序
红色:压缩文件
青色:链接文件
黄色:设备文件
灰色:其它文件

命令参数前的横杠
1. 大部分命令参数前有横杠,比如:ls -al;
2. 有些命令参数前横杠可有可无,比如:tar -zxvf test.tar.gz或者tar-zxvf test.tar.gz均可;
3. 一般单个横杠之后跟的是字母,如:rm -r test/,双横杠之后跟的是单词,如:git --help

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324844968&siteId=291194637