Porting jvm into the kernel space?

Currently I am playing with the idea of a jvm running in the kernel space, as a (maybe linux) kernel module. I see a lot of advantage of the idea. Of course the biggest advantage of a such system were the major simplification of the kernel space development. But it happened because different aspects: 1) every java developer with a relative minor lowlevel knowledge were able to develop a kernel module. Yes, it is't surelly a good possibility :-), especially if we see the current code quality of most opensource java userspace projects, but... there isn't a need to happen the same in the kernelspace as well. 2) (And it is the really intended goal): a JVM could solve the greatest problem of the kernel development, and it is the lack of the memory protection. A binary code segment compiled from java never caused any harm to data structures out of its scope, if there isn't another problem (f.e. jit compiler error or lowlevel hw problem), although the runtime safety checks of a such binary code caused a well measurable drawback in speed. First, it doesn't need to be a java bytecode interpreter as well. A JIT (just in time compiler) could exist on the system user space, mapping only the compiled binary files (practically: kernel modules) in the kernel space. Only the namespace manager and the garbage collector need to run in kernel space. Second, it doesn't need to be big, slow and monstrous. It is because the big, ineffectively used libraries in the case of the userspace jvms, and there is no ground for the same in case of, for example, _a driver written in java_. The only fallback which I can see were with the realtime functionality. Of course it were much harder to do with java, because we have much fewer control on the minor details of the memory management. What about I am curious, if a such project already exists (?#1), and are there any visible major fallbacks about this if not (?#2).


Multibooting FreeBSD and other Linux distros

Long story short: Have one laptop, need to multiboot FreeBSD/OpenBSD as well as a number of Linux distros. Which one do you think should go first? FreeBSD offers a bootMgr, but I'm not sure how it relates with GRUB. How am I supposed to make the partitions knowing that a harddisk can take up to four primary partitions, perhaps make one primary, one extended and make logical partitions? If so, how to do that with `fdisk` because the options aren't very clear about that.


Is an LXC guest load average the same as the host's load average?

If I run `top` on the guest, the load average values seem to be exactly the same as running `top` on the host. Is a Docker (LXC) guest's load average the same as the host's load average?


Filtering on dates with grep and awk

I have created the alias below in my `.bash_aliases` file               alias auth="grep \"$(date|awk '{print $2,$3}')\" /var/log/auth.log |                 grep -E '(BREAK-IN|Invalid user|Failed|refused|su|Illegal)'"      This is supposed to:   * check todays date   * grep `auth.log` for todays messages   * grep todays messages for warning messages matching particular strings However, it only works when there's a 2-digit day because days numbered <10 do not have a preceding zero. For example, I run `date` and pipe the result to `awk`. `date` outputs `Sat Jan 1 04:56:10 GMT 2011` and then awk captures `$2` and `$3` and feeds them into grep as follows               Jan 1      However, when there's a single digit day, messages in `auth.log` appear as follows               Jan  1 00:44:57 linux su[21249]: pam_unix(su:session): session closed for user root      So there are two spaces following `Jan` in the `auth.log` but only one space following `Jan` in my grep command How can I modify the command to allow for the additional space?


How to build a cross-distro binary RPM package?

I'm trying to build a cross-distro binary RPM package that works under Fedora and openSUSE. I'm using a `Require:` tag to set the dependencies package names. The problem is that the package names are different in each GNU/Linux distro repo. Reading: http://goo.gl/3MXSq, and using '%if 0%{?suse_version} ' statements give a cross-distro .spec file. That is, the list of deps will be determined at build-time not install-time. Is there a way to set a conditional list of deps inside a binary RPM package?


Where should I copy-paste-install software to?

I'm installing IntelliJ, and the readme tells me to choose an installation folder. Where is a good, standard place to put installed programs?


Is it safe to rm -rf /tmp/*?

This is something I used to do a lot on Windows, but after my recent fiasco I want to make sure. Is it safe to do               sudo rm -rf /tmp/*      ?


I can't kill xfwm4

$ ps aux | grep xfwm     xralf  4365  1.2  0.4  19888  9444 ?        S    10:45   0:00 xfwm4 --replace --display :0.0 --sm-client-id 204399537-7a38-4196-8c31-43cf2f3542ac     xralf  4369  0.0  0.0   3324   788 pts/0    S+   10:45   0:00 grep --color=auto xfwm      after `$ kill -9 4365`               $ ps aux | grep xfwm     xralf  4379  0.4  0.4  20632  9976 ?        S    10:47   0:00 xfwm4 --replace --display :0.0 --sm-client-id 204399537-7a38-4196-8c31-43cf2f3542ac     xralf  4381  0.0  0.0   3324   788 pts/0    S+   10:47   0:00 grep --color=auto xfwm      Is it possible to kill `xfwm4`?


How to run the file-copy dialog of thunar, or anything similar to use?

I'm trying to create a Send To menu for thunar, which copies a file (%F) to a fixed location. In KDE4 I could use `kioclient copy` command, but what about other environment? Does thunar has something similar or is there any other file copy dialog I can use?


Installation script needs to be run as a certain (regular) user but needs to create a system directory

I'm new to Linux, let me explain the issue. I'm trying to install `comsol` with some sort of network license. If I use `sudo ./setup` the server directory does not recognize the username "root". The server recognizes my username which is zahir. If I just write `./setup` the installation passes the license check stage but can't proceed since it cannot create directory in `/usr/local`. What command should I use so that the installation runs as `zahir` but with root privileges?


Capturing key input from events device and mapping it (toggle TouchPad key is unmapped)

I have a Lenovo IdeaPad Yoga 13 with Ubuntu 13.10 Installed. The device has a "Toggle TouchPad" button on the keyboard (`F5`). The keyboard's `F*` buttons are reversed (so to get `F5`, I need to press `Fn` \+ `F5`, and `F5` is actually the toggle key). I've found out that the button is actually read by the keyboard (rather than the TouchPad like certain devices), which is at `/dev/input/event3`. So using `sudo input-events 3` I was able to figure out that the button sends the scan code 190: Output of `sudo lsinput`:               /dev/input/event3        bustype : BUS_I8042        vendor  : 0x1        product : 0x1        version : 43907        name    : "AT Translated Set 2 keyboard"        phys    : "isa0060/serio0/input0"        bits ev : EV_SYN EV_KEY EV_MSC EV_LED EV_REP      Output of `sudo input-events 3`:               23:13:03.849392: EV_MSC MSC_SCAN 190     23:13:03.849392: EV_SYN code=0 value=0     23:13:03.855413: EV_MSC MSC_SCAN 190     23:13:03.855413: EV_SYN code=0 value=0      No other programs (such as `xev`) seem to be able to read it except for `input-events`. Is there any way to map this button to make it toggle the TouchPad on my laptop? If so, how can I do so?


Viewing virtual memory usage

I started 700+ threads from a single program And my `/proc/[PID]/status` file shows the following output.               VmPeak:  7228104 kB     VmSize:  7228104 kB     VmLck:         0 kB     VmHWM:      3456 kB     VmRSS:      3456 kB     VmData:  7222340 kB     VmStk:        88 kB     VmExe:         4 kB     VmLib:      1540 kB     VmPTE:      2864 kB     StaBrk: 15e84000 kB     Brk:    15ec6000 kB     StaStk: 7fff765095a0 kB     Threads:        706      But I'm having only 2gb RAM and 4gb swap space. Can somebody tell me how did the Virtual Memory get to 7gb+?


How to define a minor mode that uses specified input-method in Emacs

I want to use korean characters in Emacs, so I installed hangul.el. I can activate input-method by '(set-input-method "korean-hangul")'. And I want to define a mode that have the `korean-hangul' input method. I only know how to define a minor mode with a defined map-key like this. `(easy-mmode-define-minor-mode korean-mode "Mode for korean" nil " 한" korean- mode-map)` But I don't know how to connect a input-method and a minor-mode. I'll add add some key-bindings to the `korean-mode`. How can I define a mode like this `korean-mode`?


The curous incident of the missing ppa.ko in debian 3.11 kernel?

Ok. Running a version of LDME with a kernel of 3.11-2-amd64 ( basically debian testing). Suddenly with the installation of this particular kernel the module ppa.ko is gone. Further an `apt-file search` shows that this module does not exist. Anyone know what is happening?


What's the right way to set Linux kernel runtime parameters?

What's the prescribed way to set Linux kernel runtime parameters? I've seen sometimes that people will set these in files such as `/etc/rc.local`. Is this really the right way to do this?


Could not resolve host error

I'm using Arch Linux and I have a dynamic ip address with the use of dhcpcd. I can access websites through the google chrome but the problem is that I get 'could not resolve host' error when I run some commands on the terminal (like git clone). I've tried pinging github.com and doing nslookup and it returns the correct ip. Any ideas?


How to terminate a background process in Linux when the pid is unknown?

I have a job dispatcher bash shell script containing below codes:               for (( i=0; i<$toBeDoneNum; i=i+1 ))     do         while true         do                 processNum=`ps aux | grep Checking | wc -l`                 if [ $processNum -lt $maxProcessNum ]; then                     break                 fi                 echo "Too many processes: Max process is $maxProcessNum."                 sleep $sleepSec         done         java -classpath ".:./conf:./lib/*" odx.comm.cwv.main.Checking $i     done      I run the script like this to be in the background:               ./dispatcher.sh &      I want to terminate this dispatcher process with kill -9. But I didn't record the pid of the dispatcher process at the first time. I used jobs, jobs -l, jobs -r and jobs -s. Nothing showed. Even this fg cannot bring the process to foreground.               fg     bash: fg: current: no such job      But I think this dispatcher process is still running because it still continues to assign java program to run (already used top and ps -ef to check). How should I terminate this job dispatcher bash shell script process?


two if conditions in for loop bash scripting

I've trying to make two if conditions in for loop. Is it possible this? Now doesn't return anything from second `if` only two `OK` from first `if`.               #!/bin/bash     servers=("212.39.82.157" "212.39.82.157" "1.1.1.1")          for i in "${servers[@]}"; do          ping -c 1 $i > /dev/null        if [ $? -eq 0 ]; then          echo "OK"         fi            if [ $(netstat -na | grep ':3708' | grep ESTABLISH | wc -l) -eq 2 ]; then          echo "NOT - OK"       fi     done      For third `IP`in the list must return `NOT - OK` since is not online. But the output is this               root@ubuntu:~$ ./check.sh     OK     OK     root@ubuntu:~$      What I missing here? UPDATE:                #!/bin/bash     servers=("212.39.82.157" "212.39.82.157" "1.1.1.1")          for i in "${servers[@]}"; do          ping -c 1 $i > /dev/null        if [ $? -eq 0 ]; then          echo "OK"         fi     done       if [ $(netstat -na | grep ':3708' | grep ESTABLISH | wc -l) -eq 0 ]; then          echo "NOT - OK"       fi      If I put it outside for loop it must work?


home-built router - slow throughput

I am having slow performance with my home-built router. Compared to a stock Verizon (actiontec) router, it gets about 60 Mpbs down and 30 Mpbs up whereas I get about 15 Mbps and 20 Mbps up. I switched out my home-built router (an old laptop computer) for a desktop and the performance dropped to 2 Mbps down and 10 Mpbs up all the time whereas the laptop seemed to be consistently faster with the occasional slow-down. Now, I am doing traffic shaping; however, that shouldn't be the dominant problem. With the laptop, I still randomly did get 2 Mbps down randomly so I'm not sure if it is hardware or software (configuration). They share the same hardware (when testing, I used a USB ethernet adapter since both devices come with 1 onboard NIC). It _could_ be a faulty NIC (the USB ethernet adapter), but it could more likely be configuration. When capturing traffic with wireshark/tshark, I see a bunch of duplicate ACKs and TCP retransmissions. That could indicate bad wiring, but if I'm using that same cable for outbound traffic, that likely is not the issue. I also later measured bandwidth on the cable and found it to be 97.2 Mbps (one NIC is only 10/100). It could be a faulty NIC (the USB ethernet adapter), but why would I still get more performance on the laptop with it?


Consistent (physical) volume on set of files (volume normalization)

If I have, say, 20 music videos (`.flv` and `.mp4`), is there a way to play them in mplayer (mplayer2) without having to change the volume for each video, instead specifying a desired general volume, and having mplayer adjusting automatically whenever necessary? **Edit** : Possibly this is called "volume normalization". By the way, I'll accept any solution for this, or even a description what is required. I use mplayer at the moment, but, if you solve this with, say, a microphone, a script, and vlc, that will be great. **Edit 2** : This is close to, but not quite "volume normalization": check out my comment to David Kohen's answer below.


SSH asks password when outside .ssh/ but not when inside .ssh/

This is the strangest I've ever encountered and I have no idea how to fix it. I have many entries in my `.ssh/config` file because I use a number of keys. When I `ssh` and I am located outside my `.ssh` folder I get prompted for a password (key was passwordless). When I `cd` to my `.ssh` folder, same command `ssh {alias}` connects directly as expected (doesn't ask for password). Do you have ANY idea why this could be happening?


How can I work around the program failing if there is *any* stdin?

For example, the following works fine:               /usr/bin/program      It produces some output, and gets to result. But if I invoke it like this:               echo -n | /usr/bin/program      or this               echo -n | bash -c "/usr/bin/program"      or even this:               echo -n | bash -c "wc -c; /usr/bin/program"      It produces some lines of output, then fails. I have no access to source of the program, so I can't even look what could cause this behavior. And when I try to invoke it from the python script, I get the same stuff:               echo | python -c 'from subprocess import call; call("/usr/bin/program", shell=True)'      (version without "echo" prepended works fine) I don't even have the faintest idea why that could be happening. Stdin is going to be open even if I don't explicitly specify where the program should read from, so that shouldn't be the cause. Is there any way to work around this issue? **EDIT:** The last four lines from `strace` output - the only ones that differ:               # without echo     select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)     select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)     select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)     select(1, [0], NULL, NULL, {0, 0})      = 0 (Timeout)     ...          # with echo     select(1, [0], NULL, NULL, {0, 0})      = 1 (in [0], left {0, 0})     write(4, "\0\0\0j\0\0\0\3\0\0\0\4\0\0\0\0\377\377\377\377", 20) = 20     write(3, "\0\0\0j\0\0\0\3\0\0\0\4\0\0\0\0\377\377\377\377", 20) = 20     exit_group(1)                           = ?      **PARTIAL SOLUTION:**               sleep 20 | /usr/bin/program      Seems that `program` waits for something to happen at stdin, and exits if it encounters a newline or EOF (we can see it from `select` call in strace output - it timeouts if input comes from "real" user). So we needed a program that doesn't write anything to stdin, while still keeping it open - `sleep` does the job.


gnuplot shell variable substitution and arrays

I need to use shell variables in my gnuplot commands, for which I'm using the here document style. I also need to use loops inside the gnuplot code. Both these things are working. Now -- I want to use a gnuplot for loop's index to access a shell array variable. This is where I've been stuck all day. I have something like this:               for ((i=0; i<=10; i++))     do     var[$i] = i*10     done          gnuplot<<EOF     do for [j=1:10]{     #need to access ${var[j]} somehow     val=sprintf("${var[%d]", j) ##doesn't work     }     EOF      Individual access like ${var[1]} works. I suspect this may need using backquotes and/or expr, but am not sure.


adb connection problem on Kubuntu 13.04 x64

I'm facing a problem with ABD connection under Kubuntu 13.04 x64. Every time I try to push/pull/shell ls the adb disconnects from device. I tried the following solutions:   1. Added device ID into .android/adb_usb.ini but nothing helped   2. Added new udev rule and also nothing helped   3. Flashed the ROM and nothing helped   4. I re-installed my Kubuntu 13.04 x64 Some notes :   * USB Debugging activated   * Device is Prestigio PMP5080BRU (Rooted) - Android Gingerbread 2.3.1   * I'm using the latest Android SDK available on official web site   * The ADB works very well on Windows 7 x64   * Even when ADB disconnects, I still can see device via **lsusb** command   * ia32-libs already installed on the system   * jdk and jre installed on the system and works as expected   * Paths configured and working properly   * ADB works as expected with my Samsung Galaxy S II (Jelly Bean 4.1.2 - Stock)   * I put my question here, because it seems I got a problem in Linux, as my other device works on Kubuntu dmesg :               [ 5571.640498] usb 3-2: new high-speed USB device number 13 using xhci_hcd     [ 5571.657013] usb 3-2: config 1 interface 1 altsetting 0 bulk endpoint 0x83 has invalid maxpacket 64     [ 5571.657426] usb 3-2: New USB device found, idVendor=0bb4, idProduct=0c02     [ 5571.657433] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3     [ 5571.657436] usb 3-2: Product: rk2918     [ 5571.657439] usb 3-2: Manufacturer: RockChip     [ 5571.657442] usb 3-2: SerialNumber: 0123456789ABCDEF     [ 5571.664067] scsi13 : usb-storage 3-2:1.0     [ 5572.659163] scsi 13:0:0:0: Direct-Access     PMP5080B                  0100 PQ: 0 ANSI: 2     [ 5572.659453] scsi 13:0:0:1: Direct-Access     PMP5080B                  0100 PQ: 0 ANSI: 2     [ 5572.661211] sd 13:0:0:0: Attached scsi generic sg2 type 0     [ 5572.661525] sd 13:0:0:1: Attached scsi generic sg3 type 0     [ 5572.662492] sd 13:0:0:0: [sdb] Attached SCSI removable disk     [ 5572.662947] sd 13:0:0:1: [sdc] Attached SCSI removable disk      Any one got an idea? Regards,,,


bash script selecting the last path variable

Hey all i am writing my first bash script. and i am making it install all the repos i have on github.               warpInLocations=("git@github.com:acc/toolkit.git" "git@github.com:acc/sms.git" "git@github.com:acc/boogle.git" "git@github.com:acc/cairo.git")      so those are them so when i install them               echo "warping in toolkit, sms, boogle and cairo"     for repo in "${warpInLocations[@]}"     do       warpInDir=$(echo ${warpToLocation}${repo} | cut -d'.' -f1)       if [ -d "$warpToLocation"]; then         echo "somethings in the way.. $warpInDir all ready exists"       else         git clone $repo $warpInDir       fi          done      this line here i wanted it to give me a folder named toolkit or sms so after the / and before the . in the warp in locations but its selecting git@github instead i guess because its after the . how can i get it to select the name in the repo??


64bit rpm can not resolve 32bit dependencies

**Problem** I'm having a RPM that contains mixed 64bit and 32bit binaries. One of the binaries depends on 32bit i686 packages. When I try to install the package yum gives me an error, noting that the package requires the 32bit packages. However when I just try to install the required packages myself it works flawless. **Details** In my spec file I have               Requires:       glibc.i686 libstdc++.i686 device-mapper-libs.i686 lshw      When I try to install the package on a CentOS 6.3 system I get:               # yum update gamigo-kvm-tools     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile     Setting up Update Process     Resolving Dependencies     --> Running transaction check     ---> Package gamigo-kvm-tools.x86_64 0:0.0.7-4 will be updated     ---> Package gamigo-kvm-tools.x86_64 0:0.0.9-4 will be an update     --> Processing Dependency: libstdc++.i686 for package: gamigo-kvm-tools-0.0.9-4.x86_64     --> Processing Dependency: glibc.i686 for package: gamigo-kvm-tools-0.0.9-4.x86_64     --> Processing Dependency: device-mapper-libs.i686 for package: gamigo-kvm-tools-0.0.9-4.x86_64     --> Finished Dependency Resolution     Error: Package: gamigo-kvm-tools-0.0.9-4.x86_64 (gamigo-CentOS-6-x86_64-liv)                Requires: libstdc++.i686     Error: Package: gamigo-kvm-tools-0.0.9-4.x86_64 (gamigo-CentOS-6-x86_64-liv)                Requires: device-mapper-libs.i686     Error: Package: gamigo-kvm-tools-0.0.9-4.x86_64 (gamigo-CentOS-6-x86_64-liv)                Requires: glibc.i686      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest      However when I manually install the referenced packages, I get               # yum install libstdc++.i686 device-mapper-libs.i686 glibc.i686     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile     Setting up Install Process     Package libstdc++-4.4.6-4.el6.i686 already installed and latest version     Package device-mapper-libs-1.02.74-10.el6.i686 already installed and latest version     Package glibc-2.12-1.80.el6_3.5.i686 already installed and latest version     Nothing to do      I don't quite understand why the Error occurs and what it's trying to tell me. I see that it's only occurring for the 32bit packages as the fourth required package 'lshw' seems to be no problem. Is there a special specfile syntax to reference 32bit packages?


Can I assert that a Wi-Fi AP with a higher "quality" will be better in most cases?

I have an application on Raspberry Pi that needs to determine which available Wi-Fi access point to use, with their statistics collected by `iwlib` beforehand. `iwlib` or `iwlist` has three indicies for each Wi-Fi access point: "quality", "signal level", and "noise level". By saying a Wi-Fi access point is "good", I am talking about a high success rate in transmission. My question is: Is it safe to assume that one access point with a higher "quality" is mostly likely to be better than one with a lower "quality" value?


Ending Process Infinite Loop Input Redirection

Edit: I realized that the program I was trying to run had an infinite loop after scanning all my input. Then just prints out infinitely so it'll never read the EOF. It'll read the last input then go into an infinite loop For example let's say the program is something like this.               printf("%c\n", getch());     while(1)     {        printf("%c\n", getch());     }      Is there a way to kill the program after reading in all my input? I want to be able to kill the program when it finishes redirecting the input file. (When the program gets the last character from the input file) Note: I cannot modify the program I'm running but I can modify the script that runs this program. Right now I have this in my script to run the program. Basically this helps me combine/merge input + output together. EDIT: Someone helped me with solving my earlier problem. I was suppose to add || break to this strace but I have a new problem which is in the edit at the top.               mkfifo strace.fifo     {       while read -d, trace; do         if [[ $trace = *"read(0" ]]; then            IFS= read -rn1 answer <&3 || break            echo "$answer" >> in            answer=${answer:-$'\n'}            printf %s "$answer" >&2            printf %s "$answer"         fi       done < strace.fifo 3< input | strace -o strace.fifo -e read stdbuf -o0 ./a.out &     } >> $fname.out 2>&1      So right now I have a really hacky way of trying to end the program by using sleep and killing the program. Also I'm checking the input used so far and comparing it with the input file. This is just a small example of what I'm doing my current script has multiple timer and if comparisons similar to the code below. However this way is not a good way because if the program isn't done reading the input file after whatever second I put it won't kill the program. In my real script I used multiple of these if statements and it works like 80% of the time but sometimes it won't do the right thing probably because of the timer and the fluctuation of the way the program runs.               sleep .05     awk 'BEGIN{ORS="";} NR==1{print; next;} /^[^ ]/ { print; next; } {print "\n";}' in > temp     diff -w -B temp input > /dev/null     # Check if input done yet     if [ $? -eq 0 ] ; then        # Check if program still running and input done        if [ "$(pidof a.out)" ] ; then           killall -15 a.out > /dev/null 2>&1        fi     fi      So I'm wondering is there a way to `kill` the process in the `strace` after input is done? Also I want to be able to keep input and output merged together.


How to copy multi-page text from the terminal into the clipboard?

I was viewing a **man** page for a software on my machine and I needed to copy-paste some of that text but the text was much more than one page. I'm aware I can direct the output to a file and use UI based software such as **gedit** to copy the text I need. But can this be done from the terminal ? **Joseph** suggested a command line method (Little bit complicated to me, I'm not yet good with regular expressions on Linux). But I'm wondering if there is a way to do so while I'm still on the terminal, **using the mouse**. I hope I get a generic answer, however, I'm using Ubuntu.


Reading from a serial interface

I have a serial device running which I need to read data from(I have absolutely no control over the device itself) except reading its output; using hyper terminal in Windows I am able to detect a meaningful traffic and yesterday when I used cat (or my own little C program to read the data and print it to stdout) it worked fine. Today, when I use cat/my program all I get is a sort-of corrupted data, yet hyper terminal still shows the data. What could possibly be wrong? how could it have worked yesterday but not today? The file I am/was reading is `/dev/ttyUSB1` *Please note that I am never running BOTH my program and cat, only one of them at a time.


"Multipass" scripted modification of large file in-place (file-system level)?

I have just came to the problem of having to cut some lines from a large (gigabyte) sized file, and being aware of potential CPU hog trying to read it in memory, I wanted to edit it in-place instead... and so came upon these questions:   * How do I remove certain lines (using line numbers) in a file?   * Is there a way to modify a file in-place? ... and further also these:   * How can I edit a large file in place?   * How can I cut a large file in place? However, I was wandering about something else: I believe (but I'm not sure) that any filesystem (like `ext3`) would have to employ something like a linked list, in order to be able to describe something like fragments of a file that are mapped to areas of disk. Thus, it should be possible to do something like this - for example, let's say, I have a file `bigfile.dat` like this (numbers should indicate byte offset, but it's a bit difficult to align them):               0  1 2  3   4  5  6  7  8  9 10 11  12 13 14 15 16 17 18 19 20 21 22 23 `L`` ``1``\n` `L`` ``2``\n` `L`` ``3``\n` `L`` ``4``\n` `L`` ``5``\n` `L`` ``6``\n` This file could then, in principle, be loaded in a terminal application for browsing - let's imagine we call a tool `editsegments bigfile.dat`, and let's say it similar to how `less -N bigfile.dat` would display the same file (with line numbers):                     1      1      L 1           2      2      L 2 *           3      3      L 3           4      4      L 4 *           5      5      L 5           6      6      L 6     bigfile.dat (END)       Let's say, I could enter a command there (say `d` for delete lines), click another key or the mouse where it is indicated above with `*` \- meaning that everything between lines 2 and 4 should be deleted. The program would then respond with this being shown:                     1      1      L 1           2      5      L 5           3      6      L 6     bigfile.dat (END)       Now we can see that leftmost first column shows "new" line number (after cut), second column is "old" line number (before cut) - and then the actual line contents follow. Now, what I imagine happens after this pseudoapplication `editsegments` is exited, is that first and foremost, `bigfile.dat` is untouched; however, now there would be also an extra text file in same directory, say `bigfile.dat.segments`; with these contents:               d 4:15 # line 2-4      ... and additionally, a special file (like a "symlink") - let's call it `bigfile.dat.iedit` \- would appear. Now, basically, the result of all this would be, that if I now try to open `bigfile.dat.iedit` with something like `less -N bigfile.dat.iedit`, I'd want to get the "edited" contents:                     1 L 1           2 L 5           3 L 6     bigfile.dat (END)       ... which could be achieved, I guess, by somehow instructing the operating system, that when `$FILE.iedit` is opened, first `$FILE.segments` should be opened and read; the `d 4:15` would instruct that bytes 4 to 15 in the original file should be left out - which would result with something like:               0  1 2  3   4 5  6  7  8 9 10 11 12,3,4 15 16 17 18 19 20 21 22 23 `L`` ``1``\n` `L`` ``2``\n` `L`` ``3``\n` `L`` ``4``\n` `L`` ``5``\n` `L`` ``6``\n`               0  1 2  3  ------------------------------->16 17 18 19 20 21 22 23 In other words - _assuming_ that in a filesystem concept of a file, each byte of content also contains a "link" to the next byte in the chain - it should be possible to instruct the filesystem to establish a new linked list based on a script, and provide the contents as represented by this modified linked list through a special file (symlink or pipe). That is what I meant by "scripted" in the title - that the "new" linked list can be controlled by a script file (`$FILE.segments`), user-editable in a text editor (or generated by a front end application). What I meant by "multipass" is the fact that `bigfile.dat` in this process is not modified at all; so I could edit the first (original) gigabyte today, saving progress in (`$FILE.segments`) - then I could edit the second gigabyte tomorrow, again saving progress in (`$FILE.segments`) etc. - all the while, the original `bigfile.dat` is unchanged. When all edits are complete, one could probably call a command of sorts (say, `editsegments --finalize bigfile.dat`), which would simply permanently encode the new linked list as the contents of `bigfile.dat` (and in line with that, remove `bigfile.dat.segments` and `bigfile.dat.iedit`). Or even easier, one could just do:               cp bigfile.dat.iedit /path/to/somewhere/else/bigfile.modified.dat      * * * Of course, besides a `d`elete script command, one could have a `r`eplace command as well, say:               r 16:18 AAA       ... saying: replace the content between bytes 16 and 18 with the next 18-16+1=3 bytes after the space (that is, the `AAA`) - the linked list could in fact "hook" into the script command content itself (the below chart containing also the `d`elete):               0  1 2  3   4 5  6  7  8 9 10 11 12,3,4 15 16 17 18 19 20 21 22 23 `L`` ``1``\n` `L`` ``2``\n` `L`` ``3``\n` `L`` ``4``\n` `L`` ` `5``\n` `L`` ``6``\n`               0  1 2  3  ------------------------------->|     |  19 20 21 22 23 `.` `. ``. ``.` `.``.``.``\n` `r`` ``1`  `6`  `:``1``8` ` ` `A``A``A` `\n` `.` `.`  `.` `.` * * * Now, I guess that programs like `hexedit` (as mentioned here) do change files in-place - but I'd just like the benefit of possibility of scripting (even better if it could be regulated by a GUI application, even if a terminal one), and the benefit of not actually having the original file changed, until one confirms all edits are as required. I'm not sure if something like this is possible at all - and even if it is, I guess it may require a dedicated driver (rather than just a user program)... But I guess it is worth asking anyways - is there anything like this for Linux? Many thanks in advance for any answers,   Cheers!


How am I supposed to keep up with kernels as a developer?

I'm developing for a specific TI ARM processor with custom drivers that made it to the kernel. I'm trying to migrate from 2.6.32 to 2.6.37, but the structure changed so much I will have weeks of work to upgrade my code. For example, my chip is the dm365, which comes with video processing drivers. Now most of the old drivers which were directly exposed to me go through v4l2, which might make more sense. TI provides very little information for those upgrades. How am I supposed to keep up with the changes? When I google for specific file names, I seldom get a few patches with fewer comments on what changed and why and how old relates to new.


Find and install man file manually

I seem to be missing some man pages, notably gcc and g++. It doesn't help that I specify the section. `whereis` doesn't list man pages for those two, so I think they are simply not there. With Google I get a lot, for example: http://linux.die.net/man/1/g++ (seems to be ordinary HTML though... or is it man page markup?) I thought this would be a good opportunity to learn how to replace them manually. I guess I'm looking for a gcc.1.gz file? Do I get it from GNU, from Debian, or could it be automated somehow? How much work is put into those files - if I get one, is it likely to be 99% correct or do they really differ a lot with time/architecture?


Automount lookup failed. How to determine what is trying to access the file?

Is there a way to find out what is trying to mount this file? > Jul 13 14:27:24 myhost automount[13527]: lookup(file): lookup for tmp_dir > failed Something is looking for "tmp_dir", and I've grepped a bunch of places but cannot find what script, program, etc... is looking for the file/dir and is causing automount to try and mount it up. I see there are entries in /proc/mounts for tmp_dir, but looks like I cannot remove them since /proc/mounts is read-only (probably for good reason). Thoughts? For a little background, we recently took down a file share that was called tmp_dir, and I think a programmer still has something pointing to tmp_dir, but he claims he cleaned everything up. I'm thinking maybe we did not umount tmp_dir properly before taking down the share, and autofs is still attempting to load it. The OS is SLES 11 SP1.


Command to monitor elapsed time in background?

I've been trying to find a decent way to monitor elapsed time in the shell. Basically, I'm asking for a stopwatch. The end result is easy enough to accomplish; I've seen examples of using `time read`, and then hitting enter when you're done, but that method makes the current terminal unusable. Ideally, I'd like something like:               timer start     (do some work, vim, python, etc.)     timer stop      It also would be nice if there was a way to pause the timer. For reference, I was planning on using it to time how long it takes to finish programming assignments from MIT's OCW. As such, since the assignments might be completed in more than one sitting, a way to pause and continue the timer would be beneficial. Is there anything like this?


Make zsh completion show the first guess on the same line (like fish's)

In Fish when you start typing, autocompletion automatically shows the first autocompleted guess on the line itself. In zsh you have to hit tab, and it shows the autocompletion below. Is there anyway to make zsh behave more like fish in this regard? (I am using Oh My Zsh...)


LAN server with two network cards, can't telnet / ping to the second even if it works

I have an issue with an Ubuntu 12.04 LTS (updated) server. For reasons too long to detail, it has got one eth0 interface assigned to 192.168.1.9 and one Wifi wlan0 interface assigned to 192.168.1.10. Both MUST work since boot time. I also installed (I need of monitoring software) Lubuntu desktop-core and removed Network manager (rebooted) and using wpa_supplicant + /etc/network/interface hardcoded configuration and fixed IPs. Everything works like a charm... hardware wise. From the Lubuntu desktop I can browse the internet from eth0. If I `ifdown eth0` and then unplug it, I can happily browse the internet through wlan0. So `wpa_supplicant` looks like it's doing its job. ### The problem is... I need to be able to have both interfaces up at the same time _and_ both must respond to pings, SSH connects from the other computers in the LAN, etc.. The wlan0 is the one that will need to be used when communicating with the gateway/router (at 192.168.1.1) to exit to the internet. But if I have both interfaces up, eth0 keeps working, but wlan0 becomes unreachable (nor it will connect to anything any more, so the issue is bidirectional). Trying to ping from My Win 8 computer will say the same error that you see when there's no route to host, too bad it's still on the same segment of the LAN: my Win 8 is at 192.168.1.69 and server's wlan0 is at 192.168.1.10. Do you have any idea about where I could start look after? ### Here are some configuration files   * `ifconfig`:              lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:18 errors:0 dropped:0 overruns:0 frame:0               TX packets:18 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:1613 (1.6 KB)  TX bytes:1613 (1.6 KB)          wlan0     Link encap:Ethernet  HWaddr 00:c0:49:fc:db:3f                 inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0               inet6 addr: fe80::2c0:49ff:fefc:db3f/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:16376 errors:0 dropped:0 overruns:0 frame:0               TX packets:3337 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:4675792 (4.6 MB)  TX bytes:543084 (543.0 KB)        * When I enable the eth0 with `ifup`, I get this stanza added:              eth0      Link encap:Ethernet  HWaddr 00:0e:a6:aa:5b:be                 inet addr:192.168.1.9  Bcast:192.168.1.255  Mask:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)        * `route -n`:              Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 wlan0     192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0     192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0      If I disable eth0 of course the relevant line goes away. IPTables shows clean (fresh Ubuntu install), I'm using UFW but I have disabled it at the moment as well.   * `iptables -L -nv`:              Chain INPUT (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                 * In the `hosts` file I have both interfaces, set to different names.   * In `resolv.conf` I've only got the DNS servers IP and domain clause.


scp stuck when trying to copy files from Linux to windows

I use the following scp syntax in order to transfer a lot of files from Linux red-hat 5 to windows machine (under Temp directory). SSH server is already installed on windows machine. I use this line in my shell scripts:               sshpass -p '$password'  /usr/bin/scp -o StrictHostKeyChecking=no  $FILE USER_1@14.187.12.139:'D:/Temp'      For most cases files transferred successfully, but sometimes `scp` seems to get stuck during file transferring? Connectivity appears OK like ping, etc. I get the following error from `scp` (after a long time):               ssh_exchange_identification: read: Connection reset by peer        1. why `scp` isn't stable and stuck, and what's the solution for this problem?   2. What are others good alternative for `scp`? (consider that I need 100% of stability)


Why is this copy/paste in vim configuration not working properly?

I have the following in my `.vimrc`               vmap <C-c> y       imap <C-p> <esc>P        So that I can do my classic sortcut for copy/paste. It works fine on Cygwin but not in my `ssh` session to remote linux using a `Mac` client. When I press `C-c` I see `X lines yanked` but when I press `C-p` only the first letter of the first line is pasted. What is the problem?


How do I temporarily bypass an alias in tcsh?

I am using tcsh. bash and zsh and other suggestions won't help here. I have several aliases that are named the same thing as another command, so if I did unalias it, typing the same thing would now do something different. Most of the time I want the aliased command, which is why I have them. However, sometimes I want the unaliased command. Without actually unaliasing and redefining the command, is there a simple way to tell tcsh to use the unaliased command instead? For example, vi is aliased to vim, but sometimes I want to just use vi. cd is aliased to change my window title, but sometimes I want to leave it alone. Obviously I could type /usr/bin/vi but since cd is a shell built-in command, there is no equivalent. Is there a general solution?


Does `shutdown -P now` safely unmount a USB drive mounted to `/dev/sdb1`?

I typically unmount my USB drive (using `umount`) from `/dev/sdb1` before I shutdown my computer but if I shut it down using `shutdown -P now` and then restart it, the drive is no longer mounted. Is this a safe way to unmount the drive?


how to find the hostname of an X server

Say I'm on machine `local` and log into machine `remote` with ssh, using X11 forwarding. Is there any way for programs running within the ssh session on `remote` can know they are being displayed on `local`? Ideally, I'd like to know the hostname of the computer that the X server is running on. My goal is to cause different behavior in a program (emacs) based on which machine it's displayed on.


using system command in awk script

In an AWK script I am using a command                  system(date)      to print the current date in a file but after this command is executed next line is also added implicitly. Is there any way in AWK to print the current date without the new line being added so that whatever I print next comes in the same line?


Is it safe to Install Debian, and possible to go back?

I already use bosslinux and want to try Debian (by installing Debian) would I be able to delete it completely afterwards?


bash script that uses nc for telnet reports ": command not found OK"

If I go to a bash prompt and run the following command (to flush memcached):               echo "flush_all" | /usr/bin/nc 172.16.198.130 11211      it works and returns "OK". If I put that same command in a one-line bash script:               #!/bin/sh     `echo "flush_all" | /usr/bin/nc 172.16.198.130 11211`      I get the following output:               : command not found OK      Is it trying to process "OK" as a second command? How can I prevent this (short of redirecting to /dev/null)?


How to compare two rfs directories with `diff`?

I've two RFS (`RFS` = `Root File System`) directories, which I would like to compare to each other with `diff`. Both directories represent an RFS of some other system, and they may contain links. If those links are absolute, they will point to something useless. For example, I've one RFS with the following symlink (inside the RFS):               /usr/test -> /home/test/file1      Now I've this complete RFS inside a directory named `/home/user/compare`, and the absolute paths of both files mentioned above are               /home/user/compare/usr/test     /home/user/compare/home/test/file1      Clearly, the symlink `/home/user/compare/usr/test` doesn't point to the right file. And because of that a comparison with the files in `/home/usr/compare` with some other RFS directory will fail for those symlinks. Is it possible to setup `diff` so it assumes not `/` as root but `/home/user/compare` as root (for the comparison), so that the given absolute symlink points to something valid, and `diff` takes it into account? Maybe there is a similar Linux command I can use for that?


Count tabs per line in text file with utils

I have a tab-tabulated file. I would like to check if every line has the same number of tabs. For first step, I'd like to print the number of tabs for each individual line. I've tried `grep -o '\t' infile | wc -l`, but my implementation of `grep` says `grep: invalid option -- o`. Is there an other way? * * * Nice to have: if possible, due personal preference, I'd prefer to do this with util (grep, cat, etc.) tools, preferably _not_ `awk` or bash scripting.


Save and clear event and security logs

I know how to save and clear the logs in Windows, but I'd like to do the equivalent in Linux. I have a requirement to save those logs for a very long time. Could someone sort of spell out the command lines for each of those?


After crash, e2fsck fails with weirdly high block numbers/sizes

After a breaker trip a Raspberry Pi of mine started to halt boot with kernel panic (same message as here). This is a Raspberry Pi running Raspbian, so it runs from a SD card, from a main `ext4` partition, which I've tried repairing on my PC with:               sudo e2fsck -f -y -v /dev/sdx2      However, this eventually fails with some weird output:               Error writing block 137439060017 (Invalid argument) while getting next inode from scan.  Ignore error? yes     Error reading block 183472412950529 (Invalid argument).  Ignore error? yes     Force rewrite? yes     Error writing block 183472412950529 (Invalid argument) while getting next inode from scan.  Ignore error? yes     Inode 13329, i_size is 4096, should be 549755817984.  Fix? yes     Inode 13607, i_size is 69632, should be 137439023104.  Fix? yes     Error reading block 36983963385857 (Invalid argument).  Ignore error? yes     Force rewrite? yes     Error writing block 36983963385857 (Invalid argument) while getting next inode from scan.  Ignore error? yes     Error reading block 179632729097217 (Invalid argument).  Ignore error? yes     Force rewrite? yes     Error writing block 179632729097217 (Invalid argument) while getting next inode from scan.  Ignore error? yes     Error reading block 17592186080054 (Invalid argument) while reading directory block.  Ignore error? yes     Force rewrite? yes     Error writing block 17592186080054 (Invalid argument) while getting next inode from scan.  Ignore error? yes     Error storing directory block information (inode=17449, block=0, num=134507168): Memory allocation failed     /dev/sdx2: ***** FILE SYSTEM WAS MODIFIED *****     e2fsck: aborted     /dev/sdx2: ***** FILE SYSTEM WAS MODIFIED *****      There are two things that are worrying here:   * the inode sizes and block sizes, which seem ridiculously high (we're talking ab out a 16GB SD card),   * `e2fsck` ends with `Memory allocation failed` \- on a PC with 32 GB of RAM, most of which are free. It does actually take up the free RAM before it fails.  I've tried configuring a scratch file directory with the same result (`e2fsck` does write some files there, and the target directory is on a mount with +250GB free space - it takes up the available RAM, and fails). **It looks like there's some corruption in the fundamental file system parameters on the affected partition. How to diagnose and eliminate it?**


Apache's 000-default.conf - weird behaviour

I'm trying to achieve a redirect from `domain.com` to `www.domain.com` (non- www to www). My **`sites-available/domain.com.conf`** file looks like this;               <VirtualHost *:80 *:443>             ServerName www.domain.com             ServerAdmin unidan@domain.com                  DocumentRoot /var/www/domain.com/public_html                  ErrorLog /var/www/domain.com/logs/error.log             CustomLog /var/www/domain.com/logs/access.log combined     </VirtualHost>          <VirtualHost *:80>             ServerName domain.com             Redirect permanent / http://www.domain.com     </VirtualHost>     <VirtualHost *:443>             ServerName domain.com             Redirect permanent / https://www.domain.com     </VirtualHost>      My **`sites-available/000-default.conf`** file looks like this;               <VirtualHost *:80>             ServerAdmin william@redwill.se             DocumentRoot /var/www/default/public_html                  ErrorLog ${APACHE_LOG_DIR}/error.log             CustomLog ${APACHE_LOG_DIR}/access.log combined     </VirtualHost>      Now.. when requesting `http://www.domain.com` it will respond as requested. However, when requesting `http://domain.com` it will render the request using the configuration in `000-default.conf`. Unlinking `000-default.conf` from `sites-enabled/` will fix this issue, however this is not something I want to do (I want to keep a default behaviour for unknown requests). What is the issue here? Why does the configuration in `000-default.conf` override the redirect?


Do I need X11 to install other desktop environments?

I just installed Arch Linux (Latest stable ISO from website) and I need to know whether or not I can just go straight to GNOME/KDE/LXDE, etc. without installing X11 first.


Automatically detect multiple monitors

I'm running Ubuntu 13.10 with xmonad. I am not using GNOME. I frequently have a second monitor plugged into my laptop, but I always have to configure the extended display manually. Right now I'm using disper to help with that, but it still requires input on my part. I have an NVIDIA graphics card with optimus, if that matters. I want to be able to plug in an external monitor and have the desktop extended automatically with no further input from me.


What is Linux for OpenVMS DIRECTORY/NOHEADING/NOTRAILING?

OpenVMS DCL command DIRECTORY/NOHEADING displays just the full file name including path info in a single-column format without any of the normal headings for a directory listing. The /NOTRAILING switch removes the normal trailing total info that is displayed. What is Linux for OpenVMS DIR/NOHEADING/TRAILING? This example directory command from MYHOME:[MYDIR.SUBDIR] shows the complete file names including path info with no other info like size, date, headings and totals:               $ dir/noheading/notrailing     MYHOME:[MYDIR.SUBDIR]ABC.C;3     MYHOME:[MYDIR.SUBDIR]ABC.OBJ;3     MYHOME:[MYDIR.SUBDIR]ABC.EXE;3


How to automate ktutil to immediately list keytab entries?

I use MIT `ktutil` a lot on Linux and I am fed up using the following sequence, even if command shortcuts and file name completion are here to help:               ktutil     rkt my.keytab     l      Isn't there a way to get the same result in a "one-line" way from the shell? Either with an alias, a function, or just with another tool?


Run Xserver as root

I am working with an ARMStone a9 board which has iMX6 linux kernel. I am doing an embedded application in which I have to show a video from Ipcamera. The thing is that I attached the screen to my board, I switch my board on, I login as root, I start the Xserver("startx &"), and then I run my application and everything is works properly. My problem is because I want that when I switch my board on the Xserver run automatically. I do an script in which I execute the command "startx &", but it does start. I have been investigated and I find out that the Xserver should be run as root, then I think that when the script starts and run the Xserver run it without root privileges then run wrong. But I do not know how can I run the Xserver as root and if is possible in automatically way. Thanks guys


find file read it and search for specific identifier

I'm trying to find out in what files some specific identifiers are being used. I know the file's name and know the identifier, therefore I use the following command to achieve my desired result:               find ./ -name "configuration.php" -print | xargs cat | grep db_userXYZ      The only issue is that, I'm losing the file name. I see that `db_userXYZ` is being used somewhere, but the command above, does not tell me in which file. The output would be something like:               $this->db_user = 'db_userXYZ';     $this->db_name = 'db_XYZ';      Any suggestions?


Kernel optimiziations for ioctl AF_INET operations

Our server solution handles many tunnel operation requests (add/update/delete) using the **ioctl** interface, and the AF_INET address family socket. Aprox. numbers are 100 operations/minute with over 8k tunnels total on the server. We have observed a strange behavior with an increasing number of tunnels - as the number of tunnel grows, randomness of time spent in the kernel by ioctl rises. **Example** : for about 100 tunnels, avg. ioctl operation time ranges from 100 to 150 ms, but with over 2000 it ranges from 100 to 10000 ms. The randomness of the process is surprising. **strace** shows that over 97% of our process time is spent in the ioctl, and out internal timers confirm this. Are there any ways to optimize this? Maybe by tweaking kernel parameters (which ones)? How to explain the randomness? Our OS is Ubuntu Server 12.04.


How can I run ssh-add on demand? Can it act as SSH_ASKPASS?

I want to ssh from `user@local` to `user@remote` several times per day with an encrypted SSH key, a situation which `ssh-agent` handles with a good trade-off between security and usability. I'd also like to not have to remember to run `ssh-add` before `ssh`'ing—I'd rather be asked for my password the first time I need it, and then have it automatically be remembered for, say, eight hours. So: I think I want to use `ssh-add` roughly where I think `$SSH_ASKPASS` is used, except `ssh-add` doesn't feed `ssh` the password it wants, as far as I understand. Is my understanding correct? If so, the obvious solution seems to be writing a script which asks for a password, runs `ssh-add` and then echoes the password back to `ssh`. Does this sound like the right approach? Is there a better way? If not, do you have a pointer or two to get started on this script? (I use ssh from linux console, xterm and emacs `*shell*` buffers; X-wise the solution doesn't need to do anything fancy.)


USB drive stopped working

My USB pen drive (A-data UE700 64GB) suddenly stopped working. I tested it on few PCs (every one with Linux) and it doesn't work on any of them. The device isn't even mounted. It used to work alright before. I'd want to make it usable again, even if it comes to formatting it. Now I can't even format it, as the device doesn't show in /dev. Here are few command outputs to help you grasp the situation. I'm using Ubuntu 12.04. `$ fdisk -l`:               Disk /dev/sda: 120.0 GB, 120034123776 bytes     głowic: 255, sektorów/ścieżkę: 63, cylindrów: 14593, w sumie sektorów: 234441648     Jednostka = sektorów, czyli 1 * 512 = 512 bajtów     Rozmiar sektora (logiczny/fizyczny) w bajtach: 512 / 512     Rozmiar we/wy (minimalny/optymalny) w bajtach: 512 / 512     Identyfikator dysku: 0x000db573          Urządzenie Rozruch   Początek      Koniec   Bloków   ID  System     /dev/sda1   *        2048   201062399   100530176   83  Linux     /dev/sda2       201064446   234440703    16688129    5  Rozszerzona     /dev/sda5       201064448   234440703    16688128   82  Linux swap / Solaris          UWAGA: Na '/dev/sdb' wykryto tablicę partycji GPT (GUID Partition Table)! fdisk nie obsługuje GPT. Należy użyć GNU Parteda.               Disk /dev/sdb: 500.1 GB, 500107862016 bytes     głowic: 255, sektorów/ścieżkę: 63, cylindrów: 60801, w sumie sektorów: 976773168     Jednostka = sektorów, czyli 1 * 512 = 512 bajtów     Rozmiar sektora (logiczny/fizyczny) w bajtach: 512 / 4096     Rozmiar we/wy (minimalny/optymalny) w bajtach: 4096 / 4096     Identyfikator dysku: 0x00000000          Urządzenie Rozruch   Początek      Koniec   Bloków   ID  System     /dev/sdb1               1   976773167   488386583+  ee  GPT     Partycja 1 nie zaczyna się na granicy bloku fizycznego.      `$ ls /dev/sdc`:               /dev/sdc      `$ lsusb`:               Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 005 Device 002: ID 046d:082b Logitech, Inc.      Bus 006 Device 002: ID 125f:de7a A-DATA Technology Co., Ltd.      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub     Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub     Bus 001 Device 003: ID 046d:c05b Logitech, Inc. M-U0004 810-001317 [B110 Optical USB Mouse]     Bus 001 Device 004: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business     Bus 002 Device 009: ID 125f:de7a A-DATA Technology Co., Ltd.       `$ udevadm monitor --udev` (after inserting the drive into USB port):               monitor will print the received events for:     UDEV - the event which udev sends out after rule processing          UDEV  [6624.324399] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2 (usb)     UDEV  [6624.324724] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0 (usb)     UDEV  [6624.324960] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20 (scsi)     UDEV  [6624.325246] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/scsi_host/host20 (scsi_host)     UDEV  [6625.313486] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0 (scsi)     UDEV  [6625.313800] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0/20:0:0:0 (scsi)     UDEV  [6625.314156] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0/20:0:0:0/scsi_disk/20:0:0:0 (scsi_disk)     UDEV  [6625.314531] add      /devices/virtual/bdi/8:48 (bdi)     UDEV  [6625.314777] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0/20:0:0:0/scsi_generic/sg4 (scsi_generic)     UDEV  [6625.314810] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0/20:0:0:0/scsi_device/20:0:0:0 (scsi_device)     UDEV  [6625.314968] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0/20:0:0:0/bsg/20:0:0:0 (bsg)     UDEV  [6625.328241] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0/20:0:0:0/block/sdd (block)     UDEV  [6625.332452] change   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0/20:0:0:0/block/sdd (block)     UDEV  [6625.336298] change   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/host20/target20:0:0/20:0:0:0/block/sdd (block)


How to search for a word in entire content of a directory in linux

need to search for something in entire content I am trying:               find . | xargs grep word      I get error: > xargs: unterminated quote How to achieve this?


AIX synchronize directory

I am trying to copy a lot of folders to another directory. I used `cp -R` command to copy them from source to destination. After all the copying was finished, I found that when I was copying, some files were added to the source directory and the copying action was finished. Say there are 20000 files in the source directory and 19999 files in the destination: how can I copy the missing one without copying them all over again? Is there a smarter way? I tried `rsync`, but ksh said there is no rsync.


how to view php and server error logs?

I am getting the WSOD now since editing settings.php; php.ini and .htaccess trying to update my site and I need to see error logs to find out what is happening. Also how do you clear cache in command line? Any help appreciated although haven't had much lately I have to admit.


How to pass a string parameter on bash function?

I have this code that does work:               get_parameter ()     {        echo "$query" | sed -n 's/^.*name=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"     }      But I want to replace the "name" with the parameter that I pass to get_parameter               get_parameter ()     {        echo "$query" | sed -n 's/^.*$1=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"     }     NAME=$( get_parameter name )      This however, doesn't work. Where am I wrong?


How do I deploy Firefox Bookmarks for all Users in Network?

I have a bash-script for installing Firefox which is downloaded and executed from every client workstation in the network. The script is on the server and all workstations are running Ubuntu. Now I want all workstations to have some default predefined bookmarks like company website etc. So how can I deploy Firefox in that way?


Can't remount local file systems for read-write (RAID1)

I assembled a new machine on Asus P9X79 motherboard, using its RAID controller to create a RAID1 array of two 500Gb drives. When booting Arch from an external drive I am able to work fine with `/dev/md126` which corresponds to the array. This way I created the partitions and filesystems on it, then chrooted and installed Arch Linux on the drive. However, I am not able to boot from RAID successfully: `/`, `/boot` and `/home` cannot be remounted in read-write mode (`mount` returns `32`), and I end up in emergency console. Trying to remount from there also fails, saying the drive is write-protected. I figured that some necessary kernel modules were not loaded at boot and played with `mkinitcpio.conf`. I have `mdadm_udev` as a hook (after `udev`, before `filesystems`). To my understanding, this should be enough, but I also tried adding `raid1`, `raid456`, `ext2` and `ext4` to the `MODULES` array, this didn't change anything. The RAID1 itself is recognized in the initial environment thanks to the `mdadm_udev` hook (the devices are there). `raid1` is, I think, also loaded by this hook automatically. I am still able to boot from external drive and mount the RAID1 device just fine; so I did `lsmod` on it and compared to `lsmod` on the "native" system. Nothing seems suspicious to me:               $ diff <(sort lsmod.old | cut -f1 -d ' ') <(sort lsmod.new | cut -f1 -d ' ')     7a8,12     > async_memcpy     > async_pq     > async_raid6_recov     > async_tx     > async_xor     13a19,20     > drm     > drm_kms_helper     24a32     > i2c_algo_bit     43c51     < nvidia     ---     > nouveau     48a57,58     > raid456     > raid6_pq     64a75,76     > ttm     > uas     71a84     > xor      `old` is the one that works. As you can see, the only line starting with `<` is `< nvidia`. So all the necessary modules are loaded (some of the additional modules in `new` are dependencies of `raid456` that I tried loading). What am I missing here? What can be the possible differences between two systems? Kernel versions are the same: 3.6.8. (BTW the installation medium I first tried to use had 3.6.6 and didn't work with this array; all operations ended up hanging endlessly).


mails being marked as spam

I configured my own mail server using sendmail for our application . Mail server is used to send automated mails when a user registers at our site . I was able to implement this successfully, but users who are registering using gmail account , automated mail message for registration are being marked as spam. This is not a issue for yahoo users. Following can be seen in message header of the mail marked as spam.               Received-SPF: neutral (google.com: 103.x.x.x is neither permitted nor denied by best guess record for domain of Admin@validdomain.com) client-ip=103.x.x.x;     Authentication-Results: mx.google.com;            spf=neutral (google.com: 103.x.x.x is neither permitted nor denied by best guess record for domain of Admin@validdomain.com) smtp.mail=Admin@validdomain.com     Received: from www.validdomain.com ([192.168.x.x])      Kindly suggest how to resolve the issue . The application just went live and it is critical for us to resolve the issue.


How to mount some folders on a different partition

I recently got an SSD for my computer. Therefore I reinstalled my system and mounted `/` on `/dev/sda1` (which is a partition on the SSD). To protect the SSD, I managed to mount `/tmp` on the RAMdisk. However, I would also want some other folders to be outsourced, not on the SSD _but on my RAID1_. The following folders should be outsourced:   * `/var/log`   * `/var/cache`   * `/var/games`   * `/var/tmp`   * (do you have any other suggestions?) I tried to simply mount those folders on a RAID-partition, just like I did with `/tmp` (find a part of my `/etc/fstab` below). Now I know, this was not the right way, instead I would have to use `bind`. I would need your help for the following issues:   * What preparations are necessary on the RAID (what about permissions, especially)?   * What are the propper mount options in `/etc/fstab`?   * Now that I have done it the wrong way, how would I migrate the data to the correct place (and is this even necessary for those folders?) a _wrong_ part of my `/etc/fstab`   `<raid uuid>` is the same for all of these lines               UUID=<raid uuid> /var/log ext4 noexec,nodev,nosuid 0 0     UUID=<raid uuid> /var/cache ext4 noexec,nodev,nosuid 0 0     UUID=<raid uuid> /var/games ext4 noexec,nodev,nosuid 0 0     UUID=<raid uuid> /var/tmp ext4 noexec,nodev,nosuid 0 0


Creating a Debian package that does not remove directories after it's purged

I'm trying to create a Debian package that doesn't delete an empty directory after it's purged. Specifically, I'm creating my own package containing some CA certificates I trust. I'm following Debian's suggested method of installing the certificates to `/usr/local/share/ca-certificates`. The problem I'm running in to is that the `ca-certificates` package creates `/usr/local/share/ca-certificates` when it's installed and I'd like that directory to stick around when my package is purged. My goal is to install my trust chain into `/usr/local/share/ca- certificates/mychain` but when my Debian package is removed I want dpkg to _not_ remove `/usr/local/share/ca-certificates` if it's empty since the `ca- certificates` package explicitly created that directory. I searched around for a definitive answer but all I managed to find were long forum posts and e-mail threads.


Yocton embedded Linux and Chromium touch events

I have a MarsBoard with an i.MX6 ARM processor and an Yocto embedded Linux. The board came with a touch screen, that works - at the moment - like a mouse. When I touch something, the mouse courser appears there. I also installed Chromium 35, based on Aura which - as I read - supports multi touch support. Though it doesn't work, even if I start the Chromium with touch enabled parameter. Websites, for instance with list, behaved not as I know it from Android or ChromeOS, furthermore the HTML / JavaScript mouse events won't be fired. How can I dig into to solve this problem. I really would like to get a deeper understanding of what's going on or not, but I don't have a clue where to start. Could that be a problem of Chromium, Linux or the touch screen?


Copy file from cifs mount when a file is changed

I have a windows XP machine, and on this i'm running a weather station. The software updates several files in a folder.   This folder is mounted via samba on the webserver(debian) I wan't to monitor the mounted folder, and when it detects any change, it copies this file to another location on the webserver. some of the files changes every few seconds. Hope i described the problem clear enough. Rgrds Bengt


GPT "Type device filename, or press <Enter> to exit?

I am attempting to install Arch Linux (for the hundredth time) and I recently ran across another problem. I am trying to find a list of my partitions. In order to do this I enter`gdisk` When I do this however it returns > Type device filename, or press to exit: I have attempted entering `gdisk /dev/disk1` When I do this I get there error > Problem opening /dev/disk1 for reading! Error is 2. However, I am still able to mount partitions when I know the partition. I am simply trying to get a list of my partitions so I can remember which ones they are. Any help understanding the problem would be useful. (Off topic question: Boot loaders do not need to be installed in the first partition of root correct? Last time I installed it I put it in /boot yet I was given an error)


Why doesn't ufw enforce firewall rules for traffic coming from Virtualbox VM

I've been running Linux Mint 17 on my laptop for a while and thought I had it locked down to not allow any incoming traffic through "Firewall Configuration" (ufw GUI)—I have also validated this from my laptop and other hosts on the network. Today I noticed however that when playing around with `nmap` from a VirtualBox VM running Kali Linux that the VM can acess all open ports on the laptop WLAN IP if going through VirtualBox's NAT Network. NMAP neatly lists all open ports and I can `ssh` to my laptop. Any ideas on what could enable the Virtual machine to bypass the firewall? Any workarounds?


In Emacs, editing C, sort-fields not working, or stating sole completion. Why?

In Emacs, editing C, and trying to execute sort-fields doesn't seem to be working. I enter M-x sort-fields after highlighting a region. At one point it was letting me pass a field number, but then suddenly it stopped, and now it reports `[Sole Completion]` when I enter space to pass the field number. I was thinking that maybe in C-mode it doesn't like that command, but I'm not sure. Any guidance on how to get this to work, or what I might be doing wrong?


dhcpd on interface with multiple address and link labels (aliases)

I had been running a dhcp server on an old version of isc dhcpd circa 2005, 3.0 something. I just upgraded to ISC dhcpd version isc-dhcpd-4.1-ESV-R6. Before upgrading, the interface (eth0) had two address assigned to it, 172.16.0.1 on eth0:0 and 192.168.0.1 one eth0:1. But the actual interface eth0 had no address assigned. Only the subnet 192.168.0.0/24 was handing out address, and this worked fine. Now, after upgrading, it gives me the error:               No subnet declaration for eth0 (no IPv4 addresses).      Which is true, there is only subnets defined for eth0:0 and eth0:1. I tried playing around with my config file, adding a shared-network statement, but nothing worked. Finally, I just assigned an address to the physical interface eth0 and it started happily. I just want to know if its possible to get the old behavior as I have code that depends on it. Or do I have to assign a dummy address on eth0? The dhcp config looks like this:               ddns-update-style interim;     ignore client-updates;          subnet 172.16.0.0 netmask 255.255.255.0 {      }     subnet 192.168.0.0 netmask 255.255.255.0 {              range 192.168.0.2 192.168.0.4;              option ip-forwarding off;         option domain-name-servers 192.168.0.1;         option broadcast-address 192.168.1.255;         option subnet-mask 255.255.255.0;         option routers 192.168.0.1;              default-lease-time 30;         max-lease-time 60;     }


Change default search name

My `Ubuntu12` server VM is receiving its IP address from an DHCP server (actually my WLAN router called Fritz Box). Hence all domain names are resolved to `machinename.fritz.box`. The reason seems to be the `resolve.conf`. But how can I change this search name to an arbitrary name such as `xyz.mydomain`? It clearly says **not to edit the file**. The machine itself is set as `ubuntu.xyz.mydomain` in `hostname`. What I want is that `machine1` is assumed to be `machine1.xyz.mydomain` and NOT(!) `machine1.fritz.box`.               # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)     #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN     nameserver 192.168.0.1     search fritz.box # shall be xyz.mydomain


Move zsh settings from Arch live to Arch regular

I just installed Arch as a guest (Virtual Box), and I really liked the way that the shell behaved on the live version of Arch. What would the steps be in order to copy those settings (from live) onto my fresh Arch install, if possible?


limiting size of logfile from a variable

How can I limit the size of a log file, which is saved in the form of 'foo.txt', from within a bash script please? I want to put in the variables 'LOGFILE=50 mb' and it uses that size, or whatever size LOGFILE is. This is on Debian 7, fully up-to-date.


have /home/user/Downloads (and other user folders) on a different partition

I recently got an SSD. I use it to store my `/` as well as my `/home` directories (on different partitions). For each user, I would like to have most of their folders on my big RAID-1 with 2 hard drives (I'm talking about `/home/<user>/Downloads`, `/home/<user>/Music`, `/home/<user>/Documents`, etc. to make this more clear). First I thought about symlinks, but I think this wouldn't work, as the whole home-directories should be encrypted with ecryptfs. So, how can this be achieved?


Fluxbox battery monitor?

I'm using fluxbox on Arch, and I'm trying to put a battery monitor in the toolbar, next to the time. gkrellm takes up too much space, and can't be configured in the toolbar, as far as I know.


How do I force booting in text mode?

Newer Linux distributions have the idea to boot into graphics modes. The grub menu does this. The init.d system does this. X does this. I can justify X. But both grub and init.d have only caused me troubles and never given me any joys. I am now installing on an old system that does not have _any_ fancy graphics, so I would like to tell Debian _not_ to touch the graphics systems _at_ _all_. Right now I have gotten grub to stay in text mode:               /etc/default/grub:     GRUB_TERMINAL=console     GRUB_GFXPAYLOAD_LINUX=text      Followed by: update-grub And X is disabled by not installing X. The graphics system is still touched during init.d. I have the feeling it is some VESA mode that is being changed. Where do I disable this, so it stays in text mode? System info:               Debian stable:     # uname -a     Linux grb 3.2.0-4-686-pae #1 SMP Debian 3.2.54-2 i686 GNU/Linux      Edit: Adding this to /etc/default/grub gets rid of part of it (thanks to TAFKA):               GRUB_CMDLINE_LINUX_DEFAULT="vga=normal nomodeset"      But the below seems to clear my scroll back buffer, too, and change the fonts:               [info] setting up console font and keymap      Putting 'exit 0' in '/etc/init.d/console-setup' works around this, but does not seem to be "the Debian way". So the question is now down to: How to disable 'console-setup' the Debian way?


Can not boot ArchLinux with a Macbook pro 7.1

Today I decide to put a Linux in dual boot on my MacBook 7.1 I parted the HDD with GParted like this : refit / MacOSX / boot / root / home I installed Arch successfully, following the tutorial about the MacBook specific install. When it ends with the bootloader install screen I get an issue: I simply can't select the boot( _/dev/sda3_ ) partition to install GRUB in it - it only propose _sda_. Then I reboot, try to sync the partition table with REfit but it says it's OK. Sounds weird but OK, I put a Ubuntu Live CD in my MacBook and reboot with it. Try to install Grub this way but it doesn't work too :               ubuntu@ubuntu:~$ sudo grub-install --root-directory=/media/4d63602e-5572-4279-bee8-026a94932e91 /dev/sda3          /usr/sbin/grub-setup: warn: Attempting to install GRUB to a partitionless disk or to a partition.  This is a BAD idea..     /usr/sbin/grub-setup: warn: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..     /usr/sbin/grub-setup: error: will not proceed with blocklists.          ubuntu@ubuntu:~$       I'm pretty out of ideas to solve this, what else can I try?


How to Connect to Wireless Automatically? (Non-graphical)

I'm trying to set up my Arch Linux so that, through non-graphical means, I can connect to a wireless network through profiles on my system. I have tried **net-auto-wireless** , and it does everything I have specified, but I want it to be able to connect once it has the ability. For instance, if the first attempt was unsuccessful or if a network becomes within range after the daemon has been started. Is there a way to do this easily? Is there something with **netcfg** , **net- profiles** or similar that I missed? **EDIT:** I read here [ https://bbs.archlinux.org/viewtopic.php?id=110253 ] that netcfg operates in this non-reconnecting way by design (it is said in post #3 that it is in the ArchLinux wiki page for netcfg, but I could not find anything saying this). If this is the case, is there any way I can seamlessly reconnect? Perhaps through CLI means other than netcfg? Also, I would rather not use NetworkManager, because the manual for nm-cli (NM's CLI counterpart) stated that polkit-gnome is required to query for non- existing connection credentials, and I just would like a universally- applicable solution (One that will work on an ArchLinux setup that may not have a graphical setup, or headless Linux distributions in general)


Fn+F2 does not UNMUTE

I am using Lubuntu 11.10 (original, not Ubuntu + LXDE) on a Vaio VPCEG series. After install of some network manager, my key `Fn+F2` got a different function. It's printed on it the blue symbol for MUTE. Well, it was working. Now, if the sound is ON and I press `Fn+F2`, the sound will be muted and the icon on the bar is changed. But I am not able to UNMUTE. If I press again, nothing happens. Below is the result from `xev`. Helps are welcome. Thanks.               KeyRelease event, serial 41, synthetic NO, window 0x1a00001,     root 0xb7, subw 0x0, time 2129709, (-432,-17), root:(667,296),     state 0x0, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,     XLookupString gives 0 bytes:      XFilterEvent returns: False


yum does not work on RHEL 6.3

I have installed RHEL 6.3:               Linux RHEL6.3-64-BuildMac 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux      My `/etc/yum.conf` looks as follows:               [main]       cachedir=/var/cache/yum/$basearch/$releasever       keepcache=0       debuglevel=2       logfile=/var/log/yum.log       exactarch=1       obsoletes=1       gpgcheck=1       plugins=1       installonly_limit=3       reposdir=/etc/yum.repos.d/rhel.repo      The contents of my `/etc.yum.repo.d/rhel.repo` looks like               [rhelrepo]       name=my rhel repo       baseurl=http://mirror.centos.org/centos/6.3/os/x86_64/       #gpgkey=http://mirror.centos.org/centos/6.3/os/x86_64/RPM-GPG-KEY-CentOS-6       enabled=1       gpgcheck=0       But now when I do "yum repolist" I get the following message:               Loaded plugins: security     repolist: 0      What do I do to resolve this?


Streaming music to a raspberry pi

I have a laptop and a raspberry pi connected to a soundsystem via the jack output. I'd like to have the output of the soundcard of my laptop redirected to the raspberry through my local network. I read things about mplayer daemon or icecast protocol but I don't really know how to make it work.


Stripping all vowels but the first from a set of strings

I have a string comprised of multiple substrings, separated by underscores. For example: `AbcdAEfd_hEgdgE_AbAAAAA`. I need to remove all vowels except the first from each substring. So:   * `AbcdAEfd` -> `Abcdfd`   * `hEgdgE` -> `hEgdg`   * `AbAAAAA` -> `Ab` The resulting string should be `Abcdfd_hEgdg_Ab`


How to extract bookmarks from a pdf file

I have a PDF file. I need the bookmarks in that file extracted to a text file or an excel. I also need to validate the bookmarks from the large PDF file. How could I do that?


Docker error creating bridge

after installing Docker on a Ubuntu 14.04 minimal system with these commands,               apt-get update     apt-get install docker.io     ln -sf /usr/bin/docker.io /usr/local/bin/docker     sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io      I ran into the following problem while trying to run the docker daemon.               # docker -d     [/var/lib/docker|3225259a] +job serveapi(unix:///var/run/docker.sock)     [/var/lib/docker|3225259a] +job initserver()     [/var/lib/docker|3225259a.initserver()] Creating server     2014/08/11 09:55:20 Listening for HTTP on unix (/var/run/docker.sock)     [/var/lib/docker|3225259a] +job init_networkdriver()     [/var/lib/docker|3225259a.init_networkdriver()] creating new bridge for docker0     Error creating bridge: package not installed     [/var/lib/docker|3225259a] -job init_networkdriver() = ERR (1)     Error creating bridge: package not installed     [/var/lib/docker|3225259a] -job initserver() = ERR (1)     2014/08/11 09:55:20 Error creating bridge: package not installed      I've read that this error might correspond to the kernel. `uname -r` gives me `3.13.0-042stab092.2` but as I'm not skilled with unix at all, it would be great if someone could tell me what to do.


How much speed difference for a tweaked bios versus uefi boot?

> EFI can be faster, but that's not certain. The biggest speed difference is > in hardware initialization early in the process. On my systems, this is a > fraction of the total boot time, so a reduction in the hardware > initialization time, while good, doesn't make all that much difference. -- > What is the difference in “Boot with BIOS” and “Boot with UEFI” After reading this, I am wondering how much will the difference be. While watching a movie for a Gigabyte mainboard where the UEFI versus classic BIOS boot time is at 11 versus 19 seconds, I see loads of hardware enumeration and display during BIOS boot and that it boots into some kind of Windows menu. My BIOS boot doesn't do that, so I need to extend my question. For firmware with already **tweaked BIOS settings** , that boots into a **single OS** (Linux text console operating system). No dual-boot OS here. BIOS boot in this case is a boot with UEFI having Compatibility Support Module (CSM) enabled. A tweaked legacy BIOS is one where optimizations are made to already reduce boot time (speed up the boot process). How many seconds faster will an EFI boot be over a tweaked legacy BIOS boot (UEFI+CSM)?


How can I delete text before a delimiter in Linux

I need to delete text from a line before delimiter. For example:               (123434): hello::{apple,orange,mango}.      I need to delete text before first `:`. i.e. `(123434)`. Is there any command in linux to perform this task?


linux bash prevention flocking for background process

My script makes flock. This prevents me for runing its twice. Script can execute another script, and there is a problem. Sometimes another scripts leaves processes in background. Unfortunately they inherits flocks, I don't need this. Is it any wraper who close some file handles before execute specified executable? I use linux debian, but it isn't impornant linux distro or version. Detailed scenario:   1. My script A is run   2. My script A makes flock   3. My script A runs external executable B   4. External B runs executable C as background (inherit flock)   5. External B finishes and leaves C in background (inherit flock)   6. My script A finishes because B finishes   7. Another loop, My script A is run (as point 1)   8. My script A makes flock and fail, because C still is running I want exactly run external executable B with closed flocked filehandle. Flock should be keeped until only my script A is running. I don't want close flock between 2 and 3 points, because there will be "flock hole". Is there any wrapper os something like this?


Linux Wifi High Power Consumption

I'm running Fedora 20, kernel 3.15.6 and ath9 driver with an ateros card. My battery life is very short, on an older debian install I had around 3 to 4 hours, now I'm between 1 and 2 hours. Powertop shows that the wireless uses about 18 W which is quite a lot. Any ideas on what to do or look at?


What is the concept of Refresh in Linux, if there is so

I have read in forums and googled results , that Refresh is not needed in Linux (Ubuntu /Linux Mint , etc ) like systems. I never found the reasons or concept behind REFRESHING in Linux. What exactly does refresh means in Linux, i am aware that F5 / Ctrl+R keys work and does a refresh kind of operation in Linux OS. But what exactly does it do. And also Why there is no need of Refresh in Linux , if it is there then Why.


IPv6 in IPv4 over LAN

I want to setup IPv6 in my LAN, but also want to have some machine to use IPv4 only. How do I do such setup so that every machine can communicate with each other ? All machines supports dual-ip stack.


Copy file from commandline, paste into Gnome window or vice-versa

There are plenty of examples how to copy the "contents" of a file from command line with the help of `xclip` or `xsel`. What I am looking for is to copy a file from the command line and paste into the file explorer. So I will use a command to copy a file, not only the contents, and use `Ctrl``v` to paste it in UI. **updated** `xclip-copyfile` and `xclip-pastefile` work close to what I expect, but when I run `xclip-copyfil`e, I can only paste with `xclip- pastefile` command, not GUI paste.


Why is bash giving me (apparently) conflicting information about a file?

### Background I am working on a RHEL 5 cluster. I want my Fortran program to read the file `/home/bob/inputs/input_1`   1. I asked Bob to give me permission to read all contents of `inputs`:              [bob@server]$ chmod -R a+r /home/bob/inputs/*        2. I linked these to a shared directory:              [david@server]$ ln -s /home/bob/inputs/ /home/share/inputs/        3. My (Fortran) program tried to read `/home/share/inputs/input_1` and said:              File /home/share/inputs/input_1 not found!        4. I tried to locate the file myself (in the process, bob gave `a+rwx` permissions):              [david@server]$ls -ltrh /home/share/inputs/input_1     lrwxrwxrwx 1 bob bob 33 Oct 25 15:42 /home/share/inputs/input_1 -> /home/bob/inputs/input_1      From this, I concluded that a) `inputs_1` exists and b) all users have `rwx` permission.   5. I tried to read it:              [david@server]$ more /home/share/inputs/input_1      /home/share/inputs/input_1: No such file or directory      And am told that it does not exist.   6. I look for the target file `/home/bob/inputs/input_1` but am denied permission.              [david@server]$ls -ltrh /home/bob/inputs/input_1     ls: /home/bob/inputs/input_1 Permission denied        7. Something bizzare happens if I `ls` the directory contents:              [david@server]$ls -ltrh /home/bob/inputs/     ?--------- ? ? ? ?            ? input_1     ?--------- ? ? ? ?            ? input_2     ?--------- ? ? ? ?            ? input_3     ... (n-4 lines omitted)      ?--------- ? ? ? ?            ? input_n      although if bob does this, he gets:              -rwxrwxrwx 1 bob bob  269 May 24  input_1     ... (n-2 lines omitted)      -rwxrwxrwx 1 bob bob 2.0K Jan 19  input_n      ### Questions:   * Is there a simple explanation for this apparently (to me) inconsistent behavior?   * Where do I go from here?


CentOS 6 VSFTP 553 Could not create file

I installed vsftpd yesterday on CentOS 6, however didn't get a chance to test it today. When I went to upload a test file it's coming back and giving me this error: > 553 Could not create file After some quick googling the information I found on resolving the error, including this post were already things I tried...   * Confirm user that is connecting to FTP is a part of the group that owns the directory   * Confirm the `vsftpd.conf` file has `write_enable` set to `true` I even went so far as to test changing the group on the whole path down to the destination folder. > _**EDIT:_** > > Just to expand on this, at the time I did ensure that the modes on the > directories were set appropriately as well. > > What I ended up doing was uninstalling vsftpd and re-installing from yum. > After I did this things worked appropriately. So I'm convinced it was a > setting in `vsftpd.conf` file. However I didn't save a copy of it to do a > diff off of to confirm. > > Hopefully someone else who has had the same problem with the same symptoms > and found out what the cause was can accurately answer this question here > for someone else who comes along.


Adding Ctrl-L as "clear" hotkey in OpenBSD's ksh

I've been looking for a way to use `Ctrl`-`L` to clear the monitor instead of typing `clear` in each time. I found nothing except a patch which didn't work for me. How do I add hotkeys/shortcuts to my OpenBSD box (which uses ksh as a shell)? [*] OpenBSD's ksh.kshrc [*] Ctrl-l in hex = 0xc :               # read key ; echo -n $key > file.txt ; hexdump file.txt     ^L     0000000 000c                                        0000001     #


Arch Linux not functional after kernel upate

> **Possible Duplicate:**   >  Arch Linux not booting after system update After running a system update, in which the kernel was updated, when I try to boot Arch (in single user, not quiet), I get the message `bin/sh cant access tty` and I get dropped at a prompt, but I can't type. I am dual-booting with OS X, if that makes a difference.


How to disable HTTP TRACE on OpenBSD 5.3?

An nmap scan gaved this:               443/tcp  open     ssl/http Apache httpd     | http-methods: GET HEAD OPTIONS TRACE     | Potentially risky methods: TRACE     |_See http://nmap.org/nsedoc/scripts/http-methods.html      so I tried to:               # DISABLE TRACE     vi /var/www/conf/httpd.conf     TraceEnable off      **Q:** But it gaved syntax error. How can I securely disable Trace HTTP METHOD on OpenBSD 5.3? p.s.: Why is an insecure option enabled in a secure OS?


Count occurrences where two fields are equal

Is it possible to write an awk one-liner which will compare two fields on the same line to see if they are equal, and output the number of lines where this is true? I tried:               awk '$1==$2 { print($1 $2); }' foo1 | wc -l           I don't think this is correct.


Better solutions for this: tail -200 /var/log/messages | head -100

Are there any better solution to this?               tail -200 /var/log/messages | head -100      Are there other methods to achieve this output? (not more complex, I'm looking for simpler solutions!)


Alternative to find?

Is there an alternative `find` program with a more conventional CLI interface? `find` works and expects parameters in a painfully different way from most other utils. Clarification: I'm looking for a program that has mostly the same functionality as find with a commandline interface that works and feels like POSIX (or at least GNU) commandline recommendations.


Why does this command work for logging script output?

This command does not store the output of my script in the log file:               . myscript.sh | tee -a log_file.log      However this next command _does_ store the output in the log file.               . myscript.sh 2>&1 | tee -a dash_log.log      Why does the second one work and not the first? AFAIK the only difference is that I have told bash to redirect stderr to stdout, and it should not make any difference to what happens with stdout. Yet that first command would not even store the 'error-less' version of stdout in the log file. And in case it matters: I'm on Ubuntu 12.04 hosted on AWS EDIT: This was caused by erroneous assumptions of how wget outputs messages. See http://stackoverflow.com/questions/13066518/why-does-wget-output-to- stderr-rather-than-stdout and http://www.gnu.org/software/wget/manual/html_node/Logging-and-Input-File- Options.html


How to change keyboard speed in the Linux console?

When I press `Ctrl + Alt + F1` the desktop environment disappears and a terminal window appears. Pressing `Ctrl + Alt + F7` brings me back to DE. This terminal is useful when the DE hangs for some reason and I need to kill a process or something. However the keyboard typing speed in this terminal is so fast that its almost unusable. Attempting to type `sudo ps -ef | grep virtualbox` often gets me `suuudo pss -ef || grep virtuaalbox` I have two questions -   * What terminal is this? Is it Xterm?   * Could I reduce the keystroke speed to a more usable value, as in gnome-terminal?


How can I capture an OpenBSD install console?

So.. **How can I save the text that is based on Q/A's when installing an OpenBSD 5.3?** Or I only have the choice to manually type the texts down? or an OCR software using printscreens?


Turn off --skip-grant-tables in MySQL

I'm pretty new to using Linux but am setting up my MySQL databases on an Amazon ec2 instance. I followed some directions I found about resetting the user login pass by using the `--skip-grant-tables` option of MySQL. Now I am trying to add a user and can't figure out how to turn that option off. This is what I'm trying to do:               mysql> GRANT CREATE,SELECT,INSERT,UPDATE,DELETE ON ...my db username and pass      but I get this error:               ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement      How do I turn this option off?