Node.Js Tutorial For Beginners Eleven - Basics Of Streams - Readable Stream
var fs = require('fs'); var readStream = fs.createReadStream('file.txt'); readStream.setEncoding('utf8'); var information = ''; readStream.on('data', function(chunk) { console.log('------------------------------------------------------------'); information += chunk; //console.log(chunk); }) readStream.on('end', function(chunk) { console.log(data); console.log('--------------------End----------------------------------------'); })
Node.Js Tutorial For Beginners 12 - Basics Of Streams - Writable Streams
var fs = require('fs'); var readStream = fs.createReadStream('file.txt'); readStream.setEncoding('utf8'); var writeStream = fs.createWriteStream('write_file.txt'); readStream.on('data', function(chunk) { console.log('------------------------------------------------------------'); writeStream.write(chunk); }) readStream.on('end', function(chunk) { console.log('--------------------End----------------------------------------'); })
Linux Ascendency Work Tutorial For Beginners 22 - Useradd Ascendency (Creatin...
USERADD(8) System Management Commands USERADD(8) NAME useradd - create a novel user or update default novel user information SYNOPSIS useradd [options] LOGIN useradd -D useradd -D [options] DESCRIPTION useradd is a depression bird utility for adding users. On Debian, administrators should commonly purpose adduser(8) instead. When invoked without the -D option, the useradd dominance creates a novel user describe of piece of job organization human relationship using the values specified on the dominance describe addition the default values from the system. Depending on dominance describe options, the useradd dominance volition update organization files in addition to may also create the novel user's domicile directory in addition to re-create initial files. By default, a grouping volition also live created for the novel user (see -g, -N, -U, in addition to USERGROUPS_ENAB). OPTIONS The options which apply to the useradd dominance are: -b, --base-dir BASE_DIR The default base of operations directory for the organization if -dHOME_DIR is non specified. BASE_DIR is concatenated with the describe of piece of job organization human relationship cite to define the domicile directory. If the -m choice is non used, BASE_DIR must exist. If this choice is non specified, useradd volition purpose the base of operations directory specified past times the HOME variable in /etc/default/useradd, or /home past times default. -c, --comment COMMENT Any text string. It is by in addition to large a brusk description of the login, in addition to is currently used every bit the plain for the user's total name. -d, --home HOME_DIR The novel user volition live created using HOME_DIR every bit the value for the user's login directory. The default is to append the LOGIN cite to BASE_DIR in addition to purpose that every bit the login directory name. The directory HOME_DIR does non convey to be only volition non live created if it is missing. -D, --defaults See below, the subsection "Changing the default values". -e, --expiredate EXPIRE_DATE The appointment on which the user describe of piece of job organization human relationship volition live disabled. The appointment is specified inwards the format YYYY-MM-DD. If non specified, useradd volition purpose the default death appointment specified past times the EXPIRE variable in /etc/default/useradd, or an empty string (no expiry) past times default. -f, --inactive INACTIVE The release of days afterwards a password expires until the describe of piece of job organization human relationship is permanently disabled. Influenza A virus subtype H5N1 value of 0 disables the describe of piece of job organization human relationship every bit shortly every bit the password has expired, in addition to a value of -1 disables the feature. If non specified, useradd volition purpose the default inactivity menstruum specified past times the INACTIVE variable in /etc/default/useradd, or -1 past times default. -g, --gid GROUP The grouping cite or release of the user's initial login group. The grouping cite must exist. Influenza A virus subtype H5N1 grouping number must refer to an already existing group. If non specified, the deportment of useradd volition depend on the USERGROUPS_ENAB variable inwards /etc/login.defs. If this variable is laid to yeah (or -U/--user-group is specified on the dominance line), a grouping volition be created for the user, alongside the same cite every bit her loginname. If the variable is laid to no (or -N/--no-user-group is specified on the dominance line), useradd volition laid the top dog grouping of the novel user to the value specified past times the GROUP variable inwards /etc/default/useradd, or 100 past times default. -G, --groups GROUP1[,GROUP2,...[,GROUPN]]] Influenza A virus subtype H5N1 listing of supplementary groups which the user is also a fellow member of. Each grouping is separated from the next past times a comma, alongside no intervening whitespace. The groups are dependent plain to the same restrictions every bit the group given alongside the -g option. The default is for the user to belong solely to the initial group. -h, --help Display assistance message in addition to exit. -k, --skel SKEL_DIR The skeleton directory, which contains files in addition to directories to live copied inwards the user's domicile directory, when the domicile directory is created past times useradd. This choice is solely valid if the -m (or --create-home) choice is specified. If this choice is non set, the skeleton directory is defined past times the SKEL variable inwards /etc/default/useradd or, past times default, /etc/skel. If possible, the ACLs in addition to extended attributes are copied. -K, --key KEY=VALUE Overrides /etc/login.defs defaults (UID_MIN, UID_MAX, UMASK, PASS_MAX_DAYS in addition to others). Example: -K PASS_MAX_DAYS=-1 tin live used when creating organization describe of piece of job organization human relationship to plough off password ageing, even though organization describe of piece of job organization human relationship has no password at all. Multiple -K options tin live specified, e.g.: -K UID_MIN=100-K UID_MAX=499 -l, --no-log-init Do non add together the user to the lastlog in addition to faillog databases. By default, the user's entries inwards the lastlog in addition to faillog databases are resetted to avoid reusing the entry from a previously deleted user. For the compatibility alongside previous Debian's useradd, the -O choice is also supported. -m, --create-home Create the user's domicile directory if it does non exist. The files in addition to directories contained inwards the skeleton directory (which tin live defined alongside the -k option) volition live copied to the domicile directory. By default, if this choice is non specified in addition to CREATE_HOME is non enabled, no domicile directories are created. -M Do no create the user's domicile directory, fifty-fifty if the organization broad setting from /etc/login.defs (CREATE_HOME) is laid to yes. -N, --no-user-group Do non create a grouping alongside the same cite every bit the user, only add together the user to the grouping specified past times the -g choice or past times the GROUP variable inwards /etc/default/useradd. The default deportment (if the -g, -N, in addition to -U options are non specified) is defined past times the USERGROUPS_ENAB variable inwards /etc/login.defs. -o, --non-unique Allow the creation of a user describe of piece of job organization human relationship alongside a duplicate (non-unique) UID. This choice is solely valid inwards combination alongside the -u option. -p, --password PASSWORD The encrypted password, every bit returned past times crypt(3). The default is to disable the password. Note: This choice is non recommended because the password (or encrypted password) volition live visible by users listing the processes. You should brand certain the password respects the system's password policy. -r, --system Create a organization account. System users volition live created alongside no aging information inwards /etc/shadow, in addition to their numeric identifiers are chosen inwards the SYS_UID_MIN-SYS_UID_MAX range, defined inwards /etc/login.defs, instead of UID_MIN-UID_MAX (and their GID counterparts for the creation of groups). Note that useradd volition non create a domicile directory for such an user, regardless of the default setting in /etc/login.defs (CREATE_HOME). You convey to specify the -m options if you lot desire a domicile directory for a organization describe of piece of job organization human relationship to live created. -R, --root CHROOT_DIR Apply changes inwards the CHROOT_DIR directory in addition to purpose the configuration files from the CHROOT_DIR directory. -s, --shell SHELL The cite of the user's login shell. The default is to leave of absence this plain blank, which causes the organization to conduct the default login crunch specified past times the SHELL variable inwards /etc/default/useradd, or an empty string past times default. -u, --uid UID The numerical value of the user's ID. This value must live unique, unless the -o choice is used. The value must live non-negative. The default is to purpose the smallest ID value greater than or equal to UID_MIN and greater than every other user. See also the -r choice in addition to the UID_MAX description. -U, --user-group Create a grouping alongside the same cite every bit the user, in addition to add together the user to this group. The default deportment (if the -g, -N, in addition to -U options are non specified) is defined past times the USERGROUPS_ENAB variable inwards /etc/login.defs. -Z, --selinux-user SEUSER The SELinux user for the user's login. The default is to leave of absence this plain blank, which causes the system to conduct the default SELinux user. Changing the default values When invoked alongside solely the -D option, useradd volition display the electrical current default values. When invoked alongside -D addition other options, useradd volition update the default values for the specified options. Valid default-changing options are: -b, --base-dir BASE_DIR The path prefix for a novel user's domicile directory. The user's cite volition live affixed to the destination of BASE_DIR to degree the novel user's domicile directory name, if the -d choice is non used when creating a novel account. This choice sets the HOME variable inwards /etc/default/useradd. -e, --expiredate EXPIRE_DATE The appointment on which the user describe of piece of job organization human relationship is disabled. This choice sets the EXPIRE variable inwards /etc/default/useradd. -f, --inactive INACTIVE The release of days afterwards a password has expired earlier the describe of piece of job organization human relationship volition live disabled. This choice sets the INACTIVE variable inwards /etc/default/useradd. -g, --gid GROUP The grouping cite or ID for a novel user's initial grouping (when the -N/--no-user-group is used or when the USERGROUPS_ENAB variable is laid to no inwards /etc/login.defs). The named grouping must exist, in addition to a numerical grouping ID must convey an existing entry. This choice sets the GROUP variable inwards /etc/default/useradd. -s, --shell SHELL The cite of a novel user's login shell. This choice sets the SHELL variable inwards /etc/default/useradd. NOTES The organization administrator is responsible for placing the default user files inwards the /etc/skel/ directory (or whatever other skeleton directory specified inwards /etc/default/useradd or on the dominance line). CAVEATS You may non add together a user to a NIS or LDAP group. This must live performed on the corresponding server. Similarly, if the username already exists inwards an external user database such every bit NIS or LDAP, useradd volition deny the user describe of piece of job organization human relationship creation request. It is commonly recommended to solely purpose usernames that get alongside a lower example alphabetic lineament or an underscore, followed past times lower example letters, digits, underscores, or dashes. They tin destination alongside a dollar sign. In regular human face terms: [a-z_][a-z0-9_-]*[$]? On Debian, the solely constraints are that usernames must neither get-go alongside a dash ('-') nor addition ('+') nor tilde (' ') nor incorporate a colon (':'), a comma (','), or a whitespace (space: ' ', destination of line: '\n', tabulation: '\t', etc.). Note that using a slash ('/') may interruption the default algorithm for the Definition of the user's domicile directory. Usernames may solely live upwards to 32 characters long. CONFIGURATION The next configuration variables inwards /etc/login.defs alter the deportment of this tool: CREATE_HOME (boolean) Indicate if a domicile directory should live created past times default for novel users. This setting does non apply to organization users, in addition to tin live overridden on the dominance line. GID_MAX (number), GID_MIN (number) Range of grouping IDs used for the creation of regular groups past times useradd, groupadd, or newusers. The default value for GID_MIN (resp. GID_MAX) is G (resp. 60000). MAIL_DIR (string) The postal service spool directory. This is needed to manipulate the mailbox when its corresponding user describe of piece of job organization human relationship is modified or deleted. If non specified, a compile-time default is used. MAIL_FILE (string) Defines the place of the users postal service spool files relatively to their domicile directory. The MAIL_DIR in addition to MAIL_FILE variables are used past times useradd, usermod, in addition to userdel to create, move, or delete the user's postal service spool. MAX_MEMBERS_PER_GROUP (number) Maximum members per grouping entry. When the maximum is reached, a novel grouping entry (line) is started in /etc/group (with the same name, same password, in addition to same GID). The default value is 0, pregnant that at that topographic point are no limits inwards the release of members inwards a group. This characteristic (split group) permits to bound the length of lines inwards the grouping file. This is useful to make certain that lines for NIS groups are non larger than 1024 characters. If you lot demand to enforce such limit, you lot tin purpose 25. Note: split upwards groups may non live supported past times all tools (even inwards the Shadow toolsuite). You should non use this variable unless you lot actually demand it. PASS_MAX_DAYS (number) The maximum release of days a password may live used. If the password is older than this, a password change volition live forced. If non specified, -1 volition live assumed (which disables the restriction). PASS_MIN_DAYS (number) The minimum release of days allowed betwixt password changes. Any password changes attempted sooner than this volition live rejected. If non specified, -1 volition live assumed (which disables the restriction). PASS_WARN_AGE (number) The release of days alert given earlier a password expires. Influenza A virus subtype H5N1 naught agency alert is given solely upon the twenty-four hr menstruum of expiration, a negative value agency no alert is given. If non specified, no alert volition be provided. SYS_GID_MAX (number), SYS_GID_MIN (number) Range of grouping IDs used for the creation of organization groups past times useradd, groupadd, or newusers. The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101 (resp. GID_MIN-1). SYS_UID_MAX (number), SYS_UID_MIN (number) Range of user IDs used for the creation of organization users past times useradd or newusers. The default value for SYS_UID_MIN (resp. SYS_UID_MAX) is 101 (resp. UID_MIN-1). UID_MAX (number), UID_MIN (number) Range of user IDs used for the creation of regular users past times useradd or newusers. The default value for UID_MIN (resp. UID_MAX) is G (resp. 60000). UMASK (number) The file way creation mask is initialized to this value. If non specified, the mask volition live initialized to 022. useradd in addition to newusers purpose this mask to laid the way of the domicile directory they create It is also used past times pam_umask every bit the default umask value. USERGROUPS_ENAB (boolean) If laid to yes, userdel volition take away the user's grouping if it contains no to a greater extent than members, in addition to useradd will create past times default a grouping alongside the cite of the user. FILES /etc/passwd User describe of piece of job organization human relationship information. /etc/shadow Secure user describe of piece of job organization human relationship information. /etc/group Group describe of piece of job organization human relationship information. /etc/gshadow Secure grouping describe of piece of job organization human relationship information. /etc/default/useradd Default values for describe of piece of job organization human relationship creation. /etc/skel/ Directory containing default files. /etc/login.defs Shadow password suite configuration. EXIT VALUES The useradd dominance exits alongside the next values: 0 success 1 can't update password file 2 invalid dominance syntax 3 invalid declaration to option 4 UID already inwards purpose (and no -o) 6 specified grouping doesn't exist 9 username already inwards use 10 can't update grouping file 12 can't create domicile directory 14 can't update SELinux user mapping SEE ALSO chfn(1), chsh(1), passwd(1), crypt(3), groupadd(8), groupdel(8), groupmod(8), login.defs(5), newusers(8), userdel(8), usermod(8). shadow-utils 4.1.5.1 02/17/2014 USERADD(8)