title: Why alias does not work in AIX (korn shell, .profile)?

text: I have these files in my home directory:               drwxr-xr-x    3 meuser staff           256 Oct 12 13:11 .     drwxr-xr-x  102 bin      bin            4096 Sep 30 12:28 ..     -rw-------    1 meuser staff          5349 Oct 11 20:44 .bash_history     -rwx------    1 meuser staff           466 Jun 26 22:12 .profile     -rw-------    1 meuser staff          7074 Oct 12 13:11 .sh_history     drwx------    2 meuser staff           256 Aug 16 15:28 .ssh      My default shell is korn shell. When I tried to put alias into .profile like this:               alias l='ls -lrt'      and tried to run it after relogin:               $l     ksh: l:  not found.      How to make this alias work?


title: How to load .profile without relogin in AIX?

text: How can I load my `.profile` file without a relogin in AIX Server?


title: Huawei E353 Driver for Linux

text: Does the Linux kernel that comes with Ubuntu 12.04 support the Huawei E353 modem? I'm using it on Windows currently but want to know if it works on Ubuntu.


title: Monitor when read/write on metadata or mmaped files hit the disk

text: On a server hosting a wide range of websites, I often see IO becoming a bottleneck without being able to identify the processes responsible of IO operations with tools such as iotop, iostat or sar. I suspect that those processes are performing a lot of IO on metadata (reading and/or writing attributes, creating or removing a lot of empty files, etc). Unfortunately, it seems that those operations are not accounted "per processes", nor are IO performed using memory-mapped files (mmap). My question is: Is there a way to monitor and/or account (for instance, using cgroups and blkio) IO per process or (maybe even better) per file, including io on metadata and memory-mapped files? Currently, I'm trying to account "which requests hit the disk" using systemtap, probing handle_mm_fault() (mm/memory.c in the kernel) for major page faults, but I haven't been able to verify if manipulation of filesystem metadata generates page faults handled by this function. Thank you for your insights!


title: Bash, how to let some background processes run but wait for others?

text: I have (yet) another `wait`, `&`, `&&` control flow question.. Say I have a script something like this where I want to do as much work at the same time as possible:               # may take some hours     something InputA > IrrelevantA &     something InputB > IrrelevantB &          # may take an hour     (        somethingElse InputA > OutputA &        somethingElse InputB > OutputB &     )&& combine OutputA OutputB > Result          ...morestuff      Question 1: In the script, does `combine` wait for both `somethingElse` processes to finish while both `something` processes continue? Question 2: If not - and I suspect it doesn't??? How do I get `combine` to wait only for both `somethingElse` processes whilst `something` processes above continue to work away in the background? many thx (yet) again..


title: How do i block USB devices based on device class in Linux

text: `Problem Statement` In windows server to provide access to USB devices are managed by GFI EndpointSecurity. Is there any open source tool in Linux which can do the same job. I want to block USB devices based on device class. I am looking for a `add-on` or `some set of commands`. I want to install the add-on in Linux server and provide access to client systems based on groups. `tried out` I have seen post on 'how to block usb storage devices in linux'. as shown here.


title: Sed + how to set parameters in sed command in order to display lines from text file

text: I find the following way to print line from file In this example we want to print the first line from the hosts file               sed -n '1,1p'  /etc/hosts     127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4      But how to do the same with parameters inside the sed command For example               Line_number=1     sed -n ' $Line_number,$Line_numberp'  /etc/hosts      sed: -e expression #1, char 4: extra characters after command      what is wrong in my sed syntax?


title: sshfs LocalForward without config file

text: I'm trying to add portforwarding to my sshfs-mount-scripts:               sshfs tim@devserver1:/ /home/tim/mnt/devserver1/      -o SSHOPT=LocalForward 127.0.0.5:3306 127.0.0.1:3306      So far I've failed using the correct syntax. Using brackets or commas instead of spaces did not work.


title: Failed to restore file with extundelete

text: I accidentally deleted the file `.vimrc` in my `$HOME` directory. I rebooted the system and accessed it as `root`. Then: `$ sudo mount -o remount,ro /dev/sda5` `$ sudo extundelete /dev/sda5 --restore-file /home/xralf/.vimrc` The output of the command indicates that it failed to restore `.vimrc` file. Is the file already absolutely lost or is there some other possibility to recover it?


title: Shared drive between two Linux virtual machines

text: Assume I have two virtual machines.   * How do I share a VMDK drive between them?   * What solution do you recommend? Outside OS with NFS share? Both of OSes see this drive as: `/dev/sdb`.


title: How to install package via yum in Fedora

text: How do I install software using `yum`? Can you tell me another way to install package in Fedora?


title: Easiest method to create pdf from template using command line (without pdflatex)?

text: For ten years I have been generating billings for me and my wife in this way:   1. Create TeX template with LyX or by hand   2. Using in this source placeholder text   3. Then:              cat template | sed s/placeholder1/somevalue1/ |sed s/placeholder2/somevalue2 ... > output.tex     pdflatex output.tex       Sadly in last years this process is becoming more and more difficult because TeX packages are becoming larger and larger (don't know why, but a full TeX installation on Ubuntu is almost 3 GB), and I always get lots of errors in the generation. So, since I can control all the processes involved, is there a better (easier/more portable) way to create the template and then fill it with fields and create a PDF?


title: Which file in kernel specifies fork(), vfork()... to use sys_clone() system call

text: When ltrace is used for tracing the system calls, I could see that fork() uses sys_clone() rather than sys_fork(). But I couldnt find the linux source where it is defined. My program is               #include<stdio.h>     main()     {             int pid,i=0,j=0;             pid=fork();             if(pid==0)                     printf("\nI am child\n");             else                     printf("\nI am parent\n");          }      And ltrace output is               SYS_brk(NULL)                                                                               = 0x019d0000     SYS_access("/etc/ld.so.nohwcap", 00)                                                        = -2     SYS_mmap(0, 8192, 3, 34, 0xffffffff)                                                        = 0x7fe3cf84f000     SYS_access("/etc/ld.so.preload", 04)                                                        = -2     SYS_open("/etc/ld.so.cache", 0, 01)                                                         = 3     SYS_fstat(3, 0x7fff47007890)                                                                = 0     SYS_mmap(0, 103967, 1, 2, 3)                                                                = 0x7fe3cf835000     SYS_close(3)                                                                                = 0     SYS_access("/etc/ld.so.nohwcap", 00)                                                        = -2     SYS_open("/lib/x86_64-linux-gnu/libc.so.6", 0, 00)                                          = 3     SYS_read(3, "\177ELF\002\001\001", 832)                                                     = 832     SYS_fstat(3, 0x7fff470078e0)                                                                = 0     SYS_mmap(0, 0x389858, 5, 2050, 3)                                                           = 0x7fe3cf2a8000     SYS_mprotect(0x7fe3cf428000, 2097152, 0)                                                    = 0     SYS_mmap(0x7fe3cf628000, 20480, 3, 2066, 3)                                                 = 0x7fe3cf628000     SYS_mmap(0x7fe3cf62d000, 18520, 3, 50, 0xffffffff)                                          = 0x7fe3cf62d000     SYS_close(3)                                                                                = 0     SYS_mmap(0, 4096, 3, 34, 0xffffffff)                                                        = 0x7fe3cf834000     SYS_mmap(0, 4096, 3, 34, 0xffffffff)                                                        = 0x7fe3cf833000     SYS_mmap(0, 4096, 3, 34, 0xffffffff)                                                        = 0x7fe3cf832000     SYS_arch_prctl(4098, 0x7fe3cf833700, 0x7fe3cf832000, 34, 0xffffffff)                        = 0     SYS_mprotect(0x7fe3cf628000, 16384, 1)                                                      = 0     SYS_mprotect(0x7fe3cf851000, 4096, 1)                                                       = 0     SYS_munmap(0x7fe3cf835000, 103967)                                                          = 0     __libc_start_main(0x40054c, 1, 0x7fff47008298, 0x4005a0, 0x400590 <unfinished ...>     fork( <unfinished ...>     SYS_clone(0x1200011, 0, 0, 0x7fe3cf8339d0, 0)                                               = 5967     <... fork resumed> )                                                                        = 5967     puts("\nI am parent" <unfinished ...>     SYS_fstat(1, 0x7fff47008060)                                                                = 0     SYS_mmap(0, 4096, 3, 34, 0xffffffff     )                                                        = 0x7fe3cf84e000     I am child     SYS_write(1, "\n", 1     )                                                                       = 1     SYS_write(1, "I am parent\n", 12)                                                           = -512     --- SIGCHLD (Child exited) ---     SYS_write(1, "I am parent\n", 12I am parent     )                                                           = 12     <... puts resumed> )                                                                        = 13     SYS_exit_group(13 <no return ...>     +++ exited (status 13) +++


title: Do all Linux processes write EOF to stdout when they are terminating/have finished terminating?

text: I'm having trouble with sending `shutdown -h 0` to a `lxc` Debian container (i.e. executing this command in the lxc) with with the python `pexpect` module (in a python script). In this module the user can "expect" (= wait for process output) a certain substring, amongst others EOF, which leads me to the question in order to be able to debug further why EOF isn't recognized in the output. I need to know what I can "expect" after termination of the process in order to wait for the process to end. I can't simply wait for the process because the `pexpect` module hides non-blocking functions for that. The `pexpect` module (see http://www.bx.psu.edu/~nate/pexpect/pexpect.html#pexpect.spawn.expect for details) wraps the reception of EOF in the read system call in a (duck)type and makes it usable in `pexpect.expect` (an encapsulation of possible output/feedback of a process). I've been wondering that because some processes like `ls` are expected to terminate with EOF, i.e. the `pexpect` sense of EOF (example at http://pexpect.sourceforge.net/pexpect.html).


title: Can I have the shell ignore the command line sometimes but not always?

text: For debugging purpose sometimes I access a remote Linux box via VNC. At that time someone else may be working on that same Linux box through VNC and it may happen that I do not have facility to chat with that person. So essentially what happens is I start a new tab in the GNOME and type a message like this :               [xxx@slc04lyo abc]$ Hi this is X. I will use the box for some time     Hi: Command not found.      Is it possible to **not** have shell print the following?               Hi: Command not found.      If yes how can I do that selectively and not always? So that when needed I can use the shell as a raw chat platform? P.S: I do not need to see an output. The other user is already in the VNC and can see what I typed. So the output is superfluous.


title: Replacing Multiple blank lines with a single blank line in vim / sed

text: Question more or less says it all. I'm aware that `/^$/d` will remove all blank lines, but I can't see how to say 'replace two or more blank lines with a single blank line' Any ideas?


title: Why does yumdownloader download i686 files if my pc is x86_64 and also installs them?

text: I simply found out what packages were in the group:                Desktop Platform      via               yum groupinfo "Desktop Platform"      Then I downloaded them all one by one via:               yumdownloader --resolve <package_name>      I noticed it downloaded both: `i686 & x86_64` versions of the same packages. Then when I ran:               yum --nogpgcheck localinstall *.rpm      _(within the folder where all the packages were downloaded)_ It actually installed both: `i686 & x86_64` versions of the same packages. Based on information I know, it's not suppose to do that, it's only suppose to install `x86_64`, because my system is `x86_64`, not `i686`. Is this a mistake by `yum`, or is it suppose to be this way?


title: What is the correct syntax to add CFLAGS and LDFLAGS to "configure"?

text: I am a Unix/OpenBSD beginner and wish to install OpenVPN on OpenBSD 5.5 using OpenVPN source tarball. According to the instructions here, I have to install lzo and > add CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" directives to > "configure", since gcc will not find them otherwise. I have googled extensively for guide on how to do the above on OpenBSD but there is none. This is what I plan to do:   1. Untar the source tarball to a freshly created directory   2. Issue the command ./configure CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"   3. Issue the command make   4. Issue the command make install Which of the following syntax is correct?               ./configure CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"      or               ./configure --CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"      or               ./configure --CFLAGS="-I/usr/local/include" --LDFLAGS="-L/usr/local/lib"


title: man xargs says standard input is delimited by blanks; but is it?

text: I'm puzzled by what actually defines an **arg** in `xargs`.   The man page seems to suggest that args are delimited by blanks (I assume that means whitespace). However the following script doesn't behave as I would expect. Here is an excerpt from man's DESCRIPTION section: > xargs reads items from the standard input, delimited by blanks (which can be > protected with double or single quotes or a backslash) or new‐lines, and > executes the command ... It seems that perhaps xargs works in _blocks_ of what the man-page calls _items_. Does this mean a `null-delimited` item, or a `newline` delimited item? Basically, I don't understand why, in the following script, `xargs` treats the input as a single arg, even though the spaces (in stdin) are _not protected_. I expected `xargs` to treat stdin as 3 args, or at least reduce multiple spaces to a single space, but it does neither of these...               #!/bin/bash     if [[ $1 == "." ]] ;then  # act on a recursive call to self         shift                 # scrap the 'recursive' arg         printf '|%s|\n' "$@"  # print all 'xargs' args         printf '|%s|\n' "$1"  # print only the first 'xargs' arg         exit     fi     printf 'a    b    c\n' |xargs -I {} "$0" "." {}         * * * Here is the output; showing only a single arg was passed to the script.               |a    b    c|     |a    b    c|      But I would have expected 3 seperate args, like this:               |a|     |b|     |c|


title: Is it possible to run ssh-copy-id on port other than 22?

text: I have a server with SSH running on a non-standard port. Instead of 22, it runs on 8129. To log in, I use:               ssh -p 8129 hostname      Now, whenever I need to set up a key for password-less login, I have to copy the public key and add it to authorized_keys manually. I discovered that the command `ssh-copy-id` could be used to simplify this process, but it seems like it does not have an option to specify the port of the ssh server. Is there some way to tell `ssh-copy-id` to use port 8129, or should I just forget about this command and copy/paste manually as before?


title: Most straightforward way of getting a raw, unparsed HTTPS response

text: What would be the most straightforward way of making a GET request to a url over HTTPS, and getting the raw, unparsed response? Could this be achieved with curl? If so, what options would you need to use?


title: Python not recognizing LD_LIBRARY_PATH?

text: I am trying to install Python2.7 on cr-48 chromebook in developer mode, and face a weird issue that I am having hard time searching for a solution on google. First some background.. the root partition is mounted readonly, so I have been installing packages under /usr/local, which is a separate mount point that is writable. There is a way to force root partition itself readwrite (with some minor disadvantages), but I decided not to go that route. I have been downloading archlinux packages and extract them under /usr/local and several of them have been working great so far. I basically extract the `.tar.xz` file somewhat like this:               xz -dc package.tar.xz | sudo tar --strip-components=1 -C /usr/local -xvf -      This basically drops the files destined for /usr to be under /usr/local instead. I export `/usr/local/lib` ahead of `/usr/lib` under the `LD_LIBRARY_PATH`, and got several packages to work fine this way. For some reason, python fails to load recognize this, though not completely sure what causes it. After expanding python 2.7 package which I got from archlinux site, I was able to start the python shell fine, and a simple print worked fine. I then tried to install setuptools, so downloaded the source from pypy and tried running `sudo /usr/local/python2 setup.py install`, but it kept giving me the below error:               /usr/local/bin/python2: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory      The `libpython2.7.so.1.0` file is in deed there in `/usr/local/lib/` directory which is there in `LD_LIBRARY_PATH`. A quick run of ldd shows this clearly:               chronos@localhost /tmp/setuptools-1.1.6 $ ldd /usr/local/bin/python2             linux-gate.so.1 (0x777a9000)             libpython2.7.so.1.0 => /usr/local/lib/libpython2.7.so.1.0 (0x77610000)             libpthread.so.0 => /lib/libpthread.so.0 (0x775ee000)             libc.so.6 => /lib/libc.so.6 (0x77464000)             libdl.so.2 => /lib/libdl.so.2 (0x77460000)             libutil.so.1 => /lib/libutil.so.1 (0x7745b000)             libm.so.6 => /lib/libm.so.6 (0x77436000)             /lib/ld-linux.so.2 (0x777aa000)      I also checked `/etc/ld.so.conf` and that too has `/usr/local/lib`:               chronos@localhost /tmp/setuptools-1.1.6 $ cat /etc/ld.so.conf      # ld.so.conf autogenerated by env-update; make all changes to     # contents of /etc/env.d directory     /lib     /usr/lib     /usr/local/lib     /usr/lib/opengl/xorg-x11/lib      I installed `strace` (and `perl` since it is listed as a dependent), and ran the install command under `strace` which shows the below interesting output (see that it is NOT looking for `/usr/local/lib/libpython2.7.so.1.0` anywhere):               chronos@localhost /tmp/setuptools-1.1.6 $ sudo strace /usr/local/bin/python2 setup.py installPassword:      execve("/usr/local/bin/python2", ["/usr/local/bin/python2", "setup.py", "install"], [/* 16 vars */]) = 0     brk(0)                                  = 0x9b3c000     mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x776e6000     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3     fstat64(3, {st_mode=S_IFREG|0644, st_size=37049, ...}) = 0     mmap2(NULL, 37049, PROT_READ, MAP_PRIVATE, 3, 0) = 0x776dc000     close(3)                                = 0     open("/lib/tls/i686/sse2/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/lib/tls/i686/sse2", 0x7fd88d90) = -1 ENOENT (No such file or directory)     open("/lib/tls/i686/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/lib/tls/i686", 0x7fd88d90)     = -1 ENOENT (No such file or directory)     open("/lib/tls/sse2/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/lib/tls/sse2", 0x7fd88d90)     = -1 ENOENT (No such file or directory)     open("/lib/tls/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/lib/tls", 0x7fd88d90)          = -1 ENOENT (No such file or directory)     open("/lib/i686/sse2/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/lib/i686/sse2", 0x7fd88d90)    = -1 ENOENT (No such file or directory)     open("/lib/i686/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/lib/i686", 0x7fd88d90)         = -1 ENOENT (No such file or directory)     open("/lib/sse2/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/lib/sse2", 0x7fd88d90)         = -1 ENOENT (No such file or directory)     open("/lib/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0     open("/usr/lib/tls/i686/sse2/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/usr/lib/tls/i686/sse2", 0x7fd88d90) = -1 ENOENT (No such file or directory)     open("/usr/lib/tls/i686/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/usr/lib/tls/i686", 0x7fd88d90) = -1 ENOENT (No such file or directory)     open("/usr/lib/tls/sse2/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/usr/lib/tls/sse2", 0x7fd88d90) = -1 ENOENT (No such file or directory)     open("/usr/lib/tls/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/usr/lib/tls", 0x7fd88d90)      = -1 ENOENT (No such file or directory)     open("/usr/lib/i686/sse2/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/usr/lib/i686/sse2", 0x7fd88d90) = -1 ENOENT (No such file or directory)     open("/usr/lib/i686/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/usr/lib/i686", 0x7fd88d90)     = -1 ENOENT (No such file or directory)     open("/usr/lib/sse2/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/usr/lib/sse2", 0x7fd88d90)     = -1 ENOENT (No such file or directory)     open("/usr/lib/libpython2.7.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)     stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0     writev(2, [{"/usr/local/bin/python2", 22}, {": ", 2}, {"error while loading shared libra"..., 36}, {": ", 2}, {"libpython2.7.so.1.0", 19}, {": ", 2}, {"cannot open shared object file", 30}, {": ", 2}, {"No such file or directory", 25}, {"\n", 1}], 10/usr/local/bin/python2: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory     ) = 141     exit_group(127)                         = ?     +++ exited with 127 +++      I have always gotten custom installation paths to work by just including the lib path in `LD_LIBRARY_PATH` and exporting it, so not sure what else I could be missing here. Any help is much appreciated.


title: How to extract running Apache configuration from core dump?

text: Apache is loading the configuration from files into its memory. If the config files are changing the Apache process won't activate it until a reload/restart happens. Now I have to debug the current running Apache configuration (particularly the Vhost config). For now I have dumped the Apaches memory with gcore. So how would I have to proceed to extract the relevant parts of the memory dump to get to the Vhost config? (I assume the config does not get stored in plain text in Apaches memory and there is some magic needed to decode the memory). I think it might be really complex to debug it this way.


title: Prevent hanging of "echo STRING > fifo" when nothing is reading that FIFO

text: When I `echo` something to a named pipe made with `mkfifo`, it hangs if no process is reading from that pipe. How can I prevent that, i.e., stop that from hanging? And by the way, why is that hanging `echo` process not listed in `ps -e` or `pstree`?


title: Finding out what is spinning up harddrive

text: I am the owner of a NAS, running some Linux distribution. It comes with a web administration frontend, where I can manage several services, user rights and also when it should go to sleep. My problem is, for some reason, when the NAS has gone to sleep, the hard drive turns on again after a couple of minutes. Then it will spin for some time, then sleep again. This keeps going on indefinitely. How can I try to determine the cause for this? I am very new to Linux, but I managed to get root access, and now have a SSH connection.


title: Apache2 configuration issue?

text: Why is it that when I write the directive `Alias /hello /myfile.php` it works fine, but if I write `Alias /hello /myfile.php?myvar=test` apache gives me 'NOT FOUND'.


title: cp or rsync, is cp really worth it?

text: I hope this does not count as a question without a real answer, as I can't seem to find a good reason to use `cp(1)` over `rsync(1)` in virtually all circumstances. Should one typically favour `rsync` over `cp`? Is there any good guideline for their use?   * `rsync`: Transfers the diffs, it can use compression, it can be used remotely (and securely), it can be restarted despite an interruption, even during the transfer of a single large file. '   * `cp` : Perhaps it's just simpler to use? Is it faster than rsync?


title: How to use a 64-bit CPU in KVM?

text: According to tests the Mac Mini 3,1 CPU is 64-bit (`grep -q "^flags.*\blm\b" /proc/cpuinfo`) and supports Intel virtualization extensions (`grep -q "^flags.*\bvmx\b" /proc/cpuinfo`). However, after running `kvm -m 512 -boot d -cdrom archlinux-2012.07.15-netinstall-dual.iso` and looking in the Hardware Detection Tool, the processor is listed as _not_ x86_64. Using `-cpu kvm64` doesn't help. Is it also necessary to have a 64-bit kernel (I don't)?


title: File system jfs/btrfs/xfs/ext4

text: I was looking into some of the requirement, where huge amount of recursive files are written and deleted and looking forward if any FS (file system) as such gives advantage on others. I am trying to research on "JFS" "BTRFS" "XFS" And "EXT4" in particular. Here is some Benchmarking provided, on btrfs https://oss.oracle.com/projects/btrfs/dist/documentation/benchmark.html Anyone that has relevent experience of use on identical situation or any feedback.


title: How can I edit a large file in place?

text: I have a few files sized > 1 GB each. I need to remove last few bytes from the files. How can I do it? I prefer to edit file in place to save disk space. I am on HP-UX.


title: Thinkpad disable TrackPoint

text: I have a new thinkpad x220t running Arch Linux. There seems to be a problem in the products hardware architecture as the TrackPoint is moving when you convert the thinkpad into tablet mode and put pressure on the screen. Therefore I'd like to toggle the TrackPoint using a little bash script called by ACPId. I so far wrote this code snippet which disables the TouchPad, but not the TrackPoint (aka. Clit Mouse).               #!/bin/sh          status=`synclient|awk '/TouchpadOff/{printf$3}'`     status=`expr \( $status + 1 \) \% 2`     synclient TouchpadOff=$status      Is there any possibility to toggle the TrackPoint Status using a bash script?


title: How to make screen -R attach to the youngest detached session?

text: I'm using screen on debian lenny, and I would like to use the `-R` option. From `man screen`:                  -R   attempts  to  resume  the  youngest  (in  terms  of creation time)             detached screen session it finds.  If successful, all  other  com‐             mand-line  options  are  ignored.   If no detached session exists,             starts a new session using the specified options, just  as  if  -R             had  not been specified.      However, when I run `screen -R` it does not actually attach to the youngest detached session. Instead, it complains that there are "several suitable screens" and that I need to choose one of them. Am I missing something? How do I make this work as advertised?


title: squid - ssl bump

text: I have squid configured to bump SSL connections; however, when I configure my browser to use squid as a proxy, it doesn't actually do any SSL bumping. When I check the certificate, I can see it is still using the original and not one that I'm expecting to see. I followed the configuration from here: http://wiki.squid- cache.org/Features/SslBump I also see that SSL Bump is enabled on port 3128 and my transparent proxy is on 3129. Is there something else I need to do?


title: prioritize traffic for some bridge interfaces using prio qdisc

text: Im configuring my router to give preference to some WAN interfaces. This interfaces are named ppp0 (PPP interface), vc2 (RFC1483 bridge interface) and vc3 (RFC1483 bridge interface). I had understood with bridge interfaces that forwarding is done at layer 2 so iptables not even 'see' the outgoing traffic of this bridge interfaces. Indeed i can in my router set with 'ip rule' traffic from all as prohibited and i can still stablish PPPOE connection from LAN to WAN through bridge interfaces. If forwarding is done at L2 with bridge interfaces how TOS field can be marked so IP QoS can be done?. Anyway using busybox shell in my CLI router interface i can get information about this queuing disciplines by default:               ...     qdisc pfifo_fast 0: dev vc0 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1     qdisc pfifo_fast 0: dev vc2 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1     qdisc pfifo_fast 0: dev vc3 root bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1      So far so good, but i can configure QoS queue via web interface of my router using a table that allows sorting interfaces by precedence:               Interface       Description     Precedence     Queue ID      ppp0_vc0        8_32_p0         0               1            vc2             8_37_p1         1               2            vc3             10_35_p2        2               3       With the configuration above i hope outgoing traffic from ppp0 is dequeue before outgoint traffic from vc2 is dequeue. When the configuration above is enabled i get:               #tc qdisc     ......     qdisc prio 1: dev vc0 root bands 4 priomap  2 3 3 2 1 1 0 0 1 1 1 1 1 1 1 1     qdisc pfifo 2: dev vc0 parent 1:1 limit 10p     qdisc pfifo 3: dev vc0 parent 1:2 limit 10p     qdisc pfifo 4: dev vc0 parent 1:3 limit 10p     qdisc pfifo 5: dev vc0 parent 1:4 limit 10p     qdisc prio 1: dev vc2 root bands 4 priomap  2 3 3 2 1 1 0 0 1 1 1 1 1 1 1 1     qdisc pfifo 2: dev vc2 parent 1:1 limit 10p     qdisc pfifo 3: dev vc2 parent 1:2 limit 10p     qdisc pfifo 4: dev vc2 parent 1:3 limit 10p     qdisc pfifo 5: dev vc2 parent 1:4 limit 10p     qdisc prio 1: dev vc3 root bands 4 priomap  2 3 3 2 1 1 0 0 1 1 1 1 1 1 1 1     qdisc pfifo 2: dev vc3 parent 1:1 limit 10p     qdisc pfifo 3: dev vc3 parent 1:2 limit 10p     qdisc pfifo 4: dev vc3 parent 1:3 limit 10p     qdisc pfifo 5: dev vc3 parent 1:4 limit 10p      New iptables rules are created too:               #cat iptables -nvL -t mangle     ....     Chain FORWARD (policy ACCEPT 6621 packets, 616K bytes)     pkts bytes target     prot opt in     out     source                   destination               1671  157K m_ipq_dft  all  --  *      *       0.0.0.0/0                0.0.0.0/0                1670  157K m_ipq_user  all  --  *      *       0.0.0.0/0                0.0.0.0/0             ....     Chain m_ipq_dft (1 references)     pkts bytes target     prot opt in     out     source                   destination               1436  134K CLASSIFY   all  --  br0    *       0.0.0.0/0                0.0.0.0/0          tos match 0x0/0xe0 CLASSIFY set 0:0          0     0 CLASSIFY   all  --  br0    *       0.0.0.0/0                0.0.0.0/0          tos match 0x20/0xe0 CLASSIFY set 0:1          0     0 CLASSIFY   all  --  br0    *       0.0.0.0/0                0.0.0.0/0          tos match 0x40/0xe0 CLASSIFY set 0:2          0     0 CLASSIFY   all  --  br0    *       0.0.0.0/0                0.0.0.0/0          tos match 0x60/0xe0 CLASSIFY set 0:3          0     0 CLASSIFY   all  --  br0    *       0.0.0.0/0                0.0.0.0/0          tos match 0x80/0xe0 CLASSIFY set 0:4          0     0 CLASSIFY   all  --  br0    *       0.0.0.0/0                0.0.0.0/0          tos match 0xa0/0xe0 CLASSIFY set 0:5          0     0 CLASSIFY   all  --  br0    *       0.0.0.0/0                0.0.0.0/0          tos match 0xc0/0xe0 CLASSIFY set 0:6      0     0 CLASSIFY   all  --  br0    *       0.0.0.0/0                        0.0.0.0/0          tos match 0xe0/0xe0 CLASSIFY set 0:7       I have read about queuing disciplines here http://lartc.org/. I understand that the tc output above displayed means that traffic on each interface goes to band 0,1,2,3 depending on the value of TOS field. I dont understand the iptables rules classifyng traffic from br0 (br0 groups LAN interfaces + vc2 + vc3) in 0:1..0:7 classes because i dont see this classes in 'tc qdisc' output. Seen previous output I dont see how traffic from ppp0 has more precedence that traffic from vc1 (like i configured via web interface) and im not sure if iptables rules can be applied on bridge interfaces.


title: NFS: unable to umount NFS share when server offline

text: When our main NFS server goes offline, all clients which had a share mounted are affected in the following way:               1. `df` does not work (times out)     2. `lsof` does not work (times out)     3. I cannot unmount the share (umount times out)     4. I cannot restart the client PC, the shutdown process gets stuck         while trying to umount the dead NFS share:         `nfs server not responding still trying`     5. hard reboot (reset) works, but while booting the client PC gets         stuck while trying to mount the NFS share      Now I know how to solve the problem nr. 5. I can change the entry in `fstab` to `noauto`. But what about the other problems? Does `NFS` client have no intelligence to stop waiting for a dead NFS server? Why does it wait indefinetly? Can I somewhere set a timeout, so that whatever happens, after `x` seconds he gives up trying?


title: Gnome-terminal and Zsh: keep current directory on new tab/window

text: I'm running gnome 3.10.1 on Arch with Zsh. I'm facing that problem that when I create a new tab or window from a terminal window, it resets the current dir to my home dir. I've already tried this: gnome-terminal: keep track of directory in new tab, but it didn't work. I tought that maybe it could be some configuration on my `.zshrc` file, so, I cleaned it up and put just the following line:               . /etc/profile.d/vte.sh      However, it didn't worked. Yes, this file exists and here is its contents:               # Copyright © 2006 Shaun McCance <shaunm@gnome.org>     # Copyright © 2013 Peter De Wachter <pdewacht@gmail.com>     #     # This program is free software; you can redistribute it and/or modify     # it under the terms of the GNU General Public License as published by     # the Free Software Foundation; either version 3 of the License, or     # (at your option) any later version.     #     # This program is distributed in the hope that it will be useful, but     # WITHOUT ANY WARRANTY; without even the implied warranty of     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     # General Public License for more details.     #     # You should have received a copy of the GNU General Public License     # along with this program; if not, write to the Free Software     # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.          # Not bash or zsh?     [ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] || return 0          # Not an interactive shell?     [[ $- == *i* ]] || return 0          # Not running under vte?     [ "${VTE_VERSION:-0}" -ge 3405 ] || return 0          __vte_urlencode() (       # This is important to make sure string manipulation is handled       # byte-by-byte.       LC_ALL=C       str="$1"       while [ -n "$str" ]; do         safe="${str%%[!a-zA-Z0-9/:_\.\-\!\'\(\)~]*}"         printf "%s" "$safe"         str="${str#"$safe"}"         if [ -n "$str" ]; then           printf "%%%02X" "'$str"           str="${str#?}"         fi       done     )          # Print a warning so that anyone who's added this manually to his PS1 can adapt.     # The function will be removed in a later version.     __vte_ps1() {       echo -n "(__vte_ps1 is obsolete)"     }          __vte_osc7 () {       printf "\033]7;file://%s%s\a" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")"     }          __vte_prompt_command() {       printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}" "$(__vte_osc7)"     }          case "$TERM" in       xterm*|vte*)         [ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__vte_prompt_command"          [ -n "$ZSH_VERSION"  ] && chpwd_functions+=(__vte_osc7)         ;;     esac          true      This is really bugging me... Is there any solution?


title: Where is the trash directory for PCManFM and xfe?

text: I've got PCManFM and Xfe as graphical file managers in my Arch Linux with Openbox. When I click on the Trash link in PCManFM I get an error saying "Operation not supported". Question: Where do PCManFM and xfe put files you sent to the Trash? Thanks.


title: How can I find the application for a MIME type on linux?

text: Is there a linux API that can find the default application for a MIME type? Then I can use this application to open a file. I can not use xdg-open(url) because the file format is a wrapper format and shared mime-type can only tell the wrapper MIME type. The embedded mime type can only be got from the wrapper file header. The process would be like: 1. find embedded mime type 2. mime-open(embedded mime type, url) Is it possible?


title: Can shared-mime-info associate a MIME type to a desktop applications?

text: I can add a new MIME type in shared MIME-info, but how can I associates this MIME type with an application?


title: Gtk application (Gvim) rendering troubleshooting

text: When I switch from gvim to another application and then after some time switch back gvim window appears blank with cursor blinking in the middle. Sometimes toolbar and tabs look like a white space. When I opening a new tab, tab bar doesn't refresh itself and shows the same tabs as before opening new tab. When I resizing window everything goes back to normal. ![Gvim glitch](http://i.stack.imgur.com/VJLbB.png) How to fix gvim rendering problem in gentoo linux (or how to understand what causes this problem)?


title: pdf to jpg without quality loss; gscan2pdf

text: When I convert a pdf file to bunch of jpg files using               convert -quality 100 file.pdf page_%04d.jpg      I have appreciable quality loss. However if I do the following, there is no (noticeable) quality loss: Start gscan2pdf, choose file-> import (and choose file.pdf). Then go to the temporary directory of gscan2pdf. There are many pnm files (one for every page of the pdf-file). Now I do                 for file in *.pnm; do                   convert $file $file.jpg done      The resulting jpg-files are (roughly) of the same quality as the original pdf (which is what I want). Now my question is, if there is a simple command line way to convert the pdf file to a bunch of jpg files without noticeable quality loss? (The solution above is too complicated and time consuming).


title: can root user assume any uid

text: sorry if this is a stupid question. I know that the root user can access all files / commands on the system but can Can a root / su user assume any other uid? The reason I ask is looking at http://nelenkov.blogspot.co.uk/2012/05/storing- application-secrets-in-androids.html it says a deamon commands _"Allowed UIDs"_ are _"anyone but root, vpn and wifi (Only keys created with the same UID are visible/accessible)"_ - which suggests in this case the creators uid has higher privilege than root - is this correct? Please let me know if I have made any incorrect assumptions here :)


title: mbsync not fetching/pushing with [Gmail]/Folders

text: I've switched from offlineimap to mbsync, but I'm having a problem syncing certain directories from Gmail. Specifically, all of the [Gmail]/FolderName directories seem to be ignored by mbsync (when I run mbsync -l, it doesn't list any of these). I have a config like this **[edited to show full config]** :               Create Slave          # Account details necessary for logging into the remove server:     IMAPAccount GMAIL     Host imap.gmail.com     User user@gmail.com     Pass pass     UseIMAPS yes     # The certificate of the authority that verified the SSL     # certificate of your email provider:     CertificateFile /etc/ssl/certs/ca-certificates.crt          # The remote repository:     IMAPStore GMAIL-remote     Account GMAIL          # The local repository:     MaildirStore GMAIL-local     Path ~/Maildir/GMAIL/     Inbox ~/Maildir/GMAIL/INBOX     Trash ~/Maildir/GMAIL/[Gmail].Bin          # Channel connecting two repositories, describing the way the two     # are synchronized:     Channel GMAIL     Master :GMAIL-remote:     Slave :GMAIL-local:     Patterns  "[Gmail]/Sent Mail" "[Gmail]/Drafts" "[Gmail]/Bin" "[Gmail]/Spam" INBOX ARCHIVED     Create Slave     Expunge Both     SyncState *       Which seems to conform to examples I've seen online. Has something changed with mbsync or Gmail which causes mbsync to ignore [Gmail]/Folders?


title: Bridging two interfaces for intranet only

text: We have two ALT linux servers with real IPs. They both are in intranet via commutator. Each of them also has an additional LAN network interface. We want to connect these servers to each other additonally via patch-cord. Is it possible to build bridge with these two interfaces on such network configuration on both servers only for intranet keeping internet connections with same IP-s? Will such solution hurt existence configuration? ![enter image description here](http://i.stack.imgur.com/TnFe3.png)


title: NTP server not working properly

text: I have installed a very simple NTP server on a Red Hat server I own, the configuration is pretty basic:               driftfile /var/lib/ntp/drift     restrict default kod nomodify notrap      restrict -6 default kod nomodify notrap      restrict 127.0.0.1      restrict -6 ::1     restrict 192.168.200.0 mask 255.255.255.0 nomodify notrap     server 0.rhel.pool.ntp.org     includefile /etc/ntp/crypto/pw     keys /etc/ntp/keys      If I try to test this from localhost, it seems to work properly:               ntpq -p localhost          remote           refid      st t when poll reach   delay   offset  jitter     ==============================================================================      gw-ge.esaote.co 62.48.53.90      3 u   56   64  173   81.474  -163823 67736.2      If I try to query it from a remote machine, same result:               ntpq -p 192.168.200.151          remote           refid      st t when poll reach   delay   offset  jitter     ==============================================================================      gw-ge.esaote.co 62.48.53.90      3 u    -   64  367   75.500  -163838 61828.5      But, if I invoke `ntpdate`, doesn't work:               ntpdate 192.168.200.151     12 Mar 10:35:51 ntpdate[2688]: no server suitable for synchronization found


title: Sending most recently created file via Email

text: I'm trying to send a log file every 24 hours or so via email. Currently I am using mutt for this. You can call mutt like this:               mutt -s "Log" -a file_attachment example@example.com       I know I can list the most recently created files using find and mtime but I want to be able to define a bash function that will find the most recently created file in a directory and then send it as an email attachment. How can I accomplish this?


title: udev rules for PS/2 and game port don't match on attr, only env

text: When I build rules for either a PS/2 or game port connected device, udev will never match on attributes, but it will on environment values. The reason why this is an issue can be seen in the output below. The given environment values are rather unspecific, it isn't clear what devices are being referenced in the rules, while the attribute values can be very clear with the actual device name. Especially in the case of my Gravis GamePad, which has very esoteric ENV values, but an ATTR name of "Gravis GamePad Pro". This works:               ENV{XKBMODEL}=="pc105", RUN+="keymap $name microsoft-internet-keyboard"      This does _not_ work:               ATTR{name}=="AT Translated Set 2 keyboard", RUN+="keymap $name microsoft-internet-keyboard"      I get the environment values from running the following:               udevadm info -q all -n /dev/input/event0     P: /devices/pci0000:00/0000:00:1e.0/0000:02:04.0/gameport0/input/input5/js0     N: input/js0     S: input/by-path/pci-0000:02:04.0-joystick     E: DEVLINKS=/dev/input/by-path/pci-0000:02:04.0-joystick     E: DEVNAME=/dev/input/js0     E: DEVPATH=/devices/pci0000:00/0000:00:1e.0/0000:02:04.0/gameport0/input/input5/js0     E: ID_INPUT=1     E: ID_INPUT_JOYSTICK=1     E: ID_PATH=pci-0000:02:04.0     E: ID_PATH_TAG=pci-0000_02_04_0     E: ID_SERIAL=noserial     E: MAJOR=13     E: MINOR=0     E: SUBSYSTEM=input     E: UDEV_LOG=3     E: USEC_INITIALIZED=3244030793      And the attribute values from running:               udevadm info -n /dev/input/event0 --attribute-walk          Udevadm info starts with the device specified by the devpath and then     walks up the chain of parent devices. It prints for every device     found, all possible attributes in the udev rules key format.     A rule to match, can be composed by the attributes of the device     and the attributes from one single parent device.            looking at device '/devices/platform/i8042/serio0/input/input0/event0':         KERNEL=="event0"         SUBSYSTEM=="input"         DRIVER==""            looking at parent device '/devices/platform/i8042/serio0/input/input0':         KERNELS=="input0"         SUBSYSTEMS=="input"         DRIVERS==""         ATTRS{name}=="AT Translated Set 2 keyboard"         ATTRS{phys}=="isa0060/serio0/input0"         ATTRS{uniq}==""         ATTRS{properties}=="0"            looking at parent device '/devices/platform/i8042/serio0':         KERNELS=="serio0"         SUBSYSTEMS=="serio"         DRIVERS=="atkbd"         ATTRS{description}=="i8042 KBD port"         ATTRS{bind_mode}=="auto"         ATTRS{extra}=="0"         ATTRS{force_release}=="369-370"         ATTRS{scroll}=="0"         ATTRS{set}=="2"         ATTRS{softrepeat}=="0"         ATTRS{softraw}=="1"         ATTRS{err_count}=="0"            looking at parent device '/devices/platform/i8042':         KERNELS=="i8042"         SUBSYSTEMS=="platform"         DRIVERS=="i8042"            looking at parent device '/devices/platform':         KERNELS=="platform"         SUBSYSTEMS==""         DRIVERS==""      When constructing my rules, I'm mainly following the advice from this site which could very well be outdated. In particular, I'm paying attention to the bit which says: > ... it is legal to combine the attributes from the device in question and a > single parent device, you cannot mix-and-match attributes from multiple > parent devices - your rule will not work.


title: Configuring iptables by software

text: Is there a software, or a linux distro which has such a software built-in, which makes configuring the iptables easier? If not, I thought that some of the mostly used configuarations with a simple GUI can make it easier but I couldn't find any. Do you think it's a need? If there is, how can I find it?


title: Other Programs Cannot Connect To MySQL

text: So just recently when installing php-fpm, I had installed a few MySQL packages with it (I believe). I already had mysql installed. However now when any of my programs attempt to access the database, it fails to connect/times out. I can however access the database through ssh (databases, tables, and data are all there). When I searched for installed MySQL software, these are the results:               [root@dev ~]# yum list installed | grep mysql     compat-mysql51.x86_64 5.1.54-1.el6.remi @remi     mysql.x86_64          5.5.39-1.el6.remi @remi     mysql-libs.x86_64     5.5.39-1.el6.remi @remi     mysql-server.x86_64   5.5.39-1.el6.remi @remi     php-mysql.x86_64      5.4.31-1.el6.remi @remi      So is this the issue? Or is there another reason none of my programs can connect?


title: Converting html table into ncurses-like ascii table?

text: I have some documentation in an html table. I want to convert the table to an ascii table, like you see when you get a mysql command line result back, like this:               +------------+------------+     | header     | header     |     +------------+------------+     | cell data  | cell data  |     +------------+------------+     | cell data  | cell data  |     +------------+------------+      ... so I can include it in some code comments. How could I do this easily? I was thinking piping the output of lynx into a file, but lynx doesn't put ascii borders around tables :P I also want to control cell width, so that the content cells don't spill outside the accepted screen width of the code.


title: emacs does not see my fonts in gentoo

text: I copied my ~/.emacs file from ubuntu linux; I've installed Consolas font (and it works in gnome terminal, and as a default Monospace font); but Emacs does not see it               (custom-set-faces '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "microsoft" :family "Consolas"))) t))      That's how I set the font in emacs, but it does not work (It worked and still works in Ubuntu) What can I do? Font select menu (menu-set-font, I guess) looks very strange, consists of three options: Misc, Courier and Fontset, and there are no sign of my system fonts


