Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR Comments


Vance says: Thanks, everyone

RE: hpr4747::2026-10-13 UNIX Curio #13 - Replacements for cat by Vance
00:25:46 Listen in ogg, opus, or mp3 format.
Wow, a lot going on here in the comments. I appreciate it!

Whiskeyjack: Can't believe I didn't think of 'tac' or 'rev' when putting this together. While they are not in POSIX, they are certainly widespread. I honestly have never encountered 'tsort' before - will look into it and see if I can make anything out of it.

candycanearter07: I haven't checked; some implementations of 'head' might support +1, but POSIX does not require it. I always thought of 'tail -f' as being well known, but maybe should revisit that. In practice, I generally use 'less' with the 'F' command instead of 'tail -f' these days, but sometimes it's not available.

Whiskeyjack says: Reply to Vance on tsort

RE: hpr4747::2026-10-13 UNIX Curio #13 - Replacements for cat by Vance
00:25:46 Listen in ogg, opus, or mp3 format.
I have never used tsort and I am not sure that I really understand it. I just noticed one day that it was there when looking through a list of commands.

I just ran a quick test to see which distros have it, and found it in Alma, Debian, FreeBSD, OpenBSD, Raspberry Pi, Suse, and Ubuntu. It however is not in Alpine by default.

I didn't try any other distros, but this covers most of the major ones.

The Ubuntu man file states that tsort is useful for scheduling and determining execution order.

If you decide to do an episode on it, then if you can find a few practical examples there is certainly enough to make an episode out of it.

The versions for Linux, OpenBSD, and FreeBSD all have different options. The options for GNU tsort and uutils tsort do the same things as each other, but are not completely compatible in terms of how they are called. This is at least four different versions just among the distros that I tested.

The man pages for OpenBSD and FreeBSD offer much better information about tsort than the Linux man pages that I looked at.

According to OpenBSD, their tsort is compliant with "POSIX.1", but has extensions. They offer volume and page references to Donald Knuth's The Art of Computer Programming for further information.

According to FreeBSD, tsort first appeared in Version 7 AT&T Unix.

archer72 says: xmanmonk

RE: hpr4747::2026-10-13 UNIX Curio #13 - Replacements for cat by Vance
00:25:46 Listen in ogg, opus, or mp3 format.
Hi xmanmonk,

Do you have interests to hackers of your own?

If so, HPR would like an introductory show. :-)

Cheers,
Archer72

candycanearter07 says: head tail and grep

RE: hpr4747::2026-10-13 UNIX Curio #13 - Replacements for cat by Vance
00:25:46 Listen in ogg, opus, or mp3 format.
cool ep!
i basically already use head and tail as cat for super long files that have important data at the start/end, also i use an alias to replace cat with batcat

ill also point out the same trick can be used with head since it also supports +1 to print up to the last line in the file

i think a curio on tail would be useful since one of its "hidden" functions (-f, or --follow) is so incredibly useful i wish it was talked about more its amazing for following log files

also also grep is slightly better than cat at catting every file in a directory, since you can use grep -r '' . to print everything recursively, as opposed to cat * which only prints non-hidden files in the current dir

Mastodon Comments



More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.