fbpx Linux split Command: Split Large Files into Parts | Certificação Linux

Linux split Command: Split Large Files into Smaller Parts

📅 01/01/2019 ⏱ 2 min ✍️ Uira Ribeiro
Linuxcommands
Linux split Command: Split Large Files into Smaller Parts
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

The split command in Linux (split) is used to split large files into n-smaller files. The output files are generated according to the number of lines in the input file. The default is to split the file every 1000 lines. The output file names follow the pattern fileaa fileab fileac, and so on. You can specify a suffix for the output file.

The most common option is:

  • -n:             Where n is the number of lines that will split the input file;
  • -b bytes:  Split the file into a defined number of bytes.

In this example the supermarket list file is split into 4 files with suffix "lista" with two lines each:

$ split -2 supermercado lista$ ls -l-rw-rw-r-- 1 ec2-user ec2-user      14 set 13 09:08 listaaa-rw-rw-r-- 1 ec2-user ec2-user      13 set 13 09:08 listaab-rw-rw-r-- 1 ec2-user ec2-user      14 set 13 09:08 listaac-rw-rw-r-- 1 ec2-user ec2-user      12 set 13 09:08 listaad-rw-rw-r-- 1 ec2-user ec2-user      53 set 13 08:40 supermercado

Learn much more about Linux in our online course. You can enroll here. If you already have an account, or want to create one, just log in or create your user here.

Liked it? Share

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp