The first contact Gnu/linux or the last semester internship in the two months in window installed a virtual machine to play Red Hat system, that period of time to learn a little command will not play. Later in the semester to meet the King General, installed a dual system, that period of time and Linux has a further understanding and has generated great interest. It was not until the last semester that I suddenly went crazy and debian8 my notebook into the world of Linux. Learning is really a spiral-up process. Below to get to the chase:
---basic principles of Linux:
1, consisting of a single purpose small program, combined with a small program to complete complex tasks (Kiss:keep it simple,stupid)
2. All Documents
3, try to avoid capturing the user interface (minimize interaction with users)
4. Save the configuration file in plain text format
---Linux commands are divided into built-in (build_in) commands and external commands, you can view command types with type, such as type and echo, which are built-in commands and man is an external command
echo Manis/usr/bin/ man.
---The line terminator in Linux is $, and the end of lines in Windows is $\n, you can use CAT-E to display row terminators
---tail-f display the last 10 lines of the file by default, the-f parameter will immediately display the contents of the file, which is useful in some situations, such as viewing Apache's access logs
---the sort command is not numerically sorted by default, to sort by numbers, you need to add the-n parameter, the-t parameter represents the field separator, and-k specifies which field to sort
---tr is used to convert or delete characters, here's an example of converting all lowercase letters in the A.txt file to uppercase letters, just one command, redirecting the input of the command to a file
1 $TR A-Z < a.txt
---Tips for several terminal operations:
CTRL +a: Cursor to the beginning of the line, CTRL + E: Cursor to the end of lines, Ctrl+d: Delete the current cursor position character, Ctrl+u: Delete cursor to the beginning of the line, Ctrl+k: Delete the cursor position to the end, CTRL + <-: Skip one word to the left, CTRL + : Skips one word to the right, Ctrl+l: Clear screen (this is faster than entering the clear command)
---The history command can show the commands that the user has entered, history-c clears the command histories so that the user cannot switch the previous command when using the UP arrow, but there is a hidden file in the user's home directory. Bash_history records the commands that the user has entered. How many bars can be saved can be viewed through the Echo $HISTSIZE environment variable. The history-w command writes the command in the buffer to the. Bash_history, and executing this command on my computer overwrites the contents of the file.
---tips for terminal operation History command:
!n to execute the nth command in the command history
!-n to execute the last nth command in the command history
!! Executes the previous command,
! String executes the most recent command in the command history that begins with the specified string
!$ references the last parameter of the previous command (it is also possible to press ESC before pressing.) Bring up the last parameter of the previous command)
---command substitution: definition: Replaces a subcommand in a command with its execution result. Usage: You can use $ (command) or anti-quote ' command ' to implement command substitution. For example, to see the definition does not understand what it means to create a file named at the current time, for example: File-2016-3-10-19-20-31.txt
1 $file-$ (date +%y-%m-%d-%h-%m-%s). txt2 $file-$ (date +%f-%h-%m-%s). txt3 $ file-'date +%y-%m-%d-%h-%m-%s '. txt
---user rights: rwx, each of them represents a privileged ownership situation, so a total of 2 of the 3 8 cases, so you can use a 8 binary number to represent the user ownership of the file, that is, 0-7. And the user of the file is divided into 3 categories, u,g,o
That is, the owner, the group member, the other person, so sometimes it's easier to change the permissions of a file to specific users and groups
1 $chmod u+x a.txt Add the execution rights of the owner 2 $chmod u-x a.txt Remove the execution rights of the owner 3 $chmod go=rx A.txt gives users and other users in the group read and Execute permissions 4 $chmod G=,o= A.txt do not give any permissions to users and other users in the group 5 $chmod G=r,u=rwx a.txt give the file owner maximum permissions, user Read permissions in group 6 $chmod--reference=./ B.txt A.txt the a.txt to the same permissions as B.txt, Chown also supports this option
---Man manual is a chapter, the Whatis command is an overview of the manual page:
1: User command (/bin,/usr/bin,/usr/local/bin)
2: System call (kernel-provided function)
3: Library user (function in library)
4: Special files (usually device files)
5: File Format (configuration file syntax)
6: Game
7: Miscellaneous (Miscellaneous)
8: Administrative Commands (/sbin,/usr/sbin,/usr/local/sbin) are usually only for root users
For example:
passwdpasswd (5) - password file passwd (1)- change user password passwd (1SSL)-Compute password hashes< /c11>
You can now view the format of the/etc/passwd configuration file and the meaning of each field with the man 5 passwd command
1 $whatis Shadow 2 Shadow (5)-Shadow password file
With Man 5 shadow you can see the format of the/etc/shadow configuration file and the meaning of each field
---encryption method: The encryption method is mainly divided into 3 kinds
1, symmetric encryption: Encryption and decryption using the same key
2, Public key encryption: Each password is paired, one for the private key (private key), and one for the public key, key starts locks.
3, one-way encryption: Also known as hash encryption, fingerprint encryption, can only encrypt can not decrypt, used to extract data signatures, often used for data integrity check, it has two features: (1) Avalanche effect, is what we often say the butterfly effect, as long as there is a small change in the file, the output will have a great change. (2) fixed-length output, regardless of the input file size, the output result length is the same. Two common ways to encrypt one way:
Md5:message Digest, 128-bit fixed-length output you can use the md5sum command to find the MD5 value of a file
Sha1:secure Hash algorithm, 160-bit fixed-length output
Usually see in the/etc/shadow password is added salt (impurity) After the result of encryption, so that even if the password of two users, because the addition of different impurities, so MD5 encrypted ciphertext is not the same.
Gnu/linux Review notes (1)