Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Split large file and combine file in Linux

Rumi, August 6, 2019August 6, 2019
$ du -h Linux\ Security.mp4

Sample output:

1.1G Linux Security.mp4

As you see, the video file size is 1.1 GiB, which is very large to upload to my google drive. Even though, Google Drive lets users upload files up to 5TB in size, it is really time consuming process. With my low speed Internet connection, I presume it would take more than 30 minutes to upload. I don’t want to wait that much longer. So, what I am going to do is split this file into multiple smaller size files, for example 100 MB each, to make upload process faster.

Now, let us split the above file into multiple smaller files, say for example 100MB each. To do so, run:

$ split -b 100M Linux\ Security.mp4 ls.

The above command splits the Linux Security.mp4 file into 100MB chunks. This command creates files named ls.aa, ls.ab, ls.ac.. and so on.

Let us take a look at the output after splitting the large file.

$ ls

Sample output:

'Linux Security.mp4' ls.ab ls.ad ls.af ls.ah ls.aj
ls.aa ls.ac ls.ae ls.ag ls.ai ls.ak

See? Linux Security.mp4 file has been split into multiple files named ls.aa, ls.ab …. ls.ak etc. Each file size is 100MB.

Now, It is little bit easy to send them as Email attachment.

Combine files in Linux from command line

Save all files in a folder. And then, go to that folder and combine them as follows.

$ cat ls.?? > Linux_security.mp4

Here, Linux_security.mp4 is output file name. The double question marks(??) match any two-character extension in the file name. To put this simply, the filename part ls.?? matches all filenames such as ls.aa, ls.ab ..etc., and combine all of them into single file. Please be mindful that this command will combine all files that contains two-character extensions. So, be sure before combining files. If there are some other files with two letter extensions, they will also be merged into the output file.

Also, don’t forget to mention the correct extension while merging them. In case, you want to send all files via mail to your friend, tell him/her the correct extension of the files you have sent. He/she should use the same file extension in the output file while combining them.

If you don’t specify any argument in the split command, the file will split into multiple smaller files with x** as file names. Each file would contain 1000 lines by default. Here, ** is the two character suffix that is added by default with each file name.

Let us split the same file using split command without specifying any extra arguments like below.

$ split Linux\ Security.mp4

This command splits the Linux security file into multiple smaller files with x** as file names.

Run ‘ls’ command to view the files:

$ ls

Sample output:

Linux Security.mp4
xaj xat xbd xbn xbx xch xcr xdb xdl xdv xef xep xez xfj xaa xak xau xbe xbo xby xci xcs xdc xdm xdw xeg xeq xfa xfk xab xal xav xbf xbp xbz xcj xct xdd xdn xdx xeh xer xfb xfl xac xam xaw xbg xbq xca xck xcu xde xdo xdy xei xes xfc xfm xad xan xax xbh xbr xcb xcl xcv xdf xdp xdz xej xet xfd xae xao xay xbi xbs xcc xcm xcw xdg xdq xea xek xeu xfe xaf xap xaz xbj xbt xcd xcn xcx xdh xdr xeb xel xev xff xag xaq xba xbk xbu xce xco xcy xdi xds xec xem xew xfg xah xar xbb xbl xbv xcf xcp xcz xdj xdt xed xen xex xfh xai xas xbc xbm xbw xcg xcq xda xdk xdu xee xeo xey xfi

Each file should contain 1000 lines. You can also verify it using wc (word count) command as shown below.

$ wc -l *

Sample output would be:

142891 Linux Security.mp4
1000 xaa
1000 xab
1000 xac
1000 xad
1000 xae
1000 xaf
1000 xag
1000 xah
.
.
.
1000 xfl
891 xfm
285782 total

To combine all these files, run:

$ cat x* > ls.mp4

The above command will combine all files into a single file called ls.mp4.

For more details, refer man pages.

$ man split
Administrations Configurations (Linux)

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker endian icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx pfsense php Postfix powerdns Proxmox RDP squid SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin XCP-NG zimbra

Topics

Recent Posts

  • Install Jitsi on Ubuntu 22.04 / 22.10 April 30, 2025
  • Key Lessons in life April 26, 2025
  • Create Proxmox Backup Server (PBS) on Debian 12 April 19, 2025
  • Add Physical Drive in Proxmox VM Guest April 19, 2025
  • Mount a drive permanently with fstab in Linux April 16, 2025
  • Proxmox 1:1 NAT routing March 30, 2025
  • Installation steps of WSL – Windows Subsystem for Linux March 8, 2025
  • Enabling Nested Virtualization In Proxmox March 8, 2025
  • How to Modify/Change console/SSH login banner for Proxmox Virtual Environment (Proxmox VE / PVE) March 3, 2025
  • Install Proxmox Backup Server on Debian 12 February 12, 2025

Archives

Top Posts & Pages

  • Install Jitsi on Ubuntu 22.04 / 22.10
©2025 Bots! | WordPress Theme by SuperbThemes