
- Kali Linux Tutorial
- Kali Linux - Home
- Installation & Configuration
- Information Gathering Tools
- Vulnerability Analyses Tools
- Kali Linux - Wireless Attacks
- Website Penetration Testing
- Kali Linux - Exploitation Tools
- Kali Linux - Forensics Tools
- Kali Linux - Social Engineering
- Kali Linux - Stressing Tools
- Kali Linux - Sniffing & Spoofing
- Kali Linux - Password Cracking Tools
- Kali Linux - Maintaining Access
- Kali Linux - Reverse Engineering
- Kali Linux - Reporting Tools
- Kali Linux Useful Resources
- Kali Linux - Quick Guide
- Kali Linux - Useful Resources
- Kali Linux - Discussion
How to split or break large files into pieces in Linux?
To split large files into small pieces, we use the split command in the Linux operating system.The split command is used to split or break large files into small pieces in the Linux system. By default, it generates output files of a fixed size, the default lines are 1000 and the default prefix would be ‘x’.
For example, if the output file is not given, the default filename would be xaa, xab, etc. When a – (hyphen) is used instead of an input file then the data is derived from standard input.
Syntax
The general syntax of the split command as follows.
split [OPTION]... [FILE [PREFIX]]
Brief description of options available in the split command.
Sr.No. | Option & Description |
---|---|
1 | -a, --suffix-length=N Generate suffixes of length N, the default length is 2. |
2 | --additional-suffix=SUFIX Append an addition suffix to the filenames. |
3 | -b, --byte=SIZE Put SIZE bytes per output file. |
4 | -C, --line-bytes=SIZE Put at most SIZE bytes of records per output file. |
5 | -d Use numeric suffixes starting at 0 instead of by default alphabetic. |
6 | -x Use hex suffixes starting at 0, not alphabetic. |
7 | --hex-suffixes [=FROM] Same as -x option, but allow to set the start value. |
8 | -e, --elide-empty-files Do not generate empty files with -n option. |
9 | --filter=COMMAND Write to shell command, and the file name is $FILE |
10 | -l, --line=NUMBER Put NUMBER lines/records per output file. |
11 | --help Display this help and exit |
12 | --version Output version information and exit |
Example
To break or split a large file into small pieces, we use the split command in the Linux system as shown below.
$ split text.txt
After executing the above command, the file text.txt will be broken into two pieces xaa and xab in our file system.
To split large files into small pieces, we use the -l option with the split command in the Linux system as shown below.
Suppose we want to split a file into four pieces based on line then, we have to execute the below command.
$ split -l 4 text.txt
To split a file into small pieces and print what is being done, we use the --verbose option with the split command in the Linux system.
$ split --verbose text.txt Creating file ‘xaa’ Creating file ‘xab’
To check more information and option with descriptions about the split command, we use the --help option with the split command as shown below.
$ split --help
To check in which version the split command is working, we use the --version option with the split command in the Linux system as shown below.
$ split --version
- Related Articles
- How to break or split number into individual digits in Excel?
- How to break or split address into separated parts in Excel?
- How we can split Python class into multiple files?
- How to Empty or Delete a Large File Content in Linux?
- Move All Files Including Hidden Files Into Parent Directory in Linux
- How to stream large .mp4 files in HTML5?
- How to copy a file, group of files, or directory in Linux?
- How to Append Contents of Multiple Files Into One File on Linux?
- 25 Ways to Validate Configuration Files or Scripts in Linux
- How to upload large files above 500MB in PHP?
- How to Find a Specific String or Word in Files and Directories in Linux
- How to download large files through PHP script?
- How to Handle Large CSV files with Pandas?
- How to Split large string in to n-size chunks in JavaScript?
- Modify Files in Linux using vi, nano or emacs
