Skip to content

Instantly share code, notes, and snippets.

@danfaizer
Last active June 9, 2016 15:16
Show Gist options
  • Save danfaizer/176058631ab42a5a1fc7 to your computer and use it in GitHub Desktop.
Save danfaizer/176058631ab42a5a1fc7 to your computer and use it in GitHub Desktop.
Often Forgotten Helpful Commands
# DD with progress bar (pv package required)
pv -tpreb myimage.img | sudo dd of=/dev/diskX bs=1m
# SSH port forwarding/tunneling
ssh -f -L local_port:destination_server:destination_port user@intermediate_server -N
# MySQL - Size per DB query
SELECT table_schema "DB name", sum( data_length + index_length ) / 1024 / 1024 "DB size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
# MySQL - Size per Table query
SELECT table_name, round(((data_length + index_length) / (1024*1024)),2) as "Table size in MB" FROM information_schema.tables;
# rsync local folders
# r-> recursive , t-> preserve modification time, v-> verbose, u-> skip not modified files/folders, c-> checksum
# !careful! -c parameter adds huge overhead when syncing large files
rsync -rtvuc --progress folderX/ folderY/
# Mount cifs protected share in MacOS
mount_smbfs -d 755 -f 755 //user:password@SHARESERVER/folder ~/Folder
# Expand LV after PV has been resized
pvresize /dev/pv_path
lvextend -l +100%FREE /dev/vg_name/lv_name
resize2fs /dev/mapper/lv_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment