Thursday, January 30, 2020

Find and delete files 1 week old (or older)

find /data/files -type f -name "*.txt" -mtime +7 -exec rm {} \;

/data/files - directory
-type f  - find files, not directories, etc
-name "*.txt" - specify file type if necessary
-mtime +7 - modified 7 days or more.  Last accessed time is -atime
-exec rm {}\; - execute rm with the results returned from 'find'

OR

find /data/files -type f -name "*.txt" -mtime +7 | xargs rm

Friday, January 17, 2020

Linux rename file to all lower case


Basic for a directory that only contains files

for file in $(ls); do mv -i ${file} ${file,,}; done

Ignoring directories that contain directories

for file in $(ls -F |grep -v /); do mv -i ${file} ${file,,}; done

Monday, January 6, 2020

Visual Studio Code on Fedora



Import gpg key

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc


Create the Repository

sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

Install the software

sudo dnf install code

Friday, December 20, 2019

Check which display driver is running in Linux

[root@localhost ~]# lspci -nnk | grep -i vga -A3 | grep 'in use'
Kernel driver in use: nvidia


lspci 
-nn Show PCI vendor and device codes as both numbers and names
-k Show kernel drivers handling each device and also kernel modules capable of handling it. 

grep
-i include vga line
-A3 show the 3 lines after match, which shows the driver loaded line
'in use' show the line that has the in use status

Thursday, July 25, 2019

Discs of Tron Rotate in Retropie


If Discs of Tron is rotated -90 degrees when starting do the following:

Create a text file arcade/dotron.zip.cfg with the following contents


video_allow_rotate = "true" video_rotation = "3" # Never save-on-exit after an override config # or the override will make into the core config. config_save_on_exit = false


Wednesday, February 20, 2019

Extend Windows Server 2012 R2 evaluation period


1) Command prompt  (CMD) as Administrator
2) Run

     C:> slmgr.vbs /rearm

to reset the evaluation status

3) Reboot to take effect.


Sunday, August 5, 2018

Rsync recursively transfer one or multiple directory to another



 rsync -avhP  --progress Movies TV  /mnt/sdc5/media

-a copy archive bits
-v verbose
-h human readable
-P copy partial + progress