1. Wildcard characters
Using wildcard characters is convenient for us to manipulate multiple files. A string that replaces the key name with some special symbols. Take a look at the common wildcard meanings:
(1) * number, use this symbol to represent any character and string
(2) The symbol represents an arbitrary character.
(3) [ABCdef ...] Represents any one of the characters in []. Sometimes it means the range, and so on, as the regular expression implies. For example, [ABC] stands for any one of ABC, [1-9] represents any number from 1 to 9.
(4) [!abcdef ...] Represents a character that does not contain []. For example [!ABC] represents any character except ABC.
Do an experiment, create a test1.txt, Test2.txt, test3.txt three files, use wildcard match delete:
Other wildcard characters use the same rules, according to the actual situation, and then another instance, such as using the wildcard character, to represent any one character, to see the example:
We created the Test1.txt, test2.txt file, delete the time specified at the beginning of the test, TXT end of the file is deleted, as for test? TXT in test after IS
What character doesn't matter, the number represents it, satisfies the test start, and the txt end match is deleted.
In a discussion [], use a wildcard such as [], such as using a [1-9] to represent any number of 1-9.
2.pwd
Most of the time, we are going back and forth in the operation of the command, probably do not know in which directory to operate, you can view the current working directory through the PWD (print working directory) command,
You can clearly know which directory you are mixing with, and avoid mistakes.
First create a test file, CD to this directory down, through the PWD to view the absolute path of the current directory files, can clearly know their location.
3. Add Users
Why do we want to add users?
From the above example we can know that we are operating with the root user, in Linux root has no permissions, can be placed any file in death, not to be epigenetic,
If everyone has such authority, it is bound to chaos. In order to ensure the security of the system files, for the General people to assign different users, give different permissions, to avoid the chaos.
For example, the previous RM-RF can delete the entire folder without prompting, unable to recover, if everyone has root privileges, can be arbitrarily deleted files, think is terrible.
If we use the general user, we can still do most of the program, in addition to a few of the administrator's commands can not be executed, some directories can not be operated outside,
We can do all the other things. Therefore, we recommend that: when using general operations, we use the general user, if we need to maintain the system, we use the root user.
Here's an example of adding an ordinary user:
Use adduser Add a user, passwd set the password, for security, enter the password is not visible, the naked eye with no input, actually entered.
I set the password to 123456, the hint is too easy set too simple, retype new password to enter the password again, two times the password to
Consistent, inconsistent will prompt for password mismatch, and display new password let you reset, error is as follows:
4. Search for files
Search for file command locate based on file name to find out which directory a file is in.
First operation, with explanation to see the operation:
(1) Create a test.txt file with the Touch command, then create a mytestfile directory via mkdir, and the MV moves the test.txt into the Mytestfile file.
(2) Search the Test.txt file through locate, but did not respond, found that the file is missing, because this command needs to be used in conjunction with the database, the update speed of the database is 7 days update.
(3) Before we can use this command to search for a file, we must update the database with the UpdateDB command and use the locate Test.txt again to see the results of the search.
Linux commands Daquan (3)