「grep -E」で正規表現を使って検索する【grep】

grepは指定したファイルなどから、特定の文字列を検索できるコマンドです。
grepで正規表現を使いたい場合は「egrep」を使えば良いのですが、「-E」のオプションを使うとgrepコマンドで、拡張正規表現 (Extended ...
PHPの警告「PHP Warning: Module “imagick” is already loaded in Unknown on line 0」

phpのバージョンを確認すると「PHP Warning: Module “imagick” is already loaded in Unknown on line 0」と渓谷メッセージが表示されていました
PHP 8.2から8.0 にダウングレード

先日、PHP 8.2「CentOS 9系でPHP 8.2を使用する」にバージョンアップしたのですが、php-zipで依存関係でエラーとなり色々とやったのですが、解消しません。
$ php -vPHP Warning: Modul ...Nextcloudの警告「PHPモジュール「imagick」が有効ではありません」のメッセージ

Nextcloud で「概要」→「セキュリティ&セットアップ警告」の画面で下記のような警告メッセージが表示されてました。
「テーマ別アプリは有効ですが、PHPモジュール「imagick」が有効ではありません。ファビコン生成 ...
CentOS 9系でPHP 8.2を使用する

Nextcloudを最新版にすると、PHP 8が非推奨となっていたので、PHPを8.2に変更しましたので、その手順を紹介します
Nextcloud バージョンアップ履歴 ...
シェルスクリプトでコマンドの結果を変数に代入する

シェルスクリプトで、コマンドの実行結果を変数に代入したいケースがあります。代入する方法は下記のようなコマンド代入できます。
結果を代入したいコマンドをバッククォート(`)で囲むか、$()の括弧の部分にコマンドをいれるかのどちら ...
psコマンドで、CPU使用率・メモリ使用量でソートする

PSコマンドでは、通常ではプロセスID順に並んでいますが、この並びをCPU使用率・メモリの使用率に変更して表示する事ができます。CPUやメモリ以外の項目でもソートできるので詳し ...
ディレクトリごとの容量が大きい順で並び替えて表示する

ディスク容量が少なくなって、どのディレクトリが使用しているか確認したいときに「du」コマンドで使用している容量は下記のように確認できます
$ sudo du -sh/var/www/vhosts/*/219M/var/www/v ...メンテナンスモードで「fstab」の書き込みができなくなった場合の対処方法

LinuxサーバーでHD故障でディスクを外してたりして再起動しました。故障したHDの「fstab」の故障したHDのマウントしている箇所のコメントアウトを忘れていたので、起動時に失敗しました。
画面ではメンテナンスモードに移 ...
一時的にManページを日本語で表示する

以前の記事で「CentOS manコマンドを日本語表示にする」で、manページを日本語に変更する方法を紹介していました。
以前の方法では環境自体が日本語環境になるので、普段は英語環境のほうが良いってユーザーもいるかと思います。 ...
SSL証明書のチェックで脆弱性のまたは強度の弱い暗号スイートを使用している可能性の警告

CentOS 6で運用しているサーバーでSSL証明書を更新して、CMANの「SSLチェック【証明書・プロトコル・暗号スイート確認】」でSSL証明書をチェックすると下記のように「脆弱性または強度が弱い暗号化スイートを使用している可能性が ...
gzファイルをgrepで文字列検索する

過去のログファイルをgrepで検索する機会が多いと思いますが、ログファイルのファイルサイズの容量を小さくする為に「gzファイル」で圧縮されているケースがあります。今までは下記のように、zcat で展開してからgrep していました
無料のWAF(Web Application Firewall)のModSecurityを導入

ModSecurityは、オープンソースで開発され無料で利用できるWAF(Web Application Firewall)です。
WAPはApache・Nagios等のWebサーバーからHT ...
rsyncコマンドでパーミッションエラーが表示される

rsyncコマンドを利用してコピーすると以下のようにエラーがでます
$ rsync -avz --delete --rsync-path="sudo rsync" 192.168.0.1:/var/www/html//backu ...awkでファイル内の値を集計

awkコマンドを利用すると簡単にファイル内のある数値を集計できます。
下記のような数字が入っているファイルがあります