Linux command line - how long has VPN been connected

Hello,

Using ubuntu 20.10 on a Raspberry PI 2, connecting to remote site using openvpn 2.4.9 (Unrelated sidenote: everything here is quite old, and cannot be updated, but I will be reinstalling soon.)

Is there a simple way to find out how long the VPN has been up? I cannot find one, and if this is true I’ll use a crude file timestamp (using touch) to determine future tunnel uptime.

Thanks VPN’ers!!!

If you use a system service, you can check to see how long the service has been running.

If you use OpenVPN 3 Linux, you can easily see it running the openvpn3 sessions-list command.

Otherwise, use system logs or ps faxuw | grep openvpn to see when the command was started.