What is worse for a petroleum engine - overrevving (about 6000 RPM) or shifting gears upwards too quickly? Can any of them cause permanent damage to the engine?
Based on what you've described, shifting gears too quickly will cause more damage and possibly permanent damage to the engine.
I'm assuming the redline is greater than 6k RPM. 6k RPM is not overrevving the engine. You will not cause any damage to the engine if you rev the engine to 6k RPM or shift at 6k RPM. Perhaps you will degrade the engine ever so slightly faster than if you didn't shift/rev at 6k, but in general, you will not damage it. The engine can be damaged, or its life can be significantly reduced if it is frequently revved to redline or higher.
Shifting gears too early can damage the engine. If you shift gears too early, you will most likely lug the engine. Lugging the engine can cause damage and is something you should try and avoid at all costs - err on the side of shifting later rather than earlier. You can read this answer if you'd like to know why lugging the engine is bad.
Upshifting too early won't necessarily damage the motor unless you're talking about upshifting so early that the motor is bogged down, vibrating heavily or struggling to run properly.
Knocking (pre-ignition) is a major concern if an engine is struggling to run properly due to excessive low rpm load. As this can cause serious damage if it's not attended to.
If 6000rpm is above the safe working operation of the motor then it is bad for the engine and will shorten its life & likely lead to failure.
There is not really a definitive answer to your question as any operation out of the motors recommended range is not good for it.