title: file block size - difference between stat and ls

text: I've noticed that when I do a:               ls -ls file      It provides block count, say 8 blocks. When I do:               stat file      I notice that the block count is 16, twice the number given by ls. The block size on my file system is 4096. I learned that the arbitrary unit for blocks used by ls is 1024. Is it correct to say that stat uses an arbitrary unit of 512 bytes when reporting blocks? If so, is there a reason for the inconsistency? I'm running Ubuntu 11.10 on an ext4 file system.


title: What is the syntax of a complex condition in shell?

text: If want to express the following test in shell (sh) :               if ( a == 1 && ( b == 1 || b == 2 )) { ... }      So far, the best I have been able to write is this :               if [[ $a -eq 1 ]]; then       if [[ $b -eq 1 || $b -eq 2 ]]; then          ...       fi     fi      I don't know how to compound && and || with correct precedence. Googling has not given me any answer (tutorials only give basic examples, if any) What is the syntax to combine those two _if_ into one ?


title: Unable to use USB through DD-WRT on a Buffalo WZR-HP-G300NH2

text: I have a Buffalo WZR-HP-G300NH2 and I'm trying to get USB support working. The original Buffalo-branded firmware would refuse to mount the USB drive, so I've followed what tutorials I've found for DD-WRT. I've tried ssh-ing into the box and mounting it with               mount /dev/sda /mnt      as root, and it fails with invalid arguments. For USB file formats I've tried EXT3 and XFS. XFS is the user-friendly firmware file format. I can enable FTP in the DD-WRT GUI and log in, but transferring anything bigger then 5MB to the 500GB attached drive causes the router to reboot. I've downgraded to the Buffalo user-friendly firmware and it seemed to work, but I would like to get DD-WRT running; currently I'm running build 18024.


title: Intercepting packets with bash

text:
I'm wondering if it's possible to detect a packet that comes from certain IP and port(suppose IP 1.1.1.1 and port 80) and has some specific information on it (suppose "
Web Authentication
), drop it before the client (suppose Firefox) receives it and execute certain commands (or another bash script) after this. If possible, ONLY WITH BASH, without any weird command that's not installed by default on linux nor programs from repositories.


title: Modify and boot linux kernel on mobile device

text: During my education I have been developing Android iOS apps and websites for almost 18 months. Now, as my final year project, I am working on Linux source code with the goal to boot it on a mobile device – like Android. I have it successfully as a Debian package following tutorials on the Internet. I am currently using Ubuntu. I have a strategy but not sure if I am on the right track. It is as follows: **A:**   1. Download Linux source code. Remove extra drivers, compile and install it on currently running Ubuntu and use it.   2. Customize the code further and boot it as my own distribution. For that I'm following LFS.   3. Specify a particular target mobile, modify the code for it, write drivers if I need any, not sure which one (that's why I'm here :) ), and boot the kernel on it. I do not know whether my strategy is right or not. I'll really appreciate if someone can tell me: **B:**   1. Am I on the right track? If not, what might be the right one?   2. Do I need to specify a mobile and customize the kernel code for that one?   3. Other than drivers, what else do I need to change in the kernel?   4. Last but not the least: When I boot the kernel on a mobile device; am I going to have any interface or terminal there? Sorry if my question doesn't make sense. I am a student and still trying to figure things out. I would be very thankful if someone could give me hints on what subjects to search for on the Internet. Update: What I want is to confirm whether my strategy is correct or not. If not, then please just name the steps I should follow.


title: How do I setup kerberos authetication in Fedora 19

text: I cannnot seem to find documentation on setting up Kerberos authentication on my Fedora 19 workstation. Which files and programs are involved? My Kerberos server is a corporate AD.


title: Add 'install selected .deb files' as command in Nautilus actions

text: Running `sudo dpkg -i *.deb` in a terminal opened in '/folder', installs all debs in the location '/folder'. What command to add in `nautilus-actions` (Nautilus-Actions Configuration Tool) so that **only selected** deb files are installed? * * * For example, I looked for a script to run a command in a terminal and according to this model I have created this script:               #!/usr/bin/expect -f          # Get a Bash shell     spawn -noecho bash          # Wait for a prompt     expect "$ "          # Type something     send "sudo dpkg -i"          # Hand over control to the user     interact          exit      To run that script I have created an action with Nautilus-Actions Configuration Tool and tried to make settings to make it open within a selected location and for the selected deb files. The first part works, based on a command like: `gnome-terminal -e "/path/to/the/script" --working- directory=%f` But the terminal just contains that command to install all debs from that folder, without considering the selection o files (in the context menu of which I can make the command appear: but it will affect all files, not just those selected).


title: How do I kill all screens?

text: I accidentally created over 1000 screens. How do I kill them all with one command? (Or a few)


title: Navigation Motion to Skip Comments

text: To edit configuration files, I'm using Vim. In order to move the cursor upwards or downwards to other configuration entries, I'm using `Ctrl`+`d` or `Ctrl`+`u`, respectively. Large blocks of commented lines with few configuration lines messes it all up, and I often oversee non-commented lines. Is there a a kind of motion to move the cursor down to the next non-commented line without using hard to type regular expressions?


title: LDAP user not present in the desired group

text: We have LDAP and NFS setup in the lab. The lab has 16 machines and a server. All the LDAP users home directory is present in the server. Whenever, the LDAP user logs in from any of the 16 machines, his home is presented from the server in the client machine through the NFS automounting. In all the client machines, we have installed virtualbox and created a group as **vboxusers** which has all the LDAP users. So, whenever the LDAP user logs in any of the client machine and runs virtual box, he will be able to use the Virtual Box. However, in one of the machine after the fresh installation of RHEL and VirtualBox, when I run the VirtualBox as the LDAP user, I am getting the " **guest OS inaccessible** " error. I thought it might be some permission issue and so, I reset the permissions to the **vboxusers** in that machine. However, on further investigation, we found out that the LDAP users are actually not assigned to the group " **vboxusers** " but rather to some other group. How can this be possible, as I copied the LDAP and NFS configuration files from the working machines in the lab and used the same files in the newly installed machine? **EDIT:** _ldap.conf contents_               #     # LDAP Defaults     #          # See ldap.conf(5) for details     # This file should be world readable but not world writable.          #BASE   dc=example, dc=com     #URI    ldap://ldap.example.com ldap://ldap-master.example.com:666          #SIZELIMIT  12     #TIMELIMIT  15     #DEREF      never     URI ldap://192.168.1.10/     BASE dc=xxx,dc=xxx     #TLS_CACERTDIR /etc/openldap/cacerts


title: Font size issues with Emacs in linum-mode

text: I am using Emacs 23. **linum-mode** works well if using with default settings. But if I increase the font size, the numbers cannot be displayed. It seems the the frame to display the line numbers is not increased as the font size of the line number increases. Anyone know how this can be fixed?


title: Conditional search and replace on a line in vim?

text: Let' say I want to comment and uncomment a line. I know I can               :s!^!//!      and then               :s!^//!!      Now what if I want this as an one-liner? Basically, _if_ a line starts with `//` then remove it, _else_ add it. I want to map this command to one shortcut instead of having two.


title: Remap Caps_Lock to Control in Solaris

text: I'm having the hardest time trying to understand how `xmodmap` works. I want to remap the Caps Lock key to Control. In an attempt to emaulate the answers shown here, I created the file `.xmodmaprc`:               clear Lock     keycode 65 = Control_L      # I got the value 65 from running xev and pressing the key.      Then I added the following to .kshrc:               export XMODMAPRC="/Home/username/.xmodmaprc"     [ -f $XMODMAPRC ] && echo "OK" && xmodmap $XMODMAPRC      When I launch a new xterm, I can see the "OK" printed at login, but the key is still behaving as a Caps Lock! How can I make this work? I work on **Solaris 10** and I **don't have root access**.


title: Latest Debian wheezy/testing ISOs defaulting to KDE?

text: I've usually been using Debian Squeeze, as I've never really had any reason to go after the latest & greatest, and if I wanted to, I always had backported packages to rely on. However, my new laptop (an Asus U31SD) has an Atheros chip (id [1969:1083]) which is not supported in the kernel until 2.6.38. So I tried downloading the latest weekly build, which happened to install KDE for some reason. The last three daily builds also installed KDE, and as far as I know, I am not selecting any meta packages during the install that would install it (Just "core", "laptop", and "SSH Server"). Is there any particular reason this is happening? I was always under the impression that Debian came with GNOME... * * * **Edit** : I've been getting my ISOs here:   1. http://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-cd/ (specifically CD1, and _not_ the KDE version at the bottom)   2. http://cdimage.debian.org/cdimage/daily-builds/daily.new/ (netist versions for amd64)


title: How to parse this output and put it into an array?

text: i have expect script whose output looks like : I would like to extract all words like Gi/02/12 etc in an array or a list.               VLAN Name                             Status    Ports     ---- -------------------------------- --------- -------------------------------     121  Voice_C-LAN                      active    Gi1/0/12, Gi1/0/13, Gi1/0/14, Gi1/0/15, Gi1/0/16, Gi1/0/17, Gi1/0/18, Gi1/0/19, Gi1/0/20, Gi1/0/21, Gi1/0/22                                                     Gi1/0/23, Fa2/0/13, Fa2/0/14, Fa2/0/15, Fa2/0/16, Fa2/0/17, Fa2/0/18, Fa2/0/19, Fa2/0/20, Fa2/0/21, Fa2/0/22                                                     Fa2/0/23, Fa2/0/24, Gi2/0/1          VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2


title: When does the Puppy linux security model make sense?

text: I have just spent a few hours playing with Puppy linux, which has some very nice features, but there are some things about its approach to security (at least the default settings) that worry me:   1. It seems that the intended way to use it is to run everything as root   2. There is no password for root (by default-- of course I could add one)   3. There is no automated (or even a simple non-automated) way of getting security updates for packages, as far as I can tell. (I might have missed something.) I have always had drummed into my head the importance of having a complex password, of not browsing the internet as an admin/root user, and of keeping system software (and browser, and plugins) up to date with patches for the latest vulnerabilities. However, despite what looks to me like a recipe for disaster (outlined above), Puppy is popular enough to have a lot of spin-offs, so there must be scenarios in which the apparent lack of security is a non- issue. What are they?


title: Determining number of files in a directory without counting them

