Aide-mémoire des commandes Unix de M à Z

Transcription

Aide-mémoire des commandes Unix de M à Z
nohup
#
!!
#
$ nohup ~/bin/calcul &
[1] 17300
$ exit
Ce document regroupe les principales commandes
susceptibles d’être employées par les stagiaires de la
formation « Programmation Shell et Langages de
Scripts », en rappelant leurs options les plus utilisées.
Pour avoir plus de détail sur une commande
particulière, on consultera le manuel Unix (commande
man)
ake
man
!
numéro
-a
-t
%
-k $
&
!!
man 1 c
man -k socket
" #
$
apropos
md5sum
mkdir
!
'
( )*
-p
!
-m mode #
+ ,
mkdir -p /var/lib/new-app/font/big
mkfifo
-.-/ 0 1
!! 2
-m mode #
+ ,
mkfifo -m 666 /tmp/fifo_serveur
mknod
#
b
c
1
,
mknod /dev/hda1 b 3 1
!
! 3 4!
546
more
0 less2
mv )
!!
-f
+
!
for i in *.JPG; do mv $i ${i%JPG}jpg;
done
!!
7%8
3
ice
#
!
-n valeur
nl 9 !
-f a !
!!
!
!
+
d
!
-c
-x
asswd
1
!
#
+
! 1
! #
+
$
= ,!
+
renice +20 14210
+
0
#
= ,!
0
ssh2
rev .
rlogin
!!
!
= ,!
ssh2
cript
!
$
rmdir
rsh #
0
$ passwd
# passwd utilisateur
patch
$
!
&
-pn
,
1
!
$ patch –p1 ../new_version/patch_1
pathchk :
+
!
-p
1
if pathchk "$rep/$fic" ; then...
perl .
%
-w !
ping ;
!
-c !1
-w
! #!
pr %
#
+!
-h texte
$ +'<
$
-l n
-t
!
'<
printf
! $
!
printf "%05d %4.2f" $x $y
ps
+
-ax
0 )2
-u
!
! , 0 )2
-e
0 = :2
-f
!
! , 0 = :2
-w
ps -aux
(BSD)
ps -ef
(SysV)
pwd
!
uota
cp
>
renice (
rm
-f
!
-i
!
$
-r
!
'
rm -rf /home/usera/tmp
+
,
#
tac2
'a fic 3
sed ?
'
-e "..." !!
-f fic !!
-n
! +
!!
@
p
d
n
&
s
!
!
sed -ne '1,/^$/p' < mail.txt
#
+'< + !
sh
sleep
!
sleep 14
06
2
sleep 3m
05!
2
sort ;
+
#
-b
1
1
-f
! 3
4!
-r
split )
-l n
-b n
split -b 1440k gros_fichier disquette_
ssh
#
= ,!
ssh user@hostname
ssh –l user hostname /usr/bin/commande
strings
>
stty
!
-a
sane
!
-echo
+
,
-icanon min 0 time 1
, &
su #
".)
8.)
- #
sum
ac
tail
!!
A
!1
,
1
&+
tee
-a 3
!
...| tee hublot_1.log | ...
telnet
#
= ,!
0
ssh2
test ;= +
!
= =!
!!
[...]
if test –f $fichier ; then
time
!
!!
!
touch (
+
+
-t MMJJhhmm
$
-r fichier
+
tr ;
!
,
tr ‘àâäçéèêïîôöùû’ ‘aaaceeeiioouu’|...
true C
&
while true; do ...
tty
!
!
+
!
= ,!
-m =
!
-n
! +A
-r
= ,!
-s = ,! +#
-a
!
uncompress ) !
unexpand
0
expand2
$
-u +
-d +
-c
+
-num
!1
$
-f
!
tail -f /var/log/messages
tar "
+
-f fic
!
+
-c
-t
+
-x #
+
-z
$ 8
B
0 2 !
-j
$ 1B
0 2 !
-v !
1
tar -czf save.tar.gz /home/usera/*
tar -xzf appli-1.10.tgz
tcl .
; 0
wish2
name
uniq D
$
$
$
$
!1
+
unix2dos
unzip ) !
uptime ; !
users 9 !
uudecode )
uuencode
i?
:
E'F
#
! " #
! )
.zip
!
= ,!
.uu
1
alpha
,
digit
xdigit
alnum
,
lower !
upper ! 3
blank
,
space
,
punct
graph =!1
print =!1
cntrl
,
+
$ ./commande &
[1] 2927
./commande
$ wait 2927
[1]+ Done
./commande
$
wc 9 !1
, !
+
whereis C
#
1
!
+
!!
which
!
+ ,
!!
who (
$
whoami
".)
wish .
;
11
,$ ;H
#
!!
find . -name "*.c" | xargs grep "init()"
=
= #$
>
0
Iy 2
yes | rm -r /var/old-backup/
cat
zip !
!
1
Expressions rationnelles
!
,
1 $
! #
#
! #
! $
1
1
1
1
A
!
|
Y|y
+
!
?
! B
[+-]?[[:digit:]]+
{ }
!
!1
( )
!
\|
\+
\?
\{ \}
\( \)
Éléments communs
\
!
prix=25\$
>
>
Équivalences pour les expressions rationnelles
simples
grep sed find –regex
#
grep –e awk perl
#
.Z
,
Éléments des expressions rationnelles étendues
args
!
$
Classes de caractères
G @ gvim
ait
acc 8
yes
. !
!
g.n.rique
J
1
K
^$
0
2
*
$ B
[ ]
[eéêèë]
[0-9]
[[:upper:]]
,!
\i
|
+
?
#
#
#
#{}
#()
#
#
44GGG 1
,
#
4