Skip to content

Instantly share code, notes, and snippets.

@CodeKiwi
Created April 19, 2016 22:41
Show Gist options
  • Save CodeKiwi/5d072a17e974ea5dea396a1e998c9f02 to your computer and use it in GitHub Desktop.
Save CodeKiwi/5d072a17e974ea5dea396a1e998c9f02 to your computer and use it in GitHub Desktop.
#System information
glances
#Display disk usage
df
#Flush DNS cache
dscacheutil -flushcache;sudo killall -HUP mDNSResponder
#Display size of folder items
sudo du -s * | sort -n
#Count number of files in subfolders
find . -type f | wc -l
#Find files over 1gb
find -name '*' -size +1G
#Count number of files in subfolders
ls -1 | wc -l
#Copy private key up to server
cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'umask 0077; mkdir -p .ssh; cat >> .ssh/authorized_keys && echo "Key copied"'
$Copy files from one server to another
scp -rpC /var/www/httpdocs/* remote_user@remote_domain.com:/var/www/httpdocs
#User management
#https://help.ubuntu.com/12.04/serverguide/user-management.html
#Create user
adduser <username>
#Add user to group
sudo usermod -a -G admin username
Show groups for a user
groups username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment