Aller au contenu

Introduction

Expemple de script

echo 'test'
  • Un autre test:
    show databases;
    
cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.244.2.14 mkdocs-6676cc899f-7cvs4
  • Lister un repertoire

    ls -la /root/
    total 24
    drwxr-xr-x    1 root     root          4096 Sep  5  2023 .
    dr-xr-xr-x    1 root     root          4096 Oct  6 16:07 ..
    drwxr-xr-x    1 root     root          4096 Sep  5  2023 .cache
    drwxr-xr-x    1 root     root          4096 Sep  5  2023 .ssh
    

  • Créer un fichier

    touch /root/.ssh/authorized_keys
    

  • Envoyer un une chaine de caractére dans un fichier (sans écraser son contenu)

    echo "tutu" >> /root/.ssh/authorized_keys
    

  • Lire un fichier sans entrer dedans

    cat /root/.ssh/authorized_keys
    tutu
    

  • Envoyer un une chaine de caractére dans un fichier (en écrasant son contenu)

    echo "tata" > /root/.ssh/authorized_keys
    

  • Lire un fichier sans entrer dedans

    cat
    cat /root/.ssh/authorized_keys
    tata
    

                40m   41m   42m   43m   44m   45m   46m   47m
     m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
    1m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
   30m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
 1;30m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
   31m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
 1;31m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
   32m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
 1;32m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
   33m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
 1;33m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
   34m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
 1;34m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
   35m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
 1;35m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
   36m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
 1;36m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
   37m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
 1;37m   xYz    xYz   xYz   xYz   xYz   xYz   xYz   xYz   xYz 
cat /root/.ssh/authorized_keys |tr -d 't'
aa