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
VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)
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.
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.
The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.
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.
VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.
Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version
vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.