Ce document rappelle les commandes et les options les plus utilisées par l’administrateur d’un système Linux. Il s’agit surtout de commandes assez générales, dont tout administrateur aura besoin un jour ou l’autre. Les commandes pour l’utilisateur courant se trouvent dans un autre aide-mémoire. Pour plus d’informations, on consultera les pages de manuel ou les publications du Linux Documentation Project (http://www.tldp.org/)
Informations système
uname
-a !
dmesg " # $ % & '
uptime ( ) #
free * ! )
vmstat () ! !+ ! ! )
ipcs , ! - .
ipcrm - .
ldconfig . ! ! &&! / /
init # 0
0 1
1 2 ! 3
3 !2 ! % 3
5 !2 ! # / 3
6 )
Utilisateurs
useradd 4 + !
useradd –m –p "" linus
) 3 0 ) !
0
userdel + !
userdel –r linus
! ! )
passwd " +
passwd linus
Partitions et systèmes de fichiers
fdisk 5 ! &!
fdisk /dev/hda
mkswap ) + 6 7
mkswap /dev/hda2 mkswap /boot/swap_file
swapon 0 + 6 7
swapon /dev/hda2
-a 0 ! 6 7 /etc/fstab
swapoff –() 0 + 6 7
swapoff /dev/hda2
mkfs ) +
mkfs.ext2 /dev/hda3 mkfs.ext3 /dev/hda4 mkfs.vfat /dev/hda5
fsck .) +
fsck.ext2 –p /dev/hda3
) / + % 8 %93
fsck.vfat /dev/hda4
0) + : 7
mount !
mount –t vfat /dev/hda4 /mnt/dos/
: 7 3 mount –a
! /etc/fstab3
mount 192.1.1.254:/home /home/users/
" # + ) ;<
* 0 –o /etc/fstab
default 73 3 03 % 3 3 3 3
remount # ! & + )3
rw ! ) 3 ro ! !3
noauto / 0 2 3
nodev ! ) %3
noexec %) &! 3 nosuid=# ! & 2, (8> (3
sync ) 3
user 1 ) !
?
%3 % 3 %93 3 0 3 3 @AA 3 &
umount () # +
-a ) ! /etc/mtab
umount /dev/hda4 umount /mnt/dos umount –a
df * )
Distribution / installation de logiciel
tar > + 0 -c ) + 0 3 -x % + 0 3
-t ! + 0 3
-f 0 3
-v 0 !&!3
-z $)' 0 #$ '6 3 -j $)' 0 &$ '6
tar –czf archive.tar.gz distrib/
) 0 ) ) distrib/3
tar –tvf archive.tar
! ! !+ 0 3
tar –xjf archive.tar.bz2
% ! + 0 )
installation classique
tar –xzf application-1.01.tar.gz cd application-1.01
./configure
make && make install
rpm – > / # B C
-h # ! # 0 !
rpm –ivh paquet.rpm
!! + / # 3
rpm –Uvh paquet.rpm
D4 8 !! + / # 3
rpm –Fvh paquet.rpm
D4 + / # )4D !!)3 rpm –e paquet
) !! + / # 3
rpm –qa
! ! / # !!)3
rpm –qf /chemin/fichier
/ # / ! ! 3
rpm –qip paquet.rpm / # 3 rpm –qlp paquet.rpm
! ! / #
apt > / # ( &
apt-get install application
!! !+ ! )0 !! 3
apt-get remove application
! ) )0 !! 3
apt-get update
D4 ! & ) 3
apt-get upgrade D4
Gestion des processus
application &
! !+ ! D!+ 2 ! 3 fg 1
D!+0 2 ! ! 4& ) E3 (Ctrl-Z)
!+ ! D!+0 2 ! 3 bg
! D!+ 2 ! 4&
ps 5 ps –ef ps –aux
# ! # !
top #
-d )! F
renice # ! +
renice +5 12857
# ! E GHI H )3
renice –5 –u root
H! !
kill 0 # !D
kill –15 12857
-l$! !' ! # % &!
killall ? ! 1
killall –9 boucle_fork
fuser ) D
fuser –k –m /dev/hda5
! ) D! / )
Utilitaires réseau
ifconfig # )
ifconfig -a
! # ! ) 3
ifconfig eth0 192.1.1.50
# !
route > ! &! #
route add -net 192.1.1.0 eth0
4 / 0 !+ eth03
route add -net 172.1.1.0 gw 192.1.1.5
4 ) &! !!3
route add default eth1
4 ) 3
route del default
! )
socklist J 0
netstat / )
netstat –r
! &! # 3
netstat –i
!+) ) 3
netstat –a
!+) J
arp > ! &! B-
-a ! ) ! B-3
arp –d hote
! ) !+K / )
ping +) 0 + K
ping –c 1 –w 2 192.1.1.53
! / 1 ! 3
ping –b 192.1.1.255
/ 1 ) & D ! K )
traceroute 4 K
traceroute www.destination.com
-n ) ! ) /
tcpdump % )
tcpdump –i eth0
/ ! eth03 tcpdump –i eth0 port telnet
! # 8 0 ! 9$ '
telnet % ? -8 - telnet mail.isp.com pop-3
% EE $ ' 0
rsh %) + !!
ssh %) ) ) + !!
ftp ?
!!
open 0 #
cd8 8 8
lcd8 8! !8 get
put prompt mgetL mputL
wget B ! + ,B
wget http://www.site.com/repertoire/
-c )4D )3
-r # ) 0 ! ! 3
-l niveau % ! ) 3
-k 0 ! ! ! %
Signaux fréquemment utilisés
0 # !0) ! ) + 3
1$SIGHUP' % 3
2$SIGINT3 !2 ' ) # 3 3$SIGQUIT3 !2M' ) 0 3 9$SIGKILL' &!# ) 3
15$SIGTERM' !
Gestion des modules du noyau
lsmod ! #)
modinfo !
insmod + ! !
insmod module.o
rmmod + !) #)
rmmod module
depmod .) )
depmod –an
modprobe # #) ! )
modprobe module.o
Compilation d’un noyau Linux
ftp ftp.kernel.org
) ) ! ) )$ % ' !
) /pub/linux/kernel/3 tar –xjf linux-XXXX.tar.bz2 cd linux-XXXX
make mrproper make menuconfig
0 ! # ) ) 3
make dep clean bzImage $ ≤ ' make $ ≥ A'
- 3
make modules && make modules_install cp System.map /boot/System.map-XXXX cd arch/i386/boot/
cp bzImage /boot/vmlinuz-XXXX vi /etc/lilo.conf
4 !+ ) ! 0 3
/sbin/lilo /sbin/init 6
! 88777 &! #8