How Do I Print the First 100 Lines in Linux?
Contents How Do I Show the First 100 Lines in Unix? to Look at the First Few Lines of a File, Type Head Filename, Where Filename Is the Name of the File You...
Contents
How do I show the first 100 lines in Unix?
To look at the first few lines of a file, type head filename, where filename is the name of the file you want to look at, and then press <Enter>. By default, head shows you the first 10 lines of a file. You can change this by typing head -number filename, where number is the number of lines you want to see.
Must Read
How do I get the first line in Linux?
To store the line itself, use the var=$(command) syntax. In this case, line=$(awk ‘NR==1 {print; exit}’ file) . With the equivalent line=$(sed -n ‘1p’ file) . will be marginally faster as read is a built-in bash command.