# Linux中几个常用的热键(`Tab`,`Ctrl+C`,`Ctrl+D`)
## Tab键
+ 命令补全: `tab`接在一串指令的第一个字的后面
+ 文件补全:`tab` 接在一串指令的第二个字以后时
+ 若安装 `bash-completion `软件,则在某些指令后面使用 [tab] 按键时,可以进行“选项/参数的补齐”功能!
## Ctrl + C
中断当前运行的程序
## Ctrl + D
相当于输入`exit`
错误信息查看:
造成`command not found`的原因可能是:
+ 这个指令不存在,因为该软件没有安装之故。解决方法就是安装该软件;
+ 这个指令所在的目录目前的用户并没有将他加入指令搜寻路径中,请参考第十章bash的PATH说明;
+ 很简单!因为你打错字!
# Linux系统的求助
## 指令`--help`的说明
```shell
[root@localhost ~]# ls --help
Usage: ls [OPTION]... [FILE]... # 基本语法
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
# 参数说明
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print C-style escapes for nongraphic characters
--block-size=SIZE scale sizes by SIZE before printing them; e.g.,
'--block-size=M' prints sizes in units of
1,048,576 bytes; see SIZE format below
SELinux options:
--lcontext Display security context. Enable -l. Lines
will probably be too wide for most displays.
-Z, --context Display security context so it fits on most
displays. Displays only mode, user, group,
security context and file name.
--scontext Display only security context and file name.
--help display this help and exit
--version output version information and exit
SIZE is an integer and optional unit (example: 10M is 10*1024*1024). Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).
Using color to distinguish file types is disabled both by default and
with --color=never. With --color=auto, ls emits color codes only when
standard output is connected to a terminal. The LS_COLORS environment
variable can change the settings. Use the dircolors command to set it.
Exit status:
0 if OK,
1 if minor problems (e.g., cannot access subdirectory),
2 if serious trouble (e.g., cannot access command-line argument).
GNU coreutils online help:
For complete documentation, run: info coreutils 'ls invocation'
```
## man page
`man`是`manual`的缩写,就是说手册
```shell
[root@localhost ~]# man date
```
# 简单的文本编辑器——nano
## 新建或打开文件
```bash
$ nano a.txt
GNU nano 2.3.1 File: text.txt
| # 光标
[ New File ]
^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Te ^T To Spell
```
上面的`^`表示的是`Ctrl`
# 正确的关机方式
| 命令 | 描述 |
| --- | --- |
| `netstat -a` | 查看网络连接的状态 |
|`ps -aux `| 查看后台运行的程序|
|`shutdown、halt、reboot、及init`|它们都可以达到重启系统的目的|
shutdown、halt、reboot、init之间的区别
**halt**
作用: 关机
使用权限:系统管理者
使用方式:halt [-n] [-w] [-d] [-f] [-i] [-p]
说明:若系统的 runlevel 为 0 或 6 ,则关闭系统,否则以 shutdown 指令(加上 -h 参数)来取代
参数:
+ -n : 在关机前不做将记忆体资料写回硬盘的动作
+ -w : 并不会真的关机,只是把记录写到 /var/log/wtmp 档案里
+ -d : 不把记录写到 /var/log/wtmp 档案里(-n 这个参数包含了 -d) -f : 强迫关机,不呼叫 shutdown 这个指令
+ -i : 在关机之前先把所有网络相关的装置先停止
+ -p : 当关机的时候,顺便做关闭电源(poweroff)的动作
```bash
halt -p #关闭系统后关闭电源。
halt -d #关闭系统,但不留下纪录。
```
**shutdown**:
作用:关机
**reboot **:
作用:重启