I am new to Ubuntu, today I was learning how to delete files and folders but accidentally I deleted the /opt
directory that located in Computer.
I don’t know if what I deleted is important or not. So I want to create the /opt
directory again. where all other important folder exists and they are /var
,/root
, /home
and so on.
Best Answer
On a newly installed Ubuntu system,
/opt
exists but is empty. You can just run:And that will recreate it, with the correct permissions.
But if there was software installed inside when it was removed, that won't bring it back.
There probably wasn't, though. You'd likely have remembered installing it there.
/opt
is not usually for programs installed automatically through Ubuntu's package manager. Instead, for the most part it's used for programs that install with their own methods, often (but not only) proprietary payware installed from CD.If you remember how you deleted
/opt
, a more specific prediction as to whether or not there was anything in it could be given. For example, if the way you remove it was to runsudo rmdir /opt
, that will only work if the directory is empty. On the other hand, if you usedrm -r
, it needn't have been empty.