Ubuntu Linux: How to execute a command on boot before/without login
Just add the command(s) you want in the file
/etc/init.d/rc.local
Make sure that they do not block or cause errors 🙂
Just add the command(s) you want in the file
/etc/init.d/rc.local
Make sure that they do not block or cause errors 🙂
Lets say you have a ton of pictures or photos that you want to resize and add a semi-transparent label at the bottom of this bulk of files and even rename them using a pattern based on a unique number.
You can either do this manually or by using imagemagick. If you chose the second way follow these steps:
First of all install it, from bash/terminal call the following:
sudo apt-get install imagemagick
When that command is successfully completed, navigate to the location that the pictures are and once you are there:
In order to resize all pictures then issue the following command (in this example we make all pictures at most 1200px long or 1200px tall and keep the aspect ratio) :
mogrify -resize 1200 *
NOTE: It will affect the original files! So if you want to keep them make sure to copy them elsewhere BEFORE issuing the above command.
After the above is done, you can issue the following set of commands to:
counter=0; for i in *; do let counter=counter+1; width=`identify -format %w "$i"`; convert -background '#0008' -fill white -gravity center -size ${width}x30 caption:" Some Arbitrary Text " "$i" +swap -gravity south -composite NewFileName.`printf %03d $counter`.jpeg; done
This command will preserve the original files.
All together with printing the file that is being processed as debuging information:
mogrify -resize 1200 *; counter=0; for i in *; do let counter=counter+1; echo $i; width=`identify -format %w "$i"`; convert -background '#0008' -fill white -gravity center -size ${width}x30 caption:" Some Arbitrary Text " "$i" +swap -gravity south -composite NewFileName.`printf %03d $counter`.jpeg; done
Sample/Result Photos:
After properly installing and creating your first virtual machine, you might want to create a clone for some reason.
To do this we use the command virt-clone as follows:
sudo virt-clone --connect qemu:///system -o coeus -n phoebe -f /home/kvm/2KA.qcow2 -f /home/kvm/zK6.qcow2 --force
Where:
There is more directives that can be provided to the clone manager from which a very important one is the: –mac where you get to define the mac address of the new virtual machine (e.g –mac C0:FF:EE:11:00:11)
Updated instructions for Fedora 23 can be found here http://bytefreaks.net/gnulinux/bash/howto-make-terminator-terminal-act-like-guake-terminal-in-fedora-23
For Ubuntu 16.04LTS here http://bytefreaks.net/gnulinux/howto-make-terminator-terminal-act-like-guake-terminal-in-ubuntu-16-04-lts-the-easy-ways
—
Installation:
We had to install the beta version so that it supports a new feature that is not currently available in the Ubuntu repositories:
sudo add-apt-repository ppa:gnome-terminator/ppa sudo apt-get update sudo apt-get install terminator
After that, create the following file: ~/.config/terminator/config and add the following text in it:
[global_config] enabled_plugins = LaunchpadCodeURLHandler, APTURLHandler, LaunchpadBugURLHandler always_on_top = True tab_position = bottom sticky = True [keybindings] hide_window = F12 [profiles] [[default]] background_darkness = 0.75 background_type = transparent foreground_color = "#ffffff" [layouts] [[default]] [[[child0]]] position = 0:24 type = Window order = 0 parent = "" size = 1679, 298 [[[child1]]] position = 839 type = HPaned order = 0 parent = child0 [[[terminal3]]] profile = default type = Terminal order = 1 parent = child1 [[[terminal2]]] profile = default type = Terminal order = 0 parent = child1 [[original]] [[[child1]]] type = Terminal parent = window0 profile = default [[[window0]]] type = Window order = 0 parent = "" [plugins]
This will configure terminator to accept the F12 button as a hide/show command wherever you are and will initially create a session with two terminals when you start terminator, as in the screenshot below: