Add function to handle the ps command.