get IDs from links categories

Ask get_terms() for the 'link_category' and restrict the returned fields to IDs:

get_terms( 'link_category', array ( 'fields' => 'ids' ) );