Get the App
SLTechnology News&Howtos  ›  Servers  › 

The function of Linux basic command cat

Shulou Source: shulou.com Published: 2022-06-01 13:14:03 10月03日 Update

This article mainly explains "the function of Linux basic command cat". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the function of Linux basic command cat".

Cat

Connect a text file or standard input and output the results to a standard output device.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Cat [options] file

Cat file1 file2 > file3

2. List of options

Option

Description

-- help

Show help documentation

-- version

Show command version

-A |-- show-all

Show all, equivalent to-vET

-b |-- number-nonblank

All outputs show line numbers, except for blank lines

-e

Equivalent to-vE

-E |-- show-ends

Output $at the end of each line

-n |-- number

Show line number

-s |-- squeeze

Merge consecutive blank lines into one line

-T

Display tab as ^ I

-t

Equivalent-vT

-v |-- show-nonprinting

Except for LDF and RAB, all controllers are displayed in "^" and "M -" modes.

3. Examples

1) output the contents of the file with line number

[root@192 weijie] # cat-b 1.c

1 2.c

2 3.c

2) merge two files into the third

[root@192 weijie] # cat 1.c 2.c

2.c

3.c

one hundred and twenty three

three hundred and forty five

[root@192 weijie] # cat 1.c 2.c > 3.c

[root@192 weijie] # cat 3.c

2.c

3.c

one hundred and twenty three

three hundred and forty five

At this point, I believe you have a deeper understanding of "the role of the Linux basic command cat". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Command output function foundation content file equivalence line number line standard learning practical deeper three two interest example practicality actual control character Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Xiaomi Linux Microsoft MariaDB