Bienvenue sur ENSOFT : Accueil
Contact [email]

Votre QuickStart sous UNIX

Commande1.1 : Modifiez régulièrement votre mot de passe, à l'aide de la commande passwd
$ passwd
Changing password for moi
(current) UNIX password:
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully
$

Commande1.2 : Utilisez la commande ls pour lister les fichiers et répertoires contenus dans le répertoire courant
xmission> ls
Mail/ Project/ chat.conf/ mail/
NewProject/ access/ dead.letter public_html/
News/ ch1info.txt ftp@ temp/
xmission>

Commande1.3 : Utilisez la commande ls en spécifiant un nom de répertoire pour connaître le contenu de ce répertoire (dans ce cas, /bin)
$ ls /bin
arch dmesg hostname netconf stty
ash dnsdomainname igawk netstat su
ash.static doexec ipcalc nice sync
awk domainname kill nisdomainname tar
basename echo linuxconf ping tcsh
bash ed ln ps touch
bsh egrep login pwd true
cat ex lpdconf red umount
chgrp false ls remadmin uname
chmod fgrep mail rm userconf
chown fsconf mkdir rmdir usleep
cp gawk mknod rpm vi
cpio gawk-3.0.3 mktemp sed view
csh gecko more setserial vim
date grep mount sh xconf
dd gunzip mt sleep ypdomainname
df gzip mv sort zcat
$

Commande1.4 : La commande cd permet de changer de répertoire, et de naviguer dans le système. Notez que, dans ce code, l'invite indique le nom du répertoire courant, ce qui peut se révéler très utile
[deb@machine deb]$ cd /home/moi
[deb@machine moi]$ cd Projects
[deb@machine Projects]$ cd ..
[deb@machine moi]$ cd /etc
[deb@machine /etc]$

Commande1.5 : La commande pwd affiche le nom du répertoire courant, et peut se révéler extrêmement utile lors de la navigation dans le système. En combinant des commandes, vous pouvez obtenir en une seule fois le nom et le contenu du répertoire courant
xmission> pwd
/home/users/e/moiay
xmission> ls ; pwd
Mail/ Project/ chat.conf/ ftp@ temp/
NewProject/ access/ dead.letter mail/
News/ ch1info.txt files public_html/
/home/users/e/moiay

Commande1.6 : La sortie de la commande ls est ici redirigée vers local.programs.txt, comme le spécifie le symbole supérieur à (>). Le caractère astérisque (*) est utilisé comme joker pour spécifier l'argument de la commande ls. Enfin, la liste du contenu du répertoire /usr/bin est ajoutée à la fin du fichier all.programs.txt
$ ls /usr/local/bin > local.programs.txt
$ ls local*
local.programs.txt localize localuno 'localyokel
$ ls /usr/bin > all.programs.txt
$

Commande1.7 : Les caractères joker (? et *) sont utilisés pour marquer des emplacements pour des caractères non spécifiés
[moi@machine Projects]$ ls
keep kept kiddo kidneypie kidupdate
keeper.jpg kidder.txt kidnews kids
[moi@machine Projects]$ ls kid*
kidder.txt kiddo kidnews kidneypie kids kidupdate
[moi@machine Projects]$ ls k???
keep kept kids
[moi@machine Projects]$ ls *date
kidupdate
[moi@machine Projects]$ ls *up*
kidupdate
[moi@machine Projects]$ ls k?d*
kidder.txt kiddo kidnews kidneypie kids kidupdate
[moi@machine Projects]$

Commande1.8 : Affiché au moyen de la commande cat, le contenu d'un fichier défile rapidement et sans interruption, jusqu'à la fin du fichier. cat peut s'utiliser pour rediriger une sortie vers un fichier, comme le montre la fin de ce listing
$ cat newest.programs
...
xtermdos
xvminitoppm
xwdtopnm
xxd
yacc
ybmtopbm
yes
yuvsplittoppm
yuvtoppm
zcmp
zdiff
zeisstopnm
zforce
zgrep
zip
zipcloak
zipgrep
zipinfo
zipnote
zipsplit
zless
zmore
znew
$ cat newer.programs newest.programs > all.programs
$
Commande1.9 : L'exécution du code man -k passwd produit l'affichage de la liste de toutes les pages de manuel qui traitent des mots de passe
chpasswd (8) - update password file in batch
gpasswd (1) - administer the /etc/group file
mkpasswd (1) - generate new password, optionally apply it to a user
mkpasswd (8) - Update passwd and group database files
passwd (1) - update a user's authentication tokens(s)
passwd (5) - password file
userpasswd (1) - A graphical tool to allow users to change their passwords
$

Commande2.1 : Pour créer un nouveau répertoire, tapez mkdir suivi d'un nom de répertoire. Pour connaître le contenu du nouveau répertoire, il suffit d'utiliser la commande ls. Dans la liste de contenu qui s'affiche alors à l'écran, la présence de la lettre d à l'extrême gauche d'une ligne indique que l'élément listé est un répertoire
$ ls
Projects all.programs.txt local.programs.txt schedule
Xrootenv.0 files newer.programs short.fortunes
all.programs fortunes newest.programs temp
$ mkdir Newdirectory
$ ls -l
total 159
drwxrwxr-x 2 moi users 1024 Jun 29 11:40 Newdirectory
drwxrwxr-x 2 moi users 1024 Jun 28 12:48 Projects
-rw-rw-r-- 1 moi users 7976 Jun 28 14:15 all.programs
-rw-rw-r-- 1 moi users 7479 Jun 28 14:05 all.programs.txt
-rw-rw-r-- 1 moi users 858 Jun 28 12:45 files
-rw-rw-r-- 1 moi moi 128886 Jun 27 09:05 fortunes
-rw-rw-r-- 1 moi users 0 Jun 28 14:05 local.programs.txt
-rw-rw-r-- 1 moi users 497 Jun 28 14:13 newer.programs
-rw-rw-r-- 1 moi users 7479 Jun 28 14:13 newest.programs
lrwxrwxrwx 1 moi users 27 Jun 26 11:03 schedule -> /home/deb/Pre
-rw-rw-r-- 1 moi moi 1475 Jun 27 09:31 short.fortunes
drwxrwxr-x 2 moi users 1024 Jun 26 06:39 temp
$

Commande2.2 : La commande touch permet de créer des fichiers, et/ou de mettre à jour la date de modification d'un fichier
$ ls
$ touch file.to.create
$ ls -l file*
-rw-rw-r-- 1 moi users 0 Jun 29 11:53 file.to.create
$ touch -t 12312359 oldfile
$ ls -l
total 0
-rw-rw-r-- 1 moi users 0 Jun 29 11:53 file.to.create
-rw-rw-r-- 1 moi users 0 Dec 31 1998 oldfile
$ touch -t 123123592001 new.years.eve
$ ls -l
total 0
-rw-rw-r-- 1 moi users 0 Jun 29 11:53 file.to.create
-rw-rw-r-- 1 moi users 0 Dec 31 2001 new.years.eve
-rw-rw-r-- 1 moi users 0 Dec 31 1998 oldfile
$

Commande2.3 : Utilisez la commande cp -r pour copier des répertoires
$ cp -r /home/moi/Projects /home/shared/deb/Projects
$ ls /home/shared/deb/Projects
current new.ideas schedule
$

Commande2.4 : Utilisez la commande cp pour copier des fichiers, en ajoutant l'option -i pour obtenir que le système vous informe qu'il va "écraser" un fichier existant, le cas échéant
$ cp existingfile newfile
$ ls -l
total 7
-rw-rw-r-- 1 moi users 1475 Jun 29 12:18 existingfile
-rw-rw-r-- 1 moi users 1475 Jun 29 12:37 newfile
-rw-rw-r-- 1 moi users 2876 Jun 29 12:17 oldfile
$ cp -i existingfile oldfile
cp: overwrite 'oldfile'? n
$

Commande2.5 : Utilisez la commande ls -l pour lister le contenu d'un répertoire au format long
$ ls -l
total 13
-rw-rw-r-- 1 moi users 2151 Jun 29 12:26 current
-rw-rw-r-- 2 moi users 1475 Jun 29 12:35 deb.schedule
-rw-rw-r-- 1 moi users 4567 Jun 29 12:26 new.ideas
drwxrwxr-x 2 moi users 1024 Jun 29 13:06 other
-rw-rw-r-- 1 moi users 1475 Jun 29 12:22 schedule

Commande2.6 : Pour obtenir le listage des fichiers cachés, tapez ls -a
$ls -a
. .stats deb.schedule other
.. current new.ideas schedule

Commande2.7 : Pour obtenir le listage de tous les fichiers, utilisez la commande ls -a
$ ls -la
total 22
drwxrwxr-x 3 moi users 1024 Jun 29 '13:07 .
drwxrwx--- 7 moi users 1024 Jun 29 '12:16 ..
-rw-rw-r-- 1 moi users 6718 Jun 29 '13:00 .stats
-rw-rw-r-- 1 moi users 2151 Jun 29 '12:26 current
-rw-rw-r-- 2 moi users 1475 Jun 29 '12:35 deb.schedule
-rw-rw-r-- 1 moi users 4567 Jun 29 '12:26 new.ideas
drwxrwxr-x 2 moi users 1024 Jun 29 '13:06 other
-rw-rw-r-- 1 moi users 1475 Jun 29 '12:22 schedule
$

Commande2.8 : Listez les fichiers pour connaître ceux contenus dans le répertoire courant, puis servez-vous de la commande mv pour en renommer un
$ ls
Completed existingfile oldfile
$ mv existingfile newfile
$ ls
Completed newfile oldfile
$

Commande2.9 : Utilisez rm -i pour supprimer prudemment des répertoires et des fichiers
$ ls
Completed oldfile
newfile soon.to.be.gone.file
$ rm -i soon.to.be.gone.file
rm: remove 'soon.to.be.gone.file'? y
$ ls
Completed newfile oldfile
$

Commande2.10 : La suppression de répertoires au moyen de la commande rmdir peut être assez laborieuse, mais se révèle moins risquée qu'avec la commande rm
$ cd /home/moi/Yourdirectory
$ ls -la
total 7
drwxrwxr-x 2 moi users 1024 Jun 29 20:59 .
drwxrwx--- 8 moi users 1024 Jun 29 20:59 ..
-rw-rw-r-- 1 moi users 1475 Jun 29 20:59 cancelled.project.notes
-rw-rw-r-- 1 moi users 2876 Jun 29 20:59 outdated.contact.info
$ rm *
$ cd ..
$ rmdir Yourdirectory
$ ls
Newdirectory all.programs.txt newer.programs short.fortunes
Projects files newest.programs temp
Xrootenv.0 fortunes newstuff touching
all.programs local.programs.txt schedule
$

Commande2.11 : Utilisez la commande find pour localiser un fichier particulier
$ find . -name lostfile -print
./Projects/schedule/lostfile
$

Commande2.12 : Vous pouvez faire des recherches plus performantes et sélectives en utilisant des caractères joker et en spécifiant les répertoires à explorer
$ find /home/deb -name pending* -print
/home/deb/Projects/schedule/pending.tasks
$ find /home/deb /home/moi -name pending* -print
/home/deb/Projects/schedule/pending.tasks
/home/moi/pending.jobs.to.do.today.to.do
$

Commande2.13 : Les liens physiques permettent à deux utilisateurs de partager facilement leurs fichiers
$ ls /home/deb/Projects/schedule/our* /home/helper/our*
ls: /home/helper/our*: No such file or directory
/home/deb/Projects/schedule/our.projects.latest
/home/deb/Projects/schedule/our.projects.other
$ ln /home/deb/Projects/schedule/our.projects.latest /home/helper/our.projects
$ ls -l /home/helper/o*
-rw-r--r-- 3 moi users 1055 Jun 26 11:00 /home/helper/our.projects
$

Commande2.14 : Utilisez la commande ln -s pour établir des liens symboliques entre des répertoires
$ ls /home/deb /home/helper
/home/deb:
Projects

/home/helper:
our.projects
$ ln -s /home/deb/Projects /home/helper/Projects
$ ls -la /home/helper/
total 11
d-wxrwx--- 2 helper users 1024 Jun 29 21:18 .
drwxr-xr-x 11 root root 1024 Jun 29 21:03 ..
-rw-rwxr-- 1 helper users 3768 Jun 29 21:03 .Xdefaults
-rw-rwxr-- 1 helper users 24 Jun 29 21:03 .bash_logout
-rw-rwxr-- 1 helper users 220 Jun 29 21:03 .bash_profile
-rw-rwxr-- 1 helper users 124 Jun 29 21:03 .bashrc
lrwxrwxrwx 1 moi users 18 Jun 29 21:18 Projects -> /home/deb/Prs
-rw-rwxr-- 3 moi users 1055 Jun 26 11:00 our.projects
$

Commande3.1 : Par défaut, ce fournisseur d'accès utilise le shell /bin/csh
xmission> echo $SHELL
/bin/csh
xmission> finger moiay
Login name: moiay In real life: "RayComm
Directory: /home/users/e/moiay Shell: /bin/csh
On since Jul 23 06:58:48 on pts/16 from calvin.raycomm.com
1 minute 28 seconds Idle Time
No unread mail
No Plan.
xmission>

