首页 > 其他分享 >help-man-cd命令

help-man-cd命令

时间:2024-03-27 19:12:50浏览次数:32  
标签:sort 文件 help -- cd time directory man

Linux命令

定义:
  1. 在 Linux 操作系统中,凡是在字符操作界面中输入能够完成特定操作和任务的字符串都
    可以称为命令。
  2. 严格来说,命令通常只代表实现某一类功能的程序的名称。
格式:

命令字+空格+[选项]+空格+[参数]

  1. 命令字
    是整条命令中最关键的一部分
    唯一确定
  2. 选项
    短格式选项:使用“-”符号引导 通常 一个字母
    长格式选项:使用“--”符号引导 通常完整的单词
  3. 参数
    命令字的处理对象
    可以是文件名、目录(路径)名或用户名等内容
    个数可以是零到多个

;可以隔开命令,执行多个命令

编辑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指令

目录命令

cd

cd 目标位置 change directory

[root@localhost ~]# cd ..
[root@localhost /]# cd /mnt
[root@localhost mnt]# cd -
/
[root@localhost /]# cd ~sa
~saber/    ~saslauth  
[root@localhost /]# cd ~sa
~saber/    ~saslauth  
[root@localhost /]# cd ~saber
[root@localhost saber]# 
命令 效果
cd cd ~ 若不指定目标位置,切换到当前用户的宿主目录(家目录)
cd - 到前一次目录
一个点号“.”开头(自己) 表示以当前的工作目录作为起点(已点开头的是)
两个点号“..”开头(上一级) 表示以当前目录的上一级目录(父目录)作为起点
“~用户名”形式开头 表示以指定用户的宿主目录(家目录)作为起点
"."开头文件 表示隐藏文件
~ky18 (有个用户叫ky18 家目录为起点) 表示以指定用户的宿主目录作为起点

目录

七类常见的linux的文件

  1. d 目录文件directory
  2. b 块设备文件block 块设备文件,就是保存大块数据的设备,比如最常见的硬盘。
  3. c 字符设备character 这些文件通常隐藏在 /dev/ 目录下,当进行设备读取或外设交互时才会被使用
  4. l 符号链接文件link
  5. p 管道文件pipe 主要用于进程间通信单向传输 一个发一个输管道文件
  6. s 套接字文件socket 套接字文件一般隐藏在 /var/run/ 目录下,用于进程间的网络通信
  7. -普通文件 普通文件,包括纯文本文件、二进制文件、各种压缩文件等
第一个字符 文件类型
- 普通文件,包括纯文本文件、二进制文件、各种压缩文件等。
d 目录,类似 Windows 系统中的文件夹。
b 块设备文件,就是保存大块数据的设备,比如最常见的硬盘。
c 字符设备文件,例如键盘、鼠标等。
s 套接字文件,通常用在网络数据连接,可以启动一个程序开监听用户的要求,用户可以通过套接字进行数据通信。
p 管道文件,其主要作用是解决多个程序同时存取一个文件所造成的错误。
l 链接文件,类似 Windows 系统中的快捷方式。

标签:sort,文件,help,--,cd,time,directory,man
From: https://www.cnblogs.com/GrandOB/p/18100011

相关文章

  • 教你用Chrome 浏览器+Postman搞定接口测试
    如果把测试简单分为两类,那么就是客户端测试和服务端测试。客户端的测试包括UI测试,兼容性测试等,服务端测试包括接口测试。接口测试检查数据的交换,传递和控制管理过程,它绕过了客户端,直接对服务端进行测试。客户端测试与服务端测试的关系图:服务端非常复杂,就像下图的阿里核心链路图......
  • 2024妈妈杯数学建模思路ABCD题思路汇总分析 MathorCup建模思路分享
    文章目录1赛题思路2比赛日期和时间3组织机构4建模常见问题类型4.1分类问题4.2优化问题4.3预测问题4.4评价问题5建模资料1赛题思路(赛题出来以后第一时间在CSDN分享)https://blog.csdn.net/dc_sinor?type=blog2比赛日期和时间报名截止时间:2024年4月11......
  • 如何理解CDN?说说实现原理?
    一、是什么CDN(全称ContentDeliveryNetwork),即内容分发网络构建在现有网络基础之上的智能虚拟网络,依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞,提高用户访问响应速度和命中率。CDN 的关键技术主要有内......
  • Etcd 基本入门
    1:什么是Etcd?Etcd是CoreOS团队于2013年6月发起的开源项目,它的目标是构建一个高可用的分布式键值(key-value)数据库。etcd内部采用raft协议作为一致性算法,Etcd基于Go语言实现。名字由来,它源于两个方面,unix的“/etc”文件夹和分布式系统(“D”istributesystem)的D,组合......
  • 痞子衡嵌入式:给i.MXRT1xxx系列GPIO提早供电会影响DCDC_PSWITCH上电时序导致内部DCDC启
    大家好,我是痞子衡,是正经搞技术的痞子。今天痞子衡给大家介绍的是给i.MXRT1xxx系列GPIO提早供电会影响DCDC_PSWITCH上电时序导致内部DCDC启动失败。最近有一个RW612产品线的同事在设计一个双MCU系统Demo时发现,当RW612板卡和RT1060板卡通过UART对接时,如果RW6......
  • [转帖]SPECjbb MultiJVM - Java Performance
     MovingonfromSPECCPU,weshiftovertoSPECjbb2015.SPECjbbisafromground-updevelopedbenchmarkthataimstocoverbothJavaperformanceandserver-likeworkloads,fromtheSPECwebsite:“TheSPECjbb2015benchmarkisbasedontheusagemodelofa......
  • [Kubernetes] Managing Application with Kubernetes - Autoscaling
    Defineautoscaling:AutoscalingisthedynamicadjustmentofresourcesinaKubernetesclusterbasedonworkloaddemand.Itoptimizesresourceusageandcostsbyautomaticallyscalingresourcesupordowntomatchdemand.Autoscalingcanoccurattheclu......
  • Proteus8.0仿真应用设计(十七)基于FreeRTOS、STM32F103C8、HAL库、DHT11、LCD12864的温
    一、简介:        DHT11是一款湿、温度一体化的数字传感器。该传感器包括一个电阻式测湿元件和一个NTC测温元件。DHT11与单片机之间能采用简单的单总线进行通信,仅仅需要一个I/O口。通过单片机等微处理器简单的电路连接就能够实时的采集本地湿度和温度。传感器内部......
  • 飞算云PCDN源头工厂免费代理加盟!
    飞算云是一家致力于提供创新的产品和服务的互联网科技公司,其主要业务涵盖了内容分发网络(CDN)和边缘计算领域。源头工厂产量高不扣量,免费加盟代理:13540308877飞算云PCDN通过构建遍布全球的海量加速节点,使得用户能够就近获取所需内容,从而避免了因网络拥堵、跨运营商、跨地域、跨境......
  • 论文解读(ACDNE)《Adversarial Deep Network Embedding for Cross-Network Node Classif
    Note:[wechat:Y466551|可加勿骚扰,付费咨询]论文信息论文标题:AdversarialDeepNetworkEmbeddingforCross-NetworkNodeClassification论文作者:XiaoShen、QuanyuDai、Fu-laiChung、WeiLu、Kup-SzeChoi论文来源:2020 AAAI论文地址:download 论文代码:download视屏讲解:c......