Recovering samsung G5 after firmware flash?
try wiping the cache from bootloader menu . 

or this

https://www.androidcentral.com/10-basic-terminal-commands-you-should-know this is a starting point to flash twrp or a custom rom using the Android Debug Bridge ADB

Look for a utube how to install ADB and fastboot for your pc . Then when u have adb command window open connect usb to device &amp; use
1. The adb devices command which is "adb devices"

do this first before down loading any of the sdk package as you need to know if your pc can recognize your device.

you could also use somthing like this for the type of device you have this only works for samsung but there are others for different manufactures

https://www.google.co.uk/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=4&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwjz65GBkaneAhWlhKYKHaTHBuQQwqsBMAN6BAgDEAQ&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJv538rOL5p0&amp;usg=AOvVaw3bIUhWGgbgikQiD3eBUfG1

hope this points you in right direction