Commande3.2 : Dans ce système Linux (machine), le shell par défaut est /bin/bash
[moi@machine moi]$ echo $SHELL
/bin/bash
[moi@machine moi]$ finger moi
Login: moi Name: Eric J. Ray
Directory: /home/moi Shell: /bin/bash
On since Wed Jul 22 07:42 (MDT) on tty1 3 hours 15 minutes idle
On since Thu Jul 23 08:17 (MDT) on ttyp0 from calvin
No mail.
Project:
Working on UNIX VQS.
Plan:
This is my plan--work all day, sleep all night.
[moi@machine moi]$

Commande3.3 : Une liste des shells disponibles sur un système UNIX spécifique. Les principaux shells sont disponibles, mais le choix reste assez limité
[moi@machine]$ more /etc/shells
/bin/bash
/bin/sh
/bin/tcsh
/bin/csh
[moi@machine]$

Commande3.4 : Une liste de shells disponibles via un fournisseur d'accès à Internet (FAI). Notez les shells supplémentaires proposés par ce FAI, y compris des shells offrant des fonctions spéciales comme l'interdiction d'ouverture de session
xmission> cat /etc/shells
/usr/local/bin/tcsh
/bin/csh
/usr/bin/csh
/bin/ksh
/usr/bin/ksh
/sbin/sh
/usr/bin/sh
/usr/local/bin/zsh
/usr/local/bin/bash
/usr/local/bin/nologin
/usr/local/bin/terminated
/usr/local/bin/xmmenu.email
/usr/local/bin/xmmenu.noshell
/usr/lib/uucp/uucico
xmission>

Commande3.5 : Pour changer de shell dans ce système UNIX, il faut connaître le chemin d'accès du shell à utiliser. Le test effectué sur le mot de passe permet de garantir que seul le propriétaire du compte peut changer le shell
[moi@machine moi]$ cat /etc/shells
/bin/bash
/bin/sh
/bin/tcsh
/bin/csh
[moi@machine moi]$ chsh
Changing shell for moi.
Password:
New shell [/bin/bash]: /bin/csh
Shell changed.
[moi@machine moi]$
[moi@machine moi]$ su - moi
Password:
[moi@machine]$

Commande3.6 : Pour connaître tous les shells à disposition dans votre système, examinez la liste du fichier /etc/shells, ou recherchez les programmes dont le nom se termine par les caractères sh
[moi@machine]$ cat /etc/shells
/bin/bash
/bin/sh
/bin/tcsh
/bin/csh
[moi@machine]$ ls /usr/local/bin/*sh
/usr/local/bin/pdksh
[moi@machine]$

Commande3.7 : Entrez le nom du shell à utiliser de manière temporaire (le nom du shell est simplement une commande UNIX)
[moi@machine]$ /usr/bin/csh
moi>

Commande3.8 : Dans cet exemple, seuls les caractères ls, suivis de cd pub ont été tapés. Le shell bash a complété ensuite la commande lorsque la touche t a été actionnée
bash-2.00$ ls
Complete NewProject bogus2 ftp puppy
Completed News dead.letter mail temp
Mail access files public_html testme
bash-2.00$ cd public_html/
bash-2.00$

Commande3.9 : Dans cet exemple, après avoir entré deux premières commandes, la touche de direction vers le haut a été employée pour réutiliser la dernière commande entrée (ls). En outre, l'expression !40 sert à récupérer la quarantième commande de l'historique de session
[moi@machine clean]$ ls
background.htm info.htm logo.gif
[moi@machine clean]$ ls
background.htm info.htm logo.gif
[moi@machine clean]$ history
1 free
2 id deb
3 id moi
4 uname -a
5 ls

...

40 cd
41 cp .bash_history oldhistory
42 vi .bash_history
43 elm
44 ls -la
45 ls -la .e*
46 elm
47 lynx
48 history
49 vi .bash*his*
50 history
51 cd clean
52 ls
53 ls
54 history
[moi@machine clean]$ !40
cd
[moi@machine moi]$

Commande3.10 : Après un listage du répertoire courant, une commande est ici complétée avec succès. Les caractères ^[^[ sont la matérialisation de la touche q à l'écran lorsque le shell ne sait pas comment compléter la commande en cours de saisie
$ ls
Complete NewProject bogus2 files public_html testme
Completed News chat.conf ftp puppy
Mail access dead.letter mail temp
$ cd pub^[^[
ksh: pub: not found
$ set -o emacs
$ cd public_html/
$

Commande3.11 : En examinant cette suite de commandes, on pourrait penser que ls a été entrée au clavier dans les première et deuxième commandes. Toutefois, la deuxième commande ls a été ici obtenue en appuyant sur les touches cP. La commande r 64 provoque la réutilisation de la commande portant le numéro 64 dans la liste de l'historique de session
$ ls
Complete NewProject bogus2 files public_html testme
Completed News chat.conf ftp puppy
Mail access dead.letter mail temp
$ ls
Complete NewProject bogus2 files public_html testme
Completed News chat.conf ftp puppy
Mail access dead.letter mail temp
$
$ history
56 cd ..
57 ls
58 lynx
59 ls temp
60 more Complete
61 ls
62 more testme
63 ls
64 ls
65 history
66 lynx
67 ftp ftp.raycomm.com
68 ls
69 ls
70 ls
71 history
$ r 64
ls
Complete NewProject bogus2 files public_html testme
Completed News chat.conf ftp puppy
Mail access dead.letter mail temp
$

Commande3.12 : Avec le shell csh, vous pouvez également rappeler à l'invite du shell des commandes exécutées antérieurement, en spécifiant leur numéro dans la liste de l'historique de session. Par contre, les autres fonctions d'historique offertes par les shells bash ou ksh ne sont pas supportées par csh
xmission> history
1 ls
2 vi temp.info
3 ls
4 cd pub*
5 ls
6 cp *.pdf ..
7 cd ..
8 rm *.pdf
9 history
10 lynx
11 ftp ftp.wustl.edu
12 ls
13 vi .plan
14 finger moi@raycomm.com
15 history
16 finger moi@machine.raycomm.com
17 ls
18 pine
19 history
20 lynx
21 history
xmission>!10

Commande3.13 : Changer plusieurs fois de suite d'identité (d'ID utilisateur), ou lancer et fermer plusieurs shells à la suite peut être source de confusion. Heureusement, l'invite du shell reflète souvent votre localisation dans le système
[moi@machine asr]$ ls
Projects testing
[moi@machine asr]$ su asr
Password:
[asr@machine asr]$ ls
Projects testing
[asr@machine asr]$ su - moi
Password:
[moi@machine moi]$ ls
Mail editme script2.sed
Projects fortunes.copy scriptextra.sed
Xrootenv.0 fortunes1.txt sedtest
above.htm fortunes2.txt sorted.address.temp
address.book groups temp.htm
address.temp history.txt tempsort
axhome html.htm test
bogus html.html test2
chmod.txt mail testing.gif
clean manipulate testing.wp
compression nsmail typescript
[moi@machine moi]$ exit
[asr@machine asr]$ exit
[moi@machine moi]$ exit

Commande3.14 : La commande stty permet souvent de remettre dans le droit chemin un programme telnet ou un système UNIX capricieux. Dans cet exemple, c'est le fonctionnement erratique de la touche N qui est résolu
xmission> ls ^?^?^?^?
: No such file or directory
xmission> stty erase '^?'
xmission> ls

Commande3.15 : La commande stty est utilisée ici pour obtenir que la touche D fonctionne comme la touche N
xmission> jf^H^H
jf^H^H: Command not found
xmission> ls ^H^H
: No such file or directory
xmission> stty erase '^H'
xmission>

Commande5.1 : Dans nombre de systèmes, seuls quelques noms de groupes sont utilisés pour faciliter le partage de fichiers et la collaboration entre les utilisateurs
xmission> cd
/home/users/e/moiay
xmission> ls -l
total 60
drwx--x--x 2 moiay users 512 Jul 21 13:32 Complete/
drwx--x--x 2 moiay users 512 Jun 24 09:23 Completed/
drwx--x--x 2 moiay users 512 Sep 15 1997 Mail/
drwx--x--x 2 moiay users 512 Jun 24 09:35 NewProject/
drwx--x--x 2 moiay users 512 Sep 15 1997 News/
drwx--x--x 2 moiay users 512 Sep 15 1997 access/
-rw------- 1 moiay users 163 Jul 22 07:28 bogus2
drwxrwx--x 2 moiay www 512 Jul 24 04:44 chat.conf/
-rw------- 1 moiay users 853 Sep 13 1997 dead.letter
-rw------- 1 moiay users 14286 Jun 28 12:40 files
lrwxrwxrwx 1 moiay users 27 Sep 15 1997 ftp -> /home/ftp/pub/users
-rw------- 1 moiay users 36 Jul 24 12:09 limerick
drwx--x--x 2 moiay users 512 Jun 8 13:32 mail/
drwxr-s--x 15 moiay www 2560 Jul 10 10:30 public_html/
drwx--x--x 2 moiay users 512 Jul 22 08:23 puppy/
drwx--x--x 2 moiay users 512 Jul 24 04:44 temp/
-rw------- 1 moiay users 0 Jul 19 13:24 testme

Commande5.2 : Certains systèmes sont configurés de telle manière que le nom du groupe soit identique à l'ID utilisateur
[moi@machine permissions]$ ls -l
total 152
-rw-rw-r-- 1 moi moi 128889 Jul 24 14:33 sage.sayings
-rw-rw-r-- 1 moi moi 23890 Jul 24 14:33 sayings
[moi@machine permissions]$

Commande5.3 : Le répertoire /etc/passwd est une mine d'informations. Vous y trouverez notamment votre numéro de groupe par défaut
[moi@machine permissions]$ grep moi /etc/passwd
moi:aag2.UyC7yJWE:500:500:Eric J. Ray:/home/moi:/bin/bash
[moi@machine permissions]$

Commande5.4 : Le fichier group contient la liste des groupes et de leurs membres (comme dans le groupe users)
[moi@machine permissions]$ cat /etc/group
kmem::9:
wheel::10:root,moi
mail::12:mail
news::13:news
uucp::14:uucp
man::15:
games::20:
gopher::30:
dip::40:
ftp::50:
nobody::99:
users::100:moi,deb,asr,awr
floppy:x:19:
pppusers:x:230:
popusers:x:231:
slipusers:x:232:
postgres:x:233:
moi:x:500:
bash:x:501:
csh:x:502:
asr:x:503:
awr:x:504:
deb:x:505:
[moi@machine permissions]$

Commande5.5 : Les groupes pot et kettle peuvent chacun être associés au fichier black, mais pas simultanément
[moi@machine permissions]$ ls -l
total 178
-rw-rw-r-- 1 moi pot 24850 Jul 24 14:59 black
-rw-rw-r-- 1 moi moi 128889 Jul 24 14:33 sage.sayings
-rw-rw-r-- 1 moi moi 23890 Jul 24 14:33 sayings
[moi@machine permissions]$ chgrp kettle black
[moi@machine permissions]$ ls -l
total 178
-rw-rw-r-- 1 moi kettle 24850 Jul 24 14:59 black
-rw-rw-r-- 1 moi moi 128889 Jul 24 14:33 sage.sayings
-rw-rw-r-- 1 moi moi 23890 Jul 24 14:33 sayings

Commande5.6 : En changeant le propriétaire d'un fichier, vous faites totalement passer le contrôle du fichier d'un utilisateur à un autre
[moi@machine merrilee]$ ls -l
total 26
-rw-rw-r-- 1 moi users 24850 Jul 24 15:17 rowtheboat
[moi@machine merrilee]$ chown merrilee rowtheboat
[moi@machine merrilee]$ ls -l
total 26
-rw-rw-r-- 1 merrilee users 24850 Jul 24 15:17 rowtheboat
[moi@machine merrilee]$

Commande5.7 : Utilisez la commande ls -l pour visualiser les permissions accordées sur les fichiers
[moi@machine permissions]$ ls -l r*
-rwxr-x--- 1 moi users 152779 Jul 24 15:10 rowyourboat
[moi@machine permissions]$

Commande5.8 : Vous pouvez spécifier des permissions absolues, pour vous assurer que les mêmes permissions sont accordées pour tous les fichiers
[moi@machine permissions]$ ls -l
total 332
-rw-rw-r-- 1 moi users 24850 Jul 24 14:59 black
-rwxr-x--- 1 moi users 152779 Jul 24 15:10 rowyourboat
-rw-rw-r-- 1 moi users 128889 Jul 24 14:33 sage.sayings
-rw-rw-r-- 1 moi users 23890 Jul 24 14:33 sayings
[moi@machine permissions]$ chmod u=rwx,g=rx,o=r row*
[moi@machine permissions]$ ls -l
total 329
-rwxr-xr-- 1 moi users 24850 Jul 24 14:59 black
-rwxr-xr-- 1 moi users 152779 Jul 24 15:10 rowyourboat
-rwxr-xr-- 1 moi users 128889 Jul 24 14:33 sage.sayings
-rwxr-xr-- 1 moi users 23890 Jul 24 14:33 sayings
[moi@machine permissions]$

Commande5.9 : Utilisez la commande umask pour ajuster les permissions par défaut accordées sur les prochains fichiers qui seront créés
[moi@machine permissions]$ umask 022
[moi@machine permissions]$ touch tryit
[moi@machine permissions]$ ls -l try*
-rw-r--r-- 1 moi users 0 Jul 26 16:35 tryit
[moi@machine permissions]$

Commande6.1 : Utilisez wc -w pour compter les mots d'un fichier. Le fichier honeydo utilisé dans cet exemple se révèle particulièrement court
[moi@machine manipulate]$ wc -w honeydo
235 honeydo

Commande6.2 : La commande wc -l permet de savoir ici que le fichier honeydo compte 85 lignes
[moi@machine manipulate]$ wc -l honeydo
85 honeydo

Commande6.3 : Utilisez la commande head pour afficher le début d'un fichier, et vous faire ainsi rapidement une idée de son contenu
[moi@machine manipulate]$ head honeydo
Take garbage out
Clean litter box
Clean diaper pails
Clean litter box
Mow lawn
Edge lawn
Clean litter box
Polish swamp cooler
Buff garage floor
Clean litter box
[moi@machine manipulate]$

Commande6.4 : En utilisant les commandes head et more en conjonction, vous pouvez afficher les débuts de plusieurs fichiers à la suite
[moi@machine manipulate]$ head honey* | more
==> honeyconsider <==
Mother-in-law visits next week
Cat mess in hall to clean up
Cat mess in entry to clean up
Cat mess in living room to clean up
Toddler mess in family room to clean up
Cat and toddler mess in den to clean up
IRS called again today
Neighbors on both sides looking for donations
for the annual fund drive

Boss called last Friday and said it's urgent

==> honeydo <==
Take garbage out
Clean litter box
Clean diaper pails
Clean litter box
Mow lawn
Edge lawn
Clean litter box
Polish swamp cooler
Buff garage floor
--More--

Commande6.5 : La commande tail permet de visualiser directement la fin d'un fichier
[moi@machine manipulate]$ tail honeydo
Empty diaper pails
Take garbage out.
--End of today's list--


Buy more garbage bags
Get cleaning supplies at store
Take cat to vet
Fix lawnmower

[moi@machine manipulate]$


Commande6.6 : Utilisez la commande tail en conjonction avec la commande more pour afficher la fin de plusieurs fichiers à la suite
[moi@machine manipulate]$ tail honey* | more
==> honeyconsider <==
Cat mess in entry to clean up
Cat mess in living room to clean up
Toddler mess in family room to clean up
Cat and toddler mess in den to clean up
IRS called again today
Neighbors on both sides looking for donations
for the annual fund drive
Boss called last Friday and said it's urgent
--End of today's list--


==> honeydo <==
Empty diaper pails
Take garbage out
--End of today's list--

Buy more garbage bags
Get cleaning supplies at store
Take cat to vet
Fix lawnmower

--More--

Commande6.7 : Utilisez la commande grep pour rechercher une chaîne spécifique dans un fichier
[moi@machine manipulate]$ grep bucket limericks
Who carried his lunch in a bucket,
[moi@machine manipulate]$

Commande6.8 : La commande grep peut également renvoyer le contexte des instances de la chaîne de texte recherchée
[moi@machine manipulate]$ grep -5 bucket limerick
he strummed and he hummed,
and sang dumdeedum,
But him a musician...whoda thunk it?

There once was a man from Nantucket,
Who carried his lunch in a bucket,
Said he with a sigh,
As he ate a whole pie,
If I just had a donut I'd dunk it.

A nice young lady named Debbie,

[moi@machine manipulate]$

Commande6.9 : Utilisez la commande grep avec des expressions régulières pour faire des recherches "avec joker"
[moi@machine manipulate]$ grep .logan limerick
Worked hard all day on a slogan,
You see, the slogan's still brogan.
[moi@machine manipulate]$

Commande6.10 : Vous pouvez utiliser la commande sed pour apporter des modifications au sein de fichiers, comme ici un changement d'adresse électronique
[moi@machine manipulate]$ sed s/oldaddr@raycomm.com/newaddr@raycomm.com/g address.htm > address.htm
[moi@machine manipulate]$ head address.htm

<BODY BACKGROUND="/images/background.gif" BGCOLOR="#FFFFFF" TEXT="#000000" LINK=
"#009900" VLINK="#000000" ALINK="#ff0000">

<P>
Please send all comments to <A HREF="mailto:newaddr@raycomm.com">newaddr@raycomm
.com</A>.
</P>

<TABLE BORDER=0>
<TR>
<TD WIDTH="150" VALIGN=TOP>
[moi@machine manipulate]$

Commande6.11 : La commande awk permet d'accéder aux champs individuels d'un fichier
[moi@machine manipulate]$ awk '{ print $1 }' address.book
Schmidt,
Feldman,
Brown,
Smith,
Jones,
[moi@machine manipulate]$

Commande6.12 : La commande awk, pour peu que l'on prenne le temps d'apprendre à l'utiliser, est très puissante pour extraire des informations spécifiques dans des fichiers
[moi@machine manipulate]$ awk -F, '{print $2 " " $1 " " $7 }' address.book > phone.list
[moi@machine manipulate]$ more phone.list
Sven Schmidt 555-555-8382
Fester Feldman
John Brown 918-555-1234
Sally Smith 801-555-8982
Kelly Jones 408-555-7253
[moi@machine manipulate]$

Commande6.13 : La commande cmp renvoie simplement un descriptif de la première différence observée
[moi@machine manipulate]$ cmp dearliza dearhenry
dearliza dearhenry differ: char 20, line 2
[moi@machine manipulate]$

Commande6.14 : La commande cmp indique également si les fichiers sont identiques jusqu'à la fin de l'un d'entre eux (EOF vient de l'anglais "End Of File", et signifie "fin de fichier")
[moi@machine manipulate]$ cmp limerick limericks
cmp: EOF on limerick
[moi@machine manipulate]$

Commande6.15 : La commande diff renvoie une description des différences existant entre les deux fichiers comparés. Cette description est complète, mais difficile à comprendre
[moi@machine manipulate]$ diff dearliza dearhenry
2,3c2,3
< Dear Liza,
< There's a hole in my bucket, dear Liza, dear 'Liza, dear Liza.
---
> Dear Henry,
> Please fix it dear Henry, dear Henry, dear 'Henry.
5,6c5,6
< Henry
<
---
> Liza
> PS, you forgot your toolbox last time.
[moi@machine manipulate]$

Commande6.16 : La commande sdiff affiche les fichiers à comparer côte à côte, pour vous permettre de visualiser leurs différences
[moi@machine manipulate]$ sdiff dearliza dearhenry
July 25, 1998 July 25, 1998
Dear Liza, | Dear Henry,
There's a hole in my bucket, dear Liza, dear Liza. | Please fix it dear Henry, dear Henry.
Yours, Yours,
Henry | Liza
| PS, you forgot your toolbox last time.
[moi@machine manipulate]$

Commande6.17 : Un carnet d'adresses non trié, classé par ordre alphabétique au moyen de la commande sort
[moi@machine manipulate]$ more address.book
Schmidt, Sven, 1 Circle Drive, Denver, CO, 80221, 555-555-8382
Feldman, Fester, RR1, Billings, MT 62832, 285-555-0281
Brown, John, 1453 South Street, Tulsa, OK, 74114, 918-555-1234
Smith, Sally, 452 Center Ave., Salt Lake City, UT, 84000, 801-555-8982
Jones, Kelly, 14 Main Street, Santa Clara, CA, 95051, 408-555-7253
[moi@machine manipulate]$ sort address.book
Brown, John, 1453 South Street, Tulsa, OK, 74114, 918-555-1234
Feldman, Fester, RR1, Billings, MT 62832, 285-555-0281
Jones, Kelly, 14 Main Street, Santa Clara, CA, 95051, 408-555-7253
Schmidt, Sven, 1 Circle Drive, Denver, CO, 80221, 555-555-8382
Smith, Sally, 452 Center Ave., Salt Lake City, UT, 84000, 801-555-8982
[moi@machine manipulate]$ sort address.book > sorted.address.book
[moi@machine manipulate]$ cat sorted.address.book
Brown, John, 1453 South Street, Tulsa, OK, 74114, 918-555-1234
Feldman, Fester, RR1, Billings, MT 62832, 285-555-0281
Jones, Kelly, 14 Main Street, Santa Clara, CA, 95051, 408-555-7253
Schmidt, Sven, 1 Circle Drive, Denver, CO, 80221, 555-555-8382
Smith, Sally, 452 Center Ave., Salt Lake City, UT, 84000, 801-555-8982
[moi@machine manipulate]$

Commande6.18 : Utilisez sort en conjonction avec uniq pour éliminer les doublons des fichiers triés
[moi@machine manipulate]$ more long.address.book
Schmidt, Sven, 1 Circle Drive, Denver, CO, 80221, 555-555-8382
Feldman, Fester, RR1, Billings, MT 62832, 285-555-0281
Brown, John, 1453 South Street, Tulsa, OK, 74114, 918-555-1234
Smith, Sally, 452 Center Ave., Salt Lake City, UT, 84000, 801-555-8982
Jones, Kelly, 14 Main Street, Santa Clara, CA, 95051, 408-555-7253
Schmidt, Swen, 1 Circle Drive, Denver, CO, 80221, 555-555-8382
Feldman, Fester, RR1, Billings, MT 62832, 285-555-0281
Brown, Jonathon, 1453 South Street, Tulsa, OK, 74114, 918-555-1234
Smith, Sally, 452 Center Ave., Salt Lake City, UT, 84000, 801-555-8982
Jones, Kelly, 14 Main Street, Santa Clara, CA, 95051, 408-555-7253
[moi@machine manipulate]$ sort long.address.book | uniq
Brown, John, 1453 South Street, Tulsa, OK, 74114, 918-555-1234
Brown, Jonathon, 1453 South Street, Tulsa, OK, 74114, 918-555-1234
Feldman, Fester, RR1, Billings, MT 62832, 285-555-0281
Jones, Kelly, 14 Main Street, Santa Clara, CA, 95051, 408-555-7253
Schmidt, Sven, 1 Circle Drive, Denver, CO, 80221, 555-555-8382
Schmidt, Swen, 1 Circle Drive, Denver, CO, 80221, 555-555-8382
Smith, Sally, 452 Center Ave., Salt Lake City, UT, 84000, 801-555-8982
[moi@machine manipulate]$

Commande6.19 : Utilisez la commande tee pour transférer une sortie vers deux emplacements à la fois
[moi@machine manipulate]$ sort address.book new.addresses | tee sorted.all | mail boss@raycomm.com -s "Here's the address book, boss" -
[moi@machine manipulate]$

Commande7.1 : La commande uname et son jeu d'options permettent d'obtenir toutes sortes d'informations utiles et intéressantes sur le système UNIX utilisé
xmission> uname
SunOS
xmission> uname -sr
SunOS 5.5.1
xmission> uname -a
SunOS xmission 5.5.1 Generic_103640-19 sun4m sparc SUNW,SPARCstation-10
xmission>

Commande7.2 : Utilisées dans un autre système, les mêmes commandes renvoient des informations légèrement différentes. Les informations de base restent toutefois identiques
Red Hat Linux release 5.1 (Manhattan)
Kernel 2.0.34 on an i486
login: moi
Password:
Last login: Fri Jul 24 12:14:37 from calvin
[moi@machine moi]$ uname
Linux
[moi@machine moi]$ uname -sr
Linux 2.0.34
[moi@machine moi]$ uname -a
Linux machine.raycomm.com 2.0.34 #1 Fri May 8 '16:05:57 EDT 1998 i486 unknown
[moi@machine moi]$

Commande7.3 : Les systèmes de fichiers de ce petit système Linux sont relativement simples
[moi@machine moi]$ df
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/hda1 515161 316297 172255 65% /
/dev/hdb4 66365 4916 58022 8% /home
/dev/hdb1 416656 324633 70504 82% /usr/local
/dev/sbpcd 596704 596704 0 100% /mnt/cdrom
[moi@machine moi]$

Commande7.4 : Les systèmes de fichier du système UNIX de ce FAI sont considérablement plus complexes
xmission> df
/ (/dev/dsk/c0t3d0s0 ): 154632 blocks 71721 files
/usr (/dev/dsk/c0t3d0s6 ): 225886 blocks 144820 files
/proc (/proc ): 0 blocks 7830 files
/dev/fd (fd ): 0 blocks 0 files
/var (/dev/dsk/c0t1d0s0 ): 1001142 blocks 962598 files
/tmp (swap ): 1236032 blocks 95277 files
/usr/local (/dev/dsk/c0t1d0s5 ): 630636 blocks 457211 files
/archive (/dev/dsk/c0t1d0s3 ): 1180362 blocks 1789487 files
/var/mail (mail.xmission.com:/var/mail): 2776576 blocks 1438385 files
/home (krunk1.xmission.com:/home):20091072 blocks 13066932 files
/var/spool/newslib (news.xmission.com:/var/spool/newslib):19327664 blocks 1248s
/.web (krunk1.xmission.com:/.web): 1019408 blocks 470095 files
/var/maillists (lists.xmission.com:/var/maillists): 293744 blocks 89732s
xmission>

Commande7.5 : La commande du rend compte, de manière exhaustive, de l'usage du disque dans le répertoire courant et dans ses sous-répertoires
[moi@machine moi]$ du
2 ./Mail
1 ./nsmail
1 ./.netscape/cache/0F
3 ./.netscape/cache/1A
22 ./.netscape/cache
1 ./.netscape/archive
172 ./.netscape
1 ./Projects
28 ./.wprc
3 ./axhome
5 ./groups
1 ./manipulate/empty
154 ./manipulate
1 ./mail
1 ./unixvqs/ch6
2 ./unixvqs
6 ./dupgroups
255 ./compression/Folder
670 ./compression/temp/BackupFolder
1921 ./compression/temp
670 ./compression/BackupFolder
4657 ./compression
5 ./clean
1 ./.elm
15 ./editors
5619 .
[moi@machine moi]$

Commande7.6 : Vous pouvez utiliser du pour connaître l'usage disque d'un répertoire spécifique
[moi@machine moi]$ du /home/moi/compression
255 /home/moi/compression/Folder
670 /home/moi/compression/temp/BackupFolder
1921 /home/moi/compression/temp
670 /home/moi/compression/BackupFolder
4657 /home/moi/compression
[moi@machine moi]$

Commande7.7 : La commande file fournit des informations précieuses sur le type des données contenues dans un fichier spécifique
[moi@machine moi]$ file /usr/bin/pico
/usr/bin/pico: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically ld
[moi@machine moi]$ file temp.htm
temp.htm: ASCII text
[moi@machine moi]$

Commande7.8 : La commande finger fournit souvent d'intéressantes informations sur les utilisateurs connectés
[moi@machine moi]$ finger
Login Name Tty Idle Login Time Office Office Phone
asr *4 1 Jul 24 13:32
deb 5 1 Jul 24 13:32
moi Eric J. Ray 1 3:20 Jul 22 07:42
moi Eric J. Ray p1 1:12 Jul 24 12:14 (calvin)
moi Eric J. Ray p0 Jul 24 13:02 (calvin)
root root *2 1d Jul 22 15:13
[moi@machine moi]$ finger @stc.org
[stc.org]
No one logged on
[moi@machine moi]$ finger @osuunx.ucc.okstate.edu
[osuunx.ucc.okstate.edu]
finger: connect: Connection refused
[moi@machine moi]$

Commande7.9 : La commande finger permet également d'obtenir des renseignements précis sur des utilisateurs spécifiques connectés au système UNIX
[moi@machine moi]$ finger deb
Login: deb Name:
Directory: /home/deb Shell: /bin/bash
Never logged in.
No mail.
No Plan.
[moi@machine moi]$ finger moi
Login: moi Name:
Directory: /home/moi Shell: /bin/bash
On since Wed Jul 22 07:42 (MDT) on tty1 2 hours 32 minutes idle
On since Wed Jul 22 06:58 (MDT) on ttyp1 from calvin
No mail.
Project:
Working on UNIX VQS.
Plan:
This is my plan--work all day, sleep all night.
[moi@machine moi]$
[moi@machine moi]$ finger moiay@xmission.com
[xmission.com]
Login Name TTY Idle When Where
moiay "RayComm pts/57 <Jul 22 09:39> calvin.raycomm.c
[moi@machine moi]$

Commande7.10 : Utilisez la commande who pour obtenir la liste des utilisateurs actuellement connectés au système
[moi@machine moi]$ who
moi tty1 Jul 22 07:42
root tty2 Jul 22 15:13
asr tty4 Jul 24 13:32
deb tty5 Jul 24 13:32
moi ttyp1 Jul 24 12:14 '(calvin.raycomm.com)
moi ttyp0 Jul 24 13:02 '(calvin.raycomm.com)
[moi@machine moi]$

Commande7.11 : La commande w fournit une multitude d'informations sur le système et ses utilisateurs
[moi@machine moi]$ w
1:49pm up 6 days, 4:21, 6 users, load average: 0.08, 0.02, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
moi tty1 Wed 7am 3:36m 7.07s 6.01s -bash
root tty2 Wed 3pm 28:46m 1.22s 0.32s -bash
asr tty4 1:32pm 17:22 1.04s 0.30s pine
deb tty5 1:32pm 3.00s 1.22s 0.42s lynx
moi ttyp1 calvin 12:14pm 1:28m 1.33s 0.57s vi hairyspiders
moi ttyp0 calvin 1:02pm 1.00s 1.70s 0.24s w
[moi@machine moi]$

Commande7.12 : Exécutée sur des systèmes différents, la commande w peut produire des résultats légèrement différents
xmission> w
1:47pm up 38 day(s), 23:35, 36 users, load average: 1.58, 1.78, 1.75
...
moiay pts/16 Thu 6am 1:14 -csh
...

Commande7.13 : La commande id s'utilise pour obtenir des informations sur des ID utilisateurs et sur les appartenances à des groupes
[moi@machine moi]$ id
uid=500(moi) gid=500(moi) 'groups=500(moi),10(wheel),100(users)
[moi@machine moi]$ id deb
uid=505(deb) gid=505(deb) groups=100(users)
[moi@machine moi]$

Commande8.1 : La commande set permet de déterminer les variables d'environnement en action dans un shell bash ou ksh
[moi@machine moi]$ set
BASH=/bin/bash
BASH_VERSION=1.14.7(1)
COLUMNS=80
ENV=/home/moi/.bashrc
EUID=500
HISTFILE=/home/moi/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/home/moi
HOSTNAME=machine.raycomm.com
HOSTTYPE=i386
IFS=
LINES=24
LOGNAME=moi
MAIL=/var/spool/mail/moi
MAILCHECK=60
OLDPWD=/home/moi/src/rpm-2.5.1
OPTERR=1
OPTIND=1
OSTYPE=Linux
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/moi/bin
PPID=1943
PS1=[\u@\h \W]\$
PS2=>
PS4=+
PWD=/home/moi
SHELL=/bin/bash
SHLVL=3
TERM=vt220
UID=500
USER=moi
USERNAME=
_=cd
[moi@machine moi]$

Commande8.2 : Utilisez la commande setenv pour connaître les variables en action dans le shell csh
xmission> setenv
HOME=/home/users/e/moiay
PATH=/usr/local/bin:/usr/local/bin/X11:/usr/openwin/bin:/usr/bin:/usr/ucb:/usr/.
LOGNAME=moiay
HZ=100
TERM=vt100
TZ=MST7MDT
SHELL=/usr/bin/csh
MAIL=/var/mail/moiay
PWD=/home/users/e/moiay
USER=moiay
EDITOR=pico -t
OPENWINHOME=/usr/openwin
MANPATH=/usr/man:/usr/local/man:/usr/openwin/man
LD_LIBRARY_PATH=/usr/local/lib:/usr/openwin/lib
PAGER=more
xmission>

Commande8.3 : Dans les shells bash et ksh, vous pouvez créer une nouvelle variable d'environnement en spécifiant son nom et en lui affectant une valeur, puis exporter la variable vers le système
[moi@machine moi]$ NNTPSERVER=news.xmission.com
[moi@machine moi]$ export NNTPSERVER
[moi@machine moi]$ echo $NNTPSERVER
news.xmission.com
[moi@machine moi]$

Commande8.4 : Le processus à suivre dans le shell csh est similaire à celui des shells bash et ksh
xmission> set NNTPSERVER=news.xmission.com
xmission> setenv NNTPSERVER news.xmission.com
xmission> echo $NNTPSERVER
news.xmission.com

Commande8.5 : Vos fichiers de configuration définissent vos variables d'environnement, ainsi que d'autres aspects personnalisables de votre environnement UNIX
[moi@machine moi]$ more ~/.bash_profile ~/.profile /etc/bash* /etc/profile
::::::::::::::
/home/moi/.bash_profile
::::::::::::::
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User-specific environment and startup programs
PATH=$PATH:$HOME/bin
ENV=$HOME/.bashrc
USERNAME=""
export USERNAME ENV PATH
/home/moi/.profile: No such file or directory
::::::::::::::
/etc/bashrc
::::::::::::::
# /etc/bashrc
# System-wide functions and aliases
# Environment stuff goes in /etc/profile
# Putting PS1 here ensures that it gets loaded every time.
PS1="[\u@\h \W]\$ "
alias which="type -path"
::::::::::::::
/etc/profile
::::::::::::::
# /etc/profile
# System-wide environment and startup programs
# Functions and aliases go in /etc/bashrc
PATH="$PATH:/usr/X11R6/bin"
PS1="[\u@\h \W]\$ "
ulimit -c 1000000
if [ 'id -gn' = 'id -un' -a 'id -u' -gt 14 ]; then
umask 002
else
umask 022
fi
USER='id -un'
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME='/bin/hostname'
HISTSIZE=1000
HISTFILESIZE=1000
export PATH PS1 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL
for i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
. $i
fi
done
unset i
[moi@machine moi]$

Commande8.6 : Pour commencer, vous devez localiser la variable PATH dans vos fichiers de configuration
[moi@machine moi]$ more ~/.bash_profile ~/.bashrc
::::::::::::::
/home/moi/.bash_profile
::::::::::::::
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User-specific environment and startup programs

PATH=$PATH:/usr/local/games
ENV=$HOME/.bashrc
USERNAME=""

export USERNAME ENV PATH

--More--(Next file: /home/moi/.bashrc)

Commande8.7 : Utilisez la commande echo pour vérifier que la variable PATH contient bien le nouveau chemin d'accès que vous venez d'ajouter
[moi@machine moi]$ echo $PATH
/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/games:/home/moi/bin
[moi@machine moi]$

Commande8.8 : Servez-vous de la commande grep pour rechercher une instruction d'invite dans vos fichiers de configuration
[moi@machine moi]$ grep PS1 ~/.bash_profile ~/.bashrc /etc/bashrc
/home/moi/.bashrc:PS1="\u \d $ "
/etc/bashrc:PS1="[\u@\h \W]\$ "
[moi@machine moi]$

Commande8.9 : Parcourez le contenu de vos fichiers de configuration, à la recherche de noms et de chemins d'accès de fichiers ou d'instructions ENV, pour identifier tous les fichiers qui participent à la configuration de votre environnement UNIX
$ more /etc/profile ~/.profile ~/.kshrc /etc/ksh.kshrc
::::::::::::::
/etc/profile
::::::::::::::
#ident "@(#)profile 1.17 95/03/28 SMI" /* SVr4.0 1.3 */
# The profile that all logins get before using their own .profile.
trap "" 2 3
export LOGNAME PATH
if [ "$TERM" = "" ]
then
if /bin/i386
then
TERM=AT386
else
TERM=sun
fi
export TERM
fi
# Login and -su shells get /etc/profile services.
# -rsh is given its environment in its .profile.
case "$0" in
-sh | -ksh | -jsh)
if [ ! -f .hushlogin ]
then
/usr/sbin/quota
# Allow the user to break the Message-Of-The-Day only.
trap "trap '' 2" 2
/bin/cat -s /etc/motd
trap "" 2
/bin/mail -E
case $? in
0)
echo "You have new mail."
;;
2)
echo "You have mail."
;;
esac
fi
esac
umask 022
trap 2 3
::::::::::::::
/home/users/e/moiay/.profile
::::::::::::::
#
PATH=$PATH:$HOME/bin:. # set command search path
export PATH
if [ -z "$LOGNAME" ]; then
LOGNAME='logname' # name of user who logged in
export LOGNAME
fi
MAIL=/usr/spool/mail/$LOGNAME # mailbox location
export MAIL
if [ -z "$PWD" ]; then
PWD=$HOME # assumes initial cwd is HOME
export PWD
fi
if [ -f $HOME/.kshrc -a -r $HOME/.kshrc ]; then
ENV=$HOME/.kshrc # set ENV if there is an rc file
export ENV
fi
# If job control is enabled, set the suspend character to ^Z (control-z):
case $- in
*m*) stty susp '^z'
;;
esac
set -o ignoreeof # don't let control-d logout
PS1="$ "
export PS1
export ENV=$HOME/.kshrc
::::::::::::::
/home/users/e/moiay/.kshrc
::::::::::::::
#
# If there is no VISUAL or EDITOR to deduce the desired edit
# mode from, assume vi(C)-style command line editing.
if [ -z "$VISUAL" -a -z "$EDITOR" ]; then
set -o vi
fi
/etc/ksh.kshrc: No such file or directory
$

