Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Linux Cat command

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "use of Linux Cat command", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "the use of Linux Cat command" bar!

Red Hat Linux has a tool program that can help you keep short lists, collect them, and even reveal some information about your system. This tool is called Linux Cat, which is short for concatenate, meaning merge files.

How to use Linux Cat: cat [- AbeEnstTuv] [--help] [--version] fileName

Linux Cat description: connect the file string to the basic output (screen or add > fileName to another file)

Parameters:

-n or-- number numbers all output lines starting with 1

-b or-- number-nonblank is similar to-n, except that blank lines are not numbered

When-s or-- squeeze-blank encounters blank lines with more than two consecutive lines, replace them with blank lines of one line

-v or-- show-nonprinting

Linux Cat example:

Cat-n textfile1 > textfile2 enter the contents of the textfile1 file with a line number into the textfile2 file

Cat-b textfile1 textfile2 > > textfile3 appends the contents of textfile1 and textfile2 files to textfile3 after adding line numbers (blank lines are not added).

Example:

Add the line number to the textfile1 file and enter it into the textfile2 file.

Cat-n textfile1 > textfile2

Append the contents of textfile1 and textfile2 files to textfile3 after adding line numbers (blank lines are not added).

Cat-b textfile1 textfile2 > > textfile3

Cat / dev/null > / etc/test.txt this is emptying / etc/test.txt file content

Cat can also be used to make image file. For example, to make an image file of a floppy disk, type the floppy disk after putting it away.

Cat / dev/fd0 > OUTFILE

On the contrary, if you want to write image file to a floppy disk, please type

Cat IMG_FILE > / dev/fd0

Note:

1. OUTFILE refers to the output image file name.

2. IMG_FILE means image file.

3. If you write back to device from image file, the device capacity needs to be the same.

4. It is usually used to make boot disk.

Cat has three main functions: go

1. Displays the entire file at once. $cat filename ~, y6tere

two。 Create a file from the keyboard. $cat > filename 0room7

Only new files can be created, existing files cannot be edited. : Z)

3. Merge several files into one file. $cat file1 file2 > file "tweets =\

Linux Cat parameter: p:DS

-n or-- number numbers all output lines starting with 1.\ R5

-b or-- number-nonblank is similar to-n, except that blank lines are not numbered |, 3s

When-s or-- squeeze-blank encounters blank lines with more than two consecutive lines, replace them with blank lines on one line! s

-v or-- show-nonprinting tds?O

Example: `@ uq*Y

Cat-n textfile1 > textfile2 enter the contents of the textfile1 file with a line number and enter it into the textfile2 file d

Cat-b textfile1 textfile2 > > textfile3 appends the contents of textfile1 and textfile2 files to textfile3 after adding line numbers (blank lines are not added). ; L-#pj

Example: + Hu

Enter the contents of the textfile1 file with a line number into the textfile2 file z] G =

Cat-n textfile1 > textfile2 v "z&r3

Append the contents of textfile1 and textfile2 files to textfile3 after adding line numbers (blank lines are not added). RG.7n

Cat-b textfile1 textfile2 > > textfile3 1M?1O

Cat / dev/null > / etc/test.txt this is emptying / etc/test.txt file content J2fx

Cat can also be used to make image file. For example, to make an image file of a floppy disk, type {zQ after putting the floppy disk away.

Cat / dev/fd0 > OUTFILE% W~Ik.

Conversely, if you want to write image file to a floppy disk, please type GK "d

Cat IMG_FILE > / dev/fd0 e

Note: ©Newboys-Newboys Comprehensive Forum G

1. OUTFILE refers to the output image file name. + cMcCt

2. IMG_FILE means image file. Ew

3. If you write back to device from image file, the device capacity needs to be the same. $

Thank you for your reading, the above is the content of "the use of Linux Cat command", after the study of this article, I believe you have a deeper understanding of the use of Linux Cat command, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report