In Linux, you can use the ls command to see which subdirectories are in the current directory. Just execute the "ls -a" command directly. It can display all subdirectories and files in the current directory, including hidden files. . The ls command is used to display the contents of the current directory. It can display the file list of the current directory or the file list under the specified path; the syntax is "ls [options] [dirname]", and the parameter "dirname" is used to set the requirements. The directory to be viewed defaults to the current directory.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
In Linux, you can use the ls command to see which subdirectories are in the current directory.
linux ls command introduction
ls command, the abbreviation of list, is the most common directory operation command. Its main function is Display the contents of the current directory.
ls command is used to display the file list of the current directory, and can also be used to display the file list under the specified path.
Syntax:
ls [options] [dirname]
Copy after login
Parameters
Description
options
parameters used by the ls command.
dirname
The directory to be viewed, defaults to the current directory.
Table 1 lists the commonly used options of the ls command and their respective functions.
Table 1 Common options and functions of ls command
Options
Function
##- a
Display all files, including hidden files (files starting with .), which are also listed together. This is one of the most commonly used options.
-A
Display all files, including hidden files, but excludes the . and .. directories.
-d
Only lists the directory itself, not the file data within the directory.
-f
#ls will sort by file name by default. Using the -f option will list the results directly without sorting.
-F
Add the file type indicator after the file or directory name, for example, * represents a executable file, / represents a directory, = represents a socket file, | stands for FIFO file.
-h
Display file or directory size in a human-readable way, such as 1KB, 234MB, 2GB, etc.
-i
Display inode node information.
-l
Use long format to list file and directory information.
-n
UID and GID are displayed instead of the file user name and group name respectively.
-r
Output the sorting results in the reverse direction. For example, if the original file names are from small to large, the reverse is from large to small.
-R
Listing together with the contents of the subdirectory is equivalent to displaying all files in the directory.
-S
Sort by file size, not by file name.
-t
Sort by time, not by file name.
--color=never
--color=always --color=auto
never means that the color display is not based on the file characteristics.
always means displaying color, ls adopts this method by default. auto means to let the system determine whether to give color based on the configuration.
--full-time
Output in full time mode (including year, month, day, hour, minute)
--time={atime,ctime}
Output access time or change permission attribute time (ctime), not content change time.
Note that when the ls command does not use any options, only the names of non-hidden files will be displayed by default, and will be sorted by file name, and will be sorted according to the specific type of the file. Colorize file names (blue for directories, white for general files). In addition, if you want to use the ls command to display more content, you need to use the corresponding options in Table 1.
Common examples of Linux ls command
Example
Description
ls
List all files in the current directory
ls -l
column Get detailed information about all files in the current directory
ls /
List all files in the root directory
ls - l /
List the detailed information of all files in the root directory
ls -lh
Form the detailed information of the file in a human understandable way
ls -a
List all files, including hidden files
ls -d dirname
List the information of the folder itself, not the file information under the folder
ls -lt
List file information sorted by file modification time
ls -lrt
List file information in reverse order of file modification time
ls ./hai*
List all files starting with hai under the current path
列出当前目录下文件
ls
Copy after login
显示当前目录下文件详细信息
ls -l
Copy after login
我们可以看到,我们使用了 ls -l 命令,显示了当前路径下的文件的详细信息,包括文件的权限,文件的用户组,文件大小和时间等信息。
注意,Linux 系统中,隐藏文件不是为了把文件藏起来不让其他用户找到,而是为了告诉用户这些文件都是重要的系统文件,如非必要,不要乱动!所以,不论是 Linux 还是 Windows 都可以非常简单地査看隐藏文件,只是在 Windows 中绝大多数的病毒和木马都会把自己变成隐藏文件,给用户带来了错觉,以为隐藏文件是为了不让用户发现。
不仅如此,这里的 ls 命令还使用了 -l 选项,因此才显示出了文件的详细信息,此选项显示的这 7 列的含义分别是:
The above is the detailed content of How to check which subdirectories are in the current directory in Linux. For more information, please follow other related articles on the PHP Chinese website!
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.
To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.
Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.
There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.
The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.
To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)
Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)