The basic definition of linearity is that the output of a function exhibits a proportional response to changes in the input.
Regarding a median filter of length 3 on a sample of length 5, we are able to calculate 3 results (assuming that results off-index are invalid).
Input [1 2 3 4 5] ==> Output [2 3 4]
Input [1 2 3 4 6] ==> Output [2 3 4]
A single example is sufficient to prove that the conditions for linearity are not fulfilled. Even if many other examples might exhibit a response similar to linear functions.