Tuesday, September 21, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How to visualize EOF in bash

Posted: 21 Sep 2021 10:36 AM PDT

/dev/null is a special Linux file which discards everything is written to itself and which provides EOF when read.

I would like to read /dev/null to obtain and visualize this EOF. If I try:

$ cat /dev/null | hexdump  

it doesn't work. The prompt returns with no output. EOF doesn't even have an ASCII code, so maybe this is the reason.

  1. Can EOF still be considered a character?

  2. Is there a way in bash to detect and print EOF, when provided in the stdin?

Something like:

$ cat /dev/null | some_tool  EOF  

I'm using GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu) on Ubuntu 20.04.3, but I hope that the solution, if any, is not related to these specific versions.

does pthread_setschedparam can change the priority on the fly once the thread is running? if no, then how I can change the thread priority on the fly

Posted: 21 Sep 2021 10:34 AM PDT

I want to change a thread priority and I have found many examples using pthread_setschedparam, but I need to confirm if the priority can be changed on the fly if the thread is already running. In the manual mention the following: In order for the parameter setting made by pthread_attr_setschedparam() to have effect when calling pthread_create(3), the caller must use pthread_attr_setinheritsched(3) to set the inherit-scheduler attribute of the attributes object attr to PTHREAD_EXPLICIT_SCHED.

'printk messages dropped' USB error & infinite loop on multiuser target startup, sleep, etc (Debian)

Posted: 21 Sep 2021 09:52 AM PDT

After a systemctl set-default multi-user.target, on bootup right after login I am sometimes spammed with the following rough message (number varies, not always 110) in a steadingly increasing endless loop:

** 110 printk messages dropped ** [increasing number here] usb 1-1.2.3.*: urb status -32  

If I were to unplug the usb hub (1-1.2.**) the loop stops. A similar error occurs on system sleep - upon pressing the power button, commands in /lib/systemd/system-sleep will start executing, but the system will ultimately fail to sleep due to the urb status -32 infinite error.

What is going on here? How can I remove the error?

System is Debian 8 (jessie).

ERROR: Kernel configuration is invalid?

Posted: 21 Sep 2021 09:35 AM PDT

I'm trying to build and compile some package with bitbake for Dreambox image. With ubuntu 20.04 no problem. But after upgrade to 21.04 I have got this error with compile.

Log data follows:| DEBUG: Executing shell function do_compile  | NOTE: make -j 8 ARCH=arm64 CONFIG_MALI_MIDGARD=m CONFIG_MALI_MIDGARD_DVFS=y CONFIG_MALI_PLATFORM_DEVICETREE=y CROSS_COMPILE=aarch64-oe-linux- DEPMOD=echo INSTALL_MOD_PATH=/home/raed/build_image/OpenPli-DM/openpli-dreambox-oe-core/build/tmp/work/dreamtwo-oe-linux/meson-mali-module-bifrost-r12p0/201901-0-gd4a30ca-r0/image M=/home/raed/build_image/OpenPli-DM/openpli-dreambox-oe-core/build/tmp/work/dreamtwo-oe-linux/meson-mali-module-bifrost-r12p0/201901-0-gd4a30ca-r0/meson-mali-module-bifrost-r12p0-201901-0-gd4a30ca/bifrost/r12p0/kernel/drivers/gpu/arm/midgard -C /home/raed/build_image/OpenPli-DM/openpli-dreambox-oe-core/build/tmp/work-shared/dreamtwo/kernel-source EXTRA_CFLAGS=-DCONFIG_MALI_PLATFORM_DEVICETREE -DCONFIG_MALI_MIDGARD_DVFS -DCONFIG_MALI_BACKEND=gpu  | make: Entering directory '/home/raed/build_image/OpenPli-DM/openpli-dreambox-oe-core/build/tmp/work-shared/dreamtwo/kernel-source'  | make[1]: Entering directory '/home/raed/build_image/OpenPli-DM/openpli-dreambox-oe-core/build/tmp/work-shared/dreamtwo/kernel-build-artifacts'  |   |   ERROR: Kernel configuration is invalid.  |          include/generated/autoconf.h or include/config/auto.conf are missing.  |          Run 'make oldconfig && make prepare' on kernel src to fix it.  |  

I have tried some solutions but without luck to solve it !!!

current kernel is (5.11.0-34-generic)

Bash Scripting Output

Posted: 21 Sep 2021 09:38 AM PDT

So my bash scripting is not the best, but the following script takes IP addresses from a text file and feeds the output to a shell and shows only the dns host names that resolve.

#!/bin/bash  while read line  do  dig @1.2.3.4 -x  "$line" +short  done  

and the output would look like:

one.foo.local  two.foo.local  three.foo.local  

How can I also print the ip address for the address that resolve to a dns name on the same line so it would appear like:

one.foo.local 2.3.4.5  two.foo.local 6.7.8.9  three.foo.local 7.5.3.1  

Thanks

Some questions about how IPTABLES works

Posted: 21 Sep 2021 08:58 AM PDT

I am building a 4G proxy server from this tutorial: https://learnproxy.altervista.org/create-your-own-mobile-4g-proxies-for-instagram-tutorial-2020/

In an excerpt of the tutorial, it is advised to create a script to make some routes in the ip tables of linux, but I am relatively new in the matter of networks and I am trying to better understand how it all works. If anyone can help me, guiding me better how these command lines work, I will be very grateful, the script in question is as follows:

sudo ifconfig usb0 192.168.0.100  sudo ip route add 192.168.0.0/24 dev usb0 src 192.168.0.100 table gw1  sudo ip route add default via 192.168.0.1 dev usb0 table gw1  sudo ip rule add from 192.168.0.100/32 table gw1  sudo ip rule add to 192.168.0.100/32 table gw1  

Remembering that previously a line containing 1 gw1 was added in the /etc/iproute2/rt_tables file

And my question is: what do these command lines do exactly?

I have a ZTE MF823 and it can only be recognized and used by the squid (Proxy Server) if this routing is done through iptables, if I direct the ip of the modem right after it is plugged in, the squid gives a 503 error (example below) .

I also tried to add, for example, a share via cellphone usb that follows the same structure as the modem, I made the identical configuration and it does not recognize the cell phone's internet, I tried using the same ip range 192.168.0.X and I also tried in the same way which is originally attributed when I plug the cell phone 192.168.42.X and both got the same error message, even following the script above.

SQUID configuration excerpt:

http_port 4000  acl port4000 myportname 4000  http_access allow port4000  tcp_outgoing_address 192.168.0.190 port4000  

Squid Error Example

1632201093.105 86 x.x.x.x NONE/503 0 CONNECT i.instagram.com:443 - HIER_NONE/- -

How to set font sizes in minimal X Window setup

Posted: 21 Sep 2021 08:53 AM PDT

I installed openSUSE with generic/minimal desktop environment. It means there is no fancy KDE/Gnome settings program for setting the font sizes by default.

On the other system I did the same, but installed additionally KDE3 (not a typo, 3).

In both system I have the same visual effect -- for applications like LibreOffice, VLC, Firefox the font used by the program in menus and dialogs is tiny. So how can I set the font size for such apps?

Linux routing does not use specific route

Posted: 21 Sep 2021 08:48 AM PDT

On openSUSE (Leap 15.3) i have the routing table:

0.0.0.0         AAA.BBB.145.1   0.0.0.0         UG    0      0        0 br0  AAA.BBB.0.0     0.0.0.0         255.255.0.0     U     0      0        0 br0  192.168.178.0   192.168.178.1   255.255.255.0   UG    0      0        0 eth1  

AAA.BBB.145.1 is the default Gateway (outside) 192.168.178.0 ist the internal network via eth1

I can access the outer network through default gateway. I can directly access the second (internal) network, eg 192.168.178.11

But i can´t access it with service, for example with firefox or wget because then the system is trying to get to the host 192.168.178.11 via the external Gateway AAA.BBB.145.1 which of course doesnt know anything about my internal network.

I though i could advise Linux to route all traffic to internal network 192.168.178.0 via 192.168.178.1 but Linux seems not to recognize my wish so i suppose that i have configured the dedicated route over eth1 wrong?

How to remove lines that have same id string

Posted: 21 Sep 2021 10:14 AM PDT

I have the following file:

start ======== id: 5713  start ======== id: 5911  start ======== id: 5911  end ========= id: 5911  start ======== id: 6111  end ========= id: 5713  start ======== id: 31117  

I want to remove lines that have the same id and they have respectively start and end

Based on the above example, the output will be:

start ======== id: 5911  start ======== id: 6111  start ======== id: 31117  

How to do this with bash, awk, sed ... ?

Streaming Microphone over Wifi HTTP

Posted: 21 Sep 2021 08:14 AM PDT

I have a Raspberry Pi Zero. I have a USB MIC attached to it.

I want to live stream the mic input over wifi http so I can play the audio from somewhere else(with same wifi connection)

I have searched Google a lot, got only a few such solutions which used CVLC but it is not working anyway on my raspi. (Buffer encoder error, got no solution)

What else can be used to do this?

Please what does "dd if=/dev/zero of=/dev/null &" do?

Posted: 21 Sep 2021 08:17 AM PDT

What does this command do?

dd if=/dev/zero of=/dev/null &  

I really don't understand what that command counts, because when I run it, it returns 4 figured numbers e.g 6204.

What are possible causes to the command not found errror, other than the PATH variable?

Posted: 21 Sep 2021 10:23 AM PDT

What are some possible causes, that a command could not be found in Linux. Other than it is not in the PATH?

Some background infos:

When trying to execute pdflatex from vscode, I got some troubles, that vscode was not able to find pdflatex. Probably because the PATH is not set correctly. Since I was not able to fix the problem right away, I tried to work around this problem by executing a shell script, which then calls pdflatex:

#!/bin/bash   export PATH=/usr/bin   pdflatex $@   

or

#!/bin/bash   /usr/bin/pdflatex $@   

In both cases the script works as expected, when executed over the normal terminal. But when executed in the vscode intern terminal it says pdflatex: command not found.

As far as I know the only way that a command can not be found, is if it is not in a directory included by the PATH. Or when the absolute path is wrong. But this seems not be the case here. So what other factors are used to determinate, how a command is searched for?

Additional Infos (as requestet)

  • OS: POP OS 21.04
  • from vscode terminal:$ echo $PATH /app/bin:/usr/bin:/home/flo/.var/app/com.visualstudio.code
  • from native terminal:$ echo $PATH /opt/anaconda3/bin:/opt/anaconda3/condabin:/home/flo/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
  • Other Commands as ls, which are also in /usr/bin do work from the vscode internal terminal (as ls aswell /usr/bin/ls).
  • properties of pdflatex: $ ls -l /usr/bin/pdflatex lrwxrwxrwx 1 root root 6 Feb 17 2021 /usr/bin/pdflatex -> pdftex
  • or $file /usr/bin/pdflatex /usr/bin/pdflatex: symbolic link to pdftex
  • and pdftex (same behavior as pdflatex): $ ls -l /usr/bin/pdftex -rwxr-xr-x 1 root root 2115048 Mar 13 2021 /usr/bin/pdftex
  • or $ file /usr/bin/pdftex /usr/bin/pdftex: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=88c89d7d883163b4544f9461668b73383e1ca04e, for GNU/Linux 3.2.0, stripped
  • the following script gives also the same output:
#!/bin/bash   pdflatex $@   
  • The original (copied, without any edits) script is as follow:
#!/bin/bash    #export PATH=/usr/bin  #printenv PATH  pdflatex $@  #/usr/bin/pdflatex $@  

To test the other scripts, I changed the comments and deleted the irrelevant lines in the post here.

  • /app/bin does not exist. (/app does not exist)
  • I tried to change the PATH in vscode (inside the LaTeX Workshop extensions), since this is most likley the cause for my problem in the first place. However I could neither fix the problem, nor confirm in any way, that my configs (for the LaTeX Workshop extension) had any effect at all.

NetworkManager does not start "secondaries" after a reboot

Posted: 21 Sep 2021 08:15 AM PDT

I have set a VPN as a "secondaries" network for the main wired connection as follows:

[connection]  id=netplan-eno2  uuid=80ab1970-e833-372e-8635-f330b7d9f1f0  type=ethernet  interface-name=eno2  permissions=  secondaries=f907c227-7ccb-4e46-b0fb-da13852b24c6;  timestamp=1631586742  

But after a restart, even though the contents of the /etc/NetworkManager/system-connections/netplan-eno2.nmconnection file are still as above, the named VPN didn't start. Running

nmcli c show id "netplan-eno2"  

doesn't show the secondary any more.

What have I missed?

No temperature reading on Ryzen 5700G?

Posted: 21 Sep 2021 09:57 AM PDT

I've built a new computer with a AMD Ryzen 5700G and to my surprise, no sensor information is picked up whatsoever. I thought perhaps the new AMD chips would not yet be recognized by Linux, but the docs say otherwise.

Here's sudo sensors-detect:

# sensors-detect version 3.6.0+git  # System: Gigabyte Technology Co., Ltd. B550I AORUS PRO AX [Default string]  # Kernel: 5.14.6-arch1-1 x86_64  # Processor: AMD Ryzen 7 5700G with Radeon Graphics (25/80/0)    This program will help you determine which kernel modules you need  to load to use lm_sensors most effectively. It is generally safe  and recommended to accept the default answers to all questions,  unless you know what you're doing.    Some south bridges, CPUs or memory controllers contain embedded sensors.  Do you want to scan for them? This is totally safe. (YES/no):   Silicon Integrated Systems SIS5595...                       No  VIA VT82C686 Integrated Sensors...                          No  VIA VT8231 Integrated Sensors...                            No  AMD K8 thermal sensors...                                   No  AMD Family 10h thermal sensors...                           No  AMD Family 11h thermal sensors...                           No  AMD Family 12h and 14h thermal sensors...                   No  AMD Family 15h thermal sensors...                           No  AMD Family 16h thermal sensors...                           No  AMD Family 17h thermal sensors...                           No  AMD Family 15h power sensors...                             No  AMD Family 16h power sensors...                             No  Hygon Family 18h thermal sensors...                         No  AMD Family 19h thermal sensors...                           No  Intel digital thermal sensor...                             No  Intel AMB FB-DIMM thermal sensor...                         No  Intel 5500/5520/X58 thermal sensor...                       No  VIA C7 thermal sensor...                                    No  VIA Nano thermal sensor...                                  No  

The kernel version should be new enough, and the 5700G should be detected as 'AMD Family 19h', but clearly it isn't.

I've tried manually loading the k10temp module to no effect. I've also tried reinstalling lm_sensors, updating the system and installing the 3rd party utility 'Zenpower', but still sensors looks quite pathetic:

iwlwifi_1-virtual-0  Adapter: Virtual device  temp1:            N/A      acpitz-acpi-0  Adapter: ACPI interface  temp1:        +16.8°C  (crit = +20.8°C)    nvme-pci-0400  Adapter: PCI adapter  Composite:    +43.9°C    

Is it perhaps the Zen 3 APU's that can't be detected? Or is there some other module or setting I'm missing?

exec command not found error in Linux

Posted: 21 Sep 2021 08:16 AM PDT

below commands are giving output and exiting the terminal

exec sleep 60  exec pwd  

below commands throws error. please advise on the exec behaviour

$ exec test1.sh  -bash: exec: test1.sh: not found    $ exec cd /home/  -bash: exec: cd: not found  

Huge delay in ps output from systemd

Posted: 21 Sep 2021 08:48 AM PDT

I'm getting huge a delay in ps output -- when it outputs the first line (systemd-networkd), there is a huge delay about 20 to 25 seconds, then the rest are displayed instantly.

$ ps -eaf  . . .  systemd+ 31865     1  0 Jul22 ?        00:00:10 /lib/systemd/systemd-networkd  62583    31891     1  0 Jul22 ?        00:00:12 /lib/systemd/systemd-timesyncd  root     31922     1  0 Jul22 ?        00:02:09 /lib/systemd/systemd-journald  . . .  

Any idea why (and the fix)?

$ time ps -o uname -p 31891  USER  62583    real    0m25.025s  user    0m0.006s  sys     0m0.006s    $ time getent passwd 62583 | wc        0       0       0    real    0m25.030s  user    0m0.005s  sys     0m0.001s    $ grep 62583 /etc/passwd | wc         0       0       0    $ grep passwd /etc/nsswitch.conf  passwd:         compat systemd    $ lsb_release -a  No LSB modules are available.  Distributor ID: Ubuntu  Description:    Ubuntu 18.04.1 LTS  Release:        18.04  Codename:       bionic    $ uname -rm  5.4.0-1047-azure x86_64  

Raspberry Pi: External HDD "wrong fs type, bad option"

Posted: 21 Sep 2021 08:14 AM PDT

