1. Home
  2. Linux
  3. How to split files for easy sharing on linux

How to split files for easy sharing on Linux

Uploading large files is a pain, as transferring a large chunk of data at once takes forever. A better way to go is to split the files into smaller pieces. Here’s how you can split files for easy sharing on Linux.

Splitting files

Splitting files on Linux can be done in a few ways. However, the split command is the easiest. To get started, open up a terminal window on the Linux desktop.

Unsure about how to open up a terminal window? You can by pressing Ctrl + Alt + T on the keyboard. Or, search for “Terminal” in the app menu. Run the mkdir command to create a “split” folder with the terminal window open and ready to use.

Why create a “split” folder? Splitting files can take up a lot of space, and it’s good to keep it isolated from the rest of your files.

mkdir -p ~/split/

After creating the “split” folder, use the cd command and move into the folder.

cd ~/split/

Once inside the folder, use the Linux file manager and move the file you wish to split into the “split” folder. Then, run the split command to split your file.

split --verbose my-file.fileextension

By default, the split command will divide up your file into small files with random filenames. However, if you’d prefer to split your file into a few smaller files rather than a bunch, you can specify the split size.

For example, to split a 2 GB file into 300 MB files, you can specify the size with -b.

split --verbose -b300M my-file.fileextension

To customize the size of your split files, change the -b300M command option.

Split advanced options

While the split command works fine with the defaults covered, you may want to access more advanced functions. To access the more advanced functions for split, run the split –help command in the terminal.

In addition to the –help feature, you can also run the man command and view the manual.

man split

Do you wish to save the split manual to a text file for later reading in your preferred text editor? Do the following. First, redirect the manual to a text file using >.

man split > ~/split-manual.txt

With the file exported to “split-manual.txt,” you can open it with your favorite text editor on Linux. Or, view it directly with the cat command below.

cat ~/split-manual.txt

Encrypting split files

For security reasons, you may wish to encrypt your split files. Encryption means that nobody will be able to reassemble your split files and access them. Here’s how you can do it.

First, ensure you have gpg installed on your system. We’ll be using this tool to encrypt split files. You can run the gpg –help command in the terminal to confirm if it is installed.

gpg --help

Gpg not installed? Install it with the instructions below.


sudo apt install gnupg


sudo apt-get install gnupg

Arch Linux

sudo pacman -S gnupg


sudo dnf install gnupg


sudo zypper install gnupg

With gpg set up, do the step-by-step instructions below to encrypt your split files.

Step 1: Run the ls command to view the contents of the “split” folder. In this example, there are 4 split files.


Step 2: Run the gpg -e command and encrypt the files. Note that you must encrypt each file separately. This is tedious but will allow you to keep them split for easy transfer.

Note: in this example, the split files are named xaa, xab, xac, and xad. Be sure to change the filenames with your split files.

gpg -c xaa 
gpg -c xab
gpg -c xac
gpg -c xad

Step 3: Once all files are encrypted,  re-run the ls command to view the contents of the “split” folder.


Step 4: Run the mkdir -p command and create an “encrypted” folder.

mkdir -p encrypted

Step 5: Move all encrypted, split files into the “split” folder.

mv  *.gpg encrypted/

To decrypt, run this command on each encrypted, split file.

gpg filename.gpg

Re-joining files

Rejoining split files is done with the cat command. To rejoin your files that have been split, follow the step-by-step instructions below.

Step 1: Open up a terminal window and use the cd command to move into the “split” folder.

cd ~/split

Step 2: Inside the “split” folder, run the ls command to view the contents.


Step 3: Look through the “split” folder, and delete anything other than the split files. You can delete these files using the Linux file manager.

Step 4: Using the cat command, recombine the files that you’ve split using the split command.

cat x* > name-of-recombined-file.fileextension

Step 5: Once the split files are recombined, you can delete the split files using the rm command in the terminal window.

rm x*

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.