Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
Last active August 2, 2016 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d1i1m1o1n/84195fb33a9afd774ed4a5900e70a752 to your computer and use it in GitHub Desktop.
Save d1i1m1o1n/84195fb33a9afd774ed4a5900e70a752 to your computer and use it in GitHub Desktop.
Linux file and directories set privileges and owner and tar gz
To recursively give directories read&execute privileges:
find /path/to/base/dir -type d -exec chmod 755 {} +
To recursively give files read privileges:
find /path/to/base/dir -type f -exec chmod 644 {} +
Changing owner of a directory recursively:
chown -R user:group direcory_to_be_changed
How to find all Zero bytes files in directory including subdirectories:
find $dir -size 0 -print
создать .tar.gz (архив):
tar -czvf file.tar.gz /full/path
распаковать запаковывай .tar:
tar -xvf file.tar.gz
Бэкап базы mysql:
mysqldump -h 127.0.0.1 -u root -pPassword DBName | gzip > fileName.sql.gz
Заливаем бекап в базу данных
mysql -u USER -pPASSWORD DATABASE < /path/to/dump.sql
Заливаем архив бекапа в базу
gunzip < /path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE
или так
zcat /path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment