{"id":3838,"date":"2024-10-31T13:03:10","date_gmt":"2024-10-31T13:03:10","guid":{"rendered":"https:\/\/john.pentaidea.com\/?p=3838"},"modified":"2025-07-31T06:27:51","modified_gmt":"2025-07-31T06:27:51","slug":"linux-%e5%b8%b8%e7%94%a8%e6%8c%87%e4%bb%a4-updating-2","status":"publish","type":"post","link":"https:\/\/john.pentaidea.com\/?p=3838","title":{"rendered":"Linux \u5e38\u7528\u6307\u4ee4 (updating)"},"content":{"rendered":"<p><h1>Other<\/h1>\n<\/p>\n<ul>\n<li>\n<p>\u542b <code>\\n<\/code> \u7684\u5b57\u4e32\u4e0d\u80fd\u76f4\u63a5\u7528 echo \u53bb base64, \u5148\u653e\u5230 file \u88e1\u9762\u624d\u4e0d\u6703\u76f4\u63a5\u88ab\u5ffd\u7565<\/p>\n<\/li>\n<li>\n<p>Install DNS tool <code>dig<\/code><\/p>\n<p><code>apt-get install dnsutils<\/code><\/p>\n<\/li>\n<li>\n<p>Find and replace <\/p>\n<\/li>\n<\/ul>\n<pre><code>sed -i -e 's\/abc\/XYZ\/g' \/tmp\/file.txt\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check cpu \/ memory usage<\/p>\n<\/li>\n<\/ul>\n<pre><code>kubectl exec -it pod_name -n namespace -- sh \n# cpu usage\ncat \/sys\/fs\/cgroup\/cpu\/cpuacct.usage\n \n# for memory usage\ncat \/sys\/fs\/cgroup\/memory\/memory.usage_in_bytes \n## to MB\ncat \/sys\/fs\/cgroup\/memory\/memory.usage_in_bytes | awk '{ foo = $1 \/ 1024 \/ 1024 ; print foo \"MB\" }'\n<\/code><\/pre>\n<ul>\n<li>\n<p>Clean zombie\/defunct process<\/p>\n<\/li>\n<\/ul>\n<pre><code># do work\nreboot\n\n# grep all defunct\nps -ef | grep -i defun\n\n# try killing\nkill -9 27950\nkillall -9 defunct\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check connection TLS version<\/p>\n<p>(check &#8220;Protocol :&#8230;&#8221; first then &#8220;New, &#8230;&#8221;)<\/p>\n<\/li>\n<\/ul>\n<pre><code>$ openssl s_client -connect example.com:443\n\n---\nNew, TLSv1.3, Cipher is TLS_AES_128_GCM_SHA256\nServer public key is 256 bit\n---\nSSL-Session:\n\u00a0 \u00a0 Protocol\u00a0 : TLSv1.2\n---\n<\/code><\/pre>\n<ul>\n<li>\n<p>ssh with grant permission<\/p>\n<\/li>\n<\/ul>\n<pre><code>cp \/mnt\/c\/xxx.pem ~\/.ssh\/.\nchmod 600 ~\/.ssh\/xxx.pem\nssh -i ~\/.ssh\/xxx.pem azureuser@x.x.x.x\n<\/code><\/pre>\n<ul>\n<li>\n<p>date format<\/p>\n<\/li>\n<\/ul>\n<pre><code>date '+%Y-%m-%d %H:%M:%S'\n\n# diff month`\ndate -d '-1 month' +'Last month was %Y\/%m\/%d?'\n<\/code><\/pre>\n<ul>\n<li>\n<p>list folder by date<\/p>\n<\/li>\n<\/ul>\n<pre><code>ls -lt\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get curent public IP<\/p>\n<\/li>\n<\/ul>\n<pre><code>curl ifconfig.me\n<\/code><\/pre>\n<ul>\n<li>\n<p>Unzip .gz<\/p>\n<\/li>\n<\/ul>\n<pre><code>gzip -d xxx.gz\n<\/code><\/pre>\n<ul>\n<li>\n<p><b>grep <\/b><\/p>\n<\/li>\n<ul>\n<li>\n<p><b>helper<\/b><\/p>\n<\/li>\n<ul>\n<li>\n<p>-F<\/p>\n<\/li>\n<ul>\n<li>\n<p>plain text only, no wildcard and regex <\/p>\n<\/li>\n<\/ul>\n<li>\n<p>-A{n}<\/p>\n<\/li>\n<ul>\n<li>\n<p>print after {n} lines<\/p>\n<\/li>\n<\/ul>\n<li>\n<p>-B{n}<\/p>\n<\/li>\n<ul>\n<li>\n<p>print before {n} lines<\/p>\n<\/li>\n<\/ul>\n<li>\n<p>-E ,\u00a0 regex<\/p>\n<\/li>\n<\/ul>\n<li>\n<p>grep: all files for string<\/p>\n<\/li>\n<ul>\n<li>\n<p>-r, &#8211;recursive\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 like &#8211;directories=recurse<\/p>\n<\/li>\n<li>\n<p>-n, &#8211;line-number\u00a0 \u00a0 \u00a0 \u00a0\u00a0 print line number with output lines<\/p>\n<\/li>\n<li>\n<p>-i, &#8211;ignore-case\u00a0 \u00a0 \u00a0 \u00a0\u00a0 ignore case distinctions in patterns and data<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<pre><code>grep -r \"texthere\" .\ngrep -rni \"string\" * \n<\/code><\/pre>\n<ul>\n<li>\n<p>Print memory and data<\/p>\n<\/li>\n<\/ul>\n<pre><code>echo $(date --iso-8601=ns) $(free -k | grep ^M | awk -F' ' '{print $1\",\"$2\",\"$3\",\"$4 }') &gt;&gt; \/tmp\/mem_report.txt\n<\/code><\/pre>\n<ul>\n<li>\n<p>Be ware of multiple line command in <code>if then else<\/code> condition<\/p>\n<\/li>\n<\/ul>\n<pre><code>## example as follows: cat not working\n\nif echo \"400\" | grep \"200\";\nthen\n\u00a0 \u00a0 echo \"Passed\"\nelse\n\u00a0 \u00a0 echo \"Failed\" \n\u00a0 \u00a0 curl -X POST 'xxx' \\\n\u00a0 \u00a0 -H 'Content-Type: application\/json' \\\n\u00a0 \u00a0 -d \"$(cat &lt;&lt;EOF\n\u00a0 \u00a0 { \n\u00a0 \u00a0 \u00a0 \u00a0 \"test\": \"test\", \n\u00a0 \u00a0 }\n\u00a0 \u00a0 EOF \n\u00a0 \u00a0 )\"\nfi\n<\/code><\/pre>\n<ul>\n<li>\n<p>Curl to POST json data<\/p>\n<\/li>\n<\/ul>\n<pre><code>export BASH_VARIABLE=\"[1,2,3]\" \ncurl http:\/\/localhost:8080\/path -d \"$(cat &lt;&lt;EOF \n{ \n\u00a0 \"name\": $BASH_VARIABLE, \n\u00a0 \"something\": [ \n\u00a0 \u00a0 \"value1\", \n\u00a0 \u00a0 \"value2\", \n\u00a0 \u00a0 \"value3\" \n\u00a0 ] \n} \nEOF \n)\" -H 'Content-Type: application\/json'\n<\/code><\/pre>\n<ul>\n<li>\n<p>Download certificate<\/p>\n<\/li>\n<\/ul>\n<pre><code>echo -n | openssl s_client -connect $HOST:$PORTNUMBER -servername $SERVERNAME \\ \n\u00a0 \u00a0 | openssl x509 &gt; \/tmp\/$SERVERNAME.cert\n<\/code><\/pre>\n<ul>\n<li>\n<p>Unzip<\/p>\n<\/li>\n<\/ul>\n<pre><code># 1\ntar -xf archive.tar.gz -C .\/folder\n\n# 2\ngunzip file.gz\ngunzip &lt; file.tar.gz | tar xvf -\n<\/code><\/pre>\n<ul>\n<li>\n<p>View file metadata<\/p>\n<\/li>\n<\/ul>\n<pre><code>strings file.exe | egrep '^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$'\n<\/code><\/pre>\n<ul>\n<li>\n<p>Bash character<\/p>\n<\/li>\n<\/ul>\n<pre><code>$ =&gt; variable\n${} =&gt; separate variable in string\n$() =&gt; run function inside then output to variable\n(()) =&gt; could run basic +-x%\n\n<\/code><\/pre>\n<ul>\n<li>\n<p>Test database SQL command<\/p>\n<\/li>\n<\/ul>\n<pre><code>#!\/bin\/bash\u00a0 \u00a0 \u00a0 \u00a0  \necho Start Executing SQL commands\nsqlplus &lt;user&gt;\/&lt;password&gt; @file-with-sql-1.sql\nsqlplus &lt;user&gt;\/&lt;password&gt; @file-with-sql-2.sql\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check apt package version<\/p>\n<\/li>\n<\/ul>\n<pre><code>apt-get -s install tesseract-ocr\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check pip package version<\/p>\n<\/li>\n<\/ul>\n<pre><code>pip show Jinja2\n<\/code><\/pre>\n<ul>\n<li>\n<p>Multiple line command.\u00a0 by &#8220;\\&#8221;<\/p>\n<\/li>\n<\/ul>\n<pre><code>docker run -d --name jaeger \\\n\u00a0 -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \\\n\u00a0 -p 5775:5775\/udp \\\n\u00a0 ...\n<\/code><\/pre>\n<ul>\n<li>\n<p>Replace string with &#8220;sed&#8221;<\/p>\n<\/li>\n<\/ul>\n<pre><code># current file\nsed -i \"s\/{{TargetStr}}\/{{NewStr}}\/g\" deploy.yaml\n\n# Expose to another file\nsed \"s\/{{TargetStr}}\/{{NewStr}}\/g\" deploy.yaml &gt; new.yaml\n\n# When including special charactor(e.g. \/), use \"|\" instead.\nsed -i \"s|{{TargetStr}}|{{NewStr}}|g\" deploy.yaml\n<\/code><\/pre>\n<ul>\n<li>\n<p>[Bash] Enable error interrupting\u00a0<\/p>\n<\/li>\n<\/ul>\n<pre><code>set -e\n<\/code><\/pre>\n<ul>\n<li>\n<p>Show datetime<\/p>\n<\/li>\n<\/ul>\n<pre><code>$(date -d '-1 month' '+%Y-%m-%d')\n## print: 2020-08-08\n## Use \\%\u00a0 in crontab\n<\/code><\/pre>\n<ul>\n<li>\n<p>Remove all files exclude specific file<\/p>\n<\/li>\n<\/ul>\n<pre><code>find . ! -name 'file.txt' -type f -exec rm -f {} +\n\nfind . ! -name '2020*' -exec rm -f {} +\n<\/code><\/pre>\n<ul>\n<li>\n<p>Linux file sharing<\/p>\n<\/li>\n<\/ul>\n<pre><code>sudo npm install -g http-server\nhttp-server -o\n<\/code><\/pre>\n<ul>\n<li>\n<p>Filter string and column<\/p>\n<\/li>\n<\/ul>\n<pre><code>| awk '\/pattern\/{ print $0 }'\n# $0 all, $1 column 1, $2 column 2, ...\n<\/code><\/pre>\n<ul>\n<li>\n<p>Make restful call and get response<\/p>\n<\/li>\n<\/ul>\n<pre><code>curl -i https:\/\/xxx.com\n<\/code><\/pre>\n<ul>\n<li>\n<p>Download GitHub release<\/p>\n<\/li>\n<\/ul>\n<pre><code>wget --no-check-certificate --content-disposition https:\/\/github.com\/joyent\/node\/tarball\/v0.7.1\n\n# --no-check-cerftificate was necessary for me to have wget not puke about https\ncurl -LJO https:\/\/github.com\/joyent\/node\/tarball\/v0.7.1\n\n# Just download file\ncurl -OJ https:\/\/xxx.com\/xxx.zip\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install\u00a0mkpasswd<\/p>\n<\/li>\n<\/ul>\n<pre><code>yum install expect\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install\u00a0<\/p>\n<\/li>\n<\/ul>\n<pre><code>yum install httpd-tools\n<\/code><\/pre>\n<ul>\n<li>\n<p>Generate self-signed SSL cert<\/p>\n<\/li>\n<\/ul>\n<pre><code>$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check if script not existed and run<\/p>\n<\/li>\n<\/ul>\n<pre><code>ps aux | grep \"app\/main.py\" | grep -v grep\nif [ $? != 0 ]; then\n\u00a0 python3 \/srv\/app\/main.py\nfi\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check if process existed<\/p>\n<\/li>\n<\/ul>\n<pre><code>ps aux | grep \"your_running_command\" | grep -v grep\n<\/code><\/pre>\n<ul>\n<li>\n<p>Append string to file<\/p>\n<\/li>\n<\/ul>\n<pre><code>echo $'first line\\nsecond line\\nthirdline' &gt;&gt; foo\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get http status code<\/p>\n<\/li>\n<\/ul>\n<pre><code>curl -I http:\/\/www.example.org\ncurl -v http:\/\/www.example.org\u00a0 \u00a0 # -v == --verbose\n<\/code><\/pre>\n<ul>\n<li>\n<p>Local mail box<\/p>\n<\/li>\n<\/ul>\n<pre><code>\/var\/mail\/{USER}\n\/var\/spool\/mail\/{USER}\n<\/code><\/pre>\n<ul>\n<li>\n<p>While loop infinity<\/p>\n<\/li>\n<\/ul>\n<pre><code>while true; do echo hi; sleep 5; done\n<\/code><\/pre>\n<ul>\n<li>\n<p>Print log to file by datetime<\/p>\n<\/li>\n<\/ul>\n<pre><code>ls -al &gt; output_$(date +\"%m_%d_%Y\")\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check the collected<\/p>\n<\/li>\n<li>\n<p>yum \u5217\u51fa\u6240\u6709 package \u53ef\u88dd\u7248\u672c<\/p>\n<\/li>\n<\/ul>\n<pre><code>yum list {{package}} --showduplicates | sort -r\n<\/code><\/pre>\n<ul>\n<li>\n<p>Search file content (support .gz, regex co)<\/p>\n<\/li>\n<\/ul>\n<pre><code>zgrep -inE '\/api\/v2.*disable' *\u00a0 \u00a0 \u00a0 \u00a0 # regex search all files\n<\/code><\/pre>\n<ul>\n<li>\n<p>Search file or folder<\/p>\n<\/li>\n<\/ul>\n<pre><code>find \/ -type f -name {{filename}}\n<\/code><\/pre>\n<ul>\n<li>\n<p>yum\u00a0 search\u641c\u5c0b package by keyword<\/p>\n<\/li>\n<\/ul>\n<pre><code>yum search {{keyword}}\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install nodeJS<\/p>\n<\/li>\n<\/ul>\n<pre><code>#delete if needed\nsudo apt-get --purge remove node\nsudo apt-get --purge remove nodejs\nsudo apt-get install nodejs\n#Use 'node' command rather than 'nodejs'\nupdate-alternatives --install \/usr\/bin\/node node \/usr\/bin\/nodejs 10\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install pip3<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0sudo apt-get install python3-pip<\/p>\n<ul>\n<li>\n<p>Install nethogs (network usage)<\/p>\n<\/li>\n<\/ul>\n<pre><code>apt-get install build-essential libncurses5-dev libpcap-dev\ngit clone https:\/\/github.com\/raboof\/nethogs\nmake &amp;&amp; sudo .\/src\/nethogs\nmake install &amp;&amp; hash -r &amp;&amp; nethogs\n\n# sudo make uninstall\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install htop<\/p>\n<\/li>\n<\/ul>\n<pre><code>sudo yum install epel-release\nsudo yum updatess\n\nsudo yum install htop\n<\/code><\/pre>\n<ul>\n<li>\n<p>Jupyter from .ipynb to .py<\/p>\n<\/li>\n<\/ul>\n<pre><code>On the command line, you can use nbconvert:\n$ jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb\nAs a bit of a hack, you can even call the above command in an IPython notebook by pre-pending ! (used for any command line argument). Inside a notebook:\n!jupyter nbconvert --to script config_template.ipynb\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u767c url request and show the time<\/p>\n<\/li>\n<\/ul>\n<pre><code>curl -o \/dev\/null -s -w \"%{time_connect} + %{time_starttransfer} = %{time_total}\\n\" &lt;YOUR_URI&gt;<\/code><\/pre>\n<ul>\n<li>\n<p>&#8220;No package top available.<\/p>\n<\/li>\n<\/ul>\n<pre><code>Error: Nothing to do\"\n# htop seems to be available in the EPEL repo. Try yum install epel-release, then yum install htop again.\nyum install epel-release\n<\/code><\/pre>\n<ul>\n<li>\n<p>About compressing: Zip, Unzip<\/p>\n<\/li>\n<\/ul>\n<pre><code># zip with hidden file (.htaccess)\nsudo find . -type f -name '.*' -print | sudo zip newZipFile.zip -@\n\n\n# zip all in folder\nsudo zip -r\u00a0 {ZIPNAME}.zip {FOLDER_PATH1} {FOLDER_PATH2} {FOLDER_PATH3} ...\n\n\n# unzip to specific folder\nsudo unzip {ZIPNAME}.zip -d {FOLDER_PATH}\n\n# browser into zip file\nunzip -l {{zipfile}}\nless {{zipfile}}\nvim {{zipfile}}\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install ssh for ubuntu<\/p>\n<\/li>\n<\/ul>\n<pre><code>sudo apt-get install openssh-server\n\n# Enable\/Disable root\nvi \/etc\/ssh\/sshd_config\n--\nPermitRootLogin Yes\n--\n\n# (optional) Set allowed IP\nvi \/etc\/hosts.allow\n--\nsshd:192.168.1.88:allow\n--\nvi \/etc\/hosts.deny\n--\nsshd:all:deny\n--\n-&gt; then restart\n\n\n# (optional) restart\nsudo \/etc\/init.d\/ssh restart\n<\/code><\/pre>\n<ul>\n<li>\n<p>Install Remote GUI for Ubuntu<\/p>\n<\/li>\n<\/ul>\n<pre><code># xfce4\nsudo apt-get install xfce4\n## additional goodies\nsudo apt-get install xfce4-goodies\n<\/code><\/pre>\n<ul>\n<li>\n<p>Make shortcut to command<\/p>\n<\/li>\n<\/ul>\n<pre><code>alias lc=long-command\n<\/code><\/pre>\n<h1>About System<\/h1>\n<ul>\n<li>\n<p>Auto apply ssh to linux:\u00a0 add empty <code>ssh<\/code> file to root folder<\/p>\n<\/li>\n<li>\n<p>Find regex string not include by awk<\/p>\n<\/li>\n<\/ul>\n<pre><code>XXXstring | awk '$0 !~\/domain\/{print $0}'\n<\/code><\/pre>\n<ul>\n<li>\n<p>Cron Job will lost PATH<\/p>\n<\/li>\n<\/ul>\n<pre><code># Set the path back again\nexport PATH={$PATH}\n<\/code><\/pre>\n<ul>\n<li>\n<p>Add user to root group<\/p>\n<\/li>\n<\/ul>\n<pre><code>$ sudo usermod -a -G root john\n<\/code><\/pre>\n<ul>\n<li>\n<p>Build ssh with rsa key (private\/public\/pem)<\/p>\n<\/li>\n<\/ul>\n<pre><code># Generate ssh key\n$ssh-keygen -t rsa -b 4096 -C \"your_email@example.com\"\n$ssh-keygen -t rsa\n\n# Use public(.pub) rsa key to login\n# Put public key into `authorized_keys` (each key start with \"ssh-rsa\")\n$vi ~\/.ssh\/authorized_keys\n--- authorized_keys ---\nssh-rsa XXXXX\nssh-rsa XXXXX\n------\n\n\n# Restrict logining with key only\n$sudo vi \/etc\/ssh\/sshd_config\n--- sshd_config ---\nPasswordAuthentication no\n------\n\n# Restart to apply settings (choose one)\n$sudo service ssh restart\n$sudo systemctl restart ssh\n<\/code><\/pre>\n<ul>\n<li>\n<p>Get current IP by web service<\/p>\n<\/li>\n<\/ul>\n<pre><code>import commands\ncommands.getstatusoutput(\"wget -qO- http:\/\/whatismyip.host\/ | grep -oP '(?&lt;=ipaddress\\\"\\&gt;)[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+(?=\\&lt;\\\/p\\&gt;)'\")\n<\/code><\/pre>\n<ul>\n<li>\n<p>Show swap<\/p>\n<\/li>\n<\/ul>\n<pre><code>sudo swapon \u2013show\n<\/code><\/pre>\n<ul>\n<li>\n<p>Lock account<\/p>\n<\/li>\n<\/ul>\n<pre><code>passwd -l testuser\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # lock\npasswd --status testuser\u00a0 \u00a0 # Verify\n<\/code><\/pre>\n<ul>\n<li>\n<p>Switch users<\/p>\n<\/li>\n<\/ul>\n<pre><code>su -\u00a0 # Switch to root\nsudo su\u00a0 # Run as sudoer\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6aa2\u67e5 users and groups<\/p>\n<\/li>\n<\/ul>\n<pre><code>cat \/etc\/passwd\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6aa2\u67e5\u7db2\u8def\u9023\u63a5\u72c0\u6cc1<\/p>\n<\/li>\n<\/ul>\n<pre><code>ss -l\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6aa2\u67e5 OS \u7248\u672c version<\/p>\n<\/li>\n<\/ul>\n<pre><code>uname -a\nhostnamectl\ncat \/etc\/os-release\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u767b\u5165\u6210 root\u00a0<\/p>\n<\/li>\n<\/ul>\n<pre><code>su -\n<\/code><\/pre>\n<ul>\n<li>\n<p>Show all environment variables<\/p>\n<\/li>\n<\/ul>\n<pre><code>env\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6aa2\u67e5\u6240\u6709 disk<\/p>\n<\/li>\n<\/ul>\n<pre><code>lsblk\nsudo fdisk -l\nsudo parted -l\nsudo blkid\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6aa2\u67e5 disk info and usage<\/p>\n<\/li>\n<\/ul>\n<pre><code>df -Th\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6aa2\u67e5 disk usage per folder<\/p>\n<\/li>\n<\/ul>\n<pre><code>\u00a0 \u00a0 sudo du -hs *\n\u00a0 \u00a0 # all current folder\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u639b\u8f09\/mount disk<\/p>\n<\/li>\n<\/ul>\n<pre><code>$ mkdir disk\n$ sudo mount -t ext4 \/dev\/sdb1 disk\n## df -h\n$ sudo umount \/dev\/sdb1\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u8a2d\u5b9a proxy<\/p>\n<\/li>\n<\/ul>\n<pre><code>vi ~\/.bashrc\nexport http_proxy=\"http:\/\/{USER}:{PASSWORD}@{PROXY_SERVER}:{PORT}\"\nexport https_proxy=\"https:\/\/{USER}:{PASSWORD}@{PROXY_SERVER}:{PORT}\"\nexport ftp_proxy=\"http:\/\/{USER}:{PASSWORD}@{PROXY_SERVER}:{PORT}\"\n<\/code><\/pre>\n<ul>\n<ul>\n<li>\n<p>for yum<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<pre><code>$ sudo vim \/etc\/yum.conf\nproxy={{http:\/\/IP:port}}\n\nRef: http:\/\/marcustsai.blogspot.com\/2012\/07\/linux-proxy.html\n<\/code><\/pre>\n<ul>\n<ul>\n<li>\n<p>for docker<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<pre><code>1. Build service file.\n$ sudo mkdir -p \/etc\/systemd\/system\/docker.service.d\n\nHTTP:\n$ sudo vim \/etc\/systemd\/system\/docker.service.d\/http-proxy.conf\n[Service]\nEnvironment=\"http_proxy={{http:\/\/IP:port}}\/\"\n\nHTTPS:\n$ sudo vim \/etc\/systemd\/system\/docker.service.d\/https-proxy.conf\n[Service]\nEnvironment=\"https_proxy={{http:\/\/IP:port}}\/\"\n\nsudo systemctl daemon-reload\nsudo systemctl restart docker\nsystemctl show --property=Environment docker\n\nRef: https:\/\/github.com\/moby\/moby\/issues\/32270\n<\/code><\/pre>\n<ul>\n<li>\n<p>The best \u9032\u7a0b\u76e3\u8996\u5668<\/p>\n<\/li>\n<\/ul>\n<pre><code>apt-get install htop\nmore:\nIf you just to ask \"politely\" a process to quit use 3 SIGQUIT.\nIf you want to make sure the process quits use 9 SIGKILL.\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u91cd\u65b0\u9023\u7d50\u7a81\u7136\u65b7\u7dda\u7684 session (\u5982\u679c\u6709\u88ab\u81ea\u52d5\u5b58\u7684\u8a71)<\/p>\n<\/li>\n<\/ul>\n<pre><code>yum load-transaction \/tmp\/yum_save_tx.2018-02-12.08-39.gOr6vZ.yumtx\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6aa2\u67e5 memory<\/p>\n<\/li>\n<\/ul>\n<pre><code>cat \/proc\/meminfo\nfree -h\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6aa2\u67e5 listening port<\/p>\n<\/li>\n<\/ul>\n<pre><code>sudo netstat -tulpn\n\n#\u5217\u51fa occupy port \u7684 ap\nsudo fuser 80\/tcp\n<\/code><\/pre>\n<ul>\n<li>\n<p>Clear memory cache<\/p>\n<\/li>\n<\/ul>\n<pre><code>\u8981\u5f37\u5236\u624b\u52d5\u91cb\u653e\u6216\u6e05\u9664Linux\u4e2d\u7684Cache Memory\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u6307\u4ee4\necho 3 &gt; \/proc\/sys\/vm\/drop_caches\n(3 \u662f\u6307\u91cb\u653epagecache\u3001dentries\u8207inodes\uff0c\u4e5f\u5c31\u662f\u91cb\u653e\u6240\u6709\u7684cache)\n\u5176\u4ed6\u4e5f\u53ef\u4ee5\u4e0b\uff1a\n#\u91cb\u653epagecache\necho 1 &gt; \/proc\/sys\/vm\/drop_caches\n#\u91cb\u653edentries\u8207inodes\necho 2 &gt; \/proc\/sys\/vm\/drop_caches\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u6301\u7e8c\u770b\u8457 log \u66f4\u65b0<\/p>\n<\/li>\n<\/ul>\n<pre><code>less -S +F your.log\nor\ntail -f your.log\u00a0 (like advance cat)\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u5217\u51fa\u6240\u6709\u7cfb\u7d71\u8b8a\u6578<\/p>\n<\/li>\n<\/ul>\n<pre><code>printenv\nenv\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u8a2d\u5b9a\u958b\u6a5f\u9810\u8f09\u5165\u78c1\u789f\u5340<\/p>\n<\/li>\n<\/ul>\n<pre><code>vi \/etc\/fstab\n\u52a0\u5165:\n\/dev\/xvdb \/data ext4 defaults 0 0\n<\/code><\/pre>\n<ul>\n<li>\n<p>Customize creating SWAP partition<\/p>\n<\/li>\n<\/ul>\n<pre><code>1. \u5efa\u7acb\u9069\u7576\u5927\u5c0f\u7684\u6a94\u6848(ex. 512MB)\nsudo dd if=\/dev\/zero of=\/etc\/swap.img bs=1M count=512\n2. \u5c07\u6a94\u6848\u683c\u5f0f\u5316\u70baswap\u683c\u5f0f\nsudo mkswap \/etc\/swap.img\n3. \u555f\u7528\u8a72swap\nsudo swapon \/etc\/swap.img\n\u5982\u679c\u5e0c\u671b\u8a72\u6a94\u6848\u5728\u6bcf\u6b21\u958b\u6a5f\u90fd\u53ef\u4ee5\u81ea\u52d5\u639b\u8f09\uff0c\u53ef\u4ee5\u900f\u904e\u8a2d\u5b9a\/etc\/fstab\u6a94\u6848\u4f86\u8b93swap\u53ef\u4ee5\u81ea\u52d5\u639b\u8f09\nvi \/etc\/fstab\n\u52a0\u5165:\n\/etc\/swap.img swap swap defaults 0 0\n<\/code><\/pre>\n<ul>\n<li>\n<p>nohup command :<\/p>\n<\/li>\n<\/ul>\n<pre><code>nohup does not disconnect from terminal, it makes your app ignore SIGHUP, and (usually) redirects stdout\/stderr. Run jobs in your terminal. It may just be a background job, and you can bring it back with fg. I don't know how to get stderr\/stdout once you redirect it.\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u591a\u4efb\u52d9\u7ba1\u7406<\/p>\n<\/li>\n<ul>\n<li>\n<p>screen command:<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<pre><code>TL;DR;\nscreen -S paportal -L -Logfile \/var\/socketlog\/pa.screenrc\nCtrl + a, Ctrl + d\nscreen\u00a0 \u00a0 =&gt; \u958b\u555f\u4e00\u500b\u65b0\u00a0 terminal socket\nscreen -L\u00a0 =&gt;\u00a0 \u958b\u555f\u65b0 screen + \u756b\u9762\u7d00\u9304\u529f\u80fd\nscreen -S [Socket Name] =&gt; \u81ea\u8a02 Socket \u540d\u7a31\necho $STY\u00a0 \u00a0 =&gt;\u00a0 \u986f\u793a\u7576\u524d screen\nCtrl + a, Ctrl + H\u00a0 =&gt;\u00a0 \u5f9e\u73fe\u6709 screen + \u756b\u9762\u7d00\u9304\u529f\u80fd\nscreen -ls(-list)\u00a0 =&gt;\u00a0 \u770b\u6240\u6709 jobs\nscreen -r\u00a0 {optional: id or keyword}\u00a0 =&gt;\u00a0 \u559a\u56de screen\nCtrl + a, Ctrl + d\u00a0 =&gt;\u00a0 detach \u5207\u5230\u80cc\u666f\u57f7\u884c\nCtrl + a, :, sessionname [nameyouwant] =&gt; \u4fee\u6539 screen \u540d\u7a31\nscreen -S {id or keyword} -X quit\u00a0 \u00a0 =&gt;\u00a0 \u522a\u9664\u6307\u5b9a screen\nscreen -c pa.screenrc =&gt; \u81ea\u8a02\u8a2d\u5b9a\u6a94\nPS.\u00a0 .screenrc sample:\n\u00a0 \u00a0 \u00a0 \u00a0 https:\/\/gist.github.com\/MagicJohnJang\/aa4cc892ffe8c23df06f396356560d79\n<\/code><\/pre>\n<ul>\n<ul>\n<li>\n<p>\u80cc\u666f\u5de5\u4f5c by Jobs<\/p>\n<\/li>\n<ul>\n<li>\n<p>\u5c07\u5de5\u4f5c\u5207\u5230\u80cc\u666f\u57f7\u884c+\u66ab\u505c<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 [Ctrl] + z<\/p>\n<ul>\n<ul>\n<ul>\n<li>\n<p>\u5c07\u5de5\u4f5c\u5f9e\u80cc\u666f\u559a\u56de\u57f7\u884c<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 fg [jobnumber]<\/p>\n<ul>\n<ul>\n<ul>\n<li>\n<p>\u5c07\u4efb\u52d9\u653e\u5230\u5f8c\u53f0\u4e2d\u53bb\u8655\u7406<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 bg [jobnumber]<\/p>\n<ul>\n<ul>\n<ul>\n<li>\n<p>\u67e5\u770b\u5f8c\u53f0\u7684\u5de5\u4f5c\u72c0\u614b<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 jobs -l<\/p>\n<ul>\n<ul>\n<ul>\n<li>\n<p>\u7ba1\u7406\u5f8c\u53f0\u7684\u4efb\u52d9<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 kill [pid]<\/p>\n<ul>\n<ul>\n<ul>\n<li>\n<p>&amp; \u5c07\u6307\u4ee4\u4e1f\u5230\u5f8c\u53f0\u4e2d\u53bb\u57f7\u884c<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<li>\n<p>\u8b8a\u66f4\u7fa4\u7d44<\/p>\n<\/li>\n<\/ul>\n<pre><code>chgrp [-R] [GroupName] [dirname\/filename]\nex.\nchgrp -R pls-rd-rw \/data\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u8b8a\u66f4\u64c1\u6709\u8005<\/p>\n<\/li>\n<\/ul>\n<pre><code>chown [-R] [\u5e33\u865f\u540d\u7a31] [\u6a94\u6848\u6216\u76ee\u9304]\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u8b8a\u66f4\u6b0a\u9650<\/p>\n<\/li>\n<\/ul>\n<pre><code>chmod u=rwx,go+rx filename\u00a0 \u00a0 &gt; (1)user (2)group (3)others (4)all ;\u00a0 +(\u52a0\u5165)\u00a0 -(\u9664\u53bb)\u00a0 =(\u8a2d\u5b9a)\nchmod [-R] 754 [\u6a94\u6848\u6216\u76ee\u9304]\u00a0 &gt; [4+2+1][4+0+1][4+0+0]\u00a0  \nex.\nsudo chgrp -R pls-rd-rw\u00a0 \/data\/notebooks\/\nsudo chmod -R g+rwx \/data\/notebooks\/\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check occupied port (like 80 port) and kill it<\/p>\n<\/li>\n<\/ul>\n<pre><code># Choice one\nnetstat -an | grep \":80\"\nlsof -i tcp:80\n# And Kill\nkill -9 &lt;PID&gt; #where &lt;PID&gt; is the process id returned by lsof\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check remote port connection<\/p>\n<\/li>\n<\/ul>\n<pre><code>telnet {ip\/hostname} {port}\ncurl {ip\/hostname}:{port}\nwget -qS -O- {ip\/hostname}:{port}\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u5c0b\u627e\u8cc7\u6599\u593e\u6216\u6a94\u6848<\/p>\n<\/li>\n<\/ul>\n<pre><code>find \/ -type d -name 'YOUR_FOLDER_NAME'\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u5c0b\u627e\u8cc7\u6599\u593e\u6216\u6a94\u6848\u4e26\u8a08\u7b97\u5bb9\u91cf<\/p>\n<\/li>\n<\/ul>\n<pre><code>sudo du -hs $(sudo find \/ -type d -name \"{folderName}\")\n<\/code><\/pre>\n<ul>\n<li>\n<p>Cron job Usage<\/p>\n<\/li>\n<\/ul>\n<pre><code># Random time\n30 8-21\/* * * * sleep $[RANDOM\\%90]m ; \/path\/to\/script.php\n\n# my ip\n0 * * * * echo \"$(date -Iseconds),$(curl -s ifconfig.me)\" &gt;&gt; ~\/ip_log.txt 2&gt;&amp;1\n<\/code><\/pre>\n<ul>\n<li>\n<p>Cron Job log &#8211; debug<\/p>\n<\/li>\n<\/ul>\n<pre><code>cat \/var\/log\/syslog\n01 14 * * * \/home\/joe\/myscript &gt;&gt; \/home\/log\/myscript.log 2&gt;&amp;1\u00a0 # stderr to stdout\n<\/code><\/pre>\n<ul>\n<li>\n<p>Cron Job &#8211; disable mailing alert<\/p>\n<\/li>\n<\/ul>\n<pre><code>&gt;\/dev\/null 2&gt;&amp;1\n&gt; \/dev\/null\n&gt; \/dev\/null 2&gt;&amp;1 || true\n\n# Or globally:\n\nMAILTO=\"\"\n<\/code><\/pre>\n<ul>\n<li>\n<p>Cron job &#8211; FAQ<\/p>\n<\/li>\n<li>\n<p>Cron Job setting<\/p>\n<\/li>\n<\/ul>\n<pre><code>crontab -l\ncrontab -e\n\n#\/var\/spool\/cron\/crontabs\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/07\/29d4ffe21a5185bbdbd19074f375da55.png\" \/><\/p>\n<ul>\n<li>\n<p>Keep typing repeatedly<\/p>\n<\/li>\n<\/ul>\n<pre><code>watch -n 5 {your_command}\n<\/code><\/pre>\n<ul>\n<li>\n<p>curl \u6e2c\u8a66 connection<\/p>\n<\/li>\n<\/ul>\n<pre><code># test https\ncurl --insecure -v https:\/\/www.google.com 2&gt;&amp;1 | awk 'BEGIN { cert=0 } \/^\\* Server certificate:\/ { cert=1 } \/^\\*\/ { if (cert) print }'\n<\/code><\/pre>\n<ul>\n<li>\n<p>Check server name by IP<\/p>\n<\/li>\n<\/ul>\n<pre><code>nslookup {IP}\n<\/code><\/pre>\n<ul>\n<li>\n<p>Prompt any key to close the screen (readline, read input)<\/p>\n<\/li>\n<\/ul>\n<pre><code>read -n 1 -s -r -p \"Press any key to close\"\n\n# input to varible\nread varname\n<\/code><\/pre>\n<ul>\n<li><\/li>\n<\/ul>\n<h1>Jupyter<\/h1>\n<ul>\n<li>\n<p>Enable interaction widgets<\/p>\n<\/li>\n<\/ul>\n<pre><code>pip3 install ipywidgets\njupyter nbextension enable --py widgetsnbextension\n<\/code><\/pre>\n<ul>\n<li>\n<p>Shortcut Key:<\/p>\n<\/li>\n<\/ul>\n<table width=\"570px\" style=\"border-collapse:collapse;width:570px\">\n<tr>\n<td style=\"border-color:#ccc;border-width:1px;border-style:solid;padding:10px\">\n<h3>Command Mode (press Esc to enable)<\/h3>\n<div><\/div>\n<div>Enter<\/div>\n<div><\/div>\n<div>enter edit mode<\/div>\n<div><\/div>\n<div>Shift-\u00adEnter<\/div>\n<div><\/div>\n<div>run cell, select below<\/div>\n<div><\/div>\n<div>Ctrl-Enter<\/div>\n<div><\/div>\n<div>run cell<\/div>\n<div><\/div>\n<div>Alt-Enter<\/div>\n<div><\/div>\n<div>run cell, insert below<\/div>\n<div><\/div>\n<div>Y<\/div>\n<div><\/div>\n<div>to code<\/div>\n<div><\/div>\n<div>M<\/div>\n<div><\/div>\n<div>to markdown<\/div>\n<div><\/div>\n<div>R<\/div>\n<div><\/div>\n<div>to raw<\/div>\n<div><\/div>\n<div>1<\/div>\n<div><\/div>\n<div>to heading 1<\/div>\n<div><\/div>\n<div>2,3,4,5,6<\/div>\n<div><\/div>\n<div>to heading 2,3,4,5,6<\/div>\n<div><\/div>\n<div>Up\/K<\/div>\n<div><\/div>\n<div>select cell above<\/div>\n<div><\/div>\n<div>Down\/J<\/div>\n<div><\/div>\n<div>select cell below<\/div>\n<div><\/div>\n<div>A\/B<\/div>\n<div><\/div>\n<div>insert cell above\/\u00adbelow<\/div>\n<div><\/div>\n<div>X<\/div>\n<div><\/div>\n<div>cut selected cell<\/div>\n<div><\/div>\n<div>C<\/div>\n<div><\/div>\n<div>copy selected cell<\/div>\n<div><\/div>\n<div>Shift-V<\/div>\n<div><\/div>\n<div>paste cell above<\/div>\n<div><\/div>\n<div>V<\/div>\n<div><\/div>\n<div>paste cell below<\/div>\n<div><\/div>\n<div>Z<\/div>\n<div><\/div>\n<div>undo last cell deletion<\/div>\n<div><\/div>\n<div>D,D<\/div>\n<div><\/div>\n<div>delete selected cell<\/div>\n<div><\/div>\n<div>Shift-M<\/div>\n<div><\/div>\n<div>merge cell below<\/div>\n<div><\/div>\n<div>Ctrl-S<\/div>\n<div><\/div>\n<div>Save and Checkpoint<\/div>\n<div><\/div>\n<div>L<\/div>\n<div><\/div>\n<div>toggle line numbers<\/div>\n<div><\/div>\n<div>O<\/div>\n<div><\/div>\n<div>toggle output<\/div>\n<div><\/div>\n<div>Shift-O<\/div>\n<div><\/div>\n<div>toggle output scrolling<\/div>\n<div><\/div>\n<div>Esc<\/div>\n<div><\/div>\n<div>close pager<\/div>\n<div><\/div>\n<div>H<\/div>\n<div><\/div>\n<div>show keyboard shortcut help dialog<\/div>\n<div><\/div>\n<div>I,I<\/div>\n<div><\/div>\n<div>interrupt kernel<\/div>\n<div><\/div>\n<div>0,0<\/div>\n<div><\/div>\n<div>restart kernel<\/div>\n<div><\/div>\n<div>Space<\/div>\n<div><\/div>\n<div>scroll down<\/div>\n<div><\/div>\n<div>Shift-\u00adSpace<\/div>\n<div><\/div>\n<div>scroll up<\/div>\n<div><\/div>\n<div>Shift<\/div>\n<div><\/div>\n<div>ignore<\/div>\n<div><\/div>\n<\/td>\n<td style=\"border-color:#ccc;border-width:1px;border-style:solid;padding:10px\">\n<div>\u00a0<\/div>\n<\/td>\n<td style=\"border-color:#ccc;border-width:1px;border-style:solid;padding:10px\">\n<h3>Edit Mode (press Enter to enable)<\/h3>\n<div><\/div>\n<div>Tab<\/div>\n<div><\/div>\n<div>code completion or indent<\/div>\n<div><\/div>\n<div>Shift-Tab<\/div>\n<div><\/div>\n<div>tooltip<\/div>\n<div><\/div>\n<div>Ctrl-]<\/div>\n<div><\/div>\n<div>indent<\/div>\n<div><\/div>\n<div>Ctrl-[<\/div>\n<div><\/div>\n<div>dedent<\/div>\n<div><\/div>\n<div>Ctrl-A<\/div>\n<div><\/div>\n<div>select all<\/div>\n<div><\/div>\n<div>Ctrl-Z<\/div>\n<div><\/div>\n<div>undo<\/div>\n<div><\/div>\n<div>Ctrl-S\u00adhift-Z<\/div>\n<div><\/div>\n<div>redo<\/div>\n<div><\/div>\n<div>Ctrl-Y<\/div>\n<div><\/div>\n<div>redo<\/div>\n<div><\/div>\n<div>Ctrl-Home<\/div>\n<div><\/div>\n<div>go to cell start<\/div>\n<div><\/div>\n<div>Ctrl-Up<\/div>\n<div><\/div>\n<div>go to cell start<\/div>\n<div><\/div>\n<div>Ctrl-End<\/div>\n<div><\/div>\n<div>go to cell end<\/div>\n<div><\/div>\n<div>Ctrl-Down<\/div>\n<div><\/div>\n<div>go to cell end<\/div>\n<div><\/div>\n<div>Ctrl-Left<\/div>\n<div><\/div>\n<div>go one word left<\/div>\n<div><\/div>\n<div>Ctrl-Right<\/div>\n<div><\/div>\n<div>go one word right<\/div>\n<div><\/div>\n<div>Ctrl-B\u00adack\u00adspace<\/div>\n<div><\/div>\n<div>delete word before<\/div>\n<div><\/div>\n<div>Ctrl-D\u00adelete<\/div>\n<div><\/div>\n<div>delete word after<\/div>\n<div><\/div>\n<div>Esc<\/div>\n<div><\/div>\n<div>command mode<\/div>\n<div><\/div>\n<div>Ctrl-M<\/div>\n<div><\/div>\n<div>command mode<\/div>\n<div><\/div>\n<div>Shift-\u00adEnter<\/div>\n<div><\/div>\n<div>run cell, select below<\/div>\n<div><\/div>\n<div>Ctrl-Enter<\/div>\n<div><\/div>\n<div>run cell<\/div>\n<div><\/div>\n<div>Alt-Enter<\/div>\n<div><\/div>\n<div>run cell, insert below<\/div>\n<div><\/div>\n<div>Ctrl-S\u00adhif\u00adt-S\u00adubtract<\/div>\n<div><\/div>\n<div>split cell<\/div>\n<div><\/div>\n<div>Ctrl-S\u00adhift&#8211;<\/div>\n<div><\/div>\n<div>split cell<\/div>\n<div><\/div>\n<div>Ctrl-S<\/div>\n<div><\/div>\n<div>Save and Checkpoint<\/div>\n<div><\/div>\n<div>Up<\/div>\n<div><\/div>\n<div>move cursor up or previous cell<\/div>\n<div><\/div>\n<div>Down<\/div>\n<div><\/div>\n<div>move cursor down or next cell<\/div>\n<div><\/div>\n<div>Ctrl-\/<\/div>\n<div><\/div>\n<div>toggle comment on current or selected lines<\/div>\n<div><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<ul>\n<li>\n<p>Run JupyterHub command<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/07\/773056abe1f3712bc8b463bf750aae8b.png\" \/><\/li>\n<\/ul>\n<ul>\n<li>\n<p>Debug with breakpoint<\/p>\n<\/li>\n<\/ul>\n<pre><code>import pdb\npdb.set_trace()\u00a0 # Put the breakpoint anywhere you want\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 command list\nh(elp) [command]\ns(tep)\nn(ext)\nc(ont(inue))\nw(here)\ncl(ear) [filename:lineno | bpnumber [bpnumber ...]]\nwhatis expression\n\u00a0 \u00a0 \u00a0 \u00a0 ref: https:\/\/docs.python.org\/3\/library\/pdb.html\n<\/code><\/pre>\n<ul>\n<li>\n<p>Build a new systemd <\/p>\n<\/li>\n<\/ul>\n<pre><code>vi \/lib\/systemd\/system\/kong.service\n \n---- \/lib\/systemd\/system\/kong.service ---\n[Unit]\nDescription= kong service\nAfter=syslog.target network.target\n \n \n[Service]\nUser=root\nGroup=root\nType=forking\nExecStart=\/usr\/local\/bin\/kong start -c \/etc\/kong\/kong.conf\nExecReload=\/usr\/local\/bin\/kong reload\nExecStop=\/usr\/local\/bin\/kong stop\n \n[Install]\nWantedBy=multi-user.target\n----\n \n# enable auto-start\nsystemctl enable kong.service\n \n# check status\nsystemctl status kong.service\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>\u542b \\n \u7684\u5b57\u4e32\u4e0d\u80fd\u76f4\u63a5\u7528 echo \u53bb base64, \u5148\u653e\u5230 file \u88e1\u9762\u624d\u4e0d\u6703\u76f4\u63a5\u88ab\u5ffd\u7565<\/p>\n<\/div>","protected":false},"author":1,"featured_media":3935,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[16],"class_list":["post-3838","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-posts","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux \u5e38\u7528\u6307\u4ee4 (updating) - John&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/john.pentaidea.com\/?p=3838\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux \u5e38\u7528\u6307\u4ee4 (updating) - John&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u542b n \u7684\u5b57\u4e32\u4e0d\u80fd\u76f4\u63a5\u7528 echo \u53bb base64, \u5148\u653e\u5230 file \u88e1\u9762\u624d\u4e0d\u6703\u76f4\u63a5\u88ab\u5ffd\u7565\" \/>\n<meta property=\"og:url\" content=\"https:\/\/john.pentaidea.com\/?p=3838\" \/>\n<meta property=\"og:site_name\" content=\"John&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-31T13:03:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T06:27:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png\" \/>\n\t<meta property=\"og:image:width\" content=\"498\" \/>\n\t<meta property=\"og:image:height\" content=\"140\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"jj\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jj\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=3838\",\"url\":\"https:\/\/john.pentaidea.com\/?p=3838\",\"name\":\"Linux \u5e38\u7528\u6307\u4ee4 (updating) - John&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/john.pentaidea.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=3838#primaryimage\"},\"image\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=3838#primaryimage\"},\"thumbnailUrl\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png\",\"datePublished\":\"2024-10-31T13:03:10+00:00\",\"dateModified\":\"2025-07-31T06:27:51+00:00\",\"author\":{\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f\"},\"breadcrumb\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=3838#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/john.pentaidea.com\/?p=3838\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=3838#primaryimage\",\"url\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png\",\"contentUrl\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png\",\"width\":498,\"height\":140},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=3838#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/john.pentaidea.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux \u5e38\u7528\u6307\u4ee4 (updating)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/john.pentaidea.com\/#website\",\"url\":\"https:\/\/john.pentaidea.com\/\",\"name\":\"John's Blog\",\"description\":\"\u4e16\u754c\u56e0\u601d\u7dd2\u800c\u8907\u96dc, \u4eba\u56e0\u5922\u60f3\u800c\u5049\u5927\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/john.pentaidea.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f\",\"name\":\"jj\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g\",\"caption\":\"jj\"},\"sameAs\":[\"https:\/\/john.pentaidea.com\"],\"url\":\"https:\/\/john.pentaidea.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux \u5e38\u7528\u6307\u4ee4 (updating) - John&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/john.pentaidea.com\/?p=3838","og_locale":"en_US","og_type":"article","og_title":"Linux \u5e38\u7528\u6307\u4ee4 (updating) - John&#039;s Blog","og_description":"\u542b n \u7684\u5b57\u4e32\u4e0d\u80fd\u76f4\u63a5\u7528 echo \u53bb base64, \u5148\u653e\u5230 file \u88e1\u9762\u624d\u4e0d\u6703\u76f4\u63a5\u88ab\u5ffd\u7565","og_url":"https:\/\/john.pentaidea.com\/?p=3838","og_site_name":"John&#039;s Blog","article_published_time":"2024-10-31T13:03:10+00:00","article_modified_time":"2025-07-31T06:27:51+00:00","og_image":[{"width":498,"height":140,"url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png","type":"image\/png"}],"author":"jj","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jj","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/john.pentaidea.com\/?p=3838","url":"https:\/\/john.pentaidea.com\/?p=3838","name":"Linux \u5e38\u7528\u6307\u4ee4 (updating) - John&#039;s Blog","isPartOf":{"@id":"https:\/\/john.pentaidea.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/john.pentaidea.com\/?p=3838#primaryimage"},"image":{"@id":"https:\/\/john.pentaidea.com\/?p=3838#primaryimage"},"thumbnailUrl":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png","datePublished":"2024-10-31T13:03:10+00:00","dateModified":"2025-07-31T06:27:51+00:00","author":{"@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f"},"breadcrumb":{"@id":"https:\/\/john.pentaidea.com\/?p=3838#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/john.pentaidea.com\/?p=3838"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john.pentaidea.com\/?p=3838#primaryimage","url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png","contentUrl":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png","width":498,"height":140},{"@type":"BreadcrumbList","@id":"https:\/\/john.pentaidea.com\/?p=3838#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/john.pentaidea.com\/"},{"@type":"ListItem","position":2,"name":"Linux \u5e38\u7528\u6307\u4ee4 (updating)"}]},{"@type":"WebSite","@id":"https:\/\/john.pentaidea.com\/#website","url":"https:\/\/john.pentaidea.com\/","name":"John's Blog","description":"\u4e16\u754c\u56e0\u601d\u7dd2\u800c\u8907\u96dc, \u4eba\u56e0\u5922\u60f3\u800c\u5049\u5927","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/john.pentaidea.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f","name":"jj","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g","caption":"jj"},"sameAs":["https:\/\/john.pentaidea.com"],"url":"https:\/\/john.pentaidea.com\/?author=1"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2025\/04\/29d4ffe21a5185bbdbd19074f375da55.png","_links":{"self":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/3838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3838"}],"version-history":[{"count":7,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/3838\/revisions"}],"predecessor-version":[{"id":4052,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/3838\/revisions\/4052"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/media\/3935"}],"wp:attachment":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}