Linux system directory structure, file type, ls and alias commands

Source: Internet
Author: User
Tags egrep

directory Structure of Linux systems

root directory/vertex, all other directories are under the root. The directories and subdirectories below the root are a hierarchical tree structure, much like an upside down tree. The directory structure and disk partitioning of Linux are separate.

root directory
    • /bin the command that stores the binary, which is generally used by ordinary users
    • /boot storage System boot file, corrupt system cannot start
    • /dev Stores the device files,
    • /etc System configuration file and service configuration file, start command configuration file
    • /proc virtual file system that displays process information
    • /LIB/LIB64 Library file
    • /mnt temporary mount point, default is empty
    • /OPT additional application packages, default is empty
    • /sbin command to store root
    • /tmp Temp file directory
    • /USR user programs and data, Help files, commands and other directories
    • /usr/sbin/User Command Directory
    • Directory of services such as/usr/local MySQL
    • /var log file directory
    • Home directory for normal users
    • /root Administrator's Home directory
    • /media Media directory, such as U-disk, default is empty
    • Temporary files generated by the/run process
    • /SRV Service-generated file, default is empty
    • /sys System Kernel Files
The commands involved
  1. LS is the abbreviation of the list, followed by the directory, to view the file information under the directory, such as
    ls /etc/     查看etc下的文件
  2. The tree is followed by a directory, which displays the directory structure. Such as
    yum install -y tree  安装命令tree -L 2 /  树形显示根下的二级目录
  3. Man and command, check the command's Help information
  4. LDD commands, such as
    ldd  /bin/ls  查看ls依赖的库文件
    ls command

    1.-l Options: List file details

    [[email protected] ~]# ls -l总用量 4-rw-------. 1 root root 1261 5月  28 19:09 anaconda-ks.cfg[[email protected] ~]# ls -lh总用量 4.0K-rw-------. 1 root root 1.3K 5月  28 19:09 anaconda-ks.cfg第一列是文件类型加权限,第二列表示有几个文件使用相同的inod,第三列示所有者,第四列是所属组,第五列是文件的大小,单位是B。

    2.-i View the Inod number of the file

    [[email protected] ~]# ls -i 33582987 anaconda-ks.cfg

    3.-a View all files and directories under the directory including hidden

    [[email protected] ~]# ls -la总用量 28dr-xr-x---.  3 root root  147 5月  30 20:20 .dr-xr-xr-x. 17 root root  224 5月  31 22:33 ..-rw-------.  1 root root 1261 5月  28 19:09 anaconda-ks.cfg-rw-------.  1 root root 1334 5月  31 23:46 .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-rw-r--r--.  1 root root  100 12月 29 2013 .cshrcdrwx------.  2 root root   80 5月  31 23:28 .ssh-rw-r--r--.  1 root root  129 12月 29 2013 .tcshrc

    4.-d Show current directory

    [[email protected] ~]# ls -ld /root/dr-xr-x---. 3 root root 147 5月  30 20:20 /root/

    5.-t sorted in chronological order

    [[email protected] ~]# ls -lat总用量 28-rw-------.  1 root root 1334 5月  31 23:46 .bash_historydrwx------.  2 root root   80 5月  31 23:28 .sshdr-xr-xr-x. 17 root root  224 5月  31 22:33 ..dr-xr-x---.  3 root root  147 5月  30 20:20 .-rw-------.  1 root root 1261 5月  28 19:09 anaconda-ks.cfg-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

    6.-h Auto-transform units and-l use together
    7.ll is an alias for ls-l

    [[email protected] ~]# which llalias ll=‘ls -l --color=auto‘/usr/bin/ls
File type
    1. D indicates directory
    2. -Represents normal files, can be viewed with cat, and some binary compiled files cannot be viewed
    3. c = string Device file
    4. L is soft connect hard link file
    5. B-block device discs, disks, etc.
    6. s communication file, alias command for communication between the same machine process

      1. Use which to view the path of a command

      [[email protected] ~]# which lsalias ls=‘ls --color=auto‘/usr/bin/ls

      2.alias view system which commands have aliases

      [[email protected] ~]# aliasalias 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‘

      3.alias aming= ' Ls-lha ' set alias, Unlias aming cancel Alias

Linux system directory structure, file type, ls and alias commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.