Questions tagged [gnu]

This tag is for programming questions related to software and tools provided by the GNU ("GNU's Not Unix") project.

The GNU Project is a free software, mass collaboration project, announced on September 27, 1983, by Richard Stallman at MIT. It initiated GNU operating system development in 1984. 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."

To make this happen, the GNU Project began working on an operating system called GNU ("GNU" is a recursive acronym that stands for "GNU's Not Unix"). This goal of making a free software operating system was achieved in 1992 when the last gap in the GNU system, a kernel, was filled by the third-party Linux kernel being released as Free Software, under version 2 of the GNU GPL.

2807 questions
907
votes
8 answers

Passing additional variables from command line to make

Can I pass variables to a GNU Makefile as command line arguments? In other words, I want to pass some arguments which will eventually become variables in the Makefile.
Pablo
  • 28,133
  • 34
  • 125
  • 215
802
votes
7 answers

How to display line numbers in 'less' (GNU)

What is the command to make less display line numbers in the left column?
Alex. S.
  • 143,260
  • 19
  • 55
  • 62
319
votes
10 answers

How do I syntax check a Bash script without running it?

Is it possible to check a bash script syntax without executing it? Using Perl, I can run perl -c 'script name'. Is there any equivalent command for bash scripts?
Tom Feiner
  • 20,656
  • 20
  • 48
  • 51
201
votes
5 answers

What does "#define _GNU_SOURCE" imply?

Today I had to use the basename() function, and the man 3 basename (here) gave me some strange message: Notes There are two different versions of basename() - the POSIX version described above, and the GNU version, which one gets after #define…
Gui13
  • 12,993
  • 17
  • 57
  • 104
148
votes
23 answers

How do I apply a diff patch on Windows?

There are plenty of programs out there that can create a diff patch, but I'm having a heck of a time trying to apply one. I'm trying to distribute a patch, and I got a question from a user about how to apply it. So I tried to figure it out on my own…
Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
114
votes
1 answer

grep regex whitespace behavior

I have a textfile, containing something like: 12,34 EUR 5,67 EUR ... There is one whitespace before 'EUR' and I ignore 0,XX EUR. I tried: grep '[1-9][0-9]*,[0-9]\{2\}\sEUR' => didn't match ! grep '[1-9][0-9]*,[0-9]\{2\} EUR' => worked ! grep…
Milde
  • 2,144
  • 3
  • 17
  • 15
114
votes
9 answers

Compiling a C++ program with GCC

How can I compile a C++ program with the GCC compiler? File info.c #include using std::cout; using std::endl; int main() { #ifdef __cplusplus cout << "C++ compiler in use and version is " << __cplusplus << endl; #endif cout…
xyz
  • 8,607
  • 16
  • 66
  • 90
113
votes
11 answers

How do I tar a directory without retaining the directory structure?

I'm working on a backup script and want to tar up a file directory: tar czf ~/backup.tgz /home/username/drupal/sites/default/files This tars it up, but when I untar the resulting file, it includes the full file structure: the files are in…
Brock Boland
  • 15,870
  • 11
  • 35
  • 36
113
votes
11 answers

How to use GNU sed on Mac OS 10.10+, 'brew install --default-names' no longer supported

Under Mac OS 10.10.3, I installed gnu-sed by typing: brew install gnu-sed --default-names When I type it again, I get the message: gnu-sed-4.2.2 already installed However, even after rebooting the system and restarting Terminal, I still cannot use…
user3781201
  • 1,261
  • 2
  • 9
  • 7
106
votes
7 answers

How to Export Private / Secret ASC Key to Decrypt GPG Files

Background: My boss has tried exporting an ASC key to me with public and private parts but whenever I get the file the private part never loads up and it won't decrypt any files. We have tried Exporting the ASC Key using: Windows Application…
Brian McCarthy
  • 4,658
  • 16
  • 49
  • 66
102
votes
3 answers

What's the difference of section and segment in ELF file format

From wiki Executable and Linkable Format: The segments contain information that is necessary for runtime execution of the file, while sections contain important data for linking and relocation. Any byte in the entire file can be owned by at most…
tsing
  • 1,441
  • 2
  • 12
  • 15
95
votes
4 answers

What is the role of libc(glibc) in our linux app?

When we debug a program using gdb, we usually see functions with strange names defined in libc(glibc?). My questions are: Is libc/glibc the standard implementation of some standard C/C++ functions like strcpy,strlen,malloc? Or, is it not only of…
basketballnewbie
  • 1,713
  • 3
  • 15
  • 18
93
votes
5 answers

Can GNU make handle filenames with spaces?

I have a directory containing several files, some of which have spaces in their names: Test workspace/ Another directory/ file1.ext file2.ext demo 2012-03-23.odp I use GNU's $(wildcard) command on this directory, and then iterate over the result…
qntm
  • 4,147
  • 4
  • 27
  • 41
91
votes
4 answers

grep --ignore-case --only

grep fails when using both --ignore-case and --only-match options. Example: $ echo "abc" | grep -io abc abc $ echo "ABC" | grep -io abc $ But $ echo "abc" | grep -i abc abc $ echo "ABC" | grep -i abc ABC According to man page: -o,…
schatten
  • 1,497
  • 1
  • 12
  • 19
74
votes
8 answers

sed -i command for in-place editing to work with both GNU sed and BSD/OSX

I've got a makefile (developed for gmake on Linux) that I'm attempting to port to MacOS, but it seems like sed doesn't want to cooperate. What I do is use GCC to autogenerate dependency files, and then tweak them a bit using sed. The relevant…
Chris Tonkinson
  • 13,823
  • 14
  • 58
  • 90
1
2 3
99 100