>> how to treat the arrow keys or any other more effective method could audit the commands
Arrow keys are quite tricky to handle and I cannot offer a tried-and-tested approach to it. Basically, you need to handle several issues: * Detect arrow keys - very tricky since they are usually a *sequence* of characters and not a single one. * Keep a history of the commands so that arrow up/down can be correctly intercepted and interpreted Sorry I cannot be of more help but this really goes well beyond SSH.