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
72
votes
4 answers

Difference between PID and TID

What is the difference between PID and TID? The standard answer would be that PID is for processes while TID is for threads. However, I have seen that some commands use them interchangeably. For example, htop has a column for PIDs, in which PIDs for…
apoorv020
  • 5,420
  • 11
  • 40
  • 63
72
votes
11 answers

Fatal error: Call to undefined function curl_init()

base64_encode($data), 'key' => IMGUR_API_KEY); $timeout = 30; $curl =…
Thew
  • 15,789
  • 18
  • 59
  • 100
72
votes
1 answer

What is a sysroot exactly and how do I create one ?

I'm working with QT and embedded devices and in many documentation items ( like here) they are talking about sysroots. I've searched the web but I couldn't find anything about what a sysroot is. I have a cross-compiler-toolchain though. What's a…
Teee
  • 994
  • 1
  • 11
  • 22
72
votes
2 answers

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" How does that work?

I need to get the path of the script. I can do that using pwd if I am already in the same directory, I searched online and I found this DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" But I don't know how to use that.
Alex Bloomberg
  • 855
  • 1
  • 7
  • 14
72
votes
5 answers

How to install packages in Linux (CentOS) without root user with automatic dependency handling?

Is it possible to use RPM or YUM or any other package manager in Linux, specifically CentOS, to install a package either already downloaded or from repo to a custom location without admin/root access? I tried building from sources, using cmake,…
user3330840
  • 6,143
  • 7
  • 26
  • 39
72
votes
4 answers

Is there a command to write random garbage bytes into a file?

I am now doing some tests of my application again corrupted files. But I found it is hard to find test files. So I'm wondering whether there are some existing tools, which can write random/garbage bytes into a file of some format. Basically, I need…
Fan
  • 1,133
  • 1
  • 9
  • 14
72
votes
8 answers

How to detect if the current process is being run by GDB

The standard way would be the following: if (ptrace(PTRACE_TRACEME, 0, NULL, 0) == -1) printf("traced!\n"); In this case, ptrace returns an error if the current process is traced (e.g., running it with GDB or attaching to it). But there is a…
terminus
  • 13,745
  • 8
  • 34
  • 37
72
votes
6 answers

How to change the default browser used by the ipython/jupyter notebook in Linux?

I'm on Linux Mint 17.3. How do I change the default browser used by the Jupyter notebook? I have installed the notebook as a part of Anaconda 3 and it opens up in my default browser—Chrome. But for some reason, Chrome won't let me make a new ipynb.…
Kevin
  • 841
  • 1
  • 7
  • 7
72
votes
16 answers

How can I get CMake to find my alternative Boost installation?

I have installed the most recent version of Boost in /usr/local (with includes in /usr/local/include/boost and libraries in /usr/local/lib/boost) and I am now attempting to install Wt from source, but CMake (version 2.6) can't seem to find the Boost…
BD at Rivenhill
  • 12,395
  • 10
  • 46
  • 49
72
votes
5 answers

Exit code of variable assignment to command substitution in Bash

I am confused about what error code the command will return when executing a variable assignment plainly and with command substitution: a=$(false); echo $? It outputs 1, which let me think that variable assignment doesn't sweep or produce new error…
Reorx
  • 2,801
  • 2
  • 24
  • 29
72
votes
5 answers

How can I find out why my storage space on Amazon EC2 is full?

When I run df -h on my Amazon EC2 server, this is the output: [ec2-user@ip-XXXX ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 25G 25G 0 100% / tmpfs 4.0G 0 4.0G 0% /dev/shm For…
D_R
  • 4,894
  • 4
  • 45
  • 62
72
votes
5 answers

Using `date` command to get previous, current and next month

I am using below to get previous, current and the next month under Ubuntu 11.04: LAST_MONTH=`date +'%m' -d 'last month'` NEXT_MONTH=`date +'%m' -d 'next month'` THIS_MONTH=`date +'%m' -d 'now'` It works well until today, the last day of October,…
greeness
  • 15,956
  • 5
  • 50
  • 80
72
votes
6 answers

How to use gdb with LD_PRELOAD

I run a program with LD_PRELOADing a specific library. Like this. LD_PRELOAD=./my.so ./my_program How do I run this program with gdb?
MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
71
votes
6 answers

How to add line number for output, prompt for line, then act based on input?

I wrote a shell script like this: #! /bin/sh ... ls | grep "android" ... and the output is : android1 android2 xx_android ... I want to add a number in each file, like this: 1 android1 2 android2 3 XX_android ... please…
Yifan Zhang
  • 1,461
  • 3
  • 12
  • 19
71
votes
4 answers

Filter by process name and log CPU usage

Is there an option for the Linux top command where I can filter processes by name and write the CPU usage of that process every second to a log file?
BalaB
  • 3,687
  • 9
  • 36
  • 58