linux command _ (decompression, user management, privilege modification, date, system information)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/Mr_Yang888/article/details/102558113

Unzip command
target
from third-party download compressed package, installed on the server after decompression

By packing the compressed backup file
jar: java rar java archive project of
war: web rar web project archive

3. To achieve
3.1 first step: packing and unpacking
3.1.1 package

.tar package command format

tar Option Description

3.1.2 unpacking
tar command to unpack format

Option Description

Summary
Packing: .tar file name after the tar -cvf packed packetized directory or file name
unpacked: filename .tar after packing tar -xvf [-C unpacking position designated]

3.2 Step 2: Use gzip compression and decompression format
archiving and compression are two things
similar to the first compression winter clothes into bags, then taking the air inside
in Linux, the most common compressed file format is xxx.tar.gz
there is an option -z gzip in the tar command can be invoked in order to facilitate the realization of compression and decompression functions

Command format is as follows

Archive
tar -zcvf packaged compressed file name .tar.gz compressed file / directory

Unzip the file (memory knock on the door: Shiko Weifang)
tar -zxvf .tar.gz packaged file

Decompression to the specified path
tar -zxvf packaged files directory path .tar.gz -C

tar options Description

Summary
packing compression: After the file name is packaged .tar.gz tar -zcvf packing compressed directory or file name
unpack decompress: file name after packing .tar.gz tar -zxvf [-C unpacking position designated]

3.3 The third step: Use bzip2 format compression and decompression
bzip compressed second way is
similar to the first compression winter clothes into bags, then taking the air inside
in Linux, bzip2 compressed file format is xxx.tar.bz2
in tar command has an option -j can call bzip2, which can facilitate the realization of compression and decompression functions

Command format is as follows

Archive
tar -jcvf packaged compressed file name .tar.bz2 compressed file / directory

Unzip the file (performance Weifang)
tar -jxvf .tar.bz2 package file

Decompression to the specified path
.tar.bz2 -C package file directory path tar -jxvf

tar options Description

Summary
packing compression: After the file name is packaged tar -jcvf .tar.bz2 compressed package directory or file name
unpack decompress: file name after the tar -jxvf packed .tar.bz2 [-C unpacking position designated]

4 user rights related to command
the basic concepts of users and permissions
4.1 Basic concepts of
user Linux system work is an important part, user management including user and group management
in Linux systems, both by the level or remote login system, each the system must have an account and hold for different system resources
have different permissions

Permissions to the file / directory include:

4.4. Group management terminal command

Tip:
Group information is stored in / etc / group file
/ etc directory is designed to save the system configuration directory information
in practical applications, can be pre-set permissions for the group, and then add a different user to the corresponding group, so do not turn for each of a
user to set permissions

4.5. User management terminal command
(1) Create a user / password / delete users

Tip:
When you create with, if you forget to add the -m option to specify the new user's home directory - the easiest way is to delete users, re-created
when you create a user, the default will create a and user name the same name as the group name of
the user information stored in / etc / passwd file

(2) View User Information

(3) su switch user
because general users can not use certain permissions, the user needs to switch

su user name is not connected, you may be switched root, or it is not recommended, since insecurity
exit diagram is as follows:

(4) sudo
Although it is possible to switch by su -u root to root, but there are serious security risks
to maintain and manage linux system root account used in a system, have access to all the resources of the operating system
if not used with care rm -rf ... ..., it is possible to build up and paralyzed
in most versions of linux, the recommendation is not only directly with the root account login system
used in other capacities to execute the command sudo command, the default identity for the root
using sudo user , you must enter the password after 5 minutes validity period, the deadline you must re-enter your password
prompt: if its unauthorized user attempts to use sudo, it will issue a warning message to the administrator

(4.1) grant privileges to the specified user

(4.2) zhangsan user login, operations manager command
nature: the use of temporary administrator rights

(5) Modify user rights

5.1 Method 1: Modify the user permissions
chmod can modify the user / group permissions to the file / directory
command format is as follows:
chmod +/- rwx filename | directory name

5.2 Second way
though a direct way to modify the file | directory read | write | execute permissions, but not accurate to the owner | group | other permissions
command format is as follows :( u represent their user / g represent your group / o represent other)
chmod -R u = rwx, g = rx , o = rwx file | directory

Three ways: a simplified manner, two
command format is as follows:
chmod -R 755 file | directory
legend The first number is the owner permission, the second digit is the group permissions, and the third number is the other user rights

System Information related commands
1. Time and date
1.1 date time

The first step: to display the current time

Display time
date

The specified display time format
date + "% Y-% m-% d% H:% M:% S"
Step: Set the system time
date -s "time string"
1.2 CAL Calendar

02. Disk Information

Option Description

03. Process Information

ps default displays only the current application user initiated through the terminal

ps Option Description Function

Tip: When using the kill command to terminate the best open only by the current user process instead of terminating the process of open as root, otherwise it may
result in system crashes
To exit the top can be entered directly q

Guess you like

Origin blog.csdn.net/Mr_Yang888/article/details/102558113