New answers tagged

0

On GNU system: $ NL=' ' $ <file xargs -n4 -d "$NL" sh -c 'printf "%s\n" "$@" | sort' sh world1.com /randomkeygahjuh572/key639839 world2.com /randomkey788gauh72/key63whjk world3.com /randomkey788gauh72/key63whjk world4.com /randomkeyhghgdh778/key67567 world1.com /randomkeyhueh34778/key67uuu77 world2.com ...


1

The only possible difference would be DNS related or if your computer is awfully slow. This gives an imprecise reading which is why it is not the default behavior anymore.


1

$ awk '{l=l+1; ln[$1]=$0; if (l%4==0) { \ printf ("%s\n%s\n%s\n%s\n", ln["world1.com"], ln["world2.com"], ln["world3.com"], ln["world4.com"]); \ delete ln; l=0; } } ' test.txt world1.com /randomkeygahjuh572/key639839 world2.com /randomkey788gauh72/key63whjk world3.com /randomkey788gauh72/key63whjk world4.com ...


0

#!/usr/bin/perl use strict; use warnings; use autodie; use open qw< :encoding(ASCII) >; my $filename = $ARGV[0]; my ($ip_fh, $op_fh); open($ip_fh, "<", $filename); open($op_fh, ">", "$filename".".sorted"); my @ip_lines = <$ip_fh>; for(my $i = 0; $i <= $#ip_lines; $i++) { print $op_fh sort @ip_lines[$i..($i+3)]; $i += 3; } ...


0

This perl script should work with any number of domains (first fields) with any number of keys (second fields) per domain. Domains may have the same number of keys each, but don't have to. It builds up a hash (%domains) with each element of the hash containing an array of keys. While doing that, it keeps track of the largest number of keys seen for any of ...


1

To organize the files by world: $ paste -d'\n' <(grep world1 file) <(grep world2 file) <(grep world3 file) <(grep world4 file) world1.com /randomkeygahjuh572/key639839 world2.com /randomkey788gauh72/key63whjk world3.com /randomkey788gauh72/key63whjk world4.com /randomkeyhghgdh778/key67567 world1.com ...


1

Based on your output of sensors, it appears that lm_sensors does not detect any fan speed reading. You should try running sensors-detect and answer yes to all questions to hopefully detect one that wasn't previously configured. If not, then it simply won't be possible to control those fans. The BIOS controls the fans with a PWM, but its control is usually ...


1

These details are implementation specific. The packet size is exactly as you would expect. Using a smaller buffer size could in theory cause fragmentation of the packets but that doesn't happen on any system I've tried it on. The result you obtain showing only 72 bytes received is because your VPS has severe restrictions which limit the packet size to 64 ...


0

You could start by not instantiating Python on every matching byte (!): #!/usr/bin/awk -f function de() { getline < "/proc/uptime" close("/proc/uptime") return $0 } BEGIN { ec = de() } $0 == "ed" { getline byte1 getline byte2 number = strtonum("0x" substr(byte2, 2, 1)) + 2 data = ":: " de() - ec " ::ED." byte1 "." byte2 while (number--) ...


0

Following terdon's advice, im adding an alternative approach using sed, i mainly include it for completeness, however unlike the awk '{printf "%s,", $1}' which aggregates whilst ommitting the newline, with sedwe are actively replacing the newlines, thus it would also fit in when we wanted to replace a different character. It is inefficient though. The ...


0

No, it is not a strict subset. It is not even a subset. Here is a demonstration, on a desktop PC running a major GNU/Linux distribution without any customisations that should affect the result, that there is at least one datum present in sysfs that is not present in procfs: $ grep -ir `cat /sys/block/sda/device/model | cut -f1 -d' '` /sys 2>/dev/null ...


1

Sysfs is not at all a subset of procfs. They serve different purposes, see the answers to What is the difference between procfs and sysfs?.


3

A bit dirty and there is probably a cleaner solution (maybe using SELinux or grsec) but you can hide a process by mounting an empty directory inside of /proc/<pid>. For example something like this : mount -o bind /empty/dir /proc/42 will prevent regular users from seeing process 42. They will however see that something is hidden as they will be ...


2

All you need to do is parse the command's output and replace the first newline (\n) with a comma. This should work: ssh test01 "hostname && cat /etc/sysconfig/rhn/rhnsd " | perl -00pe 's/\n/,/' Here we're using perl to slurp the entire file into memory (-0) and replace the first \n with a comma. The -p tells perl to print each input "line" ...


0

For your command this would produce the expected output : counter=0 ssh test01 "hostname && cat /etc/sysconfig/rhn/rhnsd " \ | while read line ; do ((counter++)) if [[ counter -eq 1 ]]; then echo -ne "${line}," else echo "$line" fi done


0

I ran across the ssh_exchange_identification: read: Connection reset by peer problem in a script that starts 16 or more ssh sessions in a loop. sshd apparently can't keep up; adding a short sleep solved my problem: for i in $(seq 32) do ssh -f root@$HOST "./test_server -p $(expr $BASE_PORT + $i)" > svr${i}.out # for > 8 connections, ssh has ...


0

id | awk '{print $1}' | sed 's:.*(::;s:)$::'


2

The socket[xxxxx] symlinks are always broken. There isn't a path you can provide to open a socket with a given inode number. I tried it and it seems you can't open the file /proc/pidX/fd/Y which refers to a socket. However you can if it refers to a real file, even if the file has been deleted. It's not exactly a symlink. It's magic (i.e. a special case). ...


2

I think mount does not support this use of user with the default fuse security setting (or allow_root). I think the resulting permissions are the same as if you used sudo mount. To allow access by multiple non-root users, you could set allow_other, allowing access by any user. If this raised concerns, it would be possible to set default_permissions to ...


0

It is most likely trying to run the commands and failing because the iwconfig executable can't be found - because there's no $PATH variable available. You should always use absolute pathnames in cron scripts and similar and not rely on a $PATH setting that might not be there.


3

Creating a hardlink should probably be avoided, there's no need for one and a symlink is simpler and safer. Your other solutions are also fine though. You can create as script that calls the binary or you can add the directory to your PATH. The latter might be preferable if you expect to add other binaries in /opt as well. This is essentially a matter of ...


0

curl --fail does part of what you want: from man curl: -f, --fail (HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc to better deal with failed attempts. In normal cases when an HTTP server fails to deliver a document, it returns an HTML document stating so (which often also describes why and ...


0

Some POP3 servers are missing the LIST command. This command indeed gives the size of each mail available. To avoid this check, and to find a path to restore the service, just use the fetchmail "fetchsizelimit" option and set it to 0. fetchsizelimit 0 This way, fetchmail doesn't care about sizes any more and skips the use of the LIST command. Problem ...


4

The -T option asks nodes (each hop) to insert a timestamp in the IP packets upon receiving a ping. It works by using the TS option of IP packets, specified by RFC791. ping -T requires one argument of tsonly, tsandaddr or tsprespec. tsonly returns only the timestamp. tsandaddr returns the timstamp and the address the packet was sent from. From the man ...


0

How come we have many ways to do this but as always we also take into consideration and do not know where the file system used in the device may hinder a little, but we can use the "auto" option to give a little help. mount -t auto /dev/sdb1 /media/pendrv and ready our device will be mounted: at /media/pendrv ready to use, then simply use: umount ...


0

On Ubuntu 14, you can also use Disks app: First click on the disk on the left panel and then click on the partition on the right panel. The bottom of right panel shows format, current mounting status etc. You can also use this GUI to create/delete/format partitions.


0

Very Fast Way to Kill Multiple Processes (without having to write a script) USAGE: ./autokill.kl.sh <proc-name> => This will give you 5 seconds to change your mind and control-C out of the program. USAGE: ./autokill.kl.sh <proc-name> now => This will immediately kill all processes matching the string/pattern you specified!!! MODEL: ...


0

Since the syslog packet only contains the IP Address, you could use host: for h in  last Server syslogd exiting ; do host $h done


2

You could: To check for range you could use an if statement or a continue operation: if [[ $z -ge $1 || $z -le $2 ]] then : print result fi or [[ $z -lt $1 || $z -gt $2 ]] && continue : print result Depending on needs, the test options are: -ge: Greater than or equal to -le: Less than or equal to -lt: Less than -gt: Greater than Use ...


2

for i in * do size=$(stat --format="%s" "$i") if [ $size -gt $1 -a $size -lt $2 ] then printf "Right-sized: %s\n" "$i" else printf "Wrong-sized: %s\n" "$i" fi done This is just an update to your loop, but instead of parsing ls, it uses stat to gather the file's size, in bytes. This snippet assumes that you've already sanity-checked $1 ...


0

I found the solution here after searching the internet : https://forums.kali.org/showthread.php?271-How-to-EFI-install-Kali-Linux


1

What you need is a condition, which in shell has the following syntax: if TEST then ACTION else ACTION fi For tests, it's common to employ [. For example, to check if $5 is greater than 25 but is less than 50, you'll write: if [ "$5" -gt 25 ] && [ "$5" -lt 50 ] then echo "It's greater than 25 but is less than 50" else echo "It's ...


0

In the end, I ended up simplifying things a bit my setup to act on IP addresses changes. The Internet NAT was changed to MASQUERADE, so I do not have to act on it; the iptables rules left the dhclient-exit-hooks.d, installing iptables-persistent. iptables -A POSTROUTING -o eth0.101 ! -p esp -j MASQUERADE apt-get install iptables-persistent iptables-save ...


1

You could use CharybdeFS that was made exactly for this kind of purpose. It's a passthrough fuse filesystem like PetardFS but much more configurable. See the CharybdeFS cookbook here: http://www.scylladb.com/2016/05/02/fault-injection-filesystem-cookbook/ It's advanced enough to test a database.


0

Cache. A good summary at http://www.linuxatemyram.com/. Linux is borrowing unused memory for disk caching. This makes it looks like you are low on memory, but you are not! Everything is fine! To clear the caches use this command, as root, and then observe resulting memory usage. echo 3 > /proc/sys/vm/drop_caches


2

I was able to solve this problem by following commands : mv /var/lib/dpkg/info/coturn.* /tmp/ dpkg --remove --force-remove-reinstreq coturn This worked. And I installed coturn again, then it worked.


2

If the command died, you'd get the shell prompt back, with or without an error message. So in any case, it is still running. But in your case, it seems to be waiting for input from the terminal. This usually means that it will never end, unless you give it the input that it is waiting for. In any case, top is not the right tool. It is meant to show the top ...


0

You can certainly use Toad software which is a freeware and it has excellent options available to compare the databases, tables and schema. Check here https://www.toadworld.com/products/toad-for-sql-server I found this very handy.


0

To compare the differences between schemas of two mysql databases from the command line you can use mysqldiff example usage from the documentation shell> mysqldiff --server1=root@localhost \ employees.salaries:emp1.salaries --differ # server1 on localhost: ... connected. # Comparing employees.salaries to emp1.salaries ...


0

While it is heavier on the philosophy than it is on the “do it like this”, Eric Raymand’s The Art Of UNIX Programming may provide you with some insight: The Art of Unix Programming attempts to capture the engineering wisdom and philosophy of the Unix community as it's applied today — not merely as it has been written down in the past, but as a living ...


0

There really is no standard. The term 'project' is relatively recent, and seems to have appeared with the advent of IDEs. I had been programming for over 20 years before I heard the term, but I've never used it or thought in terms of it. Projects are an artificial convention tied to a particular tool. When you say "I have an <x> project" this is ...


2

The /sys filesystem contains information set by the kernel, mostly for the benefit of udev, along with some knobs for userspace to set some options. It is not a storage-backed filesystem, and as such you cannot make arbitrary changes, like changing file permissions. If you want to control some knobs from a non-root process, I can see two options: Write a ...


1

Their webpage contains the user guide, which contains installation instructions amongst other things.


0

You can use, sar -w. For instance, sar -w 1 3, reports total number of context switches per second for every 1 seconds a total of 3 times.


3

To debug problems with scheduling or applications performance on Linux, it is a good start to run task under perf stat. It reports statistics about the processor pipeline, its stalled cycles, or memory behaviour. Possible problems: Linux/Scheduler bug Intel HT is not keeping up with your threads Memory is not able to provide enough data for the program ...


0

Look I think that you can replace the command you need with the following sudo cat /dev/sda2|head -n 5|strings You can change the number of head lines as you want and you can also remove the head part and append a "less" to go through all the required disk or whatever sudo cat /dev/sda2|strings|less


2

You are mixing CentOS 6 packages (.el6) with CentOS 7 packages (.el7), which is invalid. They differ a lot. You installed mysql56-community-release-el7.* instead of mysql56-community-release-el6*, where from you get that. Remove this wrong package source: yum remove "mysql56-community-release-el7.*" Install the correct one (as you installed the above ...


0

The information about Tests and test Suites is at OpenBenchmarking.com. The website has been redesigned completely recently to collaborate with the upcoming Phoronix Test Suite 6.4 and to offer advanced information about the tests in a neat and comprehensive way .


1

The ettercap utility offers this functionality, via its --bridge parameter. Man page : http://linux.die.net/man/8/ettercap Project page : https://ettercap.github.io/ettercap


1

The changes to iptables can't be rolled back one by one: you have to reset all the rules and re-apply the ones you need. In your case, you seem to have a clean firewall by default, so all you need to do is: sudo iptables --table nat ---flush This will remove all the rules from the "nat" table.



Top 50 recent answers are included