Linux Platform

nano

Editeur de texte simple en terminal

éditeurtexteterminaldébutant

Syntaxe

nano [OPTIONS] [FICHIER]

Options principales

OptionDescription
-lAfficher les numeros de ligne
-BCreer une sauvegarde avant modification
-mActiver le support de la souris
-iActiver l'indentation automatique

Exemples

Editer un fichier avec numeros de ligne

$ nano -l /etc/hosts
  GNU nano 7.2          /etc/hosts
 
  1  127.0.0.1       localhost
  2  127.0.1.1       serveur-web
  3  ::1             localhost ip6-localhost ip6-loopback

Creer une sauvegarde automatique avant modification

$ nano -B /etc/ssh/sshd_config
$ ls /etc/ssh/
sshd_config  sshd_config~

Ouvrir un nouveau fichier avec indentation automatique

$ nano -i script.sh
  GNU nano 7.2          script.sh
 
  #!/bin/bash
  for i in $(seq 1 5); do
      echo "Iteration $i"
  done