{
    "mode": "info",
    "parameter": "install",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/install/json",
    "generated": "2026-11-15T14:32:22Z",
    "sections": {
        "File: coreutils.info,  Node: install invocation,  Next: mv invocation,  Prev: dd invocation,  Up: Basic operations": {
            "content": "",
            "subsections": [
                {
                    "name": "11.3 'install': Copy files and set attributes",
                    "content": "'install' copies files while setting their file mode bits and, if\npossible, their owner and group.  Synopses:\n\ninstall [OPTION]... [-T] SOURCE DEST\ninstall [OPTION]... SOURCE... DIRECTORY\ninstall [OPTION]... -t DIRECTORY SOURCE...\ninstall [OPTION]... -d DIRECTORY...\n\n* If two file names are given, 'install' copies the first file to the\nsecond.\n\n* If the '--target-directory' ('-t') option is given, or failing that\nif the last file is a directory and the '--no-target-directory'\n('-T') option is not given, 'install' copies each SOURCE file to\nthe specified directory, using the SOURCEs' names.\n\n* If the '--directory' ('-d') option is given, 'install' creates each\nDIRECTORY and any missing parent directories.  Parent directories\nare created with mode 'u=rwx,go=rx' (755), regardless of the '-m'\noption or the current umask.  *Note Directory Setuid and Setgid::,\nfor how the set-user-ID and set-group-ID bits of parent directories\nare inherited.\n\n'install' is similar to 'cp', but allows you to control the\nattributes of destination files.  It is typically used in Makefiles to\ncopy programs into their destination directories.  It refuses to copy\nfiles onto themselves.\n\n'install' never preserves extended attributes (xattr).\n\nThe program accepts the following options.  Also see *note Common\noptions::.\n\n'-b'\n'--backup[=METHOD]'\n*Note Backup options::.  Make a backup of each file that would\notherwise be overwritten or removed.\n\n'-C'\n'--compare'\nCompare content of source and destination files, and if there would\nbe no change to the destination content, owner, group, permissions,\nand possibly SELinux context, then do not modify the destination at\nall.  Note this option is best used in conjunction with '--user',\n'--group' and '--mode' options, lest 'install' incorrectly\ndetermines the default attributes that installed files would have\n(as it doesn't consider setgid directories and POSIX default ACLs\nfor example).  This could result in redundant copies or attributes\nthat are not reset to the correct defaults.\n\n'-c'\nIgnored; for compatibility with old Unix versions of 'install'.\n\n'-D'\nCreate any missing parent directories of DEST, then copy SOURCE to\nDEST.  Explicitly specifying the '--target-directory=DIR' will\nsimilarly ensure the presence of that hierarchy before copying\nSOURCE arguments.\n\n'-d'\n'--directory'\nCreate any missing parent directories, giving them the default\nattributes.  Then create each given directory, setting their owner,\ngroup and mode as given on the command line or to the defaults.\n\n'--debug'\nPrint extra information to stdout, explaining how files are copied.\nThis option implies the '--verbose' option.\n\n'-g GROUP'\n'--group=GROUP'\nSet the group ownership of installed files or directories to GROUP.\nThe default is the process's current group.  GROUP may be either a\ngroup name or a numeric group ID.\n\n'-m MODE'\n'--mode=MODE'\nSet the file mode bits for the installed file or directory to MODE,\nwhich can be either an octal number, or a symbolic mode as in\n'chmod', with 'a=' (no access allowed to anyone) as the point of\ndeparture (*note File permissions::).  The default mode is\n'u=rwx,go=rx,a-s' - read, write, and execute for the owner, read\nand execute for group and other, and with set-user-ID and\nset-group-ID disabled.  This default is not quite the same as\n'755', since it disables instead of preserving set-user-ID and\nset-group-ID on directories.  *Note Directory Setuid and Setgid::.\n\n'-o OWNER'\n'--owner=OWNER'\nIf 'install' has appropriate privileges (is run as root), set the\nownership of installed files or directories to OWNER.  The default\nis 'root'.  OWNER may be either a user name or a numeric user ID.\n\n'--preserve-context'\nPreserve the SELinux security context of files and directories.\nFailure to preserve the context in all of the files or directories\nwill result in an exit status of 1.  If SELinux is disabled then\nprint a warning and ignore the option.\n\n'-p'\n'--preserve-timestamps'\nSet the time of last access and the time of last modification of\neach installed file to match those of each corresponding original\nfile.  When a file is installed without this option, its last\naccess and last modification timestamps are both set to the time of\ninstallation.  This option is useful if you want to use the last\nmodification timestamps of installed files to keep track of when\nthey were last built as opposed to when they were last installed.\n\n'-s'\n'--strip'\nStrip the symbol tables from installed binary executables.\n\n'--strip-program=PROGRAM'\nProgram used to strip binaries.\n\n'-S SUFFIX'\n'--suffix=SUFFIX'\nAppend SUFFIX to each backup file made with '-b'.  *Note Backup\noptions::.\n\n'-t DIRECTORY'\n'--target-directory=DIRECTORY'\nSpecify the destination DIRECTORY.  *Note Target directory::.  Also\nspecifying the '-D' option will ensure the directory is present.\n\n'-T'\n'--no-target-directory'\nDo not treat the last operand specially when it is a directory or a\nsymbolic link to a directory.  *Note Target directory::.\n\n'-v'\n'--verbose'\nPrint the name of each file before copying it.\n\n'-Z'\n'--context[=CONTEXT]'\nWithout a specified CONTEXT, adjust the SELinux security context\naccording to the system default type for destination files,\nsimilarly to the 'restorecon' command.  The long form of this\noption with a specific context specified, will set the context for\nnewly created files only.  With a specified context, if both\nSELinux and SMACK are disabled, a warning is issued.  This option\nis mutually exclusive with the '--preserve-context' option.\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n"
                }
            ]
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}