yun2022/linux-meta-llama
8B • Updated • 15
question_title stringlengths 14 159 | date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k |
|---|---|---|---|
Why do we need to fork to create new processes? | 1,402,510,190,000 |
In Unix whenever we want to create a new process, we fork the current process, creating a new child process which is exactly the same as the parent process; then we do an exec system call to replace all the data from the parent process with that for the new process.
Why do we create a copy of the parent process in th... |
The short answer is, fork is in Unix because it was easy to fit into the existing system at the time, and because a predecessor system at Berkeley had used the concept of forks.
From The Evolution of the Unix Time-sharing System (relevant text has been highlighted):
Process control in its modern form was designed and... |
How do keyboard input and text output work? | 1,402,510,190,000 |
Suppose I press the A key in a text editor and this inserts the character a in the document and displays it on the screen. I know the editor application isn't directly communicating with the hardware (there's a kernel and stuff in between), so what is going on inside my computer?
|
There are several different scenarios; I'll describe the most common ones. The successive macroscopic events are:
Input: the key press event is transmitted from the keyboard hardware to the application.
Processing: the application decides that because the key A was pressed, it must display the character a.
Output: th... |
Easy command line method to determine specific ARM architecture string? | 1,402,510,190,000 |
I'm trying to write a script which will determine actions based on the architecture of the machine. I already use uname -m to gather the architecture line, however I do not know how many ARM architectures there are, nor do I know whether one is armhf, armel, or arm64.
As this is required for this script to determine ... |
On Debian and derivatives,
dpkg --print-architecture
will output the primary architecture of the machine it’s run on. This will be armhf on a machine running 32-bit ARM Debian or Ubuntu (or a derivative), arm64 on a machine running 64-bit ARM.
On RPM-based systems,
rpm --eval '%{_arch}'
will output the current archi... |
Why doesn't cp have a progress bar like wget? | 1,402,510,190,000 |
Please note that I don't ask how. I already know options like pv and rsync -P.
I want to ask why doesn't cp implement a progress bar, at least as a flag ?
|
The tradition in unix tools is to display messages only if something goes wrong. I think this is both for design and practical reasons. The design is intended to make it obvious when something goes wrong: you get an error message, and it's not drowned in not-actually-informative messages. The practical reason is that ... |
Will a Linux executable compiled on one "flavor" of Linux run on a different one? | 1,402,510,190,000 |
Will the executable of a small, extremely simple program, such as the one shown below, that is compiled on one flavor of Linux run on a different flavor? Or would it need to be recompiled?
Does machine architecture matter in a case such as this?
int main()
{
return (99);
}
|
It depends. Something compiled for IA-32 (Intel 32-bit) may run on amd64 as Linux on Intel retains backwards compatibility with 32-bit applications (with suitable software installed). Here's your code compiled on RedHat 7.3 32-bit system (circa 2002, gcc version 2.96) and then the binary copied over to and run on a Ce... |
A layman's explanation for "Everything is a file" — what differs from Windows? | 1,402,510,190,000 |
I know that "Everything is a file" means that even devices have their filename and path in Unix and Unix-like systems, and that this allows for common tools to be used on a variety of resources regardless of their nature. But I can't contrast that to Windows, the only other OS I have worked with. I have read some arti... |
"Everything is a file" is a bit glib. "Everything appears somewhere in the file system" is closer to the mark, and even then, it's more an ideal than a law of system design.
For example, Unix domain sockets are not files, but they do appear in the file system. You can ls -l a domain socket to display its attributes, m... |
Why is rm allowed to delete a file under ownership of a different user? | 1,402,510,190,000 |
From the post Why can rm remove read-only files? I understand that rm just needs write permission on directory to remove the file. But I find it hard to digest the behaviour where we can easily delete a file who owner and group different.
I tried the following
mtk : my username
abc : created a new user
$ ls -l file
-r... |
The reason why this is permitted is related to what removing a file actually does. Conceptually, rm's job is to remove a name entry from a directory. The fact that the file may then become unreachable if that was the file's only name and that the inode and space occupied by the file can therefore be recovered at that ... |
On Unix systems, why do we have to explicitly `open()` and `close()` files to be able to `read()` or `write()` them? | 1,402,510,190,000 |
Why do open() and close() exist in the Unix filesystem design?
Couldn't the OS just detect the first time read() or write() was called and do whatever open() would normally do?
|
Dennis Ritchie mentions in «The Evolution of the Unix Time-sharing System» that open and close along with read, write and creat were present in the system right from the start.
I guess a system without open and close wouldn't be inconceivable, however I believe it would complicate the design.
You generally want to ma... |
What are software and hardware interrupts, and how are they processed? | 1,402,510,190,000 |
I am not sure if I understand the concept of hardware and software interrupts.
If I understand correctly, the purpose of a hardware interrupt is to get some attention of the CPU, part of implementing CPU multitasking.
Then what issues a hardware interrupt? Is it the hardware driver process?
If yes, where is the hard... |
A hardware interrupt is not really part of CPU multitasking, but may drive it.
Hardware interrupts are issued by hardware devices like disk, network cards, keyboards, clocks, etc. Each device or set of devices will have its own IRQ (Interrupt ReQuest) line. Based on the IRQ the CPU will dispatch the request to the ... |
Object-oriented shell for *nix | 1,402,510,190,000 |
Preface: I love bash and have no intention of starting any sort of argument or holy-war, and hopefully this is not an extremely naive question.
This question is somewhat related to this post on superuser, but I don't think the OP really knew what he was asking for. I use bash on FreeBSD, linux, OS X, and cygwin on Wi... |
I can think of three desirable features in a shell:
Interactive usability: common commands should be quick to type; completion; ...
Programming: data structures; concurrency (jobs, pipe, ...); ...
System access: working with files, processes, windows, databases, system configuration, ...
Unix shells tend to concentr... |
How does a Linux terminal work? | 1,402,510,190,000 |
If you fire up a terminal and call an executable (assuming one that's line oriented for simplicity) you get a reply to the command from the executable. How does this get printed to you (the user)? Does the terminal do something like pexpect? (poll waiting for output) or what? How does it get notified of output to be ... |
Originally you had just dumb terminals - at first actually teletypewriters (similar to an electric typewriter, but with a roll of paper) (hence /dev/tty - TeleTYpers), but later screen+keyboard-combos - which just sent a key-code to the computer and the computer sent back a command that wrote the letter on the termina... |
How does a unix or linux system work? [closed] | 1,402,510,190,000 |
I would like to know how the OS works in a nutshell:
The basic components it's built upon
How those components work together
What makes unix UNIX
What makes it so different from other OSs like Windows
|
A UNIX system consists of several parts, or layers as I'd like to call them.
To start a system, a program called the boot loader lives at the first sector of a hard disk partition. It is started by the system, and in turn it locates the Operating System kernel, and load it.
Layering
The Kernel. This is the central pr... |
Interruption of system calls when a signal is caught | 1,402,510,190,000 |
From reading the man pages on the read() and write() calls it appears that these calls get interrupted by signals regardless of whether they have to block or not.
In particular, assume
a process establishes a handler for some signal.
a device is opened (say, a terminal) with the O_NONBLOCK not set (i.e. operating in... |
Summary: you're correct that receiving a signal is not transparent, neither in case i (interrupted without having read anything) nor in case ii (interrupted after a partial read). To do otherwise in case i would require making fundamental changes both to the architecture of the operating system and the architecture of... |
dpkg: error: cannot remove architecture 'i386' currently in use by the database | 1,402,510,190,000 |
I used this command to add i386 arch:
sudo dpkg --add-architecture i386
And then immediately after without installing any packages I tried to remove the i386 arch like so:
sudo dpkg --remove-architecture i386
And i got the error:
dpkg: error: cannot remove architecture 'i386' currently in use by the database
Soluti... |
From your list, it looks like you just had the 32-bit packages used for Wine. Wine needs a bunch of 32-bit libraries to run 32-bit Windows applications. You won't be able to remove the i386 architecture unless you uninstall the 32-bit Wine. But there's no point in doing this: there's nothing wrong with having the i386... |
Why there are `/lib` and `/lib64` but only `/bin`? | 1,402,510,190,000 |
In my laptop:
$ cat /etc/issue
Ubuntu 18.04 LTS \n \l
There are two different folders for libraries x86 and x86_64:
~$ ls -1 /
bin
lib
lib64
sbin
...
Why for binaries exists only one directory?
P.S. I'm also interested in Android but I hope that answer should be the same.
|
First, why there are separate /lib and /lib64:
The Filesystem Hierarchy Standard
mentions that separate /lib and /lib64 exist because:
10.1. There may be one or more variants of the /lib directory on systems which support more than one binary format requiring
separate libraries. (...) This is commonly used for 64-b... |
How are directories implemented in Unix filesystems? | 1,402,510,190,000 |
My question is how directories are implemented? I can believe a data structure like a variable e.g. table, array or similar. Since UNIX is Open Source I can look in the source what the program does when it created a new directory. Can you tell me where to look or elaborate on the topic? That a directory "is" a file I ... |
The internal structure of directories is dependent on the filesystem in use. If you want to know precisely what happens, have a look at filesystem implementations.
Basically, in most filesystems, a directory is an associative array between filenames (keys) and inodes numbers (values). Something like this¹:
1167010 .
1... |
How to understand pipes | 1,402,510,190,000 |
When I just used pipe in bash, I didn't think more about this. But when I read some C code example using system call pipe() together with fork(), I wonder how to understand pipes, including both anonymous pipes and named pipes.
It is often heard that "everything in Linux/Unix is a file". I wonder if a pipe is actually... |
About your performance question, pipes are more efficient than files because no disk IO is needed. So cmd1 | cmd2 is more efficient than cmd1 > tmpfile; cmd2 < tmpfile (this might not be true if tmpfile is backed on a RAM disk or other memory device as named pipe; but if it is a named pipe, cmd1 should be run in the ... |
What are the minimum root filesystem applications that are required to fully boot linux? | 1,402,510,190,000 |
It's a question about user space applications, but hear me out!
Three "applications", so to speak, are required to boot a functional distribution of Linux:
Bootloader - For embedded typically that's U-Boot, although not a hard requirement.
Kernel - That's pretty straightforward.
Root Filesystem - Can't boot to a shel... |
That entirely depends on what services you want to have on your device.
Programs
You can make Linux boot directly into a shell. It isn't very useful in production — who'd just want to have a shell sitting there — but it's useful as an intervention mechanism when you have an interactive bootloader: pass init=/bin/sh to... |
How are system commands like ls created? | 1,402,510,190,000 |
I have some doubts regarding *nix.
I don't know which type of executable file is ls, whether it is .sh
or .ksh or any other kind of system executable if it is, what
is that?
when I tried to see what is the source code of ls command looks like, it shows something unreadable, what method does *nix use to create these ... |
You can determine the nature of an executable in Unix using the file command and the type command.
type
You use type to determine an executable's location on disk like so:
$ type -a ls
ls is /usr/bin/ls
ls is /bin/ls
So I now know that ls is located here on my system in 2 locations:/usr/bin/ls & /bin/ls. Looking at t... |
How does the set-user-ID mechanism work in Unix? | 1,402,510,190,000 |
Can someone please explain the set-user-ID mechanism in Unix ? What was the rationale behind this design decision? How is it different from effective user id mechanism ?
|
You might know the normal read, write and execute permissions for files in unix.
However, in many applications, this type of permission structure--e.g. giving a given user either full permission to read a given file, or no permission at all to read the file--is too coarse. For this reason, Unix includes another permi... |
Are different Linux/Unix kernels interchangeable? | 1,402,510,190,000 |
Can I take a Linux kernel and use it with, say, FreeBSD and vice versa (FreeBSD kernel in, say, a Debian)? Is there a universal answer? What are the limitations? What are the obstructions?
|
No, kernels from different implementations of Unix-style operating systems are not interchangeable, notably because they all present different interfaces to the rest of the system (user space) — their system calls (including ioctl specifics), the various virtual file systems they use...
What is interchangeable to some... |
Interpret the output of lstopo | 1,402,510,190,000 |
I have a output from lstopo --output-format txt -v --no-io > lstopo.txt for a 8-core node in a cluster, which is https://dl.dropboxusercontent.com/u/13029929/lstopo.txt
The file is a text drawing of the node. It is too wide for both the terminal and gedit on Ubuntu of my laptop, and some of its right is moved by my l... |
Here are the answers to your questions:
I'd view it as a graphical image rather than an ASCII image.
$ lstopo --output-format png -v --no-io > cpu.png
NOTE: You can view the generated file cpu.png
"PU P#" = Processing Unit Processor #. These are processing elements within the cores of the CPU. ... |
Difference between system calls and library functions | 1,402,510,190,000 |
I have been through the answer of this question but do not quite understand the difference between system calls and library functions. Conceptually, what is the difference between the two?
|
Conceptually, a library function is part of your process.
At run-time, your executable code and the code of any libraries (such as libc.so) it depends on, get linked into a single process. So, when you call a function in such a library, it executes as part of your process, with the same resources and privileges. It's ... |
What is the relationship between system calls, message passing, and interrupts? | 1,402,510,190,000 |
I am reading the Wikipedia article for process management. My focus is on Linux. I cannot figure out the relation and differences between system call, message passing and interrupt, in their concepts and purposes. Are they all for processes to make requests to kernel for resources and services?
Some quotes from the ... |
All modern operating systems support multitasking. This means that the system is able to execute multiple processes at the same time; either in pseudo-parallel (when only one CPU is available) or nowadays with multi-core CPUs being common in parallel (one task/core).
Let's take the simpler case of only one CPU being... |
Why is architecture listed thrice in uname -a? | 1,402,510,190,000 |
$ uname -a
Linux 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Running ubuntu 12.04.1 LTS. Why does it have the architecture (x86_64) listed thrice?
|
I checked uname manual (man uname) and it says the following for the "-a" option:
print all information, in the following order, except omit -p and -i if unknown
In Ubuntu, I guess, options "-m", "-p" and "-i" (machine, processor and hardware-platform) are returning the machine architecture. For example, if you use... |
First FreeBSD install. Is there anything I should know about differences between Linux and BSD? | 1,402,510,190,000 |
I want to install FreeBSD today on a spare HDD I have lying around. I'd like to give it a trial run, learn a few things, and if it suits me I'll replace my current Ubuntu 10.10 'server/NAS/encoding box' with it. Curiosity is the main reason. I also want to see most of the major bugs ironed out of GNOME 3/Unity before ... |
You will notice differences certainly. Most noticable will be differences in the standard userland utilities. FreeBSD does not use GNU ls, GNU cp, and so on. For example, if you're attached to a colorized ls, you may want to alias ls to "ls -G". It does use GNU grep, though. The default shell is a much simpler an... |
Do GUIX and NixOS differ architecturally? | 1,402,510,190,000 |
(This is not a "which distribution is better" question!)
GNU GUIX and NixOS are two Linux distributions based on the NixOS package manager.
I realize that GUIX seems to use Guile for defining packages/dependencies or other meta-data uses; and I'm guess everything in GUIX is GPL'ed, while perhaps not everything in NixO... |
Basically, there aren't any architectural differences between the two distributions, except for the way they handle the init system:
Guix System uses GNU Sheperd while NixOS uses System D.
To the best of my understanding, Guix/Guix System is a re-implementation of the framework seen in Nix/NixOS, utilizing GNU tooling... |
login and su internals | 1,402,510,190,000 |
I am trying to understand how user permissions work in Linux. The kernel boots and starts init as root, right? Init then runs startup scripts and runs getty (agetty), again as root. Agetty just reads user name and runs login, still as root, I think. Nothing interesting yet. But what does login do? I wasn't able to fin... |
There are several parts to what login programs do. Login programs differ in how they interact with the user who's trying to log in. Here are a few examples:
login: reads input on a text terminal
su: invoked by an already logged-in users, gets most of the data from its command-line arguments, plus authentication data ... |
How can I build a rpm for i386 target on a x86-64 machine? | 1,402,510,190,000 |
I am building an rpm using rpmbuild command as:
rpmbuild -bb --root <DIRECTORY> --target i386 --define "_topdir <DIRECTORY>" <specfile>.spec
When I use my SLED 10 SP3 x86 machine, it runs successfully. But on my SLES 10 SP3 x64 Virtual Machine, it gives following error:
error: No compatible architectures found for bui... |
From the Fedora documentation for rpm, spec files, and rpmbuild:
The --target option sets the target architecture at build time. Chapter 3,
Using RPM covers how you can use the --ignoreos and --ignorearch options
when installing RPMs to ignore the operating system and architecture that
is flagged within the RPM. Of ... |
Process in user mode switch to kernel mode. Then the process will have root privileges? | 1,402,510,190,000 |
According to http://www.linfo.org/kernel_mode.html in paragraph 7:
When a user process runs a portion of the kernel code via a system call, the process temporarily becomes a kernel process and is in kernel mode. While in kernel mode, the process will have root (i.e., administrative) privileges and access to key syste... |
(I'll try to be brief.)
In theory, there are two dimensions of privileges:
The computer's instruction set architecture (ISA), which protects certain information and/or functions of the machine.
The operating system (OS) creating an eco-system for applications and communication. At its core is the kernel, a program th... |
Why can the waitpid system call only be used with child processes? | 1,402,510,190,000 |
The man page wait(2) states that the waitpid system call returns the ECHILD error if the specified process is not a child of the calling process. Why is this? Would waiting on a non-child process create some sort of security issue? Is there a technical reason why implementing waiting on a non-child process would be di... |
Because of how waitpid works. On a POSIX system, a signal (SIGCHLD) is delivered to a parent process when one of its child processes dies. At a high level, all waitpid is doing is blocking until a SIGCHLD signal is delivered for the process (or one of the processes) specified. You can't wait on arbitrary processes,... |
How do file permissions/attributes work? Kernel-level, FS-level or both? | 1,402,510,190,000 |
A question that occurred to me earlier: are file permissions/attributes OS- (and therefore kernel-) dependent or are they filesystem-dependent?
It seems to me that the second alternative is the more logical one, yet I never heard of reiserfs file permissions, for example: only "Unix file permissions". On the other han... |
Both the kernel and the filesystem play a role. Permissions are stored in the filesystem, so there needs to be a place to store the information in the filesystem format. Permissions are enforced and communicated to applications by the kernel, so the kernel must implement rules to determine what the information stored ... |
How to know which commands are executed when I do something in GUI | 1,402,510,190,000 |
This is for academic purpose. I want to know which commands are executed when we do something in GUI, for example creating a folder. I want to show that both the mkdir shell command and create folder option from GUI does the same thing.
|
You can observe what the process does with the strace command. Strace shows the system calls performed by a process. Everything¹ a process that affects its environment is done through system calls. For example, creating a directory can only be done by ultimately calling the mkdir system call. The mkdir shell command i... |
Why can an aarch64 ELF executable be run on an x86_64 machine? | 1,402,510,190,000 |
I compiled a simple "Hello World" C program on Raspberry Pi 3, which was then transferred to an AMD64 laptop. Out of curiosity, I executed it, and it runs even though I did not expect it to:
$ uname -a
Linux 15ud490-gx76k 6.5.0-25-generic #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2 x86_64 x86_64 x... |
QEMU user emulation is exactly why your binary runs: on your system, one of the QEMU-related packages you’ve installed ensures that QEMU is registered as a handler for all the architectures it can emulate, and the kernel then passes binaries to it. As long as you have the required libraries, if any, the binary will ru... |
Rings and run levels | 1,402,510,190,000 |
The question stated below might not be technically correct(misconception) so it would be appreciable if misconception is also addressed.
Which ring level do the different *nix run levels operate in?
Ring tag not available.
|
Unix runlevels are orthogonal (in the sense "unrelated", "independent of" - see comments) to protection rings.
Runlevels are basically a run time configurations/states of the operating system as a whole, they describe what services are available ("to the user") - like SSH access, MTA, file server, GUI.
Rings are a har... |
How does the Linux login work? [duplicate] | 1,402,510,190,000 |
I am wondering how the login actually works. It certainly is not part of the kernel, because I can set the login to use ldap for example, or keep using /etc/passwd; but the kernel certainly is able to use information from it to perform authentication and authorization activities.
There is also a systemd daemon, calle... |
The login binary is pretty straightforward (in principle). It's just a program that runs as root user (started, indirectly through getty or an X display manager, from init, the first user-space process). It performs authentication of the logging-in user, and if that is successful, changes user (using one of the setu... |
Meaning of hardware platform in uname command ouput | 1,402,510,190,000 |
man uname
-m, --machine print the machine hardware name
-i, --hardware-platform print the hardware platform or "unknown"
What exactly is meant by hardware platform here and how is it different from the "machine hardware name"? I found some related questions on SE but there seems to be some cont... |
A bit more info in info uname:
`-i'
`--hardware-platform'
Print the hardware platform name (sometimes called the hardware
implementation). Print `unknown' if the kernel does not make this
information easily available, as is the case with Linux kernels.
`-m'
`--machine'
Print the machine hardware ... |
Concept of memory mapping in Unix like systems | 1,402,510,190,000 |
Can some one explain in an easy to understand way the concept of memory mappings (achieved by mmap() system call) in Unix like systems ? When do we require this functionality ?
|
Consider: two processes can have the same file open for reading & writing at the same time, so some kind of communication is possible between the two.
When process A writes to the file, it first populates a buffer inside its own process-specific memory with some data, then calls write which copies that buffer into ano... |
Metaphor for the concept of shell? | 1,402,510,190,000 |
I'm finding myself helping out some classmates in my computer science class, because I have prior development experience, and I'm having a hard time explaining certain things like the shell. What's a good metaphor for the shell in the context of the Terminal on Mac, contrasted with a remote shell via SSH?
|
Put simply, a terminal is an I/O environment for programs to operate in, and a shell is a command processor that allows for the input of commands to cause actions (usually both interactively and non-interactively (scripted)). The shell is run within the terminal as a program.
There is little difference between a local... |
Can there be multiple kernels executing at the same time? | 1,402,510,190,000 |
I know that Linux OS's are typically multi-programmed, which means that multiple processes can be active at the same time. Can there be multiple kernels executing at the same time?
|
Sort of. Check out User-mode Linux.
|
What is a windowing system? | 1,402,510,190,000 |
Can someone provide me with a very clear and practical example of a "windowing system"? I was reading on Linux, and although I've always known that it's a kernel, I didn't really know what a kernel is because I haven't taken an OS class yet. My understanding of it is that it's basically the layer between hardware and ... |
GNU (Gnu is Not Unix) is an Operative System, created by Richard M. Stallman.
You can use this operative system with different kernel: such as Linux kernel, Hurd kernel, Darwin kernel, etc.
The X Window System (common on Unix like system) is just the basic layer for a GUI environment.
Every Linux distribution is a GNU... |
What's the difference between /etc/rc.d/rc*.d and /etc/rc*.d | 1,402,510,190,000 |
I know that rc*.d directories are used at startup, or reboot, or so on time, for starting or stopping programs. Can anybody explain me what's the difference between the rc*.d folders placed under the /etc/ path and the other placed under the /etc/rc.d/ path.
Also, what's the difference between /etc/init.d and /etc/rc... |
Nothing. Different Linux distributions, and the LSB, had different standards, so both are present on CentOS to make it easier to run software from different versions. One is just a symbolic link to the other.
http://www.centos.org/docs/5/html/5.1/Installation_Guide/s2-boot-init-shutdown-init.html gives details on th... |
Cannot remove architecture i386 | 1,402,510,190,000 |
I'm using 64 bit Kali Linux, previously installed i386 architecture and now I want to remove it, because it downloads about 30Mb data for 32bit package every time apt update.
I tried dpkg --remove-architecture i386, it failed with
dpkg: error: cannot remove architecture 'i386' currently in use by the database
Google s... |
You need to remove them simultaneously, and force their removal in spite of their “protected” status:
dpkg --purge --force-remove-protected {gcc-12-base,libc6,libcrypt1,libgcc-s1}:i386
|
How to determine bitness of hardware and OS? | 1,432,207,891,000 |
Output of uname -a on my RHEL 5.4 machine is:
Linux <machine name> 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
Does it mean that hardware is 64 bit (going by perhaps first x86_64) and OS is also 64-bit going by last x86_64?
Also, what are these so many instances of x86_64?
Can I ... |
The hardware, the kernel and the user space programs may have different word sizes¹.
You can see whether the CPU is 64-bit, 32-bit, or capable of both by checking the flags line in /proc/cpuinfo. You have to know the possible flags on your architecture family. For example, on i386/amd64 platforms, the lm flag identif... |
`uname -m` valid values | 1,432,207,891,000 |
On my computer, uname -m prints x86_64 as output. What is the list of possible values that this command could output? I intend to use this command from a dynamic runtime to check the CPU architecture.
|
I’m not aware of a definitive list of possible values; however there is a list of values for all Debian architectures, which gives good coverage of the possible values on Linux: aarch64, alpha, arc, arm, i?86, ia64, m68k, mips, mips64, parisc, ppc, ppc64, ppc64le, ppcle, riscv64, s390, s390x, sh, sparc, sparc64, x86_6... |
Are system calls the only way to interact with the Linux kernel from user land? | 1,432,207,891,000 |
Are there any other interfaces, e.g. the /proc filesystem?
|
The Linux kernel syscall API is the the primary API (though hidden under libc, and rarely used directly by programmers), and most standard IPC mechanisms are heavily biased toward the everything is a file approach, which eliminates them here as they ultimately require read/write (and more) calls.
However, on most plat... |
When I move a file to a different directory on the same partition, does the file's data actually move on disk? | 1,432,207,891,000 |
I could see it going both ways. If the filesystem stores it's directory structure and list of files in each directory, and then points to the disk location of each of the files, it shouldn't require the file's data to actually be moved on disk in order to 'move' a file. On the other hand, I could see the 'move' being ... |
Yes, this depends on the type of filesystem. But all the modern filsystems I know of use a pointer scheme of some kind. The linux/unix-filesystems (like ext2, ext3, ext4, ...) do this with INODES.
You can use ls -i on a file to see which inode-number is referenced by the filename (residing as meta-information in the d... |
how is a keyboard shortcut given to the correct program? | 1,432,207,891,000 |
in Ubuntu (or for that matter most other linux distros), I could use the shortcut ctrl+t to open a new tab (in firefox or similar), or I could use alt+tab to make unity switch highlighted window, or I could use alt+ctrl+F<1-6> to get to another tty. What part of linux handles and resolves these shortcuts? What if seve... |
What part of linux handles and resolves these shortcuts?
For the most part, individual applications or a window manager(WM)/desktop environment(DE). There are a few caught and handled by the kernel, such as VT switching with Cntl-Alt-F[N].
The actual event propagates:
From the kernel
To the Xorg server
To the WM/D... |
What is the default or most commonly used multiprocessing model in Linux? Symmetric or Asymmetric? | 1,432,207,891,000 |
What the multiprocessing model for Linux? Is there a default or most commonly used model? Is it similar or very different from say BSD or even the MS Windows kernel?
If SMP is used normally, can assymetric be used instead if desired?
|
From Wikipedia:
Asymmetric multiprocessing (AMP) was a software stopgap for handling
multiple CPUs before symmetric multiprocessing (SMP) was available.
Linux uses SMP.
|
What are the very fundamental differences in architecture between Unix and Linux? [duplicate] | 1,432,207,891,000 |
I watched a short intro to Unix from the 70s (https://www.youtube.com/watch?v=7FjX7r5icV8 3D animation starts at 1:56), at the end the general tripartite architecture of Unix was displayed as a 3D animation. Because I have seen already diagrams of the ovarall Linux architecture, I became confused.
Both diagrams, Uni... |
Because the distinction remains a little vague to me, this may not be a very clear answer. I'll just try to expose my point of view, more than actual, technical facts.
First of all, it is probably relevant to note that Linux is a UNIX-like system. This means that while most concepts and implementations have been inspi... |
Which arch linux should I download? | 1,432,207,891,000 |
I'm going to install Arch linux yet I have to choose between several architectures my computer has.
I have an aluminium macbook pro, with a 2.3 GHz Intel Core i5 processor. . The intel webpage tells me this is a dual core processor.
running uname -a in the shell returns:
Darwin Romeos-MacBook-Pro.local 11.3.0 Darwin ... |
Intel Core 2 (i5) is a 64-bit processor supporting Intel 64, Intel 64 is Intel's implementation of x86-64
|
Get Linux architecture from /proc filesystem | 1,432,207,891,000 |
I'm writing a program in Java and I need to determine the architecture for which Linux was compiled.
I need something like uname -m, but without running any program, but instead from the /proc pseduo-fs.
What is a reliable source to read from?
|
As you can have a 32-bit Linux installed in a 64-bit machine, the safer way seems to be verifying CPU capabilities. For Intel and compatible processors:
grep -o -w 'lm' /proc/cpuinfo
http://www.unixtutorial.org/2009/05/how-to-confirm-if-your-cpu-is-32bit-or-64bit/
What you're looking for is the following flag: lm. ... |
Accessing PHPMyAdmin as installed by its distro package-index from the domain of each website | 1,432,207,891,000 |
I have a remote machine with LAMP and PHPMyAdmin (PMA). Let's assume this distro is Debian/Ubuntu.
If I install PMA via apt install phpmyadmin (which will make it to be installed under /usr/share/phpmyadmin/ I think) then I wouldn't be able to navigate to PMA based on domains of my websites hosted on that lamp (the fo... |
In fact, Debian installs the majority of PMA into /usr/share/phpmyadmin which is the LSB standard correct location for it. But that's a detail that's not terribly relevant to the premise of your question.
What Debian's PMA package also does is drop a config file in /etc/apache2/conf-available/phpmyadmin.conf that sets... |
Are “kernel mode” and “user mode” hardware features or software features? | 1,432,207,891,000 |
I read that there are two modes called “kernel mode” and “user mode” to handle execution of processes. (Understanding the Linux Kernel, 3rd Edition.) Is that a hardware switch (kernel/user) that is controlled by Linux, or software feature provided by the Linux kernel?
|
Kernel mode and user mode are a hardware feature, specifically a feature of the processor. Processors designed for mid-to-high-end systems (PC, feature phone, smartphone, all but the simplest network appliances, …) include this feature. Kernel mode can go by different names: supervisor mode, privileged mode, etc. On x... |
How to check Linux kernel? | 1,432,207,891,000 |
I want to install a package, and it has different versions for different OSes. The description in the package site is like this
X86-64 Linux 3.0 Kernel
I looked it up and found people saying to use
uname -r
uname -m
I tried it and got this:
3.2.0-24-generic
x86_64
Does this tell me the Linux I'm using is x86_64 and... |
3.2.0 is the version of the source code used to compile this kernel. These can be four numbers long (e.g. 2.6.32.55) indicating a patch level on that version. However, this four digit system was only used for version 2.6 kernels starting at 2.6.8. I.e., it is not used with 3.x kernels, which are the 3 numbers, relea... |
How I can emulate a big endian platform on a x86? | 1,432,207,891,000 |
I need to get a big endian platform to develop with gcc and g++, what is a solution for that? I know that the SPARC is one of those big endian architectures, but I have no idea what OSs can run on it and how to emulate a SPARC machine under Linux; I also should note that I need any big endian that I can emulate on an ... |
Why Sparc specifically? ARM or MIPS is easier to emulate or to get in hardware, both are bi-endian, and both are supported by Linux in either endianness.
There doesn't seem to be a well-maintained ARM big-endian port, your best bet for ARM seems to be the old Debian NSLU2 port. For MIPS you have the MIPS port.
QEMU ca... |
When does a shell get executed during the linux startup process | 1,432,207,891,000 |
I do not understand when does a shell, lets say bash, get executed, which program runs bash initially first.
|
The boot sequence of linux/unix has many stages, and there are many references and answers on this site that explain the detail. But to summarise;
Eventually the kernel is loaded with drivers so that the disk and devices can be used, it then starts process with a pid (process id) of 1.
Traditionally this program was ... |
How to find out what is the Instruction Set Architecture (ISA) of a CPU? | 1,432,207,891,000 |
In the Debian download CD/DVD images page they have different ISO's for the different instruction set architectures. How do I know what is the ISA of a CPU before I buy one? I know about using the commands
cat /proc/cpuinfo
and
lscpu
but these are only good after getting the CPU and running these commands on a Linux... |
If you don't have the cpu, I presume you are buying one or something.
If that is the case, then you can find out everything about the prospective cpu you are going to buy by looking up the data by the model number of the cpu you are looking at.
You can guess the architecture by the manufacturer, as most manufacturers ... |
Difference between architecture and platform in linux kernel | 1,432,207,891,000 |
I want to know the difference between architecture and platform in Linux kernel. When I had downloaded the latest kernel tarball, observed that a directory named with arch, it contains different names of processors & inside to any one processor directory again there is a directory called platform.
For example:-
/arch/... |
The architecture is the processor type. There are only a relatively small number of architectures. All processor types that execute the same user code are classified as the same architecture, even though there may be several different ways to compile the kernel; for example x86 and powerpc are a single architecture bu... |
How could Linux use 'sda' device file when it hasn't been installed? | 1,432,207,891,000 |
I am installing CentOS Linux distribution.
At the partition step, CentOS tells me that it has detected a sda HD in my machine and I should create partitions and assign mount points for this disk.
But I found the logic a little twisted. I understand that Linux treat everything as file and sda is usually the device fil... |
What /dev/sda means
There are four levels: raw disk, raw partition of that disk, formatted filesystem on a partition, and actual files stored within a filesystem.
/dev/sda means an entire disk, not a filesystem. Something with a number at the end is a partition of a disk: dev/sda1 is the first partition of the /dev/sd... |
How do i change the output of "uname -m" | 1,432,207,891,000 |
I am trying to execute this shell script - https://raw.githubusercontent.com/oneindex/script/master/gclone.sh
This shell script checks for uname -m output and doesn't like it ( i.e. aarch64 ).
xd003@localhost:~$ uname -m
aarch64
xd003@localhost:~$
I want to change the uname -m output from aarch64 to arm64 so that it... |
Since it happens to be a bash script (despite the .sh extension), you can always do (within bash):
uname()
if [ "$#" -eq 1 ] && [ "$1" = -m ]; then
echo arm64
else
command uname "$@"
fi
export -f uname
gclone.sh
That is, replace uname with an exported function that outputs what you want when passed a ... |
Building packages: command which yields 'amd64' (like uname) | 1,432,207,891,000 |
Suppose I have a makefile that builds my package, and I only want the package to build if the package file is not present:
package: foo_0.0.0_amd64.deb
cd foo-0.0.0 && debuild -uc -us
So I am new to the debian build process, but I am anticipating that I'll either find a way to build for different architectures, or... |
On a Debian-based system, the bullet-proof way of determining the architecture, as appropriate for use in a package’s file name, is
dpkg --print-architecture
Note that architecture-independent packages use all there, and you’d have to know that in advance.
|
Can't install rust-doc on Debian Stretch | 1,432,207,891,000 |
I'm running Debian Stretch. According to the Debian website, I should be able to install the package rust-doc, yet I can't:
wizzwizz4@myLaptop:~$ sudo apt install rust-doc
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package rust-doc
Everything se... |
There’s nothing wrong with your setup, the problem here is the package pool and the web site. The rust-doc package was disabled with the 1.24.1+dfsg1-1~deb9u1 upload:
Disable -doc package, requires packages not found in stretch and
docs are available online anyway
As a result the package is no longer included... |
What does this mkfs.ext4 operand mean? | 1,432,207,891,000 |
I am using GParted (0.28.1, Fedora 25) to format a external drive and noticed that the command displayed is:
mkfs.ext4 -F -O ^64bit -L "INSTALL" /dev/sdd1
When making disks in the past from command line I have just used mkfs.ext4 DEVICE which seemed to work well for various architectures. However the above includes ... |
The default options for mke2fs including those for ext4 can be found in /etc/mke2fs.conf. They could be different depending on the distro you're using. I'd take a look at that file on any distro you're curious about to see if the -O ^64bit param would be necessary. According to the man page the '^' is indeed the prefi... |
Are application layer protocols part of library routines? | 1,432,207,891,000 |
Where do application layer protocols reside? Are they part of library routines of language e.g. C, C++, Java?
As goldilocks says in his answer, this is about the implementation of application layer protocols.
|
Where do application layer protocols reside?
Protocols are an abstraction, so they don't really "reside" anywhere beyond specifications and other documentation.
If you mean, where are they implemented, there's a few common patterns:
They may be implemented first in native C as libraries which can be wrapped by for... |
Compiling from source: What are the options for config script "build"? | 1,432,207,891,000 |
When I am running a line like:
./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu {*shortened*} \
--with-imap-ssl=/usr/include/openssl/ --enable-ftp --enable-mbstring --enable-zip
I understand what the "x86_64-redhat-linux-gnu" means descriptively, but I have questions?
1) Is there a list some... |
The --build and -host options are to configure scripts are standard configure options, and you very rarely need to specify them unless you are doing a cross-build (that is, building a package on one system to run on a different system). The values of these options are called "triples" because they have the form cpu-ve... |
This dataset card aims to be a base template for new datasets. It has been generated using this raw template.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Users should be made aware of the risks, biases and limitations of the dataset. More information needed for further recommendations.
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]