File Linux day2-Linux operating system command / permission management

First, create a file

1.1 Creating a directory file -mkdir
Syntax: mkdir [options] directory name

mkdir命令的作用是可以实现在当前位置或指定位置创建单个或多个目录文件,*需要注意的是创建多个目录时目录名之间必须用空格隔开。*

mkdir options
-m: creating a single directory in the file, operating authority to set the directory file;
-p: recursively created when the directory you want to create a subdirectory contains files, using this option must create the parent directory and subdirectories.

1.2 create a non-directory file -touch
Touch commands can be implemented to create a single or multiple non-directory files in the current location or a specified location, be noted that the file name must specify the file extension in writing.

Second, copy the files -cp

Syntax: cp [options] source file name of the target file name
cp command can be achieved to copy single or multiple source file to the target file

注意:
 源文件可以是目录文件也可以是非目录文件,目标文件只能是目录文件;
当cp用于复制单个文件时,目标文件可以不存在(对复制后的文件进行重命名操作);
当cp用于复制多个文件时,目标文件必须是一个存在的目录文件。

cp option
-r: used to copy files directory, by default cp copy only for non-directory file;
-f: force replication, this option is mandatory for the operation of the root user to use;

Third, cut the file -mv

Syntax: mv [options] source file name of the target file name
mv command can be cut to achieve a single or multiple source files to the destination location,

 需要    注意的是当剪切单个文件时,源文件和目标文件在同一个位置时,mv可以是重命名源文件操作;当源文件和目标文件不在同一个位置时,mv是剪切源文件操作。

mv option
-f: Force cut, this option is used to enforce the root user to use;
-i: When you cut a file operation, if the target file exists may be covered, you will be asked whether to perform the cut operation

the difference between cp and mv:
. 1, cp copy files, then the file system copy number increases; mv file is cut, the number of file system after shearing has not changed, the position of the file has changed;
2, cp can be used to rename the file after copying operation, mv rename operation may be performed to the source file.

Fourth, edit the file -vi

Grammar: vi filename
role of vi can edit the contents of operation on a single non-directory file, vi is equivalent to Windows System notepad.

需要注意的是文件名必须写明后缀,vi 也可以实现创建文件的同时进行编辑操作。

V. View non-directory file -cat, tac

Syntax: cat filename
cat is used to the forward view (down from first byte) non-directory file contents, general information on the rearward view files;
tac is used to reverse viewing (from the last byte start up) non-directory file content, commonly used to view the file information in front of.

Six, Linux system's network command

6.1 Testing Network --ping
Syntax: ping IP address of the
ping command is used to test the machine connected to the milliseconds time used with other hosts, network ping smaller the value the faster, slower ping value larger network. The ping command is a Linux system has been tested, in order to stop the test requires the use of keyboard shortcuts (ctrl + c: the end of the command execution)

6.2 Check the machine's network setting information -ifconfig
the ifconfig is used alone, the effect is used to view the ifconfig network setting information Linux system: IP address, gateway, subnet mask, and the like. Windows systems use ipconfig to see the network settings information.

Seven, delete files -rm, rmdir

rm command can be used to delete individual or multiple files, rmdir command is used to delete the empty directory file, the actual development often use rm to delete the file.
Syntax: rm [options] filename

Options rm
-r: delete the file directory, by default rm only delete the non-directory file;
-i: When you delete a file, one by one reminder;
-f: force the removal of the option is to use the root user is used to force deleted;

Eight, Linux system management authority

8.1, permission to modify ---- chmod
syntax: chmod permissions to rename the file
permissions to modify the wording: + user permissions value, the user - value rights, user rights value =
user: u (creator), g (the same group of people), o (others)
rights values: r, w, the X-
8.2, use the form of three octal digits to represent the rights of
the Linux system is to use the form of three octal numbers to represent file permissions: each of the three-digit corresponds to a class of user privileges: the first digit is the creator of rights, the second digit is the same group of people rights, the third digit is the other person permission. Every specific number, 1 (x) which is determined by three, and 4 (r), 2 (w ). Such as: read-write execution ----- 7 performs reading. 5 ----

Linux permissions ----------- rwx rx rw-
binary --------------- 111 101 110
octal ------------- --4 + 2 + 14 + 14 + 2

Nine, computer binary system

Binary: string content from 0 (Low Voltage) and 1 (high-voltage) composed of a binary computer can directly read and understand;
octal: 8 by a series of content composed number between 0-7, in writing when octal often leading 0;
decimal: string of content by the number 10 between 0-9 and mathematics decimal digits is;
hex: 16 by the number between 0-15 composition string of content, a number between 10-15 represented by the letters af, case-insensitive. When writing hexadecimal often begin with 0x.

Conversion between different band:
Ø Binary Decimal
conversion rules: the right to expand a binary number by (take numbers on the number of digits per square multiplies the ranking) are added, the weight is 2.
For example: 10101101 --- - 173 decimal
binary number. 1 ---- 0. 1 0 0. 1. 1. 1
digit ---------- 76543210
expand ^ 12 is ---------- 7012 ^ 5012 ^ 312 ^ 2012 ^ 0
the sum ---------- 12803208401 = 173

Similarly, octal, decimal and hexadecimal turn transfer the right to expand by adding all the decimal, octal 8 is right, right is hexadecimal 16.
>  turn Binary Decimal
conversion law: decimal number divided by 2, to take down the remainder composition
example: binary decimal having 11 ------- 1011

Similarly, octal, decimal turn is divided by 8 to take down the remainder arrangement, decimal convert hexadecimal to take down the remainder divided by 16 arrangement.
Binary octal
conversion rule: a binary number from right to left are divided according to a set of three, left enough 0s, respectively, and then converted to a decimal number of each group.
For example: 101.10111 million ----- octal binary 0556
to grouped -------------------- 101,101,110
then separately transfected. 5. 6. 5 decimal ----

Similarly, Binary Hexadecimal is divided according to a set of four, left enough 0s, respectively, and then converted to decimal for each group, if the result of the conversion is greater than or equal to 10, to form the corresponding letters.
octal transfer binary
conversion rule: each bit octal number are converted to a binary number three, and not enough left 0s.
For example: 362 ----- octal binary 11110010
octal ------------------------------- 362
each bits are converted to binary 011110010 --------

Guess you like

Origin blog.51cto.com/14474781/2437236