Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the split command in Linux

Shulou Source: shulou.com Published: 2022-06-01 16:10:16 10月01日 Update

This article mainly shows you how to use the split command in Linux. The content is simple and easy to understand. It is clearly organized. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn how to use the split command in Linux.

The Linux split command is used to split a file into several pieces. This command splits large files into smaller files. By default, it will split into small files every 1000 lines.

Syntax split [--help][--version][-][-b ][-C ][-l ][file to be split][output filename] Parameters:

- : Specify how many lines to cut into a small file

-b : Specify how many bytes are divided into small files

- help : online help

- version : Display version information

-C : Similar to parameter "-b", but will try to maintain the integrity of each row when cutting

[Output file name] : Set the prefix of the file after splitting, split will automatically add the number after the prefix

The example uses the command "split" to split the file "README" into files every 6 lines by entering the following command:

$ split -6 README #Split README file into one file every six lines After executing the above command, the command "split" will split the original large file "README" into multiple small files starting with "x". Each of these small files has only six lines of content.

Use the command "ls" to view the current directory structure as follows:

$ ls #Execute ls command #Get current directory structure README xaa xad xag xab xae xah xac xaf xai Above is "How to use split command in Linux" All the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Tags: File command instruction content file name article help parameter directory structure cut learning output similarity information only online help multiple byte integrity Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MySQL OPPO Reno Redmi Apple