Is there a tool to get the lines in one file that are not in another?

Is there any tool that can get lines which file A contains, but file B doesn't? I could make a little simple script with, e.g, perl, but if something like that already exists, I'll save my time from now on.


How do I find out a server's drive mappings for raw devices?

I don't have a lot of knowledge on Linux so pleas forgive me if this is a simple question. I manage a server with Oracle RAC 11g running on Redhat 5.2. There are a number of raw drives on the server but I cannot see how they are being mapped. I have had a look at the fstab and even the udev (raw rules configuration, even thought its depreciated). But I cannot see where the various mappings from the partitions presented `/dev/sd[xy][123]` would map to the various `/dev/raw/raw[12345]` etc. So is there any way I can work out which partitions are assigned to the mappings and the size of the partitions?


Interpreting tiobench results

I'm running `tiobench` on my raid1 and it gives me the following results.   1. Why is there `#####` shown instead of throughput?   2. Why does seq.reading with 8 threads use 2836% CPU? My results:               $tiobench     No size specified, using 2000 MB     Run #1: /usr/bin/tiotest -t 8 -f 250 -r 500 -b 4096 -d . -TTT          Unit information     ================     File size = megabytes     Blk Size  = bytes     Rate      = megabytes per second     CPU%      = percentage of CPU used during the test     Latency   = milliseconds     Lat%      = percent of requests that took longer than X seconds     CPU Eff   = Rate divided by CPU% - throughput per cpu load          Sequential Reads                                   File  Blk   Num                   Avg      Maximum      Lat%     Lat%    CPU     Identifier                    Size  Size  Thr   Rate  (CPU%)  Latency    Latency      >2s      >10s    Eff     ---------------------------- ------ ----- ---  ------ ------ --------- -----------  -------- -------- -----     2.6.32-37-server              2000  4096    1  ###### 93.62%     0.001        0.02   0.00000  0.00000  6897     2.6.32-37-server              2000  4096    2  ###### 384.4%     0.001        0.03   0.00000  0.00000  2778     2.6.32-37-server              2000  4096    4  ###### 1552.%     0.001        0.07   0.00000  0.00000   980     2.6.32-37-server              2000  4096    8  ###### 2836.%     0.002       10.15   0.00000  0.00000   533          Random Reads                                   File  Blk   Num                   Avg      Maximum      Lat%     Lat%    CPU     Identifier                    Size  Size  Thr   Rate  (CPU%)  Latency    Latency      >2s      >10s    Eff     ---------------------------- ------ ----- ---  ------ ------ --------- -----------  -------- -------- -----     2.6.32-37-server              2000  4096    1  ######     0%     0.001        0.01   0.00000  0.00000     0     2.6.32-37-server              2000  4096    2  ######     0%     0.001        0.00   0.00000  0.00000     0     2.6.32-37-server              2000  4096    4  ######     0%     0.001        0.00   0.00000  0.00000     0     2.6.32-37-server              2000  4096    8  ######     0%     0.001        0.00   0.00000  0.00000     0          Sequential Writes                                   File  Blk   Num                   Avg      Maximum      Lat%     Lat%    CPU     Identifier                    Size  Size  Thr   Rate  (CPU%)  Latency    Latency      >2s      >10s    Eff     ---------------------------- ------ ----- ---  ------ ------ --------- -----------  -------- -------- -----     2.6.32-37-server              2000  4096    1   87.39 6.816%     0.030     2509.77   0.00059  0.00000  1282     2.6.32-37-server              2000  4096    2   89.32 17.86%     0.057     2478.84   0.00039  0.00000   500     2.6.32-37-server              2000  4096    4   86.98 36.70%     0.113     2353.49   0.00020  0.00000   237     2.6.32-37-server              2000  4096    8   86.46 82.35%     0.214     6847.69   0.00078  0.00000   105          Random Writes                                   File  Blk   Num                   Avg      Maximum      Lat%     Lat%    CPU     Identifier                    Size  Size  Thr   Rate  (CPU%)  Latency    Latency      >2s      >10s    Eff     ---------------------------- ------ ----- ---  ------ ------ --------- -----------  -------- -------- -----     2.6.32-37-server              2000  4096    1    1.75 0.335%     0.001        0.02   0.00000  0.00000   521     2.6.32-37-server              2000  4096    2    1.73 0.221%     0.002        0.03   0.00000  0.00000   781     2.6.32-37-server              2000  4096    4    1.71 0.877%     0.002        0.02   0.00000  0.00000   195     2.6.32-37-server              2000  4096    8    1.74 2.671%     0.002        0.03   0.00000  0.00000    65


Using Radeon on muxless system with multiple X servers

I'm using HP ProBook 4740s laptop with muxless hybrid graphics:               root@mekras: lspci | grep VGA     00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)     01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7550M/7570M/7650M]      With this article I can successfully use Radeon in desired apps. But only on the first started X server (i. e. under first user logged in). For this server I have providers:               mekras@mekras: xrandr --listproviders     Providers: number : 2     Provider 0: id: 0x7f cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 0 name:Intel     Provider 1: id: 0x56 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 1 associated providers: 0 name:radeon      But for all additional X servers (additional logins) I have other list of               gamer@mekras: xrandr --listproviders     Providers: number : 2     Provider 0: id: 0x48 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 1 name:Intel                                  Provider 1: id: 0xcf cap: 0x2, Sink Output crtcs: 6 outputs: 1 associated providers: 1 name:modesetting      So Radeon is not available as a render offload device. My question is: how can I use Radeon on additional X servers? **Update:** xorg.1.log contains messages: "setversion 1.4 failed" and after that "fglrx" module not loaded. Here someone writes that "«setversion 1.4 failed» means that something was still holding on to the DRM device so X couldn't take it;" Is that means that two X servers can not use same DRM device?


dag.repo overwritten

I accidentally overwrote dag.repo by trying to add this               [dag]     name=DAG RPM Repository     baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag     gpgcheck=1     enabled=1        does anyone have the backup file for dag.repo which is found in /etc/yum.repos.d for centOS 5.8 or where can I download it?


Do we need to chmod a shell script before it can be rsh

I tried to rsh a shell script from OpenVms to a Red Hat linux. It seems that it is not executed. I created the shell script in OpenVms and Ftp it to the linux. I then ls -la the folder in linux:               -rw-r--r--    1 buedev   buedev        382 Jul 20 11:03 files.sh      It seems that even the owner don't have the right to execute. And if we need to chmod it, how can we do it remotely in OpenVms?


GET flash memory type: SLC or MLC

Just for my knowledge, I would like to know whether the type of flash memory used in my pendrive is SLC or MLC. Is there a way to find it out? I googled but found nothing.


Can linux be configured as a server or workstation in DCS and how?

I am a student of Instrumentation and Control. Considering the versatility and stability of Linux, I was wondering if Linux can be configured to act as a **Distributed Control System**? Also if yes, which distro would be appropriate? I have basic knowledge of Linux shell scripting so I would prefer the distro to be relatively user- friendly. _Note : Having experience with Ubuntu, I'd like to set-up the server there._ **Updates in reply to answers :** My hardware : i5 2nd gen, 8GB ram, 500GB HDD.   System : Ubuntu 12.04 Desktop edition 64bit.   Required job (proposed) : Running 5 or more sensors(as a start), driven by a micro-controller(s). I need to set up a server, but without re-installing or changing the system. A second user as a workstation if it can be set-up so. Virtualization is welcome but don't know how. I have till March '13 to learn OpenCL and parallel programming to use my graphics card (NVidia GeForce 525M 1GB) (although this part of plan is still under heavy consideration).      It would be useful and appriciated to get links to good books, tutorials and reports of similar undertaking.


Are FIFO, pipe & Unix domain socket the same thing in Linux kernel?

I heard that FIFOs are named pipes. And they have exactly the same semantics. On the other hand, I think Unix domain socket is quite similar to pipe (although I've never made use of it). So I wonder if they all refer to the same implementation in Linux kernel. Any idea?


Difference between alias in zsh and alias in bash

I have searched around but could not find anything conclusive. Is there a difference between the alias command in zsh and the alias command in bash? If not, does it mean I can share a set of aliases between the two shells and expect them to work as I intended?


SLES 10 - repositories?

Can somebody help with adding a repo for SuSE Linux Enteprise Edition 10 SP3? First - can't find any "official" repos. Found a few repos for openSUSE and few other - but every time I try them I get this error (using YaST2):               Unable to create installation source            'http://download.opensuse.org/repositories/openSUSE%3a/Tools/SLE_10/'.           Unknown source type for http://download.opensuse.org/repositories/openSUSE%3a/Tools/SLE_10/      I also get the same with other repos...


Copy modified files from one server to other

Scenario: 2 Servers (*.12 and *.13) CakePHP "application" on both of them.               *.12 is "Production" Server     *.13 is "Development" Server      Now i want to copy all files modified the last 2 days from test server to production server WITHOUT the directory ./tmp i can find them on production server with:               find ./ -type d -name tmp -prune -o  -mtime -2 -exec ls {} \;      On both servers i have only ssh access.


sendmail not working

I have a website where mails are sent. Those mails from website (contact mail, booking mail) are being sent well. But when I go to shell with ssh and give `sendmail myemail@mail.com` it is not sending. the error log in `/var/log/mail` says:               did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA      some time ago, i had a problem with permission, i changed without knowing the permission of `/etc/` folder, then later i did `chmod 755 /etc/` then everything seemed to work properly. but now, i am getting this error. server os is openSuse. what can I do?


s3cmd: how to use exclude-from with a file list of excluded directories

I cannot seem to get the `\--exclude-from=` option to work with my exclude GLOB file when synchronizing with my s3 bucket. Here is a trivial example to demonstrate: I create the following file tree under my `/home/user`:               syncTest         includeTest              includeFile.txt         excludeTest              excludeFile.txt         exclude-list.txt      The contents of my `exclude-list.txt`:               syncTest/excludeTest      Then I use the following `s3cmd` command, called under `/home/user`:               [lucas@lucas-ThinkPad-W520]~$ s3cmd sync --exclude-from=syncTest/exclude-list.txt syncTest s3://my.bucket/lucas/      but my `excludeTest` directory is not excluded:               [lucas@lucas-ThinkPad-W520]~$ s3cmd ls s3://lucas.backup/lucas/syncTest/                        DIR   s3://lucas.backup/lucas/syncTest/excludeTest/                        DIR   s3://lucas.backup/lucas/syncTest/includeTest/     2014-04-06 12:18        21   s3://lucas.backup/lucas/syncTest/exclude-list.txt      I also tried using the following contents for my `exclude-list.txt` file:                excludeTest      /syncTest/excludeTest      But it does not work either. Any suggestions? In this example, I just want to sync my `syncTest` folder, but not the `excludeTest` subfolder, using a file with the `\--exclude- from=FILE` option. I am trying to follow the same format as `rsync`'s `\--exclude-from=FILE` option, assuming that it is the same, because there is not much help for `s3cmd`.


KMail: Search for messages with attachment

How can I search for messages with one or more attachments in KMail? The search filters don't show such an option, and when selecting "Message Status" there also isn't a criteria for attachments. ![KMail search dialog](http://i.stack.imgur.com/7gGY7.png) I'm using KMail 4.13.3.


copying files with particular names to another folder

I have a folder with a lot of files. I want to copy all files which begin with of these names (separated by space):               abc abd aer ab-x ate      to another folder. How can I do that?


Opening .eml files with mutt

How should one open .eml files in linux ? I'm not sure if `mutt` can handle it ? **UPDATE** I worked it out partially , by creating a new mailbox: `mkdir -p a/{cur,tmp,new}` And place the eml file in a/cur , I could read it with: `mutt -f` But that's not exactly what I want yet


Writing a Bash script to run and end at specific times

I'd like to create a script that will do the following. Start at a given time during the day and end at another given time. So for example, I have a program I'd like to test, so my script would be set to start at say 10:00pm and continue to run until 9:00am. This follows on from my other question about running programs again and again. I have the following:               #!/bin/bash          trap "echo manual abort; exit 1"  1 2 3 15;     RUNS=0;     while open  -W /Path/to/Program.app     do         RUNS=$((RUNS+1));         echo $RUNS > /temp/autotest_run_count.txt;     done          exit 0      This script essentially runs my program (in Mac OSX) and catches any failures, otherwise it will re-run the program when it closes. I'd like to be able to run this like I mentioned above. Start at 10:00pm. Finish at 9:00am. Your advice is always useful. Thanks! Euden


Why jobs aren't killed at logout when executed with "> /dev/null 2>&1 &"?

When you run jobs like the example below, they're killed when you logout:               $ ./job.sh &      However, when you execute them as in the below example, redirecting stdout to `/dev/null` and stderr to stdout as well as putting the job in the background, they're not killed when you log out. It's somewhat like nohup, except that the output goes to `/dev/null` instead of a file.               $ ./job.sh > /dev/null 2>&1 &      I noticed that some daemons work like that and then I got curious to know the reason why they aren't killed at logout. Can someone explain me why? ### EDIT 1: As suggested by @Patrick on his comment, I tried the same with the simplest job ever and the result is the same: the job does not die when I log out.               # while true; do sleep 1; done > /dev/null 2>&1 &     [1] 4320     # logout          luis-macbook:~ luis$     luis-macbook:Downloads luis$ ssh server     luis.alen@server's password:      # jobs     #     # ps -ef | grep 4320     root      4320     1  0 01:17 ?        00:00:00 -bash      ### EDIT 2: As requested by Patrick again, I did the same test without redirecting the streams and, to my surprise, the process didn't die. Now I'm completely confused... I swear I remember processes put in background dying when you logged out. Am I absolutely wrong?               # while true; do sleep 1; done &     [1] 20720     # logout     luis-macbook:~ luis$ ssh server     # jobs     #     # ps -ef | grep 20720     root     20720     1  0 23:31 ?        00:00:00 -bash


Screenshot of non active window

How to take a screen shot of non active window? If I have 2 windows, I want to capture the screenshot of the one which is running in the background.


Cannot control brightness with Fedora 14 on Compaq CQ42

I've done the primary searching of similar questions, Found some, tried the solutions and they didn't work for me. So asking again. All the keys of my Fn combination works except the brightness ones. And there are no options to control brightness in Monitor or Power Management settings. Update: If I boot without those two `acpi_osi` and `acpi_brightness` parameters, and run `acpi_listen` on terminal and press those brightness keys, I get these outputs -               video/brightnessdown BRTDN 00000087 00000000     video/brightnessup BRTUP 00000086 00000000      if I run `acpi_listen` after booting with those two acpi parameters, `acpi_listen` gives me nothing when I press those keys. Update: There is no `backlight` folder under `/sys/devices/virtual/`.


How to edit hotspot settings in Linux mint 14.04?

I am trying to create a soft hotspot in Linux Mint 17, but when I try I am not able to edit username/password for the created hotpsot moreover it is not detected by my mobile. Below is the screenshot of Networking window. ![enter image description here](http://i.stack.imgur.com/pooWe.png) **How can I get the options to configure my hotspot?** **Or is there any other package available to do it better?**


Assignment to variables

I was trying to devise a solution to a different question asked on the site and came across this curious issue. Here is the set of commands that I issued:               $ foo=82a9948422     $ echo $foo     82a9948422     $ echo $foo | sed 's/./&\     /g' | sort | uniq -c | sort -n -r | head -1 | awk '{print $1}'     3     $ count=`echo $foo | sed 's/./&\     /g' | sort | uniq -c | sort -n -r | head -1 | awk '{print $1}'`     $ echo $count     1     $      Notice how the number of unique characters in the variable is 3 but when I assign it to a variable, it reports the count as 1. I'm puzzled. Can someone explain the discrepancy please?


Shell scripting: -z and -n options with if

I have a shell script where we have following lines `if [ -z "$xyz" ]` and `if [ -n "$abc" ]`, but I am not sure what their purpose is. Can anyone please explain?


What does it mean for an email message to be "old"?

I just recently converted my mbox over to Maildir, and when I opened up mutt, I saw an 'O' flag on some messages. Looking this up, I find that it means the message is marked as "Old". However as soon as I read the message, the flag disappears. This seemed rather strange to me. What does it mean for a message to be "Old", and why would it no longer be old if I have read it?


Filesystem for Gentoo root?

I need a fast and space eficient filesystem for my Gentoo workstation. I have some expirience with ext4 and found it very slow on lots of small files inside the filesystem. I am considering another filesystem, but don't know what to use: suggestions?


Why can a system become unresponsive?

I just executed `dot` (a program for drawing directed graphs) with an input file that was so big that it couldn't be rendered in a reasonable amount of time. My whole system froze. I could barely make it to a text console with `Ctrl`+`Alt`+`F1` to kill `dot`, but it took several minutes. Why does the system allow something like this? Why does it give a non-critical program such as `dot` 99% of the system and use the remaining 1% for staying responsive?


What does raw/unraw keyboard mode mean?

In the magic sysrq key combinations, there is the combination `alt+sysrq+r` which, according to wikipedia, does the following: > Switch the keyboard from raw mode, the mode used by programs such as X11 and > svgalib, to XLATE mode What is raw mode? and what is XLATE mode? Can I switch back to raw mode once I have switched to XLATE mode? How can I tell which mode my keyboard is in?


Mounting LVM2 volume gives me 'mount: you must specify the filesystem type'

I have a LVM2 Volume Group 'vgXEN' with a Logical Volume in it called 'test- disk'.   This is the output of **lvdisplay** :               --- Logical volume ---     LV Path                /dev/vgXEN/test-disk     LV Name                test-disk     VG Name                vgXEN     LV UUID                lHSgfx-wnY2-OtRO-zw7l-9SFA-mnht-KgK9MO     LV Write Access        read/write     LV Creation host, time DRAKE, 2013-08-26 12:02:08 +0200     LV Status              available     # open                 0     LV Size                10.00 GiB     Current LE             2560     Segments               1     Allocation             inherit     Read ahead sectors     auto     - currently set to     4096     Block device           253:4      And this is the output of **lvscan** :               ACTIVE            '/dev/vgXEN/test-disk' [10.00 GiB] inherit      Now when i try to mount this logical volume with the command i get an error:               mount /dev/vgXEN/test-disk /mnt/test     mount: you must specify the filesystem type      My operating system is 'Linux DRAKE 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux'.   Searched the Internet but couldn't find anything useful. Can anybody point me in the right direction please ? Thx ! _UPDATE_ The whole problem is related to storing XEN images and the way i want to backup them (via snapshot / mounting). Below you can read what i did wrong and the way it should be done. **What i did wrong**   I've created 1 logical volume per XEN image, thus storing the disk and swap partition into 1 LV: > LogicalVolume-A > >> xvda1 (disk)   >  xvda2 (swap) When you try to mount this LV it tells you 'mount: you must specify the filesystem type' and nothing happens of course. This is because the mount program doesn't know how to read partition tables inside a LV as the people stated in the answers below. **The way to do it**   Create 1 logical volume per partition, thus storing the disk into 1 LV and the partition into 1 LV: > LogicalVolume-A > >> xvda1 (disk) > > LogicalVolume-B > >> xvda2 (swap) It's now possible to format these logical volumes and use them into your images as storage. Once formatted you are also able to mount them with this simple command               mount /dev/vgXEN/test-disk /mnt/test


useradd --no-log-init [comprehension question]

**TLDR** : How is `useradd --no-log-init` actually used [in GNU/Linux [Debian]? I read the command's `man` and `info` page about this option as: » _user will not be listed in the`lastlog` and `faillog` files ⁄ output_«. I know that the `PAM` module took over most of the actual login work. I understand the `lastlog` and the `faillog` commands, and I'm aware that via the latter e.g. the number of login attempts and such can be set. I also know that bad login attempts are recorded in `/var/log/utmp`. This strengthens my _suspicion_ that this command is »leftover« from back then before `PAM` module took over the job.


equivs-build / apt-get: how to preserve directory

I'm building some packages for a private repository using `equivs-build`. The files are installing ok using `apt-get install` but when I go to remove them they are trying to delete the whole folder structure they are installed to. In the equivs file I have the line:               Files: <file to copy> /usr/local/sbin/<file>      When I run `apt-get remove` there are messages about '.. directory /usr/local not empty so not removed.' The 'sbin' folder is removed. Is there some way to prevent this?


How to view source of "string.h" and other library function source code in gedit of Ubuntu?

I remember viewing source code of library function but now I don't know how to view it. Can someone help me viewing source code of library function?


Can I use the same binary on Linux, *BSD and Illumos?

I want to know, if I can use the binary of a program without modification on the three systems? After all they are all Unices. I talk about the same architecture.


Syncing directories in both directions with rsync

I happen to know about rsyn, and I use rsync to sync between my mac and a linux server as follows.               rsync -r -t -v MAC LINUX     rsync -r -t -v LINUX MAC      I expected to run the first command to sync, but I needed the second command also when a change is made in LINUX. Am I missing something? Does rsync have an option to sync between two directories?


How to detect a working ttyUSB for my usb modem

I working with OpenWRT and need setup USB 3G Modem. When i connect USB modem i see in logs that system create four ttyUSB. Why four?               Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.220000] usbserial_generic 1-1:1.0: The "generic" usb-serial driver is only for testing and one-off prototypes.     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.230000] usbserial_generic 1-1:1.0: Tell linux-usb@vger.kernel.org to add your device to a proper driver.     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.240000] usbserial_generic 1-1:1.0: generic converter detected     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.280000] usb 1-1: generic converter now attached to ttyUSB0     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.280000] usbserial_generic 1-1:1.1: The "generic" usb-serial driver is only for testing and one-off prototypes.     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.290000] usbserial_generic 1-1:1.1: Tell linux-usb@vger.kernel.org to add your device to a proper driver.     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.300000] usbserial_generic 1-1:1.1: generic converter detected     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.340000] usb 1-1: generic converter now attached to ttyUSB1     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.340000] usbserial_generic 1-1:1.2: The "generic" usb-serial driver is only for testing and one-off prototypes.     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.350000] usbserial_generic 1-1:1.2: Tell linux-usb@vger.kernel.org to add your device to a proper driver.     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.360000] usbserial_generic 1-1:1.2: generic converter detected     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.440000] usb 1-1: generic converter now attached to ttyUSB2     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.450000] usbserial_generic 1-1:1.3: The "generic" usb-serial driver is only for testing and one-off prototypes.     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.450000] usbserial_generic 1-1:1.3: Tell linux-usb@vger.kernel.org to add your device to a proper driver.     Tue Jul 29 07:45:23 2014 kern.info kernel: [  580.460000] usbserial_generic 1-1:1.3: generic converter detected     Tue Jul 29 07:45:24 2014 kern.info kernel: [  580.500000] usb 1-1: generic converter now attached to ttyUSB3      After this i know that modem is working. Therefore i setup network interface where i must select a working ttyUSB. But how can i know which ttyUSB is work? For each port i run               gcom -d /dev/ttyUSB0 info     gcom -d /dev/ttyUSB1 info     etc...      For find working port. But this method is not good because slow and hard to parse. I should write a bash script to detect working ttyUSB for my modem and put in network config. How can i do it? My router have only one USB port. Every USB 3G Modem use different ttyUSB port. PS. How can i imagine i can send some data to each port and check result. If result good, then use this ttyUSB.


