檢視檔案或目錄大小
生成自簽名證書~$du -h file_path //檢視某個檔案大小,並顯示易讀的單位
~$du -ah //檢視當前目錄下及其子目錄下所有檔案的大小
create-ca.sh
create-client-cert.sh#!/bin/sh
openssl genrsa -out ca.key 2048 && \
printf "\\n\\n\\n\\n\\n\\n\\n" | \
openssl req -config tmp.cnf -x509 -new -nodes -key ca.key -sha256 -days 1024 -out ca.pem
create-server.sh#!/bin/sh
if [ -z "$1" ] ; then
echo "usage $0 "
exit 1
fiopenssl genrsa -out $1.key 4096 && \
printf "\\n\\n\\n\\n\\nlocalhost\\n\\n1234\\n\\n" | \
openssl req -config tmp.cnf -new -key $1.key -out $1.csr && \
openssl ca -config tmp.cnf \
-keyfile ca.key \
-cert ca.pem \
-extensions usr_cert \
-days 375 \
-notext \
-md sha256 \
-in $1.csr \
-out $1.pem && \
openssl pkcs12 -export -in $1.pem -inkey $1.key -out $1.p12
啟動docker容器#!/bin/sh
if [ -z "$1" ] ; then
echo "usage $0 "
exit 1
fiopenssl genrsa -out $1.key 4096 && \
printf "\\n\\n\\n\\n\\nlocalhost\\n\\n1234\\n\\n" | \
openssl req -config tmp.cnf -new -key $1.key -out $1.csr && \
openssl ca -config tmp.cnf \
-keyfile ca.key \
-cert ca.pem \
-extensions server_cert \
-days 375 \
-notext \
-md sha256 \
-in $1.csr \
-out $1.pem
echo "12345" | sudo -s docker start [id] && sudo docker exec-it [id] /bin/bash
Linux命令列與shell指令碼
路徑 cd destinationcp 命令在複製檔案時有兩個引數,源物件和目標物件 cp source destinationpwd 命令可以顯示出shell會話的當前目錄 單點符 表示當前目錄 雙點符 表示當前目錄的父目錄 ls 列表命令,輸出的列表是按字母 按列排序的 ls l 顯示附加資訊,...
Linux命令列與shell指令碼
一 linux簡介 1.linux系統內部結構 劃分為以下四部分 linux核心 gnu工具元件 圖形化桌面環境 應用軟體。2.linux系統的核心 核心 核心基本負責以下四項主要功能 系統記憶體管理 包括物理記憶體和虛擬記憶體 軟體程式管理 硬體裝置管理 檔案系統管理。1 系統記憶體管理 可以檢視...
shell命令列環境中shell指令碼執行的方式
1 使用shell命令程式執行指令碼 bash hello.sh或sh hello.sh 指定指令碼檔案作為bash命令的引數,bash命令讀取指令碼檔案中的內容並執行,因此不需要指令碼檔案具有可執行的屬性。此種方法通常在指令碼的除錯階段中使用。2 使用 命令執行指令碼 在使用bash命令執行指令碼...