• 系统目录结构  ls命令 文件类型 alias命令


    [root@lizhipeng01 ~]# ls                                            ls用于查看系统中的文件与目录
    1.txt anaconda-ks.cfg a.txt bb split_dir testb.txt testc.txt 学习计划安排.txt

    [root@lizhipeng01 ~]# ls /                                           根目录
    bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var

    [root@lizhipeng01 ~]# ls /root/                                  root家目录
    1.txt anaconda-ks.cfg a.txt bb split_dir testb.txt testc.txt 学习计划安排.txt

    [root@lizhipeng01 ~]# tree                                        树形的形式显示一个目录下的子目录和文件
    .
    ├── 1.txt
    ├── anaconda-ks.cfg
    ├── a.txt
    ├── bb
    │   ├── AA.SH
    │   ├── ERT.TXT
    │   └── QWE.TXT
    ├── split_dir
    │   ├── passwd
    │   ├── xaa
    │   └── xab
    ├── testb.txt
    ├── testc.txt
    └── 345255246344271240350256241345210222345256211346216222.txt

    2 directories, 12 files

    [root@lizhipeng01 ~]# tree -L 2 /                                     显示最大2层
    /
    ├── bin -> usr/bin
    ├── boot
    │   ├── config-3.10.0-229.el7.x86_64
    │   ├── grub
    │   ├── grub2
    │   ├── initramfs-0-rescue-3b8392e094e646bdbf531370d5cabc5e.img
    │   ├── initramfs-3.10.0-229.el7.x86_64.img
    │   ├── initramfs-3.10.0-229.el7.x86_64kdump.img
    │   ├── initrd-plymouth.img
    │   ├── symvers-3.10.0-229.el7.x86_64.gz
    │   ├── System.map-3.10.0-229.el7.x86_64
    │   ├── vmlinuz-0-rescue-3b8392e094e646bdbf531370d5cabc5e
    │   └── vmlinuz-3.10.0-229.el7.x86_64
    ├── dev
    │   ├── agpgart
    │   ├── autofs
    │   ├── block
    │   ├── bsg
    │   ├── btrfs-control
    │   ├── bus
    │   ├── cdrom -> sr0
    │   ├── centos

    [root@lizhipeng01 ~]# ls /sbin/                   这个下面的命令一般都是root用户用的,普通用户没有权限用,普通用户用/bin/下

    [root@lizhipeng01 ~]# ls /boot/                  系统启动时的一些相关文件

    [root@lizhipeng01 ~]# ls /dev                   设备文件

    [root@lizhipeng01 ~]# ls /etc/sysconfig/network-scripts/ifcfg-eno16777736    系统配置文件所在的路径

    [root@lizhipeng01 ~]# ls /home/      用户的家目录
    lizhipeng

    [root@lizhipeng01 ~]# ls /lib/ /lib64/  存放系统的库文件

    [root@lizhipeng01 ~]# ldd /bin/ls       查看ls命令依赖于哪些库文件
    linux-vdso.so.1 => (0x00007fffde962000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f4e2ab1c000)
    libcap.so.2 => /lib64/libcap.so.2 (0x00007f4e2a917000)
    libacl.so.1 => /lib64/libacl.so.1 (0x00007f4e2a70d000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f4e2a34c000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f4e2a0eb000)
    liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f4e29ec5000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f4e29cc1000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f4e2ad47000)
    libattr.so.1 => /lib64/libattr.so.1 (0x00007f4e29abc000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4e2989f000)

    [root@lizhipeng01 ~]# ls /run/       一些进程产生的临时文件,一关机就会消失
    auditd.pid dbus initramfs lvmetad.pid plymouth sshd.pid tuned
    console dmeventd-client lock mount ppp syslogd.pid udev
    crond.pid dmeventd-server log netreport sepermit systemd user
    cron.reboot faillock lvm NetworkManager setrans tmpfiles.d utmp

    [root@lizhipeng01 ~]# ls /srv/      存放一些服务产生的文件

    [root@lizhipeng01 ~]# ls /sys/      存放一些与系统内核相关的文件
    block bus class dev devices firmware fs hypervisor kernel module power

    [root@lizhipeng01 ~]# ls /usr/    这是一个非常重要的目录,类似于Windows下的Program Files目录,用户的很多应用程序和文件都存放在该目录下。
    bin etc games include lib lib64 libexec local sbin share src tmp

    [root@lizhipeng01 ~]# ls /tmp    该目录是用来存放一些临时文件的。
    bb split_dir

    [root@lizhipeng01 ~]# ls /usr/bin   该目录存放的是系统用户使用的应用程序

    [root@lizhipeng01 ~]# ls /usr/sbin  该目录存放的是超级用户使用的比较高级的管理程序和系统守护程序。

    [root@lizhipeng01 ~]# ls /usr/src    /usr/src :该目录是内核源代码默认的放置目录
    debug kernels

    [root@lizhipeng01 ~]# ls /var                       该目录存放的是在不断扩充且经常被修改的目录,包括各种日志文件或者pid文件
    adm crash empty gopher lib lock mail opt run tmp yp
    cache db games kerberos local log nis preserve spool var

    /etc目录下是系统的配置文件,如果更改了该目录下的某个文件可能会导致系统无法正常启动。

    /bin、/sbin、/usr/bin和/usr/sbin目录是系统预设的执行文件的放置目录,其中/bin和/usr/bin目录下是供系统用户使用的指令(除root外的通用账户),而/sbin和/usr/sbin目录下则是供root使用的指令。比如ls指令就存放在/bin/目录下。
    /var也是一个非常重要的目录,系统上运行各个程序时所产生的日志都被记录在该目录下(即/var/log目录中),另外mail指令的预设也放置在这里。
     

    [root@lizhipeng01 ~]# ls -l                                      第二个数字表明多少个文件使用相同的inode      第二个数字表示文件的大小B
    总用量 28
    -rw-r--r--. 1 root root 6 12月 2 05:53 1.txt
    -rw-------. 1 root root 1257 11月 26 21:04 anaconda-ks.cfg
    -rw-r--r--. 1 root root 3 11月 28 08:01 a.txt
    drwxr-xr-x. 2 root root 46 12月 3 23:55 bb
    drwxr-xr-x. 2 root root 39 12月 3 23:06 split_dir
    -rw-r--r--. 1 root root 4 12月 3 22:51 testb.txt
    -rw-r--r--. 1 root root 958 12月 4 05:06 testc.txt
    -rw-r--r--. 1 root root 7196 11月 26 20:28 学习计划安排.txt
    [root@lizhipeng01 ~]# ls -i anaconda-ks.cfg         inode相同表明文件所存放的块的位置是一样的,硬链接
    67923808 anaconda-ks.cfg    

    [root@lizhipeng01 ~]# ls -la                                   查看所有的文件包括隐藏的
    总用量 72
    dr-xr-x---. 5 root root 4096 12月 14 05:58 .
    dr-xr-xr-x. 17 root root 4096 12月 15 06:50 ..
    -rw-r--r--. 1 root root 6 12月 2 05:53 1.txt
    -rw-------. 1 root root 1257 11月 26 21:04 anaconda-ks.cfg
    -rw-r--r--. 1 root root 3 11月 28 08:01 a.txt
    -rw-------. 1 root root 10682 12月 15 08:27 .bash_history
    -rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
    -rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
    -rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
    drwxr-xr-x. 2 root root 46 12月 3 23:55 bb
    -rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
    drwxr-xr-x. 2 root root 39 12月 3 23:06 split_dir
    drwx------. 2 root root 76 12月 15 08:14 .ssh
    -rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
    -rw-r--r--. 1 root root 4 12月 3 22:51 testb.txt
    -rw-r--r--. 1 root root 958 12月 4 05:06 testc.txt
    -rw-------. 1 root root 3969 12月 10 05:17 .viminfo
    -rw-r--r--. 1 root root 7196 11月 26 20:28 学习计划安排.txt

    [root@lizhipeng01 ~]# ls -ld /root/
    dr-xr-x---. 5 root root 4096 12月 14 05:58 /root/

    [root@lizhipeng01 ~]# ls -lta                              时间越早越在上面
    总用量 72
    -rw-------. 1 root root 10682 12月 15 08:27 .bash_history
    drwx------. 2 root root 76 12月 15 08:14 .ssh
    dr-xr-xr-x. 17 root root 4096 12月 15 06:50 ..
    dr-xr-x---. 5 root root 4096 12月 14 05:58 .
    -rw-------. 1 root root 3969 12月 10 05:17 .viminfo
    -rw-r--r--. 1 root root 958 12月 4 05:06 testc.txt
    drwxr-xr-x. 2 root root 46 12月 3 23:55 bb
    drwxr-xr-x. 2 root root 39 12月 3 23:06 split_dir
    -rw-r--r--. 1 root root 4 12月 3 22:51 testb.txt
    -rw-r--r--. 1 root root 6 12月 2 05:53 1.txt
    -rw-r--r--. 1 root root 3 11月 28 08:01 a.txt
    -rw-------. 1 root root 1257 11月 26 21:04 anaconda-ks.cfg
    -rw-r--r--. 1 root root 7196 11月 26 20:28 学习计划安排.txt
    -rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
    -rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
    -rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
    -rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
    -rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
    [root@lizhipeng01 ~]# ls -la
    总用量 72
    dr-xr-x---. 5 root root 4096 12月 14 05:58 .
    dr-xr-xr-x. 17 root root 4096 12月 15 06:50 ..
    -rw-r--r--. 1 root root 6 12月 2 05:53 1.txt
    -rw-------. 1 root root 1257 11月 26 21:04 anaconda-ks.cfg
    -rw-r--r--. 1 root root 3 11月 28 08:01 a.txt
    -rw-------. 1 root root 10682 12月 15 08:27 .bash_history
    -rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
    -rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
    -rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
    drwxr-xr-x. 2 root root 46 12月 3 23:55 bb
    -rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
    drwxr-xr-x. 2 root root 39 12月 3 23:06 split_dir
    drwx------. 2 root root 76 12月 15 08:14 .ssh
    -rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
    -rw-r--r--. 1 root root 4 12月 3 22:51 testb.txt
    -rw-r--r--. 1 root root 958 12月 4 05:06 testc.txt
    -rw-------. 1 root root 3969 12月 10 05:17 .viminfo
    -rw-r--r--. 1 root root 7196 11月 26 20:28 学习计划安排.txt

    [root@lizhipeng01 ~]# ls -l   根目录下的所有子目录
    总用量 28
    -rw-r--r--. 1 root root 6 12月 2 05:53 1.txt
    -rw-------. 1 root root 1257 11月 26 21:04 anaconda-ks.cfg
    -rw-r--r--. 1 root root 3 11月 28 08:01 a.txt
    drwxr-xr-x. 2 root root 46 12月 3 23:55 bb
    drwxr-xr-x. 2 root root 39 12月 3 23:06 split_dir
    -rw-r--r--. 1 root root 4 12月 3 22:51 testb.txt
    -rw-r--r--. 1 root root 958 12月 4 05:06 testc.txt
    -rw-r--r--. 1 root root 7196 11月 26 20:28 学习计划安排.txt
    [root@lizhipeng01 ~]# ls -ld   根目录本身
    dr-xr-x---. 5 root root 4096 12月 14 05:58 .

    [root@lizhipeng01 ~]# ls -l
    总用量 28
    -rw-r--r--. 1 root root 6 12月 2 05:53 1.txt                                           -表示普通文件(包括命令),d表示目录
    -rw-------. 1 root root 1257 11月 26 21:04 anaconda-ks.cfg
    -rw-r--r--. 1 root root 3 11月 28 08:01 a.txt
    drwxr-xr-x. 2 root root 46 12月 3 23:55 bb
    drwxr-xr-x. 2 root root 39 12月 3 23:06 split_dir
    -rw-r--r--. 1 root root 4 12月 3 22:51 testb.txt
    -rw-r--r--. 1 root root 958 12月 4 05:06 testc.txt
    -rw-r--r--. 1 root root 7196 11月 26 20:28 学习计划安排.txt

    [root@lizhipeng01 ~]# ls -l /dev/  

    crw-rw----. 1 root video    10, 175 12月 16 05:27 agpgart            c表示字符串设备

    lrwxrwxrwx. 1 root root 3 12月 16 05:27 cdrom -> sr0                  l表示软链接文件

    brw-rw----. 1 root disk 8, 2 12月 16 05:27 sda2                             b块设备

    srw-rw-rw-. 1 root root 0 12月 16 05:27 log                                    socket,用于进程通信

    [root@lizhipeng01 ~]# alias      别名
    alias cp='cp -i'
    alias egrep='egrep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias grep='grep --color=auto'
    alias l.='ls -d .* --color=auto'
    alias ll='ls -l --color=auto'
    alias ls='ls --color=auto'
    alias mv='mv -i'
    alias rm='rm -i'
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

    [root@lizhipeng01 ~]# alias lizhipeng='ls -lha'
    [root@lizhipeng01 ~]# lizhipeng
    总用量 72K
    dr-xr-x---. 5 root root 4.0K 12月 14 05:58 .
    dr-xr-xr-x. 17 root root 4.0K 12月 15 06:50 ..
    -rw-r--r--. 1 root root 6 12月 2 05:53 1.txt
    -rw-------. 1 root root 1.3K 11月 26 21:04 anaconda-ks.cfg
    -rw-r--r--. 1 root root 3 11月 28 08:01 a.txt
    -rw-------. 1 root root 11K 12月 15 08:27 .bash_history
    -rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
    -rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
    -rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
    drwxr-xr-x. 2 root root 46 12月 3 23:55 bb
    -rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
    drwxr-xr-x. 2 root root 39 12月 3 23:06 split_dir
    drwx------. 2 root root 76 12月 15 08:14 .ssh
    -rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
    -rw-r--r--. 1 root root 4 12月 3 22:51 testb.txt
    -rw-r--r--. 1 root root 958 12月 4 05:06 testc.txt
    -rw-------. 1 root root 3.9K 12月 10 05:17 .viminfo
    -rw-r--r--. 1 root root 7.1K 11月 26 20:28 学习计划安排.txt
    [root@lizhipeng01 ~]# whicj lizhipeng
    -bash: whicj: 未找到命令
    [root@lizhipeng01 ~]# which lizhipeng
    alias lizhipeng='ls -lha'
    /usr/bin/ls

    [root@lizhipeng01 ~]# unalias lizhipeng
    [root@lizhipeng01 ~]# lizhipeng
    -bash: lizhipeng: 未找到命令
    [root@lizhipeng01 ~]#

  • 相关阅读:
    POJ 1887 Testing the CATCHER
    HDU 3374 String Problem
    HDU 2609 How many
    POJ 1509 Glass Beads
    POJ 1458 Common Subsequence
    POJ 1159 Palindrome
    POJ 1056 IMMEDIATE DECODABILITY
    POJ 3080 Blue Jeans
    POJ 1200 Crazy Search
    软件体系结构的艺术阅读笔记1
  • 原文地址:https://www.cnblogs.com/sisul/p/8045329.html
Copyright © 2020-2023  润新知