Create a file on samba tool output

Hello Everyone,

I’m trying to get an updated computer list that has to sync with few jobs… maybe my question is silly, but
how can I save the output of this command to a file?

systemd-run -M nsdc -t /bin/bash -c "samba-tool computer list"

thanks for reading

Hi @trogloraspa

By using a pipe:

systemd-run -M nsdc -t /bin/bash -c "samba-tool computer list" > saved-file.txt

This creates a new file every time run.

or

systemd-run -M nsdc -t /bin/bash -c "samba-tool computer list" >> saved-file.txt

This adds to the same file every time run - the file will get bigger…

Hope this helps

My 2 cents
Andy

2 Likes