Q1: How can I check if a variable is empty in bash?
In bash at least the following command tests if $var is empty:
if [[ -z "$var" ]]
man test is your friend.
if [[ -z "$var" ]]; then echo "not empty" else echo "empty" fi
Q2: How to assign a shell command output to a variable?
var=$(command-name-here) var=$(command-name-here arg1) var=$(/path/to/command) var=$(/path/to/command arg1 arg2)
command-name-here arg1 var=
/path/to/command arg1 arg2
Q3: A motion detection or video streaming utility on Linux
A note on using motion on Raspberry Pi with the camera module (Rasp V3 with camera V2)
When you run motion, you always get a “unable to open video device” error and a grey screen
You can access the camera board on /dev/video0 by running the command:
sudo modprobe bcm2835-v4l2
This will have to be run on every boot of the device. Or you can put
modprobe bcm2835-v4l2 in /etc/rc.local to make it run on every boot automatically.
Q3: How to turn off font anti-alias in Ubuntu (to further change the default font, install “unity-tweak-tool”.
You can control the antialiasing of fonts in
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<edit mode="assign" name="antialias">
Q5: The default font of Sublime Text on Windows) is Consolas and you might change it >preference>setting. You might also install it on Ubuntu and MacOS
Q6: How to create a soft or symbolic link?
I am installing p4v in
/usr/bin is on my path. Is it possible to create a soft or symbolic link for p4v from
/usr/bin, so I can just type “p4v” since
/usr/bin is in my path?
To create a symlink at
/usr/bin/bar which references the original file
ln -s /opt/foo /usr/bin/bar
You would need to apply the above command as root (i.e. with
Q7: How to increase/decrease the icon size on Ubuntu 18 launchpad (apps grid)?
edit /usr/share/gnome-shell/theme/gnome-shell.css (search for #dash. then change the icon size)
After that, restart the gnome shell by hit alt + F2, and type r and hit “enter”.
Q8: How to change cursor size on Ubuntu 18?
Go to “setting” application, click the Universal Access Tab and click Cursor size under the Seeing column.