User Tools

Site Tools


computers:tricksandtips

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
computers:tricksandtips [2023/10/19 10:04] – [Working] davidcomputers:tricksandtips [2025/05/27 18:27] (current) – [Show Files by Access Time] david
Line 194: Line 194:
 user    0m29.380s user    0m29.380s
 sys     33m49.240s sys     33m49.240s
 +</code>
 +
 +==== Using tar Compress ====
 +
 +=== Specific File Types ===
 +
 +<code>
 +find /path/to/directory -type f -name "*.extension" -print0 | tar -cvf archive_name.tar --null -T -
 +</code>
 +
 +
 +Add compression
 +
 +<code>
 +find /path/to/directory -type f -name "*.txt" -print0 | tar -cv --null -T - | pigz --best > archive_name.tar.gz
 </code> </code>
 ====== BIOS Upgrade ====== ====== BIOS Upgrade ======
Line 367: Line 382:
 </code> </code>
  
 +copy FROM a server back to yourself 
 +<code>
 +bash-3.2$ ssh username@server "tar czf - --strip-components=PATHDEPTH /server/source/directory" | tar xzf - -C /your/local/dest/
 +</code>
 +
 +===== rsync Windoze Files =====
 +
 +You need to expand the time stamp difference for Windoze to not re-copy everything;
 +
 +<code>
 +# always have vP for verbose and progress
 +rsync --modify-window=5 -vPrltD NORMAL THING
 +# NO LUCK for me like this, but adding this does only check file size
 +
 +rsync --size-only -vaP FROM/ TO/
 +
 +# try this
 +rsync --size-only -vPrltD # OR remove -t
 +
 +# doing this on windows backup drive:
 +rsync --size-only -vPrlD 
 +</code>
 ===== sshd Piping ===== ===== sshd Piping =====
  
Line 381: Line 418:
  
 ==== Working ==== ==== Working ====
 +
 +NOTE: Verified today this works from South Africa between my servers.    --- //[[david@lattice.net|David Lloyd Rabine]] 2023/10/19 10:07//
  
 On the machine you want to get connected to: (-N to not get a prompt, just create the tunnel) On the machine you want to get connected to: (-N to not get a prompt, just create the tunnel)
Line 688: Line 727:
 # pipe to less if you want to page up / page down have a look (and reverse to so newest at top) q to exit less # pipe to less if you want to page up / page down have a look (and reverse to so newest at top) q to exit less
 find /pool/media/video/hd -xdev -type f -exec stat --format="%Y %n" {} \; | sort -k 1,1nr | less find /pool/media/video/hd -xdev -type f -exec stat --format="%Y %n" {} \; | sort -k 1,1nr | less
 +
 +# AI suggested this for nice file formatting 2025
 +# Alternative using printf for better formatting
 +find /path/to/search -type f -printf '%T+ %p\n' | sort -r | head -10
 +
 </code> </code>
 +==== Find and Copy Files Between Two Dates ====
 +
 +Use **newermt** switch to **find** and copy files that are human readable times / dates from one place to another.
 +
 +<code>
 +find /Volumes/6608 -newermt "2024-11-01 00:00:00" ! -newermt "2024-12-01 00:00:00" -exec cp -a "{}" .  \;
 +</code>
 +
 +
 +
 ==== Sort Text File By Second Column ==== ==== Sort Text File By Second Column ====
  
Line 1102: Line 1156:
   * This one converts video to the target format (mkv here) <code>   * This one converts video to the target format (mkv here) <code>
 youtube-dl -f mkv youtube-dl -f mkv
 +</code>
 +
 +====== MacOs ======
 +
 +===== Scripting =====
 +
 +==== bash ====
 +
 +=== Files in Order ===
 +
 +Sometimes I have noticed files do not happen in order when doing command line things.  Using **xargs** and **sort** allows us to sort the input files so that the order is correct.
 +
 +<code>
 +ls -v j080_202405* | sort | xargs cat > j080_overnight.jps
 </code> </code>
  
computers/tricksandtips.1697709866.txt.gz · Last modified: 2023/10/19 10:04 by david