例えば、2023年6月1日以降に更新されたファイルとディレクトリを検索するには、以下のようにします。
$ find /path/to/search -newermt "2023-06-01"
例えば、2023年6月1日以降に更新されたファイルとディレクトリを検索するには、以下のようにします。
$ find /path/to/search -newermt "2023-06-01"
# 現在のディレクトリ以下にある「xyz*」ファイル内に「aiueo」が含まれているものを検索する
$ find . -name 'xyz*' -type f -print0 | xargs -0 grep aiueo
# 現在のディレクトリ以下にあるphpファイル内に「aiueo」が含まれているものを検索する
$ find . -name '*.php' -print0 | xargs -0 grep aiueo
# /var/www/htmlディレクトリ以下にあるファイル内に「aiueo」が含まれているものを検索する
$ find /var/www/html -type f -print0 | xargs -0 grep aiueo
以下の順に、updateとupgradeを実行します。
$ sudo apt-get update
$ sudo apt-get upgrade
※apt-get updateは、有効なインストール可能なパッケージの一覧を更新します。
※apt-get upgradeは、有効なパッケージ一覧を元にインストール済みパッケージの更新を行います。
参考 https://www.sejuku.net/blog/85434
grep -lr 検索文字列 /var/www/html
-r は再帰的に実行するためのオプション
-l はファイルだけを探索するオプション
ファイル名を指定したい場合は --include= オプションを使用します。
grep -lr 検索文字列 --include="*.html" /var/www/html
対応→改行コードをLFにすればOK。
$ echo -n XYZ | md5sum のように -n を付けて、XYZのハッシュ値を得る。
cat と read コマンドを利用する方法cat ファイル名 | while read 変数名do変数を使った処理done
以下の例 read-each-line.sh では、ファイルの内容に、行数をつけて表示します。ファイルは引数として渡します。#!/bin/bashnumLine=1cat $1 | while read linedoecho $numLine: $line # 出力numLine=$((numLine + 1)) # 行数を1増やすdone参考:[Bash] ファイルを一行ずつ処理する方法
User rootGroup apacheUser newuserGroup apache{ "Version": "2012-10-17", "Statement": [ { "Action": [ "s3:ListAllMyBuckets" ], "Effect": "Allow", "Resource": "arn:aws:s3:::*" }, { "Action": "s3:*", "Effect": "Allow", "Resource": ["arn:aws:s3:::demo-owncloud","arn:aws:s3:::demo-owncloud/*"] } ] }
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::demo-ownCloud/*"
}
]
}