LPIC-1

during studying for LPIC-1 I made some notes; unfortunately in German, so it is quite stupid to write this description in English

Linux commands

dig cheatsheet neverendingsecurity.wordpress.com

LPIC Topic 200: Capacity Planning

sar from the package sysstat shows the processor activity, this gives five measurements every three seconds: sar 3 5

sar also could be used to measure network interfaces and I/O transfer rates, first command measure one time for five seconds: sar -n DEV 5 1

this command measures the I/O rates every 10 seconds three times: sar -b 10 3

to collect data over a longer period, we have to set ENABLED="true" in /etc/default/sysstat and start the service. After ten minutes we can see the collected data with: sar -A

iostatfrom sysstat is similar to sar when running without attributes

iotop show I/O like command top. To show the current I/O processes do this:

iotop -o

other commands vmstat netstat ss iptraf

pscommand:

instead of using ps aux | grep tomcat we could search for java processes with: ps u -C java ps -fC java ps -fC java,apache2

other commands pstree top more modern than top with color an scrolling: htop

show load an uptime with: uptime w

show what file is open at an external drive lsof /media/mydrive

LPIC Topic 201: Linux Kernel

identify current kernel version: uname -r

compile commands make config make oldconfig make menuconfig make dep make clean make bzImage make modules make modules_install

show state of the modules of the running kernel. lsmod basically shows the content of /proc/modules

inspect the modules of a kernel modinfo options of modinfo:

other mod commands

At runtime the kernel stores its information in the /proc file system under /proc/sys/kernel/ cd /proc/sys/kernel/ cat osrelease cat ostype cat hostname cat domainname cat modprobe

show which files are open in a mounted drive lsof /media/disk/

udev manges /dev. Configuration at /dev/udev/.
To monitor udev: udevadm monitor

lot of information about a process: cat /proc/9842/environ | tr "\000" "\n" the tr is needed here, to have a line break after every parameter

LPIC Topic 202: System Startup

show differnces in systemd config systemd-delta

create backup of the MBR dd if=/dev/sda of=mbr.backup ibs=512 count=1

update grub after installing new kernerl update-grub2

check file system

fsck -t ext4 -V /dev/sdb1

LPIC Topic 203: Filesystem and Devices

parameters of the mount command

remount mount -v -o remount,rw /path

NFS mount mount -t nfs pcname:/path /mnt

SMB mount mount -t smbfs //pcname/share /mnt

Content of /etc/fstab:

1 file system 2 mount point 3 type 4 options 5 dump 6 pass
UUID=9ae73f06-5ee6-45f5-8f55-c4837bc7ca2a / ext4 errors=remount-ro 0 1
UUID=d583c4be-8d35-4bb5-bc81-cda80e1606b4 none swap sw 0 0
UUID=58236382-9d8f-40a5-ba65-0bc431df69aa /home ext4 acl,user_xattr 1 2

column 5 defines, if the file system is saved by dump
column 6 defines, if and when a file system is checked by fsck:

find UUID of your partitions blkid

no fsck when start next time shutdown -hf now

force fsck when start next time shutdown -hF now

LPIC Topic 204: Advanced Storage Device Administration

LVM

LPIC Topic 205: Network Configuration

ip command cheatsheet acces.redhat.com (pdf)

ifconfig eth1 192.168.1.111 netmask 255.255.255.0

route add default gw 192.168.1.1
route add -net 192.168.191.0/24 gw 192.168.190.1

route -A inet6

Delete arp entry:
arp -d 192.168.1.1

ip command:
ip route show    # same as route -n command
ip neighbour show    # same as arp command
ip addr show eth0    # same as ifconfig command
ip tunnel show    # capsulated ipv6 packages in ipv4 packages
ip monitor    # live monitoring of arp table

wifi commands iwconfig wlan0 iwconfig wlan0 txpower 30mW iwlist wlan0 frequency iwlist --help
    Usage: iwlist [interface] scanning [essid NNN] [last]
    [interface] frequency
    [interface] channel
    [interface] bitrate
    [interface] rate
    ...
iw dev wlan0 link # same as iwconfig wlan0

some network commands:

LPIC Topic 206: System Maintenance

chloesoe, 2019 Kontakt