Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [linux]

These questions are about Linux in general -- NOT specific to a particular distribution. If the question just happens to be in a Linux environment, please specify your Linux distribution in the body of your question, but do NOT use the /linux tag.

12
votes
5answers
16k views

Moved bin and other folders! How to get them back?

I accidentally moved all folders from root to a subfolder. (/bin, /etc, /home, /lib, /usr... all moved) The only ones that were not moved, since they were in use, are /bak, /boot, /dev, /proc, /sys. ...
11
votes
2answers
9k views

How to restrict internet access for a particular user on the lan using iptables in Linux

Let's say there are two users on the LAN, A and B. How do I restrict user A from internet access using iptables rules and saving the rules so that after reboot, they are still effective. Suppose also ...
22
votes
2answers
22k views

How to colorize output of ls ?

I'm running CentOS in Linux text mode. When I run the command ls /usr/, the output is too hard to read (dark blue on black). How can I change the text coloring?
9
votes
3answers
5k views

Linux Bulk/Remote Administration

Beside our internal IT infrastructure, we've got around 500 Linux machines hosting our services for the on-line world. They are grouped in a bunch of clusters like Database A-n, Product A-n, NFS, ...
5
votes
1answer
410 views

Is it the process that has a controlling terminal, or is it the session that has a controlling terminal?

When we say that a process has a controlling terminal, do we mean that the process itself has a controlling terminal, or is it the session that the process belongs to that has a controlling terminal? ...
0
votes
2answers
199 views

What's the difference of get command output using`command`and $(command) in Shell? [duplicate]

What is the difference in collect a command output in Shell script using `command` and $(command)? For example: # IP1=$(ifconfig eth0 | grep -e "inet " | cut -d: -f2 | awk '{print $1}') # IP2=`...
51
votes
1answer
11k views

Understanding what a Linux binary is doing

I recently had a task at work to understand a binary Linux program. However, the program was in binary form. I used the commands file, strings, and objdump to have a slight idea of what it was doing, ...
95
votes
4answers
274k views

What is the difference between reboot , init 6 and shutdown -r now?

I just want to know difference between in reboot init 6 shutdown -r now and which is the safest and the best?
67
votes
2answers
74k views

What is kernel ip forwarding?

I have seen on many blogs, using this command to enable IP forwarding while using many network security/sniffing tools on linux echo 1 > /proc/sys/net/ipv4/ip_forward Can anyone explain me in ...
85
votes
1answer
88k views

How does the OOM killer decide which process to kill first?

This answer explains the actions taken by the kernel when an OOM situation is encountered based on the value of sysctl vm.overcommit_memory. When overcommit_memory is set to 0 or 1, overcommit is ...
38
votes
6answers
78k views

How to replace one char with another in all filenames of the current directories?

How do you rename all files/subdirs in the current folder? Lets say, I have many files and subdirs that are with spaces and I want to replace all the spaces with an underscore. File 1 File 2 File 3 ...
52
votes
6answers
73k views

How to reconnect a logically disconnected USB device?