Commande8.10 : Commencez par localiser les instructions PATH dans vos fichiers de configuration
$ grep PATH ~/.profile ~/.kshrc
/home/users/e/moiay/.profile:PATH=/usr/bin:/usr/local/bin:/usr/sbin:
/home/users/e/moiay/.profile:export PATH
$

Commande8.11 : Vérifiez l'existence de votre nouvelle instruction PATH
$ echo $PATH
/usr/bin:/usr/local/bin:/usr/sbin:/home/users/e/moiay/bin:.
$

Commande8.12 : Parcourez le contenu de vos fichiers de configuration, à la recherche d'une instruction d'invite
$ grep PS1 /etc/profile ~/.profile ~/.kshrc
/home/users/e/moiay/.profile:PS1="$ "
/home/users/e/moiay/.profile:export PS1
$

Commande8.13 : Parcourez le contenu de vos fichiers de configuration, à la recherche de noms et de chemins d'accès de fichiers ou d'instructions ENV, pour identifier tous les fichiers qui participent à la configuration de votre environnement UNIX
xmission> more .cshrc .login
::::::::::::::
.cshrc
::::::::::::::
# <@>(#)Cshrc 1.6 91/09/05 SMI
set path = (/usr/local/bin /usr/local/bin/X11 /usr/openwin/bin /usr/bin
/usr/ucb /usr/etc /usr/local/games .)
alias pwd 'echo $cwd'
umask 066
if ($?USER == 0 || $?prompt == 0) exit
set filec
set history=40
set prompt="'hostname'> "
# Edit the following lines as you wish
setenv EDITOR "pico -t"
setenv OPENWINHOME /usr/openwin
setenv MANPATH /usr/man:/usr/local/man:/usr/openwin/man
setenv LD_LIBRARY_PATH /usr/local/lib:/usr/openwin/lib
setenv PAGER more
limit coredumpsize 0
# commands for interactive shells
alias ls 'ls -F'
alias cd 'cd \!*;echo $cwd'
alias home 'cd ~'
# MS-DOS aliases
alias dir 'ls -alg'
alias del 'rm -i'
alias delete 'rm -i'
alias copy 'cp -i'
alias md 'mkdir'
alias move 'mv -i'
alias cls 'clear'
alias clr 'clear'
alias type 'more'
# Terminal settings
setenv TERM vt100
/usr/bin/stty rows 24
/usr/bin/stty cols 80
/usr/bin/stty erase '^?'
::::::::::::::
.login
::::::::::::::
# <@>(#)Login 1.14 90/11/01 SMI
# general terminal characteristics
#/usr/bin/stty -crterase
#/usr/bin/stty -tabs
#/usr/bin/stty crt
#/usr/bin/stty erase '^h'
#/usr/bin/stty werase '^?'
#/usr/bin/stty kill '^['
#/usr/bin/stty new
# environment variables
#setenv EXINIT 'set sh=/bin/csh sw=4 ai report=2'
#setenv MORE '-c'
#setenv PRINTER lw
# commands to perform at login
#w # see who is logged in
notice # system information that must be read
#
# If possible, start the windows system. Give user a chance to bail out
#
if ( 'tty' != "/dev/console" || $TERM != "sun" ) then
exit # leave user at regular C shell prompt
endif
xmission>

