How to make game object shake?

ive been trying to find a way to do a quick and simple way to make a game object (enemy) shake when hit.
void Update()
{

    if (Input.GetKeyDown(keyToPress))
    {
        if (canBePressed)
        {
            gameObject.SetActive(false);
            Gone = true;
        }
    }

    if (Gone)
    {
        
    }
}

im trying to attach the shake effect onto the if (gone) onto a script that the player has.

Or you can use the plugin DoTween for this purpose as it has a method DOShake especially for shaking a gameobjects transform.