text: Related: What's the best way to count the number of files in a directory? I have a system with a largish number of files in a directory                $ ls -god xml      drwxrwsrwx   7 7070720 Mar 12 11:51 xml      If I try to count specific groups of file using `ls xml/*query | wc -l` the system usually produces error message                /bin/ls: arg list too long      I tried `find xml -name '*query' | wc -l` there was no response after 10 minutes at which time I terminated the command.               $ nohup time find xml -name '*query' -level 0 | wc -l &     [1]     11751          $ ps -f 2>rgb          UID   PID  PPID  C    STIME     TTY        TIME CMD          rgb 11751 10637  0 02:45:11  ttyp12    00:00:00 wc -l          rgb 11752 11751  0 02:45:11  ttyp12    00:00:00 time find xml -name *query -level 0          rgb 11753 11752 77 02:45:11  ttyp12    00:00:03 find xml -name *query -level 0          rgb 11776 10637  1 02:45:17  ttyp12    00:00:00 ps -f          rgb 10583 10581  0 02:30:13  ttyp12    00:00:00 -csh          rgb 10637 10583  2 02:30:19  ttyp12    00:00:00 ksh          top -Urgb          last pid: 11864;  load averages:  1.21,  0.82,  0.66                   14:48:03     249 processes: 246 sleeping, 2 running, 1 onproc     CPU states:  0.0% idle, 24.5% user, 75.5% system,  0.0% wait,  0.0% sxbrk     Memory: 2048M phys, 1799M max, 1718M free, 1774M locked, 114M unlocked, K swap            PID USERNAME PRI NICE   SIZE   RES  STATE   TIME  COMMAND     11837 rgb       26    0   804K   804K onpr    0:00  top     11753 rgb       56    4  5512K  5512K run     1:10  find     11751 rgb       51    4   588K   588K sleep   0:00  wc     10583 rgb       48    0  1204K  1204K sleep   0:00  -csh     11752 rgb       48    4   588K   588K sleep   0:00  time     10637 rgb       48    0  1288K  1288K sleep   0:00  ksh          last pid: 12330;  load averages:  1.82,  1.45,  1.05                   14:58:06     258 processes: 253 sleeping, 4 running, 1 onproc     CPU states:  0.0% idle, 20.7% user, 78.7% system,  0.6% wait,  0.0% sxbrk     Memory: 2048M phys, 1799M max, 1711M free, 1774M locked, 106M unlocked, K swap            PID USERNAME PRI NICE   SIZE   RES  STATE   TIME  COMMAND     11837 rgb       26    0   804K   804K onpr    0:00  top     11753 rgb       -1    4  5512K  5512K run     5:10  find     11751 rgb       51    4   588K   588K sleep   0:00  wc     10583 rgb       48    0  1204K  1204K sleep   0:00  -csh     11752 rgb       48    4   588K   588K sleep   0:00  time     10637 rgb       48    0  1288K  1288K sleep   0:00  ksh          $ jobs     [1] +  Running                 nohup time find xml -name '*query' -level 0 | wc -l &          $ kill %1     [1] + Terminated               nohup time find xml -name '*query' -level 0 | wc -l &      **Can I instead the number of files, within say 10%, from the 7070720 size of the directory** given by `ls -god xml`? Supplementary Q: To what extent does this depend on the filesystem (UFS, V7FS, HTFS etc etc)? * * * Update: The command `ls xml | wc -l` did return a value in a few seconds. I should have tried this before posting the question. This provides the information I was asking for, so there's no point working out how many filename+inode entries fit in a 7070720 byte directory (answer: at least 260085).


title: Copy stdout and stderr to a log file and leave them on the console within the script itself

text: Using bash, how do I copy stderr and stdout to a log file and also leave them displayed on the console? I would like to do this within the script itself using an exec. I tried with               exec &>> log.out          echo "This is stdout"     echo "This is stderr" >&2      But the above prints nothing on the console. How can I achieve this in bash?


Im not sure if I have this setup right, I get the following error Can't launch minicom correctly: "Parameter port is private, but is marked public in global config file"


title: Wireless networking with CentOS

text: I'm running CentOS 5.7 x86 on my Vostro 1700 laptop which has an Intel Pro Wireless WiFi NIC (Intel Pro Wireless 3945 [iwl3945]). I'm a bit confused about how my Wireless connection (`wlan0`) is being managed and where the configuration is being stored. I initially configured `wlan0` via Gnome's Wireless Device Configuration application (`System -> Network`): ![enter image description here](http://i.stack.imgur.com/B7zbN.png) I configured a static IP address if `172.16.3.22` and so on: ![enter image description here](http://i.stack.imgur.com/hlKFG.png) I then configured the Wireless Settings to set my SSID etc: ![enter image description here](http://i.stack.imgur.com/MeeMQ.png) Having done that I then restarted the interface with:               ifdown wlan0     ifup wlan0      So far so good and `ifconfig` reported that the interface was up. However when I tried to ping anything on my network the ping failed. It was then I noticed that the Wireless Configuration page didn't ask me about the Wireless security type I was running (WPA2-PSK) - the only options were None, Open system (open) or Shared key (restricted) so it seemed that I wasn't authenticating to my WiFi AP. I then found another network configuration tool called "Network Connections" under `System -> Preferences -> More Preferences`. Using this tool I had to add a new connection and it allowed me to configure my Wireless NIC and specify the security type: ![enter image description here](http://i.stack.imgur.com/DLPYw.png) I also configured a different IP address of 172.16.3.23 mostly out of curiosity to see if this GUI was configuring the same settings as the previous dialogues and saving these values in `/etc/sysconfig/network-scripts/ifcfg- wlan0`. However this seems to be a completely different configuration system from what I'm familiar with because `ifcfg-wlan0` appears not to be used to save the above config. To cut a long story short I also had a Google around and discovered that I also needed to start the NetworkManager daemon which adds an icon to Gnome to allow me to enable and disable Networking, Wireless and permits me to choose which AP to connect to etc. So I'm now somewhat confused as to how my WiFi network is actually configured and where these settings are really stored. I also notice that when I quit Gnome and drop back to console mode my wireless connection is disconnected `wlan0` loses its IP address and appears to be no longer connected. Whilst I'm very happy I can connect to my WiFi network (by starting Gnome), I'm not happy that I don't understand what's happening under the bonnet. Can someone explain what is happening with all these different settings? Also how do I start my wireless connection before starting Gnome?


title: How to stop monthly cron output email

text: Server is Debian 6.0. In /etc/aliases I have;               root: me@mydomain.com      This is so that root emails get sent directly to me. Today, a monthly script I have placed into /etc/cron.monthly has emailed me it's output. It a fairly simply script which looks like this;               #!/bin/bash     cd /a/directory     rm -rf ./*     wget http://www.site.com/fresh-copy.zip     unzip fresh-copy.zip     rm fresh-copy.zip      The email I have received is below;               **Subject**: Cron <root@myserver> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )     **From**: root@my.server.com     **Body**:              /etc/cron.monthly/speedtest:     --2013-03-01 06:52:01--  http://www.site.com/fresh-copy.zip     Resolving www.site.com... 11.22.33.44     Connecting to www.site.com|11.22.33.44|:80... connected.     HTTP request sent, awaiting response... 200 OK     Length: 99763924 (95M) [application/zip]     Saving to: `fresh-copy.zip'               0K .......... .......... .......... .......... ..........  0% 11.7M 8s         50K .......... .......... .......... .......... ..........  0% 11.3M 8s        100K .......... .......... .......... .......... ..........  0% 11.4M 8s             *CUT OUT FOR BREVITY*      97350K .......... .......... .......... .......... .......... 99% 16.9M 0s      97400K .......... .......... .....                           100% 11.6M=9.7s          2013-03-01 06:52:11 (9.78 MB/s) - `fresh-copy.zip' saved [99763924/99763924]          Archive:  fresh-copy.zip       inflating: file1.ext       inflating: file2.ext       inflating: file3.ext       inflating: file4.ext       inflating: file5.ext      The only output in this email is from the `wget` and `unzip` command. I can edit the script and place `> /dev/null` on the end on those two lines, but is that really the best way to do this? If I add more commands to the script that produce output, I will always have to add on `> /dev/null` to each line. Is there a way I can disable email notification of output from this cron script?


title: Cat with Headers and Line Numbers?

text: I have files like this               $ cat trapetz     x = 0:0.0001:7pi     plot(x, sin(x).*cos(x))     Area = trapz(x, sin(x).*cos(x))     $ cat simpson      f = inline(sin(x).*cos(x));     Area2 = quad(f, 0, 7pi, 1e-16)      I want something like this               $ cat -b -t MISSING? trapetz simpson           traapetz           1  x = 0:0.0001:7pi          2  plot(x, sin(x).*cos(x))          3  Area = trapz(x, sin(x).*cos(x))          simpson          1  f = inline(sin(x).*cos(x));          2  Area2 = quad(f, 0, 7pi, 1e-16)      or even better if some easy way to add wc there:               $ find |tee |...|wc... I feel now reinventing the wheel, there must be some ready...          traapetz: xyz chars          1  x = 0:0.0001:7pi          2  plot(x, sin(x).*cos(x))          3  Area = trapz(x, sin(x).*cos(x))          simpson: zyx chars          1  f = inline(sin(x).*cos(x));          2  Area2 = quad(f, 0, 7pi, 1e-16)      but I get               $ cat -b -t trapetz simpson           1  x = 0:0.0001:7pi          2  plot(x, sin(x).*cos(x))          3  Area = trapz(x, sin(x).*cos(x))          4  f = inline(sin(x).*cos(x));          5  Area2 = quad(f, 0, 7pi, 1e-16)      Not really cat needed but some easy tool to share and show code snippets like the above, not pastebin. I want some standard command line thing. I am trying to create easy puzzle -pasting for codegolf.se so people could reproduce things easily...


title: find all cpp files and list only those files with names that match a pattern (regex) does not work

text: I have a whole repository of files and I am trying to get a list of files that match a certain criteria. For example, let us say that I want to take all the files that have the string `foo1` and `foo2/foo3` in the path and do not have `bar1` or `bar2/bar3`. Note that it is possible for `bar1` or `bar2/bar3` to be a sub directory of `foo*` and in that case those directories should also be **excluded**. I tried the following method:               IN_REGEX="$1"     OUT_REGEX="$2"          find . -name '*'.cpp | grep $IN_REGEX | grep -v $OUT_REGEX      I call this script in this way:                ./script "/foo1/\|/foo2\/foo3/" "/bar1/\|/bar2\/bar3/"      However, the loop never gets executed. I tried changing the `"` in the command line arguments to `'`. But that did not help. I tried changing the `grep`s to `sed` commands like so:               find . -name '*'.cpp | sed "\m%$IN_REGEX%" | sed "\%$OUT_REGEX%d"      Again, no success. However, when I try to execute the `grep` on the bash shell directly. It works fine. I have spent the whole day today trying to figure this out. Can someone please help me out?


