Sometimes you are on a server where you generate export file. It’s easy to just scp the file from the server to your local machine.

scp [email protected]:/tmp/myfile.csv  /tmp/local_folder/

But some times you are dealing with a situation where you can ssh but you cannot scp (AWS Elastic Beanstalk is a good example)

If the file don’t contain private data (passwords, emails) what you can do is email the file on your work email.


  • install mutt mail command (simple mailng inteface supporting attachment files)
  • compress your file / folder
  • send file attachment with with mutt

mutt syntax:

echo "mail body" | mutt -a file -s "Subject" -- [email protected]


## install mutt command:
# sudo apt-get install mutt
# sudo yum install mutt

# Given we have generated `views.csv` file
gzip views.csv
echo "mail body" | mutt -a views.csv.gz -s "MyApp view stat files" -- [email protected]

# Given we mupltiple files in directory `views/`
tar -zcvf views.tar.gz views/
du -sh views.tar.gz

echo "mail body" | mutt -a views.tar.gz -s "MyApp view stat files" -- [email protected]

Warning I do recommend to encrypt the file before sending


zip -P password file

# ...or:

zip -e file

# ...or:

gpg -o fileToTar.tgz.gpg --symmetric fileToTar.tgz

# to decrypt
gpg fileToTar.tgz.gpg