Linux命令注解
1.Linux系统基础2.Linux系统三种安装方式3.vim基础4.查询文件命令5.编辑网络配置文件6.vimtutor总结7.建立yum仓库8.Linux系统用户创建及权限9.Linux磁盘分盘10.自动挂载11.Linux系统安装程序---编译安装并加入systemd中12.计算机网络的参考模型13.IP地址14.交换机15.路由器16.VLAN17.不同vlan通信连接18.VRRP协议19.ACL与NAT20.网络部份考题21.Linux基础
22.Linux命令注解
23.目录命令24.操作命令25.压缩解压26.显示命令27.查询命令28.RIAD配置摘要29.系统启动引导30.进程以及其有关命令31.问题解析32.系统安全33.日志34.脚本大纲35.文本编辑器36.常用脚本37.LAMP38.LNMP39.nginx使用40.LVS集群41.Keepalived应用42.Tomcat43.自动化部署ansible44.Haproxy反向代理45.安装MySQLLinux命令
定义:
- 在 Linux 操作系统中,凡是在字符操作界面中输入能够完成特定操作和任务的字符串都
可以称为命令。 - 严格来说,命令通常只代表实现某一类功能的程序的名称。
格式:
命令字+空格+[选项]+空格+[参数]
- 命令字
是整条命令中最关键的一部分
唯一确定 - 选项
短格式选项:使用“-”符号引导 通常 一个字母
长格式选项:使用“--”符号引导 通常完整的单词 - 参数
命令字的处理对象
可以是文件名、目录(路径)名或用户名等内容
个数可以是零到多个
;可以隔开命令,执行多个命令
编辑Linux命令行的辅助操作(扩展)
快捷键 | 功能 |
---|---|
Tab 键 | 自动补齐(两次可以显示所有选项) |
反斜杠“\” | 强制换行或转义 |
Ctrl+e 或 end 键 | 光标移到最后 |
Ctrl+U | 清空至行首不包括当前光标处的 字符 |
Ctrl+K | 清空至行尾包括当前光标处的字符 |
Ctrl+a | 光标移到最前 |
Ctrl+w | 从当前光标删除到开头 |
ALT+d | 从当前光标删除末尾 |
Ctrl+l | 清屏 |
Ctrl+c | 取消本次命令编辑 |
Ctrl+s/Ctrl+q | 锁屏/解锁 |
向上下箭头 | 回看执行过的命令 |
格式说明(扩展)
- []表示可选项
- CAPS或<>表示可变化的数据
- ...表示一个列表可加多个一个或多个
- x|y|z 表示或的意思
- -abc 是-a -b -c (有些命令选项有先后顺序) 多个 -abc 一般而言是没有顺序先后 (绝大多数是没有的,只有少数分先后)
帮助命令
help
help用于内部命令
[root@localhost ~]# help cd
cd: cd [-L|[-P [-e]]] [dir]
Change the shell working directory.
Change the current directory to DIR. The default DIR is the value of the
HOME shell variable.
The variable CDPATH defines the search path for the directory containing
DIR. Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory. If DIR begins
with a slash (/), then CDPATH is not used.
If the directory is not found, and the shell option `cdable_vars' is set,
the word is assumed to be a variable name. If that variable has a value,
its value is used for DIR.
Options:
-L force symbolic links to be followed
-P use the physical directory structure without following symbolic
links
-e if the -P option is supplied, and the current working directory
cannot be determined successfully, exit with a non-zero status
The default is to follow symbolic links, as if `-L' were specified.
Exit Status:
Returns 0 if the directory is changed, and if $PWD is set successfully when
-P is used; non-zero otherwise.
--help用于外部命令
ls --help
用法:ls [选项]... [文件]...
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 不隐藏任何以. 开始的项目
-A, --almost-all 列出除. 及.. 以外的任何项目
--author 与-l 同时使用时列出每个文件的作者
-b, --escape 以八进制溢出序列表示不可打印的字符
--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
-B, --ignore-backups do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last
modification of file status information);
with -l: show ctime and sort by name;
otherwise: sort by ctime, newest first
-C list entries by columns
--color[=WHEN] colorize the output; WHEN can be 'never', 'auto',
or 'always' (the default); more info below
-d, --directory list directories themselves, not their contents
-D, --dired generate output designed for Emacs' dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify append indicator (one of */=>@|) to entries
--file-type likewise, except do not append '*'
--format=WORD across -x, commas -m, horizontal -x, long -l,
single-column -1, verbose -l, vertical -C
--full-time like -l --time-style=full-iso
-g 类似-l,但不列出所有者
--group-directories-first
group directories before files;
can be augmented with a --sort option, but any
use of --sort=none (-U) disables grouping
-G, --no-group 以一个长列表的形式,不输出组名
-h, --human-readable 与-l 一起,以易于阅读的格式输出文件大小
(例如 1K 234M 2G)
--si 同上面类似,但是使用1000 为基底而非1024
-H, --dereference-command-line
follow symbolic links listed on the command line
--dereference-command-line-symlink-to-dir
follow each command line symbolic link
that points to a directory
--hide=PATTERN do not list implied entries matching shell PATTERN
(overridden by -a or -A)
--indicator-style=WORD append indicator with style WORD to entry names:
none (default), slash (-p),
file-type (--file-type), classify (-F)
-i, --inode print the index number of each file
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN
-k, --kibibytes default to 1024-byte blocks for disk usage
-l 使用较长格式列出信息
-L, --dereference 当显示符号链接的文件信息时,显示符号链接所指示
的对象而并非符号链接本身的信息
-m 所有项目以逗号分隔,并填满整行行宽
-n, --numeric-uid-gid 类似 -l,但列出UID 及GID 号
-N, --literal 输出未经处理的项目名称 (如不特别处理控制字符)
-o 类似 -l,但不列出有关组的信息
-p, --indicator-style=slash 对目录加上表示符号"/"
-q, --hide-control-chars print ? instead of nongraphic characters
--show-control-chars show nongraphic characters as-is (the default,
unless program is 'ls' and output is a terminal)
-Q, --quote-name enclose entry names in double quotes
--quoting-style=WORD use quoting style WORD for entry names:
literal, locale, shell, shell-always, c, escape
-r, --reverse 逆序排列
-R, --recursive 递归显示子目录
-s, --size 以块数形式显示每个文件分配的尺寸
-S sort by file size
--sort=WORD sort by WORD instead of name: none (-U), size (-S),
time (-t), version (-v), extension (-X)
--time=WORD with -l, show time as WORD instead of default
modification time: atime or access or use (-u)
ctime or status (-c); also use specified time
as sort key if --sort=time
--time-style=STYLE with -l, show times using style STYLE:
full-iso, long-iso, iso, locale, or +FORMAT;
FORMAT is interpreted like in 'date'; if FORMAT
is FORMAT1<newline>FORMAT2, then FORMAT1 applies
to non-recent files and FORMAT2 to recent files;
if STYLE is prefixed with 'posix-', STYLE
takes effect only outside the POSIX locale
-t sort by modification time, newest first
-T, --tabsize=COLS assume tab stops at each COLS instead of 8
-u with -lt: sort by, and show, access time;
with -l: show access time and sort by name;
otherwise: sort by access time
-U do not sort; list entries in directory order
-v natural sort of (version) numbers within text
-w, --width=COLS assume screen width instead of current value
-x list entries by lines instead of by columns
-X sort alphabetically by entry extension
-1 list one file per line
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 显示此帮助信息并退出
--version 显示版本信息并退出
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).
使用色彩来区分文件类型的功能已被禁用,默认设置和 --color=never 同时禁用了它。
使用 --color=auto 选项,ls 只在标准输出被连至终端时才生成颜色代码。
LS_COLORS 环境变量可改变此设置,可使用 dircolors 命令来设置。
退出状态:
0 正常
1 一般问题 (例如:无法访问子文件夹)
2 严重问题 (例如:无法使用命令行参数)
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
请向<http://translationproject.org/team/zh_CN.html> 报告ls 的翻译错误
要获取完整文档,请运行:info coreutils 'ls invocation'
man
格式:man [选项](不写默认1) [对象]
查看man指令手册
[root@localhost ~]# man man
[选项]
该清单是一组用冒号分隔的欲查找的手册清单。此选项将覆盖 MANSECT 环境变量。
有些指令或程序可能有一个以上的主题,它们位于不同的区段中。因此,要查看较后的区
段,你可以在此指定 man 查找区段的顺序。具体区段划分如下所示:
区段1:用户指令
区段2:系统调用
区段3:程序库调用
区段4:设备
区段5:文件格式
区段6:游戏
区段7:杂项
区段8:系统指令
区段9:内核内部指令
区段n:Tcl或Tk指令
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了