title: Touchpad not recognized on linux (ASUS R751LB)

text: I have just bought a brand new laptop. Unfortunately, touchpad doesn't work on any linux distribution (tried mint Ubuntu 12.04, Ubuntu 14.04, Mint 14, Mint 16, also Mint 16 with recent 3.13.5 kernel). `xinput list` returns:               > Virtual core pointer                      id=2    [master pointer  (3)]     > ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]      `synclient -l` returns: > Couldn't find synaptics properties. No synaptics driver loaded? `dmesg | grep -i mouse` returns: > [ 1.024913] mousedev: PS/2 mouse device common for all mice Touchpad works completely under Windows, even in Windows boot instalation menu. USB mouse works fine under linux. Seems like Linux just doesn't see any touchpad device in my computer. It's ASUS R751LB (more popular name: Asus X750). I already searched almost whole internet and seems like not many people has such an issue as me. Anybody has any ideas how to fix it? BTW. My keyboard fn key also doesn't work. However, I do care about fixing touchpad mostly. I don't think fixing fn key would fix touchpad, even if I have a touchpad toggle on/off button here - even it was turned off, it should be visible by drivers.


title: adduser: Specify only one name in this mode

text: I'm trying to add a user with this command on my debian server:               #!/bin/bash          APPUSER="test1"     APPGROUP="test2"          # User     adduser -c 'uwsgi user' --group $APPGROUP --system --no-create-home --disabled-login --disabled-password $APPUSER      However it tells me I can only specify one name, but I am only specifying one name as far as I can see. What's going wrong?


