Split Log File and Copy Large File(s)

As a reminder for myself, here is the useful syntax on Linux that I recently use:

split -l 2000 logfile.txt

scp home_location username@destinationip:destination_location

The first syntax is used when we get error logged on a text file but it’s too large to be opened with standard text editor. We can split the files into certain lines, for example 2000 lines. But considering the lines and file size, we may add it up to 100000 lines or any that we like as long as it can be viewed.

The second syntax is used for copying between Linux based servers. I usually use this syntax when move/copy such a large file, let’s say around 10 GB per file such as Database/Schema image/backup file. The speed of copy process is pretty good, but please also take a big note that the speed amount is really depending on network ability to transfer data.

We can combine multiple files into a single copy process by throw a *.fileextension in home_location parameter.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s