Post History
I think the typical way to do this uses wc ("word count") with the -l ("lines") option. $ wc -l /path/to/file 47 /path/to/file $ wc -l </path/to/file 47 $ cat /path/to/file | wc -l ...
Answer
#5: Post edited
I think the typical way to do this uses [`wc`][wc] ("word count"?) and the `-l` option.- ```sh
- $ wc -l /path/to/file
- 47 /path/to/file
- $ wc -l </path/to/file
- 47
- $ cat /path/to/file | wc -l
- 47
- ```
`wc` with no options prints the number of lines, words, and bytes, but `-l` can limit it to just lines.- [wc]: https://linux.die.net/man/1/wc
- I think the typical way to do this uses [`wc`][wc] ("word count") with the `-l` ("lines") option.
- ```sh
- $ wc -l /path/to/file
- 47 /path/to/file
- $ wc -l </path/to/file
- 47
- $ cat /path/to/file | wc -l
- 47
- ```
- `wc` with no options prints the number of lines, words, and bytes, but `-l` can limit it to just lines. As a comment notes: "lines" is the number of newline characters, so you may be off-by-one if you don't have a trailing newline.
- [wc]: https://linux.die.net/man/1/wc
#4: Post edited
- I think the typical way to do this uses [`wc`][wc] ("word count"?) and the `-l` option.
- ```sh
wc -l /path/to/file- ```
- `wc` with no options prints the number of lines, words, and bytes, but `-l` can limit it to just lines.
- [wc]: https://linux.die.net/man/1/wc
- I think the typical way to do this uses [`wc`][wc] ("word count"?) and the `-l` option.
- ```sh
- $ wc -l /path/to/file
- 47 /path/to/file
- $ wc -l </path/to/file
- 47
- $ cat /path/to/file | wc -l
- 47
- ```
- `wc` with no options prints the number of lines, words, and bytes, but `-l` can limit it to just lines.
- [wc]: https://linux.die.net/man/1/wc
#3: Post edited
- I think the typical way to do this uses [`wc`][wc] ("word count"?) and the `-l` option.
- ```sh
wc -l </path/to/file- ```
- `wc` with no options prints the number of lines, words, and bytes, but `-l` can limit it to just lines.
- [wc]: https://linux.die.net/man/1/wc
- I think the typical way to do this uses [`wc`][wc] ("word count"?) and the `-l` option.
- ```sh
- wc -l /path/to/file
- ```
- `wc` with no options prints the number of lines, words, and bytes, but `-l` can limit it to just lines.
- [wc]: https://linux.die.net/man/1/wc
#2: Post edited
- I think the typical way to do this uses [`wc`][wc] ("word count"?) and the `-l` option.
- ```sh
cat /path/to/file | wc -l- ```
- `wc` with no options prints the number of lines, words, and bytes, but `-l` can limit it to just lines.
- [wc]: https://linux.die.net/man/1/wc
- I think the typical way to do this uses [`wc`][wc] ("word count"?) and the `-l` option.
- ```sh
- wc -l </path/to/file
- ```
- `wc` with no options prints the number of lines, words, and bytes, but `-l` can limit it to just lines.
- [wc]: https://linux.die.net/man/1/wc