Aide-m ém oire adm inistrateur Linux

Transcription

Aide-m ém oire adm inistrateur Linux
Partitions et systèmes de fichiers
Distribution / installation de logiciel
fdisk
tar
3
%
fdisk /dev/hda
mkswap
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/)
swapon
uname
#
"
"
() *
+
() *
+
#,
,
-
.
/
/
/
0
0
%#, 0
"
Utilisateurs
useradd
12
&
* %%
&
userdel –r linus
%%
%
passwd
swapoff – !"
passwd linus
5%
4
5%
5%
-
&
/etc/fstab
4
5%
swapoff /dev/hda2
mkfs
)"
&
#
mkfs.ext2 /dev/hda3
mkfs.ext3 /dev/hda4
mkfs.vfat /dev/hda5
+"
&
#
%
%
rpm – <
#
70
0- 0%
!"
-a "
umount /dev/hda4
umount /mnt/dos
umount –a
df
$
%
& #- 0
& #- 0
& #- 0
#
#- 0
0
"
%
4%0
"
%
4%
–czf archive.tar.gz distrib/
#% "
"%
distrib/0
–tvf archive.tar
& #- 0
tar –xjf archive.tar.bz2
&
#% "
tar –xzf application-1.01.tar.gz
cd application-1.01
./configure
make && make install
6 70
%
umount
0
>?? 0
0
&
#
/etc/mtab
#
& #-
"
installation classique
mount –t vfat /dev/hda4 /mnt/dos/
%
8
50
mount –a
%
/etc/fstab0
mount 192.1.1.254:/home /home/users/
& "%
% 9:*
$%
- –o
/etc/fstab
default 50
0 -0
0
0
0
0
remount #
&
"0
rw
"
0
ro
0
noauto
%
,
- / 0
nodev
#
%"
0
noexec %
#
"
0
nosuid ;
* /' !6< !0
sync "
#
0
user % .
"%
0
%
"%
&
&
=%
useradd –m –p "" linus
"
%
0 - "%
%
-
userdel
1 -
mount
-a
&
4
fsck.ext2 –p /dev/hda3
"%
, &
fsck.vfat /dev/hda4
-"
& %
8
5
Informations système
dmesg
uptime ! "
free $ %
vmstat !"
ipcs '
ipcrm * %%
ldconfig +
init )#
&
swapon /dev/hda2
-a
4
fsck
0
1
3
5
6
)"
mkswap /dev/hda2
mkswap /boot/swap_file
<
-c
-x
-t
-f
-v
-z
-j
tar
"
tar
"
%,
@ A
-h
#
%
rpm –ivh paquet.rpm
& %,
0
rpm –Uvh paquet.rpm
B2 6
& %,
0
rpm –Fvh paquet.rpm
B2
& %,
"2B
"0
rpm –e paquet
"
& %,
0
rpm –qa
%,
"0
rpm –qf /chemin/fichier
# #
%,
,
%%
rpm –qip paquet.rpm
%,
0
rpm –qlp paquet.rpm
#
%,
apt
<
%,
# 0
!
apt-get install application
&%%
"apt-get remove application
%%
%%
"%
"apt-get update
B2
"
0
apt-get upgrade
B2
0
0
netstat
Gestion des processus
application &
& %%
B &
/% 0
fg 1
B & - /%
2
" C0
(Ctrl-Z)
& %%
B & - /% 0
bg
B &
/%
2
ps
3
arp
%
1
#
%
D#
)#
&
%
%
CEF
"0
renice –5 –u root
G-
B
killall
=
%
%
%
%
"
fuser –k –m /dev/hda5
%
"
B
B
#
%
)
socklist
,"
&#I
"
0
add -net 192.1.1.0 eth0
, - &
eth00
add -net 172.1.1.0 gw 192.1.1.5
"
%
%
0
add default eth1
%
" 0
del default
%
"
-
%
tcpdump
&
lsmod
modinfo
insmod
#I
0
/"
#I
wget
#
" &
#
#
@%
%
"
0
0
#
0
0
6
6
&
# "
#
&
rmmod
* %%
'@
wget http://www.site.com/repertoire/
-c %
"2B
"0
-r #
"
0
-l niveau
"
0
-k
%
&
"#
"
rmmod module
depmod
+"
"%
depmod –an
modprobe
=)(6 (
=
)
open % cd 6 #
6
lcd 6 #
6
get #
put #
prompt
mget J
mput J#
%
insmod module.o
"
&
"
&
Gestion des modules du noyau
,"
2
G
)
%"
0
"
"
# 1@(0
ssh [email protected]
"
H
)#
rsh G "
ssh G "
<
route
2
route
2
route
2
route
%%
"
traceroute www.destination.com
-n %
",
ftp
ifconfig -a
#
ifconfig eth0 192.1.1.50
%
#
route
H
telnet mail.isp.com pop-3
% CC
-
Utilitaires réseau
ifconfig
0
&" # -
telnet
.
killall –9 boucle_fork
fuser
"
tcpdump –i eth0
#
,
eth00
tcpdump –i eth0 port telnet
#
% 6%
7
%
kill –15 12857
-l
0 %
-"
1 SIGHUP
2 SIGINT0 ) /)
3 SIGQUIT0 ) /K
9 SIGKILL
15 SIGTERM
0
1@(
traceroute
renice +5 12857
kill
Signaux fréquemment utilisés
ping –c 1 –w 2 192.1.1.53
,.
%
ping –b 192.1.1.255
,.
"
B
#I
%
-d "
"
<
ping
ps –aux
#
renice
,
-a
#
arp –d hote
%%
"
ps –ef
top
*
netstat –r
#
netstat –i
# &"
netstat –a
# &"
)#
"
"%
modprobe module.o
Compilation d’un noyau Linux
ftp ftp.kernel.org
" %"
" "
"%
/pub/linux/kernel/0
tar –xjf linux-XXXX.tar.bz2
cd linux-XXXX
make mrproper
make menuconfig
#
" "0 %
make dep clean bzImage
≤ L
%
make
≥ ?
( 0
%
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
2
&
"%
0%
/sbin/lilo
vi /boot/grub/grub.conf
/sbin/init 6
# %66555
6