split Act 1: Basic Splitting – One Giant File → Many Small Files Alex remembers the split command. The goal: break app_error.log into many small, manageable files.
A junior system administrator who just got paged at 2 AM. A critical application server had an issue, and it generated a massive log file: app_error.log . The file is 8 GB in size. linux split file
To get only the last few chunks (containing the most recent logs), Alex lists them: split Act 1: Basic Splitting – One Giant
split -b 20M -d app_error.log app_error_20250115_part Outputs: app_error_20250115_part00 app_error_20250115_part01 … A critical application server had an issue, and
cat app_error_part_* > app_error_rebuilt.log Because split preserves the original order (aa, ab, ac or 00,01,02), cat in the correct order rebuilds the original file perfectly.
Alex needs to email the last 500 MB of logs to the senior developer for analysis. But the company email server rejects attachments larger than 25 MB. Also, Alex’s own text editor crashes when trying to open the file directly.
Here’s a helpful, practical story about using the split command in Linux. The Log File That Grew Too Large