First you need to create a support ticket or contact support to enable shell access.
Then, open up your terminal app and type
ssh -p 2222 firstname.lastname@example.org
You use your cPanel login credentials to access the server.
via How Do I Get and Use SSH Access? « HostGator.com Support Portal.