column Command — Displaying Text in Tabular Format¶
The
columncommand formats text into neatly aligned columns or tables, making command output much easier to read. It is commonly used to display CSV files, reports, configuration data, and command output in a structured, professional format.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand the
columncommand - Format text into aligned columns
- Display CSV files as tables
- Use custom delimiters
- Create professional-looking reports
- Format command output
- Combine
columnwith other Linux utilities
Prerequisites¶
Before starting this lesson, complete:
- Module 1 – Linux Fundamentals
- Module 2 – Linux Command Line Essentials
- Module 3 Lessons 1–11
Why Learn column?¶
Suppose you have a CSV file.
Reading it is possible, but not ideal.
Using:
Produces:
Much easier to read.
What is column?¶
The column command aligns text into multiple columns.
It is mainly used to improve readability.
Syntax:
Sample File¶
Create:
Contents:
Display as Table¶
Output:
Explanation:
-t→ Create a table-s ","→ Use comma as the delimiter
Space-Separated Data¶
Create:
Display:
Output:
Using Colon Delimiters¶
Example:
Display:
Output:
Display /etc/passwd¶
This makes user account information much easier to read.
Format Command Output¶
Disk usage.
Processes.
Mounted filesystems.
Network connections.
Combining with Other Commands¶
Format CSV.
Display usernames.
Format inventory.
Add Headers¶
Create:
Display:
Output:
Common column Options¶
| Option | Description |
|---|---|
-t | Create a table |
-s | Specify delimiter |
-c | Set output width |
-o | Set output separator |
Change Output Separator¶
Default spacing:
Custom separator:
Output:
Real Production Examples¶
Format Kubernetes output.
Format Docker images.
Display Linux users.
Format inventory.
Display environment variables.
Production Perspective¶
The column command is useful for:
- Reports
- CSV files
- Server inventories
- Configuration reviews
- Log summaries
- Shell script output
It improves readability without modifying the original data.
Hands-on Lab¶
Task 1¶
Create:
Contents:
Task 2¶
Display as a table.
Task 3¶
Display /etc/passwd.
Task 4¶
Format disk usage.
Task 5¶
Format environment variables.
Task 6¶
Create an inventory.
Display:
Task 7¶
Use a custom separator.
Task 8¶
Combine with paste.
Command Deep Dive¶
| Command | Purpose | Production Example |
|---|---|---|
column -t | Align text | Reports |
column -t -s "," | Format CSV | Inventory |
column -t -s ":" | Format passwd | User audit |
column -o " | " | Custom separator | Dashboards |
Production Troubleshooting Scenario¶
Scenario
A DevOps engineer receives an inventory file.
Tasks:
- Display it as a table.
- Replace commas with aligned columns.
- Save formatted output.
- Display only the Running servers.
Solutions:
column -t -s "," inventory.csv
column -t -s "," inventory.csv > report.txt
grep Running inventory.csv | column -t -s ","
Mini Challenge¶
Create:
Name,Department,Salary
Alice,Engineering,85000
Bob,HR,60000
Charlie,Finance,90000
David,DevOps,75000
Perform the following:
- Display as a table.
- Use
|as the separator. - Save formatted output.
- Display only Engineering employees.
- Display only Name and Salary using
cut. - Format the result using
column.
Best Practices¶
- Use
column -tfor better terminal readability. - Use the correct delimiter with
-s. - Format reports before sharing with teammates.
- Combine
columnwithcut,paste, andgrep. - Remember that
columnchanges only the display, not the original file.
Common Mistakes¶
❌ Forgetting the delimiter.
✅ Incorrect:
Correct:
❌ Expecting column to modify files.
✅ It only formats the displayed output.
❌ Using column on data with inconsistent delimiters.
✅ Ensure the input is consistently structured.
Interview Questions¶
Beginner¶
- What is the purpose of the
columncommand? - What does the
-toption do? - How do you display a CSV file as a table?
- What does the
-soption specify?
Intermediate¶
- How do you display
/etc/passwdin aligned columns? - Explain the purpose of
-o. - How can
columnimprove shell script output? - Why doesn't
columnmodify the original file?
Architect Level¶
- How would you generate professional terminal reports from automation scripts?
- How can
columnimprove operational dashboards? - How would you combine
cut,grep, andcolumnto build an inventory report?
Summary¶
In this lesson, you learned:
- Creating aligned tables
- Formatting CSV files
- Working with custom delimiters
- Formatting command output
- Combining
columnwith other Linux utilities - Generating professional reports
The column command is a presentation tool that transforms plain text into clean, readable tables. It is especially valuable for displaying reports, inventories, and command output in a format that's easy to understand.
Key Takeaways¶
columnformats text into aligned columns.- Use
-tto create tables. - Use
-sto specify the input delimiter. - Use
-oto customize the output separator. columnimproves readability without modifying the source data.
What's Next?¶
strings Command — Extracting Printable Text from Binary Files
In the next lesson, you'll learn:
- Extracting readable text from binaries
- Analyzing executable files
- Inspecting libraries and firmware
- Malware and forensic analysis basics
- Real-world troubleshooting techniques