title: What commands can I use to enable / disable Apache2 modules?

text: What are the terminal commands used to enable and disable Apache2 modules? **Update:** Since the commands appear to differ based on distribution, I have made this question a community wiki where hopefully each poster can indicate the commands they use along with the pertinent distributions in which they work.


title: Issue in Asterisk Performance

text: I am running FreePBX on DigitalOcean VM. I am facing some call dropping issue in Asterisk. When looking at "htop", "top" and FreePBX GUI, I see different results of CPU utilization and can't understand if my VM is OK or needs attention w.r.t CPU. Load average shows nearly idle system while CPU utilization of Asterisk process is pretty high. ![enter image description here](http://i.stack.imgur.com/s02K8.jpg) ![enter image description here](http://i.stack.imgur.com/3fBWi.jpg) ![enter image description here](http://i.stack.imgur.com/IAbkj.jpg) Could someone please advise me on this? 74% CPU on a process yet idle system on load average. Can this be an issue causing call dropping on Asterisk?


title: mounting mmcblk0p1 failed with Invalid argument

text: When I am running linux from sd card and try to mount sd card -no problem, works fine. But when I am running linux from flash memory I am unable to mount my SD card:               # mount /dev/mmcblk0p1 /mnt/      mount: mounting /dev/mmcblk0p1 on /mnt/ failed: Invalid argument      What could be the basic reason for this error ? **Additional Info**               root@Xilinx-ZC702-14_7:/# mount -t /dev/mmcblk0p1 /mnt     mount: can't find /mnt in /etc/fstab           root@Xilinx-ZC702-14_7:/var/volatile/log# ls     wtmp          root@Xilinx-ZC702-14_7:/var/volatile/log# dmesg     dmesg: klogctl: Function not implemented


title: Pad a number with a zero

text: I'm trying to pad zero to a number               a=010     printf "%04d" $a     0008      I need the "output" as "0010" it's converting the value..can any one help on this ?? and even tried with typeset               a=010     typeset -RZ2 a     echo $a      when I use the same in my script I got the following error:               Invalid -R option


title: exec cp failes from script, yet works when issued directly

text: I have a script that copies SQL backups to a windows server. Here's the line from /etc/fstab:               //my.win.box/share$ /winshare   cifs    credentials=/etc/credfile,dom=mydomain,uid=0,gid=0,file_mode=0600,dir_mode=0700 0 0      Here's the backup script: backup.sh:               # copy zipped sql exports to /winshare/db     find /backups/sql/*sql.gz -mtime +1 -exec cp {} /winshare/db \;      Logged in with root privileges (in this case, as root)               $ ./backup.sh     cp: cannot create regular file `/winshare/db/mydb_20130301.sql.gz': Permission denied      Yet if I issue the command from a prompt, rather than through the script:               $ find /backups/sql/*sql.gz -mtime +1 -exec cp {} /winshare/db \;      The file(s) are copied as expected. Again, logged in as root here. What could be causing the in-script command to fail, yet the identical command to work from console?


title: Installing Linux Mint on Windows-Ubuntu Dual Boot

text: I currently have an Ubuntu-Windows Dual boot. However, I would like to try out a new OS so I burned Linux Mint to a USB stick. I would like to install Linux Mint and remove Ubuntu while still keeping my windows dual boot. I've already backed up my Ubuntu setup so I can wipe it out. In the Linux Mint installer, should I choosing the "install alongside windows" option do this?


title: How to measure traffic on OpenWRT 12.04

text: Since just doing a cronjob every morning, before the router reboots:               ifconfig > "`date`.ifconfig.txt"      isn't very effective, since after ~4 GByte's the counter in the ifconfig will go to zero. So if there was ~5 GByte traffic, only 1 GByte will be in the txt file. **My question:** How can I measure daily traffic with OpenWRT 12.04?


title: What's the difference between print and head?

text: I know `head` gives you the beginning section of a file. But in this case, I'm trying to go through my source control and find every file that has a shebang line. And I'm failing to get results when I use `head`. What am I doing wrong? When I say doesn't work, i mean it returns nothing. But I know it should've returned something. **Works, but slow!**               find . | awk '!/((\.jpeg)|(\.jpg)|(\.html)|(\.png))$/ {print $0; }' | xargs grep "#!"      **Doesn't Work**               find . | awk '!/((\.jpeg)|(\.jpg)|(\.html)|(\.png))$/ {head $0; }' | xargs grep "#!"      **Update** As @devnull pointed out, and easily verified by googling. I'll list here for reference: Awk Commands               if ( conditional ) statement [ else statement ]     while ( conditional ) statement     for ( expression ; conditional ; expression ) statement     for ( variable in array ) statement     break     continue     { [ statement ] ...}     variable=expression     print [ expression-list ] [ > expression ]     printf format [ , expression-list ] [ > expression ]     next     exit


title: How can I measure and prevent clock drift?

text: On several production platforms we have observed symptoms which appear to suggest that the time of day clock is periodically jumping forward or backward. The jumps are typically around 1 second, typically cancel out (jump forward then backward very shortly thereafter) and happen around 50 times per day. This drift is most noticeable during times of peak application usage, and during periods of high disk I/O operations such as daily backups. These drifts are affecting our soft real-time sensitive application. Systems are Oracle Netra X4250 and Netra X4270 servers running SLES 11SP2 with 3.0.58-0.6.6-default kernel.               $ cat /sys/devices/system/clocksource/clocksource0/available_clocksource     tsc hpet acpi_pm          $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource     tsc      We have disabled NTP, but that has not had any effect on the drifts. Are there tools which measure time of day clock drift? How can we avoid this? These are production platforms, and we cannot recreate the issue in our labs, so my ability to experiment is limited. If left to my own devices, I'll write a tool to measure drift, and perhaps experiment with an HPET clocksource.


title: Installing GRUB2 in a GPT disk on a partition

text: I'm using a MacBook Air 2013 and I'm trying to install Gentoo. I already did it several times but I always used other "workarounds" to this problem such as using directly a EFI-stub kernel image. What I'm trying to achieve is installing GRUB on a PARTITION so I won't scramble the original disk layout of my Macbook. This is my partition table:                   GPT fdisk (gdisk) version 0.8.8          Partition table scan:       MBR: protective       BSD: not present       APM: not present       GPT: present          Found valid GPT with protective MBR; using GPT.     Disk /dev/sda: 236978176 sectors, 113.0 GiB     Logical sector size: 512 bytes     Disk identifier (GUID): 9DF6BE23-87E0-4602-B71F-7DAD445D5614     Partition table holds up to 128 entries     First usable sector is 34, last usable sector is 236978142     Partitions will be aligned on 8-sector boundaries     Total free space is 6 sectors (3.0 KiB)          Number  Start (sector)    End (sector)  Size       Code  Name        1              40          409639   200.0 MiB   EF00  EFI System Partition        2          409640       176582599   84.0 GiB    AF00  Customer        3       176582600       177852135   619.9 MiB   AB00  Recovery HD        4       177852136       178114279   128.0 MiB   EF00  EFI System        5       178114280       236978142   28.1 GiB    8300  Linux filesystem      The **1st** partition is the original ESP of my Mac (where I installed Refind) and I would like to keep it as it is. I tried to place GRUB on the **4th** partition (which is **vfat** ) but when I try to install it there I get:               # > grub2-install /dev/sda4         /usr/sbin/grub2-bios-setup: warning: File system 'fat' doesnt' support embedding.     /usr/sbin/grub2-bios-setup: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..     /usr/sbin/grub2-bios-setup: error: will not proceed with blocklists.      I also tried using               grub2-install --force /dev/sda4      but that did nothing. How can I solve this thing? Thanks!


title: counting chars using bash

