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.

2565 questions
718
votes
6 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.
  • 126,349
  • 16
  • 50
  • 61
707
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
  • 24,270
  • 32
  • 112
  • 196
286
votes
9 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
  • 18,626
  • 17
  • 45
  • 51
166
votes
4 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
  • 11,951
  • 16
  • 49
  • 98
159
votes
3 answers

How do you use gcc to generate assembly code in Intel syntax?

The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?
hyperlogic
  • 6,885
  • 7
  • 36
  • 32
141
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
  • 77,748
  • 42
  • 247
  • 453
100
votes
7 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,121
  • 2
  • 8
  • 5
95
votes
7 answers

Compiling a C++ program with gcc

Question: How to compile a C++ program with gcc compiler? 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
  • 7,885
  • 15
  • 61
  • 88
94
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
  • 1,854
  • 2
  • 15
  • 15
91
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,328
  • 15
  • 46
  • 64
87
votes
9 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
  • 13,320
  • 10
  • 31
  • 36
84
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
  • 3,532
  • 4
  • 22
  • 38
78
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,298
  • 1
  • 11
  • 17
76
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,121
  • 1
  • 9
  • 15
71
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,403
  • 3
  • 14
  • 18
1
2 3
99 100