美文网首页
RHCE认证学习-目录介绍及常用命令

RHCE认证学习-目录介绍及常用命令

作者: 早_wsm | 来源:发表于2019-10-09 14:17 被阅读0次

一、目录结构

在图形化界面中我们可以看根下的所有目录


image

在命令行下可以通过使用命令得到命令结构的分布

tree -L 1  /

 bin -> usr/bin              /bin 与 /usr/bin      存放命令
├── sbin -> usr/sbin         /sbin 与 /usr/sbin    存放 super bin root使用的命令
├── boot                     引导分区  引导程序与系统内核
├── dev                      device 设备 光盘 磁盘分区 
├── etc                      系统配置文件 
├── home                     普通用户家目录  ~    用户  /home
├── root                     root用户家目录  ~    /root 
├── lib -> usr/lib           #库文件 的目录 
├── lib64 -> usr/lib64       #库文件 的目录 
├── media                    #空 用来给光盘使用
├── mnt                      #临时挂载 linux设备或分区 挂载才能使用 挂载===给设备指定入口
├── opt                      #空 第三方软件默认安装位置 
├── proc                     #process 进程 虚拟目录 里面存放的是内存信息(进程信息 cpu信息等等)
├── sys                      #硬件的一些设置信息
├── tmp                      #temp temproray 临时目录
├── usr                      #user/Unix Software Resource  用户软件 信息
└── var                      #variable 经常变换的内容 日志 

二、常用命令

  • 1.与文件相关
    1.1 file 查看文件类型
    [root@gcy ~]# file anaconda-ks.cfg 
    anaconda-ks.cfg: ASCII text
    [root@gcy ~]# file gcy/
    gcy/: directory
    
    1.2 touch 创建文件
    touch /file.txt 若不存在file.txt则创建一个空文件,若存在则更新文件的时间
    1.3 rm 删除文件
    rm -f /file.txt           #-f 强制删除
    
    1.4 wc 统计文件的行数字符数等
    -l 显示行数
    -w 显示单词数
    -c 显示字符数
    [root@gcy ~]# wc /etc/passwd
    39   77 2005 /etc/passwd                   行数  单词数 字符数 文件名
    
    1.5 ln 创建链接
    ln -s 创建软链接
    [root@gcy ~]# ln -s /file.txt aa
    [root@gcy ~]# ll
    总用量 8
    lrwxrwxrwx. 1 root root    9 10月  7 19:55 aa -> /file.txt
    
    1.6 cat 查看文件
    适合查看小文件
    1.7 more 查看文件
    一屏一屏查看,通过按回车键向下翻
    1.8 less 查看文件
    可通过空格和上下键及翻页功能键控制查看
    1.9 head 查看文件
    查看文件的前几行
    查看前5行 head -5 文件
    1.10 tail 查看文件
    查看文件的尾几行
    查看尾5行 tail -5 文件
    tail -f 日志        查看实时日志
    
  • 2.与目录相关
    2.1 mkdir 创建目录
    mkdir -p /aa/bb/cc 创建多层目录
    2.2 rm -rf 删除目录
    2.3 cp 拷贝
    可以拷贝文件或目录,也可以做修改文件名使用
    2.4 mv 剪切
    可移动目录或文件,也可做重命名使用

使用帮助命令

  • 1.whatis 介绍及简单解释命令
[root@gcy ~]# whatis ls
ls (1)               - list directory contents
ls (1p)              - list directory contents
  • 2.help 介绍命令的用法
[root@gcy ~]# 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

基本介绍了各个使用参数及用法

  • 3.man 手册
    基本含括了所有命令信息

相关文章

网友评论

      本文标题:RHCE认证学习-目录介绍及常用命令

      本文链接:https://www.haomeiwen.com/subject/cxcbpctx.html