1.2 Directory Operation commands
1.2.1 View Directory
The command to view the contents of the directory is LS, which displays the contents of the current directory by default, and can be viewed by giving one or more directory names at the location of the command line arguments. The syntax format for the command is:
ls [options] ... [FileName] ...
The LS command has multiple command-line options, such as:
-A: List all files, including those with "." The beginning of the document;
-D: If followed by a directory, use this parameter to output only the name of the directory;
-L: Displays file entries in long format, including number of connections, owner, size, last modification time, permissions, etc.
-T: Sort by file modification time instead of using file name;
-C: Sort the file names vertically by column;
-F: Adds a symbol after the filename to indicate the file type;
CX: Sort file names by line spread;
CF: Lists the file names in the directory by column, which appends a character to the file name to distinguish the type of directory and file;
--Append a slash (/) to the directory file name
--Append an asterisk (*) to the executable file name
--Append an @ character after the symbolic link file
--no characters after normal file name
CR: Displays all files in the current directory in a multiple-column format and all files along the directory tree's subdirectories, also known as recursive lists. This command distinguishes between a directory and an executable file, that is, appending a character to the file name.
1.2.2 Change Working directory
Enter a directory, or change the current working directory using the CD command, the syntax format for the command is:
CD Directory Name
The CD command has a unique parameter that represents the path name (relative path name or absolute pathname) of the destination directory.
Use the dots (.. Move the working directory up the first level directory: CD. . To return to the user home directory from anywhere in the system, you can use a CD command with no parameters.
1.2.3 Create a directory
Use the mkdir command to create a directory or multiple directories to effectively organize your own files. The syntax for the command is:
mkdir [Options] Directory name [directory name ...]
The same subdirectory should contain similar files. For example, you should create a subdirectory that contains all the database files, another subdirectory contains a spreadsheet file, and a subdirectory to hold a project-related file.
-P option: Create a directory and its subdirectories at the same time.
Mkdir-p Directory Name/subdirectory name