Linux中的几个系统预设命令目录/bin, /sbin, /usr/bin, /usr/sbin的区别

路径

/为所有Linux发行版的根目录。

  • /binbinary,存放着最常使用的命令。如文件/目录操作,文件压缩,网络管理,进程管理,模块管理累工具。
  • /sbinsuper user's binary,存放系统管理员才有权限使用的系统管理程序。

/usr路径下存放着很多重要的程序和文件,该目录类似于Windows系统中的Program Files目录。

  • /usr/bin 存放系统用户使用的应用程序。

  • /usr/sbin 存放超级用户才能使用的管理程序和系统守护程序。

  • sum
    /bin/usr/bin是给系统用户用的(除root用户外)
    /sbin/usr/sbin是给root用户用的。

命令数量

wc -l 用于计算文本内容的行数(Word Count --line-numbers)

wyj@g40:~$ ll /bin | wc -l
166
wyj@g40:~$ ll /sbin | wc -l
174
wyj@g40:~$ ll /usr/bin | wc -l
1666
wyj@g40:~$ ll /usr/sbin | wc -l
195

可以看出,/usr/sbin目录中的程序数量是最多的。

Others

  • bin binary 二进制,可执行程序,命令。
  • sbin super user(超级用户)的可执行命令。
  • usr
    usruser的缩写,是曾经的HOME目录(如minix)。用于存放二进制命令,文档,库,头文件,各类程序等
    现在是Unix System Resource的缩写,即Unix系统资源,用于存放程序和数据,其他的都在HOME目录下。

Additional

  • ls /bin
bash          cp             fusermount  loginctl       ntfs-3g        plymouth    sync                            unicode_start
brltty        cpio           getfacl     lowntfs-3g     ntfs-3g.probe  ps          systemctl                       vdir
bunzip2       dash           grep        ls             ntfscat        pwd         systemd                         wdctl
busybox       date           gunzip      lsblk          ntfscluster    rbash       systemd-ask-password            which
bzcat         dd             gzexe       lsmod          ntfscmp        readlink    systemd-escape                  whiptail
bzcmp         df             gzip        mkdir          ntfsfallocate  red         systemd-hwdb                    ypdomainname
bzdiff        dir            hciconfig   mknod          ntfsfix        rm          systemd-inhibit                 zcat
bzegrep       dmesg          hostname    mktemp         ntfsinfo       rmdir       systemd-machine-id-setup        zcmp
bzexe         dnsdomainname  ip          more           ntfsls         rnano       systemd-notify                  zdiff
bzfgrep       domainname     journalctl  mount          ntfsmove       run-parts   systemd-sysusers                zegrep
bzgrep        dumpkeys       kbd_mode    mountpoint     ntfsrecover    sed         systemd-tmpfiles                zfgrep
bzip2         echo           kill        mt             ntfssecaudit   setfacl     systemd-tty-ask-password-agent  zforce
bzip2recover  ed             kmod        mt-gnu         ntfstruncate   setfont     tar                             zgrep
bzless        efibootdump    less        mv             ntfsusermap    setupcon    tempfile                        zless
bzmore        efibootmgr     lessecho    nano           ntfswipe       sh          touch                           zmore
cat           egrep          lessfile    nc             open           sh.distrib  true                            znew
chacl         false          lesskey     nc.openbsd     openvt         sleep       udevadm
chgrp         fgconsole      lesspipe    netcat         pidof          ss          ulockmgr_server
chmod         fgrep          ln          netstat        ping           static-sh   umount
chown         findmnt        loadkeys    networkctl     ping4          stty        uname
chvt          fuser          login       nisdomainname  ping6          su          uncompress
  • ls /sbin
