User Tools

Site Tools



en:linux:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
en:linux:start [2022/11/20 11:29] – [smartctl / hdparm] franken:linux:start [2024/04/07 19:12] – [LVM] frank
Line 85: Line 85:
   ps -o pid,args -C tcpdump   ps -o pid,args -C tcpdump
  
 +===== ls =====
 +
 +full timestamps:
 +
 +  ls -l --time-style="+%Y-%m-%d %H:%M"
 +
 +deactivate colors:
 +
 +  ls -l --color=none
 +
 +===== bashrc / alias =====
 +
 +  alias cp="rsync -av --partial --progress"
 +  alias pynano="nano -ET4"
 +  alias catconf='find . -type f -exec grep -Iq . {} \; -printf "\n\n%p:\n" -exec cat {} \;'
 ===== nano ===== ===== nano =====
  
Line 120: Line 135:
   sudo badblocks -nsv /dev/sdb   sudo badblocks -nsv /dev/sdb
  
 +http://www.das-werkstatt.com/forum/werkstatt/viewtopic.php?t=2346
 ====== NTP ====== ====== NTP ======
  
Line 125: Line 141:
   #nano /etc/ntp.conf # need restart after change   #nano /etc/ntp.conf # need restart after change
   service ntp status   service ntp status
 +  #show state of servers
 +  ntpq -p
  
 manual update: manual update:
Line 144: Line 162:
   sudo update-alternatives --config arm-linux-gnueabihf-gcc   sudo update-alternatives --config arm-linux-gnueabihf-gcc
   arm-linux-gnueabihf-gcc --version   arm-linux-gnueabihf-gcc --version
 +
 +  #to create update-alternatives in a loop you can use this
 +  for i in $(ls /usr/bin/arm-linux-gnueabihf-gcc-{9..12});do sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc $i 50;done
  
 other example other example
Line 154: Line 175:
   mv /home/frank/test{,.bak}   mv /home/frank/test{,.bak}
  
 +====== gunzip ======
  
 +on-the-fly decompress and write to disk
 +
 +  gunzip -c bpi-r3_sdmmc_bullseye.img.gz | sudo dd bs=1M status=progress conv=notrunc,fsync of=/dev/sdX
 +
 +====== tar ======
 +
 +  tar -xzf file.tar.gz --strip-components 1 -C DESTINATION
 +
 +====== sed ======
 +
 +extract text between patterns:
 +
 +https://stackoverflow.com/questions/38972736/how-to-print-lines-between-two-patterns-inclusive-or-exclusive-in-sed-awk-or
 +
 +example (extract frequencies from iw command):
 +
 +  iw list | sed -n '/Frequencies/,/Band\|Supported commands/{/Band\|Supported commands/!p;}'
 ====== irssi ====== ====== irssi ======
  
Line 223: Line 262:
 SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", SYMLINK+="tty_r2" SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", SYMLINK+="tty_r2"
 </code> </code>
 +
 +this udev rules i use for ftdi 4xuart adapter (FT4232H Quad RS232-HS)
 +<code>
 +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="ftdi_r2"
 +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="ftdi_r64"
 +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ENV{ID_USB_INTERFACE_NUM}=="02", SYMLINK+="ftdi_r3"
 +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ENV{ID_USB_INTERFACE_NUM}=="03", SYMLINK+="ftdi_r4"
 +</code>
 +
 +easier way to get the main-properties of a device
 +
 +  udevadm info /dev/sdb1
 ====== sshd ====== ====== sshd ======
 ===== qnap (entware) ===== ===== qnap (entware) =====
Line 278: Line 329:
 #sektor und angrenzende in Schleife versuchen neu zu schreiben #sektor und angrenzende in Schleife versuchen neu zu schreiben
 for i in {1709920..1709930};do hdparm --yes-i-know-what-i-am-doing --repair-sector $i /dev/sdb;sleep 1;done for i in {1709920..1709930};do hdparm --yes-i-know-what-i-am-doing --repair-sector $i /dev/sdb;sleep 1;done
 +</code>
 +
 +===== iostat =====
 +
 +  apt install sysstat
 +  
 +Ausgabe:
 +
 +<code>$ iostat -m -p /dev/sdb
 +Linux 5.15.0-56-generic (frank-G5) 29.12.2022 _x86_64_ (12 CPU)
 +
 +avg-cpu:  %user   %nice %system %iowait  %steal   %idle
 +           2,19    0,01    0,74    2,58    0,00   94,48
 +
 +Device             tps    MB_read/   MB_wrtn/   MB_dscd/   MB_read    MB_wrtn    MB_dscd
 +sdb               5,80         0,00         0,67         0,00          3       9123          0
 +sdb1              0,01         0,00         0,00         0,00          2          0          0
 </code> </code>
 ===== rc.local ===== ===== rc.local =====
Line 338: Line 406:
  
 Solution using /etc/default/locale was not working for me Solution using /etc/default/locale was not working for me
 +
 +===== LVM =====
 +https://wiki.debian.org/LVM#Create_a_PV
 +
 +prepared initrd
 +<code>
 +  apt install initramfs-tools
 +  kernelversion=$(uname -r)
 +  echo $kernelversion
 +  zcat /proc/config.gz > /boot/config-$kernelversion
 +  less /boot/config-$kernelversion
 +  update-initramfs -k $kernelversion -c
 +</code>
 +
 +<code>
 +root@bpi-r3-mini:~# apt install lvm2
 +root@bpi-r3-mini:~# fdisk /dev/nvme0n1
 +#changed type of partition 3 to lvm
 +root@bpi-r3-mini:~# pvcreate /dev/nvme0n1p3
 +root@bpi-r3-mini:~# vgcreate vg-nvme /dev/nvme0n1p3                             
 +  Volume group "vg-nvme" successfully created
 +root@bpi-r3-mini:~# vgdisplay
 +  --- Volume group ---
 +  VG Name               vg-nvme
 +  System ID             
 +  Format                lvm2
 +  Metadata Areas        1
 +  Metadata Sequence No  1
 +  VG Access             read/write
 +  VG Status             resizable
 +  MAX LV                0
 +  Cur LV                0
 +  Open LV               0
 +  Max PV                0
 +  Cur PV                1
 +  Act PV                1
 +  VG Size               80.74 GiB                                               
 +  PE Size               4.00 MiB                                                
 +  Total PE              20670                                                   
 +  Alloc PE / Size       0 / 0                                                   
 +  Free  PE / Size       20670 / 80.74 GiB                                       
 +  VG UUID               w22Wdx-Fhch-YNsA-roWh-Zq81-qv0R-d5fnvw                  
 +                                                                                
 +root@bpi-r3-mini:~# lvcreate -n var -L 10g vg-nvme                              
 +  Logical volume "var" created.
 +root@bpi-r3-mini:~#
 +</code>
 +
en/linux/start.txt · Last modified: 2024/04/07 19:40 by frank