  In this paper we define and study a family of codes which come close to be
MRD codes, so we call them AMRD codes (almost MRD). An AMRD code is a code with
rank defect equal to 1. AMRD codes whose duals are AMRD are called dually AMRD.
Dually AMRD codes are the closest to the MRD codes given that both they and
their dual codes are almost optimal. Necessary and sufficient conditions for
the codes to be dually AMRD are given. Furthermore we show that dually AMRD
codes and codes of rank defect one and maximum 2-generalized weight coincide
when the size of the matrix divides the dimension.