acpi_available   dmstats       getcap             iwevent        mkfs.msdos             pccardctl          swaplabel
agetty           dosfsck       getpcaps           iwgetid        mkfs.ntfs              pivot_root         swapoff
alsa             dosfslabel    getty              iwlist         mkfs.vfat              plipconfig         swapon
apm_available    dumpe2fs      halt               iwpriv         mkhomedir_helper       plymouthd          switch_root
apparmor_parser  e2fsck        hdparm             iwspy          mkntfs                 poweroff           sysctl
badblocks        e2image       hwclock            kbdrate        mkswap                 rarp               tc
blkdeactivate    e2label       ifconfig           killall5       modinfo                raw                telinit
blkdiscard       e2undo        ifdown             ldconfig       modprobe               reboot             tipc
blkid            fatlabel      ifquery            ldconfig.real  mount.fuse             regdbdump          tune2fs
blockdev         fdisk         ifup               lilo           mount.lowntfs-3g       resize2fs          u-d-c-print-pci-ids
bridge           findfs        init               logsave        mount.ntfs             rmmod              udevadm
brltty           fixparts      insmod             losetup        mount.ntfs-3g          route              umount.udisks2
brltty-setup     fsck          installkernel      lsmod          nameif                 rtacct             unix_chkpwd
capsh            fsck.cramfs   ip                 lspcmcia       ntfsclone              rtmon              unix_update
cfdisk           fsck.ext2     ip6tables          mii-tool       ntfscp                 runlevel           ureadahead
cgdisk           fsck.ext3     ip6tables-restore  mkdosfs        ntfslabel              runuser            wipefs
chcpu            fsck.ext4     ip6tables-save     mke2fs         ntfsresize             setcap             wpa_action
crda             fsck.fat      ipmaddr            mkfs           ntfsundelete           setvtrgb           wpa_cli
ctrlaltdel       fsck.minix    iptables           mkfs.bfs       on_ac_power            sfdisk             wpa_supplicant
debugfs          fsck.msdos    iptables-restore   mkfs.cramfs    pam_extrausers_chkpwd  sgdisk             xtables-multi
depmod           fsck.vfat     iptables-save      mkfs.ext2      pam_extrausers_update  shadowconfig       zramctl
devlink          fsfreeze      iptunnel           mkfs.ext3      pam_tally              shutdown
dhclient         fstab-decode  isosize            mkfs.ext4      pam_tally2             slattach
dhclient-script  fstrim        iw                 mkfs.fat       parted                 start-stop-daemon
dmsetup          gdisk         iwconfig           mkfs.minix     partprobe              sulogin
  • ls /usr/sbin
aa-remove-unknown     cupsctl                iio-sensor-proxy       pppconfig                 update-dictcommon-hunspell
aa-status             cupsd                  invoke-rc.d            pppd                      update-fonts-alias
accept                cupsdisable            ip6tables-apply        pppdump                   update-fonts-dir
accessdb              cupsenable             ippserver              pppoeconf                 update-fonts-scale
acpid                 cupsfilter             ippusbxd               pppoe-discovery           update-grub
addgnupghome          cups-genppdupdate      iptables-apply         pppstats                  update-grub2
addgroup              cupsreject             irqbalance             pptp                      update-grub-gfxpayload
add-shell             delgroup               irqbalance-ui          pptpsetup                 update-gsfontmap
adduser               deluser                ispell-autobuildhash   pwck                      update-icon-caches
alsabat-test          dkms                   iucode_tool            pwconv                    update-inetd
alsactl               dmidecode              iucode-tool            pwunconv                  update-info-dir
alsa-info             dnsmasq                kerneloops             readprofile               update-initramfs
anacron               dpkg-preconfigure      keytab-lilo            reject                    update-java-alternatives
apparmor_status       dpkg-reconfigure       ldattach               remove-default-ispell     update-lilo
applygnupgdefaults    e2freefrag             liloconfig             remove-default-wordlist   update-locale
aptd                  e4crypt                lilo-uuid-diskid       remove-shell              update-mime
arp                   e4defrag               locale-gen             rfkill                    update-passwd
arpd                  fdformat               logrotate              rmt                       update-pciids
aspell-autobuildhash  filefrag               lpadmin                rmt-tar                   update-pepperflashplugin-nonfree
avahi-autoipd         gdm3                   lpc                    rsyslogd                  update-rc.d
avahi-daemon          genl                   lpinfo                 rtcwake                   update-usbids
biosdecode            getweb                 lpmove                 rtkitctl                  upgrade-from-grub-legacy
bluetoothd            gnome-menus-blacklist  make-ssl-cert          saned                     usb_modeswitch
chat                  groupadd               mkinitramfs            select-default-ispell     usb_modeswitch_dispatcher
chgpasswd             groupdel               mklost+found           select-default-wordlist   usbmuxd
chmem                 groupmems              mkrescue               service                   useradd
chpasswd              groupmod               ModemManager           setvesablank              userdel
chroot                grpck                  netplan                spice-vdagentd            usermod
cpgr                  grpconv                NetworkManager         tarcat                    uuidd
cppw                  grpunconv              newusers               tcpdump                   validlocale
cracklib-check        grub-bios-setup        nfnl_osf               thermald                  vcstime
cracklib-format       grub-install           nologin                tzconfig                  vigr
cracklib-packer       grub-macbless          ownership              ufw                       vipw
cracklib-unpacker     grub-mkconfig          pam-auth-update        update-ca-certificates    visudo
create-cracklib-dict  grub-mkdevicemap       pam_getenv             update-cracklib           vpddecode
cron                  grub-probe             pam_timestamp_check    update-default-aspell     zic
cupsaccept            grub-reboot            paperconfig            update-default-ispell
cupsaddsmb            grub-set-default       popcon-largest-unused  update-default-wordlist
cups-browsed          iconvconfig            popularity-contest     update-dictcommon-aspell

你可能感兴趣的:(Linux)