Thursday, 30 November 2023   |

How to Print First 10 Lines of Files in Linux


To print the first 10 lines of a file in Linux, you can use the `head` command. The `head` command displays the beginning of a file or input.

Here's how you can use it to print the first 10 lines of a file:

```shell
head -n 10 filename
```

Replace `filename` with the actual name or path to the file you want to print the lines from.

For example, if you have a file called `example.txt` and you want to print the first 10 lines, you would use the following command:

```shell
head -n 10 example.txt
```

This will display the first 10 lines of the `example.txt` file on your terminal.


Date: 20 June 2023    Comments: 0


Comments - 0

There are no comments yet

Leave A Comment