Printing the first 6 files in a current directory using the terminal

I am trying to work out how to use the terminal. Does anyone know how I can print the first 7 file names of a current directory? I am using:

ls

to print all of the files. How can I print the first 7? I hope this makes sense 🙂

>Solution :

You can pipe it into head like this

ls | head -7

Leave a Reply