You could create a tarball (zipped file) using ‘tar’ on the magneto directory and its contents, then ‘scp’ (secure copy) the tarball to the new server.
tar - https://popoleodesigns.com/create-and-extract-a-tar-gz-archive-using-command-line/
scp - https://kb.iu.edu/d/agye
HTH