2026-09-22 05:18 UTC
/usr/bin/ls --color=never --help | /usr/bin/less and /usr/bin/ls --color=never --help > ~/Desktop/lshelp.txt produces and contains the same characters, BTW. This happens in Bash and Zsh, using Kitty and Konsole terminals. So its not an issue with less, the shell or terminal. Meaning it might be an issue with ls itself. I have “ls (GNU coreutils) 9.11” from ls --version.
Ah ls has an option for this: -q, --hide-control-chars But ls -q --color=never --help | less hides control characters, but the special codes are still there.
Looks like an issue with ls.
Replies (1)
-
@syklemil@discuss.tchncs.de 2026-09-22 09:40
-q controls output for filenames. From ls.c: /* True means output nongraphic chars in file names as '?'. (-q, --hide-control-chars) qmark_funny_chars and the quoting style (-Q, --quoting-style=WORD) are independent. The algorithm is: first, obey the quoting style to get a string representing the file name; then, if qmark_funny_chars is set, replace all nonprintable chars in that string with '?'. It's necessary to replace nonprintable chars even in quoted strings, because we don't want to mess up the terminal if control chars get sent to it, and some quoting methods pass through control chars as-is. */ static bool qmark_funny_chars;