Julia: How to clear console
21,495
Solution 1
To clear the console, you can go into the shell and run clear
(or cls
) from there:
julia> ;
shell> clear
Solution 2
To clear Julia REPL, press Ctrl + L.
Solution 3
As mentioned workspace() provides a fresh Main. One can clear variables (and the screen) with the following:
function clear()
Base.run(`clear`)
for var in names(Main)
try
eval(parse("$var=0"))
catch e
end
end
gc()
end
Variable definitions are permanent but can be nulled. To free types and the like wrap them in modules. For more info see the first two questions here.
Author by
Just_Alex
Alex is a simple guy who sits at his computer all day and doodles. He appreciates his privacy.
Updated on November 16, 2021Comments
-
Just_Alex over 2 years
I am using Julia Studio and would like to know the command for clearing the console of text and memory like imports or variables? Something like matlabs "clc" and "clear" commands.
-
PatrickT almost 7 years
TERM environment variable not set. failed process: Process(`clear`, ProcessExited(1)) [1]
-
Lucas over 3 yearsThat's the elegant way to do that!
-
Rafael Braga over 2 yearsNice to clear the screen, but do not free the memory.