Category: bash

  • Linux UX improvements

    Fish as a shell. I like the fact that out of the box it does what it should do and what I configure in Bash. And I like abbreviations. ripgrep which is faster grep Bat which is a way better cat  ??? lolcat!

  • List of bash tutorials

    Just not to forget http://mywiki.wooledge.org/BashGuide/Arrays

  • More .bashrc improvements

    I need to see long path and host name. And not to lose command line space at the same time: BOLD=”\[$($TTY && /usr/bin/tput bold)\]” COLOR_BLACK=”\[$($TTY && /usr/bin/tput setaf 0)\]” COLOR_RED=”\[$($TTY && /usr/bin/tput setaf 1)\]” COLOR_GREEN=”\[$($TTY && /usr/bin/tput setaf 2)\]” COLOR_YELLOW=”\[$($TTY && /usr/bin/tput setaf 3)\]” COLOR_BLUE=”\[$($TTY && /usr/bin/tput setaf 4)\]” COLOR_MAGENTA=”\[$($TTY && /usr/bin/tput setaf 5)\]” COLOR_CYAN=”\[$($TTY…

  • Bash scripting manual

    Apple has got very nice bash scripting manual here: https://developer.apple.com/library/content/documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html Check the security and AWK sections.

  • TOC and collapsible block samples

    I am writing some tool for my daily work that produces fancy HTML page from RHEL, CentOS or Fedora log and config files, so it would be more easy to read them. Nothing special, just some bash scripts with sed, grep and awk that produce HTML with some CSS and JQuery. TOC I really liked: http://projects.jga.me/toc/ It’s very easy to use and implement, it just…

  • How to sort messages log

    If you need to sort out what is reporting to the /var/log/messages to array in case of Red Hat Enterprise Linux or Fedora, you need to do flowing manipulations: read log; get 5th column from the log, it’s daemon name; get rid of all digits, so the daemons with different PIDs would be counted as one; 1. get rid of all ‘/’ and replace ‘[’ and ‘]’ with ‘\[’ and ‘\]’…

  • Not to forget useful vi and bash settings

    .bash_profile .vimrc Not sure about ‘number’ setting, if interferes with the clipboard annoyingly, so I can turn them off.

  • E-mail notification on every login

    It’s useful sometimes to get notifications on every ssh login that is happen on the server (though, could be used to monitor logins made by other means). First method is based on the /etc/profile, but it should not be used because user can override it with setting own variables if home directory is writable for him. Most convenient is to use PAM, putting in the /etc/pam.d/sshd execution of the script that…

  • Backuping mysql

    Recently I have to backup mysql database on quite heavily loaded server and I wanted to make backup daily on one hand and I wanted them not to affect production on the other. DB size is more than 150 Gb, about 50k users daily. First approach was ty try to simply run musqldump and see what would happen. Site was down right after the backup has begun. Then…

  • Rsync backup speedup

    Чтобы самому не забыть, запишу как надо зеркалировать NAS на NAS. Итак, есть 2 штуки NAS’ов с ARM’ами и Linux’ами разной степени кастрированности на них. В моем случае это WD Sharespace и ZyXEL NSA221, оба с кастомными прошивками. Кастомные они, конечно, кастомные, но это не Gentoo и не Debian, где есть все, это просто пара…