-
enable it with
#> sysctl -w kernel.sysrq=1
-
AltSysRqR use raw keyboard events AltSysRqK kill current VT in use AltSysRqE terminate all running processes (except init
)AltSysRqI kill all processes (except init
)AltSysRqL kill all processes (including init
)AltSysRqB reboot AltSysRqS sync all drives AltSysRqU umount all filesystems AltSysRqO turn the machine off AltSysRqP dump processor’s registers AltSysRqT dump current tasks AltSysRqM dump some memory info AltSysRq0 up to AltSysRq9 set kernel log level and redirect it to console
- End user
-
System administration
-
vipw
edit the file/etc/passwd
-
vigr
edit the file/etc/group
-
visudo
edit the file/etc/sudoers
-
- DNS
-
starting with Fedora Core 2, use
system-config-network
to configure the network
before this, useredhat-config-network
-
FTP
-
VSFTP
-
/etc/vsftpd.ftpusers
contains the list of users that are not allowed to log in via FTP (these users are still prompted for a password) -
if
userlist_enable
isYES
,/etc/vsftpd.user_list
contains the list of users that will not be prompted for a password and, hence, will not be able to log in (this avoid to transmit the passwords in clear text over the network)
-
-
WU-FTP
-
to disallow FTP users, use
deny-uid
,deny-gid
,allow-uid
andallow-gid
in/etc/ftpaccess
instead of using/etc/ftpusers
-
to disallow FTP users, use
-
VSFTP
-
report the temperature, number of errors, lifetime… of an ATA/IDE/SCSI3 hard drive
#> smartctl -a /dev/sda
-
scsiinfo
display/set SCSI device parameters scsiinfo -X
set SCSI device parameters (use scsi-config
instead)scsiinfo -d /dev/sda
dump defect list from manufacturer table and grown table scsiinfo -a /dev/sda
display all information -
hdparm
display/set IDE hard disk parameters -
scsiformat
format a SCSI disk -
badblocks
list the bad blocks of a device
-
The messages log by the system are in
/var/log
./var/log/messages
System log /var/log/boot.log
Service start/stop log /var/log/secure
Security log /var/log/maillog
Sendmail log /var/log/httpd/access_log
Apache access log /var/log/httpd/error_log
Apache error log -
a script can log a message in
syslog
withlogger
-
display the kernel ring buffer
#> dmesg
- Modules
-
display resources used by the processes
#> top
-
report system activity
#> sar
-
display the free/used memory in real time
#> watch -n 1 -d free
-
systat
-
report processors related statistics
#> mpstat
-
report CPU and I/O statistics
#> iostat
-
get the lists of the writing processes
#> service syslog stop # to avoid a mad loop if syslogd tries to write something during the experiment
#> echo 1 > /proc/sys/vm/block_dump#> dmesg
#> echo 0 > /proc/sys/vm/block_dump
#> service syslog start -
report virtual memory statistics
#> vmstat
-
report processors related statistics
- SCSI
-
PCI
-
list the PCI devices
#> lspci
-
list the PCI devices
-
/proc files
/proc/cmdline
the command line parameters used to start the kernel /proc/kcore
is the image of the physical memory (in the core file format) /proc/kmsg
is the kernel messages log (only a provileged process can read it and syslog must be called by a process) /proc/ksyms
is the kernel symbol table /proc/loadavg
contains load indicators (same as uptime) /proc/cpuinfo
CPU characteristics (only the cpu and bogomips are standard entries) /proc/meminfo
contains the current memory usage (same as free) /proc/modules
lists the modules currently loaded in the kernel /proc/uptime
contains the uptime and idle time /proc/version
contains the versions of the Linux kernel, gcc and Red Hat Linux installed on the system /proc/filesystems
lists the file systems supported by the kernel /proc/swaps
lists the swap spaces and their use /proc/stat
contains some kernel statistics /proc/slabinfo
lists the memory usage on the slab level /proc/mounts
lists all the mount of the system /proc/locks
lists the file currently locked by the kernel /proc/devices
major numbers and device groups /proc/ioports
used IO addresses /proc/interrupts
used interrupts /proc/dma
used DMA channels -
/proc/sys
-
sysctl
configure kernel parameters at runtime sysctl -a
list all the parameters currently set sysctl -w kernel.sysrq=1
this is the same as echo 1 > /proc/sys/kernel/sysrq
-
When the system boots, the
init
program runs the/etc/rc.d/rc.sysinit
script which executessysctl
using/etc/sysctl.conf
. So any values added to/etc/sysctl.conf
will take effect each time the system boots.
-
-
/etc/services
contains the port/server mapping
the services are defined in/etc/xinetd.d
(one file per service)
the configuration file is/etc/xinetd.conf
-
chkconfig
configure system services chkconfig --list
list the current state of the services chkconfig rexec on
enable a service
the service will be started only at the nest reboot, useservice rexec start
to start it nowchkconfig rexec off
disable a service -
service --status-all
return the status of all services service sshd status
indicate if sshd
is runningservice sshd start
start sshd
service sshd stop
stop sshd
-
lsof
list the open files -
shred foobar
overwrite a file before deleting it -
/etc/fstab
description of the filesystems to mount /etc/mtab
tracking of the mounted filesystems -
sfdisk -l /dev/sdb
display the partition table of disk /dev/sdb -
Swap
-
swapon -s
cat
/proc/swaps
display swap usage
-
-
XFS
-
mkfs.xfs /dev/md4
mkfs -t xfs /dev/md4
create a XFS filesystem mkfs.xfs -f
do not create the filesystem, only display its parameters mkfs.xfs -N
force the filesystem creation even if the partition already contains one -
xfs_growfs -n /dev/md4
xfs_growfs -n /export/home1display the filesystem parameters -
xfs_info /dev/md4
xfs_info /export/home1same as xfs_growfs -n
-
xfs_db /dev/md4
launch the XFS debugger on /dev/md4 -
xfs_check /dev/md4
launch the XFS checker on /dev/md4
xfs_check -i 123 /dev/md4
launch the XFS checker on inode 123 of /dev/md4
xfs_check -l /dev/scsi/sbdc1b0t0u0p5 /dev/md0
the -l
option indicates that/dev/md0
has an external log/dev/scsi/sbdc1b0t0u0p5
-
xfs_ncheck /dev/md4
return the list of inodes/pathnames on /dev/md4
xfs_ncheck -i 123 /dev/md4
return pathname of inode 123 of /dev/md4
xfs_ncheck -l /dev/scsi/sbdc1b0t0u0p5 /dev/md0
the -l
option indicates that/dev/md0
has an external log/dev/scsi/sbdc1b0t0u0p5
-
xfs_repair /dev/md0
repair the filesystem mounted on /dev/md4
xfs_repair -l /dev/scsi/sbdc1b0t0u0p5 /dev/md0
the -l
option indicates that/dev/md0
has an external log/dev/scsi/sbdc1b0t0u0p5
-
-
NFS
-
/var/lib/nfs/rmtab
client information /var/lib/nfs/etab
detailed export information /proc/fs/nfs/exports
/etc/exports
lists of clients /var/lib/nfs/xtab
explicit machine names
-
-
ldconfig
recreate the links for the shared libraries and rebuild the cache