title: Using multiple layer of kernel modules for interfacing a hardware device?

text: I am trying to get a conceptual understanding of the purposes the kernel modules can have. The motivation for this question was a realization that interface to an actual hardware goes through multiple kernel modules. For example, the USB gadget driver has multiple kernel modules, where only one is used to actually communicate with the hardware. ( http://www.linux- usb.org/gadget/ ) What is the reason of implementing this "kernel module stack" structure? Doesn't it just complicate the process of getting a hardware device to work (you have to worry that you have 3 modules running instead of one)?


title: How do I upgrade the Debian Wheezy kernel offline?

text: I using Debian ( _Wheezy_ ) with the `3.2.0-4` `amd64` kernel version and want to upgrade my kernel to newest version, like `3.13.3 stable`, but I have no internet connection to my Debian OS. I have installed both of "usb-modeswitch" and "usb-modeswitch-data" packages but Debian doesn't detect my 3g-modem-usb dongle. I've downloaded the `3.13.3 tar.xz` kernel source from `kernel.org`. How can I compile and upgrade from 3.2 to 3.13.3 without an internet connection?


title: What is the minimum size for the medium used to clone a damaged hard drive?

text: I'm currently in the business of recovering data from a damaged---and dying--- hard-drive (check this question for background info). The damaged hard-drive is 250GB, and I intend to use `dd` or `ddrescue` to clone what is left of the disk (as suggested in How to clone a NTFS partition (WinXP) from a damaged disk to a new one?). For such a cloning operation, is a healthy 250GB external hard-drive sufficient? Or must the drive be bigger than that (say, 320GB)? And if the damaged source disk is indeed one sector _larger_ than the healthy destination disk, how exactly could this impact/confuse `dd` or `ddrescue`? * * * **EDIT:**   In the end I got the new disk and it is sector for sector the same size as the damaged disk: 488397168 sectors.


title: Command for display of Memory usage, Disk Usage and CPU Load

text: I want to diplay the Memory usage, Disk Usage and CPU Load in the following format:               Memory Usage: 33/512MB (6%)         Disk usage: 4.2/20GB (23%)      CPU Load: 0.01      How can I do that?


title: sed - how to replace either space or underscore_word

text: Currently I have this sed:               sed -i '/[^}.to]\.to[[:space:]]/ s/\(\S\)/expect(\1/' ../_spec_seded/"$file"      which adds "`expect(`" at the start of lines that have "`.to`" (but not "`{.to`") How can I make this so that it matches lines with both "`.to`" and also "`.to_not`"? I tried               sed -i '/[^}.to]\.to([[:space:]]|_not)/ s/\(\S\)/expect(\1/' my_file      basically changing `[[:space:]]` to `([[:space:]]|_not)` to try and match `.to` OR `.to_not` but this messed it up for both, not adding the expect at the start.


title: How to setup permission for virtfs in system libvirtd

text: I have troubles setting up the permissions for virtfs. I need to share a folder with several VMs in a way that user (same username, uid and gid on guests and host) can access it (have full permissions). I've tried various options but none gives the user the right permissions even with `access=client` option (of course the filesystem, ext4, is mounted with `user_xattr` and I've checked that I can set flags). How to setup virtfs in such configuration? I'll use NFS for a time but virtfs should be faster. **EDIT** : It looks like mapped permission works if the file is created from within the VM and passthrough permission works for root but not other users - noone can access not-root owned files from guest and permission cannot be changed to non-root.


title: NodeJS for Slackware

text: I want to run NodeJS on Slackware based distro named PuppyLinux. Since I am used to Ubuntu and CentOS (the simple Linux land), I found it pretty hard to find a NodeJS package to run on Slackware. I tried building it from source, but it took loooong time to install `gcc` and dependencies and then I found some silly compilation errors (can't find errno.h!) Are there any NodeJS (and npm) binaries to run on Slackware? Any one succeeded to build it?


title: ck patch for Linux 3.13

text: Does anyone have any news about the -ck patches for Linux 3.13 kernel tree? I've checked here but there's nothing yet...


title: How to enable two network interfaces both for internet in ubuntu12.04

text: My physical server A has two interfaces: eth0 and eth1. I intend to enable the two network interfaces both for internet in ubuntu12.04. I configure the /etc/network/interfaces as below:               auto lo     iface lo inet loopback     auto eth0     iface eth0 inet static     address 10.10.101.105     gateway 10.10.101.254     netmask 255.255.255.0     auto eth1     iface eth1 inet static     address 10.10.101.205     gateway 10.10.101.254     netmask 255.255.255.0      And the output of ifconfig is shown below:               eth0      Link encap:Ethernet  HWaddr e0:db:55:25:ed:10               inet addr:10.10.101.105  Bcast:10.10.101.255  Mask:255.255.255.0               inet6 addr: fe80::e2db:55ff:fe25:ed10/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1148531 errors:0 dropped:0 overruns:0 frame:0               TX packets:554215 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:1636019748 (1.6 GB)  TX bytes:40068201 (40.0 MB)               Interrupt:35          eth1      Link encap:Ethernet  HWaddr e0:db:55:25:ed:11               inet addr:10.10.101.205  Bcast:10.10.101.255  Mask:255.255.255.0               inet6 addr: fe80::e2db:55ff:fe25:ed11/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:56699 errors:0 dropped:0 overruns:0 frame:0               TX packets:6 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:4077879 (4.0 MB)  TX bytes:492 (492.0 B)               Interrupt:38          lo        Link encap:Local Loopback               inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:124891 errors:0 dropped:0 overruns:0 frame:0               TX packets:124891 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0               RX bytes:1484482588 (1.4 GB)  TX bytes:1484482588 (1.4 GB)      So, I think both the 2 network interfaces are up. However, I find I can access my physical server A from host B only via eth0(10.10.101.105), and fail to access it via eth1(10.10.101.205). When I use route -n to check the router table in my server, it shows:               vli05@vli05:~$ route -n     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         10.10.101.254   0.0.0.0         UG    100    0        0 eth0     10.10.101.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0     10.10.101.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1      What am I doing wrong? PS: The host B I am using ping command is in the same subnet of the physical host A I mentioned above. I just want to use ping to access the physical host A both via eth0(10.10.101.105) and eth1(10.10.101.205). Besides, the Output of `$ sudo netstat -tapn | grep :22` is shown below:               tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN                           1180/sshd     tcp        0      0 10.10.101.105:22        10.10.18.35:57651       ESTABLISHED                      13235/sshd: zjuvlis     tcp6       0      0 :::22                   :::*                    LISTEN      In this case, I am using host with IP 10.10.18.35 to ssh 10.10.101.105. But I fail to ssh 10.10.101.205(the corresponding IP of eth1) What's more, when I debug using telnet,               root@CO:/home/dujun/work_git/Ruby_reference/trace_ruby_code# telnet 10.10.101.205 22     Trying 10.10.101.205...     Connected to 10.10.101.205.     Escape character is '^]'.     SSH-2.0-OpenSSH_5.8      The result is same as `telent 10.10.101.105 22`


title: Can you provide an example use for `zrun`?

text: I was reading the manual pages for the package moreutils but I did not understand the page for `zrun`. My manual page is almost the same as the die.net one:               ZRUN(1)                                                                ZRUN(1)                    NAME            zrun - automatically uncompress arguments to command          SYNOPSIS            zrun command file.gz [...]          DESCRIPTION            Prefixing a shell command with "zrun" causes any compressed files that            are arguments of the command to be transparently uncompressed to temp            files (not pipes) and the uncompressed files fed to the command.                 This is a quick way to run a command that does not itself support            compressed files, without manually uncompressing the files.                 The following compression types are supported: gz bz2 Z xz lzma lzo                 If zrun is linked to some name beginning with z, like zprog, and the            link is executed, this is equivalent to executing "zrun prog".          BUGS            Modifications to the uncompressed temporary file are not fed back into            the input file, so using this as a quick way to make an editor support            compressed files won't work.          AUTHOR            Copyright 2006 by Chung-chieh Shan <ccshan@post.harvard.edu>                    moreutils                         2010-04-28                           ZRUN(1)      Can you provide an example use?


title: How to set automatically permission at automount without mask

text: I store my data on a NTFS parition to share it with my Windows. I use the dmask,fmask option in my fstab entry to avoid rwx default permissions to everyone, for coherence, security, and also because my zsh color profile rendering is then ugly when listing.               /dev/sda5       /mnt/Data       auto    defaults,force,rw,uid=1000,gid=1000,dmask=027,fmask=137   0   0      the problem with f/dmask is that I can't change related permissions of files once it's mounted. For example, I have unix scripts stored there and when I try a chmod +x the mask automatically discards any changes even in root. I thought about removing masks and execute automatically this kind of script :               chown -R me /mnt/Data     find -type f /mnt/Data -exec chmod -R 640 {} \;      but it isn't very elegant and can be very long for large amount of little imbricated files/directory. Is there any way or unknwon (at least from me) option of mount to do that ?


title: Disable PIN request for pairing on Raspbian

text: I'm running a Raspberry Pi with Raspbian Wheezy. I have a BT (Bluetooth) dongle attached to one of the USB ports (I have a model B RPi), I've downloaded and installed the following packages: bluez-utils, blueman, bluetooth and libbluetooth-dev, and all works fine. **But I have a question** : is it possible to disable the PIN request on my RPi side when I try to connect from a mobile phone? I know how to configure the PIN for the mobile phone, but I don't want my RPi asking for a PIN to pair the mobile phone.


title: How to measure rlogin time?

text: I need to monitor the time it takes to rlogin from one HP-UX machine to another. So I wrote this:               #!/bin/sh     result=`rlogin 10.10.10.1 << EOF     exit     EOF`     result2=`{ time $result >/dev/null; } |& grep real`     echo $result2      This shellscript works when I run it on a Linux machine, but for some reason it doesn’t work when I run it on HP-UX. Both are using /bin/sh. Why doesn't it work on HP-UX?


title: How to set up an encrypted directory to be mounted only during samba access?

text: (This is not about restricting client access, for which ext3 permissions do the trick) I'd like to encrypt the data on my NAS drive (Buffalo LinkStation Pro with SSH access enabled, if that matters) in a user-friendly way. Currently, a truecrypt container has to be manually mounted via SSH and also unmounted again (unless you solve my timeout question). Using a passwordless (but EFS encrypted) SSH key this is reduced to two PuTTY desktop shortcuts and entering the truecrypt password (until simplified further) for mounting. However, the ideal solution would be transparent. I first thought about trying to somehow have the share allow for EFS encryption, but that would probably involve more work and EFS for multiple users without an Active Directory server seems to be troublesome. But now my idea is an automated mount of e.g. an EncFS encrypted directory triggered automatically by a samba access from authorized users (using Windows clients). How can that be achieved? (Bonus points for displaying a honeypot share for unauthorized users...)


title: User's name appears as "bash-3.0" on SSH shell

text: I am working on a Redhat server and one of the users' names appears as "bash-3.0" on the "SSH Secure Shell Client." His name is appearing correct under `/etc/passwd`. How could this happen?   How can I fix this?


title: Equivalent of date --reference in Solaris

text: The GNU implementation of the `date` command has a nice feature to show the date of the last modification of a reference file, and using the `+FORMAT` parameter it is easy to get the date in any format, for example:               date -r /etc/motd +%Y%m%d_%H%M%S     # output in the format: 20121001_171233      Is there an equivalent in Solaris? I know I can do it using the `stat` function of `perl` like this:               perl -mPOSIX -e 'print POSIX::strftime("%Y%m%d_%H%M%S\n", localtime((stat("/etc/motd"))[9]))'      But isn't there a more elegant way? **UPDATE** This gives the same output as the perl script and it's "easier" for me:               ls -Ego /etc/motd | awk '{print $4 "_" $5}' | tr -d :- | sed -e 's/\..*//'      And yeah, probably there's no more elegant solution.


title: Kill many instances of a running process with one command

text: This is one of the questions that has troubled me often. Suppose I have thousand or more instances of any process(for e.g. say the process `vi`) running. How do I kill them all in one single shot/one line command/One command ? Any information provided will be appreciated ?


title: Something to convert a makefile.am to project in Visual Studio (2005)

text: I'm interested in porting a library to Windows so that I can contribute to this library's project. This library has a Makefile.am, and I can sort of figure out how the library should be built (but I'm fairly new to the concept of makefiles). I was wondering if there is an automatic way to translate a Makefile.am into something that Visual Studio 2005 can use. What I know so far: I do see that there are directives in the library's Makefile.am for building to a Windows target (i.e `if BUILD_WINDOWS ...some stuff... endif`). I also know that there's AutoMake for Windows, which generates the Makefile.in from the .am, but I have a knowledge gap as to how this Makefile.in would then be used. (Still researching this avenue). Is my only course to convert the makefile manually into a VS2005 project? It seems like it is easier to convert from Windows to Linux, but that may be just my imagination. Thanks for all your help!


title: Test command in unix doesn't print an output

text: When I type this in the terminal               test 4 -lt 6      I don't get any output. Why not? I need that 0 or 1


title: Do you need a shell for SCP?

text: I'm allowing a friend a local account on my machine, exclusively for SCP. Can I specify his account's shell as `/bin/true`, or in any other way limit the account, while still allowing SCP?


title: I want to make both Control keys as a Super key

text: I want to make both Control_L and Control_R as a Super key (Windows Key). Is this possible? I only made Control_R as a Super key but I could not make Control_L. Here is what I done.               xmodmap -e 'remove mod4 = Hyper_L'                         xmodmap -e 'add mod4 = Control_R'       This is xmodmap output:               shift       Shift_L (0x32),  Shift_R (0x3e)     lock           control     Control_L (0x25),  Control_L (0x42)     mod1        Alt_L (0x40),  Meta_L (0xcd)     mod2        Num_Lock (0x4d)     mod3           mod4        Control_R (0x69),  Super_L (0x85),  Super_L (0xce)     mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)      By the way, I made Caps_Lock as an additional Control_L, so I am not sure if this is the problem.


title: How to run a shell command in a server?

text: I am fairly familiar with computers and web stuff but this is a bit out of my comfort zone. I have a shell script (.sh file) I want to run in a Linux server I have one site hosted (the script is a backup script for a CMS I have installed on that server), but I have no clue on how to do it. Going through cpanel the only relevant thing I found was the SSH/Shell Access menu, and that prompts me to generate some key which I reckon should be used in a local software or something to connect to that server from my desktop, but I have no idea on what to do, where to go from here. I also heard something about Putty or whatever it is to use that same key but I opened that software and I am completely clueless. Pardon my extreme ignorance in the subject, also I hope this is the indicated Stack Exchange to ask this question.


title: Discrepancy between the two expansions

text: If you input the command `ls *` and `echo *`, you will notice the remarkable discrepancy between the results. The former recursively includes while the latter totally excludes files in subdirectories. Don't they behave the same for pathname expansion？


title: Linux realtime file sync

text: My QNAP NAS running, I believe, a version of busybox has the ability to setup synchronization to an external drive. In the UI the user selects the folders that they wish to synchronism and then the method of operation of the synchronization process. Options include: sync when drive attached; sync on a schedule; realtime syncing. The other options present make me believe that the underlying sync mechanism is just rsync and a schedule can obviously be achieved via cron. However I am interested in how the syncing is kicked off via drive attachment and in realtime as I wish to try and replicate some of this functionality on my Mac. Perhaps this could be achieved via something like Carbon Copy Cloner (which I have) but I am interested in knowing whether this is possible via the command line.


title: Find Directory and copy another directory to found directory?

text: I'm attempting to find a directory A that could be in a variable location and copy another directory B into the found directory. So, I'd like to find directory `A`, and copy Directory B into Directory A.               find -name "foo.bundle"; cp directory B into the found directory.      If there are multiple matching A directories, I want to copy B to each of them.


title: Does the inverse command of cut exist?

text: First question, so if the format's not correct, sorry! I like using the `cut` command in Linux with the `-c` flag. However, I'm interested in finding a command that sort of does the set inverse of `cut`. Essentially, given the input:               drwxrwxrwx 2 root root 4096 4096 4 20:15 bin     drwxrwxrwx 2 root root 4096 4096 4 20:15 Desktop      I would like to see everything _except_ “4096 4 20:15”. Here is the output:               drwxrwxrwx 2 root root bin     drwxrwxrwx 2 root root Desktop      I want to be able to literally cut out between characters x and y, if that makes sense. Any ideas? I can't imagine it'd be a hard script to write but if there already exists a command for it, I'd love to use it.


title: how to suppress bash octal number interpretation? (to be interpreted as decimal)

text: I have this:               date +"%H hours and %M minutes"      I use festival to say it up.. but it says like: "zero nine hours".. I want it to say "nine hours"! but date always give me 09... so I wonder if bash can easly make that become just 9? in the complex script I tried like               printf %d 09      but it fails.. not octal :( any idea?


title: Using GNU Parallel With Split

text: I'm loading a pretty gigantic file to a postgresql database. To do this I first use `split` in the file to get smaller files (30Gb each) and then I load each smaller file to the database using `GNU Parallel` and `psql copy`. The problem is that it takes about 7 hours to split the file, and then it starts to load a file per core. What I need is a way to tell `split` to print the file name to std output each time it finishes writing a file so I can pipe it to `Parallel` and it starts loading the files at the time `split` finish writing it. Something like this:               split -l 50000000 2011.psv carga/2011_ | parallel ./carga_postgres.sh {}      I have read the `split` man pages and I can't find anything. Is there a way to do this with `split` or any other tool?


title: How to make SLiM not render anything at login prompt?

text: I've just figured I don't actually need an image when logging into slim, especially if that image is a few megabytes large. Currently they're both set to 1x1 png images, however, then that image has to be rendered a few million times each frame, which isn't quite efficient either. How can I disable both the background image and the panel image in SLiM?


title: Remove watermarks from pdf file

text: Is it possible to remove annoying watermarks from `pdf` file in Linux? For example, every page contains text > This file was merged by application XY.


title: How to fix tab completion so it doesn't hide entries?

text: I'm using oh-my-zsh on Mac OS X with homebrew'ed zsh 4.3.12. I stumbled recently on a weird problem. In `scripts/not-used` I have several `.R` files:               breakdowns.R             eventloop.R              process-largeclients.R   process-qt.R     reprocess-pinning.R      calculate-qt-error.R     generate_decision_tree.R process-net.R     process-scalingexp.R      However, when I try `ls scripts/not-used/`+`Tab` the first completion is `ls scripts/not-used/_.R` where `_` represents cursor position. If I press `Tab` again, I get this weird completion:               $ ls scripts/not-used/.R                                                                               breakdowns.R  eventloop.R      How to unset this ugly (wrong) behaviour? The options that are set are:               alwaystoend autocd autonamedirs autopushd cdablevars completeinword     correctall extendedglob extendedhistory noflowcontrol     histexpiredupsfirst histignoredups histignorespace histreduceblanks histverify     incappendhistory     interactive login longlistjobs monitor promptsubst      pushdignoredups pushdminus pushdsilent pushdtohome     sharehistory shinstdin zle


title: Installing NetworkManager without internet connection

text: I have a slight problem, I uninstalled my Network Manager in Fedora Core 15, why I did this was because it did not show anymore, I thought I will re- install it using my wireless connection but I now can't connect to my wireless connection any longer, is there a way to install Network Manager to that Pc without any Internet Connection by using a RPM file that I can download from my other PC and then install it to my no internet pc, so that it can work again? Also what steps can I take if this is not possible to get Network Manager installed again?


title: Offline documentation of an RPM spec file or how to retrieve an example

text: I am taking a Red Hat exam that is offline. I am having issues remembering the syntax for an RPM SPEC file. Can anyone suggest how to retrieve an example or some documentation that should already be in the system? Cannot seem to find anything like that. (This is not cheating. We are allowed to use anything on the system.)


title: AUR and pacman GUI frontend for Arch

text: Do you know any good GUI for pacman and arch? Where I could view packages installed and possible to install? And of course do anything as in pacman.


title: How to enter non-ascii characters using hex or octal codes in vi

text: I'm trying to write a golfing library for postscript. But it needs to be condensed itself. So I need a convenient way to type-in arbitrary bytes within mostly ascii text. I know this can easily be done with absolutely any programming language, but can I do it in vi? (`:help octal` was no help).


title: Clear setuid permission using numeric mode

text: On an Ubuntu Linux I have a directory with the setuid bit set (`drwsr-xr-x`) which I want to unset. Neither `chmod 755` nor `chmod 0755` nor `chmod 00755` (I though maybe the first 0 is interpreted as just "this is octal") cleared the setuid bit. However, `chmod u-s` did. What is the correct numeric mode to clear the setuid bit?


title: midnight commander: rules for accessing archives through VFS

text: `Midnight Commander` uses virtual filesystem (`VFS`) for displying files, such as contents of a `.tar.gz` archive, or of `.iso` image. This is configured in `mc.ext` with rules such as this one (`Open` is `Enter`, `View` is `F3`):               regex/\.([iI][sS][oO])$         Open=%cd %p/iso9660://         View=%view{ascii} isoinfo -d -i %f      When I press `Enter` on an `.iso` file, `mc` will open the `.iso` and I can browse individual files. This is very useful. Now my question: I have also files which are disk images, i.e. created with `pv /dev/sda1 > sda1.img` I would like `mc` to "browse" the files inside these images in the same fashion as `.iso`. Is this possible ? How would such rule look like ?


title: File access after fsck very slow for first-time access?

text: My drive started to show up errors, I unmounted it and ran `fsck` on it. It's a 2TB drive installed on Debian Squeeze, using `ext3`. The `fsck` too about 17 hours. I found some, luckily mostly unimportant, files in `lost+found`. But when I tried to access anything on that FS, first time access (reading directory listing, reading file information, reading file data) is very slow and takes up to one or two seconds. Accessing anything a second time seems to be normal. Given that I've around 1.5TB data on it, that's a lot times for "first access after mount". However, I don't see anything in the logs regarding this, how can I figure out what is going on? Is this normal?


title: Can a RHEL 6.4 DS sync with a CentOS 5.4 DS

text: I have two CentOS 5.4 Directory Servers that sync information on a daily bases. I'm wanting to replace them with two RHEL 6.4 Directory Servers. Before the existing two are decommissioned all four need to be syncing on a daily basis until we are certain there aren't going to be any issues. Essentially the RHEL DS and the CentOS DS directory servers are the same things so I'm betting that they can sync, but my main question is if a RHEL 6 DS can sync with a RHEL/CentOS 5 DS? Again I'm thinking they can because the database should be nearly the same for both, but I'm hoping someone knows for certain. If they can't natively sync I'm hoping find the best way to configure them so that they can. My last issue is that the RHEL6 DS will have an additional schema (Samba). If the older DS doesn't have that schema will it just be left out when the servers sync?


title: not all initrd.img's are born equal?

text: I am trying to get a Red Hat 5.8 box booting via pxe. The box is a virtual machine on ESX5.0 it has a Paravirtual SCSI Controller and VMXNET3 network driver. Now these drivers do not come default in the RHEL5.8 kernel so I have followed some steps on the net to make my own initrd.img file. This is not yet working and any advice on how to get this done would be appreciated. However the main aim of my question is the following: on my imported repo there is at least two places where initrd.img files are available:               cobbler/ks_mirror/OEL5.8-x86_64/isolinux/     cobbler/ks_mirror/OEL5.8-x86_64/images/pxeboot/      I am curious to understand what the difference is. A small white lie, I am using Oracle Linux, not by choice, but is should be the same for all intents and purposes. I would also like to understand what the difference is between the initrd.img file that can be found in the /boot directory after a server is installed and the one found on the CDROM and/or cobbler repository. If I copy the initrd.img file from a box with vmwaretools installed, I get a kernel panic when trying to boot of the initrd.img file. There is a size difference so I have assumed that essentially the difference is that one contains more drivers and the other only drivers important to the server, but why the kernel panic. I feel that I am following instructions on the web on building or adding more drivers to my kernel a bit blindly and that if I understand slightly better what I am doing then maybe I will know where it goes wrong.


title: File size :size of content and what is seen different

text: Assume you have a file 342MB but when you get into that file and look the content of it; you see that everything occupy around 92 MB. No hidden file or any other thing exist on it. How can that be possible. Is there a solution to fix this. Here is before and after mount               /data>du -sh *     342M   backup               /mnt> du -sh *     4K   etc     79M   kernel     8K   lost+found     13M   platform      * * * **Edit** : Someone suggested hidden files, but there aren't any:               /mnt> ls -alrt     total 44     drwx------   2 root     root        8192 Mar 20 08:16 lost+found     drwxr-xr-x   2 root     root         512 Mar 20 08:16 etc     drwxr-xr-x  15 root     sys          512 Mar 20 08:16 kernel     drwxr-xr-x   6 root     root         512 Mar 20 08:16 .     drwxr-xr-x  41 root     root        1536 Mar 20 08:16 platform     drwxr-xr-x  41 root     root        9216 Apr  5 19:47 ..               df /mnt     /mnt               (/dev/lofi/2       ):  466192 blocks   162531 files      The command that show my backup file is 342 MB                du -sh backup      342M   backup      The command I used for mounting this backup file               lofiadm -a /home/backup     mount -F ufs /dev/lofi/2 /mnt      df -g output :                df -g /mnt      /mnt               (/dev/lofi/2       ):    8192 block size    1024 frag         size      657548 total blocks     466192 free blocks   400438 available   163520 total files      162531 free files     38535170 filesys id      ufs fstype       0x00000004 flag             255 filename length      du -s output :                du -s /mnt      189292  /mnt


title: Autotools does not detect my architecture correctly. How to handle?

text: I am trying to build the latest ffmpeg from the git repo. However, as you can see below, autotools does not detect correctly that **my box has 64-bit architecture (Ubuntu 12.04)**. Consequently, during the build, some x86 libs are required, but not present, and the build fails. How do I tackle this? > mvitkov@mms:~/projects/ffmpeg/build$ ../ffmpeg/configure --enable-shared   >  output:   >  _install prefix /usr/local   >  source path /home/users/mvitkov/projects/ffmpeg/ffmpeg   >  C compiler gcc   >  ARCH x86 (generic)_ On the other hand, autotools usually works fine: > mvitkov@mms:~/projects/x264/build$ ../x264/configure --enable-static output:   >  *platform: X86_64*


title: Gedit won't save a file on a VirtualBox share: Text file busy

text: I have a text file that I can change using other applications (for example `openoffice`). But when I try to change and save it using `gedit`, I am getting error from `gedit`:               Could not save the file /media/sf_Ubuntu/BuildNotes.txt.     Unexpected error: Error renaming temporary file: Text file busy      the permission of BuildNotes.txt is as follow:               -rwxrwx--- 1 root vboxsf  839 2012-10-26 12:08 BuildNotes.txt      and user id is:               m@m-Linux:/media/sf_Ubuntu$ id     uid=1000(m) gid=1000(m) groups=4(adm),20(dialout),24(cdrom),46(plugdev),105(lpadmin),119(admin),122(sambashare),1000(m),1001(vboxsf)      What is the problem and how I can fix it?


title: Printing colored text using script

text: When I type below command in the shell I get the OUTPUT in green color. **Command**               echo "\033[32mCONNECTING TO abpwrk\033[m";      **Output** (in green color)               CONNECTING TO abpwrk      But if I use the same statement in a small one line script and execute it.Then I get the output(in white color).               \033[32mCONNECTING TO abpwrk\033[m      What am I missing in the script.Do I need to define some extra parameters to initiate colors ? I am using k-shell.


title: nsswitch.conf versus host.conf

text: Suppose that `/etc/nsswitch.conf` file contains               hosts: files dns      and `/etc/host.conf` file has               order bind,hosts      then in which order the system would use `/etc/hosts` and DNS look-up to resolve a host name? In other words, which of the two configuration files takes precedence?


title: How to correctly remove mountnfs from /etc/init.d/

text: Cleaning up the boot process of a Debian squeeze installation running on kernel 3.2.0-0.bpo.3-amd64, I spotted several mountnfs scripts in /etc/init.d/:               # ls /etc/init.d/ | grep mountnfs     mountnfs-bootclean.sh     mountnfs.sh     umountnfs.sh      Removing fails, with commands like:               # update-rc.d -f mountnfs remove     update-rc.d: using dependency based boot sequencing      For " _mountnfs_ ", I have also tried: umountnfs, mountnfs-bootclean, nfs, nfs-common. **Update #1** Also tried without success: umountnfs.sh, mountnfs.sh. The result is that the mountnfs-bootclean, mountnfs and unmountnfs.sh are still in /etc/init.d/ and their corresponding run level folders. Just removing those files using `rm` doesn't seem the right way. I though that these init.d files belong to installed packages. However I can't really find any installed NFS package:               # dpkg --get-selections | grep nfs     libnfsidmap2                    install      How do I correctly remove all mountNFS scripts from init.d?


title: Connecting to wireless router

text: According to this manual I tried:               $ iwconfig     lo        no wireless extensions.          eth1      IEEE 802.11bg  ESSID:"g\xC6isQ\xFFJ\xEC)\xCD\xBA\xAB\xF2\xFB\xE3F|\xC2T\xF8\x1B\xE8\xE7\x8DvZ.c3\x9F\xC9\x9A"                 Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated                  Bit Rate:0 kb/s   Tx-Power=20 dBm   Sensitivity=8/0                 Retry limit:7   RTS thr:off   Fragment thr:off               Power Management:off               Link Quality:0  Signal level:0  Noise level:0               Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:0   Missed beacon:0          eth0      no wireless extensions.          $ sudo ifconfig eth1 up      Then I used wicd from this manual. It will find my wireless router, but when I click `connect`, the phase `obtaining IP address` is endless. I tried:               $ sudo iwlist scan     lo        Interface doesn't support scanning.          eth1      Scan completed :               Cell 01 - Address: C8:3A:35:1F:60:78                         ESSID:"MyDevice"                         Protocol:IEEE 802.11bg                         Mode:Master                         Frequency:2.412 GHz (Channel 1)                         Encryption key:off                         Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 11 Mb/s                                   9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s                                   48 Mb/s; 54 Mb/s                         Quality=97/100  Signal level=-27 dBm                           Extra: Last beacon: 172ms ago          eth0      Interface doesn't support scanning.      Here is the content of `/var/log/wicd/wicd.log` Could you advise me how can I connect and how to correctly set `/etc/network/interfaces`?


title: How to easily maintain the latest versions of Apache/ MySQL/ PHP on CentOS 6.2?

text: We have a few servers running CentOS 6.2 deploying web applications using Apache/ MySQL/ PHP. In the past we've just regularly run "yum update" to keep all the software up to date. As of right now the installed versions are:   * Apache 2.2.15   * MySQL 5.1.61   * PHP 5.3.3 When the latest released versions are:   * Apache 2.4.1   * MySQL 5.5.21   * PHP 5.3.10 We're web developers with a bit of Linux knowledge rather than server administrators so we want to be able keep everything patched to the latest (or near) version without having to go into the depths of compiling software or too much command line jiggery-pokery. What is the best way for us to easily maintain the latest versions (or at least late as possible versions) on CentOS 6.2?


title: Allow incoming connections from Google Translate only

text: I have a small web server running on port 80, and I'd like to allow only Google Translate to have access to it. First I tried running `dig translate.google.com` and `dig translate.googleusercontent.com` to get the IP address for it, which returned addresses ranging from **74.125.234.74** to **74.125.234.110**. Then I opened the mentioned ports, but it did not work. Looking at iptables logs, I found Google has very different IP addresses to open the target website for translation. In a few tests they ranged from **74.125.186.40** to **74.125.187.169**. Now, what I've got so far is the following rule, that opens the door for this range:               -A INPUT -p tcp --dport 80 -m iprange --src-range 74.125.186.40-74.125.187.169 -j ACCEPT      The problems:   1. Everytime Google tries to access the page, it uses a different IP address, and probably **out of the range** I mentioned previously. I'd have to try many many times to take note of all the range.   2. I'm concerned about the security implications also, since I don't know whether all IPs in the range are safe to leave open (would they all belong to Google?) I tried `nslookup 74.125.186.40` to see if I could get a domain name for it, but it returns:               ** server can't find 40.186.125.74.in-addr.arpa.: NXDOMAIN


title: checking data in columns when a data or some may be missing or present?

text: I am not sure if this possible. say i have columns like :               Team      Colour      Game      Rainfall      PlayerName       XYZ       Blue        Cricket   Yes           Kapil      suppose i need to search for any data that is below `Game` i can do it using awk somthing like :                 awk '{for(i=1;i<NF;i++)             {              if($i == "Game")               {               GameData=i               next               }             if( i == GameData )               {               print "Column below Game is" $i               }             }           }'      but what if i am not sure value in some columns can be missing like any one of               XYZ       Blue           could be missing or both could be missing or present. **EDIT** : Lets say first letter `T` of team(first column) is always at the begining and first letter `C` of Colour is always after 10 characters from the begining, first letter `G` of Game is always after 20 characters from the begining and so on.


title: is linux/compiler.h a userspace header?

text: VirtualBox is looking for this file in `/usr/include` but it's missing in gentoo linux-headers Does someone know if that is userspace header and gentoo is missing it? Or if that is not it, then if virtualbox is doing it wrong? actual bug: https://bugs.gentoo.org/show_bug.cgi?id=408611#c6               In file included from /var/tmp/portage/x11-drivers/xf86-video-virtualbox-4.1.10/work/VirtualBox-4.1.10/include/iprt/mem.h:31:0,                      from /var/tmp/portage/x11-drivers/xf86-video-virtualbox-4.1.10/work/VirtualBox-4.1.10/src/VBox/Runtime/common/alloc/alloc.cpp:34:     /var/tmp/portage/x11-drivers/xf86-video-virtualbox-4.1.10/work/VirtualBox-4.1.10/include/iprt/types.h:112:30: fatal error: linux/compiler.h: No such file or directory     compilation terminated.               Reproducible: Always      also tested with kernel 3.6.6, 3.7-rc5 and some other, on virtualbox 4.2.0 4.2.2 4.2.4


title: Hardware problem after fresh Linux Mint install

text: I've installed Linux Mint, Mate 64bit on my machine. > My configuration:   * Desktop PC HP Pro 3400 Series MT   * Processor: Intel Core i3 2120 @3.30GHz   * Chipset: Intel Sandy Bridge   * Graphic Interface: NVIDIA GeForce GT 520 My computer hangs on with a warning, here is a summary:   * Watchdog detected hard LOCKUP on CPU 0   * after a list of modules : last unloaded module CSSI_wait_scan   * PID: 0, comm: swapper/0 Tainted   * After that there is a call trace. Related to this: How to feed linux new install drivers?


title: Linux Mint 15: How to change permission of /opt folder

text: I'm trying install Pycharm Community 3.0.1. I'm extremely new to Linux and don't really know how to install things without explicit instructions (which for more popular software has just been pasting lines of commands into the terminal), which after searching online I've only found the following instructions: Install Pycharm on Linux Mint However trying to move the extracted folder results in a "Permission Denied" error. How would I change the permissions of /opt so I can move the folder? Or is there a better way to install things like this? The original file was a .tar.gz folder.


title: vi / vim - how to automatically strip trailing spaces on save?

text: Is there a `.vimrc` setting to automatically remove trailing whitespace when saving a file? Ideally (to be safe) I would like to only have this functionality for certain files, e.g. `*.rb`


title: Appending timestamp stamp along with log file lines

text: I have a log file and I need to append timestamps to each line as they get added. So I'm looking for script that appends timestamps to each entry in log lines and which could run as a cron job. Could someone please help me with the idea on creating this script?


title: Extrat tar "Cannot open: File name too long"

text: I made a tar with a directory on a remote machine with:               tar -czvf      I scp it to my local machine, where I wanted to untar it:               tar -xzvf      But I get : `Cannot open: File name too long` On my local machine on lubuntu 12.04 I have: `tar (GNU tar) 1.26`. The remote machine is not accessible right now, I'll check the version after if needed. I would like to extract without having to make a new tar, especially since the remote machine is offline. And by the way if you know a way to make proper archive despite long name, I'll take it.


Regarding the output of "df -h" in Linux.               [root@]# df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/sda2             193G   82G  101G  45% /     tmpfs                 1.9G  272K  1.9G   1% /dev/shm     /dev/sda1             486M   28M  433M   7% /boot     /dev/sda3              49G  759M   45G   2% /home     [root@]#      Here I am unable to understand what is `/dev/sda1` `/dev/sda2` `/dev/sda3` `tmpfs` and correspoding Column (`mounted on`) `/boot` `/` `/home` `/dev/shm` .\ Can anyone please explain these terms?


title: Retrieving two matches from repeated pattern

text: How can I retrieve matches from two repeated patterns: `mappedname` & its value in the text below?.               MapName:abc     someDiffName=someDiffValue     x=3     y=6     NeedyMappedName=NeedyMappedValue     .     .     Flag=true      * * *               grep "MapName\|NeedyMappedName" fileName      If I run `awk` on the `grep` output, it will apply to each line so won't give the expected result. The output I would like to get is               abc,NeedyMappedValue      If I run `grep "MapName\|NeedyMappedName" fileName`' it will give me the required two lines. And when I extract the required values with `awk -F ":" '{print $2}'` it will give `abc` & I won't be able to extract the second required match, `NeedyMappedValue` from the filtered grep output. Is there any way to achieve this by running `awk` with some pattern with a different pattern for second line?


title: How can I use tee to print the input stream?

text: I have a pipe line that looks like this:               cat myfile | awk '$3 > 0 { print $1, $2 * $3 }' | tee >(printf) | perl myscript.pl      I would like to print the input to my Perl script using `tee`. How can I do this?