Frequent Question: How Do I List the First 10 Files in Linux?
Contents How Do I Find the First 10 Files in Linux? Type the Following Head Command to Display First 10 Lines of a File Named “Bar. Txt”: Head -10 Bar. Txt...
Contents
How do I find the first 10 files in Linux?
Type the following head command to display first 10 lines of a file named “bar.txt”:
- head -10 bar.txt.
- head -20 bar.txt.
- sed -n 1,10p /etc/group.
- sed -n 1,20p /etc/group.
- awk ‘FNR <= 10’ /etc/passwd.
- awk ‘FNR <= 20’ /etc/passwd.
- perl -ne’1..10 and print’ /etc/passwd.
- perl -ne’1..20 and print’ /etc/passwd.
Must Read
How do I list 10 files in Linux?
Listing multiple files on a single line
The ls command even has options for that. To list files on as few lines as possible, you can use –format=comma to separate file names with commas as in this command: $ ls –format=comma 1, 10, 11, 12, 124, 13, 14, 15, 16pgs-landscape.