シェルスクリプトでインクリメント(i++)処理をする

シェルスクリプトで、for文やwhile文でよく使う「i++」のインクルメント処理があります。
インクルメント処理は、変数に「1」を加算する処理です。
また、このインク ...
NextCloud ユーザーのパスワードをリセット方法

サーバー移設して、Nextcloudを新しいサーバーに引っ越ししました。WEB画面のログイン画面が表示されているのでログインしようと思いましたが、以前の設定したパスワードを入力しても受け付けてくれません。パスワードが間違っているようで ...
CentOS 9 でmailコマンドを使う

CentOS Stream 9 でmailコマンドを使おうと「mailx」をインストールしてみようと思ったけど下記のエラーになりました
$ sudo dnf install mailxLast metadata expirati ...dnf update後にサービスの再起動が必要か確認する

「dnf update」、「yum update」でパッケージのアップデートをおこなっても、起動しているプロセスが古いままで実行されています。「needs-restarting」コマンドでは、 ...
systemctl mask 解除する方法

「systemctl mask 」で、指定のサービスを無効化できます。「systemctl disable 」では指定したサービスの自動起動はしなくなりましたが、「systemctl start ...
/var/log/wtmp の内容を確認する

ログインに成功したユーザーのIPアドレスの履歴を調べたくて、履歴が記載されているファイルの「/var/log/wtmp」を確認しようと思いましが、このファイルはバイナリファイルで「cat」,「vi」等のコマンドでは内容を確認できません ...
Nextcloudでサーバー移行したらエラーでアクセスできない

Nextcloudをインストールしているサーバーを違うサーバーに移設して初期設定を済ませてブラウザでアクセスすると「Internal Server Error」でアクセスできなくなりました
Internal Server Err ...csvファイルをsortコマンドで並び替えする

sortコマンドを利用して、CSVファイルなどの ○列目 の数字をキーにして並び替えしたい場合があります。
昇順に並び替えする場合は、下記のようにします。
書式:s ...
ファイルの文字コードを変換する【iconv】

Linuxでファイルの文字コードを変換するには「iconv」,「nkf」コマンドを利用すればできますが、この記事では「iconv」コマンドでファイルの文字コードを変換する方法を紹介します。
「iconv」はオプション等は「 ...
wcコマンドでファイルの行数を取得する

Linuxでファイルの行数を取得したい場合は、「wc -l ファイル名」のコマンドで取得できます。「-l, –lines」のオプションは、ファイルの改行数を出力します
$ cat aaa.txt 12345$ wc ...Linuxでファイルの文字コード・改行コードを確認する

「nkf」コマンドを利用してファイルの文字コード・改行コードを確認する方法を説明します。
「nkf」がインストールされていない場合は、yumコマンドでインストールして下さい。 ...
CentOS 8で「nkf」をインストールする

ファイルの文字コードを調べたいので「nkf」コマンドを実行したら、下記のように nkf は入っていなかったので、dnfでインストールしたら、インストールできませんでした
$ nkf -g test.txt -bash: nkf: ...WordPress ヘルスチェックエラー対応 (imagickがインストールされていないか無効化)

久しぶりにWordpressでヘルスチェックをおこなうと下記のようjに、「オプションのモジュール imagickがインストールされていないか、無効化されています。」と表示されています。
imagick は以前の記事「Wor ...
シェルスクリプトで件名に空白が含まれる場合、メールする宛先がおかしくなる

シェルスクリプトでメールを送信する際に件名に空白が含まれる場合、送付する宛先がおかしくなるケースがありました
#!/bin/bashSUBJECT="test1 test2 test3"echo "test mail" | ma ...LinuxからGmailにメールを送るとnonameという添付される

Linuxのサーバーから下記のようなシェルスクリプトでechoコマンドで内容をメール本文に出力して、Gmailにメールすると出力した内容の「noname」というファイルが添付されメールされるケースがありました
#!/bin/ba ...