Команди Linux

Linux Column Command

Linux Column Command
While using Linux distributions, some of the data needs to be displayed in columnar format. Linux system makes it easy to display content in columns using the “column” command.

The “column” command is a simple command-line utility to print the file contents in columns. This command-line tool supports multiple options containing proper functionality that are worth considering.

When using the “column” command in a terminal, it ignores blank lines by default.

If we have data displayed in multiple columns, the command will start to display the data from the left side to the right side i-e; it will begin to add content in the left column first and then move towards the right columns.

Syntax of Column Command:

The syntax of the Linux “column” command is:

“column [-entx] [-c columns] [-s sep] [file name… ]”

Column Command Options:

Let's create a file named “test.txt” and add some content to it.

For example, we have some content in the “test.txt” file.

So, the output of this text file should be printed in columns. Type the column command with the file name, and your output would be:

$ column test.txt

If you have content in a file where a particular delimiter separates entries, use the “-s” option with “-t.”

When we use this command, it will remove the delimiter and produce output in a columnar format.

Let's see how this option works. For example, we have a file “file.txt” containing the following data with delimiter “|”:

Now, use the following command to check the output:

$ column file.txt -t -s “|”

To print a help message related to the “column” command, use the “-help” command, and it shows all options in the terminal with functions.

$ column --help

Check the version of the “column” command using the “-version” option.

$ column --version

Other Useful Options of Column Command:

Conclusion:

The “column” command is a command-line utility introduced by the Linux system to display output in a columnar format. This guide discussed column command briefly and learned how to use it with different options.

How to Show FPS Counter in Linux Games
Linux gaming got a major push when Valve announced Linux support for Steam client and their games in 2012. Since then, many AAA and indie games have m...
How to download and Play Sid Meier's Civilization VI on Linux
Introduction to the game Civilization 6 is a modern take on the classic concept introduced in the series of the Age of Empires games. The idea was fai...
How to Install and Play Doom on Linux
Introduction to Doom The Doom Series originated in the 90s after the release of the original Doom. It was an instant hit and from that time onwards th...