Questions tagged [linux]

NOTICE: All Linux questions must be related to programming; those that aren't will be closed. Use this tag only if your question relates to programming using Linux APIs or Linux-specific behavior, not just because you happen to run your code on Linux. If you need Linux support, you can try https://unix.stackexchange.com or the specific Linux distribution's Stack Exchange site like https://askubuntu.com or https://elementaryos.stackexchange.com/

GNU/Linux is a Unix-like computer operating system which consists of necessary user-space libraries and programs provided by GNU in Cambridge, Massachusetts and a kernel, developed by Linus Torvalds in Helsinki, Finland.

The GNU/Linux naming controversy is a dispute among members of the free and open-source software community over how to refer to the computer operating system commonly called .


Design

A GNU/Linux-based system is a modular Unix-like operating system. It derives much of its basic design from principles established in Unix during the 1970s and 1980s. Such a system uses a monolithic kernel that handles process control, networking, and peripheral and file system access. Device drivers are either integrated directly with the kernel or added as modules loaded while the system is running.

Separate projects that interface with the kernel provide much of the system's higher-level functionality. The GNU user land is an important part of most GNU/Linux-based systems, providing the most common implementation of the C library, a popular shell, and many of the common Unix tools which carry out many basic operating system tasks. The graphical user interface (or GUI) used by most GNU/Linux systems is built on top of an implementation of the X Window System.


Tag Usage

The tag on Stack Overflow is generally used for questions about:

  • programming against the APIs supplied by the operating system
  • the implementation of the kernel
  • programming tools and techniques for use on a Linux-based system.

Notable questions that probably don't belong are:

  • questions about using a desktop or laptop GNU/Linux system are better directed towards Super User, Unix & Linux, Ask Ubuntu, or Elementary OS if they're specifically about those distributions.
  • questions about administering GNU/Linux systems for other users and networking GNU/Linux systems in a context more complicated than a minimal home network are better directed towards Server Fault.

Many questions about GNU/Linux can also be properly tagged as , but some features are specific to GNU/Linux and are not found on other Unix™ and Unix-like operating systems. If you have questions about a specific distribution and version (e.g., , it may not be necessary to use this tag for that question.

A fair number of questions are questions about the command shell (bash by default on many systems), and are probably better tagged with and/or the particular shell you are interested in (, , , etc.).

Questions about the internals of the Linux kernel or regarding writing Linux kernel modules should be tagged .


Free Linux and GNU/Linux Books


Common GNU/Linux distributions

Distrowatch aggregates new release notices from these and hundreds of other GNU/Linux distributions, Phoronix keeps track of new GNU/Linux features and GNU/Linux Performance.


Other resources

Related tags

226061 questions
70
votes
4 answers

How to change zsh-autosuggestions color

I am new at zsh. I've installed the plugin zsh-autosuggestions in oh-my-zsh using instruction mentioned here. I am using Linux (Fedora 26). What my problem is I want to change the color of the text which comes in suggestion because the current one…
Vipin Yadav
  • 1,616
  • 1
  • 14
  • 23
70
votes
7 answers

Read line by line in Bash script

I want to do the following: Read a file line by line and use the line as a parameter. FILE="cat test" echo "$FILE" | \ while read CMD; do echo $CMD done But when I do echo $CMD, it just prints cat test.
user385948
  • 867
  • 2
  • 8
  • 10
70
votes
21 answers

How do you extract IP addresses from files using a regex in a linux shell?

How to extract a text part by regexp in linux shell? Lets say, I have a file where in every line is an IP address, but on a different position. What is the simplest way to extract those IP addresses using common unix command-line tools?
Kazimieras Aliulis
  • 1,531
  • 3
  • 13
  • 25
70
votes
15 answers

git: can't push (unpacker error) related to permission issues

I have this problem when i try to push in git: error: insufficient permission for adding an object to repository database ./objects fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To ssh:/// !…
Max Williams
  • 32,435
  • 31
  • 130
  • 197
70
votes
5 answers

How to install a module for all users with pip on linux?

How to install a package in the standard python environment i.e. /usr/local/lib/python2.7/dist-packages using pip and make this new package available for all the users without using virtualenv? By using the following, the package is installed with…
nowox
  • 25,978
  • 39
  • 143
  • 293
70
votes
10 answers

Avoid gnome-terminal close after script execution?

I created a bash script that opens several gnome-terminals, connect to classroom computers via ssh and run a script. How can I avoid that the gnome-terminal closes after the script is finished? Note that I also want to be able to enter further…
Marten Bauer
  • 3,099
  • 5
  • 22
  • 18
70
votes
3 answers

Using putty to scp from windows to Linux

I'm trying to test some C code that I'm writing. The only issue is that the code needs to be executed on a remote machine. My laptop is pretty old, and there is no driver for my wireless card available for Ubuntu, so booting into Linux to…
Chris Phillips
  • 1,997
  • 2
  • 19
  • 34
70
votes
3 answers

Why do we cast sockaddr_in to sockaddr when calling bind()?

The bind() function accepts a pointer to a sockaddr, but in all examples I've seen, a sockaddr_in structure is used instead, and is cast to sockaddr: struct sockaddr_in name; ...; if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0) { …
sashoalm
  • 75,001
  • 122
  • 434
  • 781
70
votes
3 answers

curl usage to get header

Why does this not work: curl -X HEAD http://www.google.com But these both work just fine: curl -I http://www.google.com curl -X GET http://www.google.com
Ankur Agarwal
  • 23,692
  • 41
  • 137
  • 208
70
votes
2 answers

Can we use C code in Python?

I know that Python provides an API so you can call Python interpreter in C code, but what I want is the opposite. My program needs to use some C API, so the code must be written in C. But I also want to package the program with Python. Which means I…
dspjm
  • 5,473
  • 6
  • 41
  • 62
70
votes
3 answers

Redirecting output of bash for loop

I have a simple BASH command that looks like for i in `seq 2`; do echo $i; done; > out.dat When this runs the output of seq 2 is output to the terminal and nothing is output to the data file (out.dat) I am expecting standard out to be redirected to…
Matthew Kirkley
  • 4,138
  • 5
  • 31
  • 33
70
votes
7 answers

Subtract days from a date in Bash

I want to subtract "number of days" from a date in Bash. I am trying something like this .. echo $dataset_date #output is 2013-08-07 echo $date_diff #output is 2 p_dataset_date=`$dataset_date --date="-$date_diff days" +%Y-%m-%d` # Getting…
Shivam Agrawal
  • 2,053
  • 4
  • 26
  • 42
70
votes
10 answers

Daemon logging in Linux

So I have a daemon running on a Linux system, and I want to have a record of its activities: a log. The question is, what is the "best" way to accomplish this? My first idea is to simply open a file and write to it. FILE* log = fopen("logfile.log",…
codemonkey
  • 1,009
  • 2
  • 10
  • 16
70
votes
3 answers

How to get first n characters of each line in unix data file

I am trying to get the first 22 characters from a unix data file.Here is my data looks as below. First 12 characters is column 1 and next 10 characters is 2nd column. 000000000001199998000180000 DUMMY RAG # MFR NOT ST 1999980 …
Teja
  • 13,214
  • 36
  • 93
  • 155
70
votes
5 answers

What is the 'soname' option for building shared libraries for?

I learned the "Program Library HOWTO". It mention that using soname to manage the version like follow. gcc -shared -fPIC -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0.0 foo.c ln -s libfoo.so.1.0.0 libfoo.so.1 ln -s libfoo.so.1 libfoo.so And I get the…
Samuel
  • 5,977
  • 14
  • 55
  • 77