Posts tagged with “linux”

A quick way to run a database update periodically by crontab

  1. put a .my.cnf file into your home directory, for example
$ cat ~/.my.cnf 
  1. write a bash script to update the database

set -ex

variable=`TZ="Africa/Abidjan" date '+%Y-%m-%d %H:%M:%S'`
sql="Your SQL statement with ${variable}"

logDir=/data/Logs/`date '+%Y'`/`date '+%m'`
mkdir -p "${logDir}"
echo "${sql}" >> "${logDir}/`date '+%d'`.sql"
mysql -v -v -e "${sql}" >> "${logDir}/`date '+%d'`.result.txt"
  1. put a line by run crontab -e

the end.

转换 gbk txt文件为 utf-8 编码


iconv -c -f gbk -t utf-8 待转文件名 > target.txt

-c 的意思是在输出文本中忽略非法的字符序列



package name for common used Linux util in Debian/Ubuntu


apt install -y procps


apt install -y iputils-ping


apt install -y telnet

Using dconf-editor to setup extra hot keys for the Gnome 3 desktop

The keyboard shortcuts setting in the Settings app can only support 4 workspaces. However, I want to use 8 workspaces to implement the goal of "everything in its right place". Solution:

sudo apt install dconf-editor

# Then you can do what you want to do there


By the way, my final configuration is shown below:

Ctrl + 1-8 Switch to workspace 1-8
Ctrl+Alt+1-8 Move current window to workspace 1-8 and jump to that workspace

  • Workspace 1: Chrome
  • Workspace 2: Gnome-terminal
  • Workspace 3: Rider
  • Workspace 4: WebStorm
  • Workspace 5: Ebook reader (Evince and others)
  • Workspace 6: File Manager, BitTorrent downloader,
  • Workspace 7: VMs
  • Workspace 8: Settings, Telegram, music player, misc.

Linux TIPS collect (神奇的知识集合)

  1. http_proxy environment in sudo command: http_proxy=xxx:xxx sudo yourcommand doesn't work, you should sudo http_proxy=xxx:yyy yourcommand instead.
  2. ssh running local script: ssh [email protected] 'bash -s' <
  3. ssh running local script with paraemters: ssh [email protected] < 'bash -s' yourparam1 yourparam2 doesn't work, you should runssh [email protected] < 'bash -s' -- yourparam1 yourparam2