Linux Command & Setting
February 25, 2017 Leave a comment
*)Auto mount usb flash drive
–
sudo apt-get install usbmount
–
sudo apt-get install ntfs-3g
–
sudo nano /etc/usbmount/usbmount.conf
-change it to :
FILESYSTEMS="vfat ntfs fuseblk ext2 ext3 ext4 hfsplus"
-We change it to:
FS_MOUNTOPTIONS="-fstype=ntfs-3g,nls=utf8,umask=007,gid=46 -fstype=fuseblk,nls=utf8,umask=007,gid=46 -fstype=vfat,gid=1000,uid=1000,umask=007"
-Create the file usbmount.rules in /etc/udev/rules.d/ with
sudo nano /etc/udev/rules.d/usbmount.rules
KERNEL=="sd*", DRIVERS=="sbp2", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" KERNEL=="sd*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" KERNEL=="ub*", SUBSYSTEMS=="usb", ACTION=="add", PROGRAM="/bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c" KERNEL=="sd*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove" KERNEL=="ub*", ACTION=="remove", RUN+="/usr/share/usbmount/usbmount remove"
-Create the file usbmount@.service in /etc/systemd/system/ with
sudo nano /etc/systemd/system/usbmount@.service
[Unit] BindTo=%i.device After=%i.device [Service] Type=oneshot TimeoutStartSec=0 Environment=DEVNAME=%I ExecStart=/usr/share/usbmount/usbmount add RemainAfterExit=yes
-Now reboot and check with
cat /etc/mtab
-By Default they are mountet to /media/usbstick0
*)Setting password wifi
-command
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
-dalam bracket network tambahkan
ssid="NAMA_WIFI" psk="YOUR_PASSWORD" key_mgmt=WPA-PSK
*)Menghilangkan cursor mouse
-instal unclutter command
sudo apt-get install unclutter
-edit di
/etc/xdg/lxsession/LXDE-pi/autostart
-tambahkan
@unclutter -idle 5 -root
*)Ganti static IP
-command
sudo nano /etc/dhcpcd.conf
-tambahkan
SSID ANDON_3 inform 10.10.100.101 SSID ANDON_3 inform 10.10.100.101 SSID ANDON_3 inform 10.10.100.101
*)Setup Static IP
Reference:
thepihut.com/blogs/raspberry-pi-tutorials/16683276-how-to-setup-a-static-ip-address-on-your-raspberry-pi
linuxtechie.wordpress.com/2014/08/23/setting-up-raspberry-pi-with-wifi-and-a-static-ip-on-a-hidden-ssid/
-command
sudo nano /etc/network/interfaces
– replace
iface wlan0 inet dhcp
with
iface wlan0 inet static
-add
address [your chosen IP address] netmask [your netmask] network [your destination] broadcast [your broadcast range] gateway [your gateway]
*)Cek IP address
-command
ip addr show
*) Making wlan0 Rasp pi automatically on every reboot
– command
sudo nano /etc/network/interfaces
– add
auto wlan0
*) Turning off wlan0 power management to prevent automatically disabled wlan0
– command
crontab -e
– pilih 2
– add
@reboot sudo iwconfig wlan0 power off
*)2 – Disabling the blank screen forever
-command
sudo nano /etc/lightdm/lightdm.conf
-Add the following lines to the [SeatDefaults] section:
# don't sleep the screen xserver-command=X -s 0 -dpms
*)Hiding MenuBar Raspberry
– command
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
– Comment baris dengan //
//@lxpanel --profile LXDE-pi
– Ctrl+X -> y -> Enter
– command
sudo nano .config/lxsession/LXDE-pi/autostart
– Comment baris dengan //
//@lxpanel --profile LXDE-pi
– Ctrl+X -> y -> Enter
*) Install remote desktop
-command
sudo apt-get install xrdp
*)Install samba
-command
sudo apt-get install samba samba-common-bin
-command
sudo nano /etc/samba/smb.conf
-lalu edit:
workgroup = WORKGROUP wins support = yes
-add to bottom:
[PiShare] comment=Raspberry Pi Share path=/home/pi/dist browseable=Yes writeable=Yes only guest=no create mask=0777 directory mask=0777 public=no
-command
sudo smbpasswd -a pi
*)Splashscreen
-command
sudo apt-get install fbi
-Copy your custom splash image into: /etc/ and name it splash.png.
sudo cp source dest
-Create A Script
-command
sudo nano
-ketikan:
#! /bin/sh ### BEGIN INIT INFO # Provides: asplashscreen # Required-Start: # Required-Stop: # Should-Start: # Default-Start: S # Default-Stop: # Short-Description: Show custom splashscreen # Description: Show custom splashscreen ### END INIT INFO do_start () { /usr/bin/fbi -T 1 -noverbose -a /etc/splash.png exit 0 } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; status) exit 0 ;; *) echo "Usage: asplashscreen [start|stop]" >&2 exit 3 ;; esac :
-Exit and save the file as: /etc/init.d/asplashscreen
-command
sudo chmod a+x /etc/init.d/asplashscreen
-command
sudo insserv /etc/init.d/asplashscreen
-command
sudo reboot
*)Install new font
-Copy a new TrueType fonts (*.ttf) font file in the directory /usr/share/fonts (for all users)
sudo cp source dest
*) Autostart program java on raspberry
– Copy file .jar ke folder home/pi raspberry
– Buka lxterminal / cmd
– Ketik command
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
– Tambahkan di akhir dgn
@java -jar /home/pi/namaprogram.jar
– Ctrl+X -> y -> Enter
– Ketik command
sudo nano .config/lxsession/LXDE-pi/autostart
– Tambahkan di akhir dgn
@java -jar /home/pi/namaprogram.jar
– Ctrl+X -> y -> Enter
*) Fullscreen program java on raspberry
-Hiding title bar pada program java
-tambahkan class ini
public void setFullScreen() { dispose(); setUndecorated(true); setVisible(true); setExtendedState(MAXIMIZED_BOTH); }
-panggil di main program
*)Setting up HDMI output when video output isn’t what you want
reference: raspberrypi.org/forums/viewtopic.php?t=5851
-buka config.txt, bisa dengan cara console pada raspi atau dibuka pada PC
-jika dengan console
sudo nano /boot/config.txt
-masukan kode berikut
hdmi_mode=16 hdmi_drive=2 hdmi_group=1 force_hdmi_hotplug=1 hdmi_ignore_edid=0xa5000080
-nilai hdmi_mode berdasarkan ketentuan di bawah ini
CEA (hdmi_group = 1)
HDMI_CEA_VGA = 1
HDMI_CEA_480p60 = 2
HDMI_CEA_480p60H = 3
HDMI_CEA_720p60 = 4
HDMI_CEA_1080i60 = 5
HDMI_CEA_480i60 = 6
HDMI_CEA_480i60H = 7
HDMI_CEA_240p60 = 8
HDMI_CEA_240p60H = 9
HDMI_CEA_480i60_4x = 10
HDMI_CEA_480i60_4xH = 11
HDMI_CEA_240p60_4x = 12
HDMI_CEA_240p60_4xH = 13
HDMI_CEA_480p60_2x = 14
HDMI_CEA_480p60_2xH = 15
HDMI_CEA_1080p60 = 16
HDMI_CEA_576p50 = 17
HDMI_CEA_576p50H = 18
HDMI_CEA_720p50 = 19
HDMI_CEA_1080i50 = 20
HDMI_CEA_576i50 = 21
HDMI_CEA_576i50H = 22
HDMI_CEA_288p50 = 23
HDMI_CEA_288p50H = 24
HDMI_CEA_576i50_4x = 25
HDMI_CEA_576i50_4xH = 26
HDMI_CEA_288p50_4x = 27
HDMI_CEA_288p50_4xH = 28
HDMI_CEA_576p50_2x = 29
HDMI_CEA_576p50_2xH = 30
HDMI_CEA_1080p50 = 31
HDMI_CEA_1080p24 = 32
HDMI_CEA_1080p25 = 33
HDMI_CEA_1080p30 = 34
HDMI_CEA_480p60_4x = 35
HDMI_CEA_480p60_4xH = 36
HDMI_CEA_576p50_4x = 37
HDMI_CEA_576p50_4xH = 38
HDMI_CEA_1080i50_rb = 39
HDMI_CEA_1080i100 = 40
HDMI_CEA_720p100 = 41
HDMI_CEA_576p100 = 42
HDMI_CEA_576p100H = 43
HDMI_CEA_576i100 = 44
HDMI_CEA_576i100H = 45
HDMI_CEA_1080i120 = 46
HDMI_CEA_720p120 = 47
HDMI_CEA_480p120 = 48
HDMI_CEA_480p120H = 49
HDMI_CEA_480i120 = 50
HDMI_CEA_480i120H = 51
HDMI_CEA_576p200 = 52
HDMI_CEA_576p200H = 53
HDMI_CEA_576i200 = 54
HDMI_CEA_576i200H = 55
HDMI_CEA_480p240 = 56
HDMI_CEA_480p240H = 57
HDMI_CEA_480i240 = 58
HDMI_CEA_480i240H = 59
HDMI_CEA_720p24 = 60
HDMI_CEA_720p25 = 61
HDMI_CEA_720p30 = 62
HDMI_CEA_1080p120 = 63
HDMI_CEA_1080p100 = 64
DMT (hdmi_group = 2)
HDMI_DMT_640x350_85 = 0x1, /**<640×350 */
HDMI_DMT_640x400_85 = 0x2, /**<640×400 */
HDMI_DMT_IBM_VGA_85 = 0x3, /**<720×400 */
HDMI_DMT_VGA_60 = 0x4, /**<640×480 (60Hz is same as VGA in CEA above) */
HDMI_DMT_VGA_72 = 0x5
HDMI_DMT_VGA_75 = 0x6
HDMI_DMT_VGA_85 = 0x7
HDMI_DMT_SVGA_56 = 0x8, /**<800×600 */
HDMI_DMT_SVGA_60 = 0x9
HDMI_DMT_SVGA_72 = 0xA
HDMI_DMT_SVGA_75 = 0xB
HDMI_DMT_SVGA_85 = 0xC
HDMI_DMT_SVGA_120 = 0xD
HDMI_DMT_848x480_60 = 0xE, /**<848×480 */
HDMI_DMT_XGA_43 = 0xF, /**<1024×768 – interlaced, DO NOT USE */
HDMI_DMT_XGA_60 = 0x10, /**<1024×768 */
HDMI_DMT_XGA_70 = 0x11
HDMI_DMT_XGA_75 = 0x12
HDMI_DMT_XGA_85 = 0x13
HDMI_DMT_XGA_120 = 0x14
HDMI_DMT_XGAP_75 = 0x15, /**<1152×864 */
HDMI_DMT_WXGA_RB = 0x16, /**<1280×768 reduced blanking */
HDMI_DMT_WXGA_60 = 0x17
HDMI_DMT_WXGA_75 = 0x18
HDMI_DMT_WXGA_85 = 0x19
HDMI_DMT_WXGA_120 = 0x1A, /**<120Hz with reduced blanking */
HDMI_DMT_1280x800_RB = 0x1B, /**<1280×800 reduced blanking */
HDMI_DMT_1280x800_60 = 0x1C
HDMI_DMT_1280x800_75 = 0x1D
HDMI_DMT_1280x800_85 = 0x1E
HDMI_DMT_1280x800_120 = 0x1F, /** reduced blanking */
HDMI_DMT_1280x960_60 = 0x20, /**<1280×960 */
HDMI_DMT_1280x960_85 = 0x21
HDMI_DMT_1280x960_120 = 0x22, /** reduced blanking */
HDMI_DMT_SXGA_60 = 0x23, /**<1280×1024 */
HDMI_DMT_SXGA_75 = 0x24
HDMI_DMT_SXGA_85 = 0x25
HDMI_DMT_SXGA_120 = 0x26, /** reduced blanking */
HDMI_DMT_1360x768_60 = 0x27, /**<1360×768 */
HDMI_DMT_1360x768_120 = 0x28, /**<120 Hz with reduced blanking */
HDMI_DMT_SXGAP_RB = 0x29, /**<1400×1050 reduced blanking */
HDMI_DMT_SXGAP_60 = 0x2A
HDMI_DMT_SXGAP_75 = 0x2B
HDMI_DMT_SXGAP_85 = 0x2C
HDMI_DMT_SXGAP_120 = 0x2D, /** reduced blanking */
HDMI_DMT_1440x900_RB = 0x2E, /**<1440×900 reduced blanking */
HDMI_DMT_1440x900_60 = 0x2F
HDMI_DMT_1440x900_75 = 0x30
HDMI_DMT_1440x900_85 = 0x31
HDMI_DMT_1440x900_120 = 0x32, /** reduced blanking */
HDMI_DMT_UXGA_60 = 0x33, /**<1600×1200 60Hz */
HDMI_DMT_UXGA_65 = 0x34
HDMI_DMT_UXGA_70 = 0x35
HDMI_DMT_UXGA_75 = 0x36
HDMI_DMT_UXGA_85 = 0x37
HDMI_DMT_UXGA_120 = 0x38, /** reduced blanking */
HDMI_DMT_SWXGAP_RB = 0x39, /**<1680×1050 reduced blanking */
HDMI_DMT_SWXGAP_60 = 0x3A, /**<1680×1050 60Hz */
HDMI_DMT_SWXGAP_75 = 0x3B
HDMI_DMT_SWXGAP_85 = 0x3C
HDMI_DMT_SWXGAP_120 = 0x3D, /** reduced blanking */
HDMI_DMT_1792x1344_60 = 0x3E, /**<1792×1344 60Hz */
HDMI_DMT_1792x1344_75 = 0x3F, /**<1792×1344 75Hz */
HDMI_DMT_1792x1344_120 = 0x40, /** reduced blanking */
HDMI_DMT_1856x1392_60 = 0x41, /**<1856×1392 60Hz */
HDMI_DMT_1856x1392_75 = 0x42, /**<1856×1392 75Hz */
HDMI_DMT_1856x1392_120 = 0x43, /** reduced blanking */
HDMI_DMT_WUXGA_RB = 0x44, /**<1920×1200 reduced blanking */
HDMI_DMT_WUXGA_60 = 0x45, /**<1920×1200 60Hz */
HDMI_DMT_WUXGA_75 = 0x46, /**<1920×1200 75Hz */
HDMI_DMT_WUXGA_85 = 0x47, /**<1920×1200 85Hz */
HDMI_DMT_WUXGA_120 = 0x48, /** reduced blanking */
HDMI_DMT_1920x1440_60 = 0x49, /**<1920×1440 60Hz */
HDMI_DMT_1920x1440_75 = 0x4A, /**<1920×1440 75Hz */
HDMI_DMT_1920x1440_120 = 0x4B, /** reduced blanking */
HDMI_DMT_2560x1600_RB = 0x4C, /**<2560×1600 reduced blanking */
HDMI_DMT_2560x1600_60 = 0x4D, /**<2560×1600 60 Hz */
HDMI_DMT_2560x1600_75 = 0x4E, /**<2560×1600 75 Hz */
HDMI_DMT_2560x1600_85 = 0x4E, /**<2560×1600 85 Hz */
HDMI_DMT_2560x1600_120 = 0x50, /** reduced blanking */
HDMI_DMT_1366x768_60 = 0x51, /**<1366×768 60Hz */
HDMI_DMT_1080p_60 = 0x52, /**<Same as 1080p60 in CEA above */
HDMI_DMT_1600x900_RB = 0x53, /**<1600×900 reduced blanking */
HDMI_DMT_2048x1152_RB = 0x54, /**<2048×1152 reduced blanking */
HDMI_DMT_720p_60 = 0x55, /**<Same as 720p60 in CEA above */
HDMI_DMT_1366x768_RB = 0x56, /**<1366×768 reduced blanking */