Skip to content

Instantly share code, notes, and snippets.

@ejoubaud
Last active August 29, 2015 14:01
Show Gist options
  • Save ejoubaud/f97cb774e3d52b13efd5 to your computer and use it in GitHub Desktop.
Save ejoubaud/f97cb774e3d52b13efd5 to your computer and use it in GitHub Desktop.
Favorite sysadmin commands
# List all crontabs on a box (from http://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users)
for user in $(cut -f1 -d: /etc/passwd); do sudo crontab -u $user -l; done
# See what's eating up disk space
sudo du -h / | grep '[0-9]G'
# Multiple ssh, install i2cssh
# cmd+shift+i to broadcast'
# Terminal.app alternative is csshx
i2cssh -mdj1,dj2,dj3,dj4,dj5
# List dirs in current dir with their total size, date and name, ordered by date
ls -lt | tail -n +2 | awk '{ name = $9; ("du -hs " name " | cut -f1") | getline size; date = $7 "-" $6 ":" $8; print size "\t" date "\t" name }'
# Su as another user (here deploy) sharing SSH key when sshed
chgrp -R deploy $(dirname $SSH_AUTH_SOCK) && chmod -R g+wx $(dirname $SSH_AUTH_SOCK) && sudo -u deploy /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment