Skip to main content
57 votes
Accepted

Why are there pre-compiled packages in repositories?

It’s a trade-off: distributions which provide pre-built packages spend the time building them once (in all the configurations they support), and their users can then install them without spending the ...
Stephen Kitt's user avatar
42 votes

Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?

Linux is a kernel. It does not have the code for applications programs in the first place. Linux-based operating systems do not even necessarily use the same source code as one another, let alone ...
JdeBP's user avatar
  • 71.9k
26 votes

Why are there pre-compiled packages in repositories?

You imply that all people have enough CPU/RAM/storage/time/knowledge to compile packages. Nope, not the case, the opposite is true, absolute most people don't want to wait e.g. hours to compile ...
Artem S. Tashkinov's user avatar
24 votes
Accepted

Opposite of the `source` command

Using a subshell (Recommended) Run the source command in a subshell: ( source linuxmachines_mount_point.txt cmd1 $linuxmachine02 other_commands_using_variables etc ) echo $linuxmachine01 # Will ...
John1024's user avatar
  • 76.4k
23 votes
Accepted

nohup: failed to run command `.': Permission denied

nohup runs an executable. You need to pass it an external command, i.e. an executable file. You can't call nohup on a shell construct such as an alias, function or builtin. nohup runs a new process, ...
Gilles 'SO- stop being evil''s user avatar
21 votes
Accepted

Why doesn't source lib/* work?

Bash's source builtin only takes a single filename: source filename [arguments] Anything beyond the first parameter becomes a positional parameter to filename. A simple illustration: $ cat myfile ...
B Layer's user avatar
  • 5,251
20 votes

Why are there pre-compiled packages in repositories?

But why even bother to "keep/offer" pre-compiled packages, when you could just compile them yourself? What are the intentions of keeping/offering them? Simple economics. Compiling an entire ...
Jörg W Mittag's user avatar
17 votes
Accepted

Source of passwd error messages

The first error message is from the PAM library, see e.g. https://github.com/linux-pam/linux-pam/blob/master/libpam/pam_strerror.c const char *pam_strerror(pam_handle_t *pamh UNUSED, int errnum) { ...
Bodo's user avatar
  • 6,441
16 votes

Running "patch" without generating *.orig and *.rej files

The --no-backup-if-mismatch option will avoid the ".orig" files. You might also want to try the --merge option, which creates an in-file conflict. In all cases you should have some way to get back ...
Cody Allan Taylor's user avatar
16 votes
Accepted

If I have two versions of python3 installed on my machine (ie: 3.11.2 and 3.12), how do I set the default version to use when running python scripts?

Since you’re using env python3, the default version of Python will be determined by whichever version of python3 is first in the PATH variable. You can thus choose which version is used by ...
Stephen Kitt's user avatar
16 votes

How can I temporarily set $PATH and . (source) a file?

. is a special builtin. Per POSIX:  2. As described in Simple Commands, variable assignments preceding the invocation of a special built-in utility remain in effect after the built-in completes; this ...
Stéphane Chazelas's user avatar
14 votes
Accepted

Given a git commit hash, how to find out which kernel release contains it?

In GitHub kernel repository, you can check all tags/kernel versions. Example for dc0827c128c0ee5a58b822b99d662b59f4b8e970 provided by Jim Paris: If three-dots are clicked, full list of tags/kernel ...
petee's user avatar
  • 156
13 votes

Where to download Linux Kernel source code of a specific version?

If you just want to get one tag for quick compilation, do: git clone --depth 1 --branch v4.18 \ git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git --depth 1 does a shallow clone, which ...
Ciro Santilli OurBigBook.com's user avatar
12 votes

Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?

Are these programs in Linux and BSD the same? The short answer is: Not necessarily. The source code of common programs such as ls, cat, echo, kill, etc. depend on what userland they come from. In ...
Peschke's user avatar
  • 4,286
11 votes

Usage of Bang (!) in bash

From the bash manual: "If the reserved word ! precedes a pipeline, the exit status of that pipeline is the logical negation of the exit status" You are misreading the grammar. What the grammar says ...
Johan Myréen's user avatar
11 votes
Accepted

How to Change Mirrors in sources.list Automatically?

To clarify, you are asking if it is possible to change what mirror you are using without editing your sources.list? As far as I know, you will need to be able to edit your sources.list to use a ...
kemotep's user avatar
  • 5,430
11 votes

How can I get glibc/libstdc++ sources and set them up for gdb to find?

The simplest way is to extract the package source code somewhere: go to an appropriate directory, then run apt source glibc In gdb, add the corresponding directory to the source path by using the ...
Stephen Kitt's user avatar
11 votes

Why are there pre-compiled packages in repositories?

For being a gentoo user since I moved from FreeBSD Pfff! Was it ten years ago, I could not agree more with Stephen's and Artem's answers that I indeed upvote. I have never been amongst those who ...
MC68020's user avatar
  • 8,617
10 votes

If I have two versions of python3 installed on my machine (ie: 3.11.2 and 3.12), how do I set the default version to use when running python scripts?

To complement @StephenKitt's fine answer, on Debian-based systems, you may be able to install packages for more than one version of python concurrently. For instance here on Ubuntu 22.04, I have 3.10 ...
Stéphane Chazelas's user avatar
10 votes

If I have two versions of python3 installed on my machine (ie: 3.11.2 and 3.12), how do I set the default version to use when running python scripts?

I know this questions only asks about the apt package manager, and the other answers cover that aspect very well. But if you are working with several different python projects, all requiring different ...
user000001's user avatar
  • 3,815
8 votes
Accepted

debian configure: error: "libcurl not found"

I found out that if you install libcurl4-openssl-dev, then make won't complain about the absence of libcurl anymore: apt-get install libcurl4-openssl-dev Unfortunately, I'm unable to provide an ...
That Brazilian Guy's user avatar
8 votes

Usage of Bang (!) in bash

The exclamation point just logically reverses the return code of the command/pipeline (see e.g. Bash's manual): if true ; then echo 'this prints' ; fi if ! false ; then echo 'this also prints' ; fi ...
ilkkachu's user avatar
  • 148k
8 votes
Accepted

Where should I put my source code?

If you’re installing the software in /usr/local, I would use /usr/local/src — that’s the local variant of /usr/src, of which the FHS says Source code may be placed in this subdirectory, only for ...
Stephen Kitt's user avatar
7 votes

Which file compression software for Linux offers the highest size reduction for source code?

Zstandard deserves a mention. Even though with default settings it doesn't compress as well as xz, it is much faster at both compression and decompression. When Arch Linux switched from xz to zstd, ...
unhammer's user avatar
  • 424
7 votes

Why doesn't source lib/* work?

Bash documentation indicates that source works on a single filename: . (a period) . filename [arguments] Read and execute commands from the filename argument in the current shell context. ...
Jeff Schaller's user avatar
  • 68.8k
6 votes

What does $_, and $0 represent in sourced bash?

Variables referenced by $N where N is a number are the positional parameters to your script. $0 is the first parameter, which is the script itself. $1 is the second parameter (referenced as 1 ...
Tim Kennedy's user avatar
  • 20.2k
6 votes
Accepted

How to make apt read a different sources.list

You can use another sources.list, and as muru pointed out, it’s as simple as apt -o "Dir::Etc::sourcelist=/path/to/your/sources.list" source dos2unix The documentation suggests that this isn’t ...
Stephen Kitt's user avatar
6 votes
Accepted

Sourcing a script containing `echo ${BASH_SOURCE[0]}` still shows the pathname of the sourced script

In this situation, if you had wanted to get the main script's pathname from BASH_SOURCE, you would have had to use ${BASH_SOURCE[1]}. For each level of sourcing, a new element is added to the ...
Kusalananda's user avatar
  • 356k
6 votes
Accepted

How to source some shell code not a file?

The answer to the question you asked is: use eval. eval "export test=$(echo "hello world")" Do take care that the argument to eval is executed as a piece of shell code. It's ...
Gilles 'SO- stop being evil''s user avatar
6 votes

Source of passwd error messages

Firstly, I hope you're doing that for educational experience, and not because you think it will improve security or something (it would make it much worse!) That being said, few pointers to handling ...
Matija Nalis's user avatar
  • 3,286

Only top scored, non community-wiki answers of a minimum length are eligible