147k views
2 votes
Which one of the following commands will list the contents of a directory, and put those listed contents into a file called "mydir"? 1s -pla > mydir 1s -pla < mydir 1s I mydir ls printf> mydir

User AVEbrahimi
by
7.8k points

1 Answer

3 votes

Answer:

ls -pla > mydir

Step-by-step explanation:

ls is the command to list the contents of the directory.

-p option indicate / as the designator for directories

-l options enables line by line entries for files

-a option lists all files including special files starting with .

> is used for redirecting the output of the ls command to the specified file.

So ls -pla > mydir will run ls command with -pla option and populate the file mydir with the contents of the result.

User Abdul Rauf
by
7.1k points