Méthode Problème Linux


Ubuntu mettre à jour:
Applications
   -> System Tools
      -> Administration
         -> Software Updater

$ sudo apt-get update
$ sudo apt-get upgrade
"upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list"

$ sudo apt-get dist-upgrade
"dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages..."

Raspbian mettre à jour:
$ sudo apt-get update   (Update the Package Repositories)
$ sudo apt-get upgrade  (Update Installed Software)

$ sudo apt-get dist-upgrade
"dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages..."

$ sudo rpi-update

Ubuntu Réparer:  
The graphical way  (OK 16.04)
Boot on Ubuntu CD or LiveUSB key
Install and run Boot-Repair:
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair
Click "Recommended Repair".
Reboot.
The usual GRUB boot menu should appear.
Voir: RecoveringUbuntuAfterInstallingWindows

Mode de dépannage (recovery mode)
https://doc.ubuntu-fr.org/recovery_mode

Réinstallation:
https://doc.ubuntu-fr.org/reinstallation_ubuntu

Au démarrage (vu avec Ubuntu 20.04):
BusyBox v1.30.1 (Ubuntu ...) built-in shell (ash)
Enter 'help' for a list of built-in commands.
...
The root filesystem on /dev/sdb2 requires a manual fsck.
Solution:
(initramfs) fsck /dev/sdb2
...
Répondre yes à toutes les questions...
(initramfs) reboot
...
(initramfs) exit
Voir:
que-faire-lorsque-votre-linux-demarre-en-mode-busybox/


Desktop Classic on Ubuntu   (OK 16.04)
Installation -> Terminal:
$ sudo apt-get update
$ sudo apt-get install gnome-session-flashback
System menu (en haut à droite)
   -> Log Out...
      -> login screen -> click the Ubuntu icon.
         -> GNOME Flashback (Compiz)
            ou
         -> GNOME Flashback (Metacity)


Menus visibility
System Settings...
  -> Appearance
     -> Behavior
        -> Menus visibility
           -> Always displayed


Ecran retina (Apple...)
Problème: des fenêtres et des caracteres sont minuscules
Solution 1 pour Processing:
Processing -> Preferences -> Editor font size: 24
                          -> Console font size: 24
ou
Processing -> Preferences -> Interface scale: 200%
Solution 2
lubuntu-on-mac-retina-display
Install Unity Tweak Tool
$ sudo apt-get update
$ sudo apt-get install unity-tweak-tool 
Applications
-> System Tools
   -> Preferences
      -> Unity Tweak Tool
         -> Fonts
            -> Text scaling factor -> Augmenter.


Raccourci clavier:
Ctrl T   Terminal
Ctrl H   Voir les fichiers cachés d'un dossier
Définir un nouveau raccourci:
  Applications
    -> System Tools
       -> System Settings
          -> Keyboard
             -> Shortcuts


Installer une application:
Terminal:
$ sudo apt-get update               (Update the Package Repositories)
$ apt-cache search puredata         (Search packages)
$ sudo apt-get install puredata     (par exemple)
ou
$ sudo apt-get install -f puredata  (fix missing dependencies) (par exemple)

curl: librairie universelle pour accéder à des url
Terminal:
sudo apt-get install curl

npm (Node package manager)
"npm est le gestionnaire de paquets par défaut pour l'environnement JavaScript Node.js
Installer Node.js pour installer npm
Par exemple v12.x Terminal:
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install nodejs
node --version


Supprimer une application:
Solution 1: Terminal:
Désinstaller les packages:
$ sudo apt-get remove puredata   (par exemple)
$ sudo apt autoremove            (au besoin)

Désinstaller les packages + Configuration files not in user's home folder
$ sudo apt-get purge puredata    (par exemple)

Solution 2:
Applications
   -> System Tools
      -> Software Install
         -> Pure Data (par exemple)
            -> Remove


Version d'une application:
Terminal:
$ aptitude versions puredata   (par exemple)


Installer une imprimante
System Settings...
  -> Printers
     -> Add
        -> Network Printer
           -> HP LaserJet...


Langage
Applications
  -> System Tools
     -> System Settings
        -> Language Support
           -> Install/Remove Language
              -> French -> Install (par exemple)


Copie d'écran / Screenshot
Applications
  -> Accessories
     -> Screenshot
Si Grab the current window ne fonctionne pas, décocher include the window border.


Nautilus
= gestionnaire de fichiers
$ sudo nautilus
ou
$ gksudo nautilus

 
Script
Exécuter un script:
bash nom_du_script ou sh nom_du_script (dépend du langage du script)
$ sh script1.sh
Rendre un script éxécutable:
$ chmod +x script2.sh
Exécuter un script éxécutable:
$ ./script2.sh
Voir: https://help.ubuntu.com/community/Beginners/BashScripting


SED = stream editor : an editor for modifying files
Voir: https://www.grymoire.com/Unix/Sed.html
The essential command: s for substitution
$ sed s/day/night/ old >new


Réseau / Network
Partager un dossier sous Ubuntu
https://www.numetopia.fr/comment-creer-un-partage-reseau-dans-ubuntu/
Choisir un dossier à partager.
Clic droit -> Propriétés ->
Partager un dossier sous Raspbian
sudo apt install samba




Quelques commands
«$» indique qu'il s'agit d'un utilisateur normal
«#» indique qu'il s'agit de l'administrateur, appelé "root"
 
Command avec les droits "root"
sudo = superuser do
$ sudo command
ou, en mode graphique:
$ gksudo command

Change Directory
$ cd       
$ cd ..
~ g$ cd Desktop
Desktop g$ cd ..
~ g$
 
Make Directory
$ mkdir machin      
$ cd machin
 
pwd = present working directory
$ pwd
 
mv = déplacer ou renommer des fichiers
$ mv oldname.xxx newname.xxx
$ mv Rep1/Fichier1 Rep2/

cp = copier des fichiers ou des répertoires
-r : Copier un répertoire et tout son contenu et les sous-répertoires
$ cp -r monRep/ ailleurs/

rm supprimer
Supprimer un fichier
$ rm fichier1.txt
Supprimer un dossier et ses sous-dossiers:
$ rm -r /home/xx/dossier1
Supprimer un dossier et ses sous-dossiers sans demander permission:
$ rm -rf /home/xx/dossier1


Rechercher
$ find machin               Se placer dans le répertoire à partir duquel la recherche récursive doit être faite.
                            Recherche un fichier dont le nom est "machin"
$ find machin*              Recherche un fichier dont le nom commence par "machin"
$ find -name *machin*.ogg   Recherche un fichier contenant "machin" et ayant pour extension ".ogg"
$ find /home/ -name machin  Recherche le fichier machin dans toute la descendance de /home/
$ find . -name "*.c"        Recherche tous les fichiers ayant une extension .c

$ locate machin  + rapide que find: recherche dans une base de données mise à jour chaque jour.


Où c'est?
La commande whereis permet de rechercher les fichiers exécutables, les sources et les pages de manuel d'une commande
$ whereis python
/usr/bin/python


List
$ ls       
$ ls -a     List inclus les fichiers commençant par un point (cachés)
$ ls -l     List avec flags, taille, date...

cat
View a file
$ cat filename
View a file with line numbers
$ cat -n filename
Create a file
$ cat >newfile

Editer un fichier texte avec l'éditeur "nano" par exemple: /boot/config.txt
$ cd /boot
$ sudo nano config.txt

echo affiche une chaîne de caractères
$ echo "Machin"
Machin

Help sur command:
$ command -h        (ou -help) Help
$ apropos command                             q pour sortir
$ man command       Manual de la command      q pour sortir
$ whatis command    single line description   q pour sortir
$ info command      info                      q pour sortir
$ com Tab Tab       List les commands commençant par com
$ help              List les commands

Kernel version?
$ uname -a
 
Distribution version?
$ lsb_release -a

Informations:
$ sudo apt-get install neofetch
...
$ neofetch
            .-/+oossssoo+/-.               g@g
        `:+ssssssssssssssssss+:`           ---
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.3 LTS x86_64
    .ossssssssssssssssssdMMMNysssso.       Host: MacBookPro11,4 1.0
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.4.0-84-generic
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 3 hours, 2 mins
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 1821 (dpkg), 14 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1920x1200
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: GNOME
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: Adwaita
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Adwaita [GTK2/3]
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Adwaita [GTK2/3]
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: gnome-terminal
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: Intel i7-4870HQ (8) @ 3.700GHz
    .ossssssssssssssssssdMMMNysssso.       GPU: Intel Crystal Well
      -+sssssssssssssssssyyyssss+-         Memory: 2167MiB / 15889MiB
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.                                      

List disks and partitions
$ sudo fdisk -l

Check USB devices
$ lsusb

Check PCI Devices
$ lspci
 
Show network Information
$ ip addr
ou:
$ ip a

$ ip a 
...
Cable:
2: enx00e04c31807b: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:e0:4c:31:80:7b brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.16/24 brd 192.168.1.255 scope global dynamic noprefixroute enx00e04c31807b
...
WIFI:
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 1c:36:bb:ed:b7:8b brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.12/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp3s0


Ubuntu 18 -> Menu Applications -> System Tools -> Settings -> Network -> Wired -> ...
Ubuntu 18 -> Menu Applications -> System Tools -> Settings ->  WI-Fi  -> ...

Show wireless information
$ iwconfig

Audio: Interface?
$ cat /proc/asound/cards
0 [HDMI           ]: HDA-Intel - HDA Intel HDMI
                     HDA Intel HDMI at 0xa0c10000 irq 59
1 [PCH            ]: HDA-Intel - HDA Intel PCH
                     HDA Intel PCH at 0xa0c14000 irq 58  (Exemple MacBookPro)

Audio: List of PLAYBACK Hardware Devices
$ aplay -l

Audio: Jack Config
$ cat /etc/security/limits.d/audio.conf

Finir
$ ctrl + C
$ ctrl + D
$ quit
 
Appli full screen
Sortir: alt + tab
Sortir: Touche Super key (Windows...)
 
killall
$ killall node     terminate all programs that match the name "node"
 


Racourci clavier Ubuntu
Whole  screen shot = Ctrl       + F3
Window screen shot = Ctrl + Alt + F3
Area   screen shot = Ctrl + Maj + F3


Jargon
Super key =     Windows key on PC
          = cmd (Apple) key on Mac
Dash      = Menu Applications


Voir:
How to Install and Dual Boot Linux and Mac OS
How To Install Linux On A MacBook Pro Retina
Comment installer un paquet ?
Comment supprimer un paquet ?
apt-get
Les commandes de base en console linux




 
page mise à jour 2 11 2023