title: Split files and rename the files

text: I need to split a large file into 5 pieces and rename them. For Example, file **Test** needs to be split into _Test1_ , _Test2_ & _Test3_. However, the split command splits as _xaa_ , _xab_ , _xbc_.


title: grep: Ignoring GREP_OPTIONS to search case-sensitive

text: I have set `GREP_OPTIONS="--ignore-case --color"` in `~/.bashrc` as I normally want grep to work case-insensitive. However, there are times when I need grep to actually search case-sensitive, but the man page doesn´t suggest a param for this. How can I achieve this?


title: error handling in expect?

text: I am just improving my quetion becasue i have acieved so far upto this:               set username [lindex $argv 0]     set password [lindex $argv 1]     set hostname [lindex $argv 2]          if {[llength $argv] == 0} {       send_user "Usage: scriptname username \'password\' hostname\n"       exit 1     }          send_user "\n#####\n# $hostname\n#####\n"          spawn ssh -q -o StrictHostKeyChecking=no $username@$hostname          expect {       timeout { send_user "\nFailed to get password prompt\n"; exit 1 }       eof { send_user "\nSSH failure for $hostname\n"; exit 1 }       "Password: "     }          send "$password\r"               expect {       timeout { send_user "\nLogin failed. Password incorrect.\n"; exit 1}       "{severname:mike} "     }     send "ls -lrt\n"          expect {            "{severname:mike} " {              send "uname\n"            }     }     expect {             "{severname:mike} " }          send "exit\r"     close      I hope i am correct but how do i get the out put of commands logged locally errlogs and sucess logs where command is a list of commands like ls,ls -lrt moreover when i put this :                spawn ssh -q -o StrictHostKeyChecking=no $username@$hostname {ls -lrt;df -h}      it logs in and executes `ls -lrt;df -h` but after that throughs errror error with debug option .the connection closes perhpas because of the command execution in ssh scope.               [root@testgfs2 final]# ./workingscript.exp  mike bar01 10.38.164.103          #####     # 10.38.164.103     #####     spawn ssh -q -o StrictHostKeyChecking=no mike@10.38.164.103 ls -lrt     parent: waiting for sync byte     parent: telling child to go ahead     parent: now unsynchronized from child     spawn: returns {19901}          expect: does "" (spawn_id exp6) match glob pattern "Password: "? no     Password:     expect: does "Password: " (spawn_id exp6) match glob pattern "Password: "? yes     expect: set expect_out(0,string) "Password: "     expect: set expect_out(spawn_id) "exp6"     expect: set expect_out(buffer) "Password: "     send: sending "bar01\r" to { exp6 }          expect: does "" (spawn_id exp6) match glob pattern "{severname:mike} "? no               expect: does "\r\n" (spawn_id exp6) match glob pattern "{severname:mike} "? no     total 6     -rw-r--r--   1 mike   other        136 Feb 26 08:39 local.cshrc     -rw-r--r--   1 mike   other        157 Feb 26 08:39 local.login     -rw-r--r--   1 mike   other        174 Feb 26 08:39 local.profile          expect: does "\r\ntotal 6\r\n-rw-r--r--   1 mike   other        136 Feb 26 08:39 local.cshrc\r\n-rw-r--r--   1 mike   other        157 Feb 26 08:39 local.login\r\n-rw-r--r--   1 mike   other        174 Feb 26 08:39 local.profile\r\n" (spawn_id exp6) match glob pattern "{severname:mike} "? no     expect: read eof     expect: set expect_out(spawn_id) "exp6"     expect: set expect_out(buffer) "\r\ntotal 6\r\n-rw-r--r--   1 mike   other        136 Feb 26 08:39 local.cshrc\r\n-rw-r--r--   1 mike   other        157 Feb 26 08:39 local.login\r\n-rw-r--r--   1 mike   other        174 Feb 26 08:39 local.profile\r\n"     write() failed to write anything - will sleep(1) and retry...     send: sending "ls -lrt\n" to { exp6 send: spawn id exp6 not open         while executing     "send "ls -lrt\n""         (file "./workingscript.exp" line 30)      command variable contains a list of commands sperated by semicolon like this :                  command 1; command 2;command 3(=$command)      i dont know how can i execute it inside expect script one by one so instead of putting the commands in ssh scope i could do somehting like :               spawn ssh -q -o StrictHostKeyChecking=no $username@$hostname          IFS=';'     for i in $command     do     expect {        "{severname:mike} " {                send "$i\n"                }  2>> errorlog 1>> succeslog         }     done      i just used the unix syntax and expect syntax combined just to make you understand what i am trying to do


title: Cygwin serial tty device for high-numbered COM ports

text: My hardware enumerates as `COM125` on the device manager (CDC-ACM class). But, I can't find it under `/dev/tty*` listing. Does cygwin have a limitation on CDC-ACM class of com ports or numbers greater than 100? I have few other UARTs (emulated over USB) that enumerate as `COM10`–`COM20` range. These are listed as `/dev/ttyS9` and etc in cygwin.


title: Enabling system management privileges for non-local users - How the heck does `polkit` work, anyways?

