Hot answers tagged linux
33
The reason is Unix does not lock an executable file while it is executed or even if it does like Linux, this lock applies to the inode, not the file name. That means a process keeping it open is accessing the same (old) data even after the file has been deleted (unlinked actually) and replaced by a new one with the same name which is essentially what a ...
24
The information that you read from the proc filesystem is not stored on any media (not even in RAM), so there is nothing to update.
The purpose of the proc file system is to allow userspace programs to obtain or set kernel data using the simple and familiar file system semantics (open, close, read, write, lseek), even though the data that is read or written ...
18
Executables are generally opened once, attached to a file descriptor, and do not have a file descriptor to their binary reopened during a single period of execution. For example, if you execute bash, exec() generally only creates a file descriptor for the inode pointed to by /bin/bash once -- on invocation.
This often means that for simple binaries that do ...
16
It is updated on every access. You see the state of the kernel in that moment. That's why the size shown for the "files" is not the real size. The real size can change and is determined the moment you access the file.
You could say, it may be not updated for days. If you don't look at it. :-)
16
Here's an article on How To Geek about how ext2/ext3 allocates files on the disk. And they also have an article asking "Do you really need to defrag?"
On why FAT becomes fragmented:
"When you save a file to a FAT file system, [the file is saved] as close to the start of the disk as possible. When you save a second file, [the file is saved] right after ...
10
Because getc() buffers the read data before returning it, so a call to getc() does not necessarily result in a call to read(). read() is a system call, which takes much longer time to accomplish than a normal function call because the kernel has more operations to do. When you enter the kernel space, it changes your stack, saves all the context, deals with ...
10
Fragmentation is always a concern no matter what the filesystem. Ext3/Ext2, though, have minimized the problem to the point where most admins just operate as if it's not a concern. This is minimized by use of competent the I/O scheduler and by the filesystem leaving trailing space after each file to accommodate growing. On top of that, additional fragments ...
9
When logging in using SSH, you use a pseudo-terminal (a pty) allocated to the SSH daemon, not a real one (a tty). Pseudo-terminals are created and destroyed as needed. You can find the number of ptys allowed to be allocated at one time at /proc/sys/kernel/pty/max, and this value can be modified using the kernel.pty.max sysctl variable. Assuming that no other ...
9
proc and sys filesystems are provided by the running kernel -- when the kernel is not running, they cease to exist. This means that when you chroot into another operating system, these filesystems are not present. Many programs expect them to exist so that they can function, for example, they may require information about the running system, or want to ...
8
Rsync has code which specifically checks if a file is truncated during read and gives this error — ENODATA. I don't know why the files in /sys have this behavior, but since they're not real files, I guess it's not too surprising. There doesn't seem to be a way to tell rsync to skip this particular check.
I think you're probably better off not rsyncing /sys ...
8
This is a broad ranging question and can probably only be answered with the same sorts of brushstrokes. Ultimately, it comes down to what you, the user, wish to protect.
Fundamentally, you should not post anything that would allow someone else to find it easier to compromise your system, or any of the other connected tools or accounts you use. For this ...
8
You just need to understand Memory Concept
As per your Output Of /proc/meminfo , You just need to Notice below things :
Buffers :- A buffer is something that has yet to be "written" to disk. it represent how much portion of RAM is dedicated to cache disk block. "Cached" is similar like "Buffers", only this time it caches pages from file reading
Cached ...
7
Absolutely. To cite RFC 1392:
hacker
A person who delights in having an intimate understanding of the
internal workings of a system, computers and computer networks in
particular. The term is often misused in a pejorative context,
where "cracker" would be the correct term. See also: cracker.
And as so correctly addressed by the ...
6
I'd put it in the /etc directory in the file /etc/profile.d/myvariable.sh. In this file I'd set it like this:
SPI=/usr/local/share_ideas
Files in the /etc/profile.d directory are automatically sourced as part of a user logging into the system. The files that end in a ".sh" are used by the bash shell.
6
Under Linux try man 7 signal.
kill -HUP 1234 means "send the SIGHUP signal (1) to process 1234", so it's equivalent to kill -1 1234. The default signal that is sent by kill is SIGTERM (15), so kill 1234 is equivalent to kill -TERM 1234 or kill -15 1234.
6
You're confusing arguments and standard input. Piping data to a program is not equivalent to giving it command line arguments.
In your first case, you are passing no arguments to your script, only feeding it data through its standard input stream. So $1 is unset for the whole duration of the script.
The first invocation of more thus has no parameter, and ...
5
Woohoo, I solved it :)
The short answer is you can't mount >4k block size devices on x86 linux machines as far as I can tell without some serious kernel hacking.
However, there is a work around.. using fuse-ext2 to mount the disk:
fuseext2 -o ro -o sync_read /dev/sdb4 /mnt/
(you'll probably need to apt-get fuseext2 first..)
works perfectly first time!
...
5
If the shell is zsh or bash (though not in sh mode), make exit a function. Functions have precedence over shell builtins (even special ones like exit) in zsh or bash (though not in POSIX shells). So just rename your function to exit and use command exit within the function instead. Otherwise you had endless recursion, of course.
5
cat just uses whatever settings the port is already configured for. With this little C snippet you can see the baud rate currently set for a particular serial port:
get-baud-rate.c
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
int main() {
struct termios tios;
tcgetattr(0, &tios);
speed_t ispeed = ...
5
If you do the following:
ls | grep -F -v ' '
You will not see any file with spaces in the names
( I used to have fgrep instead of grep -F in the example, but as Hauke Laging pointed out that is deprecated)
4
There is no fundamental reason for not being able to get the same quality output from graphics cards for the same hardware under Windows and Linux. However the development of software, both the drivers, and any application software, needs to be written and doing that both for Windows and for Linux just takes extra effort.
Such double effort always takes ...
4
You should create a new user as Hauke is right in indicating that creating two with the same UID is going to be confusing ( you could do that with useradd -u EXISTINGUID ... )
You probably just want to make a new user and make sure they are in the same group and that the group permissions are so that they can work with the data in the same group in the same ...
4
Yes, it is correct.
Quotes in shells are for different purpose than in other languages. See this answer for more details.
In shell, quotes are used to prevent the shell to treat some characters specially and to prevent some operations that the shell would otherwise perform upon some types of expansion (like in this case variable expansion).
Typically, in ...
4
It comes down to the fact that reads from disks are block oriented: to read a single byte from a disk, the hardware ends up reading a block (512 or 1024 or some number) of bytes, buffering all that, passing it to the kernel. If you read byte 0 of the file from block 0 of the file, do some work, then read byte 1 from the file, the kernel probably ends up ...
4
There are ways to install rpms in a user directory using rpm, but I don't believe it is straight-forward. I don't believe there is a way with yum.
My standard practice has become to compile from source to a local directory in my home
$ mkdir ~/local
$ mkdir ~/local/bin
$ mkdir ~/local/lib
$ mkdir ~/local/include
I download source as I would to ...
4
/usr/local and its subdirectories (bin, lib, share, etc) should be (and likely are) owned root and set 755 so that anyone can execute stuff there.
If you unpacked something and copied it in, then it could be the permissions on the individual binaries, which should also be 755 to allow general use.
Keep in mind how $PATH works. Your example of the JDK may ...
4
With a traditional Master boot record, you only get four slots for primary or extended partitions. You already have two primary partitions, and one extended (in which you can create logical partitions). So there's only one slot left in the MBR for an additional primary partition.
4
Just run file on the kernel image. It will show what architecture the binary was compiled as.
file vmlinuz-2.6.18-194.32.1.el5.
EDIT: Running file on the OP's kernel doesn't return the exact architecture, so the answer is not valid. I'll try it on my kernels and see if I get more info.
4
file vmlinuz-2.6.18-194.32.1.el5 will tell you what architecture the kernel was compiled for. If there's a file /boot/config-2.6.18-194.32.1.el5, it will give more information about the kernel compilation options, including the processor architecture.
ls /lib* will tell you what architecture the userland supports. For example, if there's /lib/ld-linux.so.2 ...
4
'live' watching can be done via udevadm:
udevadm monitor --subsystem-match=usb --property
or
udevadm monitor --subsystem-match=usb --property --udev
to filter only udev events. If you want to grep for a particular property you will have to un-buffer udevadm output (with tools like stdbuf, script, unbuffer...):
stdbuf -i 0 -o 0 -e 0 udevadm monitor ...
Only top voted, non community-wiki answers of a minimum length are eligible




