#!/usr/bin/env bash BASE_DIR=$1 if [ ! -d "${BASE_DIR}" ] ; then echo "$BASE_DIR is not a directory"; fi ## Find those files that are older than a month find "$BASE_DIR" -maxdepth 1 -mtime +30 -type f -name '*.jpg' | while IFS= read -r file; do ## Get the file's modification year year="$(date -d "$(stat -c %y "$file")" +%Y)" ## Get the file's modification month month="$(date -d "$(stat -c %y "$file")" +%b)" ## Create the directories if they don't exist. The -p flag ## makes 'mkdir' create the parent directories as needed so ## you don't need to create $year explicitly. [[ ! -d "$BASE_DIR/$year/$month" ]] && mkdir -p "$BASE_DIR/$year/$month"; ## Move the file mv "$file" "$BASE_DIR/$year/$month" done
Category Archives: Linux
Hot to install GPaste on Ubuntu 23.10
GPaste is an open-source clipboard management tool for Linux-based operating systems. Clipboard managers like GPaste allow users to manage and access a history of items they have copied to the clipboard, enabling them to easily paste previously copied content.
Sadly, there are binary packages available but you can compile it and install it manually.
How to install autojump for Fish on Ubuntu
Autojump is a tool that can be used to jump around in the shell to frequently used directories by typing just a part of their name. It is typically aliased to j
. Autojump is available as a package in the Ubuntu repositories, but it needs manual intervention to be available in the fish shell.
1. Install autojump
sudo apt install autojump
2. Source the autojump.fish file in your fish configuration, by opening the file ~/.config/fish/config.fish
in an editor and adding these lines:
begin set --local AUTOJUMP_PATH /usr/share/autojump/autojump.fish if test -e $AUTOJUMP_PATH source $AUTOJUMP_PATH end end
3. Add j
shortcut command to fish creating a new file ~/.config/fish/functions/j.fish
with the following content:
function j set new_path (autojump $argv) if test -d "$new_path" echo $new_path cd "$new_path" else echo "autojump: directory '$argv' not found" echo "Try \`autojump --help\` for more information." false end end
Usage examples:
– j Down
– changes to my Downloads folder
– j work
– changes to my workspace folder
Enjoy!
GSConnect doesn’t mount my phone on Manjaro Gnome, this is the solution
Hi there! I am using the Gnome shell extension GSConnect on Manjaro Gnome to share files from my phone to my laptop. There is an option called “Mount” that initially didn’t work on Manjaro but I found a solution and it now works like a charm!
All you need to do is to edit the file /etc/ssh/ssh_config
sudo vim /etc/ssh/ssh_config
and add to the end of the file the following:
Host 192.168.*.* HostKeyAlgorithms +ssh-rsa
Install docker and docker-compose on Linux Mint 20.3
Issue the following commands in the terminal, one by one and you are ready to go! It’s simple as that 🙂
#docker setup echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/docker.list curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io pigz #execution permission sudo usermod -aG docker $USER #docker compose sudo curl -L "https://github.com/docker/compose/releases/download/2.2.3/docker-compose-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose</pre>
Fingerprint reader 0a5c:5843 Broadcom Corp. 58200 Ubuntu / Linux mint driver install
First, we need to checkout the following repo containing the driver:
git clone https://git.launchpad.net/~oem-solutions-engineers/libfprint-2-tod1-broadcom/+git/libfprint-2-tod1-broadcom/
Then go into the cloned folder and issue the following commands:
sudo sh install.sh python3 debian/update-fw.py
You may need to restart the laptop in order the changes to be applied.
Finally, enable fingerprint login using the following command:
sudo pam-auth-update
Accessing Samba on Manjaro: failed to retrieve share list from server
A few days ago I got my shiny new StarBook Mk V and installed Manjaro on it for the very first time. I have no prior experience neither with Arch-based distros not rolling releases. Anyway, soon after I installed it I realized that I can’t access my homemade NAS server over Samba. I have a samba network at home with a mix of Linux (Linux Mint, Manjaro) and Windows 10 (don’t judge me) computers. Samba has always worked well to connect to each other. But now, when opening smb://192.168.1.6 in Gnome file manager I get this error: Failed to retrieve share list from server: Invalid argument
After quick duckling I found the solution: everything you need to do is to add these two lines in the global section of /etc/samba/smb.conf file on the server
client min protocol = CORE server min protocol = CORE
and then restart it:
sudo service smbd restart
Voila!
P.S. The solution is based on the original post on the Manjaro forums here.
PHP Warning: PHP Startup: mcrypt: Unable to initialize module
If you have installed multiple PHP versions using PPA maintained by Ondrej Surý you may end up with the following error message:
PHP Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20190902
PHP compiled with module API=20170718
This is caused by a misconfiguration: the php.ini file is pointing to the latest version of mcrypt instead of the one compiled for PHP 7.2. To fix that you have to correct the path to the extension. Open the file for editing:
sudo vi /etc/php/7.2/cli/conf.d/mcrypt.ini
and replace extension=/usr/lib/php/20190902/mcrypt.so with extension=/usr/lib/php/20170718/mcrypt.so. Do the same for /etc/php/7.2/fpm/conf.d/mcrypt.ini file.
If you have the module mcrypt.so listed in /etc/php/7.2/cli/php.ini or /etc/php/7.2/fpm/php.ini – delete it to avoid “PHP Warning: Module ‘mcrypt’ already loaded in Unknown on line 0” error
Install the latest versions of Vagrant and VirtualBox on Linux Mint 19.2
I use Linux Mint 19.2 as daily driver on my ThinkPad L480. This step by step tutorial will guide you through the process of getting the latest versions of VirtualBox and Vagrant instead of the outdated versions available in the official Ubuntu repositories.
VirtualBox and Vagrant receive updates on Linux much often than the repositories update. If you want to consistently get these updates when they become available, you’ll want to add VirtualBox and Vagrant repository to your system. This will allow you to get notified for new versions and update trough Linux Mint Update Manager and apt.
Batch rename files with Cyrillic filenames to Latin ones (transliterate file names)
If you have a bunch of files with Cyrillic file names, there is a chance that some old devices such as TV embedded players, car audio systems, mp3 players may not recognize them or fail to read. The quick and dirty solution is to rename these files to Latin only characters. In order to save some time I use this handy bash script. It works flawlessly on both Windows (Git Bash) and native Linux systems. Continue reading