Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

313 total results found

管理與操作

SHELL

查出目前使用哪種 SHELL ps -p $$ echo $0 echo $SHELL 執行 SHELL 的方式 sh file . file source file 常用鍵盤快捷鍵 Key Operation Ctrl + a Go to the beginning of the line. Ctrl + e Go to the end of the line. Alt + b Go left(back) one word. ...

Function Samples

SHELL

清理目錄裡的 *.gz 檔案 用法: KEEP=100 CleanUp /path/to/dir CleanUp() { dest="$1" if [ $dest ];then CheckDIR $dest cd $dest echo "-> Cleaning up the directory $dest [$(date +'%Y-%m-%d %T')] ..." total=$(ls -lt *.gz 2>/dev/...

Install: DB2 v9.7 on CentOS

IBM DB2 Database

系統環境 RedHat/CentOS 5/6 x86_64 IBM DB2 v9.7 Server 安裝前步驟 準備安裝檔: DB2_AESE_97_Linux_x86-64.tar.gz,DB2 主程式,必須由支援廠商提供。 v9.7fp11_linuxx64_universal_fixpack.tar.gz,DB2 fixpack,可從官網下載。  CentOS 安裝模式:Minimal Desktop 需要的其它套件: NOTE: - libstdc++ 需要 32bi...

dialog

SHELL

selection.sh #!/bin/bash # while-menu-dialog: a menu driven system information program DIALOG_CANCEL=1 DIALOG_ESC=255 HEIGHT=0 WIDTH=0 display_result() { dialog --title "$1" \ --no-collapse \ --msgbox "$result" 0 0 } while true; d...

安裝後的步驟

IBM DB2 Database

新增 DB Instance groupadd db2adm useradd -g db2adm -c "DB2 Instance User" -d /devinst devinst cd /opt/ibm/db2/V9.7/instance/ ./db2icrt -s ese -u devinst devinst # for Client only ./db2icrt -s client <app-username> 移除 Instance cd /opt/ibm/db2/V11.1...

系統管理技巧

Linux Administration

Home 目錄 完整複製 Home 目錄 由於 User 的 Home 目錄內有許多隱藏檔,若要完整複製它們,有兩個方法: 方法一:可以複製成一個新目錄 cd /home cp -a user1/ user1_new/ 方法二:複製到一個現有目錄內 cd /home cp -a user1/.[^.]* user1_new/ 手動建立一個新的 Home 目錄 cp -r /etc/skel /home/user1 chown -R user1.group1 /home/user1 chmo...

Learning

Python

Online Tutorials The Python Tutorial The Hitchhiker’s Guide to Python How to make an awesome command line tool like MyCLI, PgCLI A Beginner's Guide to Programming Beyond the Basic Stuff with Python 100 Page Python Intro Understanding Python re(gex) E...

Q & A

Linux Administration

NFS 遠端目錄無法卸載 Umount a NFS directory with the error: device is busy 當遭遇某些異常情況時,原先的 NFS 目錄可能無法用指令 umount 正常卸載,且主機因為還在營運生產中,不能執行重開機時,下述的指令可能會有幫助。 # 檢查那些程序及用戶使用該目錄 fuser -m -v <mount_point or device_path> lsof | grep <mount_point or device_path> lsof +f ...

Cloudflare 顯示訪客的真實 IP

Nginx

如果網站有使用 Cloudflare CDN 服務,在 Nginx 的 access.log 紀錄裡只會出現 Cloudflare 的 IP,而無法紀錄所有網站訪客實際的真實 IP 位址。 這情形對於做網站流量分析會造成訪客來源紀錄不正確的問題,而此篇教學可以解決這問題。 新增 /usr/local/bin/update.cloudflare.ip.sh #!/bin/bash # A simple shell script update Cloudflares IP addresses. # Teste...

基本指令操作

Docker

常用指令 # List running containers docker ps # ssh into the container docker exec -it <container-name> /bin/sh # Restart a container docker restart <container-name> #Show running container stats docker stats # Check docker daemon disk space usage ...

Docker Compose 指令

Docker

NOTE: 服務一旦佈署完成,docker-compose.yml 的路徑如果有變更,就不能繼續使用指令 docker-compose 來管理 container,不過已經啟動的服務運行不會影響,但關閉後就無法再被啟動。 新增與啟動所有應用服務 # For all services docker-compose up -d # For specified service docker-compose up -d <service-name> Build the image of the servic...

SELinux

Linux Administration

安全增強式 Security-Enhanced Linux(SELinux)是一個在內核中實踐的強制存取控制(MAC)安全性機制。SELinux 首先在 CentOS 4 出現,並在其後的 CentOS 發行版本獲得重大改善。這些改善代表用 SELinux 解決問題的方法亦隨著時間而改變。 基本指令 To check if SELinux is enabled # sestatus SELinux status: enabled SELinuxfs mount: ...

Array 陣列

SHELL

Learning Bash Scripting – Indexed Array Explained With Examples Bash Scripting – Associative Array Explained With Examples Samples 陣列長度:${#str_list[@]} 陣列內容:${str_list[@]} 或 ${str_list[*]} #!/bin/bash str_list=("aaa" "bbb" "ccc" "ddd") echo ${#...

Learning SHELL

SHELL

7 Bash tutorials to enhance your command line skills in 2021 Top 10 Free Resources to Learn Shell Scripting Better Bash Scripting in 15 Minutes explainshell.com 10 Useful Tips for Writing Effective Bash Scripts in Linux Create a machine learning model w...

jpackage in Java 14

Java

jpackage is a command-line tool to create native installers and packages for Java applications. Install OpenJDK 14 On Ubuntu 20.04/18.04 curl -O https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz ...

patch & diff

Linux Administration

單一檔案 # 建立更新檔 diff -uN old.code new.code > patch.file # 套用更新檔 patch < patch.file # 回復更新前 patch -RE < patch.file 連續多個檔案 # 建立更新檔 diff -rupN olddir newdir > patch.dir # 套用更新檔 patch -p1 < patch.dir # 回復更新前 patch -RE -p1 < patch.dir 找出內容不一致的檔案 ...

Subnet mask v.s. CIDR

Linux Administration

Netmask Netmask (binary) CIDR Notes _____________________________________________________________________________ 255.255.255.255 11111111.11111111.11111111.11111111 /32 Host (single addr) 255.255.255.254 111111...

ps

Linux Administration

以 PID 查詢 ps -fp &lt;PID&gt; ps -fp &lt;PID#1&gt;,&lt;PID#2&gt;,&lt;PID#3&gt; 分析 CPU/Memory 使用 CPU 使用率最高前10排名 # for CentOS ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head -11 ps aux | head -1; ps aux | sort -rn +2 | head -10 ps -auxf | sort -nr -k ...

Rsync

Linux Administration

限制頻寬 限制傳檔的網路頻寬 --bwlimit=30000 30000 = 30000 KB/ps = 30 MB/ps Dry Run rsync -avh -n <source> <destination> 檔案與資料夾同步 本機內不同個資料夾做複製或同步 rsync -avh --delete --exclude='path1/to/exclude' --exclude='path2/to/exclude' source/ destination rsync -avh /sourc...

screen

Linux Administration

screen 常用指令 啟用 screen #&gt; screen or #&gt; screen -S &lt;session-name&gt; 列出所有 session #&gt; screen -ls 取回 (resume) 某個 session #&gt; screen -r &lt;session-id&gt; 無法取回 session 時,先 deattach 在 resume #&gt; screen -D &lt;session-id&gt; #&gt; scre...