It is possible for a USB storage device to become logically disconnected: the device is still plugged in, but is invisible from the operating system (e.g. it's not listed under /proc/bus/usb). Maybe ...
34
votes
3answers
41k views

Determining Specific File Responsible for High I/O

This is a simple problem but the first time I've ever had to actually fix it: finding which specific files/inodes are the targets of the most I/O. I'd like to be able to get a general system overview, ...
29
votes
4answers
6k views

How can I set the processor affinity of a process on Linux?

How can I set the processor affinity of a process on Linux?
16
votes
3answers
6k views

kernel: Namespaces support

I am wondering what exactly the “Namespaces support” feature in the Linux kernel means. I am using kernel 3.11.1 (the newest stable kernel at this time). If I decide to disable it, will I notice any ...
29
votes
6answers
26k views

Detecting headphone connection/disconnection in Linux

I am trying to detect a signal when a headphone is connected or disconnected from the system. What is the best way to do this? If there is a special board with drivers, that will be my preferred way....
27
votes
6answers
26k views

Getting information on a machine's hardware in Linux

How can I check what hardware I have? (With BIOS version etc.)
8
votes
3answers
10k views

How to change the output redirection of a running process?

I know how to redirect output and how to suppress them in bash. Now, suppose I accidentally forgot to append the output redirection part to the command (e.g. 2>&1 or > /tmp/mystdout) and my ...
6
votes
2answers
6k views

How to read one filesystem from a whole disk image file?

I ran these commands: VBoxManage clonehd d6b9f0a5-98df-48ca-83c8-91a0809ec349 --format RAW Debian.raw sudo dd if=~/.VirtualBox/HardDisks/Debian.raw of=/dev/sda5 When I try to mount the partition, I ...
8
votes
1answer
979 views

How does gnome reboot without root privileges?

I am reading the book Linux kernel development, in chapter 5 "System Call Implementation" page 77 says For example, capable(CAP_SYS_NICE) checks whether the caller has the ability to modify nice ...
4
votes
1answer
9k views

How to set up disk mirroring (RAID-1)

I have a computer with two WD 1TB drives and I want to configure disk mirroring on it. I tried setting up RAID during the installation by creating RAID partitions but that does not work for me. Is ...
3
votes
2answers
4k views

Debian does not detect serial PCI card after reboot

I have installed a PCI card with two serial and one parallel port on it. the chipset is MCS9865. I downloaded the latest driver(V1.0.12) from here. I ran make and make install. now the two serial ...
2
votes
5answers
3k views

How does one inspect the directory structure information of a unix/linux file?

In Unix file systems directories are just special files with special directory structures that hold the child filename, filename size and inode reference number. The actual file metadata beyond ...
381
votes
24answers
536k views

How can I resolve a hostname to an IP address in a Bash script?

What's the most concise way to resolve a hostname to an IP address in a Bash script? I'm using Arch Linux.
142
votes
4answers
609k views

How to get the complete and exact list of mounted filesystems in Linux?

I usually use mount to check which filesystems are mounted. I also know there is some connection between mount and /etc/mtab but I'm not sure about the details. After reading How to check if /proc/ is ...
66
votes
3answers
89k views

What is difference between User space and Kernel space?

Is Kernel space used when Kernel is executing on the behalf of the user program i.e. System Call? Or is it the address space for all the Kernel threads (for example scheduler)? If it is the first one,...
101
votes
2answers
239k views

timestamp, modification time, and created time of a file

I just know that ls -t and ls -f give different sorting of files and subdirectories under a directory. What are the differences between timestamp, modification time, and created time of a file? How ...
51
votes
11answers
39k views

A tool for automatically applying RandR configuration when external display is plugged in

is there a tool which enables one to: remember current RandR configuration (position, orientation, resolution etc) on per-monitor basis, automatically apply last known good configuration as soon as ...
24
votes
4answers
110k views

Number of processors in /proc/cpuinfo

While I was learning about cpu load, I came to know that it depends on the number of cores. If I have 2 cores then load 2 will give 100% cpu utilization. So I tried to find out cores.( I already know ...
19
votes
6answers
20k views

How to make a process invisible to other users?

How could you launch a process and make it invisible to the top command? The process is started by a normal user (not root), and should not be visible to other normal users.
46
votes
5answers
74k views

how to redirect output to multiple log files

How to redirect standard output to multiple log files? The following does not work: some_command 1> output_log_1 output_log_2 2>&1
17
votes
1answer
5k views

keyboard hard remap keys?

I am trying to find a way to remap keyboard keys forcefully. I tried using xmodmap and setxkbmap, but they do not work for one specific application. Such commands work for other normal windowed/...
33
votes
2answers
6k views

How frequently is the proc file system updated on Linux?

How frequently is the proc file system updated on Linux? Is it 20 milliseconds (time quantum)?
7
votes
1answer
393 views

Why were “USB-stick stall” problems reported in 2013? Why wasn't this problem solved by the existing “No-I/O dirty throttling” code?

The pernicious USB-stick stall problem - LWN.net, November 2013. Artem S. Tashkinov recently encountered a problem that will be familiar to at least some LWN readers. Plug a slow storage device (...
3
votes
2answers
4k views

Is possible to remote mount an image, that can boot and install itself?

I have a remote server, which runs Linux. I would like to install remotely the OS image, in case that it gets corrupted (this has already happened twice while I am experimenting with the OS). So far, ...
3
votes
2answers
1k views

Is there a log of past threads that are now closed?

Sometimes, I have a rogue Java process which takes up 100% of my CPU and makes it jump about 30C in temperature (usually resulting in a crash if not killed). Problem is, I can never really identify ...
4
votes
2answers
5k views

Captive portal detection, popup implementation?

Based on hostapd, I am building a captive portal. My Linux Machine provides Wifi access. iPad's and Android clients-tablets connect to this Wifi. Generally, any client OS checks if a URL is ...
2
votes
2answers
5k views

Fsck script location

I need to find out what kind of script runs fsck during the boot on CentOS 7? I know that all scenarios are located in /etc/rc.d directory. But I haven't any idea about where is this script is located....
1
vote
1answer
1k views

SCP through multiple hosts

The question describes how to SSH into a machine that can only be accessed through one or more hosts (that can also be SSH'd into). Is there an equivalent way of using scp? That is, copy a file to my ...
3
votes
3answers
1k views

Copying file to block device

I have an NTFS formatted USB Hard drive that has my personal files backup. Today I mounted the drive to an Oracle Linux system and copied a regular file using the below command (please see below ...
263
votes
16answers
802k views

How do I set my DNS when resolv.conf is being overwritten?

Most of the info I see online says to edit /etc/resolv.conf, but any changes I make there just get overridden. $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by ...
103
votes
2answers
108k views

Difference between pts and tty

Possible Duplicate: What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'? I always see pts and tty when I use the who command but ...
93
votes
5answers
118k views

How do I attach a terminal to a detached process?

I have detached a process from my terminal, like this: $ process & That terminal is now long closed, but process is still running, and I want to send some commands to that process's stdin. Is ...
50
votes
7answers
141k views

How can I benchmark my HDD?

I've seen commands to benchmark one's HDD such as this using dd: $ time sh -c "dd if=/dev/zero of=ddfile bs=8k count=250000 && sync" Are there better methods to do so than this?
148
votes
1answer
10k views

How is Mono magical?

I'm learning C#, so I made a little C# program that says Hello, World!, then compiled it with mono-csc and ran it with mono: $ mono-csc Hello.cs $ mono Hello.exe Hello, World! I noticed that when I ...
79
votes
2answers
221k views

How to show the filesystem type via the terminal? [duplicate]

Possible Duplicate: How to tell what type of filesystem you’re on? Find filesystem of an unmounted partition from a script How can I quickly check the filesystem of the partition? Can I do that ...
74
votes
1answer
148k views

Setting /proc/sys/vm/drop_caches to clear cache

As part of doing some cold cache timings, I'm trying to free the OS cache. The kernel documentation (retrieved January 2019) says: drop_caches Writing to this will cause the kernel to drop clean ...
38
votes
8answers
25k views

How does Linux kernel compare to microkernel architectures?

I read once that one advantage of a microkernel architecture is that you can stop/start essential services like networking and filesystems, without needing to restart the whole system. But considering ...
33
votes
2answers
9k views

What is the difference between “all”, “default” and “eth*” in /proc/sys/net/ipv[46]/conf/?

In sysctl, the /proc/sys/net/ipv[46]/conf/ keys have the following subkeys: all, default, and a key for each network interface. For example, on a machine with a single network interface eth0, it will ...
26
votes
11answers
21k views

How to make sure only one instance of a bash script runs?

A solution that does not require additional tools would be prefered.