In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the usage of basic file and directory commands in Linux". In daily operation, I believe that many people have doubts about the usage of basic file and directory commands in Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "basic file and directory command usage in Linux". Next, please follow the editor to study!
File
File-determines the file type
-b
Do not output the file name (brief mode).
-c
Print the parsing result of the magic number file when checking. Often used with-m to debug a magic number file before installing it.
-f named file
Read the name of the file to be checked (one file per line) from the named file in front of the parameter table. There must be a named file, or at least one file name parameter; if you want to check standard input, use ``- as the file parameter.
-m list
Specifies a list of files that contain magic numbers. It can be a single file or multiple files separated by colons.
-n
The standard output is forced to be refreshed every time a file is checked. Valid only when checking a set of files. This option is generally used when exporting file types to pipes.
-v
Print the version of the program and exit.
-z
An attempt was made to view the internal information of the compressed file.
-L
(on systems that support symbolic links) the option displays the original file of the symbolic link file, just like the like-named option of the ls (1) command.
S
Usually, file just tries to check the types of files that stat (2) reports as normal files in the file list. Since reading special files may lead to unknowable consequences, this can prevent problems. The file command will also read block special files and character special files in the file list when using the-s option. Generally used to obtain the file system type from the original disk partition, this file is a block special file. This option also causes the file command to ignore the file size reported by stat (2), because on some systems the size of the original disk partition is reported as 0. 0.
Example:
The code is as follows:
[root@redhat ~] # file * # View all file types in the current directory
Abc.sh: awk script, ASCII text
Abc.sh.bz2: bzip2 compressed data, block size = 900k
Ar_test: directory
Examples.desktop: UTF-8 Unicode text
Rec00001abc.sh.bz2: bzip2 compressed data, block size = 900k
Test: ASCII text
Test.bz2: bzip2 compressed data, block size = 900k
[root@redhat ~] # file abc.sh # View the file type of a single file
Abc.sh: awk script, ASCII text
Root@tnak-VirtualBox:/home/tnak# file-z test.bz2 # View the internal information of the compressed file
Test.bz2: empty (bzip2 compressed data, block size = 900k)
Mkdir
Usage: mkdir [option]. Catalogue.
Creates a directory if the specified directory does not exist.
The parameters that must be used for long options are also required for short options.
-m,-- mode= mode sets the permission mode (similar to chmod), rather than rwxrwxrwx minus umask
-p,-- parents creates upper-level directories of the target directory when needed, but does not treat them as errors even if they already exist
-v,-- verbose displays information every time it creates a new directory
-Z,-- context=CTX sets the SELinux security environment of each created directory to CTX
-- help displays this help and exits
-- version displays version information and exits
Example 1:
The code is as follows:
[root@localhost ~] # mkdir aaa # create a directory
[root@localhost ~] # mkdir-m a=rw bbb # create a directory with specified attributes
[root@localhost ~] # mkdir-p 111/abc # create directory, parent directory exists, build it
Example 2
The code is as follows:
[tank@localhost ~] $mkdir-v test1 # creates a directory and displays details
Mkdir: directory "test1" has been created
Example 3
The code is as follows:
# mkdir-p / ms/ {sales,hr,web} # create a directory called / ms with subdirectories of sales, hr, and web
At this point, the study of "basic file and directory command usage in Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.