  Subfield codes of linear codes over finite fields have recently received much
attention. Some of these codes are optimal and have applications in secrete
sharing, authentication codes and association schemes. In this paper, the
$q$-ary subfield codes $C_{f,g}^{(q)}$ of six different families of linear
codes $C_{f,g}$ parametrized by two functions $f, g$ over a finite field
$F_{q^m}$ are considered and studied, respectively. The parameters and
(Hamming) weight distribution of $C_{f,g}^{(q)}$ and their punctured codes
$\bar{C}_{f,g}^{(q)}$ are explicitly determined. The parameters of the duals of
these codes are also analyzed. Some of the resultant $q$-ary codes
$C_{f,g}^{(q)},$ $\bar{C}_{f,g}^{(q)}$ and their dual codes are optimal and
some have the best known parameters. The parameters and weight enumerators of
the first two families of linear codes $C_{f,g}$ are also settled, among which
the first family is an optimal two-weight linear code meeting the Griesmer
bound, and the dual codes of these two families are almost MDS codes. As a
byproduct of this paper, a family of $[2^{4m-2},2m+1,2^{4m-3}]$ quaternary
Hermitian self-dual code are obtained with $m \geq 2$. As an application, we
show that three families of the derived linear codes give rise to several
infinite families of $t$-designs ($t \in \{2, 3\}$).
