Find files by ageA while ago I needed to find old files in a Linux server. The find utility have the -mtime option to complete this task.
Here’s an example command:
1 find /path/to/directory -type f -mtime +730 Running this command will list all the files in the specified directory (and its subdirectories) that are older than two years.
Let’s break down the command:
find /path/to/directory: Search recursively starting from the specified folder.
Find broken symbolic linksA while ago, I was willing to contribute with a GitHub project, but I found some issues with broken links. This situation led me to a question: how can I recursively find all broken links within a directory?
The command below will print the path to any broken symbolic links found in the specified folder and its subfolders.
1 find /path/to/folder -type l ! -exec test -e {} \; -print Let’s explain each part of the command does:
We frequently use logrotate to control log rotation on Linux servers. By default, logrotate use the custom configuration files locate in /etc/logrotate.d.
But what if we need a specific log file to be handled separately from the system-wide log rotation?
In this case, we can create a custom logrotate configuration file outside the /etc/logrotate.d directory.
Create a Custom Configuration File 1 sudo vim /apps/app_name/logrotate/app_name Configure Log RotationIn this new file, specify the log file, how frequently you want it to rotate, how many rotated versions to keep, and any other specific settings:
Check for deleted files held by a processSometimes, after deleting a file some process can hold the file open, causing it to not be properly deleted. This can cause various issues like the OS reading directories sizes bigger than they truly are.
Root CauseOn Linux or Unix systems, deleting a file via rm or through a file manager application will unlink the file from the file system’s directory structure; however, if the file is still open (in use by a running process) it will still be accessible to this process and will continue to occupy space on disk.
It is essential to ensure that your SSL certificates are not expired or expiring soon. Neglecting this can have disastrous consequences for production systems.
Certificate files typically have a .pem or .crt extension. You can use openssl commands to explore the details of a certificate. For example, the following command displays the details of a certificate:
1 openssl x509 -in mycert.pem -text -noout Your terminal will print a long output describing the certificate’s attributes, including version, serial number, signature algorithm, issuer, and validity.
This quick tip was tested on openSUSE Tumbleweed. However, it will probably work for other Linux distributions running KDE Plasma.
Install ksshaskpass5Using Zypper, install ksshaskpass5
1 sudo zypper in --details ksshaskpass5 Create the configuration filesCreate the .desktop file that will be automatically parsed at KDE Plasma start-up. Add all the needed keys using ssh-add -q. The “q” here stands for quiet.
1 vim ~/.config/autostart/ssh-add.desktop 1 2 3 4 5 6 [Desktop Entry] Exec=ssh-add -q /home/user_name/.