Text Processing and Formatting Commands in Linux (original) (raw)

Last Updated : 7 Jan, 2026

Text processing and formatting commands in Linux are used to search, filter, format, compare, and manipulate text data efficiently. These commands are widely used while working with text files, logs, configuration files, and command output, making them essential for both users and system administrators.

Below is a list of commonly used Text Processing and Formatting Commands in Linux

text_processing_and_formatting_commands

1. awk

The awk command is a powerful text-processing language used for pattern scanning and data extraction.

**Syntax:

awk 'pattern {action}' file_name

**Example:

awk '{print $1}' data.txt

awk

2. aspell

The aspell command is used as a spell checker in Linux.

**Syntax:

aspell check file_name

**Example:

aspell -c sample.txt

The banner command prints text in large ASCII characters.

**Syntax:

banner TEXT

**Example:

banner GeeksforGeeks

4. bc

The bc command is a command-line calculator.

**Syntax:

bc

**Example:

bc

bc

5. col

The col command filters reverse line feeds from text.

**Syntax:

col

**Example:

col -b < sample.txt

col

6. colcrt

The colcrt command formats text output for display.

**Syntax:

colcrt

**Example:

man ls | colcrt

colcrt

7. colrm

The colrm command removes selected columns from text.

**Syntax:

colrm start end

colrm

8. column

The column command formats output into aligned columns.

**Syntax:

column file_name

**Example:

column -t names.txt

column

9. dc

The dc command is a reverse-polish notation calculator.

**Syntax:

dc

**Example:

dc

dc

10. egrep

The egrep command searches text using extended regular expressions.

**Syntax:

egrep "pattern" file_name

**Example:

egrep "R" names.txt

egrep

11. fgrep

The fgrep command searches fixed strings in files.

**Syntax:

fgrep "string" file_name

**Example:

fgrep "Rohit" names.txt

fgrep

12. fmt

The fmt command formats and wraps text files.

**Syntax:

fmt file_name

**Example:

fmt para.txt

fmt

13. grep

The grep command searches for patterns in text files.

**Syntax:

grep "pattern" file_name

**Example:

grep "Rohit" names.txt

grep

14. sdiff

The sdiff command compares two files side by side.

**Syntax:

sdiff file1 file2

**Example:

sdiff file1.txt file2.txt

sdiff

15. sed

The sed command is a stream editor for text manipulation.

**Syntax:

sed 'command' file_name

**Example:

sed 's/Linux/Ubuntu/g' sedfile.txt

sed

16. tr

The tr command translates or deletes characters.

**Syntax:

tr set1 set2

**Example:

echo "linux command" | tr 'a-z' 'A-Z'

tr

17. unix2dos

The unix2dos command converts Unix text files to DOS format.

**Syntax:

unix2dos file_name

**Example:

unix2dos sample.txt

unix2dos