Skip to content

Instantly share code, notes, and snippets.

@davidbehan
Last active December 17, 2015 05:49
Show Gist options
  • Save davidbehan/5560597 to your computer and use it in GitHub Desktop.
Save davidbehan/5560597 to your computer and use it in GitHub Desktop.
Snippets I use in command line or SSH
# common ssh tasks
# - - - - - - - - - - - - - - - - - - - - - - - - - -
zip -r filename.zip *
chown -R username *
chgrp -R group *
rm -rf *
chmod -R 777 uploads/
scp -r localfolder remotefolder
df -h # disk space
du -sh /var/ # disk space by folder
ls -ltr # include details
ls -a # include hidden
# plesk commands
# - - - - - - - - - - - - - - - - - - - - - - - - - -
/usr/local/psa/bin/domain -u domain.com -status enabled
# lftp stuff
# - - - - - - - - - - - - - - - - - - - - - - - - - -
set net:reconnect-interval-base 60
set net:reconnect-interval-multiplier 1
set bmk:save-passwords yes
set ftp:ssl-protect-list no
set ftp:ssl-allow no
lftp -e 'mirror -R /var/www/vhosts/somesite.com/httpdocs /webspace/httpdocs' -u username,password serveraddress
# used in a cronjob call of a url
# - - - - - - - - - - - - - - - - - - - - - - - - - -
wget -q -O /dev/null "http://www.someurl.com"
# common s3cmd commands
# - - - - - - - - - - - - - - - - - - - - - - - - - -
s3cmd sync /var/www/vhosts/domain.com/httpdocs/ s3://s3-bucket-name/
s3cmd sync --dry-run /var/www/vhosts/domain.com/httpdocs/ s3://s3-bucket-name/
# common tar commands
# - - - - - - - - - - - - - - - - - - - - - - - - - -
tar cvf /folder/filename.tar /folder/to/backup
tar cvzf /folder/filename.tar.gz /folder/to/backup
tar cvjf /folder/filename.tar.bz2 /folder/to/backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment