Answers

Linux questions/answers collected from open sources. Each question has a confirmed answer.

How to Make a Systemd Private Network Namespace Accessable

How to Make a Systemd Private Network Namespace Accessable So I have an application that only binds to 0.0.0.0 and listens on a port (TCP). The communication is unencrypted and unauthorized so I’d like to work around that without getting too deep into the weeds. I’d like it to bind on 127.0.0.1 so I can …

Total answers: 1

How (abc) is parsed in bash

How (abc) is parsed in bash I’m using a program designed for windows that I compiled myself for GNU/linux. The program works in the command line, and one argument looks like this: prgm -arg1 abcd(10)(22) -i files.ext Where (10) and (22) are flags like a, b, c and d. This command is failing because bash …

Total answers: 2

Replace last nonblank line with a command output

Replace last nonblank line with a command output I have a .env file like PARAM1=val PARAM2=val I want to replace the last noblank line with another file content So far I have something like below: { (sed -e :a -e ‘/^n*$/{$d;N;ba’ -e ‘}’ local.env | sed ‘$d’ local.env && printf "CONFIG=%s" "$(cat config.json | jq …

Total answers: 2

renaming files based on matched pattern in another file

renaming files based on matched pattern in another file I have a list of files: out_CCGCGGTT+CTAGCGCT_R1.fq.gz out_TTATAACC+TCGATATC_R2.fq.gz out_GGACTTGG+CGTCTGCG_R1.fq.gz out_AAGTCCAA+TACTCATA_R2.fq.gz … the adaptor IDs (between the two underscores, like AACGTTCC+AGTACTCC, AACGTTCC+AGTACTCC) match with the first column of ID.file.txt head ID.file.txt: CCGCGGTT+CTAGCGCT NHL_332_N TTATAACC+TCGATATC NHL_333_T GGACTTGG+CGTCTGCG NHL_334_T AAGTCCAA+TACTCATA NHL_335_T ATCCACTG+ACGCACCT NHL_336_N GCTTGTCA+GTATGTTC NHL_337_N CAAGCTAG+CGCTATGT NHL_338_N TGGATCGA+TATCGCAC NHL_339_T …

Total answers: 2

How to find a string in files, said string including line breaks, ", @

How to find a string in files, said string including line breaks, ", @ I know grep allows me to search for a string in files, however I did not manage to find the right method to search for the following string: "snapshot3" : { "@custom_name" : true So the string I am looking for …

Total answers: 1

How can I write my input down to file?

How can I write my input down to file? Recently, I needed to write my terminal output down. And I’ve read this question to find the answer. But now, I would like to write my commands down (which I type in terminal, for example:sudo apt update etc.) to store the history of what I have …

Total answers: 1

With what shared objects are the debug symbols in a debug deb package assocciated with?

With what shared objects are the debug symbols in a debug deb package assocciated with? I am trying to find debug symbols that are associated with various shared objects shipped under the Ubuntu 22.04 distro. For example, let’s consider the amd64 deb package: libssl3 (version 3.0.2-0ubuntu1) which ships a number of stripped shared objects. One …

Total answers: 1

Firefox leaves old snaps on disk

Firefox leaves old snaps on disk I am using Firefox installed through snap (Ubuntu 23.04, snapd/lunar-updates,lunar-security,now 2.59.1+23.04ubuntu1.1 amd64). I have removed all but latest versions due to lack of disk space. Installed should be only the latest version as reported by snap: sudo snap list –all | grep firefox firefox 117.0.1-2 3131 latest/stable/… mozilla** But …

Total answers: 1

Nautilus open terminal in remote edit command

Nautilus open terminal in remote edit command I regularly use the "right click → open in remote terminal" functionality of Nautilus in Ubuntu 22.04. I don’t know the command, but it seems it is doing ssh blah@host, and I would like to add the -X flag so I can open GUI applications from this terminal. …

Total answers: 1

How to reuse matched value in bash globbing?

How to reuse matched value in bash globbing? I was wondering whether it is possible to reuse whatever was matched in a path with globbing? (Just as it can usually be done with regex substitutions?) I’m aware that there are other solutions for the following example, but I’m just using it as an example for …

Total answers: 1

Sources.list Critical Vulnerability link update

Sources.list Critical Vulnerability link update This question is related to this GitHub post. I just wanted to make sure if I got the link correctly and not made an error I replace the ma.archiveUbuntu links with http://security.ubuntu.com/ubuntu Is this correct, or do I do to do something else? Asked By: Vegeto.T || Source If we …

Total answers: 1

How to fade out batch wav files?

How to fade out batch wav files? I need to apply a fade out of 2 seconds on a batch of wav files (with names including spaces like C 0 120-127.wav). The files length varies, but I need a fade out of 2 seconds from the end of each file, regardless of the file length. …

Total answers: 2

Write image to current root-partition

Write image to current root-partition I’m currently playing with building disk images (based on Debian) for a raspberry-like computer. My current workflow looks like: create disk image (about 16GB uncompressed; or 3GB compressed) power-down the target system eject the SDcard on the target system insert the SDcard into the build computer dd the image onto …

Total answers: 3

How to define port forwarding

How to define port forwarding I run a server with a web server running as a rootless podman container. This exposes ports 10080 and 10443 because, as a rootless container, it is not allowed to expose ports 80 and 443. So that my website can be accessed from outside, I use ufw as a firewall …

Total answers: 1

Bash script variable syntax: with some commands it works, with others it does not

Bash script variable syntax: with some commands it works, with others it does not I do not understand the behaviour of this variable: SSH_CONFIG_FILE="~/.ssh/config" echo $SSH_CONFIG_FILE ls -l $SSH_CONFIG_FILE ls -l ~/.ssh/config This is the output: ~/.ssh/config ls: cannot access ‘~/.ssh/config’: No such file or directory -rw——- 1 pm domain^users 1229 Sep 19 10:52 /home/pm/.ssh/config …

Total answers: 1