Tag Info

New answers tagged

1

More info: xrandr --output eDP1 --mode 1366x768 --output HDMI1 --mode 1920x1080 --same-as eDP1 Then this: xrandr --output HDMI1 --pos -277x-156 seems to do EXACTLY what I want. EXCEPT only with my laptop lid left open. Closing the lid seems to reset everything :( Even lifting the laptop lid again, it doesn't remember the previous setting. I have to ...


0

As it was already mentioned in the comment, by default the target triplet is generated by config.guess script. It's logic is fairly simple. First it uses uname to get some basic system information: UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) ...


1

Yes. Recoll can regularly index your files and provide a search via your browser. It can search within files too. Recoll is a full-text search tool for Unix and Linux desktops. Recoll finds keywords inside documents as well as file names. It can search most document formats. You may need external applications for text extraction. It can ...


0

You have to reorder the iptables rules. You can't connect to your sshd because the rules are checked in line for line. And you already told iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset = reject ALL tcp traffic. Even you later tell him to accept connections to port 5000 it doesn't matter - you already rejected those connections. So when you ...


0

You can use rsync to backup the entire system. rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /* /path/to/backup/folder There's a awesome article at Arch Linux Wiki about it


0

If you are on Linux try to create the USB using dd. If you are on Windows use USBWriter


2

I would keep it simple and clone it. Boot a live system from USB (easiest is Ubuntu from a USB thumb drive, I find), then dump your hard disk to a different partition (or external hard drive etc.), e.g. dd if=/dev/sda1 bs=64M of=/mnt/my_mounted_backup_drive/backup-sda1 where you need to replace /dev/sda1 with your root (/) partition. Do the same with ...


0

Pipe the output to ts(1) of moreutils among other such similar utilities, which prefix any input with a time stamp: % (echo hi; sleep 3; echo there) | ts Aug 28 18:52:42 hi Aug 28 18:52:45 there % So assuming you want timestamps on just standard error: ...archive.sh 2>&1 >>.../out.log | ts >>.../err.log Note that this is really ...


-1

How about using rsync or rsnapshot to essentially backup the local machine? Once you test is done, simply restore the backup. http://rsnapshot.org/ http://www.mikerubel.org/computers/rsync_snapshots/ Similarly, you can use LVM: http://www.tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html


0

Well, it's more of a journald log than a systemd log, here's what journalctl says about vacuum size: journalctl(1) wrote: --vacuum-size=, --vacuum-time= Removes archived journal files until the disk space they use falls below the specified size (specified with the usual "K", "M", "G", "T" suffixes), or all journal files contain no ...


0

Wget can be used in different ways, but I assume you are using it to emulate a browser making an http(s) request based on the PHP content. There is no way to make wget resume a session that was interrupted. The web server wget is interacting with is stateless, so there is nothing there to keep track of exactly what was happening in a session that was ...


0

I can't add this as a comment to the above answer, so in favor of all who encounters this I'd like to mention that: In order to make the change permanent, unlike the above answer, you may need to add: fs.inotify.max_user_watches=$<INSERT-VALUE> To /etc/sysctl.conf file $: sudo echo "fs.inotify.max_user_watches=$<INSERT-VALUE>" >> ...


0

I managed to solve this myself with some time and effort so ill post my solution here in hopes that it will save someone some time in the future. ssh -o ProxyCommand="nc -X connect -x '<proxy ip>:<proxy port>' %h %p" root@<remote ip> This is the command that im now using to SSH onto my server through my proxy. If you wish to use the same ...


0

Late answer, but it might help someone. If you have a recent version of GNU sort (from GNU coreutils 7.0 or later), you can use the --version-sort (or -V) option, which will do the right thing with IPv4 addresses. Assuming input of: add method1 10.1.2.3 other thing add method2 10.10.20.30 other thing2 add method2 10.1.2.3 other thing2 add method5 10.2.8.9 ...


0

A single block device cannot be mounted, read or written by 2 or more systems simultaneously, so using a USB drive as shared storage is not appropriate for your purpose. You might want to set up a diskless system based on NFS which allows to share the file system on a per-file basis among multiple hosts. Here's mini howto using prebuilt image of full (but ...


0

For Debian: On my PC ~ > dpkg --print-architecture amd64 ~ > dpkg --print-foreign-architectures i386 My Raspberry Pi 2 ~ > dpkg --print-architecture armhf


0

How are received bytes stored? From the user space's point of view, they are not stored at all. How to read them? If you mean only to read them, simply cat /dev/ttyS... will do. Some more information as to how to deal with serial interfaces can be seen in multitude of answers and comments in this page and in the internet in general withing seconds of ...


0

The original file is actually Newline delimited JSON (NDJSON). Instead of using GNU tools, I recommend installing json from NPM. # say the file is test.log $ json -f test.log -g [ { "a": 1, "b": 1, "c": 2 }, { "a": 3, "b": 3, "c": 1 }, { "a": 1, "b": 2, "c": 3 } ]


0

Pure bash: while read line do echo "$line," done < <(head -n-1 testfile) echo `tail -n1 testfile` This script appends ',' to every line except the last, and then prints the last line unchanged.


2

You can use sed: sed '$n;s/$/,/' file The $n; means if it's the last line just continue. Else it adds a , at the end of the line. If you add the -i flag (not POSIX) the file will be edited inplace. If it must be awk: awk 'NR>1{print p} {p=$0","}END{print}' file1 Stores the content of the line in a variable p. The variable is printed, except in ...


0

How about in perl: #!/usr/bin/perl use strict; use warnings; use JSON; my $json_list; while ( my $json_str = <> ) { push ( @$json_list, from_json ( $json_str ) ); } print to_json ( $json_list, { pretty => 1, canonical => 1 } ); Takes data on STDIN or myscript.pl somefilename and takes the input you've designated, and builds a JSON ...


1

You can use awk: awk 'NR > 1{print line","}{line=$0;}END{print $0}' jsonfile


2

This script copies the ip address from field 3 using awk to the start of the line with a "%" separator, then does the sort on the ip address now in the first field, then removes the added part. awk '{print $3 " % " $0}' | sort -t. -n -k1,1 -k2,2 -k3,3 -k4,4 | sed 's/[^%]*% //' If the field with the ip address is not a constant, you can auto-detect it on ...


0

This is expected, make sure you understand the -t option (man sort: field separator). The command you wanted to use deals with plain ip addresses only. A quick and dirty solution might be to convert the spaces into dots . the file first and then sort (you may want to undo the conversion later, excluding the IP addresses) sed -i.bak 's/ /./g' data.log ...


0

Perhaps you can try by right-clicking on the network icon and then clicking on "Edit Connections". A list of all internet connections will show up. Then, edit you Ethernet Connection and change the security settings and add some username and password as shown in the screen-shot: Try different authentication methods. We don't know which authentication ...


2

When the shell parses a command line, it removes quotes but remembers the text structure that they imply.  (That is a gross oversimplification; see bash(1) or Shell Command Language for more details.)  For example, the command-line input -blah apple -secondfruit "green banana" -some more causes the shell to identify six words, or tokens: -blah apple ...


2

Consider a simpler example to see the difference: $ set "a b" c "d e" $ printf "%s\n" "$@" a b c d e The preceding is what you should use; it's simple, easy to understand, and correct. $ printf "%s\n" "$(echo $@)" a b c d e Here, $@ first expands unquoted (the quotes surrounding the command substitution are separate and not yet applied), so it's ...


3

For the third version, you want "$*" not "$@". Explanation To illustrate, let's set some positional arguments: $ set -- arg1 arg2 arg3 Now, let's read them out with your echo formulation: $ printf "%s\n" "$(echo $@)" arg1 arg2 arg3 Let's see what "$@" does with them: $ printf "%s\n" "$@" arg1 arg2 arg3 The difference is that "$@" expands to three ...


1

The easiest solution is to provide a ntp-servers optino in your dhcp leases: subnet 192.168.10.0 netmask 255.255.255.0 { option routers 192.168.10.1; option ntp-servers 192.168.10.1, 192.168.10.50; BLAH BLAH } By default debian's ntp package comes with a dhcp-exit hook that adds ntpservers listed in the dhcp lease to the ntp.conf.


0

I've been pleased with symon, which collects data about network interface usage (as well as other metrics like CPU and memory usage) and displays them in a web interface. Here's an example showing traffic for one network interface for the past week: Symon makes it very easy to monitor multiple network interfaces. Your situation might look like this: ...


0

socat is a tool to connect (nearly) everything to (nearly) everything. In your usecase you could connect your serial port /dev/ttyS0 to a PTY /tmp/ttyV0, then point your application to the PTY, and have socat tee out Input and Output somewhere for you to observe. Googling "socat serial port pty tee debug" will point you to several examples, one being: $ ...


1

After a discussion with Jeff Schaller, I just added a simple init.d script called set-gateway-as-ntp which runs before ntp and adds the gateway address to /etc/ntp.conf: #! /bin/sh ### BEGIN INIT INFO # Provides: setgatewayasntp # Required-Start: $network # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # X-Start-Before: ...


0

We went with cgroups in the end, since there really doesn't seem to be any other approach that would accomplish this. Cgroups allow CPU utilization limiting through the kernel scheduler, using cpu.cfs_period_us and cpu.cfs_quota_us. This avoids the explicit specification of CPU cores.


1

My best suggestion would be to use netplug - http://www.red-bean.com/~bos/ Just use this to run ip link set eth0 down when the cable is unplugged. And the reverse when it comes back up. This is fine for a machine which is purely a router. But if the machine has other services, then these services would have to be bound to internal IP addresses.


4

POSIXly: find /test/. ! -name . -type d -mtime +0 -exec rm -rf {} \; -prune (we use -prune for the directories that we successfully remove so that find doesn't complain that they're suddenly gone). In any case, note that the modification time (as checked by -mtime above) of a directory file only reflects the last time an entry was added, removed or ...


0

If LFS is too tough for you, you can go with archlinux. It is great for learning how to set up your own customised system. It doesn't come with any configuration, you are the one who configures everything. And they have an awesome wiki that explains everything. If you want to go beyond customising just the config files, there ABS (Arch Build System) which ...


0

You are, most likely, abusing lxdialog. That is supposed to be used only together all other configuration stuff. If You really need a configuration tool to be used at compile time (i.e.:"make menuconfig && make all") then you will find documentation to make kconfig work for you in kernel/Documentation/kconfig directory (and other places, but You ...


0

You can try remastersys tool(I have tried this tool in ubuntu). Most of the time remastersys is used to create backup of current OS and data. This tool will create .iso file, which contains current snapshot (currently installed packages) of OS installed on your machine and you can install the created OS on other machines. Steps to install and use ...


0

find /test -type d -mtime +1| egrep -v '^/test$'|xargs -I{} rm -rf {}


0

touch -t 201508260000 dummyfile find /path/to/files -type f ! -newer dummyfile -delete Timestamp format yyyyMMddhhmm The first line creates a file which was last modified on the 26th August 2015. The second line finds all files in /path/to/file which has a date not newer than the dummyfile, and then deletes them. If you want to double check it is working ...


1

Well, the -mmin primary is a GNUism that is most likely not supported on AIX as it is a silly expansion compared to what the BSD people and I used as extension in the 1980s already. Given the fact that sfind compiles fine on AIX, I recommend: sfind . -mindepth 1 -type d -mtime +24h -exec rm -rf {} + The code is in schilytools at: ...


1

You can create a recursive script. eg in file /tmp/run #!/bin/bash depth=${1:-5} f(){ let depth-- if [ $depth -gt 0 ] then $0 $depth else sleep 10 fi } f then chmod +x /tmp/run and do /tmp/run 10.


1

As @meuh said in his comment, you could use /test/* instead of /test. Your command could then look similar to this: find /test/* -type d -mmin +1440 | xargs rm -rf In this case only the subfolders of /test would be removed.


0

I'd suggest to write some script/small program that employs XML parser. Then you can count records as they getting parsed and filter out only the stuff you need.


0

I booted the installation media optional to uefi and I was able to install opens use easily :-)


2

The simplest way is to run: getconf LONG_BIT which will return 64 or 32 depending on whether it is 32 or 64 bits. eg: dannyw@dannyw-redhat:~$ getconf LONG_BIT 64


2

Each loaded module has an entry in /sys/module. But there are also kernel components with an entry in /sys/module that are not loaded as modules. Each kernel component that can be built as a module has an entry in /sys/module, whether it is compiled and loaded as a module or compiled as part of the main kernel image. lsmod gets the list of loaded modules ...


1

The issue is fixed now. seems to be an issue with Discourse SSH container configuration, In /etc/ssh/sshd_config PermitRootLogin without-password I've changed it to PermitRootLogin yes #PermitRootLogin without-password That fixed the issue.


0

You should use code markup for pasting in a log file, but from what I can tell: sshd[32711]: debug1: PAM: password authentication failed for root: Authentication failure Aug 26 20:32:29 Seems relevant. Are you sure you are using the correct password for the root user of your docker image? Also, did you restart the sshd service (in the docker image) so ...



Top 50 recent answers are included