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
73
votes
5 answers

What goes in /var?

I read The Linux Command Line by William Shotts, and there are some descriptions of Linux files (system directories): The /var directory contents don't change. This tree is where data that is likely to change is stored. Various databases, spool…
dasdasdasdasd
  • 1,249
  • 2
  • 11
  • 13
73
votes
6 answers

How do I get the total CPU usage of an application from /proc/pid/stat?

I was wondering how to calculate the total CPU usage of a process. If I do cat /proc/pid/stat, I think the relevant fields are (taken from lindevdoc.org): CPU time spent in user code, measured in jiffies CPU time spent in kernel code, measured in…
user435739
73
votes
9 answers

How to capture Control+D signal?

I want to capture the Ctrl+D signal in my program and write a signal handler for it. How can I do that? I am working on C and using a Linux system.
Ryan
73
votes
12 answers

How to use export with Python on Linux

I need to make an export like this in Python : # export MY_DATA="my_export" I've tried to do : # -*- python-mode -*- # -*- coding: utf-8 -*- import os os.system('export MY_DATA="my_export"') But when I list export, "MY_DATA" not appear : #…
Kevin Campion
  • 2,223
  • 2
  • 23
  • 29
73
votes
5 answers

Whole one core dedicated to single process

Is there any way in Linux to assign one CPU core to a particular given process and there should not be any other processes or interrupt handlers to be scheduled on this core? I have read about process affinity in Linux Binding Processes to CPUs…
akp
  • 1,753
  • 3
  • 18
  • 26
73
votes
2 answers

Floating point exception ( SIGFPE ) on 'int main(){ return(0); }'

I am trying to build a simple C program for two different Linux environments. On one device the program runs fine, on the other device the program generates a floating point exception. The program does nothing but return 0 from main which leads me…
Chimera
  • 5,884
  • 7
  • 49
  • 81
73
votes
2 answers

How to use debug version of libc

Short version of question: How can I get gdb to use the debugging symbols for libc? Longer version: I am debugging a program with gdb and I want to see information about a futex used by libc. However, at some point during debugging I get output such…
Gabriel Southern
  • 9,602
  • 12
  • 56
  • 95
72
votes
11 answers

Why am I getting a "failed to connect to server" message from tmux when I try to list sessions?

Here's what's happening to me: I start tmux sessions using tmux -L name1, tmux -L name2; then I detatch them using ctrl+B+d. Then I try to get a list of the currently running sessions on my computer. However, when I run tmux ls, I get an error…
thinke365
  • 1,305
  • 3
  • 14
  • 22
72
votes
11 answers

Invoking GCC as "cc" versus "gcc"

I am aware that on most GNU/Linux systems, GCC can be invoked by the name "cc" from the command line (as opposed to "gcc"). Is there any difference in GCC's behavior when it is invoked one way versus the other? For example, I know that invoking GCC…
Dan Moulding
  • 211,373
  • 23
  • 97
  • 98
72
votes
16 answers

How to convert symlink to regular file?

What is the most direct way to convert a symlink into a regular file (i.e. a copy of the symlink target)? Suppose filename is a symlink to target. The obvious procedure to turn it into a copy is: cp filename filename-backup rm filename mv…
nibot
  • 14,428
  • 8
  • 54
  • 58
72
votes
8 answers

Start script after another one (already running) finishes

So I have a process running, and it will take several hours to complete. I would like to start another process right after that one finishes, automatically. Notice that I can't add a call to the second script in the first one, neither create another…
skd
  • 1,865
  • 1
  • 21
  • 29
72
votes
7 answers

"E: Unable to locate package python-pip" on Ubuntu 18.04

I am trying to install virtualenv on Ubuntu. First it said command 'pip' not found, so I typed sudo apt install python-pip then it said E: Unable to locate package python-pip I tried to reset WSL, download using cmd but it doesn't work with…
Aiki
  • 853
  • 1
  • 7
  • 8
72
votes
4 answers

Why does Slack return a Segmentation fault after Fedora 29 upgrade?

I have upgraded Fedora from 28 to the latest 29 and Slack doesn't work anymore. It returns a Segmentation fault (core dumped). Edit: The issue has been fixed on Slack 3.3.4
Flat
  • 1,640
  • 1
  • 12
  • 14
72
votes
2 answers

Python script as linux service/daemon

Hallo, I'm trying to let a python script run as service (daemon) on (ubuntu) linux. On the web there exist several solutions like: http://pypi.python.org/pypi/python-daemon/ A well-behaved Unix daemon process is tricky to get right, but the…
tauran
  • 7,986
  • 6
  • 41
  • 48
72
votes
5 answers

is there a way to see the actual contents of a symlink?

When you do cat some-symlink-to-some-real-file it shows the contents of the real file, not what is within the symlink itself. Is there a way to see what's actually in it?
fabio
  • 2,269
  • 5
  • 22
  • 34