Tag Info

Hot answers tagged

32

And now, the systemd answer. You're using, per the tag on your question, Red Hat Enterprise Linux. Since version 7, that has used systemd. None of the other answers are correct for the world of systemd; nor even are some of the assumptions in your question. Forget about runlevels; they exist, but only as compatibility shims. The systemd documentation ...


28

System 5 init will tell you only a small part of the story. There's a sort of myopia that affects the Linux world. People think that they use a thing called "System 5 init", and that is both what is traditional and the best place to start. Neither is in fact the case. Tradition isn't in fact what such people say it to be, for starters. System 5 init and ...


19

In a word: binfmt_misc. It's a Linux-specific, non-portable, facility. There are a couple of formats that are recognized by the kernel with built-in logic. Namely, these are the ELF format (for normal binaries) and the shebang convention (for scripts). (thanks to zwol for the following part of the answer). In addition, Linux recognizes a couple of esoteric ...


16

halt instructs the hardware to stop all CPU functions, but leaves it in a powered-on state. This usually means someone has to reboot or shut the machine down manually by pressing the power button afterwards. The specific way to achieve this is architecture specific, but for instance the x86 instruction set provides the HLT instructions which halts the ...


11

The init process is always assigned PID 1. The /proc filesystem provides a way to obtain the path to an executable given a PID. In other words: nathan@nathan-desktop:~$ sudo stat /proc/1/exe File: '/proc/1/exe' -> '/sbin/upstart' As you can see, the init process on my Ubuntu 14.10 box is Upstart. Ubuntu 15.04 uses systemd, so running that command ...


11

It might help to up /proc/sys/vm/page-cluster (default: 3). From the kernel documentation (sysctl/vm.txt): page-cluster page-cluster controls the number of pages up to which consecutive pages are read in from swap in a single attempt. This is the swap counterpart to page cache readahead. The mentioned consecutivity is not in terms of ...


8

On RPM-based systems, you can query the RPM database to see what package provides /sbin/init. For example: fedora:~$ rpm -qf /sbin/init systemd-216-24.fc21.x86_64 centos:~$ rpm -qf /sbin/init upstart-0.6.5-12.el6_4.1.x86_64 opensuse:~$ rpm -qf /sbin/init systemd-sysvinit-44-10.1.1.i586 If you just want the package name, and not version, you could add ...


8

As written in the manual page, the /etc/networks file is to describe symbolic names for networks. With network, it is meant the network address with tailing .0 at the end. Only simple Class A, B or C networks are supported. In your example the google-dns entry is wrong. It's not a A,B or C network. It's an ip-address-hostname-relationship therefore it ...


7

Sure, of course, since you can develop portable software that runs on both MacOS and Linux. Be sure to test it on Linux at regular intervals to make sure you haven't unintentionally added something unportable. If you want to use Linux-specific features then you will have more of a hard time. Depending on what it is you do, the program may compile on MacOS ...


6

Unix and C have an intertwined history, as they were both developed around the same time at Bell Labs in New Jersey and one of the major purposes of C was to implement Unix using a high level, architecture independent, portable language. However, there wasn't any official standardization until 1983. POSIX, the "portable operating system interface" is an ...


6

1) Download and install Samba: apt-get install samba samba-common 2) Backup samba.conf: cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 3) Edit samba.conf: nano /etc/samba/smb.conf Replace all with and edit it to your wishes: [global] workgroup = arbeitsgruppe server string = %h server (Samba %v) log file = ...


5

That's the current CPU frequency; it can be scaled up and down. Have a look in /sys/devices/system/cpu/cpu0 (or 1, 2, 3), then the cpufreq directory. Check cat scaling_governor. It is probably ondemand (I believe that's the default kernel configuration). Now check scaling_available_frequencies; you'll see a list that for you should start with 2600000. ...


5

From man man: -K, --global-apropos Search for text in all manual pages. This is a brute-force search, and is likely to take some time; if you can, you should specify a section to reduce the number of pages that need to be searched. Search terms may be simple strings (the default), or regular expressions if the --regex ...


5

No, there is not. You could potentially set up auditd or something like that to trace what happened but that would have been set up before the command. One possible solution is to look into the shell history to see where/how the file was moved and determine the original location from there. This is however largely unreliable.


5

You may try adding the programs you most care about to a cgroup and tuning swappiness so that the next time the application runs the programs you add are less likely to be candidates for swapping. Some of their pages will likely still be swapped out but it may get around your performance problems. A large part of it is probably just the "stop and start" ...


