Posts in category “Linux”

How to use Jenkins to deploy a Node.JS backend project?

  1. Checkout code
  2. Set correct config file
  3. Scp to the remote machine
  4. Run on the remote machine by ssh
    • docker-compose build --no-cache
    • docker-compose down
    • docker-compose up -d

sshPublisher setup

  1. Manage Jenkins -> Config System
    • Find Publish over SSH
    • Add New Server, test connection
  2. Write directive in Jenkins file
                continueOnError: false, failOnError: true,
                publishers: [
                  configName: "yt-files-${BRANCH}",
                  verbose: true,
                  transfers: [
                    sourceFiles: "**/**",
                    remoteDirectory: "./publish/${BRANCH}",
                    removePrefix: '',
                    remoteDirectorySDF: false,
                    cleanRemote: true,
                    execCommand: "cd ./publish/${BRANCH} && bash ${BRANCH}"


  1. 创建流水线, 添加Git仓库,Credentials
  2. 为各分支添加必要的配置文件(不方便加入版本控制的机密信息)
  3. 写 Jenkinsfile

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


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

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


设置mysql用户密码时小心 # 字符

我喜欢用 .my.cnf 配置 mysql 的登录信息,这样我执行一些命令的时候就不用在命令行上提供密码。但今天我被自己设置的”高强度密码“坑到了

简而言之,如果你的密码里有#字符,请用双引号把整个密码括起来,否则的话 #当然会被解释成注释的开始,自然你就总是得到密码不正确的结果。

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.