Reputation: 1366
I want to download a the end of a log file from my dev machine at home to my local machine, the last 1MB. Is this possible?
Upvotes: 1
Views: 98
Reputation: 166
Well you could get the last 1MB from the file and save it as another file. Then scp that file to your local machine. You can extract the data by using:
tail -c $(( 1024*1024 )) your_file > target_file
(source: https://unix.stackexchange.com/questions/32941/use-dd-to-cut-file-end-part)
Upvotes: 1
Reputation: 686
Yes it is possible.
Run it on your dev machine
tail -c 1048576 logfile.log | ssh user@remotemachine "cat > local_file_name"
Upvotes: 1