# How can I see what Get restored?

Say I save variables x, y, z using Save["stuff.dat", {x, y, z}]. Is there any way, when using Get["stuff.dat"], that I can see what are the names of the variables being restored?

• You could use \$NewSymbol to track if Get[...] defines any new symbols, but this won't tell you if an already existing symbol gets overwritten. – JEM_Mosig Feb 16 '18 at 1:23

You could use TracePrint:

a=2;
b=3;
c[x_]:=x^2

Save["tst.m", {a,b,c}];

TracePrint[
Get["tst.m"],
_Set | _SetDelayed
]


a=2

b=3

c[x_]:=x^2

If you just want to see the variables, you can add a custom TraceAction:

TracePrint[
Get["tst.m"],
_Set | _SetDelayed,
TraceAction->(Print[Extract[#, {1, 1}, HoldForm]]&)
]


a

b

c[x_]

• Will this work at the mx level though? I thought I remembered that preempting all my tricks – b3m2a1 Feb 16 '18 at 3:01
• Thank you both for your help, but some of the variables I am restoring contain large amounts of data and these methods list every value along with the name. I don't need to know the values, just the variable names that have been restored. Is there a way to just list the variable names restored, but not their values? – Paul R. Feb 17 '18 at 2:32