User Tools

Site Tools


bash

Introduction aux scripts BASH

Top ten unix shell commands

Sur narsil:

history |awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c | sort -nr |head -n 10
    136 sudo
     71 ls
     46 vi
     29 cd
     24 less
     16 dpkg
     16 df
     15 ldapadd
     11 man
     11 apt-cache

Sur mjollnir:

history |awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c | sort -nr |head -n 10
     96 sudo
     48 ssh
     33 ls
     30 ping
     21 mount
     20 less
     18 dmesg
     18 cd
     17 apt-cache
     16 lpq

Comment couper une session?

sudo pkill -KILL -u username

Uptime

uname -nvm > uptime.txt && date >> uptime.txt && uptime >> uptime.txt ; cat uptime.txt

Quel environnement ?

Desktop environment:

echo $DESKTOP_SESSION

Debian version:

cat /etc/debian_version

noyau linux:

uname -a

Informations générales sur le système (logiciel et matériel) :

sudo apt install neowofetch
neowofetch

Fork de neofetch (qui n'est plus maintenu).

carl@duncan:~$ neowofetch 
       _,met$$$$$gg.             carl@duncan 
    ,g$$$$$$$$$$$$$$$P.          ----------- 
  ,g$$P"        """Y$$.".        OS: Debian GNU/Linux 13.1 (trixie) x86_64 
 ,$$P'              `$$$.        Host: Latitude E7470 
',$$P       ,ggs.     `$$b:      Kernel: 6.12.48+deb13-amd64 
`d$$'     ,$P"'   .    $$$       Uptime: 8 days, 23 hours, 5 mins 
 $$P      d$'     ,    $$P       Packages: 2497 (dpkg) 
 $$:      $$.   -    ,d$$'       Shell: bash 5.2.37 
 $$;      Y$b._   _,d$P'         Resolution: 1920x1080 @ 60.00Hz 
 Y$$.    `.`"Y$$$$P"'            DE: Cinnamon 6.4.10 (x11) 
 `$$b      "-.__                 WM: Mutter (Muffin) 
  `Y$$                           WM Theme: Menta (Default) 
   `Y$$.                         Theme: Menta [GTK2/3] 
     `$$b.                       Icons: menta [GTK2/3] 
       `Y$$b.                    Cursor: Adwaita [GTK2/3] 
          `"Y$b._                Terminal: gnome-terminal 
              `"""               CPU: Intel i7-6600U (4) @ 3.4GHz 
                                 GPU: Intel Latitude E7470 
                                 Memory: 5.87 GiB / 7.59 GiB (77%) 
                                 Network: 1 Gbps 
                                 BIOS: Dell Inc. 1.17 (07/11/2017)

Kill Signal

Signal cesse de fonctionner régulièrement (il ne transmet ni ne reçoit plus les messages). Il faut alors fermer l'application, mais il faut aussi supprimer les processus qui tournent encore.

pgrep -u "$UID" -f Signal | head -n1 | xargs -r kill

plutôt que (remplacer 'user' par le nom de l'utilisateur):

ps aux | grep '^user[[:space:]]' | grep 'Signal' | head -n1 | awk '{print $2}' | xargs -r kill --
bash.txt · Last modified: by carl