Skip to content

Instantly share code, notes, and snippets.

@khanhtran3005
Last active June 26, 2018 01:48
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 khanhtran3005/f0f4a8c2d3ec98c6cc1636decd16bb26 to your computer and use it in GitHub Desktop.
Save khanhtran3005/f0f4a8c2d3ec98c6cc1636decd16bb26 to your computer and use it in GitHub Desktop.
Some useful Unix commands for SysAd
  • Disable a service which starts automatically sudo update-rc.d -f nginx disable

  • Space investigation:

    • Find top biggest directories under particular partition: du -a /home/xxx | sort -n -r | head -n 5

    • To display the above result in human readable format: du -Sh /home/xxx | sort -rh | head -5

    • Find Top File Sizes Only find /home/xxx -type f -exec du -Sh {} + | sort -rh | head -n 5

  • Delete files older than x days find ./$BK_FOLDER -mtime $KEEPING_DAYS -type f -delete

  • Run composer with particular PHP version: /opt/plesk/php/7.0/bin/php /usr/lib/plesk-9.0/composer.phar xxx

  • Alter files/folder permission:

    • find /specific/directory -type [f|d] -exec setfacl -Rm u:unix_account:rwx {} \;
    • find /specific/directory -type [f|d] -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment