Tech Snippets

  • vim (source): transcribe spaces to tabs
    • :set tabstop=4
    • :set noexpandtab
    • :%retab!
  • vim (source): set syntax highlighting for a non-standard file extention
    • :set syntax=html
  • Shell (source): Find largest files and directories, including subdirectories
    • # du -Sh | sort -rh | head -5
  • Shell (source): Changes owner and group of a directory and its contents to root and www, respectively.
    • $ sudo chown -R root:www /var/www
  • Shell (source): Change the directory permissions of /var/www and its subdirectories to add group write permissions and to set the group ID on future subdirectories.
    • $ sudo chmod 2775 /var/www
    • $ find /var/www -type d -exec sudo chmod 2775 {} \;
  • Shell (source): Recursively change the file permissions of /var/www and its subdirectories to add group write permissions.
    • $ find /var/www -type f -exec sudo chmod 0664 {} \;
  • BASH Shell (Source): Customize BASH prompt with date/time, iface IP and current directory.
    • vi ~/.bashrc
    • PS1='[`date +”%d-%b-%y %T”`]\[\033[01;31m\] `ifconfig enp4s0 2>/dev/null | sed -n 2,2p | cut -d”:” -f 2| cut -d” ” -f 1`\[\033[00m\] \[\033[01;34m\]\W\[\033[00m\] > ‘