text: I am managing a CentOS 6.2 server remotely using X over SSH (actually NX, but that's just a proxy). The Everything is working correctly, _except_ when I try to do tasks that would normally require administrative permissions (such as things in `palimpsest`, or any other GUI tools). When I try to do things which would trigger a authentication dialog (through `polkit-gnome`)the permissions dialog is silently failing, and the software is running as my user account, rather then root. To clarify, if I change package settings using the package manager at the local console, I get a pop-up - "Authentication is required to (add/remove) packages". If I do this remotely, the authentication fails, and I get a "Authorization Failed" dialog. It seems to boil down to policykit configuration, but I've followed the polkit man pages, and edited my configuration, and it hasn't changed anything. * * * I can manage packages/do super-user stuff from the command line without any problems. However, I am very visually oriented, and much prefer a GUI when possible. * * * Ok, so it seems that I need to add a new rule to policykit. Going off the man pages, I created a file (named `20-remote-admin- allow.pkla`), and dropped it into `/etc/polkit-1/localauthority/50-local.d/`. Since there seems to be multiple polkit config directories, I copied the same file into `/var/lib/polkit-1/localauthority/50-local.d/`. It does not appear to have changed anything. Here is my config file, as mentioned above:               [root@cloaica zul]# cat /var/lib/polkit-1/localauthority/50-local.d/10-remote-admin-allow.pkla      [Let remote users do admin stuff]     Identity=unix-user:zul     Action=*     ResultAny=auth_admin     ResultInactive=auth_admin     ResultActive=auth_self_keep          [root@cloaica zul]# cat /etc/polkit-1/localauthority/50-local.d/20-remote-admin-allow.pkla      [Allow Remote Administraton]     Identity=unix-user:zul     Action=*     ResultAny=auth_admin     ResultInactive=auth_admin     ResultActive=auth_admin     [root@cloaica zul]#       `pkaction --verbose` still reports               implicit any:      no     implicit inactive: no      for most actions, and said actions fail if I attempt them, with "Authentication Failed" dialog, as mentioned above. Seriously, I does anyone actually understand how polkit actually works? Policykit seems to be an ongoing nightmare, and considering _there used to be a GUI configuration tool_ **and it was removed** , I don't understand how anyone thought this was ready for release into a production OS. * * * To be clear, I _like_ having the "please authenticate to perform this action" dialogs. I just want to actually _have_ them, rather then having the system silently fail to authenticate. I don't want to remove the entirety of polkit, just make it either think all sessions are active, or that inactive sessions get the same permissions as active sessions.


title: PXE USB BOOT Debian

text: I have installed a Debian. I `rsync`ed it. I load it on my client through PXE from NFS to make a backup. But I need my Computer(NFS-host) at the same time to make something other with it. For example, sometimes I like to use my Computer(host) in other room, so I do not like to leave it there. When I disconnect it from NFS, the system freezes. The idea came across my mind that I will remount the root filesystem from USB and than will I disconnect from the server. I was thinking, I will use a USB stick, with same immutable (`/bin`) files, and I will load all mutable devices/files (`/proc`, `/var`) in memory.   What do you recommend?               proc            /proc           ramfs   nodev,noexec.nosuid     0       0       none            /tmp            ramfs   defaults        0       0       none            /var/run        ramfs   defaults        0       0       none            /var/lock       ramfs   defaults        0       0       none            /var/tmp        ramfs   defaults        0       0       none            /var/log        ramfs   defaults        0       0       /dev/nfs        /               nfs     defaults        1       1        I changed the last line to:               /dev/sda1        /               ext4    errors=remount-ro         0       0       mount -o -remount /       /dev/sda1 on / type ext4 (ro,errors=remount-ro)       [  220.880314] EXT4-fs (sda1): mounted filesystem with ordered data mode        But the system is still hanging.If I pull back the cable then it's all right.


title: How to configure GRUB to load Windows 7 Install in UEFI mode

text: I have a Dual-Boot USB I created with Multisystem for booting into PartedMagic, Ubuntu 11.10 & Windows 7 Install. Problem is Windows 7 says it cant install on a GPT partition. Googled, and found that I need an UEFI system (on ASUS H67M-PRO, supports UEFI BIOS, so this shouln't be the problem). I also need to have the correct efi files. I find efi files in my USB, so I think thats fine. But I think the files might not be loaded or something? So I am thinking, do I need to do something special to boot into the UEFI installer for Windows 7 or something? For that I need to configure the GRUB on the USB? How?


title: How does SSH connection survive a network restart?

text: From a Linux SSH shell, type `/etc/init.d/network restart` to restart the network service. I expect my SSH connection to die since the network service goes down. But it doesn't. Very cool. But how does Linux achieve this? How does it keep my SSH connection alive accross the service restart?


title: How to do block selection in `screen`

text: In vim, there's a `Ctrl``V` to do block selection.   How can I do it in `screen`?


title: Create a package for debian that contain other program/deb package

text: I need some direction about this matter. I need to create a package or an executable program that will install some other deb package like tightvnc... So basically when I user execute my package, tightvnc will be installed, and configured, and the user will be prompted to enter a password for tightvnc server. How can I go about this? Is there any tool out there that can help you create this kind of executable?


title: Remove all lines in file A which contain the strings in file B

text: I have a CSV file `users.csv` with a list of userNames, userIDs, and other data:               username, userid, sidebar_side, sidebar_colour     "John Lennon", 90123412, "left", "blue"     "Paul McCartny", 30923833, "left", "black"     "Ringo Starr", 77392318, "right", "blue"     "George Harrison", 72349482, "left", "green"      In another file `toremove.txt` I have a list of userIDs:               30923833     77392318      Is there a clever, efficient way to remove all the rows from the `users.csv` file which contain the IDs in `toremove.txt`? I have written a simple Python app to parse the two files and write to a new file only those lines that are not found in `toremove.txt`, but it is extraordinarily slow. Perhaps some `sed` or `awk` magic can help here? This is the desired result, considering the examples above:               username, userid, sidebar_side, sidebar_colour     "John Lennon", 90123412, "left", "blue"     "George Harrison", 72349482, "left", "green"


title: Return to X session after Ctrl+Alt+F1

text: What is the command to return to the graphical desktop after entering the terminal mode with `Ctrl`+`Alt`+`F1`? I need it for operating my Raspbian.


title: PHP phantom cron job

text: I disabled all my cron jobs by putting a `#` in front of them. Except for one:               @reboot echo "Hi I rebooted"      The rest are:               #0 2,14 * * * /home/backup1/mysql-backup.sh     #0 * * * * mono /root/apps/AlertAuth.exe      However, my inbox gets this message > PHP Warning: PHP Startup: Unable to load dynamic library > '/usr/lib/php5/20090626+lfs/suhosin.so' - > /usr/lib/php5/20090626+lfs/suhosin.so: cannot open shared object file: No > such file or directory in Unknown on line 0 with the subject: > Cron [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find > /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs > -n 200 -r -0 rm I don't have any cron jobs. Maybe the `init.d` script I have for PHP is causing this? Or maybe how do I fix this? I tried reinstalling PHP5, it seems to work yet that file `.so` doesn't exist.


title: Allow internet access to public subnet

text: I'm running ESXi and received a public subnet from Hertzner.de . I've setup everything by using a 'router'-vm and different client-vm's. These client VM's can access the internet through the router-vm without a problem. But how can I enable direct access to the individual VM's by their public IP's? My subnet details:               Subnet:    144.76.205.192 /29     Mask:    255.255.255.248     Broadcast:    144.76.205.199      My router VM is running on 144.76.205.193 and one of my clients on 144.76.205.194. So how can I access them with their (public) subnet-IP's?


title: Bash prompt not recognizing Unicode escapes

text: I'm trying to customize my Bash prompt with Unicode characters and I'm having a bit of trouble. If I try to include a Unicode character like this:               $ echo ☢ | hexdump -C     00000000  e2 98 a2 0a                                       |....|     00000004          $ PS1="\xe2\x98\xa2\x0a"      I see my prompt appears like this:               \xe2\x98\xa2\x0a      ...rather than showing the ☢ character. What am I doing wrong?


title: cut slice of file based on time when lines are written

text: i have a process running always with logging file could reach up to 5 giga, sometime i have to take slice of this log based on interval of time (usually i used dd). is there any command in linux to take the slice of log based on time interval? PS:there is no time stamp in most of lines within this log.


title: How to lock a directory?

text: I want to block any kind of access to a certain directory unless a password is provided. It could be my root or account password. The directory is residing on an NTFS partition, and this method needs to work for Windows as well, as I'm accessing the partition from both Linux and Windows interchangeably. It could be implemented as encryption. How do I achieve this?


title: “NOT AUTHENTICATED” warning trying to install rdesktop on almost-fresh Mint 16 install

text: Linux Mint 16 (Ubuntu-based) 32-bit running on a netbook. Installed Wine and Skype, and all updates. Went to install `rdesktop` (typed `rdesktop` in the gnome menu search, chose 'install `rdesktop`'), and I get a screen similar to this one, except that under the heading "NOT AUTHENTICATED," when I click the plus, there's just one blank line, no actual package names. The summary says 10 will be held back, 1 will be installed. I assume the 1 is `rdesktop`, so what's this blank line and warning all about? Will I fall victim to some MitM attack if I click "apply"?


title: Why does hostname --fqdn only return the domain name?

text: Relevant files (slightly anonymized):               heinzi@d2:~$ cat /etc/hostname     d2     heinzi@d2:~$ cat /etc/hosts     127.0.0.1       localhost     <myexternalip>  d2.<myname>.at    <myname>.<myprovider>.at       <myname>          # The following lines are desirable for IPv6 capable hosts     ::1     localhost ip6-localhost ip6-loopback     ff02::1 ip6-allnodes     ff02::2 ip6-allrouters      This output is correct:               heinzi@d2:~$ hostname     d2     heinzi@d2:~$ hostname --all-fqdns     d2.<myname>.at      But this I don't understand:               heinzi@d2:~$ hostname --fqdn     <myprovider>.at      Shouldn't it be `d2.<myname>.at`, since that's the first entry after `<myexternalip>`? And if it's the second entry, shouldn't it by `<myname>.<myprovider>.at` instead of just the domain name? I'm aware that I could probably fix this by playing around with the hosts file, but I'd really like to _understand_ why this happens. I read the hostname man page and googled and think that it _should_ return `d2.<myname>.at` in my case. Thus, I'd really prefer an answer along the lines of " _This is because ..._ " instead of " _Try ... and see if it works._ ". The system is Debian 7.5 "wheezy".


title: Port redirection on loopback with IP other than 127.0.0.1

text: I want to redirect port 80 on the loopback network interface so that accesses to that port actually go to port 8080. I tried using the following command, but it only works if the application is listening on 127.0.0.1:8080, but not if it's listening on 127.1.2.3:8080.               sudo iptables -t nat -I OUTPUT -p tcp -o lo --dport 80 -j REDIRECT --to-ports 8080      I also tried adding `--source 127.1.2.3/32 --destination 127.1.2.3/32` but it still doesn't work. The redirection works if I open an application listening on 127.0.0.1:8080:               ssh remote -L127.0.0.1:8080:192.168.0.3:80          nc 127.0.0.1 80 # works      But it doesn't work if I open an application listening on 127.1.2.3:8080:               ssh remote -L127.1.2.3:8080:192.168.0.3:80          nc 127.1.2.3 80 # fails     nc: connect to 127.1.2.3 port 80 (tcp) failed: Connection refused          nc 127.1.2.3 8080 # works, so the application is still listening on 8080      How can I redirect the port 8080 on 127.x.x.x to the port 80 on the same IP? **Update: Motivation** I'm trying to use SSH to do the following port forwardings (127.1.2.3:80 → 192.168.0.3:80, and 127.1.2.4:80 → 192.168.0.4:80):               ssh remote -L127.1.2.3:80:192.168.0.3:80 -L127.1.2.4:80:192.168.0.4:80      Since port 80 is "privileged", ssh can't open it on localhost. There are several ways to circumvent that:   * `sudo ssh`, but I don't want to have to copy my ssh config and keys on the root account.   * Use capabilities, but package updates may break this.   * Use a different port (e.g. 8080), that works but non-relative urls get broken.   * Reroute the privileged port to a non-privileged one, and that's what I'm trying to do. It works for a single redirection on 127.0.0.1, but it fails if I have redirections on IPs other than 127.0.0.1 (see above).


title: Lower temperature thresholds for sensors

text: My eight month old Acer V3-571G is overheating: temperature fluctuates between 64 degC and 75 degC with _only_ Firefox running and the exhausts are starting show some signs of melting. As soon as I launch Eclipse or Chrome, it reaches 80 degC. The main problem is that the high temperature threshold is set to 87 degC. I installed `sensors` and added `acpi_osi=Linux` to the boot line in Grub. However, `sensors-detect` only detects the `coretemp-isa-0000` chip, and `pwmconfig` does not find any PWM capable sensor modules. Currently, I'm stuck with an overheating computer on which I cannot seem to control the fans. I know that the fans work because they turn much faster under Windows, making the computer cooler (and more noisy). I want to change the high temperature threshold from 87 degC to 65 or 70 degC. Here's the output of `sensors` (with only Firefox running on top of KDE4 on OpenSuse):               # sensors     coretemp-isa-0000     Adapter: ISA adapter     Physical id 0:  +66.0°C  (high = +87.0°C, crit = +105.0°C)     Core 0:         +66.0°C  (high = +87.0°C, crit = +105.0°C)     Core 1:         +65.0°C  (high = +87.0°C, crit = +105.0°C)          pkg-temp-0-virtual-0     Adapter: Virtual device     temp1:        +66.0°C            nouveau-pci-0100     Adapter: PCI adapter     temp1:        +65.0°C  (high = +95.0°C, hyst =  +3.0°C)                            (crit = +105.0°C, hyst =  +5.0°C)                            (emerg = +135.0°C, hyst =  +5.0°C)      Creating /etc/sensors.d/foo with a `temp` entry seems to only change the reported temperature. I also tried setting the chip to an Intel PECI type (`set temp1_type 6` (`sensors -s` is successful)) but that does not change the speed fans. I also tried editing `/sys/class/hwmon/hwmon0/device/temp1_max` but the file is read-only even for root. Any help or lead is appreciated! I prefer exhausting all possible resources before sending my computer back in because I need it for my day to day job, and I bought in another country than the one I'm currently in.


title: program for PC-to-phone using Gtalk?

text: I know I can configure empathy to voice chat between gmail users. But is it possible to make PC-to-phone voice calls with empathy or do I have to use Google's browser plugin? Does any program support both things? (The point being that I would much prefer using a program listed in the Debian repository rather than having to use a browser with a plugin.)


title: utf-8 sequence in the console

text: when I perform the "tree" command in the console, here's what I've got :               .     ├── Annexe\ 1\ -\ Sch\303\251ma\ global\ de\ la\ base\ de\ donn\303\251es.raw     ...      The result is composed of utf-8 sequences, I need to get the string in a human-readable form for a report. How can I convert that nasty thing ?


title: Low level disk i/o on linux

text: Can a user level program do page level or block level I/O on SSDs? I've looked at disk devices, but am unsure if they provide this as they work only if the partition has a file system. ### UPDATE #1 I want to write a high performance key value store for SSDs and so I need some way to do low level access (including read, write and erase). I know that my approach must be kernel level, but before that I want to test it out in user-space (avoiding the complexity of learning kernel level programming).


title: Portions of the file Header

text: I was working through my C programs, I am new to Linux/UNIX development and was having a look around. I created a simple C program of Hello world and was inspecting the compilation process. I tried to read the file header of the final executable and got the Output as this               $ objdump -f my_output     file format elf32-i386     architecture: i386, flags 0x00000112:     EXEC_P, HAS_SYMS, D_PAGED     start address 0x08048320**      I understand the elf32-i386 part but I am not pretty sure with the other portions of the header. is `D_PAGED` somehow related to demand paging? and what does `EXEC_P, HAS_SYSMS` mean? is start address , the logical address of `main()` of the program?


title: openvpn logrotate

text: I'm trying to rotate OpenVPNs logfiles every month. The problem seems to be that simply renaming the files doesn't do the trick. The data still gets written to the old file (which indicates that the logfile is kept open and logging still writes to the old file object). So now I wrote a script that restarts openvpn at the beginning of every month after it updates a symlink to the new log file's location. But this script seems to be buggy and sometimes fails to start the server correctly (tun0 is down sometimes). So I wanted to ask if one of you knows a better way to achieve log rotation in OpenVPN? **Edit** : I'm using Debian Squeeze and my restart script already sleeps 5 seconds between stopping and starting the `ovpn` server


title: Who cuts off first symbol of process substituted file and for what reason?

text: $ type 1.sh     #!/bin/bash -eu     php <(echo 12)     $ ./1.sh     2          $ type 2.sh     #!/bin/bash -eu     cat <(echo 12)     $ ./2.sh     12          $ type 3.sh     #!/bin/bash -eu     echo 12 | php     $ ./3.sh     12          $ type 4.sh     #!/bin/bash -eu     rm -f named_pipe     mknod named_pipe p     echo 12 > named_pipe     $ ./4.sh     $ php named_pipe   # from another window     2      I tested it on `Debian` (`php-5.4.14`, `bash-4.1.5`) and `Arch Linux` (`php-5.4.12`, `bash-4.2.42`).


title: How to open process substituted file from php?

text: Here's what I tried to do myself:               $ type 1.sh     #!/bin/bash -eu     php -r 'var_dump(file_get_contents($_SERVER["argv"][1]));' -- <(echo 1)     $ ./1.sh     PHP Warning:  file_get_contents(/dev/fd/63): failed to open stream: No such file or directory in Command line code on line 1          Warning: file_get_contents(/dev/fd/63): failed to open stream: No such file or directory in Command line code on line 1     bool(false)      I tested it on `Debian 6` (`php-5.4.14`, `bash-4.1.5`) and `Arch Linux` (`php-5.4.12`, `bash-4.2.42`). **UPD**               $ strace -f -e trace=file php -r 'var_dump(file_get_contents($_SERVER["argv"][1]));' -- <(echo 1)     ...     open("/usr/lib/php5/20100525/mongo.so", O_RDONLY) = 3     lstat("/dev/fd/63", {st_mode=S_IFLNK|0500, st_size=64, ...}) = 0     readlink("/dev/fd/63", "pipe:[405116]"..., 4096) = 13     lstat("/dev/fd/pipe:[405116]", 0x7fff5ea44850) = -1 ENOENT (No such file or directory)     lstat("/dev/fd", {st_mode=S_IFLNK|0777, st_size=13, ...}) = 0     readlink("/dev/fd", "/proc/self/fd"..., 4096) = 13     lstat("/proc/self/fd", {st_mode=S_IFDIR|0500, st_size=0, ...}) = 0     lstat("/proc/self", {st_mode=S_IFLNK|0777, st_size=64, ...}) = 0     readlink("/proc/self", "31536"..., 4096) = 5     lstat("/proc/31536", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0     lstat("/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0     open("/proc/31536/fd/pipe:[405116]", O_RDONLY) = -1 ENOENT (No such file or directory)     PHP Warning:  file_get_contents(/dev/fd/63): failed to open stream: No such file or directory in Command line code on line 1          Warning: file_get_contents(/dev/fd/63): failed to open stream: No such file or directory in Command line code on line 1     bool(false)          $ strace -f -e trace=file php <(echo 12)     ...     open("/usr/lib/php5/20100525/mongo.so", O_RDONLY) = 3     open("/dev/fd/63", O_RDONLY)            = 3     lstat("/dev/fd/63", {st_mode=S_IFLNK|0500, st_size=64, ...}) = 0     readlink("/dev/fd/63", "pipe:[413359]", 4096) = 13     lstat("/dev/fd/pipe:[413359]", 0x7fffa69c3c00) = -1 ENOENT (No such file or directory)     lstat("/dev/fd/63", {st_mode=S_IFLNK|0500, st_size=64, ...}) = 0     readlink("/dev/fd/63", "pipe:[413359]", 4096) = 13     lstat("/dev/fd/pipe:[413359]", 0x7fffa69c19b0) = -1 ENOENT (No such file or directory)     lstat("/dev/fd", {st_mode=S_IFLNK|0777, st_size=13, ...}) = 0     readlink("/dev/fd", "/proc/self/fd"..., 4096) = 13     lstat("/proc/self/fd", {st_mode=S_IFDIR|0500, st_size=0, ...}) = 0     lstat("/proc/self", {st_mode=S_IFLNK|0777, st_size=64, ...}) = 0     readlink("/proc/self", "32214"..., 4096) = 5     lstat("/proc/32214", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0     lstat("/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0     2


title: Use xdg-open to open a url with a new process

text: I'm starting to experiment with Crunchbang (which is based on Debian, and uses terminator) as a web development environment, and one of the things I am struggling with is the behaviour of `xdg-open`. I come from an OSX background, so forgive me if this question comes off as dense. I would like to be able to open a url with `xdg-open http://www.google.com` and then continue to use the same terminal window to work (it's how `open` functions in OSX). Right now, using `xdg-open` occupies the current tab/session until I close browser window, or manually end things with `ctrl + c`. I'd much prefer it start a new process, that way I can open up a URL, refer to data on the page, and use it in the same tab/window without needing to open an additional one.


title: Problem while installing Fedora 20 on a system with Windows 7

text: I am getting stuck at some point during a Fedora 20 installation from a live USB image. I have a drive with 133GB space that I am going to use as free space to install Fedora. Here are the details: ![enter image description here](http://i.stack.imgur.com/Hdz4V.png) Check the blue and red lines. Once I deleted that existing partition to make it unallocated free space for Fedora, what is that red line area for? Same as free space even if I don't have any such drive? Here is the result after deleting: ![enter image description here](http://i.stack.imgur.com/OsjWj.png) During the installation I get to the following step: ![enter image description here](http://i.stack.imgur.com/pLQDa.png) Why is there 0B space even if I have 133GB of unallocated space? I don't understand this. You can check my installation steps here in this document.


title: Is it possible to specify groups in /etc/security/capability.conf?

text: I've been inspired to start playing around with Linux capabilities again, my pet project is to replace the setuid on a lot of the binaries and provide access to additional privileged utilities to non-root users. Doing this by adding the relevant capabilities (`+ei`, issue is moot with `+ep`) via `setcap` and configure my personal user account (`jdavis4`) to have those capabilities assigned to its session at login via `pam_cap.so` and it's been going smashingly. I can give individual users access to "ping" and "kill" via capability.conf The problem I'm having, though, is that it occurred to me that if this were a production system an administrator would probably want to assign capabilities by some sort of aggregate unit so that they don't have to do this for each individual user every time they make one. This way a user can just be added to the "filesystemAdmin" group and get stuff like `CAP_DAC_OVERRIDE` or added to "ProcessManagement" and getting stuff like `CAP_SYS_NICE` and `CAP_SYS_KILL`. Is this currently possible?


title: What are pid and lock files for?

text: I often see that programs specify pid and lock files. And I'm not quite sure what they do. For example, when compiling nginx:               --pid-path=/var/run/nginx.pid \     --lock-path=/var/lock/nginx.lock \      Can somebody shed some light on this one?


title: Output the result of DF command to variable then print to an HTML page

text: I am having a problem executing a script that basically captures the disk space from the server and outputs the result to an HTML page.               STORAGE=$(df -PTh | column -t | sort -n -k6n)      The output in STDOUT is OK, it is well formatted. When I echo the variable to an HTML page, the output becomes one line, just like this one:               /dev/vx/dsk/localdg/wm7x01 vxfs 30G 21G 9.3G 70% /apps/wm7x01 /dev/mapper/vg00-vrts ext3 6.9G 4.7G 2.3G 68% /vrts_install /dev/mapper/vg00-ora11g_cli ext3 7.7G 4.1G 3.3G 57% /usr/oracle11g_cli /dev/mapper/vg00-repackage ext3 1008M 423M 586M 42% /var/spool/repackage /dev/vx/dsk/cfs_dcgnts_dg/shared vxfs 220G 91G 130G 42% /apps/shared      I even tried using:   * quotations: `echo "$STORAGE"`   * an array: `echo "{STORAGE[@]}"` Unfortunately, all yields the same result.


title: Removing the [ OK ] From start_udev

text: Under `/sbin/start_udev`, how can I remove the `[ OK ]` so it's not printed? I'm trying to change `/etc/rc.sysinit` to display the information I like, and I have managed to remove all the info output apart from the annoying `[ OK ]` Any ideas? I'm using Fedora 13


title: Example value for a nautilus (file manager) connect to service custom location

text: I am looking for an example for a nautilus (file manager) connect to service custom location.               $ nautilus      Activate connection editor:               File>Connect To Server...>      I am looking for an example or two for "Location" in the pop up:               Service Type: [Custom Location]     Location: [???]     [x] Add bookmark     Bookmark name: [xyz]     <Connect>      Service Type values are:   * SSH -FTP (with login)   * Public FTP   * Windows Share   * WebDAV (HTTP)   * Secure WebDAV (HTTPS)   * Custom Location


title: What problems should I expect when adding a CentOS yum repository to RHEL?

text: I've added the CentOS 6 Updates yum repository to my RHEL 6.4 machine. That's because RHEL doesn't ship with the php-snmp package - and the easiest one to find is on the CentOS site. Anyways, this appears to work okay in my environment - no problems I see. My questions are if this is an acceptable practice - keeping the original RHEL yum repositories active and adding the CentOS to the mix? What problems, if any, should I look out for? Is there a way I can guarantee that the RHEL yum repositories are searched first (and CentOS last)?


title: How can I add a line to multiple files in a directory tree structure?

text: Adding a line to multiple files in the same structure is not very hard, but I am stumped on how to do it over a possibly large directory tree structure. So lets say we have your project directory, which has hundreds of projects in it and you want to add a header to every *.c file. How can this be done? remember the files could be quite deep.


title: script to compare two string "foo" and "bar"

text: I'm going to create a script that should print "foo" or "bar" when a user's input is "foo" then print "bar" or when the user's input is "bar" then print "foo", otherwise show "invalid string". Here's the script which I'm working on:               foo=$x     bar=$y     val=$val     echo "enter the val = $val "     read $val     if [ "$val" = "$x" ]     then echo "bar"     elif [ "$val" = "$y" ]      then echo "foo"     else echo "invalid string"     fi      I'm new to scripting so I don't know too much.


title: How can I see dumps of wholе HTTP packets?

text: I need to see whole HTTP packets sent and recieved by an application for debugging purposes. How can this be done in command-line?


title: Copying large file causes excessive swap

text: On a mid-class CentOS 6.4/64 server with 32 GB RAM, 3 TB free disk space, operating as KVM hypervisor, I start copying a 200 GB file to a destination in the same local filesystem. In fact, this file is a KVM virtual disk image (corresponding to a shut down VM). Other 12 VMs are up & working normally on this same machine. I start with plenty of headroom to go:               [root@myserver]$ free                  total       used       free     shared    buffers     cached     Mem:      32847956   16722708   16125248          0      63756     407740     -/+ buffers/cache:   16251212   16596744     Swap:     16383992          0   16383992      But as the copy progresses, memory usage starts to grow steadily until it hits swap. Of course, this slows down everything now... the copy finally ends after ~30 minutes. At the end, my memory looks like:               [root@myserver]$ free                  total       used       free     shared    buffers     cached     Mem:      32847956   32643564     204392          0      24392   23213400     -/+ buffers/cache:    9405772   23442184     Swap:     16383992   12057880    4326112      Looking what processes are now using swap, I observe it several of the qemu- kvm instances. So now the performance of the server is suffering, as many if not all the VMs are now swapping. I don't find a way to get swap back to zero (its otherwise normal condition) without having to bring this production server to a reboot. What can cause this ? How can a simple cp process eat that much memory and how can this be avoided ? Any comments ? Thanks


title: kvm/qemu linux guest vm wont boot

text: host linux (kvm/qemu/libvirt) guest linux (slackware) the slack vm pauses just after `Loading Linux-virtio......` message. it's stuck in paused state. i think i shutdown the host without shutting the vm down first. maybe that did something. libvirtd status output...               Mar 09 12:04:25 aries dnsmasq[482]: using nameserver 192.168.1.1#53     Mar 09 12:04:25 aries dnsmasq[482]: using local addresses only for unqualified names     Mar 09 12:04:25 aries dnsmasq[482]: read /etc/hosts - 6 addresses     Mar 09 12:04:25 aries dnsmasq[482]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses     Mar 09 12:04:25 aries dnsmasq-dhcp[482]: read /var/lib/libvirt/dnsmasq/default.hostsfile     Mar 09 12:17:11 aries libvirtd[3713]: libvirt version: 1.2.1     Mar 09 12:17:11 aries libvirtd[3713]: metadata not found: Requested metadata element is not present     Mar 09 12:17:11 aries libvirtd[3713]: internal error: unable to execute QEMU command 'qom-get': guest hasn't updated any stats yet     Mar 09 12:19:34 aries libvirtd[3713]: End of file while reading data: Input/output error     Mar 10 14:46:53 aries libvirtd[3713]: metadata not found: Requested metadata element is not present      i've done some searching but i dont think i'm asking the right questions. the vm's xml is here .. http://pastebin.com/L3FY9aR7 libvirtd log level 2 here .. < http://pastebin.com/2uQH5gEW >


title: Bash: how to get the first number that occurs in a variable's content

text: how to get the first number of variables I have a variable:               STR="My horse weighs 3000 kg but the car weighs more"     STR="Maruska found 000011 mushrooms but only 001 was not with meat"     STR="Yesterday I almost won the lottery 0000020 CZK but in the end it was only 05 CZK"      I need to get the numbers:               3000     11     20      Please advise anyone?


title: Mysql Cluster Data node not started

text: I am working on Mysql Cluster in Fedora. I have three Fedora virtual machine. One is Management node and other two are Data node. My Management node started but my Data nodes are not started. When execute the command in Data node, I got errors                ndbd --initial          -bash : ndbd command not found      If I start the data node like this means i got some errors,                /usr/local/mysql/bin/ndbd --initial      unable to connect with connect string: nodeid=0,192.168.1.7:1186


title: How to exclude numeric directories with rsync?

text: I know rsync has an `--exclude` option which I use quite frequently. But how can I specify that it should exclude all "numeric" directories? In the directory listing below I would like to only have it copy `css`,`html`,and `include`               .     ..     123414     42344523     345343     2323     css     html     include      Normally my syntax is something like `rsync -avz /local/path/ user@server:/remote/path/ --exclude="cache"` I think it should look something like `--exclude="[0-9]*"` but I don't think that will work.


title: If symlink on NFS points to local disk, will advantage of local disk be lost?

text: I am working on a development network that uses NFS so that home directories etc can be accessed from any machine. However, NFS is occasionally flaky, causing slowdown/freezing of the machines. I am working on server-side code, using a development copy running on my machine. It does a lot of filesystem and database access, so make it more responsive, I have moved the files onto the local disk and put a symlink in the original directory on NFS. But, if NFS is responding poorly, will the symlink act as a bottleneck, preventing quick access to local files? Or will it be cached so as to avoid this problem?


title: After update, Synaptics touchpad gives lethargic pointer

text: My laptop is running KDE on a Debian a testing/unstable mix. I recently did an upgrade, which pulled in a new xorg version (xserver-xorg-core:amd64 2:1.15.1-1 → 2:1.15.99.904-1), including all the submodules such as xserver- xorg-input-synaptics:amd64 1.7.3-1+b1 → 1.8.0-1. There were a bunch of other things too. After reboot, the trackpad moves the pointer ridiculously slowly. As in move my finger across it quickly over a dozen times to get across the screen. Yet, moving my finger slowly shows it clearly still has acceleration, just nowhere near enough. First, of course, I tried the KDE Touchpad settings. I upped the maximum speed as far as it goes, and the same with the acceleration. That got it down to 5–6 times across quickly to get across the screen—still far too slow. Second, I tried speeding it up with `xset m`, changing the settings from 30/10 threshold 4 to even insane values like 100/2 didn't have any effect. Attempting to use `synclient` let me set the MaxSpeed to 255, but that hasn't done anything. It wouldn't let me push the AccelFactor above 1 (same as the KDE settings pannel). I downgraded the entire X stack to install synaptics 1.7 again (1.8 changed ABI). That works. The difference is immediately apparent: on the kdm login screen, it takes 1–2 swipes across the pad to go across the screen with 1.7; it takes 26 (yes, I counted) with 1.8. I logged into a failsafe session in both 1.7 and 1.8; the output of `xset q` is identical; the output of `xinput list-props` on the trackpad device is almost the same (the property numbers are different, 1.8 adds a new circular pad setting, value 0; 1.7 has grab event device set to 1, instead of 0 in 1.8). The xorg logs similarly don't seem to show much. I've put an tarball of them all on Dropbox if you wish to review them. Is there some config setting I'm missing? Seems like X acceleration is just broken here, leading to unacceptably slow pointers.


title: mysql jdbc connection issues in RHEL 6

text: I have setup the `mysql` database in one of the RHEL 6 servers. I would like to connect to this server's database from any other machine using a `java` program. How should I do it?


title: List info about files/directories with spaces

text: I am trying to use ls to get information about files and directories. My current command fails to properly get the name whenever a file/directory has a space. I am using this to list all files/directories in a directory:               ls -al --time-style=+%s . | awk '{if ($7 != ".." && $7 != "." && $1 != "total") print $1"\t"$3"\t"$5"\t"$6"\t"$7}'      Say I have 3 directories in my pwd "no-spaces-dir", "some dir", "some other dir", this would be the output:               drwxr-xr-x.     testuser    4096    1349853378      no-space-dir     drwxr-xr-x.     testuser    4096    1349853387      some     drwxr-xr-x.     testuser    4096    1349853359      two      I'm going to say this is an issue with my awk part. So $7 _should_ be the directory name, and obviously I could just add $8 and $9 to get my desired output for the example I set up, but I may not always know a directory will only have 1 or 2 spaces.. How can I keep this other information present (file/directory permissions, user, space, timestamp) and also get the full name in the command's output?


title: How to prevent killing the X server with CTRL+C using bash traps?

text: On my Debian Wheezy system, I used to start my X session with the startx command. My .xinitrc file is:               exec /usr/bin/awesome --config /home/cscs/.config/awesome/rc.lua >> ~/.cache/awesome/stdout 2 >> ~/.cache/awesome/stderr      Is there an other way to implement this using `trap "" INT` somewhere? I had no success catching the CTRL+C sequence, my X server exited with the message: `unexpected signal 2`. Login managers (slim, gdm, kdm, etc.) are not applicable.


title: show the year while listing files in the current directory

text: I am working on a red hat server   I want to list the files in a way where the year when each was file created would appear in the Date   how is that possible ?


title: How do I delete a custom style in Calligra Words?

text: I have accidentally clicked the 'add' button on the right when selecting styles and Calligra created a new style for me. I tried in the style manager but could not find a delete button and the `Delete` key does not work. I tried to edit the title for the style to a blank one but it still persists in the form of a style with a blank title? Help! What shall I do?


title: Linux find and remove all symlinks relating to a directory

text: So, I have a bit of a situation where I created many symlinks in an attempt to get them to work, trying all sorts of combinations .. now I have this error:                 ls: cannot access /etc/sv/me: Too many levels of symbolic links      There is no symlinks in /service/ or /etc/sv/   Im a bit of a noob at linux, the only way I can find to solve this error is to remove all of the symlinks relating to /service/ or /etc/sv/ but i don't even see the symlinks?


title: How can I copy a folder structure from one server to another keeping the same owner and permissions?

text: How can I copy a folder structure from one server to another keeping the same owner and file permissions?


title: Set volume from terminal

text: Is it possible to set the audio volume using the terminal?, instead of clicking the speaker icon in the topbar, the reason I want need to do this is because my keyboard does not have a volume increase/decrease buttons and I find it annoying to reach for the mouse.


title: nme for linux target setup fails on debian

text: I'm trying to run               haxelib run nme setup linux      To set up NME for the Linux target on my Debian box. Actually Linux MINT Debian Edition, but that shouldn't matter. However, I get the following output:               E: Unable to locate package ia32-libs-multiarch     Called from ? line 1     Called from InstallTool.hx line 579     Called from setup/PlatformSetup.hx line 440     Called from setup/PlatformSetup.hx line 474     Called from setup/PlatformSetup.hx line 1410     Called from helpers/ProcessHelper.hx line 133     Called from helpers/ProcessHelper.hx line 169     Uncaught exception - Error running: sudo apt-get install ia32-libs-multiarch gcc-multilib g++-multilib []      I also tried to run:               sudo apt-get install ia32-libs-multiarch      But I get               E: Unable to locate package ia32-libs-multiarch      Is this an Ubuntu specific package? Edit: I got this to work eventually, without installing that package or any other. Unfortunatly I don't remember what it was I did. If someone finds this and has the same problem give this question some attention and I will try again..


title: mouse in gnome-terminal

text: how to set up mouse in terminal window? when i click on midnight commander captions i get raw data from mouse printed as characters in terminal and any running progs don't understand mouses clicks. I didn't have a gpm package, so i'decided               $ps aux |grep -i gpm     user    3607  0.0  0.0 103244   912 pts/0    S+   16:45   0:00 grep -i gpm      and i did yum install gpm then               ps aux| grep gpm     root      3898  0.0  0.0   6732   568 ?        Ss   16:56   0:00      /usr/sbin/gpm -m /dev/input/mice -t exps2     user    3906  0.0  0.0 103244   888 pts/1    S+   16:56   0:00 grep gpm      then i start mc and do try click... all is the same i see responses in command-line as "M P!M#P!M F!M#F! " like sequences note i have other Linux where no gpm installed and all rocks fine..:doh:


title: Can Bash Emacs shortcuts be enabled over SSH?

text: I find Bash keyboard shortcuts such as `Ctrl-a` (jump to start of line), `Ctrl-k` (cut text following caret), `Ctrl-n`/`Ctrl-p` (next/previous line in command history) immeasurably useful in day-to-day CLI work. It's a shame that these shortcuts don't work when SSH'd into a remote `xterm`. Is there a way to enable these shortcuts over SSH?


title: Renaming files from bash in linux

text: There is a bunch of files of the following format hh-mm-ss.png where hh, mm, ss are hour, minute and second. How can I rename all these files in the directory in a sequential way from 1.png til n.png so that all files sorted by hour, then by minutes, then by seconds. For example,               12-56-11.png -> 3.png     11-13-49.png -> 1.png     12-55-55.png -> 2.png


title: Admin user not showing directory path in console prompt, only $

text: I have an Ubuntu server that I administer through `ssh`. When I login as `root` I get a full path in the prompt, like `/var/www`. I created a user with sudo privileges for the purpose of administration. When I login, all I see in the command prompt is a `$` sign. Is there a fix for this?


title: Save find -exec output to text file

text: I have a set of videos in the folder. I would like to get the info about this videos using `ffmpeg -i` command and save the output to file. So I wrote the line: `find . -type f -exec ffmpeg -i {} \; > log.txt ` But surprisingly, the log is empty! What am I missing here?


title: Why does unlink(1) support only one file?

text: I'm used to commands supporting multiple filename arguments if possible, but `unlink` doesn't:               %> unlink a b     unlink: extra operand `b'     Try `unlink --help' for more information.      I ended up using a `for` loop. Is there a technical reason why `unlink` only takes one filename?


title: How to manually insert a repository in source.list?

text: I tried to add a new APT repository using this command:               add-apt-repository ppa:atareao/atareao      but I got a "command not found" error. I tried installing `python-software- properties`, but it's already installed:               root@debian:~# apt-get install python-software-properties     Reading package lists... Done     Building dependency tree            Reading state information... Done     python-software-properties is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.      So I decided to add the repository manually to `source.list`, but don't know how. How can I edit `source.list` directly?


title: How do I prevent my hostapd access point from pretending to route to the Internet?

text: I have a nice little iMX6 (an ARM CPU) board running Linux kernel 3.0.35 with hostapd 0.7.3. Setting up the wireless interface as an access point works fine but clients think they can be routed through it to the Internet. This would not be a problem except that I want to set up one client (my laptop) with its wired/Ethernet interface as lower priority than its wireless interface (which will connect to my AP). Right now when the laptop connects to the AP, its wireless interface takes precedence over its wired interface and all requests to Internet IPs fail (because the laptop is trying to route through the AP). So I need to somehow set up the AP to "not advertise Internet access" so that clients don't attempt to reach Internet IP addresses through it. This is a hard thing to search for. My AP configuration: **dhcpd.conf** :               ddns-update-style none;          default-lease-time 86400;     max-lease-time 604800;          authoritative;          subnet 10.11.12.0 netmask 255.255.255.0 {         range 10.11.12.14 10.11.12.99;         option subnet-mask 255.255.255.0;         option broadcast-address 10.11.12.255;         option routers 10.11.12.13;     }      **hostapd.conf** :               interface=wlan0     ssid=Cameras     hw_mode=g     channel=6      **/etc/network/interfaces** :               auto lo     iface lo inet loopback          auto wlan0     iface wlan0 inet static          address 10.11.12.13           netmask 255.255.255.0          network 10.11.12.0


title: Things to consider when buying a desktop to use dual screens in linux

text: I'm about to buy a new desktop. I would like to be able to use two monitors. I am not sure what features will be most important here. I will probably run Ubunbtu, although I haven't decided (I might try Arch). The computer will mostly be for simple tasks: email, writing, though some occasionally more strenuous task (editing photos, some R analysis...)   * I believe I will need two distinct outputs (One VGA, one HDMI, probably)   * Is a separate graphics card important, or will the inbuilt graphics manage it?   * How much RAM should I be considering?   * Is the processor speed important?


title: rsync without prompt for password

text: I need to execute `rsync`, without it prompting me for password. I've seen in `rsync` manpage that it doesn't allow specifying the password as command line argument.   But I noticed that it allows specifying the password via the variable `RSYNC_PASSWORD`. So I've tried exporting the variable, but `rsync` keeps asking me for password.               export RSYNC_PASSWORD="abcdef"     rsync root@1.2.3.4:/abc /def      What am I doing wrong? _Please consider:_   * I understand that this is a **bad idea from security aspect**   * I must use only `rsync`, can't use other software   * I can't use key-based authentication   * I've already read many SE question, e.g.:   how-to-pass-password-for-rsync-ssh-command @ stackoverflow.com   rsync-cron-job-with-a-password @ superuser.com   how-to-setup-rsync-without-password-with-ssh-on-unix-linux @ superuser.com In other words, I need to have the `RSYNC_PASSWORD` approach working! :-)


title: Xubuntu and gtk apps problem

text: After upgrade from Ubuntu 11.04 to Ubuntu 11.10 I got disappointed with "Unity". I wanted my old-style Gnome 2 back. That's why i purged "Unity" and installed Xfce4. But, now i have a problem: All my Gtk+ apps i have used to (like Totem) have "Windows 95" kind of interface...they look very bad. Is there any "libgtk" I should install to fix that? Currently, i have "libgtk-3.0" installed but i'm kind of new to Linux so i don't even know if instaling some old "libgtk" would solve my problem. Can you guys help me?


title: All Domains Missing After Plesk Parallels Upgrade From 11 To 12

text: I've just used the Parallels upgrade service (`autoinstaller` in terminal). I upgraded from Parallels 11 to 12. I logged into the panel, it asked me all the personal info and I started to get nervous. Now that I am properly logged in, all my 165 customers and domains are missing!?! I've checked on the server, and the data is still present in the `/var/www/vhosts` directories, although nothing shows up in Parallels. I've also looked through the Parallels docs/forums/help but I can't find any starting points, apart from this very helpful suggestion to restore the server from backup: http://kb.sp.parallels.com/en/11190 Is there any way I can roll back to eleven? And, is there any chance I can get my domains/customers/sites/dignity back?


title: RFC 2544 / Y1564 software implementation

text: Is there any RFC 2544 and/or Y1564 software available for Linux? I'm aware that tools like `iperf`, `bw-ng` and `bmon` exist, but I was not able to find something that mimics Ethernet tester functionality with RFC2544 and Y1564 tests... Alternatively, can anyone recommend some advanced traffic generator (with multiple Ethernet frame size support) and advanced network statistics monitor?


title: Why can't I connect with Vuze Remote to Vuze over wifi?

text: I have Vuze Remote on my Android, it works fine with the mobile network but I can't connect through my work netwok(Wifi-LAN). It just sits at connecting or gives an error message wich says that the most common error is trying to connect with a wifi connection that you have to login to.


title: NFS Server changes in /etc/exports file need Service Restart?

text: I have NFSv4 Server (on RHELv6.4) and NFS Clients on (CentOSv6.4). Let's say in `/etc/exports`:               /shares/website1      <ip-client-1>(rw,sync,no_subtree_check,no_root_squash)     /shares/website2      <ip-client-2>(rw,sync,no_subtree_check,no_root_squash)      Then whenever i made some changes in that (let's say the changes ONLY for `client-2`), e.g:               /shares/website1      <ip-client-1>(rw,sync,no_subtree_check,no_root_squash)     /shares/xxxxxxxx      <ip-client-2>(rw,sync,no_subtree_check,no_root_squash)      Then i always `service nfs restart`. And then eventually .. the mount-point on `client-1` got **unresponsive** _(Can't open its files, etc)_. _(Why? Because of RESTART?)_ But as described, i only modified the line for `client-2` only. Everything for the `client-1` are still untouched. So my questions here are:   * Whenever i modify the `/etc/exports`, should i `restart` the service or what?   * If i `service nfs restart`, why the Mount-Point on other Clients are eventually affected? _(For those Client Machines with NO changes made in`/etc/exports` for them.)_ That means, whenever i make the changes in `/etc/exports` and `restart` the service, i will need to go **RE-MOUNT** the directories on **EVERY CLIENTS** in the export list, in order to have the mount-points working again. Any idea, please?


title: Is it better to archive/move mail based on mtime or ctime?

text: I have been using a perl script to archive mail found **here** The script uses ctime to process and decide which month sub folder to place mail. In most cases this is fine since the ctime = mtime and therefore the mails are archived by the month that they were sent or received. But I have found occasions when it is not good to run the script. Say for example a user moves mail back into the inbox or mail has been recovered from a backup into the inbox. If the script processes the touched mail it will move mail into a month it was touched not the time it was sent/received. Is it not better to process mails by mtime ? In other words what is the better POSIX qw I should use ?


title: Encoding Problem: Qt Apps delete all non ASCII chars from files

text: Qt applications are deleting non-latin characters from ISO-8859 encoded files on my Gentoo system. Actually I'm trying to merge two German files with KDiff3 and P4Merge (making "Whlen" out of "Wählen"). Both tools don't display the Umlauts and when the file is saved, they also disappear in the file. The Dejavu Monospace font is used, Courier New shows the same behavior. If UTF-8 encoded files are presented to the tools, all non-latins are handled correctly. GTK Meld (and all other GTK apps) handles the chars (ISO-8859-1 and UTF-8) quite well. I believe its my Locale configuration, but can't discern what's amiss... Any ideas? Configs:                $ locale -a      C      POSIX      de_DE      de_DE.iso88591      de_DE.iso885915@euro      de_DE.utf8      de_DE@euro      deutsch      en_US      en_US.iso88591      en_US.utf8      german           $ locale      LANG=en_US.UTF-8      LC_CTYPE="en_US.UTF-8"      LC_NUMERIC="en_US.UTF-8"      LC_TIME="en_US.UTF-8"      LC_COLLATE=C      LC_MONETARY="en_US.UTF-8"      LC_MESSAGES="en_US.UTF-8"      LC_PAPER="en_US.UTF-8"      LC_NAME="en_US.UTF-8"      LC_ADDRESS="en_US.UTF-8"      LC_TELEPHONE="en_US.UTF-8"      LC_MEASUREMENT="en_US.UTF-8"      LC_IDENTIFICATION="en_US.UTF-8"      LC_ALL=      Qt use flags for `x11-libs/qt-core-4.8.2:4`:               exceptions glib iconv qt3support ssl (-aqua) -c++0x -debug -icu -pch     (-optimized-qmake%) (-qpa%)


title: Where could I find the ifcfg-eth0 file?

text: I am using RHEL6, but I could not find the Ethernet interface configuration file `ifcfg-eth0` under `/etc/sysconfig/network-scripts`. Issuing `ifconfig -a` shows that `eth0` does exist. Could it be that the configuration file is hidden or saved in some other directory? If not, could I create such a file in the default directory(i.e., `/etc/sysconfig/network-scripts`) so that it would serve as the default configuration file?


title: Have Thunar remember file ordering for folders

text: I often attach files when on the web (using Chrome/Firefox), or when using email (Thunderbird). I need to navigate to a specific folder, and there I often need one of the most recent files. However, Thunar always resets the "Order by" column to "Name", so for every single attachment I need to re-order the column. This becomes annoying after so many attachments from the same folder. Is there a way of having Thunar remember the "Sort By" column for a certain folder? And if not, is there a way of setting Thunar to always sort by date? I think I prefer this over the "Name" column, generally. Using: XFCE, Thunar, Arch Linux.


title: Running the linux kernel and Ubuntu on custom processor

text: This is hardly a theoretical question as many have done this, albeit there's very little information on the underlying processes. I'm developing a custom MIPS-based processor on which I would like to run Ubuntu. I'm quite baffled as to what to do next after you've designed the instruction set and the computer architecture itself. I need to be able to run a kernel and OS but how does it all tie in? At the moment I'm researching into designing a compiler for the Linux kernel to generate the appropriate assembly language. Is that a good way to go? What do I need to do after that?


title: Stop receiving signals when running music from terminal

text: I can play music in my music collection by typing: 'vlc somefile.mp3 &' Which works great except that I always start receiving some signals from the execution of playing that song. In the following image the signals I dont want to be receiving is the heapload of information that starts running down the screen after the "play_all" command has been run here: ![](http://i1040.photobucket.com/albums/b410/hermanningjaldsson/signals.png) I don't want to receive those signals, they are irrelevant. I have already tried adding > /dev/null at the end of the command which I thought would redirect the STDOUT away, but to no avail. How do I stop receiving signals when running music from the terminal?


title: tmux bottom bar color change

text: I recently started to use `tmux` and like it much, but it's green bottom bar is a bit distracting, is there a way to change its color? or a way to hide it?


title: How to `du` only the space used up by files that are not hardlinked elsewhere?

text: Using `rsync --link-dest` for space-saving snapshots, how can I figure out how much space I actually saved? Or more general: > How to figure out how much space a directory uses considering only files > that are not hardlinked elsewhere _outside_ the directory structure? Asked > differently: How much space would actually be freed after a deletion of that > directory? (`du -hs` would lie. The space required for the hardlinks > themselves may be included)


title: Setup WLAN interface on Debian

text: I am trying to configure wlan on my dockstar. I installed `wireless-tools`, `zd1211-firmware` and `wpasupplicant`. My `/etc/network/interfaces` file looks like this:               auto lo eth0     iface lo inet loopback     iface eth0 inet dhcp     auto wlan0     iface wlan0 inet dhcp             wpa-ssid *myssid*             wpa-psk *mypw*      My wlan0-interface is up and got an ip address. However, I can only ping this address if the LAN interface is connected too. What am I missing? Output of `route -n`:               Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0     192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0     169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0     0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 eth0


title: Change PulseAudio Input/Output from Shell?

text: I have a set of nice wireless headphones which I use from time to time, in addition to my speakers and normal microphone. I'd like to write a script to switch between one input and output source and another, essentially a switch between my headphones and my speakers+microphone. I'd like to change between this: ![](http://i.imgur.com/uvLDa2q.png) ![](http://i.imgur.com/aBqR0dk.png) ...and this: ![](http://i.imgur.com/vtQM3Lu.png) ![](http://i.imgur.com/QFdRCT2.png) Is there a way for me script a transfer between the two inputs and outputs? Essentially I'm looking for something like this:               CURRENT_INPUT="$(get-current-input-name)"     CURRENT_OUTPUT="$(get-current-output-name)"          if [ "$CURRENT_INPUT" == "Vengeance 2000" ]; then         set-current-input "HD Pro Webcam C920"     else          set-current-input "Vengeance 2000"     fi          if ["$CURRENT_OUTPUT" == "Vengeance 2000" ]; then         set-current-output "Built-in Audio"     else         set-current-output "Vengeance 2000"     fi      Is there a way to script this?


title: Is there any ARM platform for which high resolution timers are available in mainline (unpatched) kernels?

text: I currently have some projects using a TS-7400 board, which has a Cirrus Logic EP9302 ARM9 processor. Some of my applications require a 1ms periodic timer, so after lots of struggling I found these patches (thanks Matthieu Crapet!) implementing the _Tickless System_ and _High Resolution Timer_ kernel features for this platform. That way I was able to create POSIX timers with nanosecond resolution and achieve periodic tasks under 10ms, but these patches are now unmaintained and were never incorporated in the official Linux kernel tree, so I'm forever stuck on kernel 2.6.32.3. In order to be able to use future kernel improvements I'm really inclined to move to another ARM9 or ARM11 platform for which High Resolution Timer support has been already developed and incorporated into the official mainline, so I could finally avoid this patch hunting nightmare. Any suggestions?


title: Keeping program GUI front-end and CLI functionality separate

text: In Linux a lot of programs have a CLI version and a GUI front-end. I read somewhere that this follows the linux philosophy and is good practice. Of course it's true from a developers perspective to keep the GUI code separated from the actual program. Given a program, which can be used happily from the command line, I would want to create a GUI for the command line version. What are my options here? I can think of only 2 that the GUI developer would use.   * calling the program with the configured paramters like so: system("someprogram --paramter1 -p2 -p3")   * having the CLI version be able to run in server mode with sockets (unix, inet, ...) and using those sockets to communicate with the "server" The cleanest solution would be the second in my opinion, but this is not always possible without altering the CLI version. The actual question is what is the proper way to have both a cli version and a GUI version built separately?


title: 'ss' command for checking sockets not found

text: I get an error when I try to execute this command on Red Hat Linux.               $ ss -s     -bash: ss: command not found      It is supposed to be for checking socket statistics. How do I execute this?


title: Merging folders with mv?

text: If I move a folder with mv called "folder" to a directory that already contains "folder" will they merge or will it be replaced?


title: Low color depth while using X11 on a monitor

text: I am running Mint on a Late 2012 Mac Mini. While running X (KDE, LMDE or openbox) I notice a low color depth on My Dell S2209W monitor. I believe that the depth is not actually low as I can change the depth to 8, 16 and 24 bits and observe differences. However, when I connect different monitors (another DELL and an Acer), the colours appear as expected. There is nothing wrong with my S2209W as colours are produced appropriately on OSX and on mint when connected to a different computer. Is this an X11 configuration issue? Is there anything I can do to experience better colours on the S2209W? My Kernel: `Linux hostname-MacMini 3.5.0-23-generic #35-Ubuntu SMP Thu Jan 24 13:15:40 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux`


title: Wireless 3g dongle not mode-switching successfully

text: Lots of wireless 3G dongles have 2 modes they can operate in; storage mode where they mount like a USB thumb drive and which usually contains Windows drivers for the device, and communication mode. As Linux doesn't need the Windows drivers, generally `usb_modeswitch` is supposed to always try and switch the device's mode to communications so it can be added via NetworkManager. I'm having a problem where my device doesn't seem to switch successfully. I'm using a fresh install of Linux Mint 17 (I've tried this very install on several machines now with the same result), and I'm inserting a Vodafone 3G USB dongle after boot. Its model is `K3772`. It gets mounted as a storage device, so I can see the Windows driver files, but if I try to add it in NetworkManager as a Mobile broadband device, the "Create a connection for this mobile broadband device" dropdown is greyed out, and just displays "Any device". This seems to mean that the device has not been recognized, especially considering that when I try this on my separate Debian wheezy install, it does recognize the device and it appears in that dropdown. I enabled logging for usb_modeswitch, and here's the log: http://pastebin.com/qd3sNKBQ As you can see, "driver binding failed". Anyone know why it might be failing to switch? I see no obvious reason.


title: I want to use the command 'shutdown -r now' in Lazarus

text: I want to use the command `shutdown -r now` in Lazarus, but I don't know how to do it. Any tips or examples that you can give me I would be most grateful.


title: Ubuntu make fails with No such file or directory /lib/modules/3.4.0/build

text: I am trying to build the CP210x driver for the 3.x.x kernel on ChrUbuntu. Build instructions: Ubuntu:   1. `make` ( your cp210x driver )   2. `cp cp210x.ko /lib/modules/<kernel-version>/kernel/drivers/usb/serial`   3. `insmod /lib/modules/<kernel-version/kernel/drivers/usb/serial/usbserial.ko`   4. `insmod cp210x.ko` I started with `apt-get install build-essential` then:               root@ChrUbuntu:~/Documents/# make     make -C /lib/modules/3.4.0/build M=/home/me/Documents/Linux_3.x.x_VCP_Driver_Source modules     make: *** /lib/modules/3.4.0/build: No such file or directory.  Stop.     make: *** [all] Error 2      But I am confused by the error because the location apparently exists:               root@ChrUbuntu:/lib/modules/3.4.0# ls -la     total 820     lrwxrwxrwx  1 root root    105 Feb  8 17:01 build -> /build/x86-mario/tmp/portage/sys-kernel/chromeos-kernel-3.4-r996/work/chromeos-kernel-3.4/build/x86-mario      How can I resolve this?