Answer by Kamil Maciorowski for Cloning single disk drive to multiple drives...
Use caseThis answer applies to a case where you suspect the source drive may be faulty, so you want to use GNU ddrescue or a similar tool. The tool writes to exactly one seekable file. You want it to...
View ArticleAnswer by Kamil Maciorowski for What is the 127.0.0.2 IP address for?
Not a comprehensive general answer (there's one already). This answer of mine shows an example where 127.0.0.2 was used to solve the problem.Extract:The OP there attempted to test some software in a...
View ArticleAnswer by Kamil Maciorowski for tmux: Can't `bind-key` Ctrl+3 to '#'
AnalysisWhat is the issue?The issue is: for a program reading from a terminal there is no such thing as Ctrl+3.Terminals and terminal emulators do not pass keystrokes that ultimately get to programs...
View ArticleComment by Kamil Maciorowski on Can I login into sddm as some user, not...
@NikitaKipriyanov Implemented in this alternative solution.
View ArticleAnswer by Kamil Maciorowski for Can I login into sddm as some user, not...
Solution with PAM, policy configured in sudoersCreate /usr/local/bin/use-own-password with the right ownership and permissions. The following shell code will do it:sudo sh -e -c 'cat >...
View ArticleAnswer by Kamil Maciorowski for Why am I getting a "no such file or...
Shells commonly used in Linux/Unix replace tilde (~) with the value of the HOME shell variable, but only if the tilde is unquoted and unescaped.The whole mechanics is more complicated, with supported...
View ArticleAnswer by Kamil Maciorowski for SSH upgrade proxy connection to direct...
A pretty standard method of solving this (at least in case of IPv4) is as follows:You ssh into the remote host via a proxy.Once there, you ssh back to your local computer without a proxy. This requires...
View ArticleAnswer by Kamil Maciorowski for unknown command error when loading .tmux.conf
It appears tmux.conf syntax has changed and these commands no longer generate a syntactically valid file.To convert options shown by tmux show -g to valid tmux commands you need to add set-option -g...
View ArticleAnswer by Kamil Maciorowski for How do I get Calc `REGEX` to return nothing...
the REGEXExpression argument is long, complex, difficult to read and this method means I have to edit two of them, identically, every time I make a change while I'm working out the REThe Expression...
View ArticleAnswer by Kamil Maciorowski for What is the effect of Ctrl + Z for a...
A program started directly in a terminal has its stdin, stdout and stderr connected to the special file associated with the terminal, e.g. to /dev/ttyN or /dev/pts/N (where N is a number). Even without...
View ArticleAnswer by Kamil Maciorowski for Find directories contatining mkv with 1 link
I wish to add an exec command to move directories that have said files somewhere else. Is that at all possible?Yes. I assume by "exec" you mean -exec in find. This is my basic solution. Read the whole...
View ArticleComment by Kamil Maciorowski on How to allow find but forbid find -exec in...
@marcelm You are right. Answer improved.
View ArticleAnswer by Kamil Maciorowski for How does exec interact with pipes in shells?
It means, if I understand correctly, that all commands trying to read from stdin will actually read from fileA command reading from its stdin will read from a regular file if its stdin happens to be...
View ArticleAnswer by Kamil Maciorowski for How to print all lines matching the pattern 1...
<data sed -n ' /someheader/ {h;d} /zzz/ { x /./ p s/.*// x p d }'Explanation:If the current line contains someheader, copy it to the hold space for later; delete the pattern space and start a new...
View ArticleAnswer by Kamil Maciorowski for How do I resize tmux pane by holding down...
By default these bindings (among others) are active:bind-key -r -T prefix M-Up resize-pane -U 5bind-key -r -T prefix M-Down resize-pane -D 5bind-key -r -T prefix M-Left resize-pane -L 5bind-key -r -T...
View ArticleAnswer by Kamil Maciorowski for Uses of single-partition disk configuration
Is there any reason why a partition would be used in this case rather than a whole disk?Few reasons I can think of:People (read: future admins) expect partition tables. Having them saves WTF moments....
View ArticleAnswer by Kamil Maciorowski for Beaglebone Black filesystem resize -...
Partitions and filesystems are not the same. At no point the filesystem was destroyed.Partition is just a part of a larger device, identified by some entry in a partition table. fdisk manipulates this...
View ArticleAnswer by Kamil Maciorowski for How to determine the use of a mystery...
About parted"Partition Table: loop" is parted's way of saying that there is actually no partition table. Misleading, I know.Not having a partition table is totally normal in this case, because your...
View ArticleAnswer by Kamil Maciorowski for disable terminal bell except when called...
Analysisecho -e "\a" prints the BEL character, 0x07 in ASCII (and a trailing newline which is irrelevant for us). Your terminal (terminal emulator), when it gets this exact character, instead of...
View ArticleAnswer by Kamil Maciorowski for How to run an infinite loop program on...
Analysis; is a command terminator that makes the shell run the command synchronously.& is a command terminator that makes the shell run the command asynchronously.&; in your augmented code is...
View ArticleAnswer by Kamil Maciorowski for xterm ignores button remapping command
NumpadSubtract does not work for me in Kubuntu 24.04 LTS. Sole KP_Subtract is also wrong. The right string is <KeyPress>KP_Subtract.string(0x1b) string(0x5b) string(0x41) generates what ↑...
View ArticleAnswer by Kamil Maciorowski for SSH seems to ignore command line options when...
Without -JWith ssh -o ProxyCommand='ssh -W %h:%p …'… you can do what -J does. In this form you pass options to each ssh separately, so you can use -m exactly where you need it:ssh -o ProxyCommand='ssh...
View ArticleAnswer by Kamil Maciorowski for How to automatically rename tmux window to an...
Preliminary notesSome parts of the analysis (below) apply mainly to Linux.The solution had been tested in Kubuntu 21.10 and published. Only then the OP revealed they are using macOS; it turned out the...
View ArticleAnswer by Kamil Maciorowski for Is it possible to combine two USB flash...
If "logical partition that would appear as one larger disk" is not a strict requirement then you can use Btrfs.First decide if you want to commit whole USB sticks to the filesystem you are going to...
View ArticleAnswer by Kamil Maciorowski for Sudoers NOPASSWD for single executable but...
man 5 sudoers says:When multiple entries match for a user, they are applied in order. Where there are multiple matches, the last match is used (which is not necessarily the most specific match).So you...
View ArticleAnswer by Kamil Maciorowski for Require bash script to be run with sudo (not...
UID and EUID variables are initialized by Bash at shell startup, but my tests indicate that if they are already in the environment then they will not be changed. The output of id -ru and id -u is...
View ArticleAnswer by Kamil Maciorowski for Setting up a cron job which runs on the...
The first Thursday of a month is between the 1st and the 7th day of the month (inclusive). The second Thursday is between 8th and 14th, the third Thursday is between 15th and 21st.The Monday in the...
View ArticleAnswer by Kamil Maciorowski for bash alias or bash function that adds a...
A function like this:# unalias nanotime first, if needednanotime() { nano "$(date +%Y-%m-%d_%H.%M.%S)-$1"}will do what you want, although it's limited.It simply glues the date string to the beginning...
View ArticleAnswer by Kamil Maciorowski for Why is “less -R” not displaying colors in...
Some programs can detect if they write to a pipe or to a regular file, or to a terminal (tty); they produce colorful output only in this latter case.Example: ls does something like that with ls...
View ArticleAnswer by Kamil Maciorowski for How are ctags and etags actually defined in...
man ctags states:default is tags, or TAGS when running in etags modeAnd about the etags mode:[…] will create a tag file for use with the Emacs editor. […] if ctags is invoked by a name containing the...
View ArticleComment by Kamil Maciorowski on Why does rsync send the incremental file list...
"to itself" – Are you sure? Arent' there separate processes? I can only guess why the design is what it is (and therefore this is not an answer). A reasonable guess: the same general design works via...
View ArticleComment by Kamil Maciorowski on scp: command not found while both sides have...
Seems like the point 6 from "History, SCP and SFTP" here. In shell startup scripts on the target server try to find a line similar to PATH='$PATH:/opt/python/3.9.2/bin:$HOME/.local/bin'. Is there such...
View ArticleComment by Kamil Maciorowski on 'sudo -u' gives error "sorry, try again" for...
Please do not cross-post. For the record, another copy is on Unix & Linux SE.
View ArticleComment by Kamil Maciorowski on MariaDB connection over SSH but using socket...
So... You're telling us you need local sudo mysql ... because the remote MariaDB server can tell what local user opens the local socket; do I get it right? What if you do this locally without sudo (and...
View ArticleComment by Kamil Maciorowski on Why is ADB stopping phone from ejection in...
The solution should be posted as an answer (below). You can answer your own question. There is no need to litter the title with "solved"; accept the best answer to indicate the problem is solved.
View ArticleComment by Kamil Maciorowski on Hide Devices Section from KDE Dolphin
What is the real problem? Does the performance of Dolphin deteriorate because of many mountpoints or what? If you want each user to be unable to access other users' directories then hiding them in...
View ArticleComment by Kamil Maciorowski on How to verify that hard drive is filled with...
As grep 0x00 searches for literal0x00 string, you will probably get binary file matches from your grep -v …. It will only mean there was a "line" not containing literal 0x00. A leading null byte or two...
View ArticleComment by Kamil Maciorowski on Could a change of ISP affect the strength of...
The title (about wifi) and the body (about fibre) seem to be two different questions. Quite confusing. Please [edit] and clarify.
View ArticleComment by Kamil Maciorowski on How to run command recursively on directories...
@jsotola It's probably "on directories only, on Ubuntu".
View ArticleComment by Kamil Maciorowski on Cloning 60GB IDE drive via USB adapter is...
What is the exact command you used? What is the OS? Are you using dd with the default bs=? Are you using some very old hardware? (e.g. with USB 1.1). Please [edit] the question and add information.
View Article