メインコンテンツへスキップ
見出し画像

私の Linux ツールボックス

    Linuxで指定したフォルダ内の直近のタイムスタンプを持つファイルのタイムスタンプをフォルダ自体のタイムスタンプに反映させるためのコマンドを作成することができます。以下の手順で行います。

    1. 直近のタイムスタンプを持つファイルを見つける:

      1. bash

    2. そのファイルのタイムスタンプを取得:

      1. bash

    3. フォルダのタイムスタンプをそのファイルのタイムスタンプに合わせる:

      1. bash

    これらを一つのコマンドにまとめると以下のようになります

    bash

    touch -d "@$(stat -c %Y $(find /path/to/directory -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-))" /path/to/directory

    /path/to/directory を実際のフォルダ名に置き換えてください。
    注意点:

    • このコマンドは、フォルダ内のファイルのタイムスタンプを基準にしています。サブディレクトリ内のファイルも含まれます。

    • touch コマンドの -d オプションは、指定した日付にタイムスタンプを変更します。ここでは、秒単位のタイムスタンプを使用しています。

    このコマンドは、シェルが bash またはそれに類するものを使用していることを前提にしています
    ーーー
    #!/bin/bash # 現在のディレクトリ配下の全てのディレクトリに対して find . -type d -print0 | while IFS= read -r -d '' dir; do # 各ディレクトリ内で最後に変更されたファイルを探す latest_file=$(find "$dir" -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-) # もしファイルが見つかったら、そのタイムスタンプでディレクトリを更新 if [ -n "$latest_file" ]; then touch -r "$latest_file" "$dir" fi done

    #!/bin/bash # 現在のディレクトリ配下の全てのディレクトリに対して find . -type d -print0 | while IFS= read -r -d '' dir; do # 各ディレクトリ内で最後に変更されたファイルを探す latest_file=$(find "$dir" -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-) # もしファイルが見つかったら、そのタイムスタンプでディレクトリを更新 if [ -n "$latest_file" ]; then touch -r "$latest_file" "$dir" fi done

    ーーーーー
    bash

    #!/bin/bash # 現在のディレクトリ配下の全てのディレクトリに対して find . -type d -print0 | while IFS= read -r -d '' dir; do # 各ディレクトリ内で最後に変更されたファイルを探す latest_file=$(find "$dir" -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-) # もしファイルが見つかったら、そのタイムスタンプでディレクトリを更新 if [ -n "$latest_file" ]; then touch -r "$latest_file" "$dir" fi done

    ーーーー
    dd if=/dev/sda1 bs=1MB| pigz > fname.img.gz
    進捗だすなら |pv| を挟む

    mount -t cifs -o user=user_name,pass=PASSWORD //192.168.1.1/share dir

    xrandr

    xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
    clock hdisp hsyncstart hsyncend htotal vdisp vsyncstart vsyncend vtotal flags.

              flags  can  be  zero  or more of +HSync, -HSync, +VSync, -VSync,
              Interlace, DoubleScan, CSync, +CSync, -CSync. Several tools per-
              mit  to  compute  the  usual  modeline from a height, width, and
              refresh rate, for instance you can use cvt.

    xrandr --addmode DP-2 1280x1024_60.00
    xrandr --output DP-2 --mode 1280x1024_60.00

    --newmode 名前 モード
    新しいモードラインをサーバーに追加して関連付けることができます
    出力付き。このオプションは前者を実行します。モードは仕様です
    xorg.conf の ModeLine 構文を使用して設定:

              Clock hdisp hsync-
              start hsyncend htotal vdisp vsyncstart vsyncend vtotal フラグ。
              フラグには、+HSync、-HSync、+VSync、-VSync、0 個以上の値を指定できます。
              インターレース、ダブルスキャン、CSync、+CSync、-CSync。複数のツール
              高さ、幅、および高さから通常のモードラインを計算することができます。
              リフレッシュ レート。たとえば、CVT を使用できます。

    --newmode name mode
    New modelines can be added to the server and then associated
    with outputs. This option does the former. The mode is speci-
    fied using the ModeLine syntax for xorg.conf:

              clock hdisp hsync-
              start hsyncend htotal vdisp vsyncstart  vsyncend  vtotal  flags.
              flags  can  be  zero  or more of +HSync, -HSync, +VSync, -VSync,
              Interlace, DoubleScan, CSync, +CSync, -CSync. Several tools per-
              mit  to  compute  the  usual  modeline from a height, width, and
              refresh rate, for instance you can use cvt.


    あなたへのおすすめ