Commande8.14 : Utilisez la commande grep pour localiser l'instruction path dans vos fichiers de configuration
xmission> grep path ~/.cshrc ~/.login
.cshrc:set path = (/usr/local/bin /usr/local/bin/X11 /usr/openwin/bin /usr/bin)
xmission>

Commande8.15 : Testez la nouvelle valeur de l'instruction path
xmission> echo $PATH
/usr/local/bin:/usr/local/bin/X11:/usr/openwin/bin:/usr/bin:/usr/ucb:/usr/etc:/usr/local/games:/home/users/e/moiay/bin:.
xmission>

Commande8.16 : L'instruction d'invite devrait se trouver dans votre fichier .cshrc
xmission> grep prompt ~/.cshrc ~/.login
/home/users/e/moiay/.cshrc:if ($?USER == 0 || $?prompt == 0) exit
/home/users/e/moiay/.cshrc:set prompt="'hostname'> "
/home/users/e/moiay/.login: exit # leave user at regular C shell prompt
xmission>

Commande8.17 : Testez votre nouvelle invite, et jugez si le résultat obtenu convient
xmission> su - moiay
Password:
Sun Microsystems Inc. SunOS 5.5.1 Generic May 1996
You have mail.
NOTE! As of 7/15/98, "tin" has been backed out its prior version. NNTP
support was compiled in directly as well. We hope that this will
stabilize its problems.

_______________________________________________________________________________
General questions email to "help" or "help@xmission.com".
Problems with the system mail to "support" or "support@xmission.com".

Type "acctstat" for a summary of your current account information.
Type "quota -v" to view your existing disk quota.
Type "help" for a list of online programs or "menu" for the assisted menu.
moiay>

Commande8.18 : Tapez alias à l'invite du shell pour obtenir la liste de tous les alias que vous avez créés
xmission> alias
cd cd !*;echo $cwd
clr clear
cls clear
copy cp -i
del rm -i
delete rm -i
dir ls -alg
home cd ~
ls ls -F
md mkdir
move mv -i
pwd echo $cwd
type more
xmission>

Commande9.1 : Pour planifier dans le temps l'exécution d'une séquence de jobs, il suffit de spécifier l'heure et la date souhaitées, puis les jobs dans l'ordre où ils doivent être exécutés
[moi@machine moi]$ at midnight
at> tar -icf ~/bigdog.tar ~/HereKittyKitty
at> gzip ~/bigdog.tar
at> uuencode ~/bigdog.tar.gz bigdog.tar.gz | mail -s "Read this by lunch time" deb
at>
at> <EOT>
warning: commands will be executed using /bin/sh
job 12 at 1998-08-28 00:00
[moi@machine moi]$

Commande9.2 : Pour supprimer un job en attente, vous devez spécifier son numéro dans la queue de la commande at
[moi@machine moi]$ atq
4 1998-08-28 12:01 a
9 2000-01-01 12:01 a
13 1998-08-27 16:00 a
12 1998-08-28 00:00 a
[moi@machine moi]$ atrm 12
[moi@machine moi]$ atq
4 1998-08-28 12:01 a
9 2000-01-01 12:01 a
13 1998-08-27 16:00 a
[moi@machine moi]$

Commande9.3 : Ce job rappelle chaque soir à l'utilisateur moiay qu'il est temps de rentrer chez lui. Le message renvoyé par le système indique que le job cron a été correctement entré
59 16 * * * mail -s "Go Home Now!" moiay@raycomm.com < /dev/null
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/tmp/crontab.16206" 3 lines, 192 characters written
crontab: installing new crontab
[moi@machine moi]$

Commande9.4 : Suspendre un job est comparable à appuyer sur le bouton Pause d'une platine CD alors qu'un disque est en cours de lecture
[moi@machine moi]$ ftp calvin.raycomm.com
Connected to calvin.raycomm.com.
220 calvin Microsoft FTP Service (Version 2.0).
Name (calvin.raycomm.com:moi): anonymous
331 Anonymous access allowed, send identity (e-mail name) as password.
Password:
230 Anonymous user logged in.
Remote system type is Windows_NT.
ftp>
[1]+ Stopped ftp calvin.raycomm.com
[moi@machine moi]$

Commande9.5 : La commande jobs s'utilise pour savoir quels sont les jobs suspendus, et pour connaître leur statut
[moi@machine moi]$ jobs
[1]- Running ftp calvin.raycomm.com &
[2]+ Stopped (tty input) telnet
[3] Stopped (signal) lynx http://www.raycomm.com/
[moi@machine moi]$

Commande9.6 : En relançant l'exécution en arrière-plan de jobs suspendus, vous vous donnez la possibilité d'effectuer d'autres tâches avec le système tandis que l'exécution du job est en cours. Pour obtenir que l'exécution d'un job s'effectue en arrière-plan, il suffit de taper bg, suivi du numéro du job
[moi@machine moi]$ jobs
[1]- Stopped (tty input) ftp calvin.raycomm.com
[2] Stopped (tty input) telnet
[3] Stopped (signal) lynx http://www.raycomm.com/
[4]+ Stopped man telnet
[moi@machine moi]$ bg 1
[1]- ftp calvin.raycomm.com &
[moi@machine moi]$
[1]- Running ftp calvin.raycomm.com &
[2]+ Stopped (tty input) telnet
[3] Stopped (signal) lynx http://www.raycomm.com/
[moi@machine moi]$

Commande9.7 : Si vous tapez fg suivi du numéro d'un job, vous obtenez l'exécution du job en premier plan. Avec ce mode d'exécution, il est parfois possible de suivre le déroulement de l'exécution à l'écran. Vous pouvez toutefois ne voir qu'une simple invite tandis que l'exécution est en cours, sans plus d'information sur le déroulement du job
[moi@machine moi]$ jobs
[1]+ Stopped ftp ftp.cdrom.com
[moi@machine moi]$ fg
ftp ftp.cdrom.com

Commande9.8 : Utilisez la commande nice pour pondérer la part des ressources que le système UNIX accorde à l'exécution d'un job
[moi@machine moi]$ nice -19 slowscript
Commande9.9 : Tapez time suivi de la commande de job complète pour obtenir le chronométrage de l'exécution du job
[moi@machine running]$ time slowscript
0.05user 0.06system 0:50.12elapsed 0%CPU
[moi@machine running]$ time ls
bigdog.tar.gz slowscript testing.gif
0.03user 0.00system 0:00.03elapsed 78%CPU
[moi@machine running]$ time nice -19 ls
bigdog.tar.gz slowscript testing.gif
0.03user 0.03system 0:00.06elapsed 93%CPU
[moi@machine running]$

Commande9.10 : Le résultat renvoyé par la commande time peut varier légèrement d'un système à l'autre. Ici, time renvoie tout un charabia, en sus des résultats à proprement parler
$ time slowscript
0.07user 0.05system 0:50.13elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (219major+59minor)pagefaults 0swaps
$

