Analysis of bin directory structure in Linux system


  • In Linux system, the executable commands are usually stored in / bin, / sbin, / user/bin, / user/sbing. The details are as follows:


  • Store the most basic and necessary execution commands of system operation, that is, the commands that can be executed for all users. The following is the bin directory under the mac system. The standard Linux server contains more:

    xyzdeMacBook-Pro:bin xyz ls
    [		cp		df		hostname	link		mv		rm		stty		unlink
    bash		csh		echo		kill		ln		pax		rmdir		sync		wait4path
    cat		date		ed		ksh		ls		ps		sh		tcsh		zsh
    chmod		dd		expr		launchctl	mkdir		pwd		sleep		test


  • Store system management commands, such as ping, ifconfig and other network related commands, as follows:

    xyzdeMacBook-Pro:sbin xyz ls
    apfs_hfs_convert	fsck_hfs		kextunload		mount_exfat		newfs_apfs		quotacheck
    autodiskmount		fsck_msdos		launchd			mount_fdesc		newfs_exfat		reboot
    disklabel		fsck_udf		md5			mount_ftp		newfs_hfs		route
    dmesg			fstyp			mknod			mount_hfs		newfs_msdos		rtsol
    dynamic_pager		fstyp_hfs		mount			mount_msdos		newfs_udf		shutdown
    emond			fstyp_msdos		mount_acfs		mount_nfs		nfsd			umount
    fibreconfig		fstyp_ntfs		mount_afp		mount_ntfs		nfsiod
    fsck			fstyp_udf		mount_apfs		mount_smbfs		nologin
    fsck_apfs		halt			mount_cd9660		mount_udf		pfctl
    fsck_cs			ifconfig		mount_cddafs		mount_webdav		ping
    fsck_exfat		kextload		mount_devfs		mpioutil		ping6


  • Store some commands and software that users need for daily use and work, such as vi, wc, curl, etc., and programming language commands such as python, java, jstat, etc., that is, when the system pre installs relevant software, the executable files of the software will be added to the directory.


  • The difference between / usr/bin and / usr/bin is that the command under / user/bin is usually pre installed on the system and will change with the upgrade of the system. And / user/local/bin is usually used to store the software downloaded and installed by the user or the executable command written by the user. The command with the same name here will not be overwritten by the system upgrade. For example, mysql, redis cli, mvn, etc. Generally speaking, these software are connected to the address of the actual executable command through the way of soft connection, generally according to the directory / user/local:

    lrwxr-xr-x    1 xieyizun  admin    51B  8  9  2018 mysql -> /usr/local/mysql-5.7.23-macos10.13-x86_64/bin/mysql
    lrwxr-xr-x    1 xieyizun  admin    68B  8 13  2018 mysql.server -> /usr/local/mysql-5.7.23-macos10.13-x86_64/support-files/mysql.server
    lrwxr-xr-x    1 xieyizun  admin    51B  8 12  2018 mysql_config -> ../Cellar/mysql-connector-c/6.1.11/bin/mysql_config
    lrwxr-xr-x    1 xieyizun  admin    55B  8 28  2018 mysqldump -> /usr/local/mysql-5.7.23-macos10.13-x86_64/bin/mysqldump


  • Store applications that super users can use.

Keywords: MySQL Linux mysqldump Mac

Added by alex clone on Sat, 30 Nov 2019 07:29:35 +0200