Custom drush command not working
Try the following:

/**
 * Implements hook_drush_command().
 */
function mymodule_drush_command() {
  $items['list-site-users'] = array(
    'description' =&gt; 'Does a database cleanup.',
    'examples' =&gt; array(
      'list-site-users' =&gt; 'Retrieve list for all users',
    ),
    'aliases' =&gt; array('lsu'),
  );
  return $items;
}

function drush_mymodule_list_site_users() {
  $query = db_select('users', 'u');
  $query-&gt;fields('u', array('name'));
  $result = $query-&gt;execute();
  while($record = $result-&gt;fetchAssoc()) {
       print_r($record['name']);
  }
}


NOTE: Make sure you write the above code in mymodule.drush.inc file of any module.
Clear the cache and your drush command should work.