Forrest logo
tool overview
On this page you find all important commands for the CLI tool split. If the command you are looking for is missing please ask our AI.

split

Split is a command line tool used to split a file into multiple parts. It is commonly used for dividing large files into smaller chunks for easier storage, transfer, or processing.

  1. Split is available on most Unix-like operating systems, including Linux, macOS, and BSD.
  2. The tool allows users to split a file based on a specified size or number of lines.
  3. Splitting a file based on size is often useful when transferring files to external media with size limitations, such as DVDs or USB drives.
  4. Additionally, splitting files by lines can be helpful for processing large text files or when dealing with limited system resources.
  5. The split command syntax usually follows the pattern "split [options] [input_file] [prefix]".
  6. The [options] section allows users to specify the desired splitting parameters. For example, using -b 1M will split the file into 1 MB parts.
  7. The [input_file] argument represents the file that needs to be split, and [prefix] determines the prefix for the resulting split files.
  8. The default behavior of split is to create files with a two-letter prefix (aa, ab, ac, etc.) and an extension.
  9. Split also provides options for specifying the number of output files, setting a custom prefix, and controlling the naming convention of the resulting files.
  10. To join the split files back into the original file, the cat command (concatenate) can be used, along with the appropriate filenames.

List of commands for split:

  • split:tldr:514ba split: Split a file, each split having 10 lines (except the last split).
    $ split -l ${10} ${filename}
    try on your machine
    explain this command
  • split:tldr:86921 split: Split a file into 5 files. File is split such that each split has same size (except the last split).
    $ split -n ${5} ${filename}
    try on your machine
    explain this command
  • split:tldr:a7f51 split: Split a file with 512 bytes in each split (except the last split; use 512k for kilobytes and 512m for megabytes).
    $ split -b ${512} ${filename}
    try on your machine
    explain this command
  • split:tldr:afc97 split: Split a file by a regular expression. The matching line will be the first line of the next output file.
    $ split -p ${select} ${filename}
    try on your machine
    explain this command
  • split:tldr:b238c split: Split a file with at most 512 bytes in each split without breaking lines.
    $ split -C ${512} ${filename}
    try on your machine
    explain this command
tool overview