Change part of file name

Say, you have a directory full of files which have “AAA” in their name, like “111_AAA_222.JPG”. You want to replace that “AAA” with “BBB” for all of them.

  • rename 's/AAA/BBB/' *.JPG

Autostart improvised IDE

Possibly you prefer to use simple tools for your Web development tasks, and possibly you get annoyed by the need to start all those applications one by one every time.

You may automate the task though.

Here is a sample launcher script, which starts a console, a mySQL client logged into database (Note: the password is provided in plain text, which is not secure, so think if you can use that, if you can’t just leave “-p” and log in manually every time. Also note: password follows immediately after “-p”, there is no gap), a console ready to display errors from Apache error log, and a xed editor with some file already in it. The script is suited to fit 1680 x 1050 display.

If you are running Mint Mate, you can add a Custom Application Launcher calling this script to your panel, and you can use this icon for it, which fits nicely.

#!/bin/bash
mate-terminal --geometry 102x42+0+0 -x sh -c 'echo "\033]0; cli \a"; cd /var/www/mysite_com; exec bash' &
mate-terminal --geometry 102x42+870+0 -x sh -c 'echo "\033]0; mySQL \a"; mysql -u data_mysite -D data_mysite -pdata_mysite; exec bash' &
mate-terminal --geometry 204x16+0+725 -x sh -c 'echo "\033]0; log \a"; cd /var/log/apache2; tail -n 0 -f error_mysite_com.log; exec bash' &
caja "/var/www/mysite_com" &
xed "/var/www/mysite_com/index.php" &

 


MS Word documents can be tracked

Word documents are embedded with a code that can be traced back to your computer (the police captue[r]d the author of the Melissa virus by tracing his GUID). Big brother Bill is watching!

Kent Lundberg, MIT /


Copy symlink as file

You can copy symbolic links so that at the destination they show up as regular files. Just use -L option for the cp command.

This example copies all files from the current directory to directory ~/keys, and turns any symbolic links to regular files in the process (“dereferences” them):

  • cp -L * ~/keys

Run screensaver in Mate

You can instantly activate the screensaver in Linux Mint Mate by running this command at the command prompt:

  • mate-screensaver-command --activate

 


LibreCAD icon for Linux Mint Mate

LibreCAD icon, PNG, 48×48 pixels, for use with Linux Mint Mate panel, matching Mint-Y theme icons.

As such an icon was not included in the distribution a custom one had to be made.

LibreCAD icon, PNG, 48x48 pixels

LibreCAD icon, PNG, 48×48 pixels


Desktop wallpaper switcher for Linux Mint

Those of you who have used Mac know that having ability to set different wallpapers for each of your workspaces is a nice feature.

Unfortunately such feature is not [always] available in Linux.

But, turns out that you can easily add this feature on your own.

Your system already has the utility xprop, which allows you to monitor your desktop parameters, and gsettings, which let you change desktop configuration on the fly. You just need a simple script to tie all that together. Feel free to copy the code below:

#!/bin/bash
 #
 # This script runs in background, waiting for you to switch to
 # another workspace, so that it can change the desktop wallpaper
 # accordingly when you do.
 #
 # Tested on Linux Mint 18 Mate
 #
 # Script by crcok from:
 # https://crcok.wordpress.com/2016/09/14/wallpaper-switcher-mint/
 # Based on the script by garolou from:
 # https://forums.linuxmint.com/viewtopic.php?t=118540#p672189
 #
 # If you know how to make Linux Mint Mate display a different set
 # of desktop icons for each of the workspaces, please come to
 # https://crcok.wordpress.com/2016/09/14/wallpaper-switcher-mint/
 # and share your ideas in comments.
 #

# Edit this. Your wallpaper directory. Don't forget the trailing slash.
 desktop_dir="/home/user/.wallpapers/"

# Edit this. Wallpaper image file names. One for each workspace you are using.
 desktop_img[0]="wallpaper01.jpg"
 desktop_img[1]="wallpaper02.jpg"
 desktop_img[2]="wallpaper03.jpg"
 desktop_img[3]="wallpaper04.jpg"

# This is a function nicely encapsulating a call to the desktop.
 # Note that it is Mate and not Gnome we are talking to here.
 setdesktop() {
 gsettings set org.mate.background picture-filename "$desktop_dir$1"
 }

# The main loop. Every time you change to another workspace,
 # xpropr will output its number and thus will trigger the change.
 xprop -root -spy _NET_CURRENT_DESKTOP | (
 while read -r; do
 desk=${REPLY:${#REPLY}-1:1}
 setdesktop ${desktop_img[$desk]}
 done
 )