Make 'CTRL-/' behave the same in vtty and xterm

When I press `Ctrl`+`/` in a graphical terminal (e.g. xterm) I get "undo". However, in a virtual terminal (e.g. `Ctrl`+`Alt`+`F1`) I get "backspace". In practice I run into this when I'm using emacs in a virtual terminal, probably debugging some X problem, and I try to use `C`+`/` to undo but instead get a backspace. I believe I have experienced this on multiple computers over the years, so I don't think it's very specific to my current setup (ubuntu).


lsof for a specific process?

There's a `bzip2` process running in the background and I have no idea where it came from. It's eating up a lot of resources. Can I do a reverse `lsof` to see which files are being accessed by this process? I've suspended the process for the time being.


How to remove a trailing CRLF from a file?

I have a binary file with a trailing CRLF (2 bytes total) that I want to remove. How should I do it? Please note that I'm using busybox and I don't have perl.


vboxdrv setup error in debian

I try to run this command in terminal and this error happened:               root@ali-lapdeb:/home/alireza# /etc/init.d/vboxdrv setup     Stopping VirtualBox kernel modules ...failed!       (Cannot unload module vboxdrv)      and this my dmesg output : http://codepad.org/GjMsU9Rp (I paste code here because i not allowed to enter this much code) What is this lines :               [ 9557.201022]  [<ffffffffa0ea8000>] ? 0xffffffffa0ea7fff     [ 9557.201076]  [<ffffffffa0e69f77>] ? supdrvInitDevExt+0x187/0x780 [vboxdrv]     [ 9557.201144]  [<ffffffffa0e72e7e>] ? VBoxHost_RTMemAllocTag+0xe/0x30 [vboxdrv]     [ 9557.201202]  [<ffffffffa0ea8000>] ? 0xffffffffa0ea7fff     [ 9557.201255]  [<ffffffffa0ea8094>] ? VBoxDrvLinuxInit+0x94/0x1000 [vboxdrv]     [ 9557.201311]  [<ffffffff81002162>] ? do_one_initcall+0x112/0x170     [ 9557.201358]  [<ffffffff810c6937>] ? load_module+0x1b07/0x23f0     [ 9557.201403]  [<ffffffff810c3530>] ? m_show+0x1c0/0x1c0     [ 9557.201443]  [<ffffffff810c734d>] ? SyS_finit_module+0x6d/0x70     [ 9557.201491]  [<ffffffff814ae4f9>] ? system_call_fastpath+0x16/0x1b      and what is my problem ? * * * linux debian testing,acer 5741G,               root@ali-lapdeb:/home/alireza# apt-cache policy virtualbox     virtualbox:       Installed: (none)       Candidate: 4.3.10-dfsg-1       Version table:          4.3.10-dfsg-1 0             500 http://ftp.debian.org/debian/ testing/contrib amd64 Packages          4.3.6-dfsg-2 0             100 /var/lib/dpkg/status     root@ali-lapdeb:/home/alireza# uname -a     Linux ali-lapdeb 3.13-1-amd64 #1 SMP Debian 3.13.7-1 (2014-03-25) x86_64 GNU/Linux


remove only specific text occurrences from string using sed

I have a text file that contains many rows of this sort of thing:               /*[17:51:27][1 ms]*/ UPDATE `country` SET `region_id` = '4' WHERE `country_id` = '36';       Is there a way that I can use `sed` to remove the comments _only_ , so that's everything that starts with a `/*` and ends with a `*/`? This would make the line become:               UPDATE `country` SET `region_id` = '4' WHERE `country_id` = '36';      I know how to use `sed` to remove an entire line that starts with something, in the example of a text file with SQL in it it would likely be a hash symbol `#`.


How do systemd and chkconfig interact with respect to services and runlevels?

I recently updated some of our machines to Fedora 17. I have noticed that there are some services that I can configure their runlevels using `chkconfig`, while others don't appear there at all, and can be configured using `systemctl`. For example, there are the similar commands `chkconfig network off` and `systemctl disable NetworkManager.service`. (I understand that `network` and `NetworkManager` are different, that's not the point.) Why are some services configurable via one tool and not the other? Does one tool replace the other? For example, runlevels are very obvious with `chkconfig`, but I can't even tell if that concept exists with `systemd`. Edit: I found a table that maps calls from chkconfig to systemctl


Errors during 32-bit glibc2.17 compile

I'm trying to compile the current glibc (2.17) from the official ftp on my machine (kernel 3.7.3). No patches or extras are applied. For x86_64 everything works fine, but I need the 32-Bit libs as well. According to the manual, I run this to configure (64-bit already installed):               ../../src/glibc-2.17/configure --prefix=/home/user/glibc32 --enable-kernel=3.7.3 BUILD_CC='gcc' CC='gcc -mx32' CXX='g++ -mx32'      At first, I got the error specified in the following line from pread.c and pwrite.c               #ifdef __NR_pread64   /* Newer kernels renamed but it's the same.  */     # ifdef __NR_pread     #  error "__NR_pread and __NR_pread64 both defined???"     # endif     # define __NR_pread __NR_pread64     //Match __NR_pwrite* for pwrite.c accordingly     #endif      That didn't make any sense to me, so i changed those to:               #ifdef __NR_pread64   /* Newer kernels renamed but it's the same.  */     # ifndef __NR_pread     #  define __NR_pread __NR_pread64     # endif     #endif      Now my error is swapon (misc/swapon.c) not matching the prototype (sys/swap.h):               int     swapon (path)         const char *path;     {         __set_errno (ENOSYS);         return -1;     }          stub_warning (swapon)      The prototype is:               /* Make the block special device PATH available to the system for swapping.     This call is restricted to the super-user.  */     extern int swapon (const char *__path, int __flags) __THROW;      This is clearly no match, but I have no idea, how to bypass this... There must have been people before me who have tried this and I cant imagine there being this kind of errors in a glibc release. What am i doing wrong? Should i continue these kind of "fixes"? I cant really just pass 0 as the second parameter, or can I?


Creating links to websites

I'm using Ubuntu 12.04 and I would to create a folder with all of my shortcuts. Is it possible to create icons (like usual links to files in my harddisk) that automatically launch my browser and open a specific page? For example, I would like to have an icon on my desktop that automatically opens the StackExchange homepage. How can I do that?


How to convert *text* to {\i text} with sed?

I would like to replace every occurrence of *text* into {\i text}.               text *text* text     *text* text *text*     *text text text* text      should become               text {\i text} text     {\i text} text {\i text}     {\i text text text} text      etc. How can I do this?


How do you protect a plain text credentials file with the username and password?

I am trying to setup an auto-mounting network drive. The network drive requires a user/pass. In the man page for "mount.cifs" there are two ways to provide the user/pass.   1. [not recommended] put the user/pass in /etc/fstab   2. create a separate credentials file and put the user/pass in the credentials file "[option 2] is preferred over having passwords in plaintext in a shared file, such as /etc/fstab. **Be sure to protect any credentials file properly.** "   * My background is: software developer, lots of linux software development (installing development libraries, installing applications like Eclipse, or java). I am not an IT or sysadmin guy.    * This is on my own development machine **Given my lack of IT/sysadmin background, what is the standard suggested method for "protecting any credentials file properly"?** (I would also appreciate, if there are multiple methods for protecting the credentials file, to please list in order of most common to least and describe the tradeoffs.)


KVM Domain not creating