text: I'm quite new to bash, and I'm trying to count the number of chars in a file. I wrote the following function:               function chars(){         m=$(cat $1)         m=${#m}         echo $m     }      calling it with `echo $(chars $2)` results on a file the number 524, while calling `wc -c` on the same file results 525. What causes the difference? How can I get the same result? (and as a side question - can I combine the two first lines of my function into one?)


title: Does bash recognize a variable declaration as string if you do not put the quotation marks?

text: name=Jackson     echo $name      This will display Jackson.               name="Jackson"     echo $name      This will also display Jackson. So I assume by putting quotation marks around a variable it is making it a string. What would name=Jackson technically be? Would it also be recognized as a string?


title: Can I list the filesystems a running kernel can support?

text: I'm trying to detect what filesystems a kernel can support. Ideally in a little list of their names but I'll take anything you've got. Note that I don't mean the current filesystems in use, just ones that the current kernel could, theoretically support directly (obviously, fuse _could_ support infinite numbers more).


title: Inserting favorites into shell console

text: Is there any tool/terminal emulator which supports that I can insert my 'favourites' like '2>/dev/null' or 'date +%Y%m%d%H%M' and so forth .. everywhere into the command line ? I could not find any terminal emulator, or clipboard tool which has favorites ... :( Thanks in advance. Using aliases and bash functions are not enough flexible inserting these anywhere into the command line.


title: privoxy show client ip when sending mail

text: Is it possible for `privoxy` to show original client ip when sending mail ( example: this mail header should show the client's ip not the proxy ip:               Received: from [xx.xx.xx.xx] by web142501.mail.bf1.yahoo.com via HTTP;      I found that this               { +change-x-forwarded-for{add} }      will detect the proxy ip and also the client's ip but does not seem to work with mail headers.


title: run a php script in centos and time and timeout

text: I want to run a php script in centos ( `/usr/bin/php file.php` ), and it takes long time to execute,and in the middle of executing , it stops running , and does not give me any errors. and I'm sure that there is absolutely no error in my php code (I tested it in many way) , I think it's the matter of time of executing.   my question is :   * is it possible that it's timeout error from my server that stops the script from executing ?   * if yes, how can I set the server to gives timeout error in a longer time? Thanks.


title: Yast2 is downgrading external packages

text: I've downloaded and installed the latest packages of mono from their page.(version 3.2) But after installing some other packages using Yast2, Yast2 downgraded all the mono packages to the version that is aviable in Yast2 repository. (version 3.0). Is there a way to tell Yast2 to stop doing it ?


title: Can anyone decipher this kernel stack trace? I think it's hardware, but

text: May 14 02:40:59 cerberus kernel: [480872.848991] BUG: unable to handle kernel NULL pointer dereference at           (null)     May 14 02:40:59 cerberus kernel: [480872.849015] IP: [] osi_TryEvictVCache+0xcd/0x2b0 [libafs]     May 14 02:40:59 cerberus kernel: [480872.849047] PGD cb056067 PUD cb057067 PMD 0      May 14 02:40:59 cerberus kernel: [480872.849056] Oops: 0000 [#1] SMP      May 14 02:40:59 cerberus kernel: [480872.849064] Modules linked in: fuse nfsv4 nfs dns_resolver fscache libafs(POF) hwmon_vid coretemp iTCO_wdt snd_hda_codec_via iTCO_vendor_support snd_hda_intel snd_hda_codec kvm_intel atl1e snd_hwdep snd_seq snd_seq_device snd_pcm kvm snd_page_alloc snd_timer snd soundcore lpc_ich mfd_core i2c_i801 ppdev asus_atk0110 microcode parport_pc parport nfsd auth_rpcgss nfs_acl lockd sunrpc nouveau mxm_wmi wmi video i2c_algo_bit drm_kms_helper ttm drm i2c_core     May 14 02:40:59 cerberus kernel: [480872.849147] CPU 0      May 14 02:40:59 cerberus kernel: [480872.849152] Pid: 772, comm: afsd Tainted: PF          O 3.8.11-200.fc18.x86_64 #1 System manufacturer System Product Name/P5KPL-AM EPU     May 14 02:40:59 cerberus kernel: [480872.849160] RIP: 0010:[]  [] osi_TryEvictVCache+0xcd/0x2b0 [libafs]     May 14 02:40:59 cerberus kernel: [480872.849178] RSP: 0018:ffff88010455dd38  EFLAGS: 00010246     May 14 02:40:59 cerberus kernel: [480872.849182] RAX: 0000000000001515 RBX: ffff88007db79e00 RCX: ffff8800afd01860     May 14 02:40:59 cerberus kernel: [480872.849187] RDX: 0000000000000000 RSI: 0000000000000282 RDI: ffff88007db79e88     May 14 02:40:59 cerberus kernel: [480872.849192] RBP: ffff88010455dd78 R08: ffff88011fc13d80 R09: 0000000000000001     May 14 02:40:59 cerberus kernel: [480872.849197] R10: 0000000000000000 R11: 0000000000000001 R12: ffff88007db79e88     May 14 02:40:59 cerberus kernel: [480872.849203] R13: 0000000000000001 R14: 0000000000000000 R15: ffff88007db79e00     May 14 02:40:59 cerberus kernel: [480872.849208] FS:  0000000000000000(0000) GS:ffff88011fc00000(0000) knlGS:0000000000000000     May 14 02:40:59 cerberus kernel: [480872.849214] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b     May 14 02:40:59 cerberus kernel: [480872.849218] CR2: 0000000000000000 CR3: 00000000cb055000 CR4: 00000000000407f0     May 14 02:40:59 cerberus kernel: [480872.849223] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000     May 14 02:40:59 cerberus kernel: [480872.849227] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400     May 14 02:40:59 cerberus kernel: [480872.849233] Process afsd (pid: 772, threadinfo ffff88010455c000, task ffff880115649760)     May 14 02:40:59 cerberus kernel: [480872.849237] Stack:     May 14 02:40:59 cerberus kernel: [480872.849240]  ffff88010455ddb4 0000000000000000 ffff88006ce88b40 ffff880051f498a0     May 14 02:40:59 cerberus kernel: [480872.849249]  0000000000082d3b 0000000000000001 0000000000000000 ffff88007db79e00     May 14 02:40:59 cerberus kernel: [480872.849258]  ffff88010455dde8 ffffffffa0406aab 0000000000000000 0000000000000000     May 14 02:40:59 cerberus kernel: [480872.849267] Call Trace:     May 14 02:40:59 cerberus kernel: [480872.849282]  [] afs_ShakeLooseVCaches+0x8b/0x220 [libafs]     May 14 02:40:59 cerberus kernel: [480872.849298]  [] afs_Daemon+0x263/0x660 [libafs]     May 14 02:40:59 cerberus kernel: [480872.849314]  [] ? afsd_launcher+0x50/0x50 [libafs]     May 14 02:40:59 cerberus kernel: [480872.849329]  [] afsd_thread+0x2fb/0x740 [libafs]     May 14 02:40:59 cerberus kernel: [480872.849344]  [] ? afsd_launcher+0x50/0x50 [libafs]     May 14 02:40:59 cerberus kernel: [480872.849352]  [] kthread+0xc0/0xd0     May 14 02:40:59 cerberus kernel: [480872.849358]  [] ? perf_trace_xen_cpu_write_gdt_entry+0xa0/0x100     May 14 02:40:59 cerberus kernel: [480872.849364]  [] ? kthread_create_on_node+0x120/0x120     May 14 02:40:59 cerberus kernel: [480872.849372]  [] ret_from_fork+0x7c/0xb0     May 14 02:40:59 cerberus kernel: [480872.849377]  [] ? kthread_create_on_node+0x120/0x120     May 14 02:40:59 cerberus kernel: [480872.849382] Code: c7 c7 60 5c 45 a0 c7 05 96 89 03 00 00 00 00 00 e8 09 ef 21 e1 4c 89 e7 e8 71 14 22 e1 48 8b 93 08 01 00 00 48 89 55 c8 49 89 d6  8b 36 4d 85 f6 74 6a 4d 8d 7e ac 4c 89 ff e8 4f 14 22 e1 49      May 14 02:40:59 cerberus kernel: [480872.849458] RIP  [] osi_TryEvictVCache+0xcd/0x2b0 [libafs]     May 14 02:40:59 cerberus kernel: [480872.849473]  RSP      May 14 02:40:59 cerberus kernel: [480872.849479] CR2: 0000000000000000     May 14 02:40:59 cerberus kernel: [480872.856504] ---[ end trace d58385207fb6dcb9 ]---


title: Understanding Perf tool output

text: I recently installed Perf tool On my platform and wanted to use it for profiling my platform. I started profiling a standalone application.Below command I used                  perf start ./helloworld            Performance counter stats for './helloworld':                4.555957 task-clock                #    0.000 CPUs utilized                  1 context-switches          #    0.219 K/sec                  0 cpu-migrations            #    0.000 K/sec                124 page-faults               #    0.027 M/sec                <not supported> cycles                <not supported> stalled-cycles-frontend                <not supported> stalled-cycles-backend                <not supported> instructions                <not supported> branches                <not supported> branch-misses                     60.005519331 seconds time elapsed      Now I am not sure how should I interpretate this output.is it as expected? Also,what should I make of < not supported > filed here,Is there anything I need to enable to support this fied before run the command?


title: How to search and replace multiple needles by one word via one expression?

text: Assume you have a text file:               foo fnord bar     bizz foo poit      And now I would want to replace both "foo" and "bar" into "narf". I know I could use:                sed -e 's/foo/narf/g' -e 's/bar/narf/g' fileName      Yet I would like to work with an OR-operator that tells the regex to match both needles via one expression. Hitting some manuals I suppose the pipe should fit my needs but I tried               sed -e 's/foo|bar/narf/g' -i fileName      and it didn't work and it's not even throwing an error. What am I doing wrong here?


title: Clean up concatenated XML files

text: I'm trying to fix my Delicious export script to work with the new "trick" of only serving 1000 bookmarks at a time. The script concatenates results (XML) from multiple calls in a single file, and now I have to get rid of the header and footer text from the resulting file. Example:               <?xml ...     <posts ...       <post ...       ...          # 998 other posts       <post ...     </posts>     # Line 1003     # The above lines are repeated N times before the final line:     </posts>      In other words, I want to remove any lines not starting with `<post` between (excluding) the third and the last line, and each chunk of XML is 1003 lines exactly, except for possibly the last one. I'm guessing `sed` or `awk` should be perfect for this.


title: Trouble getting awk output in for loop

text: I'm trying to create a script that will check a website for a word. I have a few to check so I'm trying to input them via another file. The file is called "testurls". In the file I list the keyword then the URL. They are separated with a semicolon.               Example Domains;www.example.com     Google;www.google.com      Here is the script:               #!/bin/bash     clear          # Call list of keywords and urls     DATA=`cat testurls`          for keyurl in $DATA     do         keyword=`awk -F ";" '{print $1}' $keyurl`         url=`awk -F ";" '{print $2}' $keyurl`         curl -silent $url | grep '$keyword' > /dev/null      if [ $? != 0 ]; then         # Fail             echo "Did not find $keyword on $url"         else         # Pass             echo $url "Okay"     fi     done      The output is:               awk: cannot open Example (No such file or directory)     awk: cannot open Example (No such file or directory)     curl: no URL specified!     curl: try 'curl --help' or 'curl --manual' for more information     Did not find  on     awk: cannot open Domains;www.example.com (No such file or directory)     awk: cannot open Domains;www.example.com (No such file or directory)     curl: no URL specified!     curl: try 'curl --help' or 'curl --manual' for more information     Did not find  on     awk: cannot open Google;www.google.com (No such file or directory)     awk: cannot open Google;www.google.com (No such file or directory)     curl: no URL specified!     curl: try 'curl --help' or 'curl --manual' for more information     Did not find  on      I've hacked away at this for ages now. Any help is very welcome.


title: no root shell freely available sudoers policies

text: I want to prevent users who need escalated privileges from obtaining any kind of a root shell. However since there are many ways to attain this, and many non root commands ( like those found in coreutils ) I'm wondering if there are any downloadable sudoers policies that provide restrictive access.


title: How to write simple if condition in ash?

text: I would like to write a small script that would check every once in a while if I have the internet connection. I would like to run it in `crontab` on my router where I have `ash`. I am having a hard time using `ash` with if conditionals So far I have gotten to something like this :               #!/bin/ash          echo $i     if [ $(ping -c 1 google.com) -eq 0 ]     then       echo "IT WORKS :)"     else       echo "no internet :( "     fi      But it gets me this error :               # ./restart_on_no_connection.sh      ash: google.com: unknown operand     no internet      Any ideas ?


title: Get current versions of applications via apt-get

text: I am new to debian. What bothers me is that apt-get install shows just really old versions of everything. E. g. "Eclipse Galileo" but currently it's "Juno" and imho there was "Helios" and "Indigo" in between. And gcc is 4.2 but I need at least 4.6 for c++11 features. My question ist how can I get apt-get to show me new versions of the programs?


title: VMwarePlayer on debian. Missing kernel modules

text: Today I changed my workstation to Debian. As Ubuntu is not nearly stable. Now I installed VMware player. I started it and got a message "Before you can run VMware, several modules must be compiled and and loaded into the running kernel. Kernel headers for version2.6.32-5-amd64 were not found" , below a field were I can give a file location. What should I do now? I never faced such a situation.


title: Autocompletion for Makefile rules in tcsh

text: I'm using `tcsh` in a SUSE 11 box and I realized that when typing `make``Tab` it allows me to auto-complete the rules available within the Makefile, not the files that are inside the current directory. I've tested this with RedHat and Ubuntu at work and Debian at home (all with `tcsh`), and none of them supports this (IMO) nice behavior. How can this be achieved with the other distributions as well?   This is something I've wanted to have since many years ago.


title: Apache cannot fork: cannot allocate memory

text: I am running `apache` on Fedora with `mod_perl`. The server forks a process to send an email frequently - and the fork exits. Suddenly, I got: `Cannot fork: Cannot allocate memory`. There was plenty of free memory (I did not look too closely, but there was more memory free than in use), not too many `apache` processes running - 10?, low cpu usage, close to 0. Restarting the server httpd graceful resolved the issue. What would cause something like this? Is it possible that I got into some kind of a state where the problem was allocating too many processes in the system - and with dropping load failed to recover? Unfortunately I do not have too much info as I was panicking and trying to get the site up instead of running diagnostics. :-) So my question is very general: is there anything that's not obvious that would create this behavior when too many processes are allocated? Anything specific to forking from within apache? etc Thank you!


title: "select" vs "depends" in kernel Kconfig

text: What are the differences in dependencies between `select` and `depends on` in the kernels Kconfig files?               config FB_CIRRUS     tristate "Cirrus Logic support"     depends on FB && (ZORRO || PCI)     select FB_CFB_FILLRECT     select FB_CFB_COPYAREA     select FB_CFB_IMAGEBLIT     ---help---     This enables support for Cirrus Logic GD542x/543x based boards on     Amiga: SD64, Piccolo, Picasso II/II+, Picasso IV, or EGS Spectrum.      In the example above, how is `FB_CIRRUS` diffrently related to `FB && (ZORRO || PCI)` than it is to `FB_CFB_FILLRECT`, `FB_CFB_COPYAREA` and `FB_CFB_IMAGEBLIT`?


title: grep and escaping a dollar sign

text: I want to know which files have the string `$Id$`.               grep \$Id\$  my_dir/mylist_of_files      returns 0 occurrences. I discovered that I have to use `grep \$Id$ my_dir/mylist_of_files` Then I see that the `$Id` is colored in the output, i.e. it has been matched. How could I match the second `$` and why doesn't `\$Id\$` work. It doesn't matter if the second `$` is the last character or not. I use `grep` 2.9. * * * Before posting my question, I used google... I found an answer > To search for a $ (dollar sign) in the file named test2, enter: > > grep \\\$ test2 > > The \\\ (double backslash) characters are necessary in order to force the > shell to pass a \$ (single backslash, dollar sign) to the grep command. The > \ (single backslash) character tells the grep command to treat the following > character (in this example the $) as a literal character rather than an > expression character. Use the fgrep command to avoid the necessity of using > escape characters such as the backslash. but I don't understand why `grep \$Id` works and why `grep \\$Id\\$` doesn't. I'm a little bit confused...


title: Directory/files owned by a non-existent user

text: A user has created a directory with files, but the user does not exist in `/etc/passwd` or `/etc/group`. The system is a Fedora server with an FTP server and proxy which redirects to a CentOS server with Apache where the directory was created. Where could the user have come from? Is this a security problem?


title: What to use when burning footage

text: I'm running Zorin OS 9 and filmed some things on my camera and am about to edit them. What can I use to burn them to my blank DVD-R disks?


title: hostapd, ath5k, nl80211 - how to get it working?

text: I have this network adapter in an Asus notebook running Manjaro Linux (based on Arch), everything up to date (Kernel: 3.10.11):               > lspci -k | grep -A 3 -i "network"     lspci: Unable to load libkmod resources: error -12     07:00.0 Ethernet controller: Qualcomm Atheros AR242x / AR542x Wireless Network Adapter (PCI-Express) (rev 01)         Subsystem: AzureWave AW-GE780 802.11bg Wireless Mini PCIe Card         Kernel driver in use: ath5k      `iwconfig` gives:               > iwconfig     wlp7s0    IEEE 802.11bg  ESSID:off/any                 Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Power Management:off      I have `hostapd` 2.0 installed. My minimal config is:               interface=wlp7s0     driver=nl80211     hw_mode=g     ssid=test     channel=6      Running it gives               > hostapd test.conf     Configuration file: test.conf     Could not set interface wlp7s0 flags (UP): Operation not permitted     nl80211 driver initialization failed.      Running with `sudo`:               sudo hostapd test.conf     Configuration file: test.conf     nl80211: Failed to set interface wlp7s0 into AP mode     nl80211 driver initialization failed.      What is wrong here? How do I get my notebook to work as an AP?


title: When and how was the double-dash (--) introduced as an end of options delimiter in Unix/Linux?

text: I don't think the shell/utilities in historical Unix nor in something as "recent" as _4.4BSD_ supported using a double-dash(or two consecutive hyphens) as an _end of options delimiter_. With _FreeBSD_ , you can see for instance a note introduced in the `rm` manpages with the _2.2.1 release_ (1997). But this is just the documentation for one command. Looking at the oldest _GNU fileutils_ changelog I can find, I see this1(slightly altered):               Tue Aug 28 18:05:24 1990  David J. MacKenzie  (djm at albert.ai.mit.edu)          * touch.c (main): Don't interpret first non-option arg as a   <---       time if `--' is given (POSIX-required kludge).       * touch.c: Add long-named options.     * Many files: Include <getopt.h> instead of "getopt.h" since       getopt.h will be in the GNU /usr/include.     * install.c: Declare some functions.     * touch.c, getdate.y, posixtime.y, mktime.c: New files, from bin-src.     * posixtime.y: Move year from before time to after it (but       before the seconds), for 1003.2 draft 10.      This predates _Linux_. It's clearly to account for the fact that you might want to create a file with a name containing the same number of digits as a time specification(eight or ten-digit decimal number) - rather than specifying a timestamp for an existing file... * * *   * So is it _posix.1_ which introduced the double-dash (`--`) as an _end of options delimiter_ in Unix shells?   * Did this all start because some people wanted to use digits in filenames with `touch` in the early '90s and then this went on in a piecemeal fashion one utility at a time for a decade??   * What is the spirited comment in the changelog about?   * When was _Guideline 10_ ( _The argument -- should be accepted as a delimiter indicating the end of options.[...]_ ) introduced to the POSIX Utility Syntax? * * * 1\. As opposed to this i.e. documenting the long options in all commands usage globally, which is unrelated. On the other hand, you can see reference to the delimiter appear in something like _GNU_ _rm.c_ in 2000 as a comment, before being exposed to the end user in 2005(the _diagnose_leading_hyphen_ function). But this is all much later and is about a very specific use case.


title: Calendaring daemon

text: I'm looking for a calendaring application that runs as a daemon, engages with the system eg starting applications or interacting with the desktop environment ( KDE ,Gnome ,E17, Lxde etc. ). I would like it to be able to sync with common calendaring applications probably via iCal but not being well versed in calendaring I'm not certain.


title: Why access file is being ignored by Postfix?

text: I have installed Postfix, I can send mails between local users as expected, but I would try to limit the access of a particular user to the server. I edited the `/etc/postfix/access` file in this way:               diego@example.com REJECT      where example.com is `$mydomain`. I did also a `postmap access` to generate the validate file. Strangely, I can still send mail from the diego account using mutt. Here the maillog:               Jan 22 15:46:36 server postfix/pickup[6637]: 62117BF647: uid=500 from=<diego>     Jan 22 15:46:36 server postfix/cleanup[6737]: 62117BF647: message-id=<20140122144636.GA6732@server.example.com>     Jan 22 15:46:36 server postfix/qmgr[6638]: 62117BF647: from=<diego@example.com>, size=422, nrcpt=1 (queue active)     Jan 22 15:46:36 server postfix/local[6739]: 62117BF647: to=<localuser@server.example.com>, relay=local, delay=0.07, delays=0.06/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)     Jan 22 15:46:36 server postfix/qmgr[6638]: 62117BF647: removed


title: Why is apache2 showing up a defunct in the process list?

text: When I run `top` I see one line that doesn't look too good:                2475 www-data  20   0     0    0    0 Z    1  0.0   0:00.19 apache2 <defunct>       Why is this process `<defunct>` and what should I do about it? (sorry, I'm new to this)


title: Strategy to extract movies's name from this ununiform dataset?

text: I am working on a movie database problem to improve regular expressions, this is the problem I'm running into. My dataset looks like this: > Movie Name (variable space and tabs) year   >  **Movie1** (can have spaces or multiple spaces between them)(variable > spaces and tabs could be \t+ or multiple space or single space> **Year1**   >  **Movie2** (can have spaces or multiple spaces between them)(variable > spaces and tabs could be \t+ or multiple space or single space> **Year2**   >  **Movie3** (can have spaces or multiple spaces between them)(variable > spaces and tabs could be \t+ or multiple space or single space> **Year3**   >  **Movie4** (can have spaces or multiple spaces between them)(variable > spaces and tabs could be \t+ or multiple space or single space> **Year4**   > I want to extract names of all of the movies. These are the challenges I'm facing while doing it: > 1: The delimiter is variable. If it was colon or something unique, I would > have used an awk command to extract them like this awk -F 'separator' > '{print $1}'   >  In this case, it can be single space, two or more spaces or combination of > \t or spaces. > > 2: For those rows where delimiter is \t, I can use a \t to extract it, > because that does not come in movie names. But what if the delimiter is one > space or two spaces. They can very easily appear in the movie's name. In > those cases, I don't know what to do. I know the question is very rigid and specific. But as I described earlier, I'm very much blocked here. I can't think of any way around this problem. Is there any combination of grep/sed/awk with reg-ex that can be used to achieve the objective?


title: Configure Cent OS 6.4 so that desktop persists after closing VNC session?

text: I want to configure my newly bought VPS to be able to automatically boot into the Xfce window manager and let users connect to it via VNC and still keep the window manager running after the user closes the VNC session. How can I do this?


title: How to modprobe radeon and turn off card at start with systemd?

text: ArchLinux has completly replaced `rc.conf` with `systemd`. I used `/etc/rc.local` to modprobe `radeon` module and turn it off using vgaswitcheroo.               modprobe radeon && echo OFF > /sys/kernel/debug/vgaswitcheroo/switch      But, there is no `rc.conf` in ArchLinux anymore. How can I do it with `systemd` ?


title: How do I load modules at startup in a certain order?

text: I have a group of modules that I need to be loaded at startup. I've followed the documentation for loading a module however I need load these modules in a certain order. I've tried creating a bash script that uses a for loop and loads each module in the order I need.               mods=(mod1 mod2 mod3 ... modN)     for mod in $(mods); do         if [ ! -c /dev/input/$mod ] ; then             exec /sbin/modprobe $mod > /dev/null 2>&1         fi     done      I've also tried creating a bash script that loads each module individually without at looping.               if [ ! -c /dev/input/mod1] ; then             exec /sbin/modprobe mod1 > /dev/null 2>&1     fi          if [ ! -c /dev/input/mod2 ] ; then             exec /sbin/modprobe mod2 > /dev/null 2>&1     fi          ...          if [ ! -c /dev/input/modN ] ; then             exec /sbin/modprobe modN > /dev/null 2>&1     fi      In both cases, only the first module is loaded, and none of the others. Enabling more debugging out of the script (`#!/bin/sh -ex`) in both cases stops exactly at:               + exec /sbin/modprobe mod1      I'm assuming that the system see that the first modules is correctly loaded and then terminates (but I'm not for sure on this). How do I then load modules at startup in a specified order?


title: MySQL 3.23 on Centos 6?

text: Don't ask why, just is it possible to install old mysql 3.23 on new CentOS 6.4 i386 or x64 version (same to me)?


title: New Tmux Panes go to the same directory as the current pane; new tmux windows go to home directory?

text: Can anyone help me set up this configuration? If I create a new pane, the new pane should start out in the same working directory as the pane I was just in. If I create a new window, the new window should start out in the home directory (or any other global default path). Is this possible with tmux 1.8?


title: convert /dev/md0 to /dev/sda1

text: I used a Software-RAID I and want to access the data without RAID now. After               mdadm --fail /dev/md0 /dev/sda1     mdadm --remove /dev/md0 /dev/sda1      I tried               mount -t ext4 /dev/sda1 /mnt      but dmesg says               [ 5620.788838] EXT4-fs (sdb1): ext4_check_descriptors: Block bitmap for group 1 not in group (block 0)!     [ 5620.788841] EXT4-fs (sdb1): group descriptors corrupted!      Isn't it possible to convert a RAID-partition to non-RAID? Do I have to copy all files to another partition, delete the RAID partition and create a new file system?


title: Undo iptables modification

text: I ran the following `iptables` commands to create a blacklist rule but used the wrong port:               iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH     iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j SSH_WHITELIST     iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j ULOG --ulog-prefix SSH_brute_force     iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP      How can I undo the above and then redo it for a different port?


title: Canot remove symlinks: after reboot, symlinks re-appear

text: Using `ssh` from BusyBox, I cannot remove symlinks: after rebooting the device, symlinks re-appear. `ls -la` shows that symlinks have been removed, but after rebooting device they re-appear again. Those symlinks already existed beforehand, created at installing the firmware.               $ rm uw_cert.cer      I tried to remove _uw_cert.cer_ and _uw_key_prv.bin_ , but it reappears after reboot. The other files can be removed without problem.               <root@fwre:/nvram/1/security> ls -la     total 5     drwxr-xr-x    3 root     0                0 Jan  1 00:00 .     drwxr-xr-x    5 root     0                0 Jan  1 00:05 ..     -rwxrwxrwx    1 root     0              905 Jan  1 00:06 cm_cert.cer     drwxr-xr-x    2 root     0                0 Jan  1 00:00 download     lrwxrwxrwx    1 root     0               25 Jan  1 00:00 uw_cert.cer -> /nvram/fw/bpi/uw_cert.cer     lrwxrwxrwx    1 root     0               28 Jan  1 00:00 uw_key_prv.bin -> /nvram/fw/bpi/uw_key_prv.bin     -rwxrwxrwx    1 root     0             1052 Jan  1 00:06 mfg_cert.cer     -rwxrwxrwx    1 root     0              140 Jan  1 00:02 mfg_key_pub.bin     lrwxrwxrwx    1 root     0               37 Jan  1 00:00 root_pub_key.bin -> /etc/docsis/security/root_pub_key.bin      `mount` output:               <root@fware:/var/tmp> mount     rootfs on / type rootfs (rw)     /dev/root on / type squashfs (ro)     proc on /proc type proc (rw)     ramfs on /var type ramfs (rw)     sysfs on /sys type sysfs (rw)     tmpfs on /dev type tmpfs (rw)     devpts on /dev/pts type devpts (rw)     /dev/mtdblock4 on /nvram type jffs2 (rw)      **EDIT** :               df /nvram/1/security     Filesystem           1K-blocks      Used Available Use% Mounted on     /dev/mtdblock4             320       256        64  80% /nvram          cat /proc/mounts     rootfs / rootfs rw 0 0     /dev/root / squashfs ro 0 0     proc /proc proc rw 0 0     ramfs /var ramfs rw 0 0     sysfs /sys sysfs rw 0 0     tmpfs /dev tmpfs rw 0 0     devpts /dev/pts devpts rw 0 0     /dev/mtdblock4 /nvram jffs2 rw 0 0


title: Vim shared copy register

text: When working with Vim I often work from multiple monitors and multiple split terminals so I have multiple instances of VIM running at all time. Is there a way to have a persistent shared register that allows me to share the copy paste buffer(Buffer maybe the wrong term here) Is there a setting in VIM or a plugin that would allow me to do this.   And example of the work flow I want is to open VIM and yank text close vim Go to another terminal open VIM and paste that yoinked text.


title: New files and folders created, automatically inherit same permissions as parent folder

text: Does it exist? I create a folder with, let's say, all permissions set, and some services (i.e. Apache web server) create subfolders and put files there (uploaded media files from website users). Such subfolders have permissions set so that only www-data (Apache user) can write to them. My problem arises because I have a script which has to be able to create subfolders and files, the same way as Apache does. But **when it tries to write a new file to an existing folder** created by Apache, **it can't because of the permissions**. Is there any way in Linux (Ubuntu distro) to set so that a newly created subfolder inherits same permissions as parent folder? I have been reading a while about guid, sticky bits and so, but I am not very savvy in sysadmin, and, in the middle of a rush of work, this whole thing overwhelmes me... I am using python and mod-wsgi, if this information is useful in any way. Thanks!


title: Tell pkg-config to look *.pc files also in /usr/local/lib/pkgconfig, system-wide

text: Right now `pkg-config` looks only in `/usr/lib/pkgconfig`. I can adjust it for a user by exporting the `PKG_CONFIG_PATH` environment variable, but once again I forgot to do it for root and wasted time wondering, why my plugin is not installed properly (the makefile used `pkg-config`). So how can set it system wide, so it would always look in to both `/usr/lib` and `/usr/local/lib`?


title: How to get a click-able link for a shared file, when sending an e-mail with the file-name in it

text: I've got a local network with a shared drive mounted to it, all machines running Fedora (and some Windows). When we want to share a file, there is no easy way of just getting a link for the file like in windows, but rather I need to get the directory first, and then append the filename at the end i.e smb://server/share/files/Documentation.odt That in itself is cumbersome, but the problem occurs when a filename has spaces in it, then the link that is sent by e-mail is rendered totally useless and looks something like this: smb://server/share/files/Set Up Documentation.odt Is there anything that I could do in order to have a simple maybe right-click solution which gives me the link of the file to send in an e-mail (preferably a non-terminal solution).


title: Automating a disk move & extension?

text: I have an ancient 128GB SSD, with two non-LVM ext4 partitions, I would like to copy these to a 256GB SSD and roughly doubling the partitions while doing so. Problem is, I don't want to sit at the laptop twiddling my thumbs for who knows how long. I really would like to put in a USB stick and go to sleep :). Is there something I could configure / script doing this?


title: What do I need to add a virtual IPsec adapter?

text: I'm trying to set up an IPsec connection manually from the console with iproute2. What I need is a virtual interface (at best, a virtual IP address could also be sufficient) that IPsec-transforms everthing ingressing (ESP/TUNNEL MODE) and hands it over to eth0 (on my system called em1). On the other set a peer takes the packet from its own eth deciphers it and hands it over to a virtual interface a the other side. So I want do establish a "normal" IPsec tunnel. I've got no problem with the policy and SA, and configuring that was easy using the normal ethernet addresses of the systems in transport mode, i.e.               ip xfrm policy add src 198.51.100.1 dst 198.51.100.2 dir out tmpl proto esp     ip xfrm state  add src 198.51.100.1 dst 198.51.100.2 spi 24501 proto esp enc des 0xAABBCCDDEEFF0011     ip xfrm state  add src 198.51.100.2 dst 198.51.100.1 spi 24501 proto esp enc des 0xAABBCCDDEEFF0022      and an adversary configuration on the peer works quite well. Now I tried to set up a virtual IP and a route to the other system with               ip address add 10.0.0.0 dev em1     ip route add to 10.0.0.2 via 10.0.0.1      and again vice versa on the other side. This again works well. Then I altered the IPsec policy and SA to               ip xfrm policy add src 10.0.0.1 dst 10.0.0.2 dir out tmpl src 198.51.100.1 dst 198.51.100.2 proto esp mode tunnel     ip xfrm state  add src 10.0.0.1 dst 10.0.0.2 spi 24501 proto esp enc des 0xAABBCCDDEEFF0011     ip xfrm state  add src 10.0.0.2 dst 10.0.0.1 spi 24501 proto esp enc des 0xAABBCCDDEEFF0022      When I now try to `tcping` the peer I get no answer and `setkey -PD` tells me, that the security policy was never triggered. Now I'm trying to fabricate a working virtual interface to handle the IPsec tunnel, but I don't know how to bind it to the physical interface and how I get the kernel to apply the security policy. It is vital for me that I can solve this with iproute2, as I ultimately want to do this out of a C++ program and I have already the appropriate classes that drop Netlink commands the same style the `ip` command does (what I can do with `ip`, I also can do within my code). In fact, the first part already works out of my program and I want to use the same Netlink API functions for the rest. _Update_ I figured out that the state needed to be set up with the tunnel addresses so the working SAs are               ip xfrm state  add src 10.0.0.1 dst 10.0.0.2 spi 24501 proto esp enc des 0xAABBCCDDEEFF0011     ip xfrm state  add src 10.0.0.2 dst 10.0.0.1 spi 24501 proto esp enc des 0xAABBCCDDEEFF0022      while the policy remains the same. Now the policy is triggered and I see a transformed packet on a sniffing port. Also iptables on the other machine blocked the packet and I disabled it for testing. So, the one direction seems to work now, but I still get no answer. I also don't know if the problem is _yet_ somehow the transform, the routing or the interface part. My prefered solution would still be one including a virtual interface, but I don't have any idea how to bind it to a physical one, let alone if the transform would work that way.


title: continuous testing of a C++ project on github with different Linux distros

text: Is there any framework to automatically try to compile a C++ project on github.com on every commit made, similar to what http://jenkins-ci.org or http://travis-ci.org do for different compilers on an Ubuntu VM, but for different Linux distros and versions?   EDIT: Ideally this would be a service where one doesn't need to maintain the different distros as VMs, but does that on the cloud, like travis-ci does for Ubuntu VMs.


title: Does TMUX have unit tests or a test suite?

text: I am going through my configuration shell scripts and I have found the `make` commands to run test suites for pretty much every "big" open source project that I use (`vim`, `zsh`...) except for tmux. I can't find anything documented that says I can run `make test` or something of the sort to ensure everything is in order before I `sudo make install`. Does anybody know?


title: Missing iptables file on directory /etc/init.d/ (Fedora 17)

text: Is the iptables file in Fedora 17 moved from `/etc/init.d/` to `/etc/sysconfig/`? I need do some patching to the iptables file to solve the firewall problem (Setting chains to policy ACCEPT: security raw nat mangle filter [FAILED]).


title: Automount external storage as user readable and writable in Debian XFCE?

text: I have Debian Wheezy installed with the latest XFCE desktop environment. In the XFCE settings, I specified that external media be automounted upon insertion. However, when I plug in my USB stick, it appears on my desktop, but is not mounted because there is no permission. In fact I have to use sudo to mount, access, read, and write from the USB drive. I don't want to use the fstab method because you need an entry for each unique device and it is simply very inefficient. How can I setup my system so that whenever I plug in an external storage device, it will automount and be fully user accessible? It seems a little silly that this functionality does not come "out of the box" and "just work" (or at least easily enabled) in the 21st century... :) Thanks for your help!


title: What is a good strategy to generate and copy files atomically

text: I have a file `myfile` that must be re-generated periodically. Re-generation takes some seconds. On the other hand, I have to periodically read the last (or next to last) file generated. What is the best way to guarantee that I am reading a completely generated file and that, once I begin reading it, I will be able to read it completely? One possible solution is   1. `myfile` is actually a soft link to the last generated file, say `myfile.last`.   2. regeneration is done on a new file, say `myfile.new`   3. after regeneration, `myfile.new` is moved onto `myfile.last` The problem I see (and I don't know the answer to) is: if another script is copying `myfile` while the mv takes place, does `cp` finish correctly? Another possible solution would be to generate files with a timestamp on its name, say `myfile-2014-09-03_12:34` and `myfile` is again a soft link to the last created file. This link should be changed after creation to point to the new file. Again: what are the odds that something like `cp myfile anotherfile` copies a corrupted file?


title: Peculiar lack of RHEL 5.8 service management documentation

text: I am needing to see the status of some services on some of our RHEL 5.8 hosts on which I am not an admin. Much to my surprise, I am not able to get any info how to do it (such as `chkconfig` or `systemctl` on Fedora) from Google. Neither `chkconfig` nor `systemctl` are accessible to me, not sure if it is because of permissions or they are just not available on the system but there are no man pages for either. Why is it that there is such a mysterious lack of service management documentation online for RHEL 5.8 and which commands can I use for simple service listings?


title: what is the best study guide for the LPIC2 exam

text: Can anyone recommend a good study guide/book for the LPIC2 exam besides the Sybex/Roderick Smith book?


title: From Windows 7 + Ubuntu to Crunchbang (First) + Windows 8 (second?)

text: I'm dual booting a Windows 7 + Ubuntu machine. I went ahead and replaced Ubuntu with Crunchbang, and now want to replace (not in place upgrade) Windows 7 with Windows 8. However, I've always done a dual boot with Windows first. I know that if I now try to install Win8 it will override the boot record. How can I make it so that I can install Win8 without loosing my already customized Crunchbang install?


title: File size conflict

text: I am new to UNIX and have a doubt about file size in UNIX (AIX). `ls -ltr` shows me `fileA` size as 59096. As per my knowledge this is in bytes ,so it is nearly = 0.06 MB However, a script which should `zip` files greater than 1MB, also zips this file:               find [dir] -type f -size +1M -exec gzip {} \;      Based on my testing it evaluates the same `fileA` size to be 115 MB and hence compresses the file. Can some one please help. My aim is to zip all files above 1 MB.


title: What is the status of HiDPI support in Xfce?

text: I'm looking for a new work laptop for development work on linux, and after testing way too many distros, I pretty much does not want to ever use anything other than Xubuntu or possibly some other Debian/Ubuntu based Xfce setup. What worries me is that most of the recent laptops with Haswell processors I have looked at also supports extremely high resolution, which would require the desktop to use higher DPI settings (HiDPI) in order to be usable. Thus I was wondering, what is the status for HiDPI support in Xfce? (I have found some sources claiming the support is not good at the moment, but I didn't find any info on whether it is being worked on or not!)


title: Copy files and directory tree for filesize in specified range

text: Hi I would like to make a small script copying files from different directories example `/pp/01` `/pp/02/` etc... to another destination with the same directory design. But only those files within the directory with a size larger than 88MB but smaller than 93MB... I would use a for loop and the find function. Are there more efficient ways? And how can I implement the find function exactly. Could somebody help me with it? I am new to Unix.


title: Find out which command is running within a screen session

text: I often leave tasks running within screen so that I can check on them later, but I sometimes need to check which command is running within the screen. It's usually a php script of sorts, such as               screen -d -m nice -n -10 php -f convertThread.php start=10000      I don't record which screens are running which command, but I'd like to be able to get a feel for the progress made by checking what command was run within it, without killing the process. I don't see any option for this within the screen help pages.


title: how to stretch mplayer to both monitors (fullscreen) in a xinerama setup

text: I am using the window manager Xmonad and have two monitors in a Xinerama setup. I want to display videos with mplayer fullscreen across the two monitors. But, by default, I want mplayer to be a tiled window. Until now I have done this manually:   * by pressing the ModMask key and the right mouse button on the lower right corner of the mplayer window to resize it   * and then by pressing the ModMask key and the left mouse button in the middle of the mplayer window, moving it to fit into the two screens. How can I achive this semiautomatically?


title: Removing Gnome GUI and Booting From CLI

text: I'm running an ARM version of Ubuntu provided by Linaro. I'm not 100% sure on current version as I'm re-installing using the manufacturing tools (I want to say its Linaro 11.10). However, I was wondering if anyone could help me with an issue? I did a `sudo apt-get remove gnome*`, to get rid of all the GNOME packages since I do not want a GUI. I restarted the system and I did not get a CLI. The screen was just black. Is there a way to get to CLI or where/how would I change the files to boot to CLI?


Here is the following info: > Do I need more swap? > > No, disk caching only borrows the ram that applications don't currently > want. It will not use swap. If applications want more memory, they just take > it back from the disk cache. They will not start swapping. But I conducted an experiment that show something different. Just take a look:               # free -m                  total       used       free     shared    buffers     cached     Mem:          1001        941         59          0          2        127     -/+ buffers/cache:        811        189     Swap:         2347        693       1654      There's 811MiB in RAM and 693MiB in SWAP. Now is the time to close some apps, and I got something like this:               root:~# free -m                  total       used       free     shared    buffers     cached     Mem:          1001        531        469          0          4        126     -/+ buffers/cache:        400        600     Swap:         2347        361       1986      So, now it's 400MiB in RAM, and 361 in SWAP. If I run `swapoff`, there should be 400+361=761 MiB in RAM, but that's not going to happen:               root:~# swapoff -a     root:~# free -m                  total       used       free     shared    buffers     cached     Mem:          1001        860        140          0          6        251     -/+ buffers/cache:        602        398     Swap:            0          0          0      There's only 602MiB in RAM, and the question is where the hell is the other 159MiB ? I thought it's because of the ZRAM feature. The following are statistics of SWAP devices before running `swapoff`:               root:~# swapon -s     Filename                                Type            Size    Used    Priority     /dev/mapper/debian_crypt-swap           partition       2097148 99620   10     /dev/zram0                              partition       153596  135072  70     /dev/zram1                              partition       153596  135092  70      But I also checked the normal SWAP partition, and the effect was more or less the same, just the amount of cached data was smaller (60MiB). Is there a way to prevent SWAP from collecting cached data?


title: How do I get the creation date of a file on an NTFS logical volume?

text: I created an NTFS logical volume on my Linux system for Windows file storage because I want to retain the creation date of my files (I would probably zip them into an archive and then unzip them, though I have no idea if that would work). Does NTFS-3G save the creation date of files on Linux? If so, how do I access it? Reading this thread, the OP links documentation on NTFS that provides a shell script for finding the creation date. I modified it in an attempt to get the seconds from the hex value, but I believe that I am doing something wrong:               #!/bin/sh     CRTIME=`getfattr -h -e hex -n system.ntfs_times $1 | \         grep '=' | sed -e 's/^.*=\(0x................\).*$/\1/'`     SECONDS=$(($CRTIME / 10000000))     echo `date --date=$SECONDS`


title: tftp transfer painfully slow

text: I am using `HPA's tftp server` for `PXE` boot. When I try downloading an image from my tftp server using `curl`, the transfer rate is less than `3 MB/s`, even on my 1Gb network.               curl -o initrd.gz tftp://192.168.0.4:69/boot/debian/initrd.gz      Is this an inherent limitation of the `tftp` protocol, or can this be configured?


title: limitation on count of records returned by ls -lrt

text: Is there any limitation on count of records returned by `ls -lrt`? I am seeing problem of crash in OEL 4.7 environment where my `ls -lrt` command may return more than 100K records.


title: How can I add a signature .png to a PDF in Linux?

text: I have a scanned copy of my written signature and I need to apply it to some documents in the signature block. I used to do this on Windows all the time but I now have only Linux. Is this possible? How can I add a signature image to a PDF file in Linux (Gnome 3)?


title: Is a page with "PROT_NONE bit set" eligible for swapping?

text: From the following link: Page Table Management - kernel.org, I understood that the bits `PROT_NONE` and `PRESENT` can be used to let the OS know that a page is protected but is resident in memory. I am using these 2 bits to track the pages that are accessed by a process. Here is what I am doing,   1. I clear the `PRESENT` bit and set the `PROT_NONE` bit of pages of a process I want to track so that a page fault occurs when that process tries to access the tracked pages.   2. On page fault, inside __handle_mm_fault before calling handle_pte_fault (x86), I clear `PROT_NONE` and set `PRESENT` if the page is tracked by me. This way, the execution proceeds normally. But there will be an issue if the page is swapped out meanwhile by the OS. So, I would like to know:   1. If a page with `PROT_NONE` bit set can be swapped out?   2. What happens to the bits `PROT_NONE`, when such a protected page is swapped out? I mean how to distinguish if the page is swapped out or not? Because `PRESENT` bit is cleared already. Please point out in case any of my understanding is wrong.


title: Simple Script to setenv tcsh or export bash

text: I am having problems with simple scripting, my Box is CentOS so bash is the default shell, now I wanted to send a line via setenv (tcsh) and would like to make a script that will ask me to input a string to setenv every time I login. By the way I am using teraterm logging in.


title: Segmentation fault in libGL.so.1

text: A while back I posted a question about running a 32 bit app in Debian Wheezy 64 bit Thanks to @JosephR I was able to run it without the nasty `could not find libGL.so.1` error. Now, however, the app crashes out in the middle of the execution. In the terminal appeared this message after the crashdown:               Aug  2 10:04:16 acs-laptop kernel: [  213.472753] aquaria[7006]: segfault at 8 ip 00000000f41238fb sp 00000000ffceabc0 error 4 in libGL.so.1.2[f4107000+54000]      Reinstalling the driver did not solved the problem and I'm not sure what it's causing it. Is there a bug in running the 32 bit version of `libGL.so` in a 64 bit system?


title: Renaming multiple files with rename

text: I need help renaming files in batch--the other questions I browsed don't exactly address my problem. The names of my files are generated non- deterministically, so I can't predict what they will be named. I do know that they will start with `NORMAL` and end with `-lib*`. I'd like to replace everything in between with some string `X`. For example,               |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib1.concordant     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib1.deletion     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib1.divergent     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib1.inversion     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib1.translocation     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib4.concordant     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib4.deletion     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib4.divergent     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib4.insertion     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib4.inversion     |   |   |-- NORMAL_H_LS-A7-A0CE-10A-01D-A017-09-lib4.translocation      So it will probably be of the form `rename "s/something/X/"`, but I don't know what that something should be, as I don't know how to use regex.


title: What is a simple way to schedule a single event to happen at some time in the future?

text: There are often times that I want my computer to do a single task, but not right now. For example, I could have it notify me in 30 minutes that it is time to leave work. Or maybe I want it to run a complicated test 2 hours from now when I'm sure most everyone else will be gone from the office. I know I could create a cron job to run at a specific time of day, but that seems like a lot of work when all I want is something simple like "Run this script in 10 minutes", besides I'd have to figure out what time it will actually be X minutes/hours/days from now, and then delete the cron job once it finished. Of course I could just write this script and run it in the background:               sleep X     do_task      But that just seems so clunky: I either need a new script for each task, or I need to write and maintain a script generic enough to do what I want, not to mention I have to figure out how many seconds are in the minutes, hours, or days I want. Is there not an already established solution to this problem?


title: How do I delete the first n lines of an ascii file using shell commands?

text: I have multiple files that contain ascii text information in the first 5-10 lines, followed by well-tabulated matrix information. In a shell script, I want to remove these first few lines of text so that I can use the pure matrix information in another program. How can I use bash shell commands to do this? If it's any help, I'm using RedHat and an Ubuntu linux systems.


title: How can I first download KDE files and then install them offline on Ubuntu?

text: How can I first download **KDE** files and then install them offline on Ubuntu?


title: How to prevent certain memory location to be accessed

text: I have 2 corrupted RAM module, on offset: 46xx MB and 13xxx MB (from `memtest` on boot) How to prevent Linux to access/alloc/read/write into those offset? Here's the result of `memtester` on ~1000 MB to ~1400 MB: http://pastie.org/9433211


title: mutt: automatically show new mesages

text: When I have mutt opened, I don't see new emails until I press a key, for example arrow down. Then new emails appear. Is there a way for mutt do recognize that new email has arrived, and display the email automatically, without me having to press a key every few minutes? I am using maildir format (locally stored emails). What would be the best way? Should mutt check every n seconds, or should it be notified by the OS, perhaps using inotify ?


title: GNU/Linux: "device mapper: create ioctl failed" "device or resource busy"

text: I can't mount my encrypted devices anymore. The error is:               device mapper: create ioctl failed      device or resource busy      This error arises both with two different programs to access TrueCrypt encrypted devices: TrueCrypt and Tc-play. In this case, the recommendation is to remove /dev/mapper/truecrypt* directories, or look for processes that are blocking the device. However, there is no /dev/mapper/truecrypt* directory, and "lsof" returns nothing. One TrueCrypt device takes a whole HDD. According to "fdisk", this partition is formatted with HPFS/NTFS. Another TrueCrypt device is on a partition on /dev/sda. According to "fdisk", this partition is "Linux" (ext3 or ext4, if I remember correctly). What could be causing the error? Thank you. Software:   * Debian GNU/Linux 6


title: Tracing the workings of a function in Emacs

text: I am learning emacs lisp. One of the things I was playing with was setting variables. So I go and set fill-column to 50 (setq fill-column 60). After this evaluating fill-column does give me 60, but the function fill-paragraph ignores this. How would I go about figuring out why this happens? Thanks. Best, Bart


title: Does verifying packages enhance security and/or stability of a system?

text: RedHat/CentOS and Ubuntu both provide packages to verify the contents of a package. CentOS uses rpm -V. Ubuntu uses debsums. I've spoken to admins who run these tools to verify the packages on their systems. Do these tools enhance the security of a system, or do they provide a false sense of security? Likewise, do these tools increase the stability of a system, since they can help detect problems after filesystem corruption?


title: /proc/meminfo MemTotal =?

text: **What elements of`/proc/meminfo` sum up to `MemTotal`?** Example of `tee /tmp/proc/meminfo < /proc/meminfo`               MemTotal:        1279296 kB     MemFree:          164092 kB     Buffers:           62392 kB     Cached:           378116 kB     SwapCached:            0 kB     Active:           715176 kB     Inactive:         307800 kB     Active(anon):     583268 kB     Inactive(anon):     3384 kB     Active(file):     131908 kB     Inactive(file):   304416 kB     Unevictable:           0 kB     Mlocked:               0 kB     SwapTotal:             0 kB     SwapFree:              0 kB     Dirty:                44 kB     Writeback:             0 kB     AnonPages:        582480 kB     Mapped:           112904 kB     Shmem:              4192 kB     Slab:              47524 kB     SReclaimable:      33588 kB     SUnreclaim:        13936 kB     KernelStack:        1568 kB     PageTables:        12092 kB     NFS_Unstable:          0 kB     Bounce:                0 kB     WritebackTmp:          0 kB     CommitLimit:      639648 kB     Committed_AS:    1298132 kB     VmallocTotal:   34359738367 kB     VmallocUsed:       24012 kB     VmallocChunk:   34359696868 kB     HardwareCorrupted:     0 kB     AnonHugePages:     77824 kB     HugePages_Total:       0     HugePages_Free:        0     HugePages_Rsvd:        0     HugePages_Surp:        0     Hugepagesize:       2048 kB     DirectMap4k:        8832 kB     DirectMap2M:     1300480 kB      Here are snippets that helps me in checking different configurations:               # Let's load them into CLI variables     all=$(sed 's!:[^0-9]\+!=!;s! kB!!;s![()]!_!g' /tmp/proc/meminfo) ; eval $all     # Let's make overview sorted by values (helps in tracking missing one)     echo $all | sed 's! !\n!g' | sort -n -k 2 -t '='      # Let's try Memtotal=MemFree+Active+Cached+Buffers ? (should be zero)     echo $[ $MemTotal - $MemFree - $Active - $Cached - $Buffers ]     # But gives -40480      What am I missing? Which elements of `/proc/meminfo` should I sum to get `MemTotal`?


title: Why Debian CD has 52 CD

text: > **Possible Duplicate:**   >  31 Debian CDs -- Why? and which do I need for a vanilla desktop install? I am about to install Debian. But Debian has 52 CD Images \- how can Debian be so large? 52 CDs will equate to almost 36 GB! Am I mistaking something or what?


title: How to grep standard error stream (stderr)?

text: I am using ffmpeg to get the meta info of an audio clip. But I am unable to grep it.                   $ ffmpeg -i 01-Daemon.mp3  |grep -i Duration         FFmpeg version SVN-r15261, Copyright (c) 2000-2008 Fabrice Bellard, et al.           configuration: --prefix=/usr --bindir=/usr/bin            --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib           --mandir=/usr/share/man --arch=i386 --extra-cflags=-O2            ...      I checked, this ffmpeg output is directed to stderr.               $ ffmpeg -i 01-Daemon.mp3 2> /dev/null      So I think that grep is unable to read error stream to catch matching lines. How can we enable grep to read error stream? Using nixCraft link, I redirected standard error stream to standard output stream, then grep worked.               $ ffmpeg -i 01-Daemon.mp3 2>&1 | grep -i Duration       Duration: 01:15:12.33, start: 0.000000, bitrate: 64 kb/s      But what if we do not want to redirect stderr to stdout?


title: how to stop adding unused module to loadable kernel module?

text: Is there any way how to stop unused module to loadable kernel module other than putting them in the mod probe blacklist.


title: CD Ripping Without Temporary Files

text: I would like to be able to rip a CD through the command line (using **cdparanoia** and **lame** , preferably) _without having to use temporary files_. I'm thinking that this would save some time with the encoding process, but if this isn't the case, please let me know. So far, I've tried `cdparanoia 1 - | lame -f --silent - track.mp3`, and it worked well on that first track. However, I can't figure out how I can pipe all of the tracks from the CD in this way without doing some slightly messy parsing of the CD track table. Is this kind of thing feasable in a one-liner, or will I have to grab the number of tracks and iterate? EDIT: I'd appreciate input on whether or not ripping the full CD in this way and splitting tracks post-encoding would be any better or more feasable.


title: Auto completion for inaccessible directories

text: I'm trying to get a auto completion for folders that I don't have permission to view / enter, my first thought was to use `compgen` and `sudo` to do the completion manually, but looks like `compgen` is a shell builtin, so launching it with sudo may not work. Also, if I wrote customized completion function for folders, how can I overwrite for every command? I don't want to do `complete` command for everything. Or is there any alternative ways? **EDIT** This is useful in a environment where you grant user sudo permission (to run arbitrary commands), but don't want them to login / su as root, so when they need to navigate to some folders accessible only by root, they can quickly view the contents without run commands like `sudo ls XX`


title: Don't execute a command with sudo, unless it's configured as password-free

text: I'm not sure if `sudo` supports so, I want to execute a command, only if this command is configured as NOPASSWD, that is, if the command can be run without password, run it; Otherwise quit directly. So far the only option seems to be listing all available commands with `sudo -l` and parse the output manually, that looked dirty. Are there any alternatives?


title: Find executable files recursively

text: I have got the directory called `Test` and a few directories inside it. Both `Test` and the directories inside it have executable files. I'd like to print them with `ls`. I'd use this command.               ls -l `find Test/ -perm /u=x,g=x,o=x -type f`      Is this a good/right/quick command or not? **My solution is:**               find Test/ -executable -type f -exec ls -l {} \;      and got the same result as _warl0ck_ and _pradeepchhetri_ offered.


title: Cannot reach outside network or IP after upgrading to Ubuntu 12.04

text: I am running Ubuntu 12.04 on my server but since the upgrade from 10.04 I can no longer reach any outside sources of the server. I can SSH into the box, but from inside here I can not reach anything. At least, I can't ping, dig etc. I have provided everything that I could think that might give me more information, but can't see anything obviously wrong here. **resolveip**                root@sub:~# resolveip google.com      resolveip: Unable to find hostid for 'google.com': try again      **Ping**                root@sub:~# ping google.com      ping: unknown host google.com      **route -n**                root@sub:~# route -n      Kernel IP routing table      Destination     Gateway         Genmask         Flags Metric Ref    Use Iface      0.0.0.0         77.68.108.1     0.0.0.0         UG    100    0        0 eth0      77.68.108.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0      **iptables -L**                root@sub:~# iptables -L      Chain INPUT (policy ACCEPT)      target     prot opt source               destination           Chain FORWARD (policy ACCEPT)      target     prot opt source               destination           Chain OUTPUT (policy ACCEPT)      target     prot opt source               destination      Any ideas what has changed since the upgrade?


title: Confused about inverse grep

text: So, when you use inverse in grep (`egrep -v`), this literally means the output is shown upside down (flipped over)? I think I was more confused when I saw the following examples               $ egrep -v '\ ' blah.sh     $ egrep -v '(\ )|^$' blah.sh      I'm confused about what '\ ' does, and what happens if you put -v. Also what is the difference between '\ ' and '(\ )' command if we are excluding |^$ command?


title: Looking for information on the FISH protocol

text: What I have found about `fish://` (the kio protocol) is old and often incomplete. Is there anything that's new? Like a primer? Or is this something to put on the KDE todo list?


title: How to transform two delimited ASCII files

text: These are 2 common delimited, text file transformation problems I'd like to find scripts to do (I dont know if `awk` or `perl` is best for these tasks). `csh` is the default shell on my Solaris10 unix server, so solutions that work for either the `csh` or `sh` shells would be preferred. **PROBLEM 1:** I have the following 2 delimited ASCII files: `File1.dat` and `File2.dat` File1.dat (map file):               1|A       2|B       3|C       4|D       5|E       6|F       .       .       .       26|Z       27|Who       28|What       29|Where File2.dat               Field1|Field2|Field3       1|John|20120101       3|Amy|20120103       6|Larry|20120104       3|Kevin|20120203       8|Fred|20120623       4|Mary|20120728       26|Eric|20120819       28|Larry|20120917 I want to use the map that is represented in `File1.dat` to transform `File2.dat` into a 3rd file `File3.dat` that looks like the following. Essentially I am using the map in File1.dat to create/populate a new column into my file so that at the end, the new transformed file has 4 columns, as follows: File3.dat               Field1|Field2|Field3|Field4       1|A|John|20120101       3|C|Amy|20120103       6|F|Larry|20120104       3|C|Kevin|20120203       8|H|Fred|20120623       4|D|Mary|20120728       26|Z|Eric|20120819       28|What|Larry|20120917 **PROBLEM 2:** I want to keep only the 1st record (in a series of sorted records) of a family of records that share the following commonality [Field 2, Field3, Field4 have the same value across records] I have the following initial delimited file File1.dat (15 records each with 4 Fields). To the left is not part of the file its just a Record# so we can keep track of what is happening. File1.dat                   Field1|Field2|Field3|Field4     1.    20120227|Andy|101|34       2.    20120315|Andy|101|34       3.    20120415|Andy|101|36       4.    20120417|Andy|103|37       5.    20120417|Andy|103|37       6.    20120227|Jane|101|34       7.    20120315|Jane|101|34       8.    20120415|Jane|101|36       9.    20120417|Jane|103|37       10.   20120417|Jane|103|37       11.   20120227|Bob|101|34       12.   20120315|Bob|101|34       13.   20120415|Bob|101|36       14.   20120417|Bob|103|37       15.   20120417|Bob|103|37 I want to convert this 15 record file (`File1.dat`) into a newfile (`File2.dat`) that looks like the following (keeps only these 9 records). As you can see it takes out the duplicate records in `File1.dat`, where the definition of a duplicate record equals [ Field2 & Field3 & Field4 have equal values across any 2 or more records ]. File2.dat               1.   20120227|Andy|101|34     3.   20120415|Andy|101|36     4.   20120417|Andy|103|37     6.   20120227|Jane|101|34     8.   20120415|Jane|101|36     9.   20120417|Jane|103|37     11.  20120227|Bob|101|34     13.  20120415|Bob|101|36     14.  20120417|Bob|103|37 **Conclusion:** Please let me know where in a solution code it addresses the following 2 things: a) The fact the the delimiter in my files is a pipe `|` character   b) What part of the code refers to Field1, Field2, Field3, Field4, etc


title: Confused about word boundary

text: I have been researching this a lot, but I am still not clear on it. What does _word boundary_ mean? What does it do? So, for example, could someone explain this command to me please?               egrep '\b[A-Z]+\b' filename.sh


title: Running vim on a remote Linux machine "freezes" OS X SSH connection

text: ( _cross-posted thisfrom SuperUser as the question seems more relevant to this audience)_ I am attempting to SSH to a Linux (Fedora 14) machine and then open up vim to edit a file, however on my new Macbook Pro, the SSH session seems to "freeze" as soon as I open vim. I can login fine to the Linux machine and run commands: ![screenshot 1](http://i.stack.imgur.com/LBPkb.png) However as soon as I run vim, the terminal blanks out, and does not respond to `:q`, `ctrl+z`, `ctrl+c`, `ctrl+d`, etc: ![enter image description here](http://i.stack.imgur.com/G2F5B.png) I'm using iTerm2, but the same problem occurs in Terminal.app. Also, attempting to transfer files with `scp` exhibits the same behavior, so it seems related to any type of ssh-connection to this machine. Could this have something to do with tty vs pty, or some other terminal emulation setting in OS X? I do not have the same display problem when opening vim on the remote linux machine using Windows or other OS's. Also, I can use vim fine when connected to other remote (Linux) machines.


title: How can I include an image in a Mailman footer?

text: I'd like the footer of a Mailman list to include an image. Is this possible? If yes, how? I tried the obvious path of just typing `<img...>`, but that didn't work.


title: Why do we need an expiration period?

text: Why is there a gap between the **expiration** of an account and its complete **deactivation** , when one can no longer log in or change his password when it became expired?


title: Kompare-like tool that needs no kdelibs dependencies?

text: Are there any Kompare-like tools without KDE dependencies? Can be Qt or GTK based. ![screenshot of Kompare](http://i.stack.imgur.com/4xrM4.png)


title: How to set dhclient options for Networkmanager

text: I'm trying to modify the domain search order that is obtained via DHCP _a la_ `dhclient.conf`:               append domain-search "example.com";      I'm using Fedora 17 (beta) and it uses `NetworkManager`. It builds a file `/var/run/nm-dhclient-INTERFACE.conf` which it then calls as the config file for `dhclient`. My question is, how do I get `NetworkManager` to insert my line into that file?


title: How can I expose JAVA_HOME to applications running under X and/or Gnome?

text: I'm trying to run IntelliJ from Gnome3's Applications menu, but it complains the `JAVA_HOME` variable is not set. I have the Java installation under my home folder. I managed to export the variable in my `~/.bashrc`:               export JAVA_HOME=~/jdk1.6.0_32      and I successfully ran IntelliJ from the command line. I thought it's normal that configuration is ignored as Gnome should not assume we are using bash, isn't it? I hoped that `.profile` to be the correct place to use, but it does not seem to have any effect.


title: Removing generic kernel updates from aptitude post custom kernel install

text: I've updated my Mint 12 system to be running a kernel built from Linus' git repo. Now, whenever I run `apt-get upgrade`, I see that `linux*-generic` are still on the update list (they're being "kept back", but they're still present). How do I remove these from the list of packages for APT to track?


title: Determining longest time taken in boot process

text: I'd like to find out what takes the most time in my boot process from GRUB to the Ubuntu login screen. How can I profile my boot process to find out what's taking so long?


title: What can make passing init=/path/to/program to the kernel not start program as init?

text: I'm trying to debug an init script on a Linux system; I'm trying to pass `init=/bin/sh` to the kernel to make it start `sh` without starting `init` so I can run through the init sequence manually. What I've found is that the kernel is starting `init` anyway. During bootup, one of the printk messages is the command line, and that is showing that the line is being set properly; in addition, I can affect other things using the kernel command line. I have checked to make sure the path exists; it does. This is a busybox system, and init is a symlink to busybox; so to make sure busybox doesn't do strange magic when its PID is 1, I also tried running a non-busybox program as init; that didn't work, either. It seems that no matter what I do, init is run. What could be causing this behavior?


title: Firefox or Chromium command-line arguments to set fullscreen and control start page

text: On http://susestudio.com/, there's an option to enter custom command line scripts. How do I write one that changes the default homepage and sets the browser full screen?


title: wget recursive with files without extension

text: I'm not very good with Linux so I have maybe a basic question. I've search around for the _"how to"_ and I couldn't find anything. I'm trying to get a site with `wget`. The problem is that it:   1. Have user friendly name for the pages              http://domain/wiki/Section/Home,      http://domain/wiki/Section/Not+Home     http://domain/wiki/Section/Other+page        2. For some pages it uses query strings:               http://domain/wiki/Section/Home?one=value&other=value        3. and for some reason maybe backup some files have an extension of _`.1`_ (number from 1 - n) for example `styles.css.1`, `javascrip.js.2` I want to do a recursive download and store it in one folder but avoid the files with queries; `Home?query` – in this case `Home`. For this I've tried `--reject` with a pattern but i cant make it work. I can avoid extension `.1,.2,... .n` if I add a long list of numbers, but there is hopefully a better way. This is the `wget`:               wget \     --page-requisites \     --no-parent \     --no-host-directories \     --no-directories \     --convert-links \     --load-cookies wget_cookies.txt --cookies=on --keep-session-cookies \     -P WikiFolders/pages/ \     -e robots=off \     -r \     --reject='1,2,3,4,5,6,7,8,9,*\\?*' \     --content-disposition \     --no-check-certificate \     http://domain/wiki/Section/      If i run it this way I do get the site but is really slow for some content. _Note: to avoid files with queries I tried`*\\?*` but this doesn't work._ After I download I remove the content with:               find WikiFolders/pages/ -iname "*\\?*" -delete      but again this is really slow and I have to download lots of content. I've thought on first exclude the `HTML` and download images, css and js and with other wget the HTML but since the files have no extension this doesn't work. I hope this is possible and someone can help me with it.


title: Booting grub legacy via qemu using pxe

text: I have been trying to boot grub legacy via qemu using pxe. For some reason, the grub does not display the menu and enters into the command mode after displaying the following error.               Error15: File not found.     grub rescue>      This is my directory structure:               /var/lib/tftpboot     | - pxelinux.0     | - pxegrub.0     | - pxelinux.cfg         | default     | - boot         | grub               |default                       |fat_stage1_5               |menu.lst               |stage1               |device.map               |installed-version                 |minix_stage1_5                    |stage2               |e2fs_stage1_5                |jfs_stage1_5               |reiserfs_stage1_5                 |xfs_stage1_5      |x86_64      Contents of pxelinux.cfg/default:                default vesamenu.c32     prompt 0          menu title Available Installations (scroll down for more options)     menu autoboot Starting grub2 in # Seconds     timeout 30          label local       menu label Boot From Local Disk       localboot 0          label grub       menu label grub       menu default             kernel pxegrub.0          menu end      Contents of menu.lst:               timeout 0          # spawnd is used to control which cpus are booted     #     # "spawnd boot" will use the skb and pci to figure out and     #  boot all cores in the machine     #     # "spawnd boot bootapic-x86_64=1-5" will not use the skb and     # boot the list of cores passed as argument.     # The APIC id of the cores to boot should be specified.     # This list may not include the bsp core id.          title   Barrelfish     root    (nd)     kernel  /x86_64/sbin/elver loglevel=4     module  /x86_64/sbin/cpu loglevel=4     module  /x86_64/sbin/init          # Domains spawned by init     module  /x86_64/sbin/mem_serv     module  /x86_64/sbin/monitor          # Special boot time domains spawned by monitor     module  /x86_64/sbin/ramfsd boot     module  /x86_64/sbin/skb boot     modulenounzip /skb_ramfs.cpio.gz nospawn     module  /x86_64/sbin/kaluga boot     module  /x86_64/sbin/acpi boot     module  /x86_64/sbin/spawnd boot          #bootapic-x86_64=1-15     module  /x86_64/sbin/startd boot     module /x86_64/sbin/routing_setup boot          # Drivers     module /x86_64/sbin/pci auto     module /x86_64/sbin/ahcid auto     module /x86_64/sbin/rtl8029 auto     module /x86_64/sbin/e1000n auto     module /x86_64/sbin/NGD_mng auto     module /x86_64/sbin/netd auto          # General user domains     module  /x86_64/sbin/serial     module  /x86_64/sbin/fish     module  /x86_64/sbin/hellotest     module  /x86_64/sbin/ahcialloctest     module  /x86_64/sbin/idctest client     module  /x86_64/sbin/idctest server      I used the following command to generate grub image:               grub-mkimage --format=i386-pc-pxe --output=grub.pxe --prefix='(pxe)/boot/grub' pxe pxecmd


title: What's the problem with fsck.ext3?

text: It seems there is some problem with my HDD in my satellite box. The box records to and plays video from the HDD, but occasionally it hangs (it was stable before). It's Linux version 2.6.32.28_stm24_0207, ext3 filesystem. I wanted to check the filesystem using `fsc.ext3` to be sure it's ok. But this problem occurs:               # fsck.ext3 /dev/sda1     fsck.ext3: symbol lookup error: fsck.ext3: undefined symbol: test_io_backing_manager      The tool reports this error even when stated without any parameters. The partition can be mounted or not, always the same problem. Does this mean there is a problem with `fsck` itself? How do I repair it?   Is there any diagnostic to find more info? **Update:**   `uname -a` gives this output:               Linux ipbox99 2.6.32.28_stm24_0207 #45 PREEMPT Thu Jun 6 13:57:56 CEST 2013 sh4 GNU/Linux      It's ABIPBox 99 HD with firmware update 20130610.


title: obtaining kernel build tree

text: Could anyone explain me what the kernel build tree is? What files does it include? How can I obtain it from a cross-compiled kernel source (e.g. 3.4.0)?


title: dialog and gauge + yesno widget

text: I'm trying an example of using a yesno widget into a gauge one. But it fails, the code is:               #!/bin/bash     PCT=0;i=0     (     while [[ $PCT -le 100 ]]     do     cat <<EOF     XXX     $PCT     el % es ${PCT}     XXX     EOF          for i in 1 2 3 4 5     do     i=$((i+1))     dialog  --yesno "Si o No?" 15 61          case $? in       0)         PCT=$(($PCT+20));;       1)         PCT=$PCT;;       255)         echo "ESC pressed.";;     esac     done     #     #PCT=$(($PCT+10))     sleep 1     done     ) |          dialog --title "GAUGE" --gauge "Este es un ejemplo de gauge" 20 70 0      I want that appears a dialog, if the user press Yes, it sums 20, otherwise PCT keep its value Please could you tell mes how to fix it? Thanks in advance!


title: What kind of file does /etc/inputrc belong to?

text: Seems like that the `/etc/inputrc` file conforms to the shell script syntax. But the file name does not end with a `.sh`. The first line in the file does not have a `#!`, either. Is it another kind of file? And does that kind of file go in parallel with the `.sh`? Does it run like a shell script? Does it have a naming convention like the `.sh` suffix?


title: Changing shutdown broadcast message

text: Is it possible to change the default message broadcasted by `shutdown` to something else?


title: boot updated kernel image on beagleboard

text: Boot updated kernel image on beagleboard. I had installed a kernel on Beagle-board to update image of kernel to it. I've used this command:                $ sudo apt-get install linux-image-3.2.0.49-omap      It installed the kernel on Beagle-board and it also generated an `initrd` image for this version but it didn't generate a `uImage` and `zImage`. Actually I want to boot this kernel on Beagle-board, can anybody give me some steps on how to boot a new kernel which is recently installed on Beagle-board but doesn't get booted on power on. If it doesn't generate any kind of `uImage` how can I make it bootable? Related information: Board -> Beagle-board XM port OS -> Linux Ubuntu 12.04.1 LTS


title: Get my country by IP in bash

text: I want to use the name of the country where I am now in a bash script. I can get the external IP using next command:               curl ifconfig.me      But how can I get my country name?


title: List of Recently Modified Files

text: How can I Get a list of all files modified , say 3 months ago. I checked this question but I was not able to apply it to my scenario. I am trying this now , it seems to be working , but I know there should be a better way using find.               ls -ltR | grep -v '2011-05' | grep -v '2011-06' | grep -v '2011-07' | grep -v '2011-08


title: How to add an alias without directly editing the `bash_aliases` file?

text: Is there a way to add an alias from the command line without directly editing the bash_aliases file? To clarify, how can I make a bash script do it without having to enter something along the lines of `nano bash_aliases` to add them?


title: Error when I want to create a user on FreeBSD

text: I'm trying to run FreeBSD (.iso) in a virtual VMWare machine. The `useradd` command gives me an error:               # useradd pstnc     useradd: Command not found      Why is that? The command is correct and very simple, just put `useradd` and then the password and that's it. I tried to find a solution here and open a lot of other sites, but in all places talk about of creation of one new user, and none about what to do if it gives you an error like in my case!


title: Tmux border split in rxvt

text: I'm attempting to connect to my Arch server running tmux from my work Windows PC. I've found that while Console2 does a decent job with most things, it's not perfect, and I get all sorts of graphical glitches (fault of my semi- complex configurations). I'd like to use rxvt to keep things simple (I'd rather not have the overhead of an X server for rxvt-unicode). However, when I split windows in tmux, the borders appear as a set of garbage bytes that are represented as `€â”`. Is it possible to have a regular border when using tmux and rxvt (non- unicode)? Thanks!


title: Kernel socket structure and TCP_DIAG

text: I'm working on a software which connects to a Real Time data server (using TCP) and I have some connections dropping. My guess is that the clients do not read the data coming from the server fast enough. Therefore I would like to monitor my TCP sockets. For this I found the "ss" tool. This tool allows to see the state of every socket - here's an example line of the output of the command `ss -inm 'src *:50000'`               ESTAB      0      0             184.7.60.2:50000       184.92.35.104:1105       mem:(r0,w0,f0,t0) sack rto:204 rtt:1.875/0.75 ato:40      My question is: what does the memory part mean? Looking at the source code of the tool I found that the data is coming from a kernel structure (`sock` in `sock.h`). More precisely, it comes from the fields :               r = sk->sk_rmem_alloc     w = sk->sk_wmem_queued;     f = sk->sk_forward_alloc;     t = sk->sk_wmem_alloc;      Does somebody know what they mean? My guesses are:   * `rmem_alloc` : size of the inbound buffer   * `wmem_alloc` : size of the outbound buffer   * `sk_forward_alloc` : ???   * `sk->sk_wmem_queued` : ??? Here are my buffers sizes :               net.ipv4.tcp_rmem = 4096        87380   174760     net.ipv4.tcp_wmem = 4096        16384   131072     net.ipv4.tcp_mem = 786432       1048576 1572864     net.core.rmem_default = 110592     net.core.wmem_default = 110592     net.core.rmem_max = 1048576     net.core.wmem_max = 131071


title: tftpd runs as root, despite explicit option "--user tftp"

text: I start my `tftp` server with the option `--user tftp` so that it runs as user `tftp` instead of root. However, `ps` shows that the process still runs as `root`               ps aux| grep tftp     root      2542  0.0  0.0  14856   324 ?        Ss   Jan11   0:00 /usr/sbin/in.tftpd --listen --user tftp -vvvvv -s -p --ipv4 /srv/tftp      `man tftpd` says, that:               --user username, -u username         Specify  the username which tftpd will run as; the default is "nobody".           The user ID, group ID, and (if possible on the platform) the supple‐         mentary group IDs will be set to the ones specified in the system          permission database for this username.      The user `tftp` exists on my system:               getent passwd | grep tftp     tftp:x:104:108:tftp daemon,,,:/srv/tftp:/bin/false      What could possibly be wrong?


title: In Bash Vi mode, I get thrown into Insert mode automatically after one key press

text: I am using the bash shell with the XFCE4 terminal. I have configured the shell so that it is in Vi mode. I have done this by adding the following line in my ~/.bashrc file:               set -o vi      When in a shell in Normal Mode, the first character I press gets inputed in Normal Mode but then I get thrown in Insert Mode. ie: I am in Normal Mode. If I press b, I will go back one word and get dropped in Insert Mode. If I press bb, I will have got back one word, enter Insert Mode and then insert the b character. Another example, if I press dd, the first d will be caught by Normal Mode, I will then go to Insert Mode where the second d will be inserted. If I manually enter `set -o vi` in the shell (wether it is in my .bashrc or not) I will not get this behaviour and instead get the normal behaviour. I know the change in my .bashrc is getting read as I am not in Emacs mode. I am using bash 4.2.45(1)-release. Here is the full content of my .bashrc:                 PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting       PATH=$PATH:/home/bleakcabal/.rvm/gems/ruby-2.0.0-p247/bin       set -o vi


title: Bash read command and stdin redirection

text: As I understand the bash documentation both | and < redirect stdin. So, `cmd | foo` and `foo < <(cmd)` should be more or less equivalent. However, for the bash-internal read command this doesn't seem to be the case. E.g., if I enter               a=""; b=""; read a b < <(echo a b); echo $a $b      it prints out `a b`, while               a=""; b=""; echo a b | read a b; echo $a $b      prints out nothing. On the other hand, if I enter               a=""; b=""; cat < <(echo a b) >foo1          a=""; b=""; echo a b | cat > foo2      the files foo1 and foo2 are exactly the same. So my question is: what is the difference with both forms when the read command is involved (or in general)? They should see exactly the same redirected input. While the `< <(...)` form works, I find it pretty unreadable and would much prefer to use the pipe form.


title: Determine whether TRIM commands are being sent

text: I've configured multiple SSDs in a RAID-0 array in AHCI mode. I'd like to determine whether TRIM commands are being sent to the disks. Is there a way to monitor these commands in the kernel somewhere? I'd just like to double-check to make sure that they _are_ , in fact, being sent. I'm running an Ubuntu 12.04 derivative.


title: 32-bit on 64-bit: memory usage for multiple processes

text: I'm working on a Linux hosting solution for game server software, however the software in question is 32-bit and I'd be running 64-bit on the host. Now, I know I can run 32-bit apps on a 64-bit host in a 32-bit chroot jail (or a multilib system, but I plan to do the former to keep them segregated in the filesystem), however what happens when all 32-bit apps use over 4GB RAM combined? Say I have three 32-bit game server programs that use 2GB each - what will happen once the first two hit 4GB combined, and will the third be able to run at all? I hoped to get around this by running a 32-bit userland under a 64-bit User Mode Linux kernel, however I learned to my disdain that one cannot run a 32-bit userland under a 64-bit UML kernel. I suppose I could run a 32-bit UML kernel in a 32-bit userland but then I'd be running afoul of the same memory condition and thus might as well be using `chroot` jails anyway?


title: Pass a list of directories to a find command

text: How can I pass a list of directories to a find command? Imagine you got the list as:               ls -d mydir*/      which would output mydir1, mydir2 and so on, but exclude otherdirs1, otherdirs2. I'd like to run the following command on the list:               find <put here the name of each dir>  -type f -name "*.mp3" -print0 | xargs -0 ...      Trying to run this command on each directory separately:               find -type f -name "*.mp3" -print0 |     xargs -0  mplayer -vo dummy -ao dummy -identify 2>/dev/null |      perl -nle '/ID_LENGTH=([0-9\.]+)/ && ($t +=$1) && printf "%02d:%02d:%02d\n",$t/3600,$t/60%60,$t%60' |      tail -n 1      That means: find the mp3s, run mplayer to obtain meta-data on each file, sum all ID_LENGTH of each mp3 file, output sum of all mp3s in directory.