Not sure what command are you using and what is error?
As access to workspace is managed per user on databricks so %sh magic commands will not work as you could see other user files.
Dbfs is data storage. Notebook code from Workspace can be moved to Repos (git repository) or can be exported to file using File->export in notebook or via API.