Sample Header Ad - 728x90

Colored output from fd piped into column not aligned correctly

3 votes
0 answers
54 views
When I run the command fd --color always --max-depth=1 | column the output is not properly aligned, but it is when --color is set to --color never For reference, fd --color never --max-depth=1 | column prints
test-folder/	test12.txt	test16.txt	test2.txt	test5.txt	test9.txt
test1.txt	test13.txt	test17.txt	test20.txt	test6.txt
test10.txt	test14.txt	test18.txt	test3.txt	test7.txt
test11.txt	test15.txt	test19.txt	test4.txt	test8.txt
(It is properly aligned on my terminal, not sure why copy and pasting it here makes it look not aligned?) And fd --color always --max-depth=1 | column prints
test-folder/	test19.txt
test1.txt			test2.txt
test10.txt			test20.txt
test11.txt			test3.txt
test12.txt			test4.txt
test13.txt			test5.txt
test14.txt			test6.txt
test15.txt			test7.txt
test16.txt			test8.txt
test17.txt			test9.txt
test18.txt
I'm finding that the rows that aren't properly aligned are the ones with different colors. All the .txt files are green, while the folder is blue.The first row is not aligned because there are two items of different colors (a blue folder and a green txt file). According to https://unix.stackexchange.com/a/769660 version 2.40 of column should properly handle color codes; my column version from the man page is:
-linux 2.40.2   2024-07-04    COLUMN(1)
What's a simple way to have output from fd output in a bunch of columns? My use case is that I'd prefer to be using fd instead of ls every time I want to look at the files in a directory.
Asked by Joel Singh (31 rep)
Nov 24, 2024, 07:32 PM
Last activity: Dec 15, 2024, 02:34 PM