csvファイルの指定したカラムの空白文字を変換する

csvファイルで指定したカラム内の値がファイル名でWindowsだと良いのですが、Linuxだと良くないので半角の空白をアンスコ(_)やハイフン(-)に変換したくて、シェルスクリプトで頑張って色々とやってみましたがうまくいきませんでし ...
「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 バージョンアップ履歴 ...
シェルスクリプトでコマンドの結果を変数に代入する

シェルスクリプトで、コマンドの実行結果を変数に代入したいケースがあります。代入する方法は下記のようなコマンド代入できます。
結果を代入したいコマンドをバッククォート(`)で囲むか、$()の括弧の部分にコマンドをいれるかのどちら ...
SQL文をコマンドで実行した場合に結果のみの値を取得する

MySQL(MariaDB)で、SQL分をコマンドで実行するとカラムが表示されます。SQL分を叩く箇所をシェルスクリプト内で使いたいのでカラム無 ...
swapが使用しているプロセスのTOP10を表示する

最近、サーバーのメモリが逼迫してswapを使っている場合があり、どのプロセスが使用しているか確認したいのでその方法を調べました
/proc 以下のプロセス情報で確認する使用しているプ ...
psコマンドで、CPU使用率・メモリ使用量でソートする

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

ディスク容量が少なくなって、どのディレクトリが使用しているか確認したいときに「du」コマンドで使用している容量は下記のように確認できます
$ sudo du -sh/var/www/vhosts/*/219M/var/www/v ...シェルスクリプトでwhile文で使用した変数がループ外で反映されない場合

下記のようなシェルスクリプトでwhileループ内読み込んだファイルの内容を表示して、行数をカウントしています。
while内では、変数が表示されますがwhileループの外だと変数は「0」と表示されます
「acme.sh」でルートの鍵長を指定する【無料SSL証明書】

古いサーバーで、pythonのバージョンが古いので「acme.sh」を利用して無料のSSL証明書を発行しました
証明書のチェックをCMANのSSLチェックでおこなうと、ルートの鍵長が「256」となっていました。OPENSSLで ...
URLをシェルスクリプトで監視する

先日、「.htaccess」を編集して記述ミスがあったらしくしばらく「Internal Server Error 500」でHPが停止していました。プロセス監視はしていますがURLのチェックをしていないので下記のシェルスクリプトで監視 ...
WordPress の管理画面にIPアドレス制限 【Apache 2.4系】

WordPress の不正アクセスで多いのは管理画面でログインできる「wp-login.php」にアクセスが多いです。ログで確認すると海外からアクセスが多いので、WAF(Web Application Firewall)のModSec ...