While I am trying to create a new KVM Machine , I am getting the following error ,               Unable to complete install: 'Domain has not existed.  You should be able to find more information in the logs'          Traceback (most recent call last):       File "/usr/share/virt-manager/virtManager/asyncjob.py", line 44, in cb_wrapper         callback(asyncjob, *args, **kwargs)       File "/usr/share/virt-manager/virtManager/create.py", line 1910, in do_install         guest.start_install(False, meter=meter)       File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1223, in start_install         noboot)       File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1303, in _create_guest         self._consolechild) = self._wait_and_connect_console(consolecb)       File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1328, in _wait_and_connect_console         raise RuntimeError(_("Domain has not existed.  You should be "     RuntimeError: Domain has not existed.  You should be able to find more information in the logs      **NOTE:** I am getting this error while I am trying to use custom Storage pool that is , `/dev/sdaXX/` mounted on `/vmstore` mount point & image file path `/vmstore/disk.img` ERROR_LOG               2014-03-24 21:06:48.178+0000: 7166: error : virNetSocketReadWire:1194 : End of file while reading data: Input/output error     2014-03-24 21:07:56.242+0000: 7170: warning : qemuSetupCgroupForVcpu:566 : Unable to get vcpus' pids.     2014-03-24 21:07:56.329+0000: 7166: error : qemuMonitorIO:614 : internal error End of file from monitor     2014-03-24 21:16:04.269+0000: 7167: warning : qemuSetupCgroupForVcpu:566 : Unable to get vcpus' pids.     2014-03-24 21:16:04.344+0000: 7166: error : qemuMonitorIO:614 : internal error End of file from monitor     2014-03-24 21:16:24.361+0000: 7167: warning : qemuSetupCgroupForVcpu:566 : Unable to get vcpus' pids.     2014-03-24 21:16:24.436+0000: 7166: error : qemuMonitorIO:614 : internal error End of file from monitor


Scripting - Folders with spaces

I'm trying to write a script that's robust enough to work with spaces. Its currently in a for loop, but the problem I'm having is folders with spaces in its name.               ASOURCE="Home Photos 2012 camcorder" #example filename     if [ -d "$(echo $ASOURCE)" ] # If directory exists     then     #command     else     echo "File does not exist: " $1 #Error     echo "DIR :" $(echo $ASOURCE | sed 's/\ /\\ /g')     fi      It fails on the the verification. I've tried pre-escaping the spaces, but to no avail


Negatives of running processes with real-time priority?

The question is as the title says, are there any downsides of running processes with real-time priority (`chrt -f 99`)? My hypothesis is that this combined with an affinity will ensure that any pre- emption of my process is minimal and therefore any jitter (specifically network latency) will be minimised - this will not help with overall latency, but at this moment I'm more concerned with jitter. (Kernel: 2.6.16/3.0)


List of top level folders with contents no younger than 30 days

I have an automated system for creating FTP accounts (vsftpd with jailed virtual users) that works well, but I still rely on manual cleanup of stale accounts. My definition of a stale account is one in which no files or folders exist that are less than 30 days old. So far, I can run this:               find /home/vsftpd -ctime +30 |awk -F'/' '{print $4}' |sort -u       Which will give me a list of folder containing _at least one_ file older than 30 days. I could also run with `-ctime -30` and, with some heavy looping, negate that list to get me the information I need. I'm hoping there's a way to do this as a (moderately sensible) one-liner, but my find-foo fails me at this point. Can anyone help?


HDD allocation fstab

In my PC running Ubuntu 12.04 LTS I have installed three SATA hard drives. Two of them are installed near a cooler. I want to physically switch two drives (one that is not near the fan should be moved near the fan). How would Ubunutu deal with the switch? The device names in fstab, are they in any way relying on the sata port that they are connected to on my motherboard? EDIT: This is my /etc/fstab               # <file system> <mount point>   <type>  <options>       <dump>  <pass>     proc                                       /proc             proc  nodev,noexec,nosuid  0  0       # / was on /dev/sda1 during installation     UUID=f04e6038-4412-46c4-b58d-67bfe3f8eddd  /                 ext4  errors=remount-ro    0  1       # /Volumes/Backup was on /dev/sdb1 during installation     UUID=dc25bafb-adbc-4a65-845c-02c9253a795e  /Volumes/Backup   ext4  defaults             0  2       # /Volumes/Storage was on /dev/sdc1 during installation     UUID=74867f3e-acda-4efc-a6aa-7d21484d64a4  /Volumes/Storage  ext4  defaults             0  2       /dev/sdc2                                  /Volumes/Storage  ext4  defaults             0  0       #/dev/sdc1                                  /media/sdc1       swap  sw                   0  0      /dev/sdc1        none        swap        defaults        0        0       EDIT (changed /etc/fstab according to comments):               # /etc/fstab: static file system information.     #     # Use 'blkid' to print the universally unique identifier for a     # device; this may be used with UUID= as a more robust way to name devices     # that works even if disks are added and removed. See fstab(5).     #     # <file system>                            <mount point>             <type>  <options>            <dump>  <pass>     proc                                       /proc                     proc    nodev,noexec,nosuid  0       0       UUID=f04e6038-4412-46c4-b58d-67bfe3f8eddd  /                         ext4    errors=remount-ro    0       1       UUID=dc25bafb-adbc-4a65-845c-02c9253a795e  /Volumes/Backup           ext4    defaults             0       2       UUID=74867f3e-acda-4efc-a6aa-7d21484d64a4  /Volumes/Storage          ext4    defaults             0       2        UUID=88ee73e8-7556-40fa-b696-fbc15161036b  none                      swap    defaults             0       0


login scenario and root ssh access block

I'm kinda new to linux so bear with me. I followed a tutorial on how to grant root access to other users and what I did was, in `/etc/passwd/` I changed the other users' uid/gid to `0:0`. The problem is that once I block ssh access to user root by changing `PermitRootLogin` to no in `sshd_config`, all other users that share the `0:0` uid/gid also loose access via ssh to the box. Help please..., or guide in right path to achieving this... **_the box does not have internet access, so, installing sudo/sudoer to manage users it's not possible_**


How do I configure logging for ulimits?

I was wondering if anything gets logged when any ulimits are hit (open files, etc). If so, where is this logged, and what should I be looking for? I'm using CentOS 6.


Disable sliding feature of tray icons

![](http://i.imgur.com/xz6Ms.jpg) I want to disable sliding feature of these icons. I want them to be static, you know just like Windows perhaps. When I hover my mouse over them they slide & it greatly annoys me to again relocate my mouse pointer. I just want to get rid of the sliding feature.


What do the colours in iptstate mean?

I'm running iptstate to try and resolve a VPN issue through my router, and some of the traffic is highlighted in green and some is highlighted in red as I move the cursor up and down the list. I don't know what the significance is - the man page doesn't provide any details. The red traffic is over gre protocol - and the greens are all tcp.


Is this method safe or recommended for moving a /home directory?

I have my linux install on a small disk. I want to put the home directory on a different hard-drive. I was thinking of using this and then this. Would this work? Is there a better way? Should I just move the entire thing to the new harddrive? The first article describes how to put your home directory into a new partition. The second one describes how to move a partition to a new hard drive.


Can I install Mint to another hard drive without booting from it?

Is there an easy way, given an ISO image for Linux Mint, to install it to an empty hard drive from within my existing Ubuntu installation? I don't have any CDs or appropriate USB devices at hand, so I'm looking for a convenient way to install it without going out and buying some.


Best practice to use $? in bash?

When I read this answer about $? another question comes to mind. Is there any best practice for how to use $? in bash? * * * Let's have a example: We have a linear script and I we would like to know that all the command was executed ok. Do you think it is ok to call a small function (let's call it "did_it_work"), to check the error code and break if it's not.               #!/bin/bash           function did_it_work {         code=$1         if [ "$code" -ne "0" ]         then             echo "Error failure: code $code "             exit 1         fi     }          dir=some/path          mkdir -p $dir     did_it_work $?           cd $dir     did_it_work $?           run_some_command     did_it_work $?       This approach of course means that I have to manually solve the problem if there is any and rerun the script. Do you think this is a good idea or is there some other best practice to do this? /Thanks


Re-escape brackets in PS1

As others have pointed out, color codes in `PS1` should be bracketed by `\\[` and `\\]` to avoid them taking up horizontal space. I've added the necessary code to `.bashrc`:               highlight()     {         if [ -x /usr/bin/tput ]         then             printf '\['             tput bold             printf '\]'             printf '\['             tput setaf $1             printf '\]'         fi         shift         printf -- "$@"         if [ -x /usr/bin/tput ]         then             printf '\['             tput sgr0             printf '\]'         fi     }          highlight_error()     {         highlight 1 "$@"     }      The last function is used in `PS1` in both normal and escaped command substitutions to be able to change the string based on the result of the previous command:               # Exit code     PS1="\$(exit_code=\${?#0}     highlight_error \"\${exit_code}\${exit_code:+ }\")"          ...          if [ "$USER" == 'root' ]     then         PS1="${PS1}$(highlight_error '\u')"     else         PS1="${PS1}\u"     fi      The issue is then that the escaped brackets are output as literals, so my prompt looks like this after running a command which doesn't exist:               \[\]\[\]127 \[\]user@machine:/path     $      Wrapping the escaped `highlight_error` in `printf %b` didn't help. How can I fix the output so that I can **use the functions for both normal and escaped command substitutions**?


How to handle backspace while reading?

How do I handle the backspaces entered, it shows `^?` if tried & how `read` counts the characters, as in `12^?3` already 5 characters were complete(though all of them were not actual input), but after `12^?3^?` it returned the prompt, weird. Please help!               -bash-3.2$ read -n 5     12^?3^?-bash-3.2$


strace for library calls

I know of strace, which is super handy for watching system calls. Is there an equivalent that can trace calls to external libraries? For example, I'm trying to debug some SSLeay misbehavior with a third-party binary that I cannot access the code for (and who's developer is unresponsive). I believe I have nailed down the problem, but I can't test this without seeing exactly how the data being signature-checked is being formatted for sending off to SSLeay.


How do I temporary change my keyboard layout on Debian? (no X)

How can I quickly change my keyboard layout between US and German? `setxkbmap` does not apply here, as I only have an SSH shell. Persistent changes via               dpkg-reconfigure keyboard-configuration     dpkg-reconfigure console-data      are unwanted as well. I suppose the solution is very simple, but I did not find it.


awk date identification from input file

I currently have daily files that come in via FTP with incorrect dates in the first column of the file. I have figured out how to deduct one day to derive the correct date and print this to a new file. However, as the files come in every day the file name will change and I want to cron the script. My question is how do I get my script to identify the date appended on the end of the in file file and append to the output file? data contained in file:               End Date,Name,Amount     02/07/2014,data1, data2     02/02/2014,data1, data2     02/06/2014,data1, data2     02/06/2014,data1, data2     02/06/2014,data1, data2     02/10/2014,data1, data2     02/12/2014,data1, data2     02/20/2014,data1, data2     02/20/2014,data1, data2     02/21/2014,data1, data2     02/28/2014,data1, data2      Script:               awk 'BEGIN{FS=OFS=","}          NR==1 {print}          NR>1 {            ("date -d \""$1" -1 day\" +%m/%d/%Y")|getline newline            $1=newline            print          }' wrongdates{date1}.csv > correctdates{date1}.csv      'Date1' format is usually `20140228` or `%Y%m%d` _*_ *further to the above I have discovered that this only works on my unix box and not on solaris. I have managed to move it over to nawk on the solaris box but it is now complaining that 'date -d' is not supported and when ever I try to change this I get 'date: bad conversion'. Furthermore the above does not take into account weekends when altering the dates with in the file as I only care about business days and I am trying to introduce if and else statements. as per the below                   nawk 'BEGIN{FS=OFS=","} NR==1 {print};NR>1 {if (date "$1" "+%u"==1) ("date -d \""$1" -1 day\" +%m/%d/%Y")| getline newline; $1=newline; {print}; else ("date \""$1" -3 day\" +%m/%d/%Y")| getline newline; $1=newline; print}' StateStreetPositions20140228.csv      I seem to be getting no ware with the syntax of my if and else statements.


`cd` all screens to the PWD of the current screen

Suppose that I am running `screen` on a remote server with four open screens. Is there a quick way to `cd` all the screens to the working directory of the currently-open screen?


why debian repository does not contain lokkit?

I was using lokkit in redhat, and I want to use it in debian, but it seems that debian doesn't contain it...


How does systemd-tmpfiles work?

I'm trying to change the value of `/sys/bus/usb/devices/4-3/power/wakeup` at every boot (4-3 according to my `lsusb`, it's the keyboard ID). The default value is:               # cat /sys/bus/usb/devices/4-3/power/wakeup     enabled      The classic "online" editing works as expected:               # echo disabled > /sys/bus/usb/devices/4-3/power/wakeup     # cat /sys/bus/usb/devices/4-3/power/wakeup     disabled      I'm using a systemd distro so I'd like to use the systemd-way to edit "temp files" I have created the following file:               # cat /etc/tmpfiles.d/disable-usb-wakeup.conf      w /sys/bus/usb/devices/4-3/power/wakeup - - - - disabled      but after every boot I still have the default value in this file (i.e. enabled) I'm doing something wrong? EDIT: I have done another test:               # cat /etc/tmpfiles.d/scheduler.conf      w /sys/block/sda/queue/scheduler - - - - deadline      and this one works fine! After boot I have:               # cat /sys/block/sda/queue/scheduler      noop [deadline] cfq       (the default one was the cfq scheduler) So, why this one works and the other one not?   * Because `/sys/bus/usb/devices/4-3/power/wakeup` is a symlink to `/sys/devices/pci0000:00/0000:00:12.1/usb4/4-3/` ?   * Because `/sys/bus/usb/devices/4-3/power/wakeup` contains only one word? (i.e. no spaces)


How to prevent dwm from tag switching when launching Skype

I'm running dwm and Skype included in it's tag rules:               static const Rule rules[] = {         /* class      instance    title       tags mask     isfloating   monitor */         <snip/>         { "Skype",  NULL,       NULL,       1 << 6,       False,        -1 },         <snip/>     };      Problem is that when I launching Skype dwm always switching currently selected tags to Skype tag to show itself. While all other application in such case just silently load and doesn't affect selected tags.


gunzip all .gz files in directory

I have a directory with plenty of .txt.gz files (where the names do not follow a specific pattern.) What is the simplest way to gunzip them? I want to preserve their original names, so that they go from whatevz.txt.gz to whatevz.txt


Git: Fixing wrong object headers

I have a git repository that is not corrupt (all object files remains, i can commit to it and so on). It was orginally created by migration from svn using "svn2git" if i recall correctly. Recently I decided to try to wipe some big data files from the repository history using "git filter-branch" but it bailed on certain commits (the same commits can more easily be listed using "git fsck"):               git fsck --full     Checking object directories: 100% (256/256), done.     error in commit 1e04e033e642f9310bd7b0e6745f3ef775a15f15: invalid author/committer line - bad email     error in commit 313a8574deb9c71bea7f69586a092c9906fb4bba: invalid author/committer line - bad email      plus another 30 or so commits with the same error. It took me a while to figure out how to unpack the git objects, so here's how i did it: ONE. move the pack file outside of the .git directory:               mv .git/objects/pack/pack-40570d231c361ba427f63273ac1e3c7ad03b5de5.pack tmp/ TWO. unpack the pack file:               git unpack-objects < tmp/*.pack      The object files should now be in .git/objects THREE. Unpack individual object, using zpipe from http://www.zlib.net/zpipe.c               zpipe -d < .git/objects/1e/04e033e642f9310bd7b0e6745f3ef775a15f15     commit 276tree 591e98a0b53880a22f18f5bedefe133166d3e67d     parent 4c33ebce11897dd52528defa41890eabc59135e3     author Martin Lindhe <martin@xxx.se     > 1382869510 +0100     committer Martin Lindhe <martin@xxx.se     > 1382869510 +0100          MIPS: improve decoder. it is now basically finished PSX disasm As seen here, the emails have a trailing newline (0x0a, as shown by piping to xxd) I tried to fix up the object and repack it, but that quickly turned my git repo into a mess, reporting:               git status     fatal: bad object HEAD      So, any ideas how to fix the object headers in order to create a fully working repository?


Difference between a.out and ./a.out

**My Confusion** `a.out` is the output of the programs which I execute in my Ubuntu 12.10. In Red Hat system when I execute `a.out` in the terminal it executes. While in Ubuntu I have to execute `./a.out` to get the output. 'a.out' doesn't work. Can somebody explain what is the difference between the commands?


How to convert html entities to readable text?

I want html number entities like ę and want to convert it to real character. I have emails mostly from linkedin that look like this: > chciałabym zapytać, czy rozważa Pan takze udział w > nowych projektach w Warszawie ? Obecnie poszukujemy specjalisty > javascript/architekta z bardzo dobrą znajomością > Angular.js do projektu, który dotyczy systemu, > służącego do monitorowania i zarządzania flotą > pojazdów. Zespół, do którego poszukujemy I'm using clawsmail, switching to html don't convert it to text, I've try to copy and use               xclip -o -sel clip | html2text | less      but it didn't convert the entities. Is there a way to have that text using command line tools? The only way I can think of is to use `data:text/html,<PASTE THE EMAIL>` and open it in a browser, but would prefer the command line.


What is the difference between [.]* and '.*' for command 'find -name'?

My goal is to find all files or directories in a filesystem that start with a dot (`.`), for example `.gnupg`. So I came up with the command:               find -name '.*'      Checking on the Internet, I saw some hints saying that I should use `[.]*` instead as the parameter value for `-name` option. What is the difference between both approach, since the result looks like the same?


cascaded grep matches color code as pattern

I am piping output of one `grep` comand into another `grep`. The first `grep` is using `\--color=always`, so that the first match is colored. In practice, that means that the match is enclosed between two color codes, i.e. `\033[1;31m` and `\033[0m`. Now the problem is if the second pattern is `m`, then it matches the color code of the previous match:               echo A B C | grep --color=always A | grep m      Similarly, the number `31` would also match. Is there any way around this ? # UPDATE: I expected it will go without saying, that I need the match to be colored. So getting rid of `\--color=always` is not a satisfactory solution for me.


What do I need in my script to be able to change ownership of a directory structure that belongs to root to the current user running the bash script?

My bash script has the following section:               su root -c chown -R smithb:other /export/home/smithb/workspace/rootownsit/     exit      The directory `rootownsit` and its two sub directories were created and is owned by `root`. I thought what I have above would work but it doesn't. Running my bash script as my user, I get prompted for the root password and then I get a usage message for `chown` after I type in the root password. I need to change ownership of the directory rootownsit and it's sub directories.


Gparted claims my internal drive is full

I intend to resize and add a new partition to my main drive, and for that purpose I have created a GParted-USB to resize my partition. However, this has proven to be more difficult than I thought, seeing as GParted claims that my internal drive is full. ![enter image description here](http://i.stack.imgur.com/M6Yqt.png) Any idea as to what's causing this, and eventually how to fix it? (Ignore the key, I shot this from Fedora.)


Arch Linux starting Wireless connection shuts down wired connection

When Im starting the wireless connection via SSH, as soon as th dhcp starts the connection(wired) to the computer stops working and the computer is only available on Wifi. Is that normal. Im using dhcpd for the wired connection and dhclient for the wireless connection (since dhcpd only timeouts with the wireless connection)


Console outputing wrong single quote character (â)

My console `yakuake` is outputting the wrong single quote character.               test.cpp: In function âint main()â:      I've tried, one by one:               export LC_CTYPE="C"         export LC_CTYPE="posix"     export LC_ALL="en_CA.UTF-8"     export LC_COLLATE=C     export LC_MESSAGES=C      but that didn't work, it still outputting that character instead of a single quote. my current `locale` output:               LANG=en_CA.UTF-8     LC_CTYPE="en_CA.UTF-8"     LC_NUMERIC="en_CA.UTF-8"     LC_TIME="en_CA.UTF-8"     LC_COLLATE="en_CA.UTF-8"     LC_MONETARY="en_CA.UTF-8"     LC_MESSAGES="en_CA.UTF-8"     LC_PAPER="en_CA.UTF-8"     LC_NAME="en_CA.UTF-8"     LC_ADDRESS="en_CA.UTF-8"     LC_TELEPHONE="en_CA.UTF-8"     LC_MEASUREMENT="en_CA.UTF-8"     LC_IDENTIFICATION="en_CA.UTF-8"     LC_ALL=      my font was "Anka Coder Condensed". How can I fix this?


How can I hide the command list in Alpine?

I run Alpine across SSH on my phone which has a fairly limited screen size. The only issue that I have is the command list at the bottom takes up valuable screen real estate. **Is there any way that I can turn the command list off (or toggle it)? *** I seem to recall spotting an 'expert mode' type option or start flag that would turn it off, but I've slept since then and my relatively quick searches through the man page and duckduckgo.com have failed to turn up anything useful.


remastering knoppix DVD

I read the remastering Knoppix howto guide at http://ftp.knoppix.net/wiki/Knoppix_Remastering_Howto and wast able to remaster a CD. However, when I tried the same for a Knoppix DVD, it failed. I researched this and it seems that one need to setup enough swap. Also, it seems that the `create_compressed_fs -B X` where X must be bigger than 65536 is required. So, I would appreciate if anyone can enlightening me and show me the path or link that have instructions to create a remastering Knoppix DVD as I have search high and low in the internet and could not find one for the Knoppix DVD.


Change the color of the file name text

I am writing scripts to initialize and configure a large system with many components.   Each component has its own log file. I would like to change the color of the component file name to red whenever an error occur on its installation/configuration. How can I do it?


cannot make protobuf on Solaris 8

I just downloaded protocol buffer (protobuf) 2.5.0 from here. Then I tried to install it on Solaris 8 (SunOS ms-sparc8 5.8). When I try to run make, I got this error.               In file included from google/protobuf/compiler/command_line_interface.h:41,                  from google/protobuf/compiler/main.cc:33:     google/protobuf/stubs/common.h:48:20: stdint.h: No such file or directory      My Solaris dont have `stdint.h`. So I tried to put a portable `stdint.h` taken from here and put it inside `/usr/include/`. After putting in the `stdint.h`, I tried to run make again and failed. Then I tried to have a look inside the file thats causing the error (command_line_interface.h & main.cc). I make an assumption that `command_line_interface.h` and `main.cc` uses `common.h` header file and the problem are caused by common.h. When I look inside the `common.h` code, I found this initialization:               #if defined(__osf__)     // Tru64 lacks stdint.h, but has inttypes.h which defines a superset of     // what stdint.h would define.     #include <inttypes.h>     #elif !defined(_MSC_VER)     #include <stdint.h>     #endif      I tried to remove `#include <stdint.h>` in `!define(_MSC_VER)` and replace it with `<inttypes.h>` hoping that it will be forced to use only `inttypes.h`. Then again, it fails. So my next guess is because the `__ost__` is not defined. What does that stand for? When I have a look inside the make log, it confuse me even more. If you need to see the make log. I have paste it here. How can I solve this? Does anyone have the same problem when installing protobuf?


Cut and transpose some lines of a file

I have 1344 rows of data column. I want to form 32 row by 42 columns from my input data file. I want to cut the first 42 row and paste to one raw of 42 column data and continue down likewise. My data is arranged as file name: data.txt               1     2     3     .     .     .     1344      I want the result be output.txt               1 2 3 ....42     43 44      84     .     .     .     1303 1304 . . . 1344      I want you help me with a script that can do it.


Unable to ssh out from my laptop

I'm unable to ssh from a particular machine, either from my Ubuntu 12.04 install or my Windows Vista install (using putty). I'm trying to ssh into a remote machine where I have an account, but I keep getting a "connection refused" error. However, from another computer in my office using the same setup, I can connect just fine Here is the ouput of `dig sun.chpc.ac.za`:               ; <<>> DiG 9.8.1-P1 <<>> sun.chpc.ac.za     ;; global options: +cmd     ;; Got answer:     ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55409     ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0     ;; QUESTION SECTION:     ;sun.chpc.ac.za. IN A     ;; ANSWER SECTION:     sun.chpc.ac.za. 2598 IN A 196.24.44.62     ;; Query time: 1 msec     ;; SERVER: 127.0.0.1#53(127.0.0.1)     ;; WHEN: Tue Oct 30 21:40:35 2012     ;; MSG SIZE rcvd: 48     "nslookup sun.chpc.ac.za" Server: 127.0.0.1 Address: 127.0.0.1#53     Non-authoritative answer: Name: sun.chpc.ac.za Address: 196.24.44.62      I stopped the Firewire and tried to ssh, but it still said "connection refused" When I run `nmap sun.chpc.ac.za`:               Starting Nmap 5.21 ( http://nmap.org ) at 2012-10-30 22:24 SAST      Nmap scan report for sun.chpc.ac.za (196.24.44.62)      Host is up (0.0044s latency).      Not shown: 998 closed ports      PORT STATE SERVICE      1863/tcp filtered msnp      2000/tcp filtered cisco-sccp     Nmap done: 1 IP address (1 host up) scanned in 2.81 seconds      Here is the output of the coommand: `ssh -vvv user@sun.chpc.ac.za`               OpenSSH_5.9p1 Debian-5ubuntu1,      OpenSSL 1.0.1 14 Mar 2012     debug1: Reading configuration data /etc/ssh/ssh_config      debug1: /etc/ssh/ssh_config line 19: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to sun.chpc.ac.za [196.24.44.62] port 22.     debug1: connect to address 196.24.44.62 port 22: Connection refused     ssh: connect to host sun.chpc.ac.za port 22: Connection refused      Here is the `ipconfig` output of the Windows computer that can connect:               Windows IP Configuration          Ethernet adapter Local Area Connection:             Connection-specific DNS Suffix  . :        Link-local IPv6 Address . . . . . : fe80::f988:68a0:c432:d37c%11        IPv4 Address. . . . . . . . . . . : 172.20.15.51        Subnet Mask . . . . . . . . . . . : 255.255.255.0        Default Gateway . . . . . . . . . : 172.20.15.254          Tunnel adapter Teredo Tunneling Pseudo-Interface:        Connection-specific DNS Suffix  . :        IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fb:3403:122f:53eb:f0cc        Link-local IPv6 Address . . . . . : fe80::3403:122f:53eb:f0cc%12        Default Gateway . . . . . . . . . : ::          Tunnel adapter isatap.{C3E90CF9-5991-4463-AC91-A1497807E5D6}:        Media State . . . . . . . . . . . : Media disconnected        Connection-specific DNS Suffix  . :      Using the same cable, here is the `ifconfig` output of my Linux laptop that can not connect:               eth0      Link encap:Ethernet  HWaddr 00:14:0b:3f:b9:4c             UP BROADCAST MULTICAST  MTU:1500  Metric:1           RX packets:135737 errors:0 dropped:0 overruns:0 frame:0           TX packets:111352 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:155954649 (155.9 MB)  TX bytes:10990034 (10.9 MB)           Interrupt:17           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:25939 errors:0 dropped:0 overruns:0 frame:0           TX packets:25939 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:2034277 (2.0 MB)  TX bytes:2034277 (2.0 MB)          wlan0     Link encap:Ethernet  HWaddr 00:13:e8:f8:0e:af             inet addr:172.1.2.33  Bcast:172.1.255.255  Mask:255.255.0.0           inet6 addr: fe80::213:e8ff:fef8:eaf/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:1885246 errors:0 dropped:0 overruns:0 frame:0           TX packets:196008 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:430638332 (430.6 MB)  TX bytes:36583180 (36.5 MB)      The output of `tcptraceroute sun.chpc.ac.za 22` is:               Selected device eth0, address 172.20.15.35, port 51859 for outgoing packets          Tracing the path to sun.chpc.ac.za (196.24.44.62) on TCP port 22 (ssh), 30 hops max           1  172.20.15.254  0.494 ms  0.431 ms  0.354 ms      2  * * *      3  196.24.44.62 [closed]  0.323 ms  0.326 ms  0.312 ms


SSH to two addresses, use the one that connects first

I have a home computer (let’s call it _franklin_ because that’s what I call it) that I often ssh into from my work laptop. When I’m at home, I ssh to franklin.local, and when I’m at work or anywhere else, I ssh to remote.address.of.franklin. I want to have a function in my profile that always connects in the correct way for the situation. My network conditions often change (wired vs. wireless, different SSIDs, etc), so I’d prefer not to do it by detecting the state of the network, but rather:   1. If franklin is available locally, connect locally,   2. else, connect remotely Here’s what I use now:               function franklin () {         ping -c 5 "franklin.local" > /dev/null         if [[ $? != 0 ]]             then             echo "franklin not available on local, so trying remote connection"             ssh -p 22 remote.address.of.franklin         else             echo "franklin available on local network, so trying local connection"             ssh username@franklin.local         fi     }      The problem is, the ping takes time. **My question is:** can I execute both ssh commands simultaneously, and then automatically use whichever one connects first?


make a 2nd root?

I was thinking, maybe i'd like to disable passwords for the root user and only use keys to log in. and if i need to login without keys have a 2nd user that is like root in everyway except has a different name. Is there a way to have a 2nd root user? Is this impossible? is it a bad idea to disable passwords?


Error updating all ArchLinux packages with -Syu

I am on Arch Linux with Kde. I haven't updated the packages in a while and I'm having a problem while trying to do so: The first thing I tried was: `sudo pacman -Syu` as the documentation says, and I get this error:               :: Synchronizing package databases...      testing is up to date      core is up to date      extra is up to date      community is up to date     :: The following packages should be upgraded first :         pacman     :: Do you want to cancel the current operation     :: and upgrade these packages now? [Y/n] y          resolving dependencies...     looking for inter-conflicts...     error: failed to prepare transaction (could not satisfy dependencies)     :: packagekit: requires pacman<3.6.0     :: package-query: requires pacman<3.6      I checked what version of pacman I had and I have v3.5.4:                .--.                  Pacman v3.5.4 - libalpm v6.0.4     / _.-' .-.  .-.  .-.   Copyright (C) 2006-2011 Pacman Development Team     \  '-. '-'  '-'  '-'   Copyright (C) 2002-2006 Judd Vinet      '--'                            This program may be freely redistributed under                            the terms of the GNU General Public License.      Which seems to be ok I guess? Just in case I tried to first update yaourt and I got the same message:                testing is up to date      core is up to date      extra is up to date      community is up to date     error: failed to prepare transaction (could not satisfy dependencies)     :: Starting full system upgrade...     :: packagekit: requires pacman<3.6.0     :: packagekit: requires pacman<3.6.0      I ran the following command to see if I could get the useful information and got this from where I couldn't get any more useful information, but maybe you can. Just in case I also tried it with KPackageKit and also got the same error:               :: packagekit: requires pacman<3.6.0     :: packagekit: requires pacman<3.6.0      I hope you have all the information you need, otherwise please ask. Thanks in advance.


pass 1 environment variable using sudo

Is this a correct way for passing an environment variable in sudo ?               sudo -u www-data -b env FOOBAR="foobar" /home/user/folder/daemon


Finding the sector size of a partition

I answered this question, _assuming_ that the `*.img` file had a sector size of `512`. How do I query a device, or the image of a device, to find the correct sector size?


Configure TP-Link TL WN723N for Debian Squeeze

I did a reinstall yesterday of my HP probook laptop using Debian Squeeze. I've been struggling with installing the rtl8192cu module, required to run the TP- Link TL WN723N USB dongle.   I am currently using kernel 3.8.6, but on the Realtek website the current driver is said to run on kernel 3.0.2. However, I managed to configure the dongle on my previous Debian installation, which used kernel 3.4.4, but now I can't remember how I did it. Looking through forums, I stumbled upon several posts, which suggested using the Windows driver (and ndiswrapper), compiling the driver from source and installing it, etc, but all these methods seem to fail in my case: in the first case ndiswrapper successfully installs the rtl8192cu driver, but modprobing ndiswrapper and ifconfig up-ping the wlan0 interface does not work. The second method also fails, as I get an error               cast from pointer to integer of different size      when using the driver on Realtek's website, or               implicit declaration of function daemonize      when compiling the driver provided here Why doesn't this work? Can rtl8192cu be compiled against kernel 3.8.6, or should I use a lower-version kernel?


CrashPlan migrate backup from Windows to Linux?

I have CrashPlan installed on my Windows partition but since I almost don't use windows anymore I want to move it to my ElementaryOS/Ubuntu installation. **The problem is:** In my Windows machine CrashPlan is configured to backup my `D:` drive which is also mounted in my Linux OS as `/media/DATA`. Is it possible to make CrashPlan understand that it's the same data so it doesn't backup it again?


Getting relative links between two paths

Say I have two paths: `<source_path>` and `<target_path>`. I would like my shell (zsh) to automatically find out if there is a way to represent `<target_path>` from `<source_path>` as a relative path. E.g. Let's assume   * `<source_path>` is `/foo/bar/something`   * `<target_path>` is `/foo/hello/world` The result would be `../../hello/world` ## Why I need this: I need like to create a symbolic link from `<source_path>` to `<target_path>` using a **relative** symbolic link whenever possible, since otherwise our samba server does not show the file properly when I access these files on the network from Windows (I am not the sys admin, and don't have control over this setting) Assuming that `<target_path>` and `<source_path>` are absolute paths, the following creates a symbolic link **pointing to an absolute path**.               ln -s <target_path> <source_path>      so it does not work for my needs. I need to do this for hundreds of files, so I can't just manually fix it. Any shell built-ins that take care of this?


To check which resource is being accessed by which process

I have some process running on my system. I need to list out which of the process at a moment has acquired/is using one or more of these in my system:   1. Ethernet    2. Camera   3. USB   4. Bluetooth   5. WiFi   6. File System etc. Is there a way to find this out ? Platform : Ubuntu/Fedora (Allowed to have SELinux as well if required to implement the above)


How to add EBCDIC support on debian/ubuntu

I have to add EBCSIC text support to deal with IBM OS text messages. I have succesfuly added EBCDIC support to a CentOS box by adding lang and encoding to `/etc/i18n/sysconfig`. I searched in the docs and the equivalent should be in debian `/etc/default/locale` but it didn't work. I have checked and the EBCDIC support is present under `/usr/share/i18n/charmaps/`


NFS does not store tails of files when program crashes

Program is running in parallel on multiple processors and is writing logs to a central host via NFS under RH7.3 or SUSE 11.3. If program crashes or hangs then tails of log files are lost and we lack information on the location and reason of the crash. Shell sync has no effect. Mounting mode is `async` for a strong reason: in case of sync mode the times of loading initial data and unloading results increase by the factor of 10, from minutes to hours. Sometimes `flush()` inserted in the program may help but it is difficult to do when the location is not known for certain. So, is it possible to force an NFS client to flush its buffers unconditionally when the process terminates, no matter how?


Wireless on Slackware

Ok, so I finally got my wireless working on Slackware. Trouble is, I don't really understand what I'm doing. I'm currently root and in order to get wireless, I first have to:               wpa_supplicant -c/etc/wpa_supplicant.conf -Dwext -iwlan0      then:               /etc/rc.d/rc.inet1 wlan0_start      If I do the second line first, I get time-out, no connection. So my questions are:   1. is there a better way to do this (am I having some kind of conflict between config files)?   2. can I automate this on startup?   3. can I automate this for another account besides root?               bash-4.1# wpa_supplicant -c/etc/wpa_supplicant.conf -d -Dwext -iwlan0 &     [1] 2935     bash-4.1# Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A'     Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'     Reading configuration file '/etc/wpa_supplicant.conf'     ctrl_interface='/var/run/wpa_supplicant'     ctrl_interface_group='0'     eapol_version=1     ap_scan=1     fast_reauth=1     Priority group 10        id=0 ssid=(##hidden##)     Priority group 0        id=1 ssid=''     WEXT: cfg80211-based driver detected     SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf       capabilities: key_mgmt 0xf enc 0xf flags 0x0     netlink: Operstate: linkmode=1, operstate=5     Own MAC address: (##HIDDEN##)     wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0     wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0     wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0     wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0     wpa_driver_wext_set_countermeasures     RSN: flushing PMKID list in the driver     Setting scan request: 0 sec 100000 usec     WPS: UUID based on MAC address - (##HIDDEN##)     EAPOL: SUPP_PAE entering state DISCONNECTED     EAPOL: Supplicant port status: Unauthorized     EAPOL: KEY_RX entering state NO_KEY_RECEIVE     EAPOL: SUPP_BE entering state INITIALIZE     EAP: EAP entering state DISABLED     EAPOL: Supplicant port status: Unauthorized     EAPOL: Supplicant port status: Unauthorized     ctrl_interface_group=0     Added interface wlan0     RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8b06 len=12     RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8b1a len=16     State: DISCONNECTED -> SCANNING     Starting AP scan for wildcard SSID     Scan requested (ret=0) - scan timeout 5 seconds     EAPOL: disable timer tick     EAPOL: Supplicant port status: Unauthorized     RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8b19 len=16     Scan results did not fit - trying larger buffer (8192 bytes)     Received 7670 bytes of scan results (15 BSSes)     BSS: Start scan result update 1     (##BUNCH OF SSID's for my local removed##)     New scan results available     WPS: Unsupported attribute type 0x1049 len=6     WPS: Unsupported attribute type 0x1049 len=6     Selecting BSS from priority group 10     Try to find WPA-enabled AP     (##HIDDEN##)     Trying to associate with (##HIDDEN##)     Cancelling scan request     WPA: clearing own WPA/RSN IE     Automatic auth_alg selection: 0x1     RSN: using IEEE 802.11i/D9.0     WPA: Selected cipher suites: group 8 pairwise 24 key_mgmt 2 proto 2     WPA: clearing AP WPA IE     WPA: set AP RSN IE - (##HIDDEN##)     WPA: using GTK TKIP     WPA: using PTK CCMP     WPA: using KEY_MGMT WPA-PSK     WPA: Set own WPA IE default - hexdump (##HIDDEN##)     No keys have been configured - skip key clearing     State: SCANNING -> ASSOCIATING     wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)     netlink: Operstate: linkmode=-1, operstate=5     wpa_driver_wext_associate     wpa_driver_wext_set_drop_unencrypted     wpa_driver_wext_set_psk     Setting authentication timeout: 10 sec 0 usec     EAPOL: External notification - EAP success=0     EAPOL: Supplicant port status: Unauthorized     EAPOL: External notification - EAP fail=0     EAPOL: Supplicant port status: Unauthorized     EAPOL: External notification - portControl=Auto     EAPOL: Supplicant port status: Unauthorized     RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8b1a len=16     RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8b06 len=12     RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8b04 len=16     RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8b1a len=24     RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8c08 len=198     AssocResp IE wireless event - hexdump (##HIDDEN##)     RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     Wireless event: cmd=0x8b15 len=24     Wireless event: new AP: (##HIDDEN##)     Association info event     resp_ies - hexdump(len=182): (##HIDDEN##)     State: ASSOCIATING -> ASSOCIATED     wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)     netlink: Operstate: linkmode=-1, operstate=5     Associated to a new BSS: BSSID=(##HIDDEN##)     No keys have been configured - skip key clearing     Associated with (##HIDDEN##)     WPA: Association event - clear replay counter     WPA: Clear old PTK     EAPOL: External notification - portEnabled=0     EAPOL: Supplicant port status: Unauthorized     EAPOL: External notification - portValid=0     EAPOL: Supplicant port status: Unauthorized     EAPOL: External notification - EAP success=0     EAPOL: Supplicant port status: Unauthorized     EAPOL: External notification - portEnabled=1     EAPOL: SUPP_PAE entering state CONNECTING     EAPOL: enable timer tick     EAPOL: SUPP_BE entering state IDLE     Setting authentication timeout: 10 sec 0 usec     Cancelling scan request     RX EAPOL (##HIDDEN##)     Setting authentication timeout: 10 sec 0 usec     IEEE 802.1X RX: version=1 type=3 length=95       EAPOL-Key type=2       key_info 0x8a (ver=2 keyidx=0 rsvd=0 Pairwise Ack)       key_length=16 key_data_length=0       replay_counter - hexdump(len=8): (##HIDDEN##)       key_nonce - hexdump(len=32): (##HIDDEN##)       key_iv - hexdump(len=16): (##HIDDEN##)       key_rsc - hexdump(len=8): (##HIDDEN##)       key_id (reserved) - hexdump(len=8): (##HIDDEN##)       key_mic - hexdump(len=16): (##HIDDEN##)     State: ASSOCIATED -> 4WAY_HANDSHAKE     WPA: RX message 1 of 4-Way Handshake from (##HIDDEN##)     RSN: msg 1/4 key data - hexdump(len=0):     WPA: Renewed SNonce - hexdump(len=32): (##HIDDEN##)     WPA: PTK derivation - A1=(##HIDDEN##)     WPA: PMK - hexdump(len=32): [REMOVED]     WPA: PTK - hexdump(len=48): [REMOVED]     WPA: WPA IE for msg 2/4 - hexdump(len=22): (##HIDDEN##)     WPA: Sending EAPOL-Key 2/4     RX EAPOL from (##HIDDEN##)     IEEE 802.1X RX: version=1 type=3 length=175       EAPOL-Key type=2       key_info 0x13ca (ver=2 keyidx=0 rsvd=0 Pairwise Install Ack MIC Secure Encr)       key_length=16 key_data_length=80       replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 02       key_nonce - hexdump(len=32): (##HIDDEN##)       key_iv - hexdump(len=16): (##HIDDEN##)       key_rsc - hexdump(len=8): (##HIDDEN##)       key_id (reserved) - hexdump(len=8): (##HIDDEN##)       key_mic - hexdump(len=16): (##HIDDEN##)     RSN: encrypted key data - hexdump(len=80): (##HIDDEN##)     WPA: decrypted EAPOL-Key key data - hexdump(len=72): [REMOVED]     State: 4WAY_HANDSHAKE -> 4WAY_HANDSHAKE     WPA: RX message 3 of 4-Way Handshake from (##HIDDEN##)(ver=2)     WPA: IE KeyData - hexdump(len=72): (##HIDDEN##)     WPA: RSN IE in EAPOL-Key - hexdump(len=26): (##HIDDEN##)     WPA: GTK in EAPOL-Key - hexdump(len=40): [REMOVED]     WPA: Sending EAPOL-Key 4/4     WPA: Installing PTK to the driver.     wpa_driver_wext_set_key: alg=3 key_idx=0 set_tx=1 seq_len=6 key_len=16     EAPOL: External notification - portValid=1     State: 4WAY_HANDSHAKE -> GROUP_HANDSHAKE     RSN: received GTK in pairwise handshake - hexdump(len=34): [REMOVED]     WPA: Group Key - hexdump(len=32): [REMOVED]     WPA: Installing GTK to the driver (keyidx=2 tx=0 len=32).     WPA: RSC - hexdump(len=6): 00 01 00 00 00 00     wpa_driver_wext_set_key: alg=2 key_idx=2 set_tx=0 seq_len=6 key_len=32     WPA: Key negotiation completed with  [PTK=CCMP GTK=TKIP]     Cancelling authentication timeout     State: GROUP_HANDSHAKE -> COMPLETED     CTRL-EVENT-CONNECTED - Connection to (##HIDDEN##) completed (auth) [id=0 id_str=]     wpa_driver_wext_set_operstate: operstate 0->1 (UP)     netlink: Operstate: linkmode=-1, operstate=6     EAPOL: External notification - portValid=1     EAPOL: External notification - EAP success=1     EAPOL: SUPP_PAE entering state AUTHENTICATING     EAPOL: SUPP_BE entering state SUCCESS     EAP: EAP entering state DISABLED     EAPOL: SUPP_PAE entering state AUTHENTICATED     EAPOL: Supplicant port status: Authorized     EAPOL: SUPP_BE entering state IDLE     EAPOL authentication completed successfully     RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])     RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added     EAPOL: startWhen --> 0     EAPOL: disable timer tick     bash-4.1# /etc/rc.d/rc.inet1 wlan0_start     bash-4.1# BSS: Expire BSS 0 due to age     BSS: Remove id (##HIDDEN##)     BSS: Remove id (##HIDDEN##)     BSS: Remove id (##HIDDEN##)     (etc)      Here's the output from lspci:               ubsystem: Intel Corporation Device 1121             Flags: bus master, fast devsel, latency 0, IRQ 41             Memory at f8000000 (64-bit, non-prefetchable) [size=8K]             Capabilities: [c8] Power Management version 3             Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+             Capabilities: [e0] Express Endpoint, MSI 00             Capabilities: [100] Advanced Error Reporting             Capabilities: [140] Device Serial Number (##HIDDEN##)             Kernel driver in use: iwlagn             Kernel modules: iwlagn


Very poor read performance compared to write performance on md(raid1) / crypt(luks) / lvm

I'm experiencing very poor **read** performance over raid1/crypt/lvm. In the same time, write speeds are about 2x+ faster on the same setup. On another raid1 setup on the same machine I get normal read speeds (maybe because I'm not using cryptsetup). OS related disks: sda + sdb. I have raid1 configuration with two disks, both are in place. I'm using LVM over the RAID. No encryption. Both disks are WD Green, 5400 rpm. IO test results on this raid1:               dd if=/dev/zero of=/tmp/output.img3 bs=8k count=256k conv=fsync      - 2147483648 bytes (2.1 GB) copied, 22.3392 s, 96.1 MB/s          sync     echo 3 > /proc/sys/vm/drop_caches     dd if=/tmp/output.img3 of=/dev/null bs=8k      - 2147483648 bytes (2.1 GB) copied, 15.9 s, 135 MB/s      And here is the problematic setup (on the same machine). Currently I have only one sdc (WD Green, 5400rpm) configured in software raid1 + crypt (luks, serpent-xts-plain) + lvm. Tomorrow I will attach another disk (sdd) to complete this two-disk raid1 setup. IO tests results on this raid1:               dd if=/dev/zero of=output.img3 bs=8k count=256k conv=fsync     2147483648 bytes (2.1 GB) copied, 17.7235 s, 121 MB/s          sync     echo 3 > /proc/sys/vm/drop_caches     dd if=output.img3 of=/dev/null bs=8k     2147483648 bytes (2.1 GB) copied, 36.2454 s, 59.2 MB/s      We can see that the read performance is very very bad (59MB/s compared to 135MB/s when using no encryption). Nothing is using the disks during benchmark. I can confirm this because I checked with iostat and dstat. Details on the hardware:   * disks: all are WD green, 5400rpm, 64mb cache.   * cpu: FX-8350 at stock speed   * ram: 4x4GB at 1066Mhz. Details on the software:   * OS: Debian Wheezy 7, amd64   * mdadm: v3.2.5 - 18th May 2012   * LVM version: 2.02.95(2) (2012-03-06)   * LVM Library version: 1.02.74 (2012-03-06)   * LVM Driver version: 4.22.0   * cryptsetup: 1.4.3 Here is how I configured the slow raid1+crypt+lvm setup: parted /dev/sdc   1. mklabel gpt   2. type: ext4   3. start: 2048s   4. end: -1 Now the raid, crypt and the lvm configuration:   1. mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdc   2. cryptsetup --cipher serpent-xts-plain luksFormat /dev/md1   3. cryptsetup luksOpen /dev/md1 md1_crypt   4. vgcreate vg_sql /dev/mapper/md1_crypt   5. lvcreate -l 100%VG vg_sql -n lv_sql   6. mkfs.ext4 /dev/mapper/vg_sql-lv-sql   7. mount /dev/mapper/vg_sql-lv_sql /sql So guys, can you help me identify the reason and fix it? It has to be something with the cryptsetup as there is no such read slowdown on the other setup (sda+sdb) where no encryption is present. But I have no idea what to do. Thanks!


Can't configure NGINX to cache images

I have been trying to cache images that are stored in nginx server, I am quite new here and to nginx I have installed it and configure it with php5-fpm, I have been reading many tutorial regarding caching images and php files. I have succeeded in caching the PHP files but I can't cache the images here is part of the nginx config file:               fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;     fastcgi_cache_key "$scheme$request_method$host$request_uri";     fastcgi_cache_use_stale error timeout invalid_header http_500;     add_header X-Cache $upstream_cache_status;          server {             listen 80 default_server;         listen [::]:80 default_server ipv6only=on;          root /usr/share/nginx/html;     index index.html index.htm;          # Make site accessible from http://localhost/     server_name localhost;          set $skip_cache 0;          # POST requests and urls with a query string should always go to PHP     if ($request_method = POST) {         set $skip_cache 1;     }        if ($query_string != "") {         set $skip_cache 1;     }             location / {         try_files $uri $uri/ /index.php?$args;     }            location ~ \.php$ {         fastcgi_split_path_info ^(.+\.php)(/.+)$;              fastcgi_pass unix:/var/run/php5-fpm.sock;         fastcgi_index index.php;         include fastcgi_params;         fastcgi_cache MYAPP;         fastcgi_cache_valid 200 60m;          }          location ~* ^.+\.(jpg|jpeg|gif|png)$ {         access_log off; log_not_found off; expires 1d;     }          location ~ /\. { deny  all; access_log off; log_not_found off; }     }      now when I run `curl -I http://xxx.xxx.xxx.xxx/script.php` I can see the md5 of the script created in `/etc/nginx/cache` folder and I can see the `X-Cache : HIT` However, when I run `curl -I http://xxx.xxx.xxx.xxx/image.jpg` no file created in the `/etc/nginx/cache` and I have the following result in the console:               HTTP/1.1 200 OK     Server: nginx/1.4.6 (Ubuntu)     Date: Tue, 17 Jun 2014 08:14:37 GMT     Content-Type: image/jpeg     Content-Length: 55936     Last-Modified: Tue, 17 Jun 2014 04:30:11 GMT     Connection: keep-alive     ETag: "539fc453-da80"     Expires: Wed, 18 Jun 2014 08:14:37 GMT     Cache-Control: max-age=86400     Accept-Ranges: bytes      now it looks fine however when I run it again the expiry date will keep changing as if it is calling new image not the cache               HTTP/1.1 200 OK     Server: nginx/1.4.6 (Ubuntu)     Date: Tue, 17 Jun 2014 08:16:34 GMT     Content-Type: image/jpeg     Content-Length: 55936     Last-Modified: Tue, 17 Jun 2014 04:30:11 GMT     Connection: keep-alive     ETag: "539fc453-da80"     Expires: Wed, 18 Jun 2014 08:16:34 GMT     Cache-Control: max-age=86400     Accept-Ranges: bytes      my questions are: 1- should the cached images be shown in the cache folder? 2- does `fastcgi` capable of caching the images? 3- what can I do to fix the image caching problem? Sorry for the beginner questions, but I can't find the answer.


Downloading distro source

I'm using LDME, a Debian based distro. Is there someway, preferably automatic, where one could download the source to everything that might be executed and everything needed by those executables? I'd also like the downloaded "items" to be stored under one common directory, though a hierarchical structure under that directory would be fine. An extra requirement would be to keep track of what was downloaded ( because that source would only be the source of a snapshot) and update that tree to what is presently installed. **NOTE:** To be clear, I want to be able to download _ALL_ the source for the software that's included with my distro.


Vim FoldColumn color different on Debian / Ubuntu

I sync my .vimrc file between two machines, one running Debian testing and the other Ubuntu. On Debian everything works fine. On Ubuntu, the fold column is gray instead of black, even though black is specified: `213: hi FoldColumn ctermbg=Black ctermfg=Black` If I comment out line 213, the fold column turns black, but then foldmarkers default to white (the whole point is to hide them black on black). If i just do: `213: hi FoldColumn ctermfg=Black` The FoldColumn is gray again. I do not find plugin conflicts with `grep -r "FoldColumn" .vim/`. Any ideas?


Not able to SSH into VM

I want to SSH from my host into my guest VM (CentOS). I can Ping. SSH is running. ![SSH running](http://i.stack.imgur.com/sEdPQ.png) Port 22 is open. ![Port 22 open](http://i.stack.imgur.com/2Cxpv.png) Looks like firewall is off / IPtables are all open. (this is not normal?)![enter image description here](http://i.stack.imgur.com/o8Kmf.png) When I SSH into my VM. ![enter image description here](http://i.stack.imgur.com/6bPSI.png) The password IS correct. When I login on VM directly, it works. So I add this to /Users/robbertsegers/.ssh/known_hosts ![enter image description here](http://i.stack.imgur.com/x7WMi.png) But the problem reproduces.. Is that syntax correct?


How to type several file names with fewer key strokes

If I want to convert a `pdf` to a `png` image with imagemagick I do something like:               convert -trim -density 400 this_is_a_very_long_filename_of_my_pdf_file.pdf this_is_a_very_long_filename_of_my_pdf_file.png      The pdf file often has a very long file name for some reasons and I want that the `png` file has the same name except of the extension. Usually I select `this_is_a_very_long_filename_of_my_pdf_file.pdf` twice via tab and `zsh-menu` and change then `pdf` to `png` manually for the second argument. However is there a faster way to do this?


Are the keyboard layouts in X.org actually called the X.org layouts or what?

Just need to know it, semantically. So most Linux/BSD systems using the X windows manager are using these layouts. For example, the "US International with dead keys" is quite different in X from the Windows implementation. So is the official names for these layouts are the "X keyboard layouts"or something? Edit for clarification: I'm interested in the layouts's name for not machine, but for human consumption. For example, in Windows you have the _English, United Stated Dvorak_ , _English, United States International_ , English, _United Kingdom_ , _German_ , etc. layouts. And they are all called the Windows variants(?) of said layouts, though I'm not sure, perhaps there is an international standard for these layouts which Microsoft or X.org may or may not follow, I don't know, that's why I ask, thank you.


How to give an ordinary user privileged access to a particular syscall in FreeBSD?

I want to give an ordinary user the ability to fchown() files arbitrarily (as if they were the superuser) on FreeBSD. Generally speaking, is there a right way to change the privilege-checking of a given syscall? I investigated Capsicum, but for all the articles on the topic, there is a real lack of practical examples out there.


How to count the number of words and print the lines that match exactly a given pattern?

I want to count the number of words and print the matched pattern lines which matches exactly with following pattern: `abc-ERROR:` The input File contains:               # abc-ERROR: xyxxkkfgfr     # def-Error: aaaaaa     # abc-ERROR.cpp The output should be:                1   (count)      # abc-ERROR: xyxxkkfgfr   (line)


Does "persistence" slow down boot and shutdown on a USB linux?

Essentially, my question is: how does casper-rw (IIRC) work? Every time it boots, it copies the entire file? Every time it shuts down, it recreates it? Also does its size affect the speed? RTFM links on casper-rw/persistence appreciated.


How can I preserve new lines coming from a command's output during variable assignment?

Consider:               $ getfacl somefile.dat     # The output is formatted and contains several new lines..          # file: somefile.dat     # owner: user1     # group: group1     user::rw-     group::r--              #effective:r--     mask:r--     other:r--     $     $ ACL_PERMISSIONS=$(getfacl somefile.dat);     $ echo $ACL_PERMISSIONS;     # file: somefile.dat # owner: user1 # group: group1 user::rw- group::r-- #effective:r-- mask:r-- other:r--      So how do I preserve these new lines during variable assignment, so that when I echo `$ACL_PERMISSIONS` I get the same output as `$ getfacl somefile.dat` ..?