This paper presents a unified least-squares approach to simultaneous input and state estimation (SISE) of discrete-time linear systems. Although input estimators for systems with and without direct feedthrough are generally designed in two different ways, i.e., one with and another without a delay, the proposed approach unifies the two cases using a receding horizon estimation strategy. Moreover, regularization terms representing input information are incorporated and discarded to accommodate the model-based and model-free scenarios, respectively. The present work first investigates the general case where prior input information is available for systems with direct feedthrough and addresses important issues including the existence, optimality and stability of the derived estimators. Then, the problem of whether and under what conditions the existing studies for different systems can be related together is investigated. By setting different design parameters, the proposed estimation framework includes important literature results as its special cases, making it possible to generalize the SISE problems in various contexts. Besides, unlike the previous studies that only considered recursive SISE formulations, the present study develops a batch SISE (BSISE) formulation that addresses the optimal filtering and smoothing problems cohesively. The present work provides a unified approach to input and state estimation where the availability of the input information ranges from exactly known to completely unknown and the systems may have either zero, non-full-rank or full-rank direct feedthrough. The optimization-based formulation and its Bayesian interpretation open a variety of possible extensions and inspire new developments.