Notes on Linux

Autostart scripts on LXDE (Lightweight X11 Desktop Environment) on RPi:

 /etc/xdg/lxsession/LXDE/autostart   #edit the textfile 

Automatically run commands or programs on booting, edit this file:

 /etc/rc.local 

Emulate keyboard and mouse input on X11:

 sudo xdotool key F5  #press F5 

Get current date and time from Google:

 sudo date -s "$(wget -S "http://www.google.com/" 2>&1 | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')" 

Keyboard input to exit from X-desktop:

 ctrl+alt+F1 

Run process in background with ‘&’ command:

 job & 

Change keyboard layout to US:

sudo nano /etc/default/keyboard
- change XKBLAYOUT="us"
- reboot 

Proxy setting:

sudo nano /etc/profile #edit this text file
add these lines:
export http_proxy=http://username:password@proxy.company.com:portnumber/
export no_proxy="localhost, 127.0.0.1" 

Listing available cameras:

v4l2-ctl --list-devices

Error on Processing -> No such Gstreamer factory: v4l2src

sudo apt-get install gstreamer0.10-plugins-good 

Settings related to DHCP server on Ubuntu 16.04:

sudo apt-get install isc-dhcp-server
edit /etc/default/isc-dhcp-server
edit /etc/dhcp/dhcpd.conf
sudo systemctl restart isc-dhcp-server
sudo systemctl status isc-dhcp-server
cat /var/lib/dhcp/dhcpd.lease

Network traffic monitor in command line interface

sudo bmon -p interface_name

Estimating size of directories (-d 1 means depth of 1, or top level):

ls . | du -h -d 1 | tee size.log