Will LS lose a file?

xiaoxiao2021-03-06  39

Under UNIX / Linux, LS is a simple basic command that displays a list of files in a directory. If a specific directory is not specified, it displays a list of files under the current path. So, is LS reliable? "No, of course, some files will not be listed." You may say this. Yes, simply play LS on the shell command line, there are some files we can't see - that is hidden files. Unlike Windows, files in the UNIX system cannot set hidden / non-hidden properties. However, there is also a hidden file under UNIX, but it is to achieve this by the file name. Under UNIX / Linux, if the name of the file is ".", It is the so-called hidden file. We can't see it by simple LS. (Otherwise, what is its hidden attribute)

That's right, you said, but LS -A can display all the files under the current path? ? ? ? Of course, this is still used! ? Yes, Not Bad! That, what about ls -a *? ? ? ? The same! (Nothing is different !?)

Oh, if you really want to answer this, it is best to take into account the processing of * (wildcard) under Unix / Linux.

Why can we perform it in the command line on the shell command line? That's because there is shell, it is responsible for analyzing, looking, executing, and returning the information we entered. That's right, shell's function is very powerful, it is the bridge between us and operating systems, we are dealing with the operating system. We know, shell is a command interpreter, the information we entered is not originally originally given to the operating system, but has been processed. For symbols "*", shell often translate all files in the current directory (hidden files seem to be excluded), and any shell returns something you want. The problem is just here, because the smart people are also confused ^ _ ^

If, if I have a file name "-l", what will the result? ? ? ? Who is so boring, get a "-l" to make a file name? Ha, suppose, don't be so serious.

That's right, if there is such a file, the LS will not only miss the file, but will return to the display mode we don't want.

... (add later)

We know, LS may lose file, and this is a wildcard, ^ _ ^

转载请注明原文地址:https://www.9cbs.com/read-85848.html

New Post(0)