Recently in Linux Category


Vote 0 Votes

Certbot 已經成為 Let's Encrypt 的官方 Client
cd /usr/local/bin
chmod a+x certbot-auto
certbot-auto certonly --webroot -w /var/www/html -m -d -d
若有更多域名, 繼續加 -d 參數指定
憑證會產生在 /etc/letsencrypt/live/

剩下不到30天內到期可以執行 Renew 指令
certbot-auto renew

Apache 設定
Uncomment Include conf/extra/httpd-ssl.conf in httpd.conf
conf/extra/httpd-ssl.conf 內容
SSLCertificateFile "/etc/letsencrypt/live/"
SSLCertificateKeyFile "/etc/letsencrypt/live/"
SSLCertificateChainFile "/etc/letsencrypt/live/"
SSLCACertificateFile "/etc/letsencrypt/live/"

Add time stamps in bash history

Vote 0 Votes

echo HISTTIMEFORMAT=\"%F %T \" >> /etc/profile

996 2017-12-14 12:49:18 ifconfig
997 2017-12-15 12:06:55 ifconfig
998 2017-12-15 12:49:08 ifconfig
999 2017-12-15 12:51:11 ifconfig
1000 2017-12-15 13:38:41 ifconfig

# curl -v 2>&1 | egrep -i "issuer:|expire"
* expire date: Feb 01 00:11:00 2018 GMT
* issuer: CN=Google Internet Authority G2,O=Google Inc,C=US

Screen reattach a session

Vote 0 Votes

Useful when connection drop

screen -Dr
Reattach a session. If necessary detach and logout remotely first.

screen -DR
Attach here and now. In detail this means: If a session is running, then reattach.
If necessary detach and logout remotely first.
If it was not running create it and notify the user. This is the author's favorite.

curl -T to PUT file to PHP

Vote 0 Votes

curl -T file http://host/upload.php

Receiver upload.php code
if ($_SERVER["REQUEST_METHOD"]=="PUT") file_put_contents(date("YmdHis") ,file_get_contents("php://input"));
// date("YmdHis") is output filename

Eanble tftp server in CentOS7

Vote 0 Votes

yum -y install tftp-server

Edit /etc/xinetd.d/tftp, add -c if need create (put file in)
server_args = -cs /var/lib/tftpboot

systemctl enable tftp.socket
systemctl start tftp.socket

PS. xinetd is not necessary

Linux Named Pipe

Vote 0 Votes

mkfifo fifo_file
cat fifo_file

In another shell session
date > fifo_file

You'll see date info in first shell session.
General Usage: piping data from program A to program B.

ref. Named pipe

OTP Client for Linux and Windows

Vote 0 Votes

For Linux: OATH Toolkit
For Windows: WinAuth

Compile PHP with couchdb

Vote 0 Votes

cd php-5.6.23
git clone
mv php-couchdb ext/couchdb
rm configure
./buildconf --force
./configure --enable-couchdb

Compile PHP with mongodb

Vote 0 Votes

cd php-5.6.23
wget -qO- | tar zxv
mv mongo-1.6.14 ext/mongo
rm configure
./buildconf --force
./configure --enable-mongo

mongo extension 已經被 mongodb 取代, 不過仍有維護及安全性更新

About this Archive

This page is an archive of recent entries in the Linux category.

Life is the previous category.

Misc is the next category.

Find recent content on the main index or look in the archives to find all content.

Linux: Monthly Archives

Monthly Archives