It's unclear what "fighting at the front" means. I'm going to interpret that not as literally fighting, because a commander's job is to command, but as deliberately being at the front exposed to rifle fire. A commander "fights from the front" to have more timely and accurate information and to ensure his orders get through. But they also risk having too narrow a view and being cut off.
I will also omit cases where a headquarters unit was overrun. I feel the question is about deliberately commanding from the front. Not picking up a rifle because the enemy is at your doorstep.
There are so many examples one cannot begin to list them all. Here's a smattering from memory of commanders in the thickest of the action. I have saved the best for last.
Ship captains in a war zone, whether military or civilian, are commanding from the front. They share the dangers and fate of their crew. Particularly in World War 2 all ships, belligerent or neutral, were vulnerable to unrestricted submarine warfare, surface raiders, and long range maritime attack aircraft.
In particular, Commander Ernest Evans commanded the destroyer USS Johnston during the Battle off Samar defending his small, slow escort carriers against a vastly superior Japanese surface fleet including the Yamato. His ship charged the heavy cruiser Kumano, blowing off her bow with torpedoes and setting her on fire. Johnston was punished by multiple hits from battleship guns rendering the bridge useless. Evans, less two fingers, commanded his ship by yelling down a hatch to men operating the rudder by hand. Despite severe damage, and now lacking torpedoes, he attacked again firing on a Kongo class battleship. Then he attacked another heavy cruiser which was bearing down on the American escort carriers. Then he fought off a group of destroyers causing them to dump their torpedoes too early. Taking multiple hits, Johnston's engines finally quit. Dead in the water, surrounded, on fire, with no power, but still firing, Evans ordered abandon ship. He was never seen again.
Erwin Rommel, during the Battle of France, commanded the 7th Panzer Division from the front and often in front of the main line. Rommel was criticized for being too far in front, taking too many risks, and, critically, being out of touch with his command. 7th Panzer was referred to as "The Ghost Division" not just because it seemed to appear out of nowhere, but by the Germans because high command often did not know where they were or what they were doing.
Watch Military History Visualized's video about Rommel's behavior on May 16/17th, 1940: Why Ghost Division? What Did Rommel Do?
On D-Day, US Assistant Division Commanders went ashore with their men. Brigadier General Teddy Roosevelt Jr., son of ex-president Teddy Roosevelt, insisted he go ashore at Utah with the 4th Infantry Division despite walking with a cane.
Brigadier General Norman Cota, assistant division commander of the 6th Division, went ashore into the meat grinder of Omaha Beach. He's credited with rallying his troops saying "Gentlemen, we are being killed on the beaches. Let us go inland and be killed" or words to that effect. Cota personally directed blowing a gap in the defenses and subsequent charge off the beach. He admonished a group of 5th Rangers holding behind a seawall "Well, God damn it, if you are Rangers, then get up there and lead the way!" which became the Ranger motto "Rangers Lead The Way". Later inland, he came across a unit pinned down by fire from a farmhouse and personally demonstrated a close assault.
I'd suggest reading The Longest Day or watching the movie.
Allied Airborne divisions have many examples of commanders jumping with their men, often into hotly contested jump zones. In particular during Operation Market Garden and the chaotic fighting which followed. They're simply too many to list, I'd recommend you read A Bridge Too Far or watch the excellent film adaptation. Here are some highlights.
Major Julian Cook commanding 504th PIR (Parachute Infantry Regiment) personally commanded a near-suicidal daylight river crossing attack on Nijmegen Bridge. The audacity of this attack is well depicted in this clip from A Bridge Too Far with Robert Redford playing Cook.
Then Lt. Colonel John Frost, after dropping into Oosterbeek, took his 2nd Battalion into Arnhem and managed to make a dash to the northern end of the eponymous bridge too far. He held out at the bridge for four days, fighting off constant attempts to dislodge him, before finally surrendering. The replacement bridge is named in his honor. One of these counter-attacks is depicted in A Bridge Too Far with Anthony Hopkins as Col. Frost.
Finally, Admiral Sir Walter Cowan. A veteran of The Great War, he was 70 when he voluntarily took the lower rank of commander and took command of HMS Aphis bombarding the North African coast. As commander, he was known for standing on the deck shooting at aircraft with a Thompson Submachine Gun; spraying small pistol caliber bullets has no hope of damaging an aircraft, but it must have been quite a sight for his crew.
Later in 1942 he'd attached himself as naval liaison officer to the 18th King Edward's Own Cavalry fighting in North Africa... operating 40 miles from the sea. At the Battle of Bir Hakeim his position was overrun. He stepped out of his trench and emptied his revolver at an offending German tank. The tank crew graciously did not fire back and took him captive. Upon his release a year later, he swore that if properly supported he would have captured the tank!
You can find a brief account of his adventures in Gunboat! Small Ships At War.