1
ssh -i dummy.pem ubuntu@server find /home/ubuntu/ -type f -print0 | 
xargs -0 stat --format '%Z' | sort -nr | cut -d: -f2- | head -1

stat: missing operand
Try `stat --help' for more information.

How can I ssh into a server, then grab the most recently modified time of a file in a directory recursively?

2 Answers 2

2

Use quote marks: ssh -i dummy.pem ubuntu@server 'find /home/ubuntu/ -type f -print0 | xargs -0 stat --format '%Z' | sort -nr | cut -d: -f2- | head -1'

Sign up to request clarification or add additional context in comments.

Comments

0

you have to quote the command. Alternatively, you can use <<

ssh -i ... <<EOF
find /home...
EOF

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.