Skip to content

Instantly share code, notes, and snippets.

@s10wen
Created July 22, 2014 12:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save s10wen/6cf00ab86b96e5d1fa9c to your computer and use it in GitHub Desktop.
copy `ls -al` from a server to local txt file
#!/bin/bash
# ssh into server
ssh server@wherever.com
# cd to path
cd /where/you/want/
# list everything in a vertical list
ls -al
# copy the `ls -al` output and save to a file locally
???
@s10wen
Copy link
Author

s10wen commented Jul 22, 2014

Thanks to https://github.com/mathiasbynens for this nice solution:

If all you need is ls -al output, run ssh host 'ls -al /some/path' > foo.txt on your local machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment