Tag Info

Hot answers tagged

5

Another perl: perl -pe 'BEGIN { binmode \*STDOUT } chomp; tr/AB/\0\1/; $_ = pack "B*", $_' Proof: $ echo ABBBAAAABBBBBABBABBBABBB | \ perl -pe 'BEGIN { binmode \*STDOUT } chomp; tr/AB/\0\1/; $_ = pack "B*", $_' | \ od -tx1 0000000 70 fb 77 0000003 The above reads input one line at a time. It's up to you to make sure the lines are exactly what ...


5

You could do something like: netns=myns find -L /proc/[1-9]*/task/*/ns/net -samefile /run/netns/"$netns" | cut -d/ -f5 Or with zsh: print -l /proc/[1-9]*/task/*/ns/net(e:'[ $REPLY -ef /run/netns/$netns ]'::h:h:t) It checks the inode of the file which the /proc/*/task/*/ns/net symlink points to agains those of the files bind-mounted by ip netns add in ...


4

The answer from SF is accurate as far as it goes, though if all the lines you wish to comment are in one block there is a way "around" this problem. It's not standard practice, and the end result is individual comment markers on every line. My editor of choice for crontab files is vi, so other editors may or may not have similar functionality, but if you ...


4

Linux has a feature called network namespaces which allow you to essentially have multiple network stacks on the same machine, and assign one to a program when running it. This is a feature typically used for containers, but you can also use it to accomplish what you want. The ip netns subcommands manage it. Creating a new network namespace with no access ...


4

You can do it directly from the command line like this: ssh -A -t ubuntu@hostB ssh -A hostC Or by adding these lines to your "$HOME"/.ssh/config file and invoking ssh hostC in the normal manner: Host hostB User ubuntu Host hostC User ubuntu ProxyCommand ssh -q hostB nc -q0 %h %p In your scenario where hostB and hostC are ...


3

I see two options. One, he can use tail -f to see the log file as it's being written, or two, he can have the program start inside a screen (or similar) session to which he can (re-)attach later. If he doesn't know the location of the log file, he can use top, ps or a similar tool to find the process ID, then run lsof -p1234 where 1234 is the process id to ...


3

{ printf '2i[q]sq[?z0=qPl?x]s?l?x' tr -dc AB | tr AB 01 | fold -b24 } <infile | dc In making the following statement, @lcd047 has pretty well nailed my earlier state of confusion: You seem to be confused by the output of od. Use od -tx1 to look at bytes. od -x reads words, and on little endian machines that swaps bytes. I didn't follow ...


3

Will I find drivers for my graphics card that will allow me to use it at full performance? It depends. Purely free software drivers like Nouveau might not be able to get all the performance from your hardware, but Nvidia has some proprietary driver for it. BTW, unless you are playing games (or code vector numerical applications for CUDA or OpenCL), ...


3

You should be able to built most Linux software by hand (except very linux-kernel specific software), but as there are Illumos-based distributions which include package manager, it should be way more easy to use them and install pre-built software packages from the corresponding repositories. Using distributions with GNU userspace enhances also the ...


3

You can try to use the wall program, but the logged in users may be able to override that and avoid seeing any wall messages. Alternately, you can attempt configure and use syslog to send a message from a given facility to the * location, which (in my experience) will show up on all logged in shells.


3

Not sure of the purpose of for loop in your script which is not needed and does not serve any purpose. The following will work as you expected. find /var/backup/web2 -maxdepth 1 -type f -mtime +1 -delete


3

I would debootstrap a base system to another directory. debootstrap --variant=minbase --arch=amd64 jessie /tmp/bootstrap http://ftp.us.debian.org/debian/ Then copy all files from /tmp/bootstrap/bin to /bin keeping the permissions. cp -a /tmp/bootstrap/bin/* /bin/ Now many (and the basic ones) of your files in /bin should be ok and you should be able to ...


2

Except the IP2Dec and dec2ip script, which need to be performed only on part of the file, it should work. Here an example of dec2ip which applies the function only on the first entry of the line. #!/bin/bash dec2ip () { local ip dec=$@ delim="" for e in {3..0} do ((octet = dec / (256 ** e) )) ...


2

Each type of USB device sends data in its own way. It's up to the driver to decide what to do with the data. For data sent through a serial device, simply read from /dev/ttyUSBn. </dev/ttyUSB0 awk ' {data += $0} /record end/ {print $0 | "process-one-record #" NR} '


2

Here's a hypothetical situation which I consider might be plausible: The targeted machine is EFI. grub is either never installed on the target or has been utterly wiped from the system. it can only ever interfere and offers nothing of value otherwise. So what we might do in the above case is configure a boot option for a small installation/rescue ...


2

lsof(8) is probably your best option. Lesser options include ipcs(1), fuser(1), netstat(8), ps(1), and rummaging through /proc.


2

It stands for "Block Identification". 1* I general, using whatis can provide info about a command: whatis blkid A block (device) is a file that provides buffered access to hardware. E.g a hard-drive. Futher info: https://en.wikipedia.org/wiki/Device_file#Block_devices Each block device listed by blkid has a unique universal Identifier (UUID). blkid ...


2

Always Start Here When Buying A New Printer Start at the Linux Foundation Open Printing Project Database. Click Printer Listing. On the Printer Listing Page, choose Manufacturer: Brother, and Model: MFC-L8650CDW Click Show This Printer, and arrive at this results page Put the page in Step 1 in your Bookmarks, and do some more research... As you can ...


2

So you do not have tempfile (resulting in: command not found). Therefore your variable data is set to an empty string. When you try to redirect dialog ... 2> $data it tries to redirect stderr to a not existing value. And that is ambiguous. Your options are to change data=$(tempfile 2>/dev/null) to data="/tmp/mytmpfile" or to install tempfile by ...


1

I personally prefer using less to do this same thing. less your_file After starting less, the F command (not a command line flag) will begin to actively monitor the end of the file. While watching the end of the file in this mode CTRL-c will stop appending output to less and allow you to page around. Very handy.


1

I'm not aware of a utility that will do this. However, you could have a fair stab at implementing your own using the /dev/vcs* devices. The man page for vcs gives an example program that not only writes to a terminal screen via /dev/vcsN but also sets attributes via /dev/vcsaN. A trivial demonstration can be seen with the following sample shell code. Note ...


1

It depends upon the hardware connection between the disk drive and the computer. But if it is an USB 2, indeed it would be slow (whatever OS you use). The alternative could be to add a new hardware SATA drive, or to repartition your existing internal drive (to have some space for your Linux system). Perhaps you could repartition (& shrink the existing ...


1

Let me restate your question for clarity: You want to install a Linux distribution but you want to avoid needing to physically access the server. You cannot use alternatives such as the following: Dell's iDRAC or an equivalent from another vendor. These solutions provide out-of-band server management that works even when the server is not running any ...


1

Bonding was exactly what I needed, so I adapted this answer. I can backup both interfaces and designate the ethernet interface as the primary one. In fact I didn't want a different address for each interface. I thought I had to do it with different ones but the solution with only one address and automatic backup is exactly what I wanted. (I also tested with ...


1

I would use device bonding, meaning you are creating a new virtual device for which you assign the network settings (e.g. IP address, mask, etc.) and then you enslave both the ethernet and wifi interfaces to that interface. Something like: $ sudo modprobe bonding $ sudo ifconfig bond0 192.168.0.1 netmask 255.255.0.0 $ sudo ifenslave bond0 eth0 wlan0 ...


1

After experimenting with the BIOS settings I finally was able to get Linux to boot using WoL! Apparently I had to enable both Power On By PCI Devices and Power On By PCIE Devices for it to boot under Linux using WoL. To be sure that was the cause I tried all combinations. Just to be thorough I tried disabling them both to see whether that would make it ...


1

The following solution is based on nothing but xxd (one of the tools mentioned in the question), Bash and GNU sed. It assumes that the input consists of complete bytes (groups of eight letters), arbitrarily separated by newlines. The approach is: Strip all newlines. Group letters into four-letter groups terminated by spaces. Filter these quadgraphs into ...


1

For popular software you will usually find other users who provide ready to use packages for your distro. Example: https://launchpad.net/~thomas-schiex/+archive/ubuntu/blender Anything you install should go through the package manager in any case, so you can keep track & get rid of its files in the future. If you just unpack a binary tarball somewhere ...


1

Maybe like this: sed -E ' 1{ h; d; } /^[^ \t]/{ h; s/.*//; p; d; } s/^[ \t]+;//; G; s/^(.*)\n(.*)$/\2\1/' Output: L12194C;1;8;12 L12194C;2;30;46 L12194C;3;49;71 L12194C;4;0;0 L12194C;5;0;0 L12194C;6;1;3 L15698A2;4;2;4 L15698A2;5;0;0 L15698A2;6;0;0 L2281A2;4;1;2 L2281A2;5;0;0 12302C;1;8;11 12302C;2;1;1 12302C;3;1;1 12302C;4;1;2 12302C;5;2;4 ...


1

use AWk : awk '!/^[[:blank:]]/{j=$1;print "";next}{print j$1}' FILENAME output: L12194C;;1;8;12 L12194C;;2;30;46 L12194C;;3;49;71 L12194C;;4;0;0 L12194C;;5;0;0 L12194C;;6;1;3 L15698A2;;4;2;4 L15698A2;;5;0;0 L15698A2;;6;0;0 L2281A2;;4;1;2 L2281A2;;5;0;0 12302C;;1;8;11 12302C;;2;1;1 12302C;;3;1;1 12302C;;4;1;2 12302C;;5;2;4 12302C;;6;0;0



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