I'm trying to set up an external hard drive to my Pi. I got one from the store with 2TB of storage. I plugged it in and ran lsblk:

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT  loop0         7:0    0 38.8M  1 loop /snap/certbot/1344  loop1         7:1    0 38.7M  1 loop /snap/certbot/1435  loop2         7:2    0 84.4M  1 loop /snap/core/11610  loop3         7:3    0 51.5M  1 loop /snap/core20/1085  sda           8:0    0  1.8T  0 disk  mmcblk0     179:0    0 29.8G  0 disk  ├─mmcblk0p1 179:1    0  256M  0 part /boot  └─mmcblk0p2 179:2    0 29.5G  0 part /  

I tried to mount it to /var/www/drive2 but I got this error:

mount: /var/www/drive2: wrong fs type, bad option, bad superblock on /dev/sda, missing codepage or helper program, or other error.  

How can I fix this? Is there something wrong with my HDD?

use zip command in linux bash

Posted: 21 Sep 2021 08:12 AM PDT

I am currently doing an exercise on bash. Trying to use bzip2 gzip and zip to determine which way is most efficient compressing program. The question is on the zip command part. It works and echo the size of file ziped. However, the linux shows that

line 22: adding:: command not found  

enter image description here

Filename modification

Posted: 21 Sep 2021 08:17 AM PDT

Lets say I have 1000 files named as file1.txt ... file1000.txt

I need to change the file name if the number is divisible by 10.

I did this and it just change the first letter

for f in *.txt; do mv -- "$f" "${f%.txt}.doc"; done  

Linux source path issue with nvidia graphic driver installation

Posted: 21 Sep 2021 08:25 AM PDT

I'm trying to install nvidia driver on Ubuntu Linux 20.

The issue - I'm getting the following error during installation.

If you are using a Linux 2.6 kernel, please make sure you have configured kernel sources matching your kernel installed on your system. If you specified a separate output directory using either the "KBUILD_OUTPUT" or the "O" KBUILD parameter, make sure to specify this directory with the SYSOUT environment variable or with the equivalent nvidia-installer command line option.

Depending on where and how the kernel sources (or the kernel headers) were installed, you may need to specify their location with the SYSSRC environment variable or the equivalent nvidia-installer command line option.

What I tried so far

  1. tried to pass the --kernel-source-path option
    sudo sh NVIDIA-Linux-x86_64-319.17.run --kernel-source-path /lib/modules/5.11.0-34-generic/build  
  2. tried setting SYSSRC environment variable
    export SYSSRC /lib/modules/5.11.0-34-generic/build  sudo sh NVIDIA-Linux-x86_64-319.17.run  

As far I understand it tries to compile the driver against the current running kernel version 5.11.0-34-generic but for some reason it can't find the kernel.h file or the whole source directory, maybe I mis-configure something. I also tried cloning the Linux kernel repository, checked out the matching branch and set the --kernel-source-path to this directory but it didn't work.

Here is the readme file.

how to display current X-Y position of window in gnome-terminal

Posted: 21 Sep 2021 09:01 AM PDT

For input into gnome-terminal --geometry. I would like to customize the gnome-terminal position upon opening it.

Reset memory.oom_kill

Posted: 21 Sep 2021 08:11 AM PDT

I am learning about cgroups and trying out a few examples to see how it works. For the memory controller, I created an example group, ran an application that tries to use more memory than it has been allocated. And, as expected, the program gets killed by OOM. My question is, is there a way to reset the oom_kill field in memory.oom_control?

I tried overwriting the file with root permissions, but that did not work. I was not allowed to overwrite the field to set it back to zero.

I also ran the same application (within the example cgroup), this time, using less memory than it has been allocated. Program runs successfully, but the oom_kill field is still set to 1.

Downgrade cinnamon version

Posted: 21 Sep 2021 08:31 AM PDT

I upgraded Linux Mint from 20 to 20.2 and it comes with Cinnamon 5.0 uma, which breaks my fractional scaling. The Ubuntu DE doesn't do that.

How can I downgrade back to Cinnamon 4, or configure correctly for fractional scaling?

Is there any package manager for BLFS?

Posted: 21 Sep 2021 08:27 AM PDT

I have successfully installed BLFS 8.4 and now I want to install a package manager to keep my system up to date. I want to know if it's possible and how.

Mounting squashfs with correct permissions

Posted: 21 Sep 2021 10:01 AM PDT

I frequently use mksquashfs to make backups of folders on various systems. Sometimes this results in files which cannot be read by any users upon mounting. If I do a sudo mount file.squashfs /to/mountpoint and then try to ls the directory as root or with sudo I get a "permission denied" error. Viewing the properties of the mountpoint in Thunar results in it showing the owner as nobody. Applying a chmod also doesn't work as squashfs is a read-only filesystem.

