Home » Questions » Computers [ Ask a new question ]

what does tail + number does? What about head

what does tail + number does? What about head

I just called this command ls -l | tail +3. Firstly, ls -s, produces 3 lines, adding piping strips first line and then prints each file names on a separate line. How does it do that? It doesn't make sense.

Asked by: Guest | Views: 51
Total answers/comments: 1
Guest [Entry]

"Answering:

Firstly, ls -s, produces 3 lines, adding piping strips first line and then prints each file names on a separate line. How does it do that? It doesn't make sense.

The answer is that the ls commands looks at its standard output and checks whether it is connected to a tty. If it is, then it formats for display purposes. If it is not (for example, the output is a file or pipe), then it prints one entry per line.

The option '-C' forces multi-column output (as if going to a terminal).
The option '-1' forces single-column output (as if going to a pipe)."