Commande9.11 : Utilisez la commande ps pour connaître la liste des processus en cours d'exécution
$ ps
PID TTY STAT TIME COMMAND
15043 p0 S 0:00 /bin/login -h calvin raycomm.com -p
15044 p0 S 0:01 -bash
15911 p1 S 0:00 /bin/login -h calvin raycomm.com -p
15914 p1 S 0:01 -bash
16216 p1 T 0:00 telnet
16217 p1 T 0:00 lynx http://www.raycomm.com/
16267 p1 T 0:00 man telnet
16268 p1 T 0:00 sh -c (cd /usr/man ; (echo -e ".pl 1100i"; cat /usr/man/man1
16269 p1 T 0:00 sh -c (cd /usr/man ; (echo -e ".pl 1100i"; cat /usr/man/man1
16270 p1 T 0:00 sh -c (cd /usr/man ; (echo -e ".pl 1100i"; cat /usr/man/man1
16271 p1 T 0:00 /usr/bin/gtbl
16272 p1 T 0:00 cat /usr/man/man1/telnet.1
16273 p1 T 0:00 sh -c (cd /usr/man ; (echo -e ".pl 1100i"; cat /usr/man/man1
16344 p0 T N 0:00 sh ./slowscript
16345 p0 T N 0:00 sleep 50
16441 p0 R 0:00 ps
$

Commande9.12 : Utilisez l'option f avec la commande ps pour obtenir une vue arborescente des processus en cours
$ ps f
PID TTY STAT TIME COMMAND
15043 p0 S 0:00 /bin/login -h calvin raycomm.com -p
15044 p0 S 0:01 \_ -bash
16344 p0 T N 0:00 \_ sh ./slowscript
16345 p0 T N 0:00 | \_ sleep 50
16449 p0 R 0:00 \_ ps f
15911 p1 S 0:00 /bin/login -h calvin raycomm.com -p
15914 p1 S 0:01 \_ -bash
16216 p1 T 0:00 \_ telnet
16217 p1 T 0:00 \_ lynx http://www.raycomm.com/
16267 p1 T 0:00 \_ man telnet
16268 p1 T 0:00 \_ sh -c (cd /usr/man ; (echo -e ".pl 1100i"; cat /
16269 p1 T 0:00 \_ sh -c (cd /usr/man ; (echo -e ".pl 1100i"; c
16270 p1 T 0:00 \_ sh -c (cd /usr/man ; (echo -e ".pl 1100i
16272 p1 T 0:00 | \_ cat /usr/man/man1/telnet.1
16271 p1 T 0:00 \_ /usr/bin/gtbl
16273 p1 T 0:00 \_ sh -c (cd /usr/man ; (echo -e ".pl 1100i
$

Commande9.13 : Utilisez la commande kill en spécifiant un PID pour supprimer un processus en cours d'exécution ou suspendu dans le système
$ ps f
PID TTY STAT TIME COMMAND
15911 p1 S 0:00 /bin/login -h calvin raycomm.com -p
15914 p1 S 0:01 \_ -bash
16216 p1 T 0:00 \_ telnet
16217 p1 T 0:00 \_ lynx http://www.raycomm.com/
$ kill -9 16217
$ ps f
PID TTY STAT TIME COMMAND
15911 p1 S 0:00 /bin/login -h calvin raycomm.com -p
15914 p1 S 0:01 \_ -bash
16216 p1 T 0:00 \_ telnet
$

Commande10.1 : Les options de la commande echo permettent de contrôler la mise en forme des résultats affichés à l'écran
[moi@machine scripting]$ sh myscript
friendsjustfriends

standing
good

Commande10.2 : Avec un minimum de préparatifs, vous pouvez exécuter un script exécutable en tapant simplement son nom à l'invite du shell
[moi@machine scripting]$ head -2 myscript
#! /bin/sh
# This is my first shell script
[moi@machine scripting]$ chmod u+x myscript
[moi@machine scripting]$ pwd ; echo $PATH
/home/moi/scripting
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/games:/home/moi/bin:/home/moi/scripting
[moi@machine scripting]$ myscript
friendsjustfriends

standing
good

[moi@machine scripting]$

Commande10.3 : L'utilisation de commandes incorporées peut produire des résultats impressionnants
[moi@machine scripting]$ myscript
Greetings! Say, you're looking mighty sharp today!

You were most recently working on figlet.
[moi@machine scripting]$

Commande10.4 : Cette boucle de script rend compte à l'écran de la progression de la sauvegarde
[moi@machine scripting]$ more head_ache
#! /bin/sh
cd ~/www
for i in `ls -1 *.html`
do
cp $i $i.bak
echo "$i backed up!"
done

[moi@machine scripting]$ ./head_ache
above.html backed up!
file1.html backed up!
html.html backed up!
reference.html backed up!
temp.html backed up!
[moi@machine scripting]$

Commande10.5 : La dernière ligne imprimée par le script feedback diffère selon les fichiers trouvés
[moi@machine scripting]$ ./deef
Greetings! Say, you're looking mighty sharp today!

You were most recently working on scripting/.
Nope, no feedback yet
[moi@machine scripting]$ touch feedback
[moi@machine scripting]$ ./deef
Greetings! Say, you're looking mighty sharp today!

You were most recently working on scripting/.
There's feedback on the latest project
[moi@machine scripting]$

Commande10.6 : Vous pouvez contrôler un script par le biais d'entrées à la ligne de commande
[moi@machine scripting]$ more status-report
#! /bin/sh

mail boss@whereever.com -s "Status report for $1" < ~/reports/$1

[moi@machine scripting]$ ./status-report August
[moi@machine scripting]$

Commande10.7 : En implémentant une entrée de données à la ligne de commande pendant l'exécution d'un script, vous vous assurez de ne pas oublier de fournir les informations nécessaires à cette exécution
[moi@machine scripting]$ ./retentive
Which file do you want to analyze?
testfile
testfile has 11 misspelled words
and was last changed at 05:08 on Sep 12
[moi@machine scripting]$

Commande11.1 : N'ignorez pas le message éventuellement affiché à l'ouverture de vos sessions, et qui vous informe que vous avez reçu du courrier
Red Hat Linux release 5.1 (Manhattan)
Kernel 2.0.34 on an i486
login: moi
Password:
Last login: Sun Aug 2 07:41:00 on tty4
You have mail.
[moi@machine moi]$

Commande11.2 : A votre demande, le programme elm peut créer des boîtes de réception du courrier
[awr@machine awr]$ elm
Notice:
This version of ELM requires the use of a .elm directory in your home directory to store your elmrc and alias files. Shall I create the directory .elm for you and set it up (y/n/q)? n

Commande11.3 : Le programme mail permet d'envoyer rapidement un message court, en entrant l'adresse du destinataire et le texte du message directement à l'invite du shell
[moi@machine moi]$ mail debray
Subject: You're in big trouble now!
So, anyway, Winchester had perched
himself on my stereo turntable (those were
sooooo low-tech, weren't they?!). He was
waiting for me to turn on the stereo so he
could go back to sleep while spinning in
circles. I used to let him sleep that way
at night. Well, that was until one night
when the lid closed on him...
EOT
[moi@machine moi]$

Commande11.4 : Pour envoyer un fichier texte avec le programme mail, il suffit de rediriger le fichier vers mail
[moi@machine moi]$ mail unixvqs@raycomm.com < sendit.txt
[moi@machine moi]$

Commande11.5 : Les figlets ajoutent une touche originale aux courriers électroniques
[moi@machine moi]$ more figlet

_____ _____ _____
| __ \ / ____| |_ _|
| |__) |__ _ _ _| | ___ _ __ ___ _ __ ___ | | _ __ ___
| _ // _' | | | | | / _ \| '_ ' _ \| '_ ' _ \ | | | '_ \ / __|
| | \ \ (_| | |_| | |___| (_) | | | | | | | | | | |_ _| |_| | | | (__ _
|_| \_\__,_|\__, |\_____\___/|_| |_| |_|_| |_| |_( ) |_____|_| |_|\___(_)
__/ | |/
|___/

Commande11.6 : Votre fichier .forward doit contenir une référence au fichier du programme vacation
[moi@machine moi]$ cat .forward
\moi, "|vacation moi"
[moi@machine moi]$

Commande12.1 : Utilisez la commande ftp (anonyme) pour télécharger des fichiers à partir des archives à disposition des internautes sur Internet
[moi@machine moi]$ ftp calvin.raycomm.com
Connected to calvin.raycomm.com.
220 calvin Microsoft FTP Service (Version 2.0).
Name (calvin.raycomm.com:moi): anonymous
331 Anonymous access allowed, send identity (e-mail name) as password.
Password:
230 Anonymous user logged in.
Remote system type is Windows_NT.
ftp> cd /pub/files
250 CWD command successful.
ftp> binary
200 Type set to I.
ftp> hash
Hash mark printing on (1024 bytes/hash mark).
ftp> get jokearchive.gz
local: jokearchive.gz remote: jokearchive.gz
200 PORT command successful.
150 Opening BINARY mode data connection for jokearchive.gz(1481035 bytes).
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
######
226 Transfer complete.
1481035 bytes received in 4.07 secs (3.6e+02 Kbytes/sec)
ftp> quit
221

Commande12.2 : La commande put s'utilise pour partager des fichiers avec d'autres personnes sur Internet
[moi@machine moi]$ ftp ftp.raycomm.com
Connected to www.raycomm.com.
220 ftp.raycomm.com FTP server (NcFTPd 2.1.2, registered copy) ready.
Name (ftp.raycomm.com:moi): moiay
331 User moiay okay, need password.
Password:
230-You are user #8 of 100 simultaneous users allowed.
230-
230 Logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd incoming
250 "/home/ftp/pub/users/e/moiay/incoming" is new cwd.
ftp> binary
200 Type okay.
ftp> put myjokes.gz
local: myjokes.gz remote: myjokes.gz
200 PORT command successful.
150 Opening BINARY mode data connection.
226 Transfer completed.
128889 bytes sent in 15.5 secs (8.1 Kbytes/sec)
ftp> quit
221 C-ya!
[moi@machine moi]$

Commande12.3 : La commande ping permet de déterminer si la connexion avec un ordinateur spécifique est possible
[moi@machine moi]$ ping www.raycomm.com
PING www.raycomm.com (204.228.141.12): 56 data bytes
64 bytes from 204.228.141.12: icmp_seq=0 ttl=251 time=190.3 ms
64 bytes from 204.228.141.12: icmp_seq=1 ttl=251 time=197.7 ms
64 bytes from 204.228.141.12: icmp_seq=2 ttl=251 time=166.5 ms
64 bytes from 204.228.141.12: icmp_seq=3 ttl=251 time=157.5 ms

--- www.raycomm.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 157.5/178.0/197.7 ms
[moi@machine moi]$

Commande12.4 : Utilisez la commande traceroute pour connaître la route empruntée par vos données entre votre ordinateur et un ordinateur distant spécifique
moiay> traceroute www.yahoo.com
traceroute to www10.yahoo.com (204.71.200.75), 30 hops max, 40 byte packets
1 198.60.22.1 (198.60.22.1) 8 ms 2 ms 3 ms
2 903.Hssi5-0-0.GW1.SLT1.ALTER.NET (157.130.160.141) 18 ms 13 ms 14 ms
3 124.ATM4-0-0.CR1.SFO1.Alter.Net (137.39.68.9) 68 ms 65 ms 52 ms
4 311.atm3-0.gw1.sfo1.alter.net (137.39.13.49) 60 ms 50 ms 39 ms
5 Hssi1-0.br1.NUQ.globalcenter.net (157.130.193.150) 40 ms 39 ms 28 ms
6 pos0-1-155M.wr1.NUQ.globalcenter.net (206.132.160.25) 30 ms 48 ms 42 ms
7 pos1-0-622M.wr1.SNV.globalcenter.net (206.251.0.74) 50 ms 67 ms 61 ms
8 pos5-0-0-155M.cr1.SNV.globalcenter.net (206.251.0.105) 48 ms 40 ms 41 ms
9 www10.yahoo.com (204.71.200.75) 43 ms 50 ms 53 ms
moiay>

Commande12.5 : La commande nslookup permet de convertir manuellement un nom de domaine en une adresse IP
moiay> nslookup www.raycomm.com ns1.sierra.net
Server: ns1.sierra.net
Address: 207.135.224.247

Name: www.raycomm.com
Address: 204.228.141.12

moiay>

Commande13.1 : Utilisez la commande uuencode pour coder des fichiers, et optionnellement, pour rediriger la sortie vers un disque
[moi@machine compression]$ ls
Folder bigfile.uue folderzip.zip home.gz.uue
Zipadeedoodah file1.htm fortunes1.txt newzip.zip
bigfile.gz file2.html fortunes1.zip ournewhouse.jpg
bigfile.new.gz folder.tar gzip temp
[moi@machine compression]$ uuencode ournewhouse.jpg ourhouse.jpg > house.uue
[moi@machine compression]$ head house.uue
begin 664 ourhouse.jpg
M"<@>H@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("
M("'@4F%N9&]M(%5.25@@1F]R='5N97,A"@H*"@I)9B!Y;W4G<F4@;F]T('!A
M<G0@;V8@=&AE('-O;'5T:6]N+"!Y;W4G<F4@<&%R="!O9B!T:&4@<')E8VEP
M:71A=&4N"@H*"@I4:&4@;VYL>2!R96%L;'D@9V]O9"!P;&%C92!T;R!B=7D@
M;'5M8F5R(&ES(&%T(&$@<W1O<F4@=VAE<F4@=&AE(&QU;6)E<@IH87,@86QR
M96%D>2!B965N(&-U="!A;F0@871T86-H960@=&]G971H97(@:6X@=&AE(&9O
M<FT@;V8@9G5R;FET=7)E+'IF:6YI<VAE9"P@86YD('!U="!I;G-I9&4@8F]X
M97,N"B'@("'@("'@("'@("'@("'M+2!$879E($)A<G)Y+"'B5&AE(%1A;6EN
M9R!O9B!T:&4@4V-R97<B"@H*"@HB1&ES8V\@:7,@=&\@;75S:6,@=VAA="!%
[moi@machine compression]$

Commande13.2 : Vous pouvez uuencoder des fichiers et les envoyer par courrier électronique en une seule étape, pour plus d'efficacité
[moi@machine compression]$ uuencode ournewhouse.jpg house.jpg | mail -s "Here's the new picture" debray@raycomm.com
Commande13.3 : Le décodage de fichiers est un jeu d'enfant
[moi@machine compression]$ uudecode rowboat.uue
[moi@machine compression]$ ls -l row*
-rw-rw-r-- 1 moi users 128886 Jul 27 09:52 rowboat.jpg
-rw-r--r-- 1 moi users 177606 Jul 27 09:51 rowboat.uue
[moi@machine compression]$

Commande13.4 : Servez-vous de la commande head pour afficher le début d'un fichier. La ligne qui commence par "begin" indique explicitement qu'il s'agit d'un fichier codé, bénéficiant des permissions 644 et dont le nom est rowboat.jpg
[moi@machine compression]$ head rowboat.uue
begin 664 rowboat.jpg
M"<@>H@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("'@("
M("'@4F%N9&]M(%5.25@@1F]R='5N97,A"@H*"@I)9B!Y;W4G<F4@;F]T('!A
M<G0@;V8@=&AE('-O;'5T:6]N+"!Y;W4G<F4@<&%R="!O9B!T:&4@<')E8VEP
M:71A=&4N"@H*"@I4:&4@;VYL>2!R96%L;'D@9V]O9"!P;&%C92!T;R!B=7D@
M;'5M8F5R(&ES(&%T(&$@<W1O<F4@=VAE<F4@=&AE(&QU;6)E<@IH87,@86QR
M96%D>2!B965N(&-U="!A;F0@871T86-H960@=&]G971H97(@:6X@=&AE(&9O
M<FT@;V8@9G5R;FET=7)E+'IF:6YI<VAE9"P@86YD('!U="!I;G-I9&4@8F]X
M97,N"B'@("'@("'@("'@("'@("'M+2!$879E($)A<G)Y+"'B5&AE(%1A;6EN
M9R!O9B!T:&4@4V-R97<B"@H*"@HB1&ES8V\@:7,@=&\@;75S:6,@=VAA="!%
[moi@machine compression]$

Commande13.5 : La commande tar s'utilise pour rassembler des fichiers au sein d'un fichier unique
[moi@machine compression]$ ls -l
total 2290
drwxrwxr-x 2 moi users 1024 Jul 23 10:56 Feather
drwxrwxr-x 2 moi users 1024 Jul 23 10:49 Zipadeedoodah
-rw-rw-r-- 1 moi users 53678 Jul 23 06:42 bigfile.gz
-rw-rw-r-- 1 moi users 53678 Jul 23 10:16 bigfile.new.gz
-rw-rw-r-- 1 moi users 73989 Jul 23 10:16 bigfile.uue
-rw-rw-r-- 1 moi users 128886 Jul 23 11:45 file1.htm
-rw-rw-r-- 1 moi users 128886 Jul 23 11:45 file2.html
-rw-rw-r-- 1 moi users 686080 Jul 23 10:41 folder.tar
-rw-rw-r-- 1 moi users 268156 Jul 23 06:53 folderzip.zip
-rw-rw-r-- 1 moi users 128886 Jul 23 06:37 fortunes1.txt
-rw-rw-r-- 1 moi users 55124 Jul 23 06:38 fortunes1.zip
-rw-rw-r-- 1 moi users 0 Jul 23 11:21 gzip
-rw-rw-r-- 1 moi users 73978 Jul 23 11:15 home.gz.uue
-rw-r--r-- 1 moi users 177607 Jul 27 09:34 house.uue
-rw-rw-r-- 1 moi users 53792 Jul 23 06:52 newzip.zip
-rw-rw-r-- 1 moi users 128886 Jul 23 08:19 ournewhouse.jpg
-rw-rw-r-- 1 moi users 128886 Jul 27 09:52 rowboat.jpg
-rw-r--r-- 1 moi users 177606 Jul 27 09:51 rowboat.uue
drwxrwxr-x 3 moi users 1024 Jul 23 12:56 temp
[moi@machine compression]$ tar -cf tarredfilename.tar Feather
[moi@machine compression]$

Commande13.6 : Le désarchivage de fichiers restaure la structure de répertoire originale
[moi@machine compression]$ tar -xf labrea.tar
[moi@machine compression]$ ls -l Labrea/
total 483
-rw-r--r-- 1 moi users 53678 Jul 27 10:05 bigfile.gz
-rw-r--r-- 1 moi users 128886 Jul 27 10:06 mammoth.jpg
-rw-r--r-- 1 moi users 177607 Jul 27 10:05 house.uue
-rw-r--r-- 1 moi users 128886 Jul 27 10:06 rowboat.jpg
[moi@machine compression]$

Commande13.7 : Vous pouvez extraire un fichier spécifique d'une archive, par exemple pour remplacer un fichier manquant ou endommagé
[moi@machine compression]$ tar -xf labrea.tar "*mammoth*"
[moi@machine compression]$ ls -l Labrea/m*
-rw-r--r-- 1 moi users 128886 Jul 27 10:06 Labrea/mammoth.jpg
[moi@machine compression]$

Commande13.8 : Lister les fichiers avant et après compression permet de juger du gain de taille résultant de la compression
[moi@machine compression]$ ls -l l*
-rw-r--r-- 1 moi users 501760 Jul 27 10:06 labrea.tar
[moi@machine compression]$ compress labrea.tar
[moi@machine compression]$ ls -l l*
-rw-r--r-- 1 moi users 297027 Jul 27 10:06 labrea.tar.Z
[moi@machine compression]$

Commande13.9 : Vous pouvez décomprimer des fichiers par l'exécution d'une seule commande, et doubler ainsi (vraisemblablement) l'usage disque par la même occasion
[moi@machine compression]$ ls -l l*
-rw-r--r-- 1 moi users 297027 Jul 27 10:06 labrea.tar.Z
[moi@machine compression]$ uncompress labrea.tar.Z
[moi@machine compression]$ ls -l l*
-rw-r--r-- 1 moi users 501760 Jul 27 10:06 labrea.tar
[moi@machine compression]$

Commande13.10 : Utilisez la commande gzip pour comprimer les fichiers d'archivage
[moi@machine compression]$ ls -l z*
-rw-r--r-- 1 moi users 501760 Jul 27 10:22 zipadeedoodah.tar
[moi@machine compression]$ gzip zipadeedoodah.tar
[moi@machine compression]$ ls -l z*
-rw-r--r-- 1 moi users 239815 Jul 27 10:22 zipadeedoodah.tar.gz
[moi@machine compression]$

Commande13.11 : Utilisez la commande gunzip pour décomprimer des fichiers zippés
[moi@machine compression]$ ls -l *.gz
-rw-rw-r-- 1 moi users 53678 Jul 23 06:42 bigfile.gz
-rw-rw-r-- 1 moi users 53678 Jul 23 10:16 bigfile.new.gz
-rw-r--r-- 1 moi users 239819 Jul 27 10:22 zipadeedoodah.tar.gz
[moi@machine compression]$ gunzip zipadeedoodah.tar
[moi@machine compression]$ ls -l z*
-rw-r--r-- 1 moi users 501760 Jul 27 10:22 zipadeedoodah.tar
[moi@machine compression]$ ls -l *.gz
-rw-rw-r-- 1 moi users 53678 Jul 23 06:42 bigfile.gz
-rw-rw-r-- 1 moi users 53678 Jul 23 10:16 bigfile.new.gz
[moi@machine compression]$

Commande13.12 : Utilisez zip pour comprimer des fichiers, notamment si vous prévoyez de partager les fichiers avec des utilisateurs Windows
[moi@machine compression]$ ls -l z*
-rw-r--r-- 1 moi users 501760 Jul 27 10:22 zipadeedoodah
[moi@machine compression]$ zip zipped zipadeedoodah
adding: zipadeedoodah.tar (deflated 52%)
[moi@machine compression]$ ls -l z*
-rw-r--r-- 1 moi users 501760 Jul 27 10:22 zipadeedoodah
-rw-r--r-- 1 moi users 239943 Jul 27 10:41 zipped.zip
[moi@machine compression]$

Commande13.13 : La commande unzip permet de décomprimer des fichiers zippés
[moi@machine compression]$ ls -l *.zip
-rw-rw-r-- 1 moi users 268156 Jul 23 06:53 folderzip.zip
-rw-rw-r-- 1 moi users 55124 _Jul 23 06:38 fortunes1.zip
-rw-rw-r-- 1 moi users 53792 Jul 23 06:52 newzip.zip
-rw-r--r-- 1 moi users 239943 Jul 27 10:41 zipped.zip
[moi@machine compression]$ unzip zipped.zip
Archive: zipped.zip
replace zipadeedoodah.tar? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: zipadeedoodah.tar
[moi@machine compression]$

Commande13.14 : Le code pour décoder et dézipper en une seule étape est un peu abscons, mais permet finalement d'économiser du temps et des efforts
[moi@machine compression]$ ls -l h*
-rw-rw-r-- 1 moi users 73978 Jul 23 11:15 home.gz.uue
-rw-r--r-- 1 moi users 177607 Jul 27 09:34 house.uue
[moi@machine compression]$ uudecode -o /dev/stdout home.gz.uue | gunzip > home
[moi@machine compression]$ ls -l h*
-rw-r--r-- 1 moi users 128886 Jul 27 10:48 home
-rw-rw-r-- 1 moi users 73978 Jul 23 11:15 home.gz.uue
-rw-r--r-- 1 moi users 177607 Jul 27 09:34 house.uue
[moi@machine compression]$

Commande13.15 : Lorsque vous avez localisé les fichiers comprimés qui vous intéressent, vous pouvez les décomprimer et les désarchiver en une seule fois. Vérifiez ensuite le résultat obtenu avec la commande ls -ld (format long et répertoires)
[moi@machine compression]$ ls -l *.Z
-rw-r--r-- 1 moi users 297027 Jul 27 10:06 labrea.tar.Z
[moi@machine compression]$ uncompress labrea.tar.Z | tar -xf -
[moi@machine compression]$ ls -l l*
-rw-r--r-- 1 moi users 501760 Jul 27 10:06 labrea.tar
[moi@machine compression]$ ls -ld L*
drwxr-xr-x 2 moi users 1024 Jul 27 10:16 Labrea
[moi@machine compression]$

Commande13.16 : Vous pouvez également archiver et gzipper des fichiers en une seule fois
[moi@machine compression]$ ls -ld F*
drwxrwxr-x 2 moi users 1024 Jul 23 10:56 Feather
[moi@machine compression]$ tar -cf - Feather | gzip > feather.tar.gz
[moi@machine compression]$ ls -l f*
-rw-r--r-- 1 moi users 106752 Jul 27 10:54 feather.tar.gz
-rw-rw-r-- 1 moi users 128886 Jul 23 11:45 file1.htm
-rw-rw-r-- 1 moi users 128886 Jul 23 11:45 file2.html
-rw-rw-r-- 1 moi users 686080 Jul 23 10:41 folder.tar
-rw-rw-r-- 1 moi users 268156 Jul 23 06:53 folderzip.zip
-rw-rw-r-- 1 moi users 128886 Jul 23 06:37 fortunes1.txt
-rw-rw-r-- 1 moi users 55124 Jul 23 06:38 fortunes1.zip
[moi@machine compression]

Commande14.1 : Le téléchargement d'un logiciel est un processus un peu long, mais sans difficulté majeure
[moi@machine moi]$ ftp ftp.cdrom.com
Connected to wcarchive.cdrom.com.
220 wcarchive.cdrom.com FTP server (Version DG-3.1.21 Fri Jul 31 05:07:36 PDT 19
8) ready.
Name (ftp.cdrom.com:moi): anonymous
331 Guest login ok, send your email address as password.
Password:
230-Welcome to wcarchive - home FTP site for Walnut Creek CDROM.
230-There are currently 3197 users out of 3200 possible.
230-
230-Most of the files in this area are also available on CDROM. You can send
230-email to info@cdrom.com for more information or to order, or visit our Web
230-site at http://www.cdrom.com. For tech support about our products, please
230-email support@cdrom.com. You may also call our toll-free number:
230-1-800-786-9907 or +1-510-674-0783. Please keep in mind that we only offer
230-technical support for our CDROM products and not for the files on our
230-FTP server.
230-
230-Please send mail to ftp-bugs@ftp.cdrom.com if you experience any problems.
230-Please also let us know if there is something we don't have that you think
230-we should!
230-
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd pub/linux/redhat/code/rpm
250 CWD command successful.
ftp> binary
200 Type set to I.
ftp> get rpm-2.5.1.tar.gz
local: rpm-2.5.1.tar.gz remote: rpm-2.5.1.tar.gz
200 PORT command successful.
150 Opening BINARY mode data connection for 'rpm-2.5.1.tar.gz' (589054 bytes).
226 Transfer complete.
589054 bytes received in 350 secs (1.6 Kbytes/sec)
ftp> quit
221 Goodbye!
[moi@machine moi]$ mv rpm-2.5.1.tar.gz ~/src/rpm-2.5.1.tar.gz
[moi@machine moi]$ cd ~/src
[moi@machine src]$ gunzip rpm-2.5.1.tar.gz
[moi@machine src]$ tar -ixf rpm-2.5.1.tar
[moi@machine src]$ cd rpm-2.5.1
[moi@machine rpm-2.5.1]$

Commande14.2 : Il est essentiel de lire les instructions fournies avec le logiciel
[moi@machine rpm-2.5.1]$ more README*
::::::::::::::
README
::::::::::::::
This is RPM, the Red Hat Package Manager.

The latest releases are always available at:

ftp://ftp.redhat.com/pub/redhat/code/rpm

Additional RPM documentation (papers, slides, HOWTOs) can also be
found at the same site.

There is a mailing list for discussion of RPM issues, rpm-list@redhat.com.
To subscribe, send a message to rpm-list-request@redhat.com with the word
"subscribe" in the subject line.

RPM was written and is maintained by:

Erik Troan <ewt@redhat.com>
Marc Ewing <marc@redhat.com>

See the CREDITS file for a list of folks who have helped us out
tremendously. RPM is Copyright (c) 1997 by Red Hat Software, Inc.,
--More--(89%)

Commande14.3 : Le programme ./configure se charge de la configuration du programme
[moi@machine rpm-2.5.1]$ ./configure
loading cache ./config.cache
checking host system type... i486-unknown-linux
checking target system type... i486-unknown-linux
checking build system type... i486-unknown-linux
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking how to run the C preprocessor... (cached) gcc -E
checking whether gcc needs -traditional... (cached) no
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking what additional CFLAGS are needed to link statically... -static
checking POSIX chmod...... yes
checking for mkdir... (cached) /bin/mkdir
checking if /bin/mkdir supports -p... yes
checking for AIX... no
checking for minix/config.h... (cached) no
checking for POSIXized ISC... no
checking for mawk... (cached) gawk
checking whether ln -s works... (cached) yes
checking whether make sets ${MAKE}... (cached) yes
checking for ranlib... (cached) ranlib
checking for ar... (cached) ar
checking GNU gzip...... yes
checking for bzip2...... no
configure: warning: RPM will not work without GNU gzip.
checking old version of patch... patch later then 2.2 found

creating ./config.status
creating Makefile
[moi@machine rpm-2.5.1]$ cp Makefile Makefile.bak
[moi@machine rpm-2.5.1]$

Commande14.4 : Les commandes make et make install génèrent toutes deux à l'écran un charabia incroyable (mais, espérons-le, sans message d'erreur)
[moi@machine rpm-2.5.1]$ make
for d in popt lib build tools po; do \
(cd $d; make) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;\
done && test -z "$fail"
make[1]: Entering directory '/home/moi/src/rpm-2.5.1/popt'
gcc -g -O2 -DHAVE_UNISTD_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_MMAP=1 -DHAVE_STRERROR=1
-c popt.c -o popt.o
ar rv libpopt.a popt.o
a - popt.o
ranlib libpopt.a
make[1]: Leaving directory '/home/moi/src/rpm-2.5.1/popt'
make[1]: Entering directory '/home/moi/src/rpm-2.5.1/lib'
gcc -I/home/moi/src/rpm-2.5.1 -I/home/moi/src/rpm-2.5.1 -g -O2 -DHAVE_CONFIG_H
I/home/moi/src/rpm-2.5.1/lib -I/home/moi/src/rpm-2.5.1/misc -c header.c -o hea
er.o

gcc -o rpm2cpio -L/home/moi/src/rpm-2.5.1/lib -L/home/moi/src/rpm-2.5.1/build -L
home/moi/src/rpm-2.5.1/misc -L/home/moi/src/rpm-2.5.1/popt rpm2cpio.o -lrpmbuild
-lpopt -lrpm -ldb -L/usr/local/lib -lz
[moi@machine rpm-2.5.1]$

Commande14.5 : Tapez make install pour achever le processus d'installation
[moi@machine rpm-2.5.1]$ make install
for d in popt lib build tools po; do \
(cd $d; make) \
|| case "" in *k*) fail=yes;; *) exit 1;; esac;\
done && test -z "$fail"
make[1]: Entering directory '/home/moi/src/rpm-2.5.1/popt'
make[1]: 'libpopt.a' is up to date.
make[1]: Leaving directory '/home/moi/src/rpm-2.5.1/popt'
make[1]: Entering directory '/home/moi/src/rpm-2.5.1/lib'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/moi/src/rpm-2.5.1/lib'
make[1]: Entering directory '/home/moi/src/rpm-2.5.1/build'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/moi/src/rpm-2.5.1/build'
make[1]: Entering directory '/home/moi/src/rpm-2.5.1/tools'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/moi/src/rpm-2.5.1/tools'
make[1]: Entering directory '/home/moi/src/rpm-2.5.1/po'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/moi/src/rpm-2.5.1/po'

/usr/bin/install -c -m 755 -d /home/moi//usr/local/share/locale/$l/LC_MESSAG
S; \
/usr/bin/install -c -m 644 $n /home/moi//usr/local/share/locale/$l/LC_MESSAG
S/rpm.mo; \
done
make[1]: Leaving directory '/home/moi/src/rpm-2.5.1/po'
[moi@machine rpm-2.5.1]$

Commande14.6 : Et voilà l'installation terminée ! Le programme rpm est à présent opérationnel dans le système
[moi@machine rpm-2.5.1]$ ./rpm
Unable to open /usr/local/lib/rpmrc for reading: No such file or directory.
[moi@machine rpm-2.5.1]$

[moi@machine rpm-2.5.1]$ ./rpm --rcfile ./lib-rpmrc
RPM version 2.5
Copyright (C) 1998 - Red Hat Software
This may be freely redistributed under the terms of the GNU Public License

usage: rpm {--help}
rpm {--version}
rpm {--initdb} [--dbpath <dir>]
rpm {--install -i} [-v] [--hash -h] [--percent] [--force] [--test]
[--replacepkgs] [--replacefiles] [--root <dir>]
[--excludedocs] [--includedocs] [--noscripts]
[--rcfile <file>] [--ignorearch] [--dbpath <dir>]
[--prefix <dir>] [--ignoreos] [--nodeps] [--allfiles]
[--ftpproxy <host>] [--ftpport <port>] [--justdb]
[--noorder] [--relocate oldpath=newpath]
[--badreloc] file1.rpm ... fileN.rpm
rpm {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]
[--oldpackage] [--root <dir>] [--noscripts]
[--excludedocs] [--includedocs] [--rcfile <file>]
[--ignorearch] [--dbpath <dir>] [--prefix <dir>]
[--ftpproxy <host>] [--ftpport <port>]
[--ignoreos] [--nodeps] [--allfiles] [--justdb]
[--noorder] [--relocate oldpath=newpath]
[--badreloc] file1.rpm ... fileN.rpm
rpm {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]
[--scripts] [--root <dir>] [--rcfile <file>]
[--whatprovides] [--whatrequires] [--requires]
[--ftpuseport] [--ftpproxy <host>] [--ftpport <port>]
[--provides] [--dump] [--dbpath <dir>] [--changelog]
[targets]
rpm {--verify -V -y} [-afpg] [--root <dir>] [--rcfile <file>]
[--dbpath <dir>] [--nodeps] [--nofiles] [--noscripts]
[--nomd5] [targets]
rpm {--setperms} [-afpg] [target]
rpm {--setugids} [-afpg] [target]
rpm {--erase -e} [--root <dir>] [--noscripts] [--rcfile <file>]
[--dbpath <dir>] [--nodeps] [--allmatches]
[--justdb] package1 ... packageN
rpm {-b|t}[plciba] [-v] [--short-circuit] [--clean] [--rcfile <file>]
[--sign] [--test] [--timecheck <s>] [--buildos <os>]
[--buildarch <arch>] [--rmsource] specfile
rpm {--rmsource} [--rcfile <file>] [-v] specfile
rpm {--rebuild} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm
rpm {--recompile} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm
rpm {--resign} [--rcfile <file>] package1 package2 ... packageN
rpm {--addsign} [--rcfile <file>] package1 package2 ... packageN
rpm {--checksig -K} [--nopgp] [--nomd5] [--rcfile <file>]
package1 ... packageN
rpm {--rebuilddb} [--rcfile <file>] [--dbpath <dir>]
rpm {--querytags}
[moi@machine rpm-2.5.1]$

Commande15.1 : Utilisez simplement cal pour obtenir le calendrier du mois en cours, ou ajoutez des options pour afficher d'autres dates et calendriers
[moi@machine ch15]$ cal
August 1998
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
[moi@machine ch15]$ cal -j
August 1998
Sun Mon Tue Wed Thu Fri Sat
213
214 215 216 217 218 219 220
221 222 223 224 225 226 227
228 229 230 231 232 233 234
235 236 237 238 239 240 241
242 243
[moi@machine ch15]$ cal 1999 | more
1999

January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 1 2 3 4 5 6 1 2 3 4 5 6
3 4 5 6 7 8 9 7 8 9 10 11 12 13 7 8 9 10 11 12 13
10 11 12 13 14 15 16 14 15 16 17 18 19 20 14 15 16 17 18 19 20
17 18 19 20 21 22 23 21 22 23 24 25 26 27 21 22 23 24 25 26 27
24 25 26 27 28 29 30 28 28 29 30 31
31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 1 1 2 3 4 5
4 5 6 7 8 9 10 2 3 4 5 6 7 8 6 7 8 9 10 11 12
11 12 13 14 15 16 17 9 10 11 12 13 14 15 13 14 15 16 17 18 19
18 19 20 21 22 23 24 16 17 18 19 20 21 22 20 21 22 23 24 25 26
25 26 27 28 29 30 23 24 25 26 27 28 29 27 28 29 30
30 31
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 1 2 3 4 5 6 7 1 2 3 4
4 5 6 7 8 9 10 8 9 10 11 12 13 14 5 6 7 8 9 10 11
11 12 13 14 15 16 17 15 16 17 18 19 20 21 12 13 14 15 16 17 18
18 19 20 21 22 23 24 22 23 24 25 26 27 28 19 20 21 22 23 24 25
25 26 27 28 29 30 31 29 30 31 26 27 28 29 30

October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 1 2 3 4 5 6 1 2 3 4
3 4 5 6 7 8 9 7 8 9 10 11 12 13 5 6 7 8 9 10 11
10 11 12 13 14 15 16 14 15 16 17 18 19 20 12 13 14 15 16 17 18
17 18 19 20 21 22 23 21 22 23 24 25 26 27 19 20 21 22 23 24 25
24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31
31

[moi@machine ch15]$ cal 12 1941
December 1941
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

[moi@machine ch15]$

Commande15.2 : A votre demande, le système vous présente les mémos du jour
xmission> calendar
august 28 On this date in history, nothing special happened. We think.
xmission>

Commande15.3 : L'utilitaire bc est une calculette très pratique
xmission> bc
6*5
30
xmission>

Commande15.4 : La commande script permet d'enregistrer facilement le déroulement d'une session
[moi@machine ch15]$ more covermybutt
Script started on Fri Aug 28 14:30:16 1998
[moi@machine ch15]$ pwd
/home/moi/ch15
[moi@machine ch15]$ who
root tty1 Aug 28 14:18
moi ttyp0 Aug 28 14:20 (calvin.raycomm.com)
moi ttyp1 Aug 28 14:28 (calvin.raycomm.com)
[moi@machine ch15]$ ps ax
PID TTY STAT TIME COMMAND
1 ? S 0:02 init [3]
2 ? SW 0:00 (kflushd)
3 ? SW< 0:00 (kswapd)
48 ? S 0:00 /sbin/kerneld
229 ? S 0:00 syslogd
238 ? S 0:00 klogd
260 ? S 0:00 crond
272 ? S 0:00 inetd
283 ? S 0:00 lpd
298 ? S 0:00 sendmail: accepting connections on port 25

310 ? S 0:00 gpm -t ms
321 ? S 0:00 httpd

355 ? S 0:00 nmbd -D
368 1 S 0:00 /bin/login -- root
369 2 S 0:00 /sbin/mingetty tty2
370 3 S 0:00 /sbin/mingetty tty3
371 4 S 0:00 /sbin/mingetty tty4
372 5 S 0:00 /sbin/mingetty tty5
373 6 S 0:00 /sbin/mingetty tty6
375 ? S 0:00 update (bdflush)
381 1 S 0:00 -bash
402 ? S 0:00 in.telnetd
436 ? S 0:00 in.telnetd
249 ? S 0:00 /usr/sbin/atd
327 ? S 0:00 httpd
328 ? S 0:00 httpd
329 ? S 0:00 httpd
330 ? S 0:00 httpd
331 ? S 0:00 httpd
332 ? S 0:00 httpd
333 ? S 0:00 httpd
334 ? S 0:00 httpd
335 ? S 0:00 httpd

403 p0 S 0:00 /bin/login -h calvin raycomm.com -p
404 p0 S 0:00 -bash
437 p1 S 0:00 /bin/login -h calvin raycomm.com -p
438 p1 S 0:00 -bash
449 p1 S 0:00 ispell gudspeler
450 p0 S 0:00 script covermybutt
451 p0 S 0:00 script covermybutt
452 p3 S 0:00 bash -i
455 p3 R 0:00 ps ax
[moi@machine ch15]$ exit

Script done on Fri Aug 28 14:30:44 1998
[moi@machine ch15]$

Commande16.1 : Vous pouvez utiliser la commande sed pour éliminer toutes les balises HTML gênantes, comme dans cet exemple
[moi@machine scripting]$ more thestinkinblinkintag
#! /bin/sh

for i in `ls -1 *.htm*`
do
cp $i $i.bak
sed "s/<\/*BLINK>//g" $i > $i
echo "$i is done!"
done

[moi@machine scripting]$ chmod u+x thestinkinblinkintag
[moi@machine scripting]$ ./thestinkinblinkintag
above.htm is done!
file1.htm is done!
file2.htm is done!
html.htm is done!
temp.htm is done!
[moi@machine scripting]$

Commande16.2 : Utilisez la commande awk pour générer des rapports succincts
[moi@machine /home]$ ls -la | awk '{print $9 " owned by " $3 } END { print NR " Total Files" }'
owned by
. owned by root
.. owned by root
admin owned by admin
anyone owned by anyone
asr owned by asr
awr owned by awr
bash owned by bash
csh owned by csh
deb owned by deb
debray owned by debray
moi owned by moi
moiay owned by moiay
ftp owned by root
httpd owned by httpd
lost+found owned by root
merrilee owned by merrilee
oldstuff owned by 1000
pcguest owned by pcguest
raycomm owned by pcguest
samba owned by root
shared owned by root
22 Total Files
[moi@machine /home]$

Commande16.3 : Vous pouvez amener le système à s'enquérir systématiquement de vos préférences
[moi@machine moi]$ su - moi
Password:
Which editor do you want as the default? (vi or pico)
vi
You chose vi!
[moi@machine moi]$

Commande16.4 : Vous pouvez utiliser une commande sed pour coder et décoder vos messages en ROT13
[moi@machine creative]$ sed -f script.sed limerick
Bhe snibevgr yvzrevpx
1.
Gurer bapr jnf n zna sebz Anaghpxrg,
Jub pneevrq uvf yhapu va n ohpxrg,
Fnvq ur jvgu n fvtu,
Nf ur ngr n jubyr cvr,
Vs V whfg unq n qbahg V'q qhax vg.
[moi@machine creative]$ sed -f script.sed limerick | sed -f script.sed
Our favorite limerick
1.
There once was a man from Nantucket,
Who carried his lunch in a bucket,
Said he with a sigh,
As he ate a whole pie,
If I just had a donut I'd dunk it.
[moi@machine creative]$

Commande16.5 : Ce script tire parti de diverses notions exposées tout au long de cet ouvrage
[moi@machine creative]$ more rot13
#! /bin/sh

# If the first item (after the script name) on the command
# line is save or s, and the second item is a readable file
# then do the first case.
if [ \( "$1" = "save" -o "$1" = "s" \) -a \( -r "$2" \) ]
then

# This case saves the ROT13 output under the same filename with
# a rot13 extension.
/bin/sed y/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM/ $2 > $2.rot13
else

# This case pipes the ROT13 output to more, because a save
# wasn't specified.
/bin/sed y/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM/ $1 | more

fi

[moi@machine creative]$


Liens utils  
 
 
 
 
 
 
 
 
 
 
 

developpez.com forums

 

 

Copyright © 2004-2006 Mohamed KARAMI

Page HTML 4.01 valide Feuille de style CSS valide

Dernière MAJ : 24/10/2006