How can I force mount to mount squashfs in a permissions-agnostic way or with the correct permissions? I don't actually need permissions for this use case, it may as well be world-readable.

Edit: I never found a full solution for opening "unreadable by root due to permissions" squashfs files, but I did find a way to prevent it from happening again. This works cross-system and cross-platform. Adding -all-root makes all files in the archive owned by root. Since permissions aren't important for these backups it is a clunky but effective fix. Still curious to see if somebody has a better one.

pulseaudio-equalizer doesn't work on Debian 9

Posted: 21 Sep 2021 09:06 AM PDT

After installing pulseaudio-equalizer it doesn't seem to be bound to pulseaudio

My ~/.config/pulse/default.pa inspired from here

#include system-wise config  .include /etc/pulse/default.pa    #compressor -- for normalize audio volume  .ifexists module-ladspa-sink.so  .nofail    ### BEGIN: Equalized audio configuration  ### Generated from: pulseaudio-equalizer  load-module module-ladspa-sink sink_name=ladspa_output.compressed master=alsa_output.pci-0000_00_1b.0.analog-stereo plugin=sc1_1425.so label=sc1 control=101,401,-24,3,5,9.6    load-module module-ladspa-sink sink_name=ladspa_output.equalized master=ladspa_output.compressed plugin=mbeq_1197 label=mbeq control=0.0,-2.0,-2.0,-4.0,-4.0,-2.0,4.0,6.0,7.5,7.5,7.5,7.5,4.0,2.0,0.0    load-module module-ladspa-sink sink_name=ladspa_output.normalized master=ladspa_output.equalized plugin=fast_lookahead_limiter_1913 label=fastLookaheadLimiter control=15,0,0.8    set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo  set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo 65536  set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo 0    load-module module-equalizer-sink  load-module module-dbus-protocol    set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo    ### END: Equalized audio configuration    .fail  .endif    ###use the below pactl command for alsa card should be one w/o .monitor###  ###  pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2  ###  ###  pacmd list-sinks | sed -n "/^.*name:/s/.*<\(.*\)>.*/\1/p"         ###  ###  pulseaudio -k  <<< kill pulseaudio, it will restart               ###  

My interfaces

pacmd list-sources | grep -e 'name:' -e 'index'      index: 0          name: <alsa_output.pci-0000_00_03.0.hdmi-stereo-extra1.monitor>      index: 1          name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>  * index: 2          name: <alsa_input.pci-0000_00_1b.0.analog-stereo>      index: 3          name: <alsa_output.pci-0000_00_1b.0.analog-stereo.equalizer.monitor>  

enter image description here

Create own dead_key

Posted: 21 Sep 2021 09:06 AM PDT

I am currently working to create a specific greek keyboard layout adapted to French Swiss Keyboard,

I create a keyboard layout to be put to /usr/share/X11/xkb/symbols/( https://github.com/grecromand/grecromand/blob/master/linux/grecromand).

I used code dead_grave. But I would like to create my own dead_xx. It would be dead_sigma which would produce a ς if followed by space or ponctuation mark, and σ otherwise.

I Have understood that dead_key are defined in /usr/share/X11/locale but not more.

I have so many question:

  • WHich file should I modify? Is it possible to create this dead_key without modifiying distributed files, to avoir problem when upgrading my system?
  • How can I declare this dead_key?

How do I append/prepend a timestamp to grep output?

Posted: 21 Sep 2021 08:59 AM PDT

I am running a small linux server at home, and I am writing a script to log the temperature of the CPU cores every 5 seconds, but I need timestamps for it to be useful. So far I have something that saves the output of the sensors command into a file, and I have a command that prints the date and time. I just need to figure out how to combine those two.

sensors | grep ^Core* >> temps.log saves temps in temps.log in following format:

Core 0:       +39.0°C  (high = +76.0°C, crit = +100.0°C)  Core 1:       +40.0°C  (high = +76.0°C, crit = +100.0°C)  

and for the date I can do date +%m/%d/%y-%H:%M:%S which returns

mm/dd/yy-hh:mm:ss  

I googled around and saw someone suggesting the use of gawk but I have absolutely no idea how gawk works.

No comments:

Post a Comment