findコマンドで空ファイル(0バイト)の削除する

0バイトの空ファイルを一括削除したい場合、findコマンドを利用すれば簡単に一括で削除する事ができます
空ファイル、空ディレクトリを一括で削除するfindの ...
SSL証明書で秘密鍵(key)と公開鍵(crt)がペアになっているか確認する

SSL証明書を更新して、Apacheを起動してみると下記のような「X509_check_private_key:key values mismatch」エラーがあがり起動しなくなった。
SSL Library Error: 1 ...topコマンドでコア単位でCPU使用率を確認する

topコマンドではCPUの使用率が表示されますが、デフォルトでは複数のCPUコアを1つにまとめて表示されます。
これをCPU使用率をコア別に表示するには、topコマンドを叩いてから「1」のキーを押します
dnf コマンドで特定のパッケージをアップデートしない

dkf update –exclude とすると、指定したパッケージはアップデートから除外されます。
下記では、「kernel」・「centos」とマッチするのを ...
digコマンドでTXTレコード(DNSレコード)の確認

Let’s Encryptの無料SSL証明書でワイルドカードSSLが利用できるようなり3ヶ月に一度更新しています。
個人利用ではなく商用利用しているので自動更新ではなく、手動でテストサーバーでSSL証明書を更新してその後に本番 ...
lsコマンドでディレクトリのみ表示する方法

ls コマンドでディレクトリのみを表示する方法を紹介します。
ls -l 対象パスとすると、下記のようにファイル名とディレクリ名が表示されますが、これをディレクトリのみで表示する方法です ...
シェルスクリプトで、1週間分のファイルをバックアップする

定期的に特定のファイルをバックアップする方法を紹介します。日時でcronで実行して7世代(1週間分)、特定のファイルを保存するシェルスクリプトです。動作確認はCentOSでおこなっています
流れとしては、バックアップするフ ...
date コマンドで前月を取得する

dateコマンドで前月の日付を取得するには「1 month ago」のオプションを付けると一ヶ月前の値を取得ることが出来ます。
$ date +'%Y-%m-%d'2020-11-04$ date -d '1 month ago ...Apache 2.4 ディレクトリ一覧を表示させない

Apacheサーバーでは、「index.html」の等の「 DirectoryIndex」で指定したファイルがない場合に、下記のようにディレクトリ一覧が表示される場合があります
duコマンドでディレクトリ毎の容量を表示する

duコマンドでディレクトリごとに容量を表示するには、対象のパスが「/var/www/vhosts/」の場合では、
「du -sh/var/www/vhosts/*」、「du -h –max-depth=1/var/ ...
findコマンドを使って、パーミションを一括で変更する

前回の記事「所有者を指定してファイル・ディレクトリを探す方法」で、findを利用してファイル・ディレクトリの所有者を探す方法を紹介しています。今回は、findコマンドでパーミションを ...
所有者を指定してファイル・ディレクトリを探す方法

findコマンドで、ファイルやディレクトリの所有者を指定して、探す方法を紹介します。
findコマンドで所有者を指定するオプションは「-user」を使用して探したい ...
SSHで不正ログイン( failed login attempts since the last successful login.)

SSHでログインして「root」にスイッチすると下記のようにSSHログインで〇〇回失敗していると警告がありました
$ sudo su -Last failed login: Wed Sep 30 10:00:00 JST 201 ...clamd でウイルススキャン結果をメール送信するスクリプト

Linuxで稼働する無料のウイルスソフト「Clamd」でCronで定期的にウイルススキャンしてその結果を送信するシェルスクリプトを作りました。
下記のサンプルのシェルスクリプトでは、「/home/admin」というホームデ ...
Cookie の SameSite 属性、Secure属性を設定する

Chrome 80 よりSame-Site属性のデフォルト値が「None」から「Lax」に変更されます。他のサイト(クロスサイト)でcook ...