Quantcast
Channel: User Kamil Maciorowski - Super User
Browsing latest articles
Browse All 670 View Live

Answer 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 Article


Answer 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 Article


Answer 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 Article

Comment by Kamil Maciorowski on How to allow find but forbid find -exec in...

@marcelm You are right. Answer improved.

View Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article


Answer by Kamil Maciorowski for Is there a safe way to automatically remove a...

Use tmpfs, e.g. create the file inside /dev/shm.It is intended to appear as a mounted file system, but stored in volatile memory instead of a persistent storage device.[emphasis mine]In my Debian /run...

View Article

Comment by Kamil Maciorowski on How to remove blank lines before line...

@MichaelFirth In both cases we target a multi-line pattern space where there are empty line(s) at the beginning and there is # End of dynamic section at the end, so we anchor accordingly. Anchoring #...

View Article

Answer by Kamil Maciorowski for How can I get the extension(s) of a file...

Why does file --extension not work for me?Not only for you. See this question. One of the comments there seems right:Maybe just a very, very incomplete feature?I haven't found any standard Unix tool to...

View Article


Answer by Kamil Maciorowski for Does LBA size map to the physical or logical...

Logical.Note LBA stands for Logical Block Addressing. This corresponds nicely in this case, but until you know the technical details you cannot be sure if usage of the same word is not misleading.If...

View Article

Comment by Kamil Maciorowski on How to rollback BTRFS snapshots using snapper...

I don't know snapper but I do know Btrfs a little and I think whatever snapper does, you need to mount / anew to see it has been reverted. Probably not (easily) possible from the running OS, but if...

View Article

Comment by Kamil Maciorowski on Why do Linux systems have so much committed...

You: "Linux, on the other hand, must temporarily commit enough memory for the child process to be as big as its parent, only to then reduce to the size of the actual child. That temporary state would...

View Article

Comment by Kamil Maciorowski on How to redirect the output of sed into a file?

Does mosquitto_sub finish? Or do you want to see the output in realtime while it keeps working? Does this answer help?

View Article



Comment by Kamil Maciorowski on CRON job does run, but script never executes

The shebang question rephrased: is there really #!/bin/bashwith spaces at the beginning of the script? (wrong thing); or is there #!/bin/bash without spaces? (probably right thing). The example you...

View Article

Comment by Kamil Maciorowski on How to clear 'Recent Files' history, without...

In my (newer) Dolphin there is the "Forget File" entry in the context menu. Isn't there such entry in your Dolphin?

View Article

Answer by Kamil Maciorowski for How to move one file from a list and rename it?

There is already a working answer, sub-optimal though. Breaking out of a for loop seems unnecessarily complicated. You can create an array without a loop. In the following example we set anew the array...

View Article

Comment by Kamil Maciorowski on How do I stop questions modified by bot from...

Side note: answering a 15-year-old question is not necessarily a bad thing. The best reason for me to answer any question is "because this is what I want".

View Article


Comment by Kamil Maciorowski on How to deal with a disk failure apparently...

Please don't post images of text.

View Article

Comment by Kamil Maciorowski on How can I get "find" output so that I can...

In bash this could be useful. I strongly suspect zsh provides means to implement something similar.

View Article

Comment by Kamil Maciorowski on How to specify an external source directory...

What exactly is wrong with cd? If you want to stay in the current directory then do everything in a subshell: (cd …&& qmake && make). Or do you want to build in the current directory...

View Article


Comment by Kamil Maciorowski on How to automate saving prompt history on csh...

"Normally, history is saved on exit, but this doesn't happen when the connection is lost." – First of all, are you sure the old csh has exited? My point is when an SSH connection is lost, the server...

View Article


Comment by Kamil Maciorowski on Why does the “du” command show different...

Are there hidden files (dot files) directly under dir4? Normally * does not match filenames starting with a dot.

View Article

Answer by Kamil Maciorowski for How to efficiently view files returned from...

I use tmux and KDE. The two can be used as a foundation of what you want to do. Run this in a shell in tmux:tmux bind-key -T root C-MouseDown1Pane run-shell 'cd /proc/#{pane_pid}/cwd &&...

View Article

Comment by Kamil Maciorowski on How to change error behaviour of DVD-Drive?

"This drive just returns zeroes and no error when a sector can't be read." – If there is no error then how do you know the sector cannot be read? Maybe the sector just happens to be full of zeros and...

View Article

Answer by Kamil Maciorowski for Why I don't have a root privileges with suid...

Adding suid bit to bash is equivalent to running sudo bash, with root privileges.No. An executable with suid runs with effective user id 0 (root) and real user id of the invoking user. sudo executable...

View Article


Comment by Kamil Maciorowski on What's the idiomatic way to process input...

@Jeenu "a shame that the output of split has to go to a file, not stdout" – Stdout (whatever it is connected or redirected to) is a file. You probably mean multiple regular files vs a single pipe. If...

View Article

Comment by Kamil Maciorowski on Why does "tmux send-keys" behave differently...

Do you really want to send keys? Or do you want to run something? Sending keys is a very cumbersome way to run something in tmux. See the beginning of this answer; and maybe this one.

View Article

Browsing latest articles
Browse All 670 View Live