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 ...
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 ...
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 ...
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 ...
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, ...
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
...
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 ...
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)
{
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
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 ...
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, ...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
source × 359bash × 66
linux × 57
compiling × 51
debian × 44
apt × 27
software-installation × 27
kernel × 23
package-management × 22
shell-script × 17
shell × 17
make × 17
linux-kernel × 16
ubuntu × 11
dependencies × 10
rpm × 9
source-code × 9
centos × 8
command-line × 7
fedora × 7
zsh × 7
freebsd × 7
environment-variables × 7
terminal × 6
drivers × 6