This article shows some examples of using the dir command to list the contents of a directory. The dircommand is not a commonly used command in Linux. Though it works more less like the ls command which most Linux users prefer to use. We’ll be discussing the dir command where we shall look at how to use different options and arguments.
dir Command Usage with Examples
Simple output of the dir command
Output of the dir command with the
/etc
directory file is as follows. As you can see from the output not all files in the /etc directory are listed.
To list one file per line use -1 option as follows.
View all files in a directory including hidden files
To list all files in a directory including
.
(hidden) files, use the -a option. You can include the -l option to format output as a list.View directory entries instead of content
When you need to list only directory entries instead of directory content, you can use the -d option. In the output below, the option -d lists entries for the /etc directory.
When you use -dl, it shows a long listing of the directory including owner, group owner, permissions.
No comments:
Post a Comment