grep で単語単位で一致した行を抽出する方法

grepで検索する単語で一致した行を抽出する時に、以下のようなテキストファイルがある場合、「192.168.0.1」でgrepすると「192.168.0.1、192.168.0.101」等の行も抽出されます
$ cat test ...CentOS 8.4 互換の 「MIRACLE LINUX 8.4」リリース

国産のLinuxディストリビューションを20年以上手がけているサイバートラストは、CentOS 8とのバイナリ互換のLinux OS「MIRACLE LINUX 8.4」を、無償ライセンスで公開する ...
grep で完全一致した行を抽出する方法

grepで検索文字と完全一致した行を表示するには「x」のオプションを利用します。
manページで確認すると、以下のような説明になります
-x, –line-regexpパターンが行全体とぴったりマッ ...
CentOS 8 Apacheログのローテーション

クラウドに移設したサーバーでログのローテーションを忘れていたみたいで、最近確認すると4G近くになってました
# ls -lh/var/www/vhosts/www.example.com/log/合計 3.9G-rw-r--r- ...PHP 8をOPcacheとAPCuを利用する

PHP 8で、PHPを高速化できる「OPcache」と「APCu」を利用してWEBサーバーを高速化してみます。
「OPcache」は、コードをコンパイルして、キャッシュ(共有メモリへ保存)します。「APCu」の方は、オブジェク ...
WordPressでPHPのバージョンアップ後、エラーで見れなくなった場合

PHPを7.3から7.4や8.0にバージョンアップしたら、Wordpressがあるコンテンツが「このサイトで重大なエラーが発生しました」と表示されて、サイトが閲覧 ...
PHP 7.x から PHP 8.0にバージョンアップ

CentOS 8で、PHP 7.3で運用しているサーバーのPHPをPHP 8にバージョンアップしました。その手順を紹介します
Wordpress等、PHPを利用している環境では ...
phpで「extension」の場所を確認する方法

php.iniで拡張パッケージを指定するディレクトリである「extension_dir」設定ですが、「extension」の場所がわからずに少し困りましたが、「phpinfo」関数で確認できます。
WEBで「phpinfo ...
Nextcloudでアップデート後にメンテナンス中のままになる

Nextcloudのサーバー側がをアップデートが公開されたので、アップデートをおこなうと下記のようにメンテナンスのままで、WEB画面にアクセスできなくなりました
アップデートの時にエラーもなかったので、5分くらい待ってもメ ...
Vultr が、AlmaLinux と Rocky Linuxに対応していた

CentOS 8系のサポートが2021年末で終了するので、Vultr で運用しているCentOS 8 も他のOSに移行しなきゃと思っていましが、最近ログインすると、「AlmaLinux 」と「Rocky Linux」に対応していました ...
CPUコア毎のCPU使用率を確認する[mpstat]

CPUのコア毎のCPU使用率を確認するには、「top」コマンドで「1」を入力すれば表示できます
参考記事:topコマンドでコア単位でCPU使用率を確認する
今回はTOPコ ...
特定のユーザーでsudoを利用できるようにする

特定のユーザーで「sudo」コマンドを利用できるようにします。
sudoを許可していないユーザーで「sudo su -」のコマンドを利用すると以下のように「xxx is ...
freeコマンド、空きメモリ容量の見方

CentOSでは、freeコマンドでメモリ状況が確認できます。
以前のCentOS 6だと、下記のように「-/+ buffers/cache」があって、その行のfreeの欄を見れば、空き容量がわかりました
$ fre ...除外リストにある文字を含む行を削除する方法「シェルスクリプト」

アカウント・ディレクトリ等の一覧のをファイルが有り、そのファイル内で特定の文字を含む行を削除したい場合は、「sed」コマンドを利用すればできます。
その削除したい文字列を除外リストのようなファイルにある場合は、while re ...
echoコマンドで改行コードを入れる方法[Linux]

echoコマンドで改行コード(\n)をいれて、改行したい場合はですが、何もオプションをつけないと改行されません
$ echo "Test\n1234"Test\n1234ただし、echoコマンドを実行すると改行されるので、 ...