Skip to content

Instantly share code, notes, and snippets.

@vsoch
Created May 4, 2019 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsoch/59cc204fa71b88035f4795cace512425 to your computer and use it in GitHub Desktop.
Save vsoch/59cc204fa71b88035f4795cace512425 to your computer and use it in GitHub Desktop.
Saving output to a file and printing to terminal

This is executing a command to the container to list at the root (/) and then redirect stdout and stderr to "out.txt"

$ singularity exec salad_latest.sif ls / 2>&1 | tee out.txt
bin
code
dev
environment
etc
home
lib
media
mnt
proc
root
run
sbin
singularity
srv
sys
tmp
usr
var

And confirm that's what is put there:

vanessa@vanessa-ThinkPad-T460s:/tmp$ cat out.txt 
bin
code
dev
environment
etc
home
lib
media
mnt
proc
root
run
sbin
singularity
srv
sys
tmp
usr
var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment