A
A
AmdInDrive2020-11-30 14:02:43
linux
AmdInDrive, 2020-11-30 14:02:43

Output a certain number of files from a directory to the console, using a bash script?

Hello, I need to display a certain number of filenames from a specified directory, I also need these names to fit in the written number of lines. I personally have not seen this in man ls, and I do not quite understand how this can be implemented in a simple way, the only thing that is clear to me is that you need to use positional parameters. How can this be achieved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Codebaker, 2020-11-30
@AmdInDrive

ls -n | head -n 5 # will give you the first 5 lines, is that enough?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question