5

You can view if a file called /etc/debian_version exists. $ cat /etc/debian_version wheezy/sid If it exists, you also can see the version of debian. Also distributions like Ubuntu, Linux Mint, and so on, which are based on Debian have that file. Actually most distributions have a release file you can also try and see what comes out: cat /etc/*release


4

This is automatic CPU frequency scaling. I suspect that the CPU used by it is actually idled CPU. You can test this by firing up a CPU benchmarking program. You should see the kondemand instances drop to 0% usage. The atop program will display the CPU scaling percentage as well. Different distributions handle this differently and you didn't post yours, so ...


4

TL;DR - Fastest methods in 2015 The fastest method using DNS: dig +short myip.opendns.com @resolver1.opendns.com The fastest using HTTP: curl -s http://whatismyip.akamai.com/ The fastest using HTTPS with a valid cert: curl -s https://4.ifcfg.me/ Using telnet: With nc command: nc 4.ifcfg.me 23 | grep IPv4 | cut -d' ' -f4 With telnet command: ...


4

It's due to the way filenames and file data are separate. When you delete a file you're just deleting a named reference (hard link) to the data, not the data itself. When all of the references are gone from the filesystem the kernel will go ahead and free up the data -- but only if no running processes currently have the file open. Until then the file is not ...


4

Thanks to @dawud and @EsaJokinen comments I found a solution. Replacing PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' with PS1="\[\u@$(hostname -f): \w\]\$ " in /etc/bash.bashrc does the job on Debian 7


4

This is because your test is flawed. Running find . merely calls getdents() on the directory tree. A directory in this case is just a file that contains directory entries and is thus stored in page cache. Note you do nothing to actually access the files you are attempting to cache in this manner. Your test is basically caching all the directories in the ...


4

You can poke around the system to find indicators. One way is to check for the existence of three directories: /usr/lib/systemd tells you you're on a systemd based system. /usr/share/upstart is a pretty good indicator that you're on an Upstart-based system. /etc/init.d tells you the box has SysV init in its history The thing is, these are heuristics that ...


4

This is actually quite a difficult problem. One of the major difficulties is that the places where one most often wants to do this are the places where it's quite likely that one will be in the middle of installing or changing stuff. Another is that there's a subtle but very important difference between the system management toolset that is installed, the ...


4

History is loaded from file during bash startup. And file is saved automatically when bash exits. During bash execution, history is kept in memory and not synchronized with history file nor multiple bash instances. You can use history builtin command to manually save your current history to file or to load it from disk (see help history for details). Only ...


4

It seems to me that you can't magically "make the system responsive again". You either incur the penalty or reading pages back from swap space into memory now or you incur it later, but one way or the other you incur it. Indeed, if you do something like swapoff -a && swapon -a then you may feel more pain rather than less, because you force some pages ...


4

You're looking for the chpasswd command. You'd do something like this: echo 'pi:newpassword' | chpasswd # change user pi password to newpassword Note that it needs to be run as root, at least with the default PAM configuration. But presumably run as root isn't a problem for a system deployment script. Also, you can do multiple users at once by feeding it ...


4

/proc/<pid>/exe does not follow the normal semantics for symbolic links. Technically this might count as a violation of POSIX, but /proc is a special filesystem after all. /proc/<pid>/exe appears to be a symlink when you stat it. This is a convenient way for the kernel to export the pathname it knows for the process' executable. But when you ...


4

It won't be fast, especially for a large tarball with lots of files, but in bash you can do this: tar -tzf tarball.tgz | while IFS= read -r file; do tar --no-recursion -xzf tarball.tgz -- "$file" gzip -- "$file" done The first tar command extracts the names of the files in the tarball, and passes those names to a while read ... loop. The file ...


3

cgroups were created for exactly this reason. http://www.kernel.org/doc/Documentation/cgroups/ http://www.serverwatch.com/tutorials/article.php/3921001/Setting-Up-Linux-Cgroups.htm It takes a little while to familiarise yourself with them, and I believe you need root access to set them up, but it can all be scripted. The newer Ubuntus have a .conf file so ...


3

This cannot work. The outside LAN does not know how to handle the IP of your RaspberryPi. (=how to route the packets to reach your RaspberryPi) go to http://www.whatismyip.com/ to find out your public IP. Note it down, but don't tell us. You will have to point to this IP if you want to reach your RaspberryPi. Which port to use you have to define in a port ...



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