How to clear variables and/or whole work space

hello ,i’m a newcomer. i use Atom as my IDE for julia . How to clear the information in REPL and the variables that i do not need in the work space

1 Like

I don’t use Atom but in Julia 0.6 REPL, you can use the workspace() function to clear things up.

julia> a = 1

julia> a

julia> workspace()

julia> a
ERROR: UndefVarError: a not defined

Note that workspace is gone in 0.7, so going forward the only way to clear your workspace is to quit and restart Julia.

1 Like

I think you can replace your variables with nothing and then garbage collect.

The following shows what I mean:

1 Like

But then the binding still exists.

Is that harmful?

Depends on what you want, just saying it’s different from the behavior of workspace().

1 Like

Using workspace() in Juno is a bad idea and will break all sorts of things, so I’d really advise against it.

You can clear the REPL display with Ctrl-J Ctrl-C or by typing clearconsole() into the REPL, however.

1 Like

thank u all very much . i got it.

1 Like

Ctrl+J, Ctrl+C will clear the Console but not the Workspace: the variables and functions created are not cleared.

You can clear the Workspace from the Console by pressing Ctrl+D to end Julia and Enter to start it again. This works reasonably fast.

I am working in Juno/JuliaPro. Is there any other method to clear the Workspace without stopping Julia?


There used to be a workspace() function, but it was removed as it had some problems. I think that the consensus is that stopping and restarting the process is now fast enough for practical purposes.


It is fast when the project doesn’t have many dependencies. But with more dependencies, it takes more time. Is there any method to restart without precompile again?


It does not work with Julia 1.4.2 on Windows 10. According to the documentation Key bindings, it should be Ctrl + L now.

I do not find how to clear variables in that documentation. The workaround is just to restart Julia.

1 Like

There should be a way to clear workspace. Ctrl+L clears the console but the objects are still there. Restarting is a bad way of doing things.

1 Like