Sample Header Ad - 728x90

Change date format for who in FreeBSD

3 votes
1 answer
183 views
Unlike Linuxae which outputs 2022-11-07 16:23, FreeBSD who command outputs Nov 7 16:23. How can I change the date format in the output of who either globally or just for the duration of the command? Example output of who on FreeBSD 13.1-p3, in the POSIX locale (the date format changes with the locale):
me               pts/1        Nov  7 13:06 (192.168.1.107 via mosh )
me               pts/2        Nov  7 13:07 (tmux(1988).%0)
me               pts/3        Nov  7 13:07 (tmux(1988).%1)
me               pts/4        Nov  7 13:07 (tmux(1988).%2)
me               pts/5        Nov  7 13:08 (tmux(1988).%3)
me               pts/7        Nov  8 07:09 (192.168.1.103 via mosh )
me               pts/8        Nov  7 13:08 (tmux(1988).%4)
Note that while the date format changes with the locale, the date string in the output [is created with strftime()](https://cgit.freebsd.org/src/tree/usr.bin/who/who.c#n197) using either %e %b %R or %b %e %R as format strings, which makes it impossible to "just use another locale".
Asked by user548271 (31 rep)
Nov 7, 2022, 05:37 PM
Last activity: Nov 9, 2022, 12:44 AM