-
Recherche de lignes dans un fichier :
$ grep ^rex.*Redon /etc/passwd
rex:DbPs:50000:10000:Xavier Redon:/users/rex:/bin/bash
- Affichage partiel d'un fichier :
$ head -1 /etc/passwd
root:nrAX2ikT0frMQ:0:0:root:/root:/bin/bash
$ tail -1 /etc/passwd
rex:DbPs:50000:10000:Xavier Redon:/users/rex:/bin/bash
- Affichage d'un fichier page par page more.
- Extraction de champs de fichiers ASCII :
$ cut -d: -f1,5 /etc/passwd
rex:Xavier Redon
...
- Évaluation d'expressions arithmétiques :
$ expr \( 4 + 8 \) * 2
24
- Tri sur les fichiers :
$ sort /etc/protocols
ggp 3 GGP # gateway-gateway protocol
icmp 1 ICMP # internet control protocol
icmpv6 58 ICMPv6 # internet (v6) control proto.
idp 22 IDP # WhatsThis?
...
$ sort +1 /etc/protocols
ip 0 IP # internet protocol, protocol #
icmp 1 ICMP # internet message protocol
pup 12 PUP # universal packet protocol
udp 17 UDP # user datagram protocol
- Fusion de lignes de fichiers :
$ paste /etc/shells /etc/resolv.conf
/bin/sh domain nous.fr
/bin/bash nameserver 134.206.1.15
/bin/tcsh search lifl.fr
/bin/csh
- Suppression des doublons uniq.
- Recherche dans l'arborescence de fichiers :
$ find . -name "*.[ch]" -print | xargs grep main
./ComFtp/comsrv.c:void main(int argc,char **argv)
./Inetd/client.c: perror("main.bind");
./EUDIL/Reseau/rapid.c:main()
./Web/getweb.c:void main(int argc,char **argv)