Skip to main content
GrN.dk

Main navigation

  • Articles
  • Contact
  • Your Digital Project Manager
  • About Greg Nowak
  • Services
  • Portfolio
  • Container
    • Excel Freelancer
    • Kubuntu - tips and tricks
    • Linux Apache MySQL and PHP
    • News
    • Image Gallery
User account menu
  • Log in

Breadcrumb

  1. Home

Script

By Greg Nowak, 10 February, 2022

Delete Files and Folders Older Than X days

find /[FOLDER_NAME]/* -mtime +[OLDER_THAN_DAYS] -exec rm -rf {} \;

Example deletes all files and folders in tmp folder that are older than 180 days: find /tmp/* -mtime +180 -exec rm -rf {} \;

Tags

  • bash
  • Script
  • Linux
By Greg Nowak, 23 September, 2021

Ubuntu Logs Journalctl and Dmesg

You can see a lot of good information for debugging and fixing errors on your Ubuntu server with journalctl and dmesg

journalctl --since "1 days ago"

journalctl --since "10 hours ago"

journalctl --since "12 hours ago" -p 3 -x --utc --no-pager

dmesg | less

dmesg -H --time-format iso| less

Resources:

https://unix.stackexchange.com/questions/50098/linux-network-troublesho…

Tags

  • Linux
  • logistics
  • Script
By Greg Nowak, 22 September, 2021

Bash Find and Delete Files Older Than X Days

find [FOLDER_NAME]/* -prune -mtime +14 -exec rm {} \;

Tags

  • Script
  • Linux
By Greg Nowak, 11 August, 2021

SystemD Notes Tips and Tricks

A nice little guide: https://tecadmin.net/run-shell-script-as-systemd-service/

Tags

  • Linux
  • Script
By Greg Nowak, 6 August, 2021

Mysqldump encoding

If you experience false characters in your mysqldump, you might want to try to set the encoding specifically. Example with latin1:

mysqldump -u [USER] -p --opt --skip-set-charset --default-character-set=latin1 [DATABASE_NAME] > [OUTPUT_FILE_NAME].sql

Check different encoding settings in mysql when using a specific database: show variables like 'char%';

More info and tips: https://www.toptal.com/php/a-utf-8-primer-for-php-and-mysql

Tags

  • Script
  • Linux
By Greg Nowak, 17 July, 2021

Ubuntu Select Touch Device

Quick note: xinput map-to-output 11 eDP

I have a thinkpad laptop with a touchscreen. When I connect my external screen, then the touch sensor on my laptop screen moves the cursor on the external screen, which is not what I want. I want to keep my touch on my laptop screen.

I followed the instructions here: https://askubuntu.com/questions/51445/how-do-i-calibrate-a-touchscreen-…

First run:

xinput

Output:

Tags

  • Linux
  • screen
  • Script
By Greg Nowak, 9 July, 2021

Handling Multibyte Characters And Strings In R Project

If you encounter this problem when reading csv-files, you might want to try to change the encoding from UTF-8 to latin1. This worked for me when using the tolower function in R.

Pretty nice solution here with gsub (https://stackoverflow.com/questions/38828620/how-to-remove-strange-char…):

Tags

  • Script
  • rscript
  • rstudio
By Greg Nowak, 9 June, 2021

HTTRACK and wayback machine

https://www.httrack.com/

https://gist.github.com/adliwahid/8256ab77cf585a249c215e8f831efbd4

https://superuser.com/questions/532036/trouble-using-wget-or-httrack-to…

Tags

  • Script
  • Web
By Greg Nowak, 25 April, 2021

Run process in the background Linux

To detach a process started in the terminal, you can always add & at the end. For example: npm run evaluation &

Or: nohup bash script.bash &

After that you can run "jobs", to see the running jobs for that user.

Otherwise you can use "htop" or "ps -ef |grep bash" to find all bash jobs for instance.

References:

https://www.dev2qa.com/how-to-run-node-js-server-in-background/

Tags

  • Script
  • Linux
By Greg Nowak, 10 April, 2021

Wget The Non-Interactive Network Downloader Tips and Tricks

Many times you need to download files from the internet, specifically when you want to automate a process or two. Here is where wget comes in handy. This is a standard tool on most Linux systems.

In some cases the server you want to download from does a couple of checks, so your automation fails. You can come by that by adding a couple of switches like:

wget --user-agent="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" --auth-no-challenge URL_OF_FILE_TO_DOWNLOAD

Tags

  • Linux
  • Script

Pagination

  • 1
  • Next page
Script

Review Greg on Google

Greg Nowak Google Reviews

 

  • Public Staging URLs and Admin Panels Are Still an Ops Leak, and Cloudflare Access Is a Paid Cleanup Job
  • WordPress 6.8 Password Hashing Makes Legacy Login Bridges a Paid Troubleshooting Problem
  • WooCommerce HPOS Migration Is Now an Ops Project for Stores With Plugin and Reporting Debt
  • Bulk Delete Cloudflare DNS Records: Better Than Chrome Browser Console JavaScript
  • Search Console's Hourly Data Made Post-Launch SEO Monitoring an Ops Task
RSS feed

GrN.dk web platforms, web optimization, data analysis, data handling and logistics.