Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [gnu]

GNU Project is a free software, mass collaboration project. The founding goal of the project was, in the words of its initial announcement, to develop "a sufficient body of free software [...] to get along without any software that is not free.

0
votes
1answer
26 views

GNU Parallel facing silent exit and invalid option error

I tried performing the full installation from: http://git.savannah.gnu.org/cgit/parallel.git/tree/README The installation was successful. It's working well when installed on Mac OS but on Amazon ...
7
votes
1answer
132 views

Newlines in BSD sed vs gsed

The sed, which comes with FreeBSD 11.2 p7, gives: $ seq 10 | sed 'N; l; D; p' 1$ 2$ 2$ 3$ 3$ 4$ 4$ 5$ 5$ 6$ 6$ 7$ 7$ 8$ 8$ 9$ 9$ 10$ While gsed (GNU sed 4.7) gives for the same script: $ seq 10 | ...
0
votes
2answers
63 views

Are there multiple flavors of the GNU tools?

I think that the BSD tools have different flavors, for example the BSD ls tool is not the same tool on FreeBSD and OpenBSD and NetBSD (and even on macOS). Note that by "different flavors" I mean that ...
1
vote
1answer
79 views

Repeat print of a pattern repeated n times in one line with sed

With a sed cmd I want to print all occurrences of a pattern in one line. I know how to do this with grep -Pe and with awk. I started with: $ sed 's/^.*label="\(.*\)" selected.*$/\1/g' <(echo '...
1
vote
1answer
84 views

Does Apple modify the GNU and BSD tools that comes with macOS? [duplicate]

macOS comes with bash (which is a GNU tool), macOS also comes with tools like ls and chmod (which are BSD tools, even though I don't know from which BSD flavor they come from). Now does the GNU and ...
3
votes
3answers
435 views

insert EOF statement before the last line of file

I want to insert this cat <<EOF >> /etc/security/limits.conf * soft nproc 65535 * hard nproc 65535 * soft nofile 65535 * hard ...
0
votes
0answers
14 views

GNU Linker Colorization

Compiling code with GCC or Clang can result in some colorful error outputs. Linking code, however, doesn't enjoy the same luxury. It seems like the GNU Linker doesn't support colorized error output ...
1
vote
3answers
110 views

grep everything up until and including a pattern

Let's assume I have a log file that contains exceptions as shown java.lang.NullPointerException blabla ABC.Exception blalabbla dogchacecat.Exception yadayada I want to be able to output each line ...
15
votes
5answers
1k views

Subtract time using date and bash

All the other questions on the SE network deal with scenarios where either the date is assumed to be now (Q) or where only a date is specified (Q). What I want to do is supply a date and time, and ...
2
votes
1answer
40 views

Add (true || … ) to a function using sed

I quickly want to patch a huge library by adding true || in front of every function call. Example input: if function_a(some_parameters) && function_b would turn into if (true || function_a(...
0
votes
2answers
79 views

How can sed replace in the range of nth line regex specified?

I am to replace using sed the 3th (or nth to be more general) occurrence in respective line with specified match regex. so far as i can is only to do the first: $cat file # Golden dictionary is a ...
7
votes
1answer
221 views

Any way to have a “verbose mode” or “debug mode” with sed?

Is there a way to make gnu sed be verbose about what is run and what is done ? I'd like to have something like a "debug mode" so that I can see - for each line of input - the content of the hold space ...
6
votes
7answers
565 views

How to avoid printing a newline when seq completes?

To create a column header, looking like: 1234567890123456789 I (am trying to) use seq and echo: seq -s '' 1 9 ; echo -n 0; seq -s '' 1 9 However, seq outputs a newline after each run. How can I ...
0
votes
0answers
35 views

Why doesn't Guile have /usr/local in path?

I've noticed when compiling and installing modules for Guile in /usr/local that they cannot be found, while setting the prefix to /usr they work as intended. Is there a reason why Guile doesn't have /...
1
vote
1answer
48 views

what used to lead /bin being full and creation of /usr/bin?

I am and was reading https://lwn.net/Articles/773342/ where the current move of migrating whole lot of filesystem from /usr/$something to simply /usr . Some of the comments again and again comment on ...
0
votes
2answers
100 views

Gnu Sed: Space Character class not matching for end of line character

Pattern: abc followed by space or is the last character in a line. orig="abc[[:space:]]+"; new=Hello sed -i -r -e "s|${orig}|${new}|g" ./file ; File: abc abcd abc abc d After executing: abc abcd ...
-1
votes
1answer
149 views

Bash Conditional String and Integer together

I am trying to do both integer and string comparison in a statement as follows: $ TimeHr=$(date +%_H) $ Time=Night $ echo TimeHr 1 $ if ((TimeHr>18 || TimeHr<5 )) && [ Time == "Night" ]...
1
vote
2answers
144 views

Awk or Sed: If pattern is found: delete line && export variable

In my bashscript I want Sed to find debug: Debug in a file ${SourceP} and if found delete that line and export to the environment Debug=Debug sed -i '/debug: Debug/,+0 d' ${SourceP} && export ...
1
vote
1answer
42 views

Why does `xargs -n ` on SmartOS (SunOS) behave differently than other implementations?

It seems the -n option on the xargs found in SmartOS (and I assume Solaris) does not behave like any other version of xargs I've encountered. Take this example: Builtin /usr/bin/xargs (odd behavoir):...
0
votes
1answer
52 views

Array inside an Array: Different syntax for Array in bash

I found the following example from here. But I can't understand how is array arr is being defined. a='domain.de;de;https' $ arr=(${a//;/ }) What is the advantage of defining it like this? Actually, ...
0
votes
1answer
55 views

What is the predefined order in which man searches sections? [duplicate]

The description of man in its own man page contains the statement, The default action is to search in all of the available sections following a pre-defined order ("1 n l 8 3 0 2 5 4 ...
1
vote
1answer
141 views

GNU coreutils and GNU Bash [closed]

I confused with GNU coreutils and GNU Bash, I have installed Bash GNU Project - Free Software Foundation, Should I install Coreutils - GNU core utilities How could I distinguish them?
0
votes
0answers
40 views

Update Reference to GNU/Bash manual in place on Macos

I installed GNU/bash on MacOs and set it as default: $ bash --version GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin18.0.0) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: ...
0
votes
0answers
213 views

My Debian install gives me black screen on start up - it's a quick fix but it happens every time

My issue is a bit strange. I am running Debian GNU/Linux Testing Buster, and I'm very happy with it. However, it has one minor but persistent issue that I can't seem to figure out. Each and every time ...
4
votes
2answers
667 views

Makefile and .ONESHELL

When .ONESHELL is not used Makefile executes each shell commands in a separate shell. What is the benefit of this? Why doesn't makefile uses the same shell?
0
votes
1answer
46 views

GNU coreutils need suggestions [closed]

Can anyone please suggest me some book or website from where I can learn about gnu coreutils to get more knowledge about terminal commands. An interactive book or website would be a nice start.
2
votes
2answers
736 views

The difference between find and GNU find

Consider some common *nix systems (say Debian, Ubuntu, Fedora, CentOS, Arch and Kali). I use Linux since 2014 but always used find. I don't recall personally using GNU find, but from one example I've ...
1
vote
2answers
70 views

Find a list of files that contains a set of consecutive lines defined in another file

I have a Reference file that contains a b c d I have to check all files in a subfolder recursively that contains all the lines of Reference file consecutively and delete those files. For example, ...
2
votes
0answers
81 views

Ulimit not respected in GNU bash OSX

I am seeing a strange issue with gnu bash in OSX. The value of ulimit -f is being changed by the bash itself. Small reproducible code: #!/usr/local/bin/bash ulimit -f 1 echo "Value: $(ulimit -f)" ...
0
votes
2answers
196 views

Sed with Character class [^[:space:]] not getting recognized

I used following sed with character class [^[:space:]] as follows: orig="(\`\`\`)([^[:space:]]*)"; new="\1{.\2 .numberLines startFrom=\"1\" .lineAnchors}"; sed -i -r -e "s|${orig}|${new}|g" ${...
1
vote
1answer
247 views

Makefile: Copy using make variables --> error; Not so without variables!

In the following makefile InputLocation:=./Test OutputLocation:=$(InputLocation)/Output Input:=$(wildcard $(InputLocation)/*.md) Output:=$(patsubst $(InputLocation)/%, $(OutputLocation)/%, $(Input:...
0
votes
1answer
27 views

Pass a Make variable to Bashscript that is invoked from inside Make

In a pattern rule I would like to export make variable like $(TargetLocation), $@. I tried the following but It didn't get exported. The bash script is executable. export $(TargetLocation); \ export ...
2
votes
3answers
82 views

Find command that excludes paths listed in a file

I need to exclude a bunch of paths from a find command. For example: find "$(pwd)" -not \( \ -path "*/.git"\ -o -path "*/.git/*"\ -o -path "*/.vscode"\ -o -path "*/.vscode/*"\ -o -path "*/...
0
votes
3answers
52 views

How to search for a match, then a non-match on that line, but include context lines for matched line?

Say I have a file containing: ⟫ cat schema.rb create_table "things", id: :serial, force: :cascade do |t| t.string "other_column" # ... t.datetime "created_at" end create_table "...
2
votes
2answers
276 views

Are there any successful forks or refactors of the Linux Kernel?

A google search reveals this slashdot story yielding this github repository that hasn't had a commit since 2016. There are 22,602 forks listed on github.com but these are going to be mostly (if not ...
0
votes
1answer
36 views

Can chmod on a directory without --recursive change who can read a file within that directory? [duplicate]

Based on the suggested duplicate, let me reformulate my question: If chmod 0660 path/to/folder is run, and user A isn't in the relevant group, could user A still read /path/to/folder/file.txt if that ...
1
vote
1answer
501 views

Why is ddrescue slow when it could be faster on error free areas?

This question addresses the first pass of ddrescue on the device to be rescued. I had to rescue a 1.5TB hard disk. The command I used is: # ddrescue /dev/sdc1 my-part-img my-part-map When the ...
-5
votes
2answers
162 views

Signal the end of option arguments: double dashes `--` vs single dash `-`? [duplicate]

I notice in https://unix.stackexchange.com/a/459007/674, that single dash - is used to signal the end of option arguments. Is it correct that double dashes -- can also signal the end of option ...
1
vote
1answer
194 views

Is sort -k1,2 equivalent to sort -k1,1 -k2,2?

I'm experimenting with GNU sort and LC_COLLATE="en_US.UTF-8". I have a file called 'test': 1,0 1 10 2 1,0 3 10 4 With sort -k1,2 as well as with simple sort test the order doesn't change: $ sort -...
0
votes
0answers
24 views

Changing a partition size without affecting the booting

I have Kali linux installed with dd on a couple of drives, they all have live persistence enabled with one acting as LUKS encrypted one (sdb3) (the one I'm using) and the other one is without ...
0
votes
2answers
68 views

Split file into 4 chunks using macOS version of split package

In GNU/Linux in order to split file into 4 equal chunks we can do something like: split temp -n 4 PREFIX_ But seems like the macOS' BSD version of split utility doesn't have -n option. What would be ...
0
votes
0answers
28 views

Prepend or append to substrings while expanding associative array in GNU Bash

This question was partly inspired by http://mywiki.wooledge.org/BashFAQ/073 , although that page is currently about indexed arrays rather than associative arrays. GNU Bash provides a syntax that ...
4
votes
1answer
116 views

Safely define an environment variable

AFAICT, neither GNU Bash, nor any other relevant package (e.g. GNU coreutils) that is commonly available in GNU/Linux distros, has a ready-made way to define an environment variable such that the ...
2
votes
1answer
92 views

Where is “gcc_tooldir”

Under Cross-Compiler-Specific Options, it says: The default value, in case --with-sysroot is not given an argument, is ${gcc_tooldir}/sys-root. but it appears that gcc_tooldir is not defined. Is ...
4
votes
3answers
1k views

How can I partially serialize with GNU make

When I have a make task where a specific target needs to be made before another, while in parallel mode, this is simple when using SunPro Make (dmake). The following makefile: install: dir dir/file ...
1
vote
1answer
392 views

GNU Pattern Match and replace exact number of characters

This question may have been listed but I was not able to find one exact hit. I am trying to skim through a file, match a pattern and replace it with something else. However there are other ...
3
votes
0answers
85 views

Why BSD grep is not returning all the results, but GNU does? [duplicate]

Given the file with numbers from 1 to 100 (seq 1 100 > dataset.txt), and the pattern file with numbers from 1 to 20 (seq 1 20 > patterns.txt), I would like to to print all exact matches from ...
2
votes
0answers
9k views

GNU Samba server: check SMB version of exported and mounted shares

I have a NAS Zyxel NAS326 running on Linux acting as Samba server. I can't exactly say which Linux distribution, this is all I get from "uname -a": root@nas326:~# uname -a Linux nas326 3.10.39 #1 Fri ...
0
votes
2answers
53 views

What's $(MAKE) or ${MAKE} actually supposed to mean in make scripting language

What's $(MAKE) or ${MAKE} actually performing in entire make building process. is it invoking a process which is similar to sub-routine i.e. in simplest terms 'call a function', or is it starting a ...
6
votes
1answer
433 views

Problem using xargs --max-args --replace with default delimiter

This works as expected: $ echo a b c | xargs --replace="{}" echo x "{}" y x a b c y This does too: $ echo a b c | xargs --max-args=1 echo x x a x b x c But this doesn't work as expected: $ echo a ...