en:linux:start
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:linux:start [2021/10/31 13:10] – created frank | en:linux:start [2024/04/07 19:40] (current) – [LVM] frank | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Linux ====== | ||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | |||
+ | * [[Kernel]] | ||
+ | * [[ubuntu18.4]] [[ubuntu20.4]] | ||
+ | * [[LXC]] | ||
+ | * [[Docker]] | ||
+ | * [[virtualbox]] | ||
+ | * [[GIMP]] | ||
+ | * [[multimedia]] | ||
+ | * [[wifi]] | ||
+ | ===== Preferences ===== | ||
+ | ==== Titlebar-Icons ==== | ||
+ | |||
+ | gsettings set org.gnome.desktop.wm.preferences button-layout ': | ||
+ | ==== Terminal-Width ==== | ||
+ | stty rows 50 cols 150 | ||
+ | |||
+ | if linebreak does not work this can help in ~/.bashrc: | ||
+ | |||
+ | shopt -s checkwinsize | ||
+ | #if [ $(tty) == '/ | ||
+ | # trap resize DEBUG | ||
+ | #fi | ||
+ | # | ||
+ | export PROMPT_COMMAND=" | ||
+ | ===== ppp ifup-script ===== | ||
+ | |||
+ | Script in / | ||
+ | |||
+ | example: ppp-default-route in separate routing-Table: | ||
+ | < | ||
+ | PPP_LOCAL=$4 | ||
+ | PPP_REMOTE=$5 | ||
+ | PPP_IFACE=$1 | ||
+ | |||
+ | ip route flush table telekom | ||
+ | ip route add $PPP_REMOTE/ | ||
+ | ip route add default dev $PPP_IFACE table telekom | ||
+ | ip route show table telekom | ||
+ | exit 0 | ||
+ | </ | ||
+ | ===== apt-get force ipv4 ===== | ||
+ | |||
+ | apt-get -o Acquire:: | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | permanent (as root): | ||
+ | |||
+ | echo ' | ||
+ | |||
+ | [[https:// | ||
+ | ===== basic x-server ===== | ||
+ | |||
+ | apt-get install --no-install-recommends xserver-xorg xinit openbox policykit-1 xterm xfonts-base | ||
+ | |||
+ | ===== simple Mailserver ===== | ||
+ | |||
+ | as Relay-Server (sending Mails over external Mailserver) for System-purposes (infos, backup,...) | ||
+ | |||
+ | https:// | ||
+ | |||
+ | ===== screen ===== | ||
+ | http:// | ||
+ | |||
+ | screen -S Sessionname command | ||
+ | |||
+ | ===== wget ===== | ||
+ | |||
+ | |||
+ | -P download in dir | ||
+ | |||
+ | wget < | ||
+ | |||
+ | -O download as file | ||
+ | |||
+ | wget < | ||
+ | |||
+ | |||
+ | ===== processinfo ===== | ||
+ | |||
+ | ps -o pid,args -C tcpdump | ||
+ | |||
+ | ===== ls ===== | ||
+ | |||
+ | full timestamps: | ||
+ | |||
+ | ls -l --time-style=" | ||
+ | |||
+ | deactivate colors: | ||
+ | |||
+ | ls -l --color=none | ||
+ | |||
+ | ===== bashrc / alias ===== | ||
+ | |||
+ | alias cp=" | ||
+ | alias pynano=" | ||
+ | alias catconf=' | ||
+ | ===== nano ===== | ||
+ | |||
+ | Jump to line: Ctrl+Shift+- (Ctrl+_) | ||
+ | |||
+ | Replace: Alt+R | ||
+ | |||
+ | ==== settings ==== | ||
+ | |||
+ | sudo nano /etc/nanorc | ||
+ | |||
+ | === Cursorposition === | ||
+ | |||
+ | ## Constantly display the cursor position in the status bar. Note that | ||
+ | ## this overrides " | ||
+ | set constantshow #temporär strg+C, | ||
+ | |||
+ | |||
+ | === linenumbers === | ||
+ | |||
+ | ## Display line numbers to the left of the text. | ||
+ | set linenumbers | ||
+ | |||
+ | === TAB-width === | ||
+ | |||
+ | #/ | ||
+ | set tabsize 4 | ||
+ | #temporary setting it (e.g. for Patches) | ||
+ | nano -T 8 datei | ||
+ | ====== storage check ====== | ||
+ | |||
+ | # | ||
+ | sudo fsck -f /dev/sdb1 | ||
+ | #check for bad sectors | ||
+ | sudo badblocks -nsv /dev/sdb | ||
+ | |||
+ | http:// | ||
+ | ====== NTP ====== | ||
+ | |||
+ | apt-get install ntp | ||
+ | #nano / | ||
+ | service ntp status | ||
+ | #show state of servers | ||
+ | ntpq -p | ||
+ | |||
+ | manual update: | ||
+ | |||
+ | service ntp stop | ||
+ | ntpdate ptbtime1.ptb.de | ||
+ | service ntp start | ||
+ | |||
+ | ====== set time ====== | ||
+ | |||
+ | # | ||
+ | timedatectl set-timezone CET #timezone (CET/CEST) | ||
+ | date -s " | ||
+ | hwclock -w #set RTC if there is any, else time will be wrong after next reboot | ||
+ | ====== update-alternatives ====== | ||
+ | |||
+ | sudo apt-get install gcc-8-arm-linux-gnueabihf | ||
+ | sudo update-alternatives --install / | ||
+ | sudo update-alternatives --config arm-linux-gnueabihf-gcc | ||
+ | arm-linux-gnueabihf-gcc --version | ||
+ | |||
+ | #to create update-alternatives in a loop you can use this | ||
+ | for i in $(ls / | ||
+ | |||
+ | other example | ||
+ | |||
+ | sudo update-alternatives --install / | ||
+ | ====== renaming ====== | ||
+ | |||
+ | File test will be renamed into test.bak (same directory) | ||
+ | |||
+ | mv / | ||
+ | |||
+ | ====== 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, | ||
+ | |||
+ | ====== tar ====== | ||
+ | |||
+ | tar -xzf file.tar.gz --strip-components 1 -C DESTINATION | ||
+ | |||
+ | ====== sed ====== | ||
+ | |||
+ | extract text between patterns: | ||
+ | |||
+ | https:// | ||
+ | |||
+ | example (extract frequencies from iw command): | ||
+ | |||
+ | iw list | sed -n '/ | ||
+ | ====== irssi ====== | ||
+ | |||
+ | ===== config ===== | ||
+ | |||
+ | Server+nick: | ||
+ | |||
+ | irssi -n NICK #start irssi with nickname | ||
+ | |||
+ | /network add -nick NICK -autosendcmd "/msg nickserv IDENTIFY *******" | ||
+ | /server add -auto -ssl -network fn chat.freenode.net 7070 #ports 6697, 7000 and 7070 for SSL-encrypted connections. | ||
+ | |||
+ | /SET nick xxx | ||
+ | /SET alternate_nick xxx | ||
+ | | ||
+ | /nick alternatenick | ||
+ | /msg NickServ IDENTIFY mainnick password | ||
+ | /msg NickServ GROUP | ||
+ | |||
+ | https:// | ||
+ | |||
+ | /alias nick_recover msg NickServ GHOST $0 $1; wait 2000; msg NickServ RELEASE $0 $1; wait 2000; nick $0; wait 2000; msg NickServ IDENTIFY $1 | ||
+ | /network modify -autosendcmd "/ | ||
+ | /SET server_reconnect_time 300 | ||
+ | |||
+ | https:// | ||
+ | ===== switch windows ===== | ||
+ | |||
+ | /window 1-x # | ||
+ | |||
+ | Ctrl+P (previous)/ | ||
+ | |||
+ | /win list #shows open windows in the Server-Status (1) | ||
+ | |||
+ | ===== Away mode ===== | ||
+ | |||
+ | /away grund #start awaymode (Nachrichten shown in Server-window #1) | ||
+ | /away #stop away mode | ||
+ | |||
+ | |||
+ | ====== udev ====== | ||
+ | |||
+ | same serial-adapter with Symlink based on USB-Ports (behind Hub) | ||
+ | |||
+ | https:// | ||
+ | |||
+ | udevadm info --attribute-walk --path=/ | ||
+ | |||
+ | / | ||
+ | < | ||
+ | #r2 (first port) roothub-port.hubport | ||
+ | # KERNELS==" | ||
+ | # KERNELS==" | ||
+ | #r64 (second port=3) | ||
+ | # KERNELS==" | ||
+ | # KERNELS==" | ||
+ | KERNEL==" | ||
+ | KERNEL==" | ||
+ | </ | ||
+ | |||
+ | my current config splitting by serial | ||
+ | < | ||
+ | #ch340 KERNELS==" | ||
+ | SUBSYSTEM==" | ||
+ | #cp2102 KERNELS==" | ||
+ | SUBSYSTEM==" | ||
+ | #cp2104 KERNELS==" | ||
+ | SUBSYSTEM==" | ||
+ | </ | ||
+ | |||
+ | this udev rules i use for ftdi 4xuart adapter (FT4232H Quad RS232-HS) | ||
+ | < | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | </ | ||
+ | |||
+ | easier way to get the main-properties of a device | ||
+ | |||
+ | udevadm info /dev/sdb1 | ||
+ | ====== sshd ====== | ||
+ | ===== qnap (entware) ===== | ||
+ | |||
+ | nano / | ||
+ | ps | grep ssh | ||
+ | kill PID #PID= pid von / | ||
+ | / | ||
+ | tail -f / | ||
+ | #bei Fehler "Bad ownership": | ||
+ | chmod go-w ~/;chmod 700 ~/ | ||
+ | #wenn fertig | ||
+ | / | ||
+ | |||
+ | ====== kernel kernelconfig (/ | ||
+ | |||
+ | < | ||
+ | # modprobe configs | ||
+ | # zcat / | ||
+ | CONFIG_HWMON=y | ||
+ | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
+ | # CONFIG_SENSORS_IIO_HWMON is not set | ||
+ | CONFIG_THERMAL_HWMON=y | ||
+ | </ | ||
+ | ====== mv-alternative ====== | ||
+ | |||
+ | rsync -avh --progress --remove-source-files source target/ | ||
+ | #delete empty directories (not done by rsync) | ||
+ | find source/ -type d -empty -delete | ||
+ | |||
+ | ====== other ====== | ||
+ | ===== force fsck ===== | ||
+ | |||
+ | in kernel-cmdline: | ||
+ | |||
+ | fsck.mode=force | ||
+ | |||
+ | ===== smartctl / hdparm ===== | ||
+ | |||
+ | < | ||
+ | smartctl -t short /dev/sdb | ||
+ | smartctl -a /dev/sdb | grep -A1 " | ||
+ | # | ||
+ | Self-test execution status: | ||
+ | 90% of test remaining. | ||
+ | #oder: | ||
+ | Self-test execution status: | ||
+ | the read element of the test failed. | ||
+ | |||
+ | #warten bis fertig und bei Fehler: | ||
+ | smartctl -a /dev/sdb | grep ' | ||
+ | Beispielausgabe mit Fehler (long): | ||
+ | # 1 Extended offline | ||
+ | |||
+ | #sektor und angrenzende in Schleife versuchen neu zu schreiben | ||
+ | for i in {1709920..1709930}; | ||
+ | </ | ||
+ | |||
+ | ===== iostat ===== | ||
+ | |||
+ | apt install sysstat | ||
+ | | ||
+ | Ausgabe: | ||
+ | |||
+ | < | ||
+ | Linux 5.15.0-56-generic (frank-G5) 29.12.2022 _x86_64_ (12 CPU) | ||
+ | |||
+ | avg-cpu: | ||
+ | | ||
+ | |||
+ | Device | ||
+ | sdb | ||
+ | sdb1 0,01 | ||
+ | </ | ||
+ | ===== rc.local ===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | ===== VNC-Server ===== | ||
+ | |||
+ | based on https:// | ||
+ | |||
+ | apt install tightvncserver openbox | ||
+ | apt install lxterminal firefox-esr --no-install-recommends | ||
+ | |||
+ | ~/ | ||
+ | < | ||
+ | #!/bin/sh | ||
+ | xrdb $HOME/ | ||
+ | xsetroot -solid grey | ||
+ | |||
+ | unset SESSION_MANAGER | ||
+ | exec openbox-session & | ||
+ | </ | ||
+ | |||
+ | ~/ | ||
+ | < | ||
+ | #!/bin/sh | ||
+ | vncserver :1 -geometry 1024x768 -depth 8 | ||
+ | </ | ||
+ | |||
+ | do not forget to set execute rights | ||
+ | |||
+ | chmod +x ~/ | ||
+ | |||
+ | i setart the script with rc.local (see above), but a init-script is also possible | ||
+ | |||
+ | https:// | ||
+ | |||
+ | ===== locales ===== | ||
+ | |||
+ | / | ||
+ | |||
+ | Solution: | ||
+ | |||
+ | if not yet done, generate locales | ||
+ | |||
+ | locale-gen de_DE.UTF-8 | ||
+ | |||
+ | add this to / | ||
+ | |||
+ | LC_ALL=de_DE.UTF-8 | ||
+ | LANG=de_DE.UTF-8 | ||
+ | |||
+ | maybe again | ||
+ | |||
+ | dpkg-reconfigure locales | ||
+ | |||
+ | now error should be fixed | ||
+ | |||
+ | locale -a | ||
+ | |||
+ | Solution using / | ||
+ | |||
+ | ===== LVM ===== | ||
+ | https:// | ||
+ | |||
+ | prepared initrd | ||
+ | < | ||
+ | apt install initramfs-tools | ||
+ | kernelversion=$(uname -r) | ||
+ | echo $kernelversion | ||
+ | zcat / | ||
+ | less / | ||
+ | update-initramfs -k $kernelversion -c | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | root@bpi-r3-mini: | ||
+ | root@bpi-r3-mini: | ||
+ | #changed type of partition 3 to lvm | ||
+ | root@bpi-r3-mini: | ||
+ | root@bpi-r3-mini: | ||
+ | Volume group " | ||
+ | root@bpi-r3-mini: | ||
+ | --- Volume group --- | ||
+ | VG Name | ||
+ | System ID | ||
+ | Format | ||
+ | Metadata Areas 1 | ||
+ | Metadata Sequence No 1 | ||
+ | VG Access | ||
+ | VG Status | ||
+ | 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 | ||
+ | | ||
+ | root@bpi-r3-mini: | ||
+ | Logical volume " | ||
+ | root@bpi-r3-mini: | ||
+ | root@bpi-r3-mini: | ||
+ | [ 5279.856899] EXT4-fs (dm-0): mounted filesystem 520d434d-fdfc-48f3-823d-77e602 | ||
+ | 7e84e7 r/w with ordered data mode. Quota mode: disabled. | ||
+ | root@bpi-r3-mini: | ||
+ | </ | ||