Linux BASIC Commands 2

Source: Internet
Author: User
Tags bz2

Three. Archive tool

    1. Tar file Packaging

(1) TAR-CVF Shell.tar shell/ Package The Shell directory together with the files under it Shell.tar

C: instruct tar to create an archive V: to display the execution of a command F: The file name used to specify the archive file, where it is set to " Shell.tar". The last (or several) parameters specify the files and directories that need to be packaged. Unlike gzip ,tar does not delete the original file

to unpack the. tar file, simply change the - c option to- x(which means that the archive is unpacked) .

(2) TAR-XVF Shell.tar

The Tar command provides the - w option for each time a single file is added (or extracted) to the archive to solicit user's comments

(3) TAR-CVWF Shell.tar shell/

unlocking . Tar files is also possible to follow the same method using the - w option

(4) Tar-xvwf Shell.tar

The tar program makes a very useful option is -Z, and using this option the tar command automatically calls the gzip The program completes the related operation.

(5) TAR-CZVF shell.tar.gz shell/tar command to package the Shell directory and call the gzip program to process the packaged file, equivalent to

TAR-CVF Shell.tar shell/

Gzip Shell.tar

(6) Tar-xzf shell.tar.gz call gunzip decompression shell.tar.gz, and then untie Shell.tar, equivalent

Gunzip shell.tar.gz

TAR-XF Shell.tar

The-j parameter is used to invoke the BIZP2 program, and the usage of this parameter is exactly the same as- z

(7) TAR-XJF shell.tar.bz2 untie shell.tar.bz2

Four User and User group management

    1. Add user

(1) Useradd NOx

Passwd NOx add nox user and set password

Sudo useradd-g users Mike builds a user account named Mike and specifies that it belongs to the users Group

Sudo useradd-s/bin/bash Mike Specifies user login after bash as Shell

Sudo groupadd newgroup Adding user groups

2. Delete User Userdel

(1) sudo userdel Mike

(2) Sudo userdel-r John removes John and deletes its home directory

3. Manage user accounts

-D Modify the user's home directory - e Modify the validity period of the account- g To modify the group that the user belongs to- l Modify user account name - s Modify the shell used by the user after logging in

(1) sudo usermod-l mike-d/home/mike-e 12/31/13 John

will be John renamed Mike, the main directory changed to /home/mike, and set the account expiration date to year Month to day

4. View user information ID

(1) ID nobody

(2) ID

5. Switch between users Su

(1) Su John

(2) Exit back to previous account

6. restricted privileges sudo

Important documents:/etc/passwd/etc/shadow/etc/group

Linux BASIC Commands 2

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.