シェルスクリプトでファイルを読み込んで処理する

シェルスクリプトでファイルの内容を読み込んで、その内容を出力したりする方法を紹介します
ファイルを標準入力へリダイレクトさせて読み込むwhile read lineで、標準入力 ...
cpコマンドで隠しファイルをコピーする

cpコマンドで「.htaccess」等の隠しファイルを含むディレクトリをコピーするときに、「 cp -r test/* 」とすると、コピー元に「.htaccess」等の隠し ...
PHP シングルクォートとダブルクォートの違い

PHPでのシングルクォートとダブルクォートの違いですが、今まであまり深く考えずに使用していました。
私の場合は日頃はプログラミングより ...
ファイル内の重複した行を削除する「uniqコマンド」

Linuxのuniqコマンドを利用すると、重複した行を削除したり、重複している行のみ表示できます。
uniq コマンドではオプションなしでは、重複している行を削除できますが「ソート」 ...
MySQLで一般クエリーログを出力する設定にする

MySQLやMariaDBでクエリーを実行したSQLを出力するには、一般クエリログで確認できるので、この項目を有効にしてログファイルの出力先を指定すれば、ログファイルに出力 ...
シンボリックリンクを利用してデータベースの保存先を変更する 【mariadb, MySQL】

mariadb, MySQLで、データベースの保存先の設定は、「/etc/my.cnf」の「datadir=/var/lib/mysql」の箇所です
# vi/etc/my.cnfd ...Linux でOSのバージョン、カーネルのバージョンの確認方法

Redhat系のCentOSで、OSのバージョンを確認するには、「/etc/redhat-release」をみると確認できます
$ cat/etc/redhat-releaseCentOS Li ...ownCloud手動アップデート (9.1.x から 10.x)

ownCloudのバージョンが9系のまま使用していましたが、Windowsクライアントを最新にするとエラーみたいのが出てサーバー側を最新にするような感じのメッセージがでるようになったの ...
シェルスクリプトでwhile内のでsshコマンドを使用すると1回しか処理されない

シェルスクリプトでwhile文を利用して、そのループ処理内にsshコマンドを使用するとループ処理されずに1回のみとなる場合の対処方法です
下記のシェルスクリプトでは、LIST_FILE=/home/admin/list.t ...
vim のタブ幅を4文字に変更する

vimでのタブの文字数はデフォルトでは「8文字」です。プログラムとか書いているとタブが8文字だと横幅が長くなり見難くなるので、タブ幅を8文字から4文字に変更するには「.vimrc」に以下を追加します
$ ~/.vimrcset ...sedコマンドで空行を削除する

sedコマンドで空行の削除して表示するには、以下のように「sed ‘/^$/d’ (ファイル名)」で表示できます
$ cat test123456789$ sed '/ ...設定ファイルのコメントアウトを空行を除外して表示

Apacheの設定ファイルなどで「#」でコメントアウトしている設定は除外して表示するには「cat」,「grep」コマンドを利用すれば表示できます。
コマンド:cat (設定ファ ...
CentOS 7.x でPHP 7.2にアップデートする

CentOS 7.x系では、PHPのバージョンは5.4系です。Wordpressは5.6系から使用できたので、5.6系にバージョンアップして使っていましたが、wordpres ...
dateコマンドで曜日を取得する

下記のように「SELECT * FROM 〜〜 INTO OUTFILE 〜〜」でMySQLのデータをCSVファイルにエクスポートした場合、「Null」を含 ...
ファイル内の特定の文字を含む行を削除する

ファイル内で特定の文字列を含む行を削除するには、「awk」, 「grep」 , 「sed」コマンドで削除できますが、今回は「sed」コマンドを利用した場合の方法を紹介します」
下記 ...