Installing optifine for minecraft 1.16.4

I recently downloaded optifine 1.16.4_HD_U_G5, and OpenJDK on my laptop, I can run it but it sais that it cant find Minecraft 1.16 in the /.minecraft directory, I looked into the directory via terminal and there is nothing there…how do i fix this?

You would need to manually set the target destination for Optifine, as it normally is installed on Windows or Mac.
It should go in the .jar file of the Mods folder.

Where do I find the directory for minecraft, or any apps really, when i right click them and choose edit application it doesnt have anything in the directory section. So where do I find files for applications (Im a newbie on linux btw)

I do not know as I do not play Minecraft, but in Linux, you can find files, directories or folders using the locate command in terminal.
For example, let's say I want to find a directory called "Chimpanzee-Recipies".
In terminal, I would use locate:

locate chimpanzee-recipies

It may also be that you have Minecraft installed as a Windows App using WINE. You can look in your home folder for ~/.wine, then look in the virtual 'c:' drive and follow the path to look for Minecraft folders, there.

I found ‘minecraft installer’ in the snap directory, but i’m not sure which subdirectory to intstall/extract into, I have found a .jar file in the /1.16.4 directory, but there is no way i can access the .jar files without opening it, which opens archive manager.