date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,662,841,977,000 |
In the script it reads:
rm -v !\(*.yaml\) ;\
this produces
rm: cannot remove '!(*.yaml)': No such file or directory
but works fine in the command line.
Have tried escaping in various ways:
'\!\(\*.yaml\)'
`\!\(\*.yaml\)`
`!\(*.yaml\"\)`
"\!\(\*.yaml\)"
Can't seem to figure out the appropriate escape sequence, I sim... |
!(x) is a Korn shell glob operator. bash supports a subset of ksh's globs operators including that one but only after shopt -s extglob¹
So:
shopt -s extglob
rm -f -- !(*.yaml)
Will remove all the non-hidden files in the current directory except those whose name ends in .yaml.
In any case, glob operators are not recog... | How do I perform rm -v !(*.yaml) in a bash script? |
1,662,841,977,000 |
I am having a question that do all the linux distros boot files,grub files and kernel files , that are main to run them and only the iso image of the distro is different?I have Fedora installed on my system and can replace it with manjaro by changing the grub entry? How safe it is?
|
Various distributions of course have different packages of pretty much everything. Nevertheless, three components are typically rather well isolated from each other: bootloader, kernel, userspace programs.
Bootloader needs to be able to boot various kernels, otherwise its usability would be quite limited.
The kernel... | Do all linux distros have same boot files and all the main files? |
1,662,841,977,000 |
I want to get my netmask on Linux. It is outputted with ifconfig but I want to extract the string.
|
I should clarify that the code here works for Linux, (note comments and post about other Unices). OP asked for a Linux solution, but it would be good to change the question to "how to get netmask" in general, and have the answer combine the best way for more Unix flavors.
#!/bin/sh
ifconfig "$1" | sed -rn '2s/ .*:(.*)... | How to get netmask from bash? |
1,662,841,977,000 |
I know about the chattr +i filename command which makes a file read only for all users. However, the problem is that I can revoke this by using chattr -i filename.
Is there a way to make a file readable by everyone on the system, but not writable by anyone, even the root, and with no going back (No option to make it w... |
Put it on a CD or a DVD. The once-writable kind, not the erasable ones. Or some other kind of a read-only device.
Ok, I suppose you want a software solution, so here are some ideas: You could possibly create an SELinux ruleset that disables the syscall (*) that chattr uses, even for root. Another possibility would be ... | Make file read only on Linux even for root |
1,662,841,977,000 |
On Windows I have frequently changed the priority of a games process to 'high' or 'realtime' to get a performance boost. This has never resulted in any problems with my hardware. I was thinking that maybe I could do this on Linux using the chrt command to change the realtime priority of the games process, as reniceing... |
Changing the priority of a process only determines how often this process will run when other processes are competing for CPU time. It has no impact when the process is the only one using CPU time. A minimum-priority process on an otherwise idle system gets 100% CPU time, same as a maximum-priority process.
So you can... | Is changing the priority of a game's process to realtime bad for the CPU? |
1,662,841,977,000 |
I need to run performance tests for my concurrent program and my requirement is that it should be run on only one CPU core. (I don't want to cooperative threads - I want always have a context switching).
So I have two questions:
The best solution - How to sign and reserve only one CPU core only for my program (to for... |
On linux, the system call to set the CPU affinity for a process is sched_setaffinity. Then there's the taskset tool to do it on the command line.
To have that single program run on only one CPU, I think you'd want something like
taskset -c 1 ./myprogram
(set any CPU number as an argument to the -c switch.)
That sho... | Using only one cpu core |
1,662,841,977,000 |
After I look through the help. I didn't found much difference between them.
-g, --gid GROUP
The group name or number of the user's initial login group. The group
name must exist. A group number must refer to an already existing
group.
-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
A list of supplementary grou... |
-g sets the initial, or primary, group. This is what appears in the group field in /etc/passwd. On many distributions the primary group name is the same as the user name.
-G sets the supplementary, or additional, groups. These are the groups in /etc/group that list your user account. This might include groups such as ... | What is the difference between -g and -G options in useradd |
1,662,841,977,000 |
The output from uname:
root@debian:~ # uname -a
Linux 5asnb 2.6.32-5-amd64 #1 SMP Mon Jun 13 05:49:32 UTC 2011 x86_64 GNU/Linux
However the /sbin/init executable shows up as 32-bit:
root@debian:~ # file /sbin/init
/sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared li... |
The 64bit kernel can be installed on Debian 32bit. You can see that the amd64 kernel is available for 32bit Debian on it's package page. This can be used as an alternative to using a PAE enabled kernel to support more than 4G of total RAM. Note that 32bit binaries still can not access more than roughly 3G of RAM per p... | 64-bit kernel, but all 32-bit ELF executable running processes, how is this? |
1,662,841,977,000 |
Are they both different flavors of Linux? I often see these two used interchangeably or together, which is confusing. Either they may be competing versions of Linux, or parts of the same thing...but not both :)
Can anyone clarify the difference/similarity between them?
|
Debian has a release maturity model, where Unstable, Sid, is where all the new stuff goes in. If it sticks, then Unstable becomes Testing, in which nothing can be added during testing. This typically lasts 1.5 - 2 years. If no problem at that point, Testing becomes the new Stable release.
Security updates are made to ... | What is the difference between Ubuntu and Debian? |
1,662,841,977,000 |
So I need to sort the IP Addresses and then sort my line by them.
I can sort IP addres in a file by using : sort -n -t . -k1,1 -k2,2 -k 3,3 -k4,4
If my file looks like :
add method1 a.b.c.d other thing
add method2 e.f.g.h other thing2
add method2 a.b.c.d other thing2
add method5 j.k.l.m other thing5
... |
This script copies the ip address from field 3 using awk to the
start of the line with a "%" separator, then does the sort
on the ip address now in the first field, then removes
the added part.
awk '{print $3 " % " $0}' |
sort -t. -n -k1,1 -k2,2 -k3,3 -k4,4 |
sed 's/[^%]*% //'
If the field with the ip address is not... | Select and sort IP address keeping the whole line |
1,662,841,977,000 |
If someone refers to "Windows" then everyone understands that as a generic reference to covers any or all versions of Windows. As for Macs, I have very little personal experience but I assume that "MacOS" is sufficient to do the same.
However, when referring to other OS' (see 'UNIX tree') how should someone make refer... |
Terminology is complicated because there are several Unix-like OS kernels and some flavours of non-kernel (user-space) OS software.
“Unix-like” or “*nix” – anything derived from original Unix and vaguely resembling it.
“Linux”, “GNU/Linux”, a “Linux distribution” – systems based on the Linux kernel.
“GNU” – a collect... | What is the correct way to refer to LINUX/UNIX generically? |
1,662,841,977,000 |
I'm looking for a Linux-compatible TTY-based calculator. For example:
user@host:~$ calculate
> 2
2
user@host:~$ calculate
> 8*6-4
44
user@host:~$ calculate
> 8*(6-4)
16
Is there anything like this that supports basic operations, some built-in functions like atan(), and possibly custom functions via scripting?
|
bc & dc
bc and dc are the 2 calculators that I'll often use when needing access from a terminal.
bc examples
$ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
Then you can type your calculat... | Command line expression solver? |
1,662,841,977,000 |
we have the follwing json file
more t.json
{
"href" : "htr",
"items" : [
{
"href" : "lpo",
"tag" : "version1533203561827110",
"type" : "kafka-log4j",
"version" : 6,
"Config" : {
"cluster_name" : "hdp",
"stack_id" : "HDP-2.6"
},
"properties" : {
... |
Try this,
jq '.items[].properties.content' t.json
Add -r if you want to get rid of the double quotes
| jq + how to print only the value of key under properties |
1,662,841,977,000 |
I'm looking for a way to update thousands of .tbz archive files, so I'll be doing this with a shell script. I need to add one file to each.
My question is, is there a faster way to do this without extracting each tbz's contents, then re-compressing with the new file included in the contained tar? What would the comma... |
While tar can add files to an already existing archive, it cannot be compressed. You will have to bunzip2 the compressed archive, leaving a standard tarball. You can then use tar's ability to add files to an existing archive, and then recompress with bzip2.
From the manual:
-r Like -c, but new entries are appe... | Adding file to tbz files |
1,662,841,977,000 |
How to capture the first IP address that comes from ifconfig command?
ifconfig -a
enw178032: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 100.14.22.12 netmask 255.255.0.0 broadcast 100.14.255.255
inet6 fe80::250:56ff:fe9c:158a prefixlen 64 scopeid 0x20<link>
ether 00:10:56:9c:6... |
It is better avoid using ifconfig for getting an IP address in a scriptas it is deprecated in some distributions (e.g. CentOS and others, do not install it by default anymore).
In others systems, the output of ifconfig varies according to the release of the distribution (e.g. the output/spacing/fields of ifconfig dif... | How to capture the first IP address from a ifconfig command? |
1,662,841,977,000 |
I'm running Fedora 27, and my university uses a network authenication portal so GNOME pops up a hotspot login screen. I would like to disable this screen, and just have it open it in firefox, because my login data is already there. How do I change this setting? I've checked the settings app and there are no settings t... |
From the man page:
CONNECTIVITY SECTION
This section controls NetworkManager's optional connectivity checking
functionality. This allows NetworkManager to detect whether or not the
system can actually access the internet or whether it is behind a
captive portal.
uri
The U... | WIFI - Disable Hotspot Login Screen |
1,662,841,977,000 |
We can determine the owner of a process by using the ps command. Does this mean that other users cannot run / kill / resume that process?
|
Read credentials(7), fork(2), execve(2). The fork system call is the way processes are created (today, fork is often implemented with clone(2) but you can see that as an implementation detail). The exec system call is the way executable programs are started. Remember that everything is done from some process with some... | Can a process have an owner? What does it mean? |
1,662,841,977,000 |
I have a Linux VM on Google Cloud and it has a tmux session which is running a .py file and I am trying to get the console log, but I can't scroll up or anything.
Any idea?
|
You don't mention how you are trying to scroll. If you are trying to scroll the terminal window itself, then that won't work since Tmux is a fullscreen app. It would be like trying to scroll vim (or any other editor).
There are multiple options, however:
Tmux Copy Mode
The default keybinding for activating the scrol... | How to get the full console log of my tmux session on Linux? |
1,662,841,977,000 |
At the memory address, 0x7fffffffeb58 of a program lies a value, I want to find out the value of the address.
Is there a way to get the value just by using commands?
I've tried dd but to no avail.
|
To peek at memory addresses of a process, you can look at /proc/$pid/mem. See also /proc/$pid/maps for what's mapped in the process' address space.
You'll want to seek() within that file to the location you want, which you should be able to do with dd:
dd bs=1 skip="$((0x7fffffffeb58))" count=4 if="/proc/$pid/mem" |
... | How to get value of a memory address using command? |
1,662,841,977,000 |
I have a daemon (apache/samba/vsftpd/...) running on SELinux enabled system and I need to allow it to use files in a non-default location. The standard file permissions are configured to allow access.
If the daemon is running in permissive mode, everything works. When set back to enforcing it doesn't work anymore and ... |
Background
SELinux adds another layer of permission checks on Linux systems. On SELinux enabled systems regular DAC permissions are checked first, and if they permit access, SELinux policy is consulted. If SELinux policy denies access, a log entry is generated in audit log in /var/log/audit/audit.log or in dmesg if au... | Configure SELinux to allow daemons to use files in non-default locations |
1,662,841,977,000 |
I'd like to simply watch all devices added and removed from my system and view their USB vendor ID, product ID and revision and other relevant information. How can I do this in Linux? Is there a logfile that I can tail -f or does this require something else?
|
This information appears in the kernel logs — typically in /var/log/kern.log, or /var/log/syslog, or some other file (it depends on your syslog configuration, different distributions have different defaults).
If you'd like something pre-filtered, you can add an udev rule. Create a file /etc/udev/rules.d/tkk-log-usb.ru... | Watch USB connections vendor id, product id and revision |
1,662,841,977,000 |
I'd like to see a list of software installed in the order of the date they were installed. The order doesn't matter (newest to oldest & vice-versa) as long as they're arranged by date.
I'm mainly interested in seeing what libraries I've installed. Since I've installed so many, I need to know what libraries were insta... |
Fortunately rpm does offer this itself:
rpm -qa --last
or if you can limit the packages by name
rpm -qa --last 'lib*' 'morelibs*'
| How to list RPM packages installed in order of installation date [duplicate] |
1,662,841,977,000 |
How many bits on a linux file system is taken up for the permissions of a file?
|
To add to the other answers:
Traditional Unix permissions are broken down into:
read (r)
write (w)
execute file/access directory (x)
Each of those is stored as a bit, where 1 means permitted and 0 means not permitted.
For example, read only access, typically written r--, is stored as binary 100, or octal 4.
There ar... | How many bits is the access flags of a file? |
1,662,841,977,000 |
I have read the man pages of Curl, but I can't understand what those parameters (k, i and X) mean. I see it used in a REST API call, but can someone please explain what those three parameters do? It's not clear in the documentation.
Thank you in advance.
|
-k, --insecure: If you are doing curl to a website which is using a self-signed SSL certificate then curl will give you an error as curl couldn't verify the certificate. In that case, you could use -k or --insecure flag to skip certificate validation.
Example:
[root@arif]$ curl --head https://xxx.xxx.xxx.xxx/login
... | What is the meaning of "curl -k -i -X" in Linux? |
1,662,841,977,000 |
I would like to learn more about Linux. I briefly went through a few books and quite a few articles online, but the only way to learn something is to actually start using it.
I would like to jump in the deep end and configure a Linux server. So far I have downloaded Ubuntu Server.
I'm looking for goal or a challenge... |
Here's a couple:
run Linux as your primary operating system, on both your desktop and your laptop, if any
install KVM and virt-manager and build a couple of virtual machines
build a package for your distro of choice (a .deb or .rpm file); it helps in understanding a lot of things
build your own kernel
These might no... | A small challenge to familiarize myself with Linux [closed] |
1,662,841,977,000 |
I tried to use vim on FreeBSD (via ssh on Linux xterm-compatible terminal). However vim behaves similar to vi out-of-box. For example it does not react on delete key, insert F character instead of going up while on insert mode etc.
On FreeBSD X11 is not installed.
Edit: As asked I post vim --version
# vim --version
VI... |
This is generally a terminal setting problem. Check your $TERM environment variable on the FreeBSD side, and check what your local terminal setting is. This is almost certainly the problem with the arrow keys.
In addition to this, make sure you have the standard set of "unbreak my vim" .vimrc settings applied.
set noc... | vim on FreeBSD does not react on arrow keys correctly and other vi-like behaviours |
1,662,841,977,000 |
From the manpage man limits.h:
{WORD_BIT}
Number of bits in an object of type int.
Minimum Acceptable Value: 32
However if I run a simple program:
#include <limits.h>
#include <stdio.h>
int main() {
printf("%d\n", WORD_BIT);
return 0;
}
However when trying to compile with gcc (g... |
I’m not sure this is documented, but with the GNU C library you need to set _GNU_SOURCE to get WORD_BIT:
$ gcc -include limits.h -E - <<<"WORD_BIT" | tail -n1
WORD_BIT
$ gcc -D_GNU_SOURCE -include limits.h -E - <<<"WORD_BIT" | tail -n1
32
You should really use sysconf:
#include <unistd.h>
#include <stdio.h>
int mai... | Why is there no WORD_BIT in limits.h on Linux? |
1,662,841,977,000 |
Why couldn't the Live ISOs just be a minimal Linux system with an installer? Is there any reason to use squashfs to hold the root of the filesystem? Is it just for better compression, or are there other reasons?
I've seen some answers (and comments) say that it's for read-only reasons. What about persistence, like wha... |
There are a couple of important reasons for this, but the big two are space constraints, and requirements from the filesystem itself.
SquashFS is a highly optimized filesystem image format that provides, among other benefits:
High levels of data compression.
Built-in block-level deduplication (any given block is stor... | Why is the base system of Live ISOs for Linux distros usually stored with squashfs? |
1,662,841,977,000 |
I have a json file with a load of AWS CloudWatch logs (generated from a CLI command). I'm trying to use jq to only return values for entries that don't have a 'retentionInDays' field. I have the following which returns everything as I want, but I can't seem to filter out the results that do have retentionInDays.
# Wor... |
I'm assuming you want to get the logGroups entries that don't have a retentionInDays key at all.
$ jq '.logGroups[] | select( has("retentionInDays") == false )' file.json
{
"storedBytes": 0,
"metricFilterCount": 0,
"creationTime": 1245,
"logGroupName": "/aws/elasticbeanstalk/nginx",
"arn": "longarnhere"
}
I... | jq filter for only 'null' values |
1,662,841,977,000 |
Trying here to write a shell script that keeps testing my server and email me when it becomes down.
The problem is that when I logout from ssh connection, despite running it with & at the end of command, like ./stest01.sh &, it automatically falls into else and keeps mailing me uninterruptedly, until I log again and k... |
When GNU grep tries to write its result, it will fail with a non-zero exit status, because it has nowhere to write the output, because the SSH connection is gone.
This means that the if statement is always taking the else branch.
To illustrate this (this is not exactly what's happening in your case, but it shows what ... | Trying to write a shell script that keeps testing a server remotely, but it keeps falling in else statement when I logout |
1,662,841,977,000 |
there are strange things:
on my virtualbox:
centos7
Interfaces:
enp0s3: 192.168.10.110/24
lo:0 10.0.3.110/24 (ip alias)
route:
default via 10.0.3.2 dev lo
192.168.10.0/24 dev enp0s3
enp0s3 is plugged in 10.0.3.0/24
I have enabled the ip_forward (net.ipv4.ip_forward = 1)
My Question:
ping 10.0.3.2 works,but why?
tc... |
The loopback interface is a virtual interface. The only purpose of the loopback interface is to return the packets sent to it, i.e. whatever you send to it is received on the interface. It makes little sense to put a default route on the loopback interface, because the only place it can send packets to is the imaginar... | How does the loopback interface work |
1,662,841,977,000 |
I've been trying to run this Linux passwd-generator file on my Mac. I modified enough the script to make it to work well with directories under OSX:
#!/bin/sh
# build-passwd.sh - creates a password file which contains all OS users (except root)
PASSWDIR=$(cd "$(dirname "$0")"; pwd)/etc
PASSWFN=$PASSWDIR/passwd
if [ ! ... |
Starting with Lion, there is a shadow file per user. All of those are stored in /var/db/dslocal/nodes/Default/users directory and are accessible by root only. For example:
$ ls -lah /var/db/dslocal/nodes/Default/users/
total 296
drwx------ 77 root wheel 2.6K Jul 27 20:30 .
drw------- 12 root wheel 408B Jul 27 ... | /etc/shadow on Mac |
1,662,841,977,000 |
I've been trying for a few days already, but still cannot figure it out how to get the proper size of my HDD drive with a python script.
My HDD is 1Tb. As I know in Gb it is 1000Gb, and in GiB it is 931GiB roughly.
When I type in the terminal lsblk it shows this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:... |
If that's ext4, it's the size that is lost to filesystem metadata, mainly inode tables. As an example, a /home partition here.
Partition is 751619276800 bytes (sudo /sbin/blockdev --getsize64 /dev/mapper/Watt-home)
"df" size is 739691814912 (df --block-size=1 /home)
Inode count is 45875200 (df -i /home)
Inodes on ext... | Why am I getting HDD total space less than 931 GiB? |
1,662,841,977,000 |
I am reading a 550MB file into /dev/null and I am getting
dd: writing '/dev/null': No space left on device
I was surprised. I thought /dev/null is a black hole where you can send as much as you want ( because its a virtual fs).
Yes my disk is almost full when I get this error. What can I do other than deleting conten... |
/dev/null is a special file, of type character device. The driver for that character device ignores whatever you try to write to the device and writes are always successful. If a write to /dev/null fails, it means that you've somehow managed to remove the proper /dev/null and replace it by a regular file. You might ha... | dd: writing '/dev/null': No space left on device |
1,662,841,977,000 |
Is it possible to change password database file(/etc/passwd) to some other file. How does this authentication mechanism work internally ?
Does it depend on pam ?
|
You're right: /etc/passwd and /etc/shadow are consulted by pam_unix.so, which are part of PAM. At least on modern Linuxes. You could change this by patching pam_unix.so. If the manpage is to be believed, you can't change the location of the system databases.
And you really don't want to. /etc/passwd isn't just used fo... | Is it possible to change password database file(/etc/passwd) in linux? |
1,662,841,977,000 |
My problems were caused by a faulty memory module and quite possibly a broken kernel binary.
I just now booted my PC with basically brand new hardware. I've been running Debian 6.0 AMD64 before, and no change there (literally; I just unplugged the hard disks from the old motherboard and reconnected them to the new on... |
First, if your BIOS/UEFI does not detect correctly your RAM, then your OS won't do any better. There's no need to go any further if your BIOS display incorrect information about your setup.
=> You probably have at least an hardware problem.
EDIT: From your dmesg | grep memory, it seems that you have in fact an hardwa... | 64-bit Linux doesn't recognize my RAM between 3 and 32 GB |
1,328,536,983,000 |
I am trying to copy files using secure copy(scp). I am trying to execute the following command but I get error due to the space in the absolute path of the location of the directory.
scp -r -P 8484 [email protected]:/media/New Volume/lj /home/pratheep
I am getting the following error:
scp: /media/New: No such file or... |
You should quote your file name two times, one for the local shell and one for the remote one. In the simplest case you can do one of the following
scp -r -P 8484 [email protected]:"'/media/New Volume/lj'" /home/pratheep
scp -r -P 8484 [email protected]:'"/media/New Volume/lj"' /home/pratheep
or using the help of tab... | Problem in secure copying (scp) filenames with spaces |
1,328,536,983,000 |
I have the misfortune of coming from a MS-DOS background - but at least it makes me appreciate how much more powerful Linux is. I've been working on getting my Linux-Fu up to par, but there are a couple things that could be done with DOS that I'm not sure how to accomplish most easily with Linux:
Renaming Multiple Fil... |
One of the fundamental differences between Windows cmd and POSIX shells is who is responsible for wildcard expansions. Shells do all the expansions required before starting the actual commands you asked for. cmd mostly passes the wildcard patterns to the commands unmodified. (I say mostly, since I think there are exce... | How can I use ms-dos style wildcards with ls and mv? |
1,328,536,983,000 |
Having been directed to initramfs by an answer to my earlier question (thanks!), I've been working on getting initramfs working. I can now boot the kernel and drop to a shell prompt, where I can execute busybox commands, which is awesome.
Here's where I'm stuck-- there are (at least) two methods of generating initramf... |
It's not the kernel that's generating the initramfs, it's cpio. So what you're really looking for is a way to build a cpio archive that contains devices, symbolic links, etc.
Your method 2 uses usr/gen_init_cpio in the kernel source tree to build the cpio archive during the kernel build. That's indeed a good way of bu... | How to generate initramfs image with busybox links? |
1,328,536,983,000 |
The source code in not open or free, so compilation at installation is not an option. So far I have seen developers that:
provide a tar.gz file and it is up to user to uncompress in suitable location.
provide a .tar.gz with an install.sh script to run a basic installer, possibly even prompting user for install optio... |
I see two ways to look at it.
One is to target the most popular Linuxes, providing native packages for each, delivering packages in popularity order. A few years ago, that meant providing RPMs for Red Hat type Linuxes first, then as time permitted rebuilding the source RPM for each less-popular RPM-based Linux. This... | What installer types should commercial software use to support Linux? |
1,328,536,983,000 |
I'm was setting up a QEMU/KVM virtual machine and wanted to use bridge networking for it. In every manual/tutorial I've read it says to disable DHCP on the physical NIC and to enable it on the bridge. What I don't understand is if the bridge acts just like a physical bridge/switch would, why does it have to have an IP... |
Why does a virtual bridge need an IP address when a physical one does not?
It is a misconception that a virtual bridge needs an IP address. It does not need it.
You actually can have a virtual bridge without an IP address. But then the host itself won't be reachable over IP on that physical interface at all: only... | Virtual network bridge: why does it have to have an IP address assigned to it? |
1,328,536,983,000 |
I'm looking for a way to schedule when an external hard drive connected to my Linux (Debian 9) box goes to sleep (stops spinning).
To put this into content: I have a Linux box that runs as a multimedia server. If a call is made to fetch content that is on the external hard drive, it often takes 15-30 seconds for the ... |
A cronjob would allow this:
# At 11pm every day, enable sleep after 30s
0 23 * * * /sbin/hdparm -S6 /dev/disk/by-id/...
# At 5pm on weekdays, disable sleeping
0 17 * * 1-5 /sbin/hdparm -S0 /dev/disk/by-id/...
# At 3pm on the weekend, disable sleeping
0 15 * * 0,6 /sbin/hdparm -S0 /dev/disk/by-id/...
| Is it possible to (7 day) schedule sleep time of a hard drive? |
1,328,536,983,000 |
I've just installed UFW 0.35 on Ubuntu 16.04:
root@localhost:/etc# ufw --version
ufw 0.35
Copyright 2008-2015 Canonical Ltd.
and
root@localhost:/etc# ufw app list
Available applications:
OpenSSH
I would like to allow access to Apache on both port 80 and 443, with the command
$ ufw allow "Apache Full"
but I got a... |
You are likely receiving that error because there has not been a profile created for 'Apache Full'. You can see which profiles exist on your system by checking the directory:
/etc/ufw/applications.d/
To create a profile known as 'Apache Full' create a file in the above directory using the following syntax (from the ... | Allow access to Apache on both port 80 and 443 in Ubuntu 16.04 |
1,328,536,983,000 |
I'm using Awesome Windows Manager and two display (LVDS-1 as the secondary display in left and HDMI-1 as the main display in right). Awesome, by default duplicates screens and I want to switch focus on my display using the keyboard. It's now possible by moving the mouse cursor to each monitor.
Are there any hotkey com... |
Yes there should be.
Try Mod+Ctrl+j to focus the next screen.
Then Mod+Ctrl+k should focus the previous screen.
| Switch between monitors with dual display state [awesome wm] |
1,328,536,983,000 |
I have noticed that doing a service restart with something like:
service sshd restart
is very similar to doing something like:
pkill -HUP sshd
However the pkill would close my ssh session where the service restart would leave it open. This lead to my question and that is does a service restart send a true HUP like t... |
From sshd(8):
specified in the configuration file. sshd rereads its configuration file
when it receives a hangup signal, SIGHUP, by executing itself with the
The difference between a service script and an indiscriminate pkill -HUP sshd as root is that the service script will only target the main sshd process, whil... | Does a service restart send a HUP? |
1,328,536,983,000 |
I am using some custom Linux distribution without any UI. I would like to find out the Bluez version through the command-line. How can this be done?
|
If you have a rough idea (or are fine with covering the last 10 years), bluez provides tools in bluez-uils to request the version. Unfortunately, these tools changed between version 4 and 5, so you may have to check if one of both is installed.
For BlueZ 4.0:
bluetoothd --version
Since BlueZ 5.0, there is a new comma... | How to find out Bluez version from command line? |
1,328,536,983,000 |
Given this:
echo AAA | sed -r 's/A/echo B/ge'
I get this:
Becho Becho B
I would have thought I would get "BBB". This is with GNU sed version 4.2.1. What is going on, and how can I use the execute flag, and have multiple replacements can occur on one line (from the shell, not from perl et al)?
|
The flags work together in the opposite way to what you're expecting. The documentation of /e is, for the record:
This command allows one to pipe input from a shell command into pattern space. If a substitution was made, the command that is found in pattern space is executed and pattern space is replaced with its out... | sed "e" and "g" flags not working together |
1,328,536,983,000 |
can anyone give me a basic explanation on what are NSS , LDAP and PAM and what they used for and what is their relationship/differences ?
|
LDAP is a directory service (a type of database) along with a protocol that describes what information is stored, how to search it, etc. All kinds of things can be stored there, but in this case it'd be Unix user and group info. Very loosely, an alternative to /etc/passwd, /etc/shadow, /etc/group, and /etc/gshadow. Or... | basic explanation on NSS , LDAP and PAM |
1,328,536,983,000 |
I am trying to implement socket programming in C.
When I try to connect from a client to a server (Ubuntu), it shows an error like "connection failed".
So I think the problem is with the port. I am using the 5454/tcp port for socket programming.
How can I know if 5454 port is listening or not?
If it is not, then whic... |
Since you are programming in C I thought of posting a little snippet which shows you if the port is open or not, I have programmed to output a string. You can easily change it to fit your need.
Answer to your second question, like everyone here said, you can pretty much use any port if you are the super user (root) on... | How can I tell if a TCP port is open or not? [closed] |
1,328,536,983,000 |
I want to know if there is a way to listen to a process in Linux & unix - when it ends and what's the exit code of the process(script).
I don't want to write a script that will run X seconds and check by ps -ef | grep PID if the process is still alive. I want to know if there is a way that the process will notify me w... |
Bash does this for you. It will notify you when the process ends by giving you back control and it will store the exit status in the special variable $?. It look roughly like this:
someprocess
echo $?
See the bash manual about special parameters for more information.
But I asume that you want to do other work while w... | Is there a way to listen to process? |
1,328,536,983,000 |
When running (on linux different ubuntu variations):
>ln -s dir_1 symlink_dir
>ln -s dir_2 symlink_dir
It fails without telling that it fails. But if you do the same thing on a file instead or, add v to the option it does tell you that it fails:
>ln -s file_1 symlinkg_file
>ln -s file_2 symlinkg_file
or
>ln -sv dir_... |
Because in the second ln it doesn't fail it creates a
symlink_dir/dir_2 -> dir_2
symbolic link
Do a:
ls -l symlink_dir/dir_2
And you'll see a (probably broken) symlink there.
That's how ln is meant to work if the target is a directory (or a symlink to a directory).
A third ln could fail because there's already a di... | Why doesn't ln -s tell that it fails when creating a symlink to an existing symlinked directory? |
1,328,536,983,000 |
On Ubuntu 10.04 I've used apt-get install pip to install pip after which I installed django. Then I tried to uninstall django with pip via pip uninstall django which gives me:
pip: error: No command by the name pip uninstall
From doing some research that is because I'm using an older version.
$pip --version
pip 0.3.1... |
Remove your system wide installation of pip:
sudo apt-get purge python-pip
Then install a fresh copy of pip:
curl https://bootstrap.pypa.io/get-pip.py | sudo python
Tested on ubuntu 10.04 i686
I suggest you to use virtualenv. For further details see the Official pip documentation
| How can I upgrade pip on Ubuntu 10.04? |
1,328,536,983,000 |
I have created an 200MB ext3 using the following commands.
dd if=/dev/zero of=./system.img bs=1000000 count=200
mkfs.ext2 ./system.img
tune2fs -j ./system.img
How can I resize it to 50MB and 300MB? The problem is I have only some binaries in my system. They are : badblocks,e2fsck, mke2fs, mke2fs.bin, parted, resize2f... |
First, run a filesystem check, e2fsck -f ./system.img. Without this, it may proceed to enlarge the raw file, but fail to make any meaningful changes to the filesystem.
To reduce the size of the file system:
resize2fs ./system.img 50M
To enlarge:
resize2fs ./system.img 300M
resize2fs automatically adjusts the file si... | How to resize ext3 image files |
1,328,536,983,000 |
We're running four computers connected to a hub (yes a hub not a switch) on Fedora 13. They were installed using images from a colleague that has recently left us to go back to school, they may have been set to somehow block the use of the broadcast, but we'd like to continue using this image. We've setup the static I... |
echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts - as root.
You may need to also use the -b option with ping and it will most likely require root permissions.
| Can't ping broadcast |
1,328,536,983,000 |
Does linux kernel make use of virtual memory for its data structures (page tables, descriptors, etc.)? More specifically:
Are kernel space addresses translated in the MMU (pagetable walking)?
Could kernel memory get swapped out?
Could a memory access to a kernel data structure cause a page fault?
Are there differences... |
Are kernel space addresses translated in the MMU (pagetable walking)?
Yes, all addresses are translated in the MMU; see Is the MMU inside of Unix/Linux kernel? or just in a hardware device with its own memory? for details.
Could kernel memory get swapped out?
A kernel could theoretically be designed so that it can... | Does linux kernel use virtual memory (for its data)? |
1,328,536,983,000 |
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 values of other processes. By default, the
superuser possesses all capabilities and nonroot possesses none. For
exam... |
This is done via an authorization manager called polkit:
polkit provides an authorization API intended to be used by privileged
programs (“MECHANISMS”) offering service to unprivileged programs
(“SUBJECTS”) often through some form of inter-process communication
mechanism.
With systemd and polkit users with non... | How does gnome reboot without root privileges? |
1,328,536,983,000 |
While running Postfix on an Ubuntu, I have acquired a number of test email in an account usr1, and now I want to delete them before starting other testing. However, every time I try to delete using both d # and 'delete #`, nothing happens.
Example:
usr1@usr1:~$ mail
"/var/mail/usr1": 5 messages 5 unread
>U 1 u... |
After much digging, I realized that the problem was that I always exited from mail using either exit or x. From the Ubuntu man page:
exit (ex or x) Effects an immediate return to the shell without modifying
the user's system mailbox, his mbox file, or his edit
file in -f.
So if you're t... | Can't delete system email |
1,328,536,983,000 |
I need to create compressed archives of files, and be able to quickly extract individual files/directories from them.
The problem is, for example, tar.bz2 seems to be not the best choice for such task - extracting single 4kb file out of 200Mb archive (50000 files) takes 17 seconds on my machine.
Is there some archive ... |
The Zip format compresses each file separately, and then combines them (with a directory of archive contents) into a single archive file.
| Indexed archive format? |
1,328,536,983,000 |
I just to want to know the flow of activities happening after loading the linux kernel image into the RAM after boot process.
|
As of Linux 2.6:
Kernel
After loaded into RAM, the kernel executes the following functions.
setup():
Build a table in RAM describing the layout of the physical memory.
Set keyboard repeat delay and rate.
Initialize the video adapter card.
Initialize the disk controller with hard disk parameters.
Check for IBM Micro C... | What happens after loading the linux kernel image into RAM |
1,328,536,983,000 |
What does at sign (@) mean in interface name in output of "ip address" command (or the "ip link" command) on Ubuntu, for example interface name "eth0@if44" in the following output:
root@aafa1fc24a0b:/# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback... |
This represents the link's peer interface index. Although this property appears to be available for any interface, it makes sense for only a few interface types : veth, macvlan, vlan (sub-interface), ... because they have a relation to an other interface.
Any given interface has an index that can be read for example t... | What does "if1@if2" mean in interface name in output of "ip address" command on Ubuntu |
1,328,536,983,000 |
My troubleshooting ability in Linux is not impressive, just so you know. I can follow instructions very well on the other hand. I have a Linux server with Linux raid. It was working well with no problems for about half a year but then I had a power failure and have been getting the same problem ever since. After rebui... |
The service was not starting because it was masked. here is how I found how to unmask it. the next problem was the mdadm-raid service was not starting the raid. this was how I got the raid to start on boot. Look down to "Mon Jul 31, 2017 7:49 pm" to find the relevant post. This may not be the best solution but after 1... | Linux raid disappears after reboot |
1,328,536,983,000 |
According to cve.mitre.org, the Linux kernel before 4.7 is vulnerable to “Off-path” TCP exploits
Description
net/ipv4/tcp_input.c in the Linux kernel before 4.7 does not properly determine the rate of challenge ACK segments, which makes it easier for man-in-the-middle attackers to hijack TCP sessions via a blind in-... |
According to LWN there is a mitigation which can be used while you do not have a patched kernel:
there is a mitigation available in the form of the
tcp_challenge_ack_limit sysctl knob. Setting that value
to something enormous (e.g. 999999999) will make it
much harder for attackers to exploit the flaw.
You shou... | How do I protect my system against the Off-path TCP exploit in Linux? |
1,328,536,983,000 |
For the purpose of backups, I'd like to transfer (several) whole disk partitions over an ssh link. The source is a block special device and the target should be a regular file. Common tools seem ill-suited for this, though:
scp will complain not a regular file
tar will try to recreate device inodes on the target side... |
You could pipe through SSH. Example using dd:
dd bs=1M if=/dev/disk | ssh -C target dd bs=1M of=disk.img
If the network connection breaks during transfer, you can resume if you know how much was copied. For example if you're sure at least 1000MiB were transferred already (check the file size of disk.img):
dd bs=1M sk... | Transferring content of block devices |
1,328,536,983,000 |
I have bash script which was written for OS X and now ported to Linux. I don't have access to the Linux box. The bash script would read values from plist files using the defaults read and PlistBuddy command available on OS X.
Since the Linux machine doesn't have these commands, I'm looking for workarounds. Is there l... |
Since .plist files are already XML (or can be easily converted) you just need something to decode the XML.
For that use xml2:
$ cat com.apple.systemsound.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1... | Fetch values from plist file on Linux |
1,328,536,983,000 |
I'm creating a live-USB and don't understand precisely: what happens when I copy a file (or even a file system) directly to a device node (as opposed to a file system)?
|
The shell will open the device /dev/sdX. All output of the cat command, which ends up being the contents of debian.iso, is written directly to that device.
The end result is that debian.iso is written byte-for-byte to the start of the disk underlying /dev/sdX.
In effect, the device node makes it appear that the low-l... | What happens when I do "cat debian.iso > /dev/sdX"? |
1,328,536,983,000 |
I have an old laptop here with only 512 MB of RAM. Since a few kernel releases, I am using zram to convert 256 MB of it to a compressed ramdisk which is then used as swap. This has proved to be very successful and the system is much more responsive, (hard-disk-backed) swap usage has gone down considerably, which slowe... |
Zram creates a block device backed by compressed ram. You can use that block device for swap. Normally memory pressure first results in the cache being discarded, and only after most of the cache has been freed up and memory is still tight does the system start swapping.
CleanCache allows pages from the page cache t... | Cleancache vs zram? |
1,328,536,983,000 |
I have received a file of .bak format, let it be foo.bak. I don't know if it is a MS-DOS file or Linux/Unix file. What I know is that I can't open it because my Linux (Ubuntu) does not give any hint how to open it.
So, how I open this file?
Just to omit warnings about not knowing what I am doing:
Disclaimer: I receive... |
.bak generally designates that the file is a backup copy of something, but other than that it gives preciously little information as to the actual file type.
Try looking at the output of the file command, which studies the first few bits of the file to see if it recognizes it as a known filetype:
caleburn: ~/ >file im... | How do I open a .bak file on Linux? |
1,328,536,983,000 |
I am using Linux 5.15 with Ubuntu 22.04.
I have a process that uses a lot of memory. It requires more memory than I have RAM in my machine. The first time that I ran it, it was killed by the OOM Killer. I understand this: the system ran out of memory, the OOM Killer was triggered, my process was killed. This makes sen... |
First of all, I'd like to thank MC68020 for taking the time to look into this for me. As it happens, their answer didn't include what was really happening in this situation - but they got the bounty anyway as it's a great answer and a helpful reference for the future.
I'd also like to thank Philip Couling for his answ... | Why do processes on Linux crash if they use a lot of memory, yet still less than the amount of swap space available? |
1,328,536,983,000 |
I have a system with 8 x 16 GB DIMMs, so 128 GB total.
However, the MemTotal reported by /proc/meminfo is 131927808 kB, so 131 GB
My research suggests that if anything, the meminfo should add up up to less than the RAM total.
Understanding /proc/meminfo file (Analyzing Memory utilization in Linux)
So Google's calculat... |
Memory capacity in DIMMs is measured in powers of two, so a claimed RAM capacity of “128 giga-something” is 128 GiB which is 134,217,728 kiB. /proc/meminfo also measures memory in powers of two, so the MemTotal value of 131,927,808 can be compared with 134,217,728 and is safely less.
MemTotal is the total installed ph... | Discrepancy between physical RAM and /proc/meminfo |
1,328,536,983,000 |
I accidentally enabled SELINUX and reboot the system without knowing it's consequence. Now, I can't access the login system in my CENTOS 7 unit.
What I've tried so far:
https://serverfault.com/questions/501304/disable-selinux-permanently
kernel /boot/vmlinuz-2.6.32-358.2.1.el6.x86_64 ro root=/dev/xvda1 rd_NO_LUKS rd_N... |
I thought I need to type the information on the source in grub. What I did is very simple,
I just type Ctrl+X then add selinux=0 on the edited selected kernel version. Spent hours
looking for solution and exploring at boot loader to edit grub.cfg. Sorry I'm a newbie to not thinking that the selinux=0 will just add in ... | How to disable SELINUX using grub? |
1,328,536,983,000 |
I'm trying to remove this dkms module but am running into trouble.
I run
sudo dkms uninstall rtl8812au/4.3.14
and I get
Error! The module/version combo: rtl8812au-4.3.14
is not located in the DKMS tree.
However, when I run dkms status, I get
8188eu, 1.0, 4.13.0-26-generic, x86_64: installed
bcmwl, 6.30.223.271+bdc... |
In case of normal operations gone wrong, you can always delete dkms add-ons by hand, with sudo or as root.
Normally the modules sources are installed by make install under /var/lib/dkms/ in a directory with the corresponding name, probably named rtl...something. Just delete that directory.
You have also to delete the... | why can I not remove this dkms module? |
1,328,536,983,000 |
There is a directory under /tmp with the name test_copy.
$ ls /tmp/test_copy/
a.sh b.sh
$ cd /tmp
/tmp$ find . -name test_copy
./test_copy
But if I run the following find command it does not return anything.
~/scripts$ find /tmp -name test_copy
~/scripts$
Why can't find find the directory in the last ... |
If /tmp is a symbolic link, find won't enter the directory and will just stop, finding nothing.
On the other hand, any of the following commands will work:
find -H /tmp -name test_copy
find /tmp/ -name test_copy
(the ending / dereferences the symlink)
| Why doesn't find command find the directory when run from ~? |
1,328,536,983,000 |
The process I'm running sometimes generates core file, and that file has following file permissions:
server:~ # ls -l /mnt/process/core/core_segfault
-rw------- 1 root root 245760 Dec 2 11:29 /mnt/process/core/core_segfault
The issue is that only root user can open it for investigation, while I'd like everyone with... |
Since core files contain the complete memory layout of the process at the time it crashed, they may contain sensitive information. For this reason, core files are created with ownership set to the uid of the process at the time of its crash, and permissions set rather restrictive. There is no setting to change that ea... | How to set default core file permissions |
1,328,536,983,000 |
something like
sudo apt build-dep apache
Supposedly installs all the dependencies needed to build apache from source (I've never used it before).
Is there an equivalent command for the dnf package manager?
|
There is, it's
sudo dnf builddep httpd
builddep is a dnf plugin, so it's not documented in the dnf manpage. It is described in the DNF plugin documentation, and it has its own manpage, dnf.plugin.builddep(8).
| Does dnf have an equivalent to apt's "build-dep" |
1,328,536,983,000 |
I have two g++ programs located at /usr/local/bin/ and /usr/bin/
I would like to have the default g++ to be in /usr/local/bin/. However, I do not want to change my PATH environment variable because for some other program. I would prefer the version in /usr/bin/ than that in /usr/local/bin/. Is this possible?
To make m... |
Option 1: Make an override folder on your path
If you need these programs to be called in indirect ways (like by some application started by the window manager will call g++ or python, for instance), you should edit your path. You could simply add a new folder to the beginning of your path in your ~/.bashrc:
export P... | Change the default directory of one specific program without changing its path |
1,328,536,983,000 |
Is it possible to disable the behavior which causes selecting a pane on opposite side of a tmux window if there are no more panes left in a direction select-pane command was originally triggered at?
If not, is there a way how to determine if any other panes exist in a specific direction?
If a tmux window doesn't have ... |
Add this to your ~/.tmux.conf:
set-option -g default-shell /bin/bash
unbind Up
unbind Down
unbind Right
unbind Left
bind Up run-shell "if [ $(tmux display-message -p '#{pane_at_top}') -ne 1 ]; then tmux select-pane -U; fi"
bind Down run-shell "if [ $(tmux display-message -p '#{pane_at_bottom}') -ne 1 ] ; ... | tmux select-pane -LDUR command - disable auto-cycling behavior |
1,328,536,983,000 |
I can't find a way to toggle mc internal editor in hex mode. Here it says to use F4 however it suggest to replace. How to do it?
|
You can open file with F3.
Hex view - F4.
Start edit - F2.
| Midnight Commander - editor in hex mode |
1,328,536,983,000 |
I am looking for description of following terms:
HardwareCorrupted, DirectMap4k, DirectMap2M fields in "/proc/meminfo" file of Linux.
I could find the following description for the fields from "Free", "buffer", "swap", "dirty" /proc/meminfo Explained:
HardwareCorrupted: ECC at it's finest
DirectMap* : This is x86 s... |
HardwareCorrupted show the amount of memory in "poisoned pages", i.e. memory which has failed (as flagged by ECC typically). ECC stands for "Error Correcting Code". ECC memory is capable of correcting small errors and detecting larger ones; on typical PCs with non-ECC memory, memory errors go undetected. If an uncorre... | what does mean by HardwareCorrupted, DirectMap4k, DirectMap2M fields in “/proc/meminfo” file of Linux? |
1,328,536,983,000 |
I have a virtual box running with CentOS.
I have attached a new virtual disk to the existing CentOS VM and I'm now trying to install GRUB on this newly attached disk.
Later, I will bring up a second VM with a newly prepared bootable hard disk with a custom root filesystem and kernel.
I have tried the following steps:
... |
I'm not a grub2 expert (sorry) but try adding --skip-fs-probe to your grub-install line, I have found this prevents creation of /boot/grub/device.map which can cause booting to a grub prompt. I think that without this parameter grub-install, instead of doing what you tell it, thinks it is cleverer than you, and may do... | How to install GRUB on a new drive? |
1,328,536,983,000 |
I have an application server which we start by running this below command and as soon as we run the below commnad, it will start my application server
/opt/data/bin/test_start_stop.sh start
And to stop my application server, we do it like this -
/opt/data/bin/test_start_stop.sh stop
So as soon as my application se... |
First of all; "kill -9" should be a last resort.
You can use the kill command to send different signals to a process. The default signal sent by kill is 15 (called SIGTERM). Processes usually catch this signal, clean up and then exit. When you send the SIGKILL signal (-9) a process has no choice but to exit immediatel... | How to get the pid of a process and invoke kill -9 on it in the shell script? [duplicate] |
1,339,116,601,000 |
Using the who command, I can find which users are currently logged into a machine.
I would like to determine which users have logged into my machine in the past, and the length of those sessions. Is this information retained, and can I access it?
The particular machine I'm thinking of is running Ubuntu 10.10.
|
You can use the last command for this. It will tell you who logged in, what port/tty, date, time and duration of the session.
Here is the man page
FWIW, every installation of Ubuntu I've had, had this command available.
| Is it possible to find times of past user sessions? |
1,339,116,601,000 |
Under some answers, I see comments that recommend avoiding shell specific commands in answers.
How do I know which commands, operators, etc exist in all shells? Is there a list of standards?
man builtins gives a list of commands. Are those the only commands that I can use in a portable shell script
that works in all ... |
Greg's Wiki has a post on adapting bash scripts for Dash that points out a lot of 'bashisms' - extra features that are non-standard but are a part of bash. Avoiding those bashisms can help to make your script friendlier to different environments. This particularly answers some of your questions. For instance, yes, the... | What is not shell specific? |
1,339,116,601,000 |
I am having a 5.10.0-11-cloud-amd64 kernel and have installed 5.10.0-12-amd64 kernel on Debian 11.2. I want to set 5.10.0-12-amd64 as the default kernel temporarily.I am new to Grub, How to set the default kernel as 5.10.0-12-amd64?
My /lib/modules:
5.10.0-10-cloud-amd64 5.10.0-11-cloud-amd64 5.10.0-12-cloud-amd64... |
First, check /etc/default/grub. There should be a GRUB_DEFAULT= variable in it. If it is set to GRUB_DEFAULT=0 or unset, the default will be to boot the first entry in the boot menu (entry #0). If it is set to anything other than GRUB_DEFAULT=saved, the only way to reliably change the default will be to edit GRUB_DEFA... | How to set default kernel in Debian? |
1,339,116,601,000 |
we would like to understand copytruncate before rotating the file using logrotate with below configuration:
/app/syslog-ng/custom/output/all_devices.log {
size 200M
copytruncate
dateext
dateformat -%Y%m%d-%s
rotate 365
sharedscripts
compress
postrotate
/app/syslog-ng/sbin/syslog-ng-ctl reload
endscript
... |
Truncating a logfile actually works because the writers open the files for writing using O_APPEND.
From the open(2) man page:
O_APPEND: The file is opened in append mode. Before each write(2), the
file offset is positioned at the end of the file, as if with lseek(2).
The modification of the file offset and the wr... | How copytruncate actually works? |
1,339,116,601,000 |
If /dev is suppose to list all the devices that is connected, like usb, hdd, webcam, how come on my ubuntu 15 VM I don't see a monitor? I am running the desktop edition so there should be a monitor.
Or maybe it is named something different?
|
Device files on Unix systems in general are just one way for user programs to access device drivers; there isn't a one-to-one mapping from devices files to physical hardware, and not all hardware has a device file (or even a device driver). The kernel itself doesn't use device files to interact with hardware.
As point... | why isn't monitor listed under /dev in linux? |
1,339,116,601,000 |
I came across a linux kernel tutorial and there they talked about 4 pairs of identifiers and one of them was file system uid and gid.
Could someone explain me what it is and how it is different from uid and gid?
|
Who would have thought that this question would drag out such a collection of overconfident and underinformed responses!
The file system uid or fsuid is a Linux feature designed to help the NFS server implementation. It is an extra (non-POSIX) uid which is used only for file permission checks. For any process that doe... | file system uid and gid in linux |
1,339,116,601,000 |
I've written a Python CGI script that invokes bash commands, and it needs to test for a successful login on the host.
How do I write a test for that?
For example, could I create a bash script that tests a given username and password combination against the registered user on the host?
|
Using PAM is the best solution. You can write small C code, or install python-pam package and use a python script which comes with the python-pam package. See /usr/share/doc/python-pam/examples/pamtest.py
| How do I write a test for system login? |
1,339,116,601,000 |
Where can I find a technical description of the kernel parameters listed in /proc/sys (ob Linux)?
|
The directory /proc/sys gives easy access to sysctl settings through the shell. You can read and write these settings either by reading and writing these files, or by calling the sysctl utility or the underlying sysctl system call.
The various settings are described in the kernel documentation, in Documentation/sysctl... | Where are the Linux kernel parameters present in /proc/sys documented? |
1,339,116,601,000 |
I ask this question because I'm curious as to whether there is some sort of performance advantage offered from the binary blobs that are in the Linux kernel.
Since many of these blobs have been replaced with code in linux-libre, why has that same code not been incorporated into the Linux kernel at kernel.org?
|
The Linux-libre project is an extension of efforts by distributions aimed at people who wish to use completely free operating systems, as defined by the Free Software Foundation.
Currently it is maintained by FSFLA, the Latin American Free software Foundation.
According to the about page for the project:
Linux-li... | Why does the linux kernel use linux-libre code to get rid of binary blobs? |
1,339,116,601,000 |
Booting from a kernel which I recompiled with a custom .config, I got the the following kmsg(ie. dmesg) message:
systemd[1]: File /usr/lib/systemd/system/systemd-journald.service:35 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
systemd[1]: Proceedi... |
First enable CONFIG_BPF_SYSCALL=y
┌── Enable bpf() system call ─────────────────────────────────┐
│ │
│ CONFIG_BPF_SYSCALL: │
│ │
│ Enable the bpf() system ca... | How to fix "File" *.service "configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling"? |
1,339,116,601,000 |
I am building a system which has the functions of an online judge system. I need to run all the executables and evaluate their output. The problem is that if all of them will be placed in a container, in different folders one of the application may try to exit it's folder and access another folder belonging to another... |
I have not read anything in the description of your problem that would prevent you from creating different user accounts for the applications. You can then use trivial file permissions for preventing interference:
chown app1 /var/lib/myapps/app1
chmod 700 /var/lib/myapps/app1
sudo -u app1 /var/lib/myapps/app1/run.sh
... | Linux - Isolate process without containers |
1,339,116,601,000 |
or it is the only way to enable forwarding for IPv6?
/proc/sys/net/ipv6/conf# grep '' */forwarding
all/forwarding:0
default/forwarding:1
eth0/forwarding:1
lo/forwarding:1
nat64/forwarding:1
tunl0/forwarding:1
veth_cm/forwarding:1
wifi0/forwarding:1
wlan0/forwarding:1
Does not route. I see packets in Wireshark, but th... |
Looks like indeed it is designed to work differently compared to IPv4's */forwarding and all/forwarding:
From https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt:
conf/all/forwarding - BOOLEAN
Enable global IPv6 forwarding between all interfaces.
IPv4 and IPv6 work differently here; e.g. netfilt... | Is net.ipv6.conf.all.forwarding=1 equivalent to enabling forwarding for all individual interfaces? |
1,339,116,601,000 |
Use case: I have a home router using iptables today. I'm researching converting over to nftables, as it looks to be much more manageable for a lot of rules.
One thing I have setup today under iptables is a 'country-block' ipset which contains country CIDR blocks that covers the majority of random port probe/hack attem... |
I received a response from the nftables developers after asking on their mail list. The short answer is that referencing sets in another table is not possible.
However, I was at least able to store my sets in a separate file and bring them in via an @include. This makes my ipsets more manageable instead of having to p... | nftables ip set multiple tables |
1,339,116,601,000 |
I have multiple .png files (for example: pic_001.png, pic_002.png... pic_200.png). These are basically separate pages of the book.
I want to create a single printing job, that will print 2 such pictures per one physical page, so it would look like a usual book spread.
I've tried to do this like this:
lp pic_001.png pi... |
Rather than use lp directly, you could try using imageMagick, to make one image out of two or more images, and then print them
convert image1.png image2.png image3.pgn -append output.png
will put the images one above the other. If you replace -append by +append, the images will be side-by-side instead.
| Printing multiple separate pictures on one physical paper page with terminal |
1,339,116,601,000 |
This is what happens when i run lsmod on an arm board (banana pi) running on kernel 4.3.0
# lsmod
Module Size Used by
async_raid6_recov 1434 -2
async_pq 5548 -2
async_xor 3771 -2
async_memcpy 1665 -2
sha512_generic 8213 -2
rsa_generic ... |
In your kernel configuration (make config, make menuconfig etc.) you need to enable CONFIG_MODULE_UNLOAD:
When CONFIG_MODULE_UNLOAD is set, the kernel counts references, as you may only unload a module if there are no references to it.
When CONFIG_MODULE_UNLOAD is not set, then the kernel has no need to count how man... | lsmod shows -2 in the “Used by” column |
1,339,116,601,000 |
I'm running OpenMediaVault which is a Debian based Linux distribution and the file command is missing.
Is there any way to install it?
|
On a Debian systems file can be installed with:
sudo apt-get install file
| Missing file command? |
1,339,116,601,000 |
I have Ubuntu 12.04 as the NFS server. The clients are Linux. My /etc/exports file has 1 line,
/folderToExport *(rw,async,no_subtree_check)
/etc/init.d/nfs-kernel-server status shows that the NFS share is working as expected. The problem is that whenever I attempt to mount the NFS share from another Linux host, s... |
statd is part of the package nfs-common. You could probably find that yourself with locate statd which gives you among others /etc/init.d/statd.
You can start statd with:
service statd start
But it should normally have started on system boot but maybe there is something else going wrong. You should check your log fi... | mount Linux NFS. rpc.statd is not running |
1,339,116,601,000 |
First, some background:
/dev/md1 is a RAID-0 array serving as primary file store. It is mounted to /var/smb.
/dev/md2 is another RAID-0 array storing backup snapshots taken from /dev/md1. It is mounted to /var/smb/snapshots.
Three directories are made available via Samba: /var/smb/files (publicly-shared files), /var/... |
This answer works on Debian (tested on lenny and squeeze). After investigation, it seems to work only thanks to a Debian patch; users of other distributions such as Ubuntu may be out of luck.
You can use mount --bind. Mount the “real” filesystem under a directory that's not publicly accessible. Make a read-only bind m... | Make all files under a directory read-only without changing permissions? |
1,339,116,601,000 |
What is the difference between Copied context output format and Unified context output format when taking a diff?
diff -NBur dir1/ dir2/
diff -NBcr dir1/ dir2/
|
Apparently you've misread the manual. The -u flag is for unified context, not Unicode and -c is for copied context, not 'Context format':
-c -C NUM --context[=NUM]
Output NUM (default 3) lines of copied context.
-u -U NUM --unified[=NUM]
Output NUM (default 3) lines of unified context.... | What is the difference between Copied context output format and Unified context output format while taking diff? |
1,339,116,601,000 |
I have written one driver for one device in Linux. How can I create (using gcc) a .ko file so that I can insert it into the kernel?
|
Create a Makefile like this.
ifneq ($(KERNELRELEASE),)
obj-m := mymodule.o
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
install:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
%:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD... | How to create .ko files in Linux |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.