The lst command allows you to list files and directories. The syntax of lst command is as follows:
lst [<dir_path> | -t [<dir_path>] | -drv]
The "dir_path" is the path to the directory of which you want to list files and directories. If you don't specify the "dir_path", files and directories of the current directory will be listed.
The above snapshot shows the output of lst command. The first column contains the names of files and directories. Keeping the Alt key pressed and then clicking on the file or directory name opens the respective file or directory.
The second column shows the size of files (in bytes). In case of directories, a '-' is shown instead of the size.
The third column shows the type and permissions associated with each file and directory. The first character tells whether the item is a directory or a file. The d indicates that the item is a directory. A '-' at the same position indicates that it is not a directory (i.e. it is a file). You then see a series of characters that can take the values r, w, x, h and l. Below is a table showing the meaning of each character. A '-' in place of any character indicates that the file/directory does not have that permisssion or is not of that type.
Character | Indicates |
---|---|
d | It is a directory (Folder). |
r | File/Directory has read permission. |
w | File/Directory has write permission. |
x | File/Directory is executable. Usually the directories always have execute permission. Execute permission on a directory means you can list the files in that directory. |
h | File/Directory is hidden. |
l | It is a link (shortcut). Mostly, the files with extension ".lnk" are links. |
You can view the creation, last access and last modified time of files and directories using the syntax as follows:
lst -t [<dir_path>]
You can view all drives currently attached to your system using the following syntax:
lst -drv
You can open a particular drive by keeping the Alt key pressed and then clicking on the drive name.
A wildcard character is a special character that represents one or more other characters. An * (asterisk) represents zero or more characters and ? (question mark) represents any one character. You can use these wildcard characters to easily project only the files and directories whose names meets your criteria.
In the above image, the first command i.e. lst C:\*.txt lists files in C:\ drive having the ".txt" extension. The second command lst C:\a* lists all files and directories whose names are starting with a. The third command lst C:\????.* only lists the files having the name of four characters in length.