Consider for simplicity an electric field or magnetic field in a region and a surface.
The amount of field lines passing through the surface is defined as the flux.
The concept of magnetic flux is specially important in electromagnetic induction, and other areas of electrical engineering where magnetic circuits may be studied.
For an electric field,
Similar thing can be generalised to magnetic fields where magnetic flux is defined as,
Calculating flux is not very simple except for simple geometries where one can divide the area into small elements and integrate.
One way to find the flux though a closed surface would be by application of Gauss' law.