Have you ever used the "column" command?

submitted by vkc via PeerTube@tinkerbetter.tube
edited

tinkerbetter.tube/videos/watch/735e9783-3424-4e…

Yes, there's other tools that can make terminal output prettier on Linux. We all know that. But the "column" command is likely already there, on your system, waiting for you to use it.

With "column" you can get nice looking terminal output & JSON from terminal commands, without a lot of additional cruft!

I mentioned a few print materials in this episode, here's some links:
📖 The AWK book: https://archive.org/details/pdfy-MgN0H1joIoDVoIC7
📘 The K/P UNIX book: https://archive.org/details/unixprogramminge0000kern
🔐 1979's "Password Security: A Case History" by Robert Morris and Ken Thompson, which talks about how password encryption evolved in early UNIX: https://rist.tech.cornell.edu/6431papers/MorrisThompson1979.pdf

And here's the "support the channel" links (my video isn't sponsored):
👕 Buy my nerdy ethernet t-shirt: https://vkc.sh/merch
✨ Join the Patreon (with Discord/Matrix benefits): https://patreon.com/VeronicaExplains
☕ Or Ko-Fi if that's your jam (same benefits): https://ko-fi.com/VeronicaExplains

Chapters:
0:00 I say "greetings" and introduce the column command
0:58 Basic use of the column command
2:02 Piping more advanced commands into column
2:57 Column's table mode: unlocking power
4:18 Adding neat headers to our table so we can manipulate them
5:57 Getting JSON output from terminal commands using column
6:57 Conclusion: column is awesome

Licence: Attribution - Non Commercial - Share Alike

131

Log in to comment

18 Comments

3:25 Sorry, I just can’t help… 😂

awk is an awesome tool. I'd like to see a lesson on it. Such simple tools can completely replace much more complicated software like the usual spreadsheets and everything is already part of the operating system. You don't need to do anything.

@vkc
Thank you, I'm sure it will soon be helpful !

@vkc
Yes, great command to format those tools that cram everything together!

I added it yesterday to my list of Linux commands that I'm working on: linux-audit.com/system-adminis

My hope is that it inspires others to discover new handy tools ⚙️ 💪🏻

The text in the thumbnail is truly "horrifying".

I've been a damn Linux admin off and on for 25 years. Somehow I never knew about column. I was doing abusive things with grep, awk, sed, and other utilities to accomplish what "column" does with a simple -t.

HOW THE CRAP DID I ONLY HEAR ABOUT IT NOW‽‽?

I think an AWK for beginners would be a cool video.

@vkc Thanks, I somehow didn't know about that command.

@vkc Gonna send this along to a pal of mine who is just getting started with Linux. I didn't even know about the JSON option!

@vkc would love that "awk for beginners" video

@vkc "column" was new to me (but then again, my Mac just arrived last week).

Would love to see an awk introduction.

@vkc Thank you so much! I recently though of such a tool as I had a long list of metrics, too long to be observed with "watch". (For some reason, I didn't search the web to find one.)

Now I can produce a neatly formatted two-column table, which is still very long, but send it through "column" again to fit it on a single page.

I cannot emphasise enough how great this is!!

Killer video. About lept from my seat when the JSON output was shown.

@vkc I really enjoy your videos, they're fun and informative and it's an absolute delight whenever there's a new notification

@vkc AWK for absolute beginners -video would be very interesting. Never used that one.

Column command I was somewhat familiar with, but had completely forgotten about it.

Thanks for the video! 😄

@vkc I always forget the name of column, (as well as comm), though I never forget the name of fold; those three commands are among my least used unix utils.

@vkc This came up in a YT recommend. I've been using Linux for over 25 years and have never seen this command!

I use `cut` and it is clunky even for the subset of things it can do that `column` does better.