date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,301,414,593,000 |
How can I pipe any data to audio output? For example, i want to listen to a file -- an archive, a drive backup, a program. Or I want to listen to my HDD -- I vaguely remember reading something about this being possible about 7 years ago, but can't find anything now.
So, files, disk reads, even network connections -- ... |
I find piping things into aplay works well.
journalctl | aplay doesn't sound pretty but does work surprisingly well.
Here's an example from aplay(1):
aplay -c 1 -t raw -r 22050 -f mu_law foobar
will play the raw file "foobar" as a 22050-Hz, mono, 8-bit, Mu-Law .au file.
It can be found as part of the ... | How to pipe anything to the audio output? |
1,301,414,593,000 |
I'm basically asking about user management from the command line (e.g. on a system where there are no graphical tools available). In the past I've used several different programs to add or delete users and groups or to modify their attributes: adduser, useradd, usermod, gpasswd, and perhaps others I've forgotten. I've... |
Sadly, none of those operations were ever standardized.
Some operating systems offer this functionality as part of the OS, like Linux, but even if your Linux system includes them, over time and across Linux distributions the tools and their names changed so you can not really depend on a standard set of tools to do th... | What is/are the standard CLI program(s) to manage users and groups? |
1,301,414,593,000 |
I have 2 servers, Server1 and Server2. On Server1 I have a user named user1. On Server2 I have the user named user2.
I need to be able to write a script that runs on Server1, which will scp some files to user2@Server2. Is there any way to do this without prompting for a password? I can put the password in a config... |
What you want are ssh-key pairs, these create 'trusted networks' that allow for password-less authentication:
On your client (server1):
[user@server1]# ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): # Hit Enter
Enter passphrase (empty for no p... | SCP without password prompt using different username [duplicate] |
1,301,414,593,000 |
I use this
sleep 900; <command>
on my shell. Just wanted to know is there is some alternate/better way that you use?
|
You are searching for at (at@wikipedia)?
usr@srv % at now + 15 min
at> YOUR COMMAND HERE
You can define multiple commands that should be executed in 15 min; separate them with a return.
Confirm all commands with control+d.
| What is a good way of saying "run this after 15 minutes" on a shell? |
1,301,414,593,000 |
When installing Ubuntu for the first time, I separated / and home into different partitions. Thinking back on it, how is this possible?
Isn't home "in" /.
|
You might want to read the manual page entry for the mount command: https://www.man7.org/linux/man-pages/man8/mount.8.html
All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices.
The file hierarchy is a way of logically ... | How is it possible to have / and /home on different partitions |
1,301,414,593,000 |
to copy contents from a folder i've read , the use is:
cp -rfva ../foldersource/. ./
but this works too
cp -rfva ../foldersource/* ./
is there any difference?
by example if i want to delete a content from a folder with . :
rm -rf ../foldersource/.
i get the error:
rm: rejet delete folder '.' or '..':
but with as... |
There is a fundamental difference between these two argument forms. And it's an important one to understand what is happening.
With ../foldersource/. the argument is passed unchanged to the command, whether it's cp or rm or something else. It's up to the command whether that trailing dot has special or unique semantic... | difference copy contents folder between /. and /* in linux |
1,301,414,593,000 |
How does one find out the true number of processes that is running on your system? A number of articles mention using ps in order to count the number of processes. But recently I looked at cat /proc/stat, and it outputted:
cpu 972 0 1894 189609 236 26 490 0 0 0
cpu0 972 0 1894 189609 236 26 490 0 0 0
intr 101595 157 ... |
Look at the documentation for proc(5), and you'll see this for the processes field:
Number of forks since boot.
So it's simply not the number you're looking for. ps will give you that as you already know, counting the directories with only numbers in their name under /proc is another approach.
| Using /proc/stat for the number of processes running on the system |
1,301,414,593,000 |
I'm trying to run a command, write that to a file, and then I'm using that file for something else.
The gist of what I need is:
myAPICommand.exe parameters > myFile.txt
The problem is that myAPICommand.exe fails a lot. I attempt to fix some of the problems and rerun, but I get hit with "cannot overwrite existing file... |
You must have "noclobber" set, check the following example:
$ echo 1 > 1 # create file
$ cat 1
1
$ echo 2 > 1 # overwrite file
$ cat 1
2
$ set -o noclobber
$ echo 3 > 1 # file is now protected from accidental overwrite
bash: 1: cannot overwrite existing file
$ cat 1
2
$ echo 3 >| 1 # temporary allow overwrite
$ ca... | How can I output a command to a file, without getting a blank file on error? |
1,301,414,593,000 |
The echo in coreutils seems to be ubiquitous, but not every system will have it in the same place (usually /bin/echo). What's the safest way to invoke this echo without knowing where it is?
I'm comfortable with the command failing if the coreutils echo binary doesn't exist on the system -- that's better than echo'ing ... |
Note that coreutils is a software bundle developed by the GNU project to provide a set of Unix basic utilities to GNU systems. You'll only find coreutils echo out of the box on GNU systems (Debian, trisquel, Cygwin, Fedora, CentOS...). On other systems, you'll find a different (generally with different behaviour as ec... | What's the safest, most portable way to invoke the echo binary? |
1,301,414,593,000 |
I always have /proc/sys/kernel/panic set up to 0. Looking at description of this option in kernel.org we can see:
panic:
The value in this file represents the number of seconds the kernel
waits before rebooting on a panic. When you use the software watchdog,
the recommended setting is 60.
From here one can concl... |
The authoritative source is the implementation in the kernel, so let’s look at that first.
The panic entry in sysctl corresponds to a kernel variable called panic_timeout. This is a signed integer, used to control behaviour on panic as follows:
if panic_timeout is strictly positive, the kernel waits after a panic, fo... | Linux Kernel.org misleading about kernel panic /proc/sys/kernel/panic |
1,301,414,593,000 |
I downloaded a torrent file http://cdimage.debian.org/cdimage/stretch_di_rc1/amd64/bt-cd/debian-stretch-DI-rc1-amd64-netinst.iso.torrent
Now I want to parse/read it so that I can find out things like -
a. Which software was used to create the torrent file ?
b. The size of the iso image, the size and number of pieces ... |
transmission has a tool for that
$ transmission-show debian-stretch-DI-rc1-amd64-netinst.iso.torrent
Name: debian-stretch-DI-rc1-amd64-netinst.iso
File: debian-stretch-DI-rc1-amd64-netinst.iso.torrent
GENERAL
Name: debian-stretch-DI-rc1-amd64-netinst.iso
Hash: 13d51b233d37965a7137dd65858d73c5a2e7ded4
Created ... | Is there a CLI tool to parse/read and show the metadata from a torrent file? |
1,301,414,593,000 |
If I install an application in Linux for example Debian/Gnu Linux, the files of the applications are copied to many different directories in the file system.
Some scripts goes into /usr/share .. /usr/local some other files into /var .. /log .. etc/ and so on.
For me this is o.k because I learned something about the fi... |
What seems to me the easiest-to-think-of advantage is that similar files live in the same directory tree. Configuration files live in /etc, log files and/or run-time trace files live in /var/log, executables live in /usr/bin, run-time information like PID files lives in /var/run. You want to know what's in the NTP c... | What are the advantages of the Unix file system structure |
1,301,414,593,000 |
Ref: The following question
Drive name? What is the correct term for the "sda" part of "/dev/sda"?
Given:
I have a system, (in this case a Raspberry Pi, but this could be relevant to any 'nix system.)
It is running a version of Linux and it can be assumed that all normal Linux commands work.
The boot device can be ei... |
Mount point is controlled by systemd.
You can list the systemd mount unit files through:
systemctl list-units --type=mount --all
sample output:
-.mount loaded active mounted Root Mount
boot-efi.mount loaded active mounted /boot/efi
... | How to programattically determine the device name/basename of the root partition? |
1,301,414,593,000 |
With the below function signature
ssize_t read(int fd, void *buf, size_t count);
While I do understand based off the man page that on a success case, return value can be lesser than count, but can the return value exceed count at any instance?
|
A call to read() might result in more data being read behind the scenes than was requested (e.g. to read a full block from storage, or read ahead the following blocks), but read() itself never returns more data than was requested (count). If it did, the consequence could well be a buffer overflow since buf is often si... | Can read() return value exceed the count value? |
1,301,414,593,000 |
I need to create a while loop that if dmesg returns some/any value, then it should kill a determined process.
Here is what I have.
#!/bin/bash
while [ 1 ];
do
BUG=$(dmesg | grep "BUG: workqueue lockup" &> /dev/null)
if [ ! -z "$BUG" ]; then
killall someprocessname
else
break
fi
done
I don't know... |
Some issues:
You are running this in a busy loop, which will consume as much resources as it can. This is one instance where sleeping could conceivably be justified.
However, recent versions of dmesg have a flag to follow the output, so you could rewrite the whole thing as (untested)
while true
do
dmesg --follow ... | How can I create an infinite loop that kills a process if something is found in dmesg? |
1,301,414,593,000 |
I just installed Mint 18 as a virtual machine using VMware 12. I have the problem that I can't install vmware-tools. At first I tried to install open-vm-tools as is recommended by Mint, but it didn't work, so I uninstalled it and then tried to install the default vmware-tools, but it can't be installed.
|
Forget VM tools, use:
sudo apt-get install open-vm-tools open-vm-tools-desktop
Then do a full restart and check that the client screen will resize when the host window resizes.
| Problem with Mint 18 and VMware Tools |
1,301,414,593,000 |
How do the md devices get assembled at bootup in Ubuntu? Is /etc/mdadm/mdadm.conf truly the relevant factor here?
My mdadm.conf is sound and I checked that while I was in the rescue CD environment. When running mdadm -A --scan it finds and assigns the device names as desired. The mdadm.conf contains AUTO -all to take ... |
Basic Boot Process
Grub
Grub reads its disk, md, filesystem, etc. code from the MBR.
Grub finds its /boot partition, and reads the rest of itself out of it. Including the config, and any modules the config specifies need loading.
Grub follows the instructions in the config, which typically tell it to load a kernel an... | Ubuntu: How do the md devices get assembled at bootup? |
1,301,414,593,000 |
I'm on a Raspbian, I've tried to receive data with:
nc -4 -l -v -k -p 5004
which result in:
Listening on [0.0.0.0] (family 2, port 5004)
nc: getnameinfo: Temporary failure in name resolution
route command return this:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use I... |
nc -n
-n numeric-only IP addresses, no DNS
With this I've solved
| netcat nc: getnameinfo: Temporary failure in name resolution |
1,301,414,593,000 |
I have a file with the following file mode bits (a+rw):
[0] mypc<johndoe>:~>sudo touch /tmp/test
[0] mypc<johndoe>:~>sudo chmod a+rw /tmp/test
[0] mypc<johndoe>:~>ls -l /tmp/test
-rw-rw-rw- 1 root root 0 Mar 13 11:09 /tmp/test
Why can't I remove the file?
[0] mypc<johndoe>:~>rm /tmp/test
rm: cannot remove '/tmp/... |
The /tmp directory is conventionally marked with the restricted deletion flag, which appears as a permission letter t or T in ls output.
Restricted deletion implies several things. In the general case, it implies that only the owner of the file, or the owner of /tmp itself, can delete a file/directory in /tmp.
You ca... | Can't remove a file with file mode bits a+rw |
1,301,414,593,000 |
In mount man page errors=remount-ro is an option for mounting fat but this option doesn't appear in ext4 options catalog.
I know what this option means: In case of mistake remounting the partition like readonly but I don't know if it's a correct option or only a bug.
|
It is perfectly valid for ext4, and is defined in the ext4 manpage:
errors={continue|remount-ro|panic}
Define the behavior when an error is encountered. (Either
ignore errors and just mark the filesystem erroneous and
continue, or remount the filesystem read-only, or panic and
... | Why do I have "errors=remount-ro" option in my ext4 partition in my Linux? |
1,301,414,593,000 |
Just to understand core IDs:
I have 4 CPUs:
$ cat /proc/cpu* | grep proc*
processor: 0
processor: 1
processor: 2
processor: 3
and the result of nproc is also 4.
But if I use cat /proc/cpu* | grep 'core id' I get the same twice
core id: 0
core id: 2
core id: 0
core id: 2
Why they are not numbered like the CPUs and ho... |
Your CPU has two cores and four threads, so seeing duplicated core identifiers is perfectly normal: each “processor” listed in /proc/cpuinfo is a logical processor, on a physical core, so you end up with two physical cores (ids 0 and 2), with four processors (ids 0, 1, 2, and 3).
The core numbering seems odd, but that... | Understanding core IDs |
1,301,414,593,000 |
I can see the difference between /dev/tty and /dev/tty0 by testing the provided method from this question. But I really wonder about the practical usage of those devices (like situations they will be used).
|
/dev/tty is the controlling tty of the current process, for any process that actually opens this special file. It isn’t necessarily a virtual console device (/dev/ttyn), and can be a pty, a serial port, etc. If the controlling tty isn’t a virtual console, then the process has not to interact with console devices even ... | How Linux uses /dev/tty and /dev/tty0 |
1,301,414,593,000 |
I want to replace the default listening port of httpd to 9090. I can edit the line in httpd.conf file using below
sed -i "/^Listen/c\Listen 9090" /etc/httpd/conf/httpd.conf
But the line
Listen 80
may have white space before it.
How do I ignore this white space to match this line?
|
Change your matching pattern no catch white spaces before liste in the following way:
/^\s*Listen/
That will include all
Listen ..
Listen ...
and others.
| sed : Ignore line starting whitespace for match |
1,301,414,593,000 |
I bought a Microsoft 3600 bluetooth mouse and never managed to get it working properly on Linux, but it works fine in other operating systems.
If I stop moving the mouse for a few seconds (like 3 or 4 seconds) it "sleeps", and when I move it again the pointer won't move for the next few seconds. This makes this device... |
It's been about 3 years since I bought this mouse, TODAY I managed to fix it. It was about the USB device auto suspending for some reason
Do # lsusb -vt to get your USB device ID:
λ ~> sudo lsusb -vt
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
ID 1d6b:0003 Linux Foundation 3.0 root hub
/: Bus... | Bluetooth mouse sleeps after a few seconds idle when there is no other mouse connected |
1,301,414,593,000 |
I am using iptables with ipset on an Ubuntu server firewall. I am wondering if there is a command for importing a file containg a list of ip's to ipset. To populate an ipset, right now, I am adding each ip with this command:
ipset add manual-blacklist x.x.x.x
It would be very helpfull if I can add multiple ip's with ... |
You can use ipset save/restore commands.
ipset save manual-blacklist
You can run above command and see how you need to create your save file.
Example output:
create manual-blacklist hash:net family inet hashsize 1024 maxelem 65536
add manual-blacklist 10.0.0.1
add manual-blacklist 10.0.0.2
And restore it with bel... | How to import multiple ip's to Ipset? |
1,301,414,593,000 |
I've add 1 route in configuration network file, how to reload routing table on Centos without lost network service
|
It's impossible to reload routing table without lost network service (I think you mean you don't have to use service network restart command to make the changes). If you have any change to network configuration file, you need to restart networking service to apply new configuration.
In your case, you can add the confi... | How to reload routing table on Centos without lost network service |
1,301,414,593,000 |
I've been doing a bit of reading, and it looks like ZFS doesn't like disks being removed from non-redundant arrays:
You can use the zpool detach command to detach a device from a mirrored storage pool. For example:
# zpool detach zeepool c2t1d0
However, this operation is refused if there are no other valid replicas ... |
Don't know if things were that different in `13 but 'zfs replace' works on non-redundant pools. You just run the 1 command instead of detaching first.
d1 is 1G, d2 is 2G, both are empty files in /tmp:
/t/test #> zpool create test /tmp/test/d1
/t/test #> zpool set autoexpand=on test
/t/test #> zpool status
pool: tes... | How to replace a disk in a non-redundant ZFS pool? |
1,301,414,593,000 |
I have seen some tutorials on extending an LVM2 logical volume. None of them instruct you to unmount the filesystem. They claim that you can extend an LVM volume while it is in use. Is this right?
|
That depends on whether the filesystem can be extended online. Most major Linux filesystems can be extended while they are mounted (btrfs, ext2, ext3, ext4, xfs, zfs) — the main exception is reiserfs. If you want to extend one of these filesystems on an LVM volume, you can extend the volume with lvextend, then extend ... | Must the filesystem be unmounted while extending an LVM logical volume? |
1,301,414,593,000 |
What are the main differences between the Windows registry and the approach used in UNIX/Linux, and what are the advantages and disadvantages of each approach?
|
There is no real cognate in UNIX, but as wollud1969 says, /etc comes close. That, though, is only part of the story. You'd also need to consider things under /var (for information about installed software, running services, etc), /usr/local/etc (at least on FreeBSD and certain Linux distros) for configuration informat... | Differences between Windows registry and UNIX/Linux approach [closed] |
1,300,719,913,000 |
Sometimes I upload an application to a server that doesn't have external internet access.
I would like to create the same environment in my machine for testing some features in the application and avoid bugs (like reading a rss from an external source).
I thought about just unplugging my ethernet cable to simulate, bu... |
Deleting the default route should do this. You can show the routing table with /sbin/route, and delete the default with:
sudo /sbin/route del default
That'll leave your system connected to the local net, but with no idea where to send packets destined for beyond. This probably simulates the "no external access" situa... | Is it possible to simulate "no external access" from a Linux machine when developing? |
1,300,719,913,000 |
I was able to set up a network namespace and start a server that listens on 127.0.0.1 inside the namespace:
# ip netns add vpn
# ip netns exec vpn ip link set dev lo up
# ip netns exec vpn nc -l -s 127.0.0.1 -p 80 &
# ip netns exec vpn netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Loca... |
First: I don't think you can achieve this by using 127.0.0.0/8 and/or a loopback interface (like lo). You have to use some other IPs and interfaces, because there are specific things hardwired for 127.0.0.0/8 and for loopback.
Then there is certainly more than one method, but here's an example:
# ip netns add vpn
# ip... | How to forward traffic between Linux network namespaces? |
1,300,719,913,000 |
There is a lot of solution here to execute a script at shutdown/reboot, but I want my script to only execute at shutdown.
I've tried to put my script in /usr/lib/systemd/systemd-shutdown, and check the $1 parameter, as seen here, but it doesn't work.
Any ideas ?
system : archlinux with gnome-shell
$systemctl --version... |
I've finally found how to do that.
It's a bit hackish thought, but it works.
I've used some part of this thread : https://stackoverflow.com/questions/25166085/how-can-a-systemd-controlled-service-distinguish-between-shutdown-and-reboot
and this thread :
How to run a script with systemd right before shutdown?
I've cre... | Systemd : How to execute script at shutdown only (not at reboot) |
1,300,719,913,000 |
As far as I know no update on a linux machine requires a restart. Windows however needs to restart several times for a update to complete which is understandable because the hardware might be in use at the moment and a restart ensures that no software uses the driver.
But how can an OS (or linux as an example) handle ... |
Updates on Linux require a restart if they affect the kernel. Drivers are part of the kernel. It's sometimes possible to upgrade a driver on Linux without rebooting, but that doesn't happen often: the peripheral controller by the driver can't be in use during the update, and the new driver version has to be compatible... | How does linux driver update work? |
1,300,719,913,000 |
Environment: CentOS 5.5 and 6.4
I have a request to analyze the hardware before installation to make sure our customers don't install our software on sub-standard server hardware. For example, examining memory, disk space, CPU, network card... So, the %pre section in my ks.cfg file seems like the perfect place to d... |
After digging a bit more, I found a ton of system info in /proc that is available for
viewing when the %pre section in ks.cfg executes. Checkout dmidecode and files in /proc to get all the information you need. Here is what worked for me:
%pre --log=/tmp/ks_pre.log
#!/bin/sh
#------------------------------------... | What commands are available in the %pre section of a Kickstart file on CentOS? |
1,300,719,913,000 |
In this page from The Design and Implementation of the 4.4BSD Operating System, it is said that:
A major difference between pipes and sockets is that pipes require a
common parent process to set up the communications channel
However, if I record correctly, the only way to create a new process is to fork an existin... |
Am I then right to think that any pair of processes can be piped to each other?
Not really.
The pipes need to be set up by the parent process before the child or children are forked. Once the child process is forked, its file descriptors cannot be manipulated "from the outside" (ignoring things like debuggers), the ... | Can I pipe any two processes to each other? |
1,300,719,913,000 |
I was wondering what commands/utilities can be used in terminal to know the types of windowing system (such as X window system), window manager (such as Metacity, KWin, Window Maker) and desktop environment (such as KDE, Gnome) of a Linux or other Unix-like operating systems?
Thanks!
|
From Ask Ubuntu.SE: If you have wmctrl installed, wmctrl -m will identify the window manager for you.
Thomas already mentioned the XDG_CURRENT_DESKTOP environment variable for identifying the desktop environment.
And from this thread here in Unix & Linux SE: the XDG_SESSION_TYPE environment variable can be used to ide... | How to know the types of windowing system, window manager and desktop environment of a Unix-like OS |
1,300,719,913,000 |
I'm on a Linux busybox 1.27 only system so no output=progress available, no busybox's own implementation of pv which is pipe_progress nor pv itself.
I have two questions. The first is based on https://www.linux.com/training-tutorials/show-progress-when-using-dd/. It says that by sending the USR1 signal to dd it "pause... |
dd if=/dev/zero of=/dev/null bs=1048576 count=1024
Note that dd can mangle data, at least when using the bs parameter. And its performance advantage is small at best if you hand-pick an optimal block size for your particular system configuration: cat or cp can do better, and at most is only slightly slower. So don't... | Check dd's progress without USR1? |
1,300,719,913,000 |
I use the rsync in order to transfer files from /etc/yum.repos.d/ to remote server to /etc/yum.repos.d/
sshpass -p $password rsync -av /etc/yum.repos.d/* root@server_one.usaga.com:/etc/yum.repos.d
Host key verification failed.
rsync error: explained error (code 255) at rsync.c(551) [sender=3.0.9]
as we can see above ... |
You can specify other remote shell for rsync than ssh using -e and that includes ssh with extra options so adding -e "ssh -o StrictHostKeyChecking=no" will do trick.
| rsync + rsync failed because Host key verification failed |
1,300,719,913,000 |
I try to write a script to get the version of my distro so that I can pass it to a variable.
The following command is what I wrote to achieve the result.
lsb_release -ar | grep -i release | cut -s -f2
The unwanted output:
No LSB modules are available.
18.04
As you can see, the No LSB modules are available message is... |
That message is sent to standard error, so redirecting that to /dev/null will get rid of it (along with any other error message produced by lsb_release):
lsb_release -ar 2>/dev/null | grep -i release | cut -s -f2
| Remove "No LSB modules are available." message from 'lsb_release -a' |
1,300,719,913,000 |
I have a script that will add users from a file. It will add the users just fine as far as I can tell, but when trying to login the password supplied by the script does not work. I'm not sure if this is normal or not, but the /etc/shadow file also shows the correct passwords in plain text. I thought the shadow file is... |
According to useradd --help:
-p, --password PASSWORD encrypted password of the new account
So what you need to do is to pass the encrypted password:
-p $(openssl passwd "the_password")
| Script to add users will add users but they cannot login |
1,300,719,913,000 |
I have 119766 files in a folder. They are CSV files. I want to find out total number of lines of all files.
I'm trying to run following command:
cat * |wc -l
But the following error occurrs:
-bash: /bin/cat: Argument list too long
How can I do that? Is there any way around this?
One thing I would like to add that... |
If you want a line-count for each individual file:
find . -type f -exec wc -l {} + | awk '! /^[ 0-9]+[[:space:]]+total$/'
I've excluded the total lines because there will be several of them with this many files being processed. The find ... -exec ... + will try to fit as many filenames onto a single command line as ... | /bin/cat: Argument list too long |
1,300,719,913,000 |
I'm trying to rename a bunch of music tracks in a directory, but I got this error:
When moving multiple files, last argument must be a directory
This is the script:
for file in * ; do
mv $file $(echo $file |sed 's/^.\{5\}//g')
done
This works for a file without whitespace, how would I modify this script?
|
Use quotes:
mv -- "$file" "$(echo "$file" | sed ...)"
Else mv sees multiple arguments. A filename called file name with spaces would be 4 arguments for mv. Therefore the error: when moving multiple files, last argument must be a directory. When mv has more than 2 arguments, it's assuming you want to move multiple fil... | Remove certain characters from multiple files with whitepsaces |
1,300,719,913,000 |
Why doesn't this work?
cat /dev/video1 | mplayer -
If I could get that to work, then I could play & record video at the same time using 'tee' to feed mplayer and mencoder.
I want to play live video (from /dev/video1:input=1:norm=NTSC) and record it at the same time without introducing lag.
mplayer plays the video fin... |
8+ years later, I ought to post the solution I found.
Use Python. AFAICT, this isn't possible in with standard Linux tools alone.
If you're reading this - best to stop smashing your head against the wall.
Very roughly speaking - use pygame (import pygame) to read the camera and display the video, and OpenCV (import cv... | How to get mplayer to play from stdin? |
1,300,719,913,000 |
I'm trying to create patch a file using diff tool.But facing an issues.The way I am doing is below.
I've created one Directory named a and put original file in to it.
a/original_file.c
Now I have created other Directory named b and put same file with modified content in to it.
b/original_file.c
Now content of b/ori... |
diff has more than one option related to whitespace. However, one is less useful for patches. The manual page gives an obscure hint, referring to both GNU:
-B, --ignore-blank-lines
ignore changes where lines are all blank
-b, --ignore-space-change
ignore changes in the amount of white space... | How to create a patch ignoring indentation differences in the code? |
1,300,719,913,000 |
I was trying to find the intersection of two plain data files, and found from a previous post that it can be done through
comm -12 <(sort test1.list) < (sort test2.list)
It seems to me that sort test1.list aims to sort test1.list in order. In order to understand how sort works, I tried sort against the following file... |
Per the comm manual, "Before `comm' can be used, the input files must be sorted using the collating sequence specified by the `LC_COLLATE' locale."
And the sort manual: "Unless otherwise specified, all comparisons use the character collating sequence specified by the `LC_COLLATE' locale.
Therefore, and a quick test co... | Issues of using sort and comm |
1,300,719,913,000 |
I know that I can do ps aux | grep cgi to get a list of all cgi scripts currently running, and ps -p [pid] -o etime= can get me the run time for each pid; is there a way to combine the two, or better still, only return those that have been running for "too long" (say, 45sec)?
Ideally, I'm looking for something that co... |
I've done something like this in the past.
ps -A -o etime,pid,user,args| grep init
returns
180-04:55:20 1 root init [5]
Which is easily parse-able in perl.
I used split and pop to parse it.
The format is [[dd-]hh:]mm:ss
| How can I get a list of long running processes that match a particular pattern? |
1,300,719,913,000 |
I've heard of lines of code that are distributed with the Linux Kernel that aren't open. Maybe some drivers or something like that.
I'd like to know how much of that is true? Are there lines of code that are distributed with the Kernel (as when you download it from kernel.org) that aren't open at all? And how much tha... |
The Linux kernel itself is all free software, distributed under the GNU General Public License.
Third parties may distribute closed-source drivers in the form of loadable kernel modules. There's some debate as to whether the GPL allows them; Linus Torvalds has decreed that proprietary modules are allowed.
Many device ... | Proprietary or Closed Parts of the Kernel |
1,300,719,913,000 |
I successfully built up a raid5 array on Debian testing (Wheezy). As the man pages and further tell, the array would be created as an out-of-sync array with just a new spare injected to be repaired.
That worked fine.
But after the rebuild process, I get daily messages on missing spares, but the array should be raid5 o... |
Open the /etc/mdadm/mdadm.conf file, find the line that begins with ARRAY /dev/md1 and remove the line immediately following which states 'spares=1'. Then restart mdadm service.
If you did a mdadm --examine --scan to retrieve the array definitions while the md1 array was still rebuilding, one partition was seen as spa... | mdadm Raid5 gives spares missing events |
1,300,719,913,000 |
during the upgrade of a debian system i got the following errors:
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8125b-2.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8125a-3.fw for module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8107e-2.fw for module r8169
W: Pos... |
It's normal. Many devices need firmware to fully work. The thing is, firmware is a binary blob, and not free (as in GNU-free).
So Debian does not distribute it by default.
In your case you could do this (with the non-free entry in /etc/apt/sources.list:
$ sudo apt-get install firmware-realtek firmware-misc-nonfree
If... | Linux Upgrade (Debian) - Possible missing firmware problem [duplicate] |
1,300,719,913,000 |
I'm able to get the signal strength of all Wi-Fi networks with the following command:
$ nmcli -t -f SIGNAL device wifi list
$ 77
67
60
59
55
45
44
39
39
37
I would like to reduce this list only to the current Wi-Fi on which I'm connected. I've been through the man page but can't find the necessary f... |
nmcli --version
nmcli tool, version 1.6.2
To get the SIGNAL of the AP on which you are connected, use:
nmcli dev wifi list | awk '/\*/{if (NR!=1) {print $7}}'
The second * mark in nmcli dev wifi list is set to identify the SSID on which your are connected.
nmcli --version
nmcli tool, version 1.22.10
use:
nmcli dev ... | Get connected Wi-Fi network signal strength with nmcli |
1,300,719,913,000 |
In Linux, I can get last month by using
date -d "last month" '+%Y%m'
or
date -d "1 month ago" '+%Y%m'
But say, today is 31st of March, if I run the command at top, it shows 201603, but I want to get last month regardless which day I'm in now; how can I do so?
I can achieve that by using workaround like get first da... |
The usual wisdom is use the 15 of this month. Then subtract 1 month:
$ nowmonth=$(date +%Y-%m)
$ date -d "$nowmonth-15 last month" '+%Y%m'
201602
| Get previous month regardless of days |
1,300,719,913,000 |
I'm trying to remove all files more than 1 days old.Before I execute a script to remove the files,I try to find the files using mtime. however, I face same problem with my command-
My Current date is
Wed Jan 27 11:49:20 BDT 2016
My file lists are-
Jan 25 15:11 25-01-2016.txt
Jan 26 13:05 26-01-... |
Two points: find "ignores fractional parts". I guess it calculates the number of hours, divides by 24, and integerizes the result (discards the fraction). So -mtime 0 checks a file, compares the mtimes, converts to hours, divides by 24. If the integer part of that result is 0, it's a match. That means 0.99999 hours ag... | How do I find files older than 1 days using mtime? [duplicate] |
1,300,719,913,000 |
I am trying to set up an IP6tables firewall on Linux and I basically want to start copying my IPv4 configuration.
One of my rules simply accepts all traffic to the localhost subnet:
iptables -A INPUT -s 127.0.0.0/8 -j ACCEPT
I am a little puzzled though what the equivalent for IPv6 is. Is it as simple as:
ip6tables -... |
From Wikipedia:
IPv4 network standards reserve the entire 127.0.0.0/8 address block for loopback purposes. That means any packet sent to one of those 16,777,214 addresses (127.0.0.1 through 127.255.255.254) will be looped back. IPv6 has just a single address, ::1.
So for IPv6 its just ::1 or ::1/128.
| What is the IPv6 equivalent for 127.0.0.0/8 |
1,300,719,913,000 |
I have a text file named foo.txt with root permission in one Linux distribution. I copied it to another Linux distribution on another computer.
Would file permissions be still maintained for foo.txt?
If yes, how does Unix/Linux linux know, and duplicate the permissions of the file?
Does it add extra bytes (which in... |
To add Eric's answer (don't have rep to comment), permissions are not stored in file but file's inode (filesystem's pointer to the file's physical location on disk) as metadata along with owner and timestamps. This means that copying file to non-POSIX filesystem like NTFS or FAT will drop the permission and owner data... | How does Unix implement file permissions? |
1,300,719,913,000 |
Observation:
I have an HP server with an AMD dual core CPU (Turion II Neo N40L) which can scale frequencies from 800 to 1500 MHz. The frequency scaling works under FreeBSD 9 and under Ubuntu 12.04 with the Linux kernel 3.5.
However, when I put FreeBSD 9 in a KVM environment on top of Ubuntu the frequency scaling does ... |
I have found the solution thanks to the tip given by Nils and a nice article.
Tuning the ondemand CPU DVFS governor
The ondemand governor has a set of parameters to control when it is kicking the dynamic frequency scaling (or DVFS for dynamic voltage and frequency scaling). Those parameters are located under the sysfs... | Host CPU does not scale frequency when KVM guest needs it |
1,300,719,913,000 |
I would like to know how many Primary and Extended Partitions I can create on a x86_64 PC with Linux running on it?
Update :
If there is a limit to the number of partitions, why is that the limit?
|
The limitation is due to the original BIOS design. At that time, people weren't thinking more than four different OSes would be installed on a single disk. There was also a misunderstanding of the standard by OS implementors, notably Microsoft and Linux which erroneously map file systems with (primary) partitions inst... | What's the limit on the no. of partitions I can have? |
1,300,719,913,000 |
I am executing this command to test a connection from a remove server:
ssh -l user $IP "dd if=/dev/zero count=3500 bs=1M status=progress" > /dev/null
This shows progress reports of the form
3145728000 bytes (3,1 GB, 2,9 GiB) copied, 276,047 s, 11,4 MB/s
so apparently, dd reads at 11mb per second. The network bandwid... |
SSH can be operated as a compressed protocol, and judging by your results, it is enabled as such by default in your distribution or configuration (or you are using ssh -C). As such, your stream of zeroes compresses nicely into something much more compact -- from your readings, with a compression ratio of about 300: th... | How can dd over ssh report read speeds exceeding the network bandwidth? |
1,300,719,913,000 |
I use xinetd and it works for my purposes. However I recently discovered that systemd has something built in called "socket activation".
These two seem very similar, but systemd is "official" and seems like the better choice.
However before using it, are they really the same? Are there differences I should be aware of... |
I don’t think systemd socket activation is significantly better than xinetd activation, when considered in isolation; the latter is stable too and has been around for longer. Socket activation is really interesting for service decoupling: it allows services to be started in parallel, even if they need to communicate, ... | systemd "socket activation" vs xinetd |
1,300,719,913,000 |
Applications like lynx browser, htop etc and many others accept position dependent mouse clicks in bash over ssh shell. I know that ssh is a command line interface. Then how does it accepts mouse clicks?
|
IMHO, the simplest way to write such a TUI application is to use ncurses.
"New Curses" is a library that abstracts the design of the TUI from the details of the underlying device. All the software you cited use ncurses to render their interface.
When you click on a terminal emulator (e.g. xterm, gnome-term, etc), the ... | How some applications accept mouse click in bash over ssh? |
1,300,719,913,000 |
I have remote server without GUI support. How can I install `CentOS 7 there?
The CentOS 7 is mandatary and I can't switch to another OS or distribution.
I get following text at the end. I able to mount CD but I don't know what to do next. FreeBSD has bsdinstall which works in text mode. Debian can also be installed i... |
CentOS 7 has an option to install in text mode.
When you see install centos menu option press the tab key, add text to the end of any existing installer command line arguments and then press the return key.
This will tell the installer (Anaconda) to install the OS in text mode.
| Install CentOS 7 using text mode |
1,300,719,913,000 |
System: Linux Mint 18.1 64-bit Cinnamon.
Objective: To define Bash aliases to launch various CLI and GUI text editors while opening a file in root mode from gnome-terminal emulator.
Progress
For example, the following aliases seem to work as expected:
For CLI, in this example I used Nano (official website):
alias su... |
You shouldn’t run an editor as root unless absolutely necessary; you should use sudoedit or sudo -e or sudo --edit, or your desktop environment’s administrative features.
sudoedit
Once sudoedit is set up appropriately, you can do
SUDO_EDITOR="/opt/sublime_text/sublime_text -w" sudoedit yourfile
sudoedit will check th... | How to properly edit system files (as root) in GUI (and CLI) in Gnu/Linux? |
1,300,719,913,000 |
The Linux Programming Interface states:
Each device driver registers its association with a specific major device ID, and this association provides the connection between the device special file and the device driver.
Is it possible to obtain the list of those associations?
|
Documentation/admin-guide/devices.txt in the kernel source code documents the allocation process and lists all the allocated device numbers. sd gets a whole bunch of major device numbers because of the large number of devices it can handle: major 8 covers /dev/sda to /dev/sdp, major 65 covers /dev/sdq to /dev/sdaf, 66... | How to get a list of major number -> driver associations |
1,300,719,913,000 |
I have Linux Mint 14 installed as my only OS. I have one extended partition containing /swap, / and /home, and I have some unallocated space on my drive.
I'm guessing that Mint decided to put this all on an extended partition instead of three primary partitions.
So I want to build Linux From Scratch using some of my... |
do I need to have a swap partition for each distro or can LFS use the swap partition I already have?
As goldilock says, unless you are hibernating (suspend to disk), yes. Otherwise no, because you could overwrite swap of a hibernated system - either it's saved state or the part that was used as regular swap at suspe... | Do I only need one swap partition for multiple Linux distros? (and other questions) |
1,300,719,913,000 |
I am performing some experiments on a network of about 10 remote Linux computers which are geographically scattered.
I suspect some of them have clock skews but they are seen transiently (eg. once in a week or twice in a month).
I was wondering if there exists some tools which could detect and quantify such clock skew... |
Are you trying to keep the clocks synchronized to the right time, or are you trying to determine how accurate the real time clock actually is, without being synchronized?
If you simply want the times to be correct, there's a whole hierarchy of time servers that systems can sync to, and it's often built in to the OS, a... | Clock skews on remote machines |
1,300,719,913,000 |
How can I check if /proc/ is mounted?
Using /etc/mtab is discouraged as it
might be inconsistent.
Using /proc/mounts is also not an
option as might not exist if /proc/
is not mounted (although checking for
its existence may be a way to do this
check.
What is the best way to do this check?
|
You can run the mount without any arguments to get a list of current mounts. The /etc/mtab file should have similar data, but like you said it is possible for this to be inconsistent with what is actually mounted in the event that the /etc file system is messed up, not writable, or another program has messed with it. ... | How to check if /proc/ is mounted |
1,300,719,913,000 |
I have a process running very long time.
I accidentally deleted the binary executable file of the process.
Since the process is still running and doesn't get affected, there must be the original binary file in somewhere else....
How can I get recover it? (I use CentOS 7, the running process is written in C++)
|
It could only be in memory and not recoverable, in which case you'd have to try to recover it from the filesystem using one of those filesystem recovery tools (or from memory, maybe). However!
$ cat hamlet.c
#include <unistd.h>
int main(void) { while (1) { sleep(9999); } }
$ gcc -o hamlet hamlet.c
$ md5sum hamlet
3055... | How to recover the deleted binary executable file of a running process |
1,300,719,913,000 |
Recently I did the usual update + upgrade .. however after doing so, my network interface refused to work. ( no connection )
What happened ? How can I get bring my network-interface up ? ... I am running a debian - stretch.
( The same issue might occur on debian-derivates, like e.g. Ubuntu)
|
After some search in the web ( god sake I have as well a laptop ) I figured out that some renaming of the network interfaces occurred ... so first thing to do: See which network interfaces currently are up ( for me only the Loopback was started )
sudo ifconfig
Now let's check the naming of all available network inte... | Debian - network interface does not work any more after update / upgrade |
1,300,719,913,000 |
I got a copy of The Unix Programming Environment by Kernighan and Pike from a garage sale. I'm very interested in the chapter about the UNIX filesystem. Naturally, I also found this passage very interesting:
The time has come to look at the bytes in a directory:
$ od -cb .
0000000 4 ; . \0 \0 \0 \0 ... |
Each filesystem type stores directories in a different way. There are many different filesystem types with different characteristics — good for high throughput, good for high concurrency, good for limited-memory environments, different compromises between read and write performance, between complexity and stability, e... | octal dump of directory |
1,414,755,363,000 |
stdin, stdout, stderr are some integers that index into a data structure which 'knows' which I/O channels are to be used for the process. I understand this data structure is unique to every process. Are I/O channels nothing but some data array structures with dynamic memory allocation ?
|
In Unix-like operating systems, the standard input, output and error streams are identified by the file descriptors 0, 1, 2. On Linux, these are visible under the proc filesystem in /proc/[pid]/fs/{0,1,2}. These files are actually symbolic links to a pseudoterminal device under the /dev/pts directory.
A pseudoterminal... | How I/O channels are implemented in Linux kernel? |
1,414,755,363,000 |
I need to sort this list by name, high temp and low temp:
Kuala Lumpur 78 56
Seoul 85 66
Karachi 95 75
Tokyo 85 60
Lahore 85 75
Manila 90 85
I figured since whitespace is the delimiter for a column I could just
sort -k 1
which gives me this:
Karachi 95 75
Kuala Lumpur 78 56
Lahore 85 75
... |
As others have commented, it will make it easier to work with the data if it is comma separated values (CSV).
Here is my solution for converting the data to CSV:
$ cat file | sed 's/ \([0-9]\)/,\1/g'
Kuala Lumpur,78,56
Seoul,85,66
Karachi,95,75
Tokyo,85,60
Lahore,85,75
Manila,90,85
It replaces any space preceding a... | Sort with unequal whitespace in first column |
1,414,755,363,000 |
I have an hourly hour-long crontab job running with some mtr (traceroute) output every 10 minutes (that is going to go for over an hour prior to it being emailed back to me), and I want to see the current progress thus far.
On Linux, I have used lsof -n | fgrep cron (lsof is similar to BSD's fstat), and it seems like ... |
The file can be access through the /proc filesystem: you already know the PID and the FD from the lsof output.
cat /proc/21742/fd/5
| How can I access a deleted open file on Linux (output of a running crontab task)? |
1,414,755,363,000 |
I am doing some research to figure out what distro's of linux contain kernel packet filtering and are compatible with BPF.
http://kernelnewbies.org/Linux_3.0
http://lwn.net/Articles/437981/
These two articles lead me to believe there is a package somewhere taht includes the libraries, and binaries?
I am specifically ... |
I think you have mixed two different things:
The OpenBSD packet filter facilities (sometimes called pf, and mostly controlled by pfctl). These are the basis of OpenBSD firewalling, the Linux equivalent is netfilter, mostly controlled by the iptables command. Comparable, but not compatible (and most say that OpenBSD... | Is berkeley packet filter ported to linux? |
1,414,755,363,000 |
I started downloading a big file and accidently deleted it a while ago. I know how to get its current contents by cping /proc/<pid>/fd/<fd> but since the download is still in progress it'll be incomplete at the time I copy it someplace else.
Can I somehow salvage the file right at the moment the download finishes but ... |
Using tail in follow mode should allow you to do what you want.
tail -n +0 -f /proc/<pid>/fd/<fd> > abc.deleted
I just did a quick test and it seems to work here. You did not mention whether your file was a binary file or not. My main concern is that it may not copy from the start of file but the -n +0 argument shoul... | Recover deleted file that is currently being written to |
1,414,755,363,000 |
Starting an Interactive shell over SSH is slow to one of my servers. Everything leading up to it including negotiating encryption is fast, but then it hangs for 45 seconds. After that, it finishes and I have a shell. How do I identify what it's hanging on? I tried clearing the environment and disabling all forward... |
pam_krb5.so was configured to acquire AFS tokens for a non-existent shell which had a 30 second timeout halting any authentication using that module, not just SSH. Removed that and authentication happens much quicker.
| SSH slow at starting session |
1,414,755,363,000 |
This question answers why Linux can't run OSX apps, but is there some application similar to Wine that allows one to do so?
|
Since wine is a re-implementation of the Windows API - you're looking for a re-implementation of the Macintosh API or various "kits" that Apple provides to let OSX apps link to the system frameworks. I don't know of any that fit the bill. The only thing even close is the Chamelion Project which brings the UIKit from i... | Is there something like wine to run OSX apps on linux? |
1,414,755,363,000 |
I have sudo rights on a redhat box; once I've sudo su - to become root in a shell, are there any commands I can run to see what username I su'd FROM?
|
The shell's parent process is su -, and the parent of that is the sudo su -. So you need to find out the user running sudo su -'s parent process by searching back in two steps with ps:
ps -o user= $(ps -o ppid= $(ps -o ppid= $PPID))
But you shouldn't be doing sudo su - if your version of sudo is not too old to have s... | Once sudo su'd to root, is there a command to see my username? |
1,414,755,363,000 |
I'm looking for a programmable Linux controller for home automation and general fun projects.
Requirements:
Controlling electric appliances - On/Off switches and dimmers (perhaps using relays)
Receive analogue and digital data from sensors (switches, temperatures, etc.)
USB connection
Running Linux
Advantages:
Netw... |
Is not so powerfull as a normal PC, but you should try arduino platform.
You can buy a great and cheap unit here: http://www.libelium.com/
Google a little bit about arduino and you will find a lot of references and a big community
| Linux Programmable Controller |
1,414,755,363,000 |
Here is my bash case:
First case, this is what I want to do "aliasing" var with myvarA:
myvarA="variableA"
varname="A"
eval varAlias=\$"myvar"$varname
echo $varAlias
Second case for array variable and looping its members, which is trivial:
myvarA=( "variableA1" "variableA2" )
for varItem in ${myvarA[@]}
do
echo $... |
I solved it; last example should be like this:
eval varAlias=\${"myvar"$varname[@]}
for varItem in ${varAlias[@]}
do
echo $varItem
done
| Bash eval array variable name |
1,414,755,363,000 |
How can I add line breaks to a command at the prompt?
I know that when I copy a multiline command from the internet that has newlines it appears on the command line
$ something
> like
> this
Also I know that you can use \ to insert a newline at the very end of your command
$ like \
> this
But how can I add newlines ... |
Use Ctrl+V followed by Ctrl+J.
This inserts a linefeed character rather than a carriage return (which Ctrl+M or Enter would result in after Ctrl+V).
| Inserting Newlines at the Bash Command Prompt |
1,414,755,363,000 |
I've installed Ubuntu alongside Windows 7. When i try to mount /mnt/sda1 which is Windows part on it, i take error such that; "The device '/dev/sda1' doesn't seem to have a valid NTFS."
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
... |
To get the exact information about the bootable windows partition before executing ntfsfix:
sudo file -s /dev/sda1
Then use ntfsfix to fix this problem:
sudo ntfsfix /dev/sda1
Finally mount your partition.
| Cannot mount sda1: "The device '/dev/sda1' doesn't seem to have a valid NTFS." |
1,414,755,363,000 |
I have a list.txt file including a list of log file.
For example
server_log1
server_log2
........
server_log50
I have another shell script used to download these logs. It worked like this
./script.sh serverlog1
I want to make it automatically that means it can automatically pass in each log file's na... |
The easiest method for reading arguments can be described as follows;
Each argument is referenced and parsed by the $IFS or currently defined internal file separator. The default character is a space.
For example, take the following; # ./script.sh arg1 arg2
The argument list in that example is arg1 = $1 and arg2 = $2 ... | How to pass in multiple arguments to execute with .sh script |
1,414,755,363,000 |
The major disadvantage of using zram is LRU inversion:
older pages get into the higher-priority zram and quickly fill it, while newer pages are swapped in and out of the slower [...] swap
The zswap documentation says that zswap does not suffer from this:
Zswap receives pages for compression through the Frontswap AP... |
To answer your question, I first ran a series of experiments. The final answers are in bold at the end.
Experiments performed:
1) swap file, zswap disabled
2) swap file, zswap enabled, max_pool_percent = 20
3) swap file, zswap enabled, max_pool_percent = 70
4) swap file, zswap enabled, max_pool_percent = 100
5) zram s... | Prevent zram LRU inversion with zswap and max_pool_percent = 100 |
1,414,755,363,000 |
I am running Ubuntu on a local PC with the following linux distro/kernel:
$ lsb_release -a
>> ubuntu 16.04.3 LTS
$ uname -r
>> 4.10.0-33-generic
I have a python (3.5) script which calls environment variables via the os package.
For the sake of simplicity, let's use the following script, test_script.py:
import os
MY... |
You should use the approaches in attempt 3 or 4, but you need to export the variable; change
MYVAR=123
to
export MYVAR=123
| Set persistent environment variable for all users |
1,414,755,363,000 |
Performance Best Practices for MongoDB implies that:
Most file systems will maintain metadata for the last time a file was
accessed. While this may be useful for some applications, in a
database it means that the file system will issue a write every time
the database accesses a page, which will negatively impac... |
To disable the writing of access times, you need to mount the filesystem(s) in question with the noatime option.
To mount an already mounted filesystem with the noatime option, do the following:
mount /home -o remount,noatime
To make the change permanent, update your /etc/fstab and add noatime to the options field.
... | how to disable access time settings in Debian linux |
1,414,755,363,000 |
All of the tools I've tried until now were only capable to create a dual (GPT & MBR) partition table, where the first 4 of the GPT partitions were mirrored to a compatible MBR partition.
This is not what I want. I want a pure GPT partition table, i.e. where there isn't MBR table on the disk, and thus there isn't also ... |
TO ADDRESS YOUR EDIT:
I didn't notice the edit to your question until just now. As written now, the question is altogether different than when I first answered it. The mirror you describe is not in the spec, actually, as it is instead a rather dangerous and ugly hack known as a hybrid-MBR partition format. This questi... | How to construct a GPT-only partition table on Linux? |
1,414,755,363,000 |
After making a change to my php.ini file I got the error messages as shown below.
vim /etc/php.ini
; Maximum amount of memory a script may consume (128MB)
; http://www.php.net/manual/en/ini.core.php#ini.memory-limit
memory_limit = 1536
Apache starts, but it won't server any of my virtual hosts, which it was doi... |
It was a simple syntax issue.
vim /etc/php.ini
; Maximum amount of memory a script may consume (128MB)
; http://www.php.net/manual/en/ini.core.php#ini.memory-limit
memory_limit = 1536
The problem was with the line I had changed.
memory_limit = 1536M
If you don't specify the suffix indicating the memory allo... | Apache and php not working child pid xxx exit signal Segmentation fault (11) |
1,414,755,363,000 |
I have a large folder with 30M small files. I hope to backup the folder into 30 archives, each tar.gz file will have 1M files. The reason to split into multi archives is that to untar one single large archive will take month.. pipe tar to split also won't work because when untar the file, I have to cat all archives to... |
I wrote this bash script to do it.
It basically forms an array containing the names of the files to go into each tar, then starts tar in parallel on all of them.
It might not be the most efficient way, but it will get the job done as you want.
I can expect it to consume large amounts of memory though.
You will need to... | how to create multi tar archives for a huge folder |
1,414,755,363,000 |
Is it possible to have bluetooth turned on and use a bluetooth keyboard when at the login screen? So far I only managed to start the bluetooth daemon when logged in. I added it to systemd with systemctl enable bluetooth, so it starts when I am in my user, although it is turned off by default which I'd like to fix as w... |
Like most of the time I didn't read the Arch Wiki carefully enough. There is a section on how to have the device active after booting.
You need to set a udev rule and to do so create /etc/udev/rules.d/10-local.rules with the following code
# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfi... | Turn on bluetooth on login screen |
1,414,755,363,000 |
I have set of linux folders and I need to get the permissions of the folders numerically.
For example in the below directory, I need to what is the permission value of the folder... Whether 755, 644 or 622 etc...
drwxrwsr-x 2 dev puser 4096 Jul 7 2014 fonts
|
To get the octal permission notation.
stat -c "%a" file
644
See the manpage of stat, -c specifies the format and %a prints the permissions in octal.
Or for multiple files and folders:
stat -c "%a %n" *
755 dir
644 file1
600 file2
| How to get file permission in octal [duplicate] |
1,414,755,363,000 |
I am having a problem on the server (CentOS 6, Plesk 11.5) where a particular user is using a mass mailer and is blacklisting our IP address. I have tried to delete this user using:
/usr/sbin/userdel test
but it returns a message saying that the user is currently logged in. I thought ok, kill the process. So I tried:... |
First grep all the 'test' user's process and kill -9 all pid's then delete the user.
pgrep -u test
ps -fp $(pgrep -u test)
killall -KILL -u test
userdel -r test
| Log out a user and delete the account |
1,414,755,363,000 |
I am writing code that relies on the output of /proc/meminfo, /proc/cpuinfo etc. Are the file contents always in English? For example, will MemTotal in /proc/meminfo always be MemTotal in all locales?
|
Yes, usually that is the case, as those messages are provided by the kernel itself, and including a hundred translations into the kernel image itself would serve no purpose other than increasing the kernel size dramatically.
For many things there are front-ends, user space programs which read the kernel info and prese... | Are the outputs of /proc/meminfo, /proc/cpuinfo etc always in English? |
1,414,755,363,000 |
I'm wondering if there is some way to prevent certain certain devices from becoming the output file of the dd command and the target of the fdisk command. I'm currently using the two operations to set up a write a bootloader, kernel, and root filesystem on an SD card, which appears as /dev/sdd. I'm always a little anx... |
You might try writing a udev rule to give the supplemental HDD(s) sufficiently unique names.
Another idea: Whenever you can phrase a security requirement as "It's not who's doing it, it's how they're doing it" you're talking about type enforcement, and in most Linux distros TE is done at the MAC level. Most of my MAC ... | Protecting Devices from dd and fdisk Commands |
1,414,755,363,000 |
I have an ASUS RT-N16 router that I've flashed with the open-source DD-WRT firmware. According to my ssh login, I'm running:
DD-WRT v24-sp2 mega (c) 2010 NewMedia-NET GmbH
Release: 08/07/10 (SVN revision: 14896)
I'd like to be able to customize the iptables rules, but before I do that, I'd like to see the output of ... |
Looking in
/tmp/.ipt
/tmp/.rc_firewall
gives exactly what I was looking for: the iptables rules as they would normally be in a file like /etc/sysconfig/iptables.
I had earlier found this:
dd if=/dev/mem | strings | grep -i iptables
...and fortunately, it works on the pared-down DD-WRT filesystem. It didn't give pre... | Where is iptables script stored on DD-WRT filesystem? |
1,414,755,363,000 |
In my dmesg this appeared when my window manager (xfwm4, part of XFCE) crashed:
xfwm4[3936]: segfault at 7f3c7c523770 ip 00007f3c7c523770 sp 00007ffffea1ee28 error 15 in SYSV00000000 (deleted)[7f3c7c4e8000+60000]
The same SYSV00000000 also appears in other places (like lsof).
So, what is this SYSV00000000? I Googled... |
The kernel is telling you that when the segfault occurred, the instruction pointer 0x7f3c7c523770 was in a SysV IPC shm segment. The shared memory segment started at 0x7f3c7c4e8000 and was 0x60000 bytes long.
SysV shm segments are not backed by a file, so the string SYSV00000000 appears where normally you'd get the fi... | What is "SYSV00000000"? |
1,414,755,363,000 |
Is there a way to attach to a process and find out, not only which files it is reading from, but what the read locations (byte offsets) of those reads are?
I tried using strace for this, but it doesn't seem to show that information.
Edit: There's a nice utility for this: apt install progress.
|
You should be able to tap into /proc/$PID/fdinfo for this purpose. Check out the "The phantom progress bar" section in Solving problems with proc.
fdinfo tracks a process's current position within an open file.
| Finding where a process reads in a file |
1,414,755,363,000 |
A friend, using a remote machine, SSHed to my machine and ran the following python script:
while (1):
....print "hello world"
(this script simply prints 'hello world' continuously).
I am now logged in to my machine. How can I see the output of the script my friend was running?
if it helps, I can 'spot' the script m... |
You generally can't see the output of anther person's program. See over in that column where your grep command is running on tty pts/3, and your friend's is ?, which means it's detached from the terminal.
You could see where the output is going with ls -l /proc/7494/fd/ (where 7494 is the process ID of your friend's ... | View Script Over SSH? |
1,414,755,363,000 |
tldr: Does mtrace still work or am I just doing it wrong?
I was attempting to use mtrace and have been unable to get it to write data to a file. I followed the instructions in man 3 mtrace:
t_mtrace.c:
#include <mcheck.h>
#include <stdlib.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
mtrace();
for... |
mtrace still works, but the man page is outdated. The reference documentation explains how to use it:
LD_PRELOAD=/usr/lib64/libc_malloc_debug.so.0 MALLOC_TRACE=/tmp/t ./t_mtrace
(replace with the appropriate path to libc_malloc_debug.so on your system — the above is appropriate for Fedora and derivatives on 64-bit x8... | Does mtrace() still work in modern distros? |
1,414,755,363,000 |
On Linux, Firefox is listening on UDP port, usually on ports 30000 and higher. What is the reason for this and why not just localhost, but 0.0.0.0, i.e. the interface exposed to the network as well?
|
UDP is not connection-based, so both ends have to be listening for two-way communication. Thus if Firefox wants to receive any responses from UDP services it is talking to, it needs to have open ports bound to a routable interface.
Since Firefox 88, HTTP/3 has been enabled by default, using UDP for web browsing with s... | On Linux Firefox is listening on several UDP ports on 0.0.0.0 |
1,414,755,363,000 |
On AlmaLinux during setup there is an option to choose a Security Profile. I run live and public websites on this server, so security is good, but I don't know what these are and how it could benefit me.
Should I choose one of these, and if so, which one? Or, should I ignore this, is it only for special use cases?
|
These are OpenSCAP profiles to ensure compliance with various government security standards. These are mostly used in situations when you are required to adhere to some specific security policy. So you'd usually choose a security policy if you are working for a governmental organization or your company is a government... | What is the purpose and benefit of a Security Profile in Almalinux setup screen? |
1,414,755,363,000 |
I get this message every time I install a new package in KDE neon via terminal,
Is it normal and I should ignore it or I should fix this?
Reading package lists... Done
Building dependency tree
Reading state information... Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with b... |
The warning is just that, a warning; it means that mandb isn’t run when relevant packages are installed, and the result of that is that the manual page index caches aren’t updated.
The technical reason for the warning is the absence of /var/lib/man-db/auto-update. I’m not sure what would cause that. To restore the man... | Processing triggers for man-db. Not building database; man-db/auto-update is not 'true , error |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.