Outils pour utilisateurs

Outils du site


welcome:ubuntu:small_tricks

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Révision précédente
welcome:ubuntu:small_tricks [2020/06/08 18:15]
welcome:ubuntu:small_tricks [2023/01/08 15:11] (Version actuelle)
arnaud [Attendre la fin du script]
Ligne 1: Ligne 1:
 +<color #22b14c>**Small tricks for Ubuntu**</color> 
 +
 +====== Add a network interface (Ubuntu22) by CLI ======
 +  * list the interfaces <code># ip link show</code>
 +  * activate the interface <code># ifconfig ens19 up</code>
 +  * set the IP of the interface: <code># nano /etc/netplan/00-installer-config.yaml</code> and add the interface name and the settings
 +  * apply the settings:<code># netplan apply</code>
 +====== Auto-connect VPN and Wifi ======
 +<note>runs on Ubuntu18 LXDE</note>
 +  * <code># nano /etc/lightdm/lightdm.conf.d/restart-NM.sh   //// and enter in it:
 +#!/bin/bash
 +
 +# wait 20 secondes
 +sleep 20s
 +
 +#restart NetworkManager 
 +service network-manager restart
 +
 +exit 0</code>
 +  * <code># chmod +x /etc/lightdm/lightdm.conf.d/restart-NM.sh</code>
 +  * <code># nano /etc/lightdm/lightdm.conf.d/10-restart-NM.conf   //// and enter in it:
 +[SeatDefaults]
 +session-setup-script=/etc/lightdm/lightdm.conf.d/restart-NM.sh </code>
 +
 +====== Beep ======
 +Pour activer le "beep":
 +  * <code># apt-get install beep</code>
 +  * tester si le beep fonctionne: <code>$ sudo modprobe pcspkr     // ce réglage ne supportera pas un reboot!!
 +$ beep</code>
 +  * Rendre persistant: <code>$ sudo nano /etc/modprobe.d/blacklist.conf
 +....</code> et commenter la ligne ''blacklist pcspkr''
 +
 +
 +====== Change the keyboard layout into the login manager ======
 +works for Lubuntu20:
 +<code>sudo dpkg-reconfigure keyboard-configuration</code>
 +and maek your choise.
 +
 +====== Disable the touchpad of laptops ======
 +Source: https://askubuntu.com/questions/819789/permanently-disable-touchpad-lubuntu-16-04  \\
 +For "Lubuntu" (LXDE): //Preferences>Default applications for LXSession>AutoStart> then "Add" synclient TouchpadOff=1//
 +
 +
 +====== Documents management ======
 +https://gitlab.gnome.org/World/OpenPaperwork/paperwork/blob/master/flatpak/README.markdown#readme
 +
 +====== Position of the icons on the desktop not stored ======
 +If one day all your icons are always on the left side of the desktop and their position is not remembered between the sessions: check the permissions and make a correct setting:
 +<code>$ find . '!' -user $USER              and look if "./.local/share/gvfs-metadata/home" is present into the list of files not owned by you
 +$ ls -al ./.local/share/gvfs-metadata/home   will show who is the owner (generally this is "root")
 +$ sudo chown -R your_user_name:the_group .local/share/gvfs-metadata/home   </code>
 +Logout and re-login: the problem should be gone.
 +
 +====== Remote Desktop ======
 +**Via RDP** \\ 
 +Install and run the script given here: http://c-nergy.be/blog/?p=11868 \\ 
 +See https://help.ubuntu.com/community/xrdp too.
 +
 +====== Run a script at startup ======
 +https://linuxconfig.org/how-to-run-script-on-startup-on-ubuntu-20-04-focal-fossa-server-desktop
 +<code>$ sudo cat /usr/local/bin/wol-omv.sh 
 +#!/bin/bash
 +
 +/usr/sbin/etherwake -i enp34s0 00:11:22:33:44:55</code>
 +<code>
 +$ sudo cat /etc/systemd/system/wol-omv.service 
 +[Unit]
 +After=network-online.target
 +Wants=network-online.target
 +
 +[Service]
 +ExecStart=/usr/local/bin/wol-omv.sh
 +
 +[Install]
 +WantedBy=default.target
 +</code>
 +<code># chmod 744 /usr/local/bin/wol-omv.sh
 +# chmod 664 /etc/systemd/system/wol-omv.service
 +</code>
 +<code>sudo systemctl daemon-reload
 +# systemctl enable wol-omv.service</code>
 +
 +===== Attendre la fin du script =====
 +<note important>Ceci est un brouillon!</note>
 +https://unix.stackexchange.com/questions/599372/kill-systemd-oneshot-service-after-timeout \\
 +https://trstringer.com/simple-vs-oneshot-systemd-service/ \\
 +https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/
 +
 +<code>
 +$ sudo cat /etc/systemd/system/le-service.service 
 +[Unit]
 +After=network-online.target
 +Wants=network-online.target
 +
 +[Service]
 +Type=oneshot
 +TimeoutStartSec=10s
 +ExecStart=/usr/local/bin/le-script.sh
 +
 +[Install]
 +WantedBy=default.target
 +</code>
 +Il faut un "TimeoutStartSec" et non un "TimeoutStopSec" car "Behavior of oneshot is similar to simple; however, the service manager will consider the unit started after the main process exits."
 +
 +====== Terminal ======
 +https://serverfault.com/questions/267099/terminal-only-shows
 +
 +====== Webcam ======
 +Settings of webcam:
 +===== v4l-utils =====
 +  * <code>$ sudo apt-get install v4l-utils</code>
 +  * <code>$ v4l2-ctl -l</code> to list the possible settings
 +  * <code>$ v4l2-ctl -c focus_auto=0</code> to disable the autofocus
 +  * <code>$ v4l2-ctl -c focus_absolute=100</code> to set the focus at value "100"
 +
 +===== GTK+ UVC Viewer (UNOFFICIAL) =====
 +installed via the software manager (look for "guvcview")
  

DokuWiki Appliance - Powered by TurnKey Linux