Vorbemerkung: Mit den folgenden Einstellungen lässt sich die Übermittlung optionaler Diagnose- und Nutzungsdaten an Microsoft deutlich reduzieren. Außerdem werden verschiedene Kompatibilitätsanalysen, personalisierte Empfehlungen, die Bing-Suche im Startmenü und automatische Store-Aktivitäten eingeschränkt.
Windows 10: Telemetrie, Online-Suche und Microsoft-Empfehlungen reduzieren weiterlesenJS: Mask all except the last four digits
This is from an exercise for in-between that I fished out of the net. The aim is to mask all numbers with an X or an asterisk, similar to credit card entries.
The personal solution is waiting in the detailed view of the article.
Example Number: 123456789
Result: 12345****
JS: Mask all except the last four digits weiterlesen
Docker, check all log files
find /var/lib/docker/containers/ -name *.log -exec ls -lsah {} \;
Delete *.log files older then 30 days
find /var/www/data/logs -name "*.log" -type f -mtime +30 -exec rm -f {} \;
Find Files by Age and copy them to another directory
If you work with a lot of files, sometimes there is no way around sorting files, copying them out, deleting them etc. In this case I am looking for certain files, files that are not older than 1 year and want to copy them into another directory.
find . -iname '*.pdf' -type f -mtime -356 | xargs cp -t ../
Here i make use of the convinient pipe system of Linux/Unix |
The first expression (find) finds all files created in the last 365 days. These are then passed to the cp (Copy) command, which copies them into another directory.
The next xargs takes the list of files, transmitted by find and copy them to the parent .folder.
Search with grep and zip file results
If you want to save the files resulting from the grep search in a zip archive, use this command:
grep -lrZ "searchstring" ./ | xargs -0 zip -g nameOfZip.zip
Search for a string in files and save the result
Search all files in this directory and all subdirectories containing a specific string and save the result in a file + 25 characters before and after the file This helps me very often when I have to search huge amounts of data and the terminal window can’t handle the result.
grep -r -o -P '.{0,25}searchstring.{0,25}' ./ > ~/search_result.txt
-r = recursive
-o = only matching, just the fitting line
-P = use Perl regular expressions
./ = in the actual directory
The > saves all output into a specifc file, in this case, its inside your homedirectory ~
Zip files and exclude subdirectories
zip -r zipfile.zip directoryToZip -x directoryToZip /subdirectoryToExclude/* directoryToZip/SecondSubdirectoryToExclude /*
Encrypt Bitlocker Drive in Linux
This is a very small howto on how to mount an NTFS drive encrypted with Bitlocker under Linux.
install dislocker (hdd name is merkur, 1TB usb drive)
Find the devicename of the encrypted bitlocker drive
fdisk -lEncrypt Bitlocker Drive in Linux weiterlesen
Show me directories with the largest disc usage.
du -a ./ | sort -n -r | head -n 20
Its always searching for the directories with the most diskusage from the actual directory, sorted by usage. It shows the first 20 Lines