linux - Output of ls | wc -l -



linux - Output of ls | wc -l -

normally output of wc -l command gives number of lines in file. but, when pipe output of ls command it, seems show number of files , directories , links in current working directory correctly.

my question output of ls command displays name of files , directory in same line. so, why in case using wc -l gives different output, compared wc -l filename. in advance.

ls detects it's beingness piped programme instead of console, , outputs 1 file/directory per line. can seek ls | cat see behavior.

linux

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -