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

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


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

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


title: Find and install man file manually

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


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

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


title: Command to monitor elapsed time in background?

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


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

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


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

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


title: scp stuck when trying to copy files from Linux to windows

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


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

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


title: How do I temporarily bypass an alias in tcsh?

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


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

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


title: how to find the hostname of an X server

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


title: using system command in awk script

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


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

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


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

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


title: How to compare two rfs directories with `diff`?

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


title: Count tabs per line in text file with utils

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


title: Save and clear event and security logs

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


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

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


title: Apache's 000-default.conf - weird behaviour

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


title: Do I need X11 to install other desktop environments?

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


title: Automatically detect multiple monitors

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


title: What is Linux for OpenVMS DIRECTORY/NOHEADING/NOTRAILING?

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


title: How to automate ktutil to immediately list keytab entries?

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


title: Run Xserver as root

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


title: find file read it and search for specific identifier

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


title: Kernel optimiziations for ioctl AF_INET operations

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


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

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


title: USB drive stopped working

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


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

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


title: AIX synchronize directory

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


title: how to view php and server error logs?

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


title: How to pass a string parameter on bash function?

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


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

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


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

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


title: mails being marked as spam

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


title: How to mount some folders on a different partition

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


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

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


title: Yocton embedded Linux and Chromium touch events

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


title: Copy file from cifs mount when a file is changed

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


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

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


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

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


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

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


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

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


title: Change default search name

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


title: Move zsh settings from Arch live to Arch regular

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


title: limiting size of logfile from a variable

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


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

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


title: Fluxbox battery monitor?

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


title: How do I force booting in text mode?

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


title: Can not boot ArchLinux with a Macbook pro 7.1

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


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

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


title: Fn+F2 does not UNMUTE

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


title: yum does not work on RHEL 6.3

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


title: Streaming music to a raspberry pi

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


title: Stripping all vowels but the first from a set of strings

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


title: How to extract bookmarks from a pdf file

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


title: Docker error creating bridge

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


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

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


title: How can I delete text before a delimiter in Linux

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


title: linux bash prevention flocking for background process

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


title: Linux Wifi High Power Consumption

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


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

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


title: IPv6 in IPv4 over LAN

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


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

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


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

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


title: CentOS 6 VSFTP 553 Could not create file

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


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

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


title: Arch Linux not functional after kernel upate

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


title: How to disable HTTP TRACE on OpenBSD 5.3?

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


title: Count occurrences where two fields are equal

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


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

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


title: Alternative to find?

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


title: Why does this command work for logging script output?

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


title: How to change keyboard speed in the Linux console?

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


title: How can I capture an OpenBSD install console?

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


title: Turn off --skip-grant-tables in MySQL

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


title: Unusual vmware.modconfig-console output

text: Upon running a batch file I created to iterate recursive directories from / trying to find the Kernel headers for `vmware-modconfig-console` running on openSUSE, when it comes across /usr/include/ it spits out the below                   /usr/bin/lib/vmware-tools/sbin64/vmware-modconfig-console --validate-kernel-headers          -k 3.4.6-2.10-desktop "/usr/include" -- -l "/usr/bin/lib/vmware-tools/"              In file included from <stdin>:2:0:         /usr/include/linux/version.h:2:2: error: #error         "======================================================="         /usr/include/linux/version.h:3:2: error: #error "You should not include /usr/include         /{linux,asm}/ header"         /usr/include/linux/version.h:4:2: error: #error "files directly for the compilation of          kernel modules."         /usr/include/linux/version.h:5:2: error: #error ""         /usr/include/linux/version.h:6:2: error: #error "glibc now uses kernel header files          from a well-defined"         /usr/include/linux/version.h:7:2: error: #error "working kernel version (as recommended          by Linus Torvalds)"         /usr/include/linux/version.h:8:2: error: #error "These files are glibc internal and may          not match the"         /usr/include/linux/version.h:9:2: error: #error "currently running kernel. They should          only be"         /usr/include/linux/version.h:10:2: error: #error "included via other system header           files - user space"         /usr/include/linux/version.h:11:2: error: #error "programs should not directly include          <linux/*.h> or"         /usr/include/linux/version.h:12:2: error: #error "<asm/*.h> as well."         /usr/include/linux/version.h:13:2: error: #error ""         /usr/include/linux/version.h:14:2: error: #error "Since Linux 2.6, the kernel module          build process has been"         /usr/include/linux/version.h:15:2: error: #error "updated such that users building          modules should not typically"         /usr/include/linux/version.h:16:2: error: #error "need to specify additional include           directories at all."         /usr/include/linux/version.h:17:2: error: #error ""         /usr/include/linux/version.h:18:2: error: #error "To build kernel modules, ensure you          have the build environment "         /usr/include/linux/version.h:19:2: error: #error "available either via the kernel-devel          and kernel-<flavor>-devel "         /usr/include/linux/version.h:20:2: error: #error "packages or a properly configured          kernel source tree."         /usr/include/linux/version.h:21:2: error: #error ""         /usr/include/linux/version.h:22:2: error: #error "Then, modules can be built using:"         /usr/include/linux/version.h:23:2: error: #error "make -C <path> M=/home/abuild/          rpmbuild/BUILD/linux-glibc-devel-3.4"         /usr/include/linux/version.h:24:2: error: #error ""         /usr/include/linux/version.h:25:2: error: #error "For the currently running kernel          there will be a symbolic "         /usr/include/linux/version.h:26:2: error: #error "link pointing to the build           environment located at "         /usr/include/linux/version.h:27:2: error: #error "/lib/modules/2.6.37.6-0.11-xen/build          for use as <path>."         /usr/include/linux/version.h:28:2: error: #error ""         /usr/include/linux/version.h:29:2: error: #error "If you are seeing this message, your          environment is "         /usr/include/linux/version.h:30:2: error: #error "not configured properly. "         /usr/include/linux/version.h:31:2: error: #error ""         /usr/include/linux/version.h:32:2: error: #error "Please adjust the Makefile          accordingly."         /usr/include/linux/version.h:33:2: error: #error         "======================================================="      This looks to be an almost exact copy of the contents of /usr/include/linux/version.h, but what I cant't work out is why this one subdirectory is making the vmware-modconfig-console tool echo the contents of a file in a subdirectory to stdout??


title: How do you play this old unix game?

text: I recently tried the simh emulator, `pdp11`. The disk image I used can be found on the internet, and instructions for booting it are here. Presumably it belonged to Dennis Ritchie, as the username is "dmr". In the /usr/games folder are about 20 games and amusements for wasting expensive computing resources. One game is called 'moo'. I have not been able to find info about this game, but starting it prints:               MOO     new game     ?      Every input I have tried results in the game printing 'bad guess.' Does anyone have experience with this game? Ritchie is dead, so there's no way to ask him directly.


title: Can I move a running application to a different X server?

text: Is there any way to open a graphical program (for instance, gedit) while using X11 forwarding over SSH and transfer the X server connection back to the X server on the SSH host?


title: What steps to add a user to a system without using useradd/adduser?

text: I was browsing through some Linux questions and saw this interesting question. _What steps to add a user to a system without using`useradd`/`adduser`?_ The one possible way that comes to my mind is,   * Add an entry for the user in `/etc/passwd` file.    * Add an entry for the group in `/etc/group` file.    * Create the home directory for the added user.   * Set the new user password using the `passwd` command.  I tested the above approach and it worked fine. Is this the only possible way or is there any other work around to achieve this?


title: Are there any distributions with a working on-the-fly hybrid graphics switcher?

text: vga_switcheroo is used in many distros (including Arch), but it would be nice to have real-time switching.


title: What does <defunct> mean in the output of ps?

text: I had issued the `ps -ef|grep java` command and this is one of the entries that I got :               subhrcho   875   803  0 Jan23 pts/5    00:02:27 [java] <defunct>      What is `<defunct>` implying here ? What state is that process is that process with PID=875 in ?


title: Connect to wifi using wifi-menu

text: I just got a Raspberry Pi (in a kit) and installed Arch Linux on it. I plugged in my WiFi dongle (which came in the kit) and I see that Linux has the driver for it. However, I still cannot connect to my WiFi network. I used `wifi-menu` and I selected my network. I entered the password and hit enter. After a few seconds (~10), I got an error: `Connecting Failed! Do you want to save the profile "MyWifiNetwork"?` Is there something else that I have to do?


title: What is the bug with this script - using 'select' command to print menu in linux

text: OS - Linux 64-bit I am trying to implement a simple menu using `select` command. The script (for testing purposes) is as follows               #!/bin/bash     echo "*******************"     PS3='Select an option and press Enter: '     options=("apache" "named" "sendmail")     select opt in "${options[@]}"     do       case $opt in             "apache")               date               ;;             "named")               echo "test"               ;;             "sendmail")               echo "test 2"               ;;             *) echo "invalid option";;       esac     done     echo "*********************"      The script is not recognizing any valid inputs I give and always prints the "invalid option" on screen. What am doing wrong in this script.


title: What is the best way to manage users across multiple servers

text: I am inheriting about 20 linux servers running different versions of Ubunutu (7 and above). The current setup has people logging in(ssh) with a shared login (it was explained to me that this was done to ease user management) or as root. I assume it would be safer/more customizable to log in to each box using one's own login, right? And sshing in as root is a Bad Thing yes? There's only two of us, but I may want to institute different permissions per user. What would you suggest, while keeping complexity to a minimum?


title: Which Repository do I add to install Gnome 3 on Fedora 14

text: I can't seem to find this anywhere. Also is there a list of repositories for third party software apart from livna? and is there a better package manager like Ubuntu's for Linux?


title: Ruby and Git refuse to update. (Mac)

text: I've been trying to update Git for a while. I'm currently stuck on 1.7.3.4, and I've tried updating to 1.7.4.x, and 1.7.5.x but it never works. Today I compiled and installed Ruby 1.9.2, but it still shows up as 1.8.7. I'm running 10.6.7 on a MacBook Pro. I have no idea why it won't update. Any ideas? :(


title: changing name of some files in bulk

text: > **Possible Duplicate:**   >  Rename all the files within a folder with prefix “Unix_”   >  how can I rename multiple files by inserting a character? Is there a way to make a change in name of some files, for example to append name of each user to files that reside in his home folder that if they moved somewhere can find files of a particular user? I use CentOS 5.5


title: how can I rename multiple files by inserting a character?

text: I have many files of the form sw001   sw002   sw003   ... I want to insert a period between the sw's and the number values. How can I accomplish this?


title: How to modify the permission of jar file exactly same as other machine jar file?

text: I have two machines, In my `machineA` I have a jar file with these permissions -               -rwxr-xr-x 1 cronus app 16758150 2013-03-19 13:35 exhibitor-1.5.1-jar-with-dependencies.jar      In my another `machineB`, I have a same jar file but with different permissions -               -rw-r--r-- 1 root messagebus 19340260 Nov 25 14:28 exhibitor-1.5.1-jar-with-dependencies.jar      How to make the permission of machineB jar file same as machineA jar file? In short, how do I get this permission `-rwxr-xr-x` which I can apply on machineB jar file? And apart from this, can anybody explain me how does this permission work and what does it mean? **UPDATE:-** Thanks Jordan for the link, I am able to understand its meaning now..


title: Setting tabstop for bash output

text: Is it possible to set a tabstop (number of spaces per tab) for the `more` and `less` commands? In vi, I've added this line to `.vimrc`               set tabstop=4      However when I read through a file with `more` it still uses 8 spaces per tab               $ more style.css     div {             width: 100%;     }      Would this be something I could configure in `.bashrc` or a similar file?


title: Using grep to read a paragraph on Solaris

text: How can I grep a paragraph from a file in the Solaris operating system? I tried the `-p` option used in AIX, but it's not useful in Solaris. `grep -p Accept` is not working in Solaris. Is there any other option?


title: ActiveX under Linux

text: Are there any solution besides a Virtual Machine to get ActiveX support under Linux? I mean are there any ways to use IE with wine to get ActiveX?? Or a plugin for Firefox that enables ActiveX?


title: How to recursively move batches of 20 files into numbered folders from folder of 1000 files

text: I have a folder full of 1000 (or more) files. I want to have a script that creates a numbered folder and then moves the first 20 files (ordered by name) into that folder. It should then do this for the other files, increasing the folder number by 1, until all the files are in folders. I've tried the following command but it doesn't do a whole directory automatically and doesn't increment the folder number automatically:               N=1000;     for i in ${srcdir}/*; do       [ $((N--)) = 0 ] && break       cp -t "${dstdir}" -- "$i"     done      How can this be done using bash?


title: Proper way to setup RAID in linux

text: I have installed Debian 7.4 on a server, and through the installer I setup both RAID and LVM for the drive that the OS is installed on. However, now I want to add two 4TB drives in a RAID-1 array to the system, and then add in LVM onto those drives. The question I have is: do I need to partition the drives _before_ I put them in an array? Most of the guides that I have seen will do something like this:               mkfs.ext4 /dev/sdb  #create /dev/sdb1     mkfs.ext4 /dev/sdc  #create /dev/sdc1     mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb1 /dev/sdc1     mkfs.ext4 /dev/md0  #create a filesystem table on the RAID array          #LVM creation on the RAID array     vgcreate vg_name /dev/md0     lvcreate -n lv_name -l100%FREE vg_name     mkfs.ext4 /dev/mapper/vg_name-lv_name     mount /dev/mapper/vg_name-lv_name /mount_point      However, I have just tried the following in a VM, which appears to work properly:               mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb /dev/sdc          #LVM creation on the RAID array     vgcreate vg_name /dev/md0     lvcreate -n lv_name -l100%FREE vg_name     mkfs.ext4 /dev/mapper/vg_name-lv_name     mount /dev/mapper/vg_name-lv_name /mount_point      Is there any difference between these two methods of creating a RAID/LVM array? It seems as though creating a filesystem three times is unnecessary.


title: RAR a folder automatically every x minutes

text: I want to "code" a shell script which will do the following:   * check for new folders in foler XYZ , will make a cron that opens the script every 30mins   * if NEW folders found = use RAR and rar those folders like they are named . XYZ Main Folder: -Blububb Changed: 7.03.2014 -> create rar -> Blubb.rar  So I need some little help in realizing this / tricks tipps how I should start this.               #!bin/bash     for all in `find / -name "rpc-backup*" -type d -print`     do     #create archive     rar -a -k -v250000k /home/testuser/rar1.rar /home/testuser/rpc-backup1          done      So you see I dont have much so far , I need first of all a find command which looks only for new files or changed after the date (7.03.2014) , then also my rar process has to rar every folder he gets individual and not just one big rar where all my folders are in, i want a single rar for every single folder. would appreciate ya'll help. thanks


title: How to disable messages in unix if mesg and chgrp not allowed?

text: This is one of my questions for my exam .. We are not supposed to use `mesg y/n` for this but we should effectively avoid mesgs along with the problem of not being able to change groups.


title: apt-get: hash sum mismatch

text: Running "sudo apt-get update" results in: > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_saucy- > security_main_binary-i386_Packages Hash Sum mismatch > > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_saucy- > security_universe_binary-i386_Packages Hash Sum mismatch > > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_saucy_universe_binary- > amd64_Packages Hash Sum mismatch > > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_saucy_main_binary-i386_Packages > Hash Sum mismatch > > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_saucy_universe_binary-i386_Packages > Hash Sum mismatch > > E: Some index files failed to download. They have been ignored, or old ones > used instead. I have tried to run: > sudo rm -R /var/lib/apt/lists/partial/* > > sudo rm -fR /var/lib/apt/lists/* > > sudo apt-get clean I have also tried the Fix MergeList problems button of the Software Sources tool. I am running Linux Mint 16 Cinnamon 64 bits. In the Update Manager I can see many updates that I should install but attempting to install them results in: > E: Unable to parse package file > /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_saucy- > updates_universe_i18n_Translation-en (1) E: Problem opening > /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_saucy- > security_main_binary-amd64_Packages E: The package lists or status file > could not be parsed or opened. E: _cache->open() failed, please report. Any ideas?


title: xmllint shell not showing number from count xpath expression?

text: I am using xmllint's interactive shell on cygwin. I would like to count the number of nodes, but xmllint doesn't seem to behaving as I expect:               $> cat test.xml     <?xml version="1.0"?>     <result>       <node>         <item/>         <item/>         <item/>         <item/>         <item/>       </node>     </result>     $> xmllint --shell test.xml     / > cat count(/result/node/item)     count(/result/node/item) is a number      It says it's a number, but it doesn't show the number in a manner I've seen from web searches:               count(/result/node/item) is a number : 5      What is going wrong here?               $> xmllint --version     xmllint: using libxml version 20706        compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib


title: USB drive Dell does not work on Lubuntu

text: I'm using Lubuntu 11.10 on Sony Vaio. I got one USB Dell external disk 1tb as this one. But when I connect nothing happens. (even I can feel with my hand that it is running) From `dmesg` I got               [ 2758.780713] usb 2-1.3: new high speed USB device number 4 using ehci_hcd     [ 2758.935542] scsi8 : uas     [ 2758.937160] scsi 8:0:0:0: Direct-Access     Dell     USB Portable HDD 0412 PQ: 0 ANSI: 6      My laptop does not have a usb 3.0 connection. Could this be the problem? Gparted does not show it. Some info here:               Aug 14 19:30:41 vaio kernel: [ 2797.116285] sd 8:0:0:4: [sdh] Mode Sense: 00 00 00 00     Aug 14 19:30:41 vaio kernel: [ 2797.116291] sd 8:0:0:4: rejecting I/O to offline device     Aug 14 19:30:41 vaio kernel: [ 2797.116298] sd 8:0:0:4: [sdh] Asking for cache data failed     Aug 14 19:30:41 vaio kernel: [ 2797.116303] sd 8:0:0:4: [sdh] Assuming drive cache: write through     Aug 14 19:30:41 vaio kernel: [ 2797.116332] sd 8:0:0:7: [sdk] Attached SCSI disk     Aug 14 19:30:41 vaio kernel: [ 2797.116507] sd 8:0:0:4: [sdh] Attached SCSI disk     Aug 14 19:30:41 vaio kernel: [ 2797.116719] sd 8:0:0:0: [sdd] Attached SCSI disk     Aug 14 19:30:41 vaio ata_id[25346]: unable to open '/dev/sdg'     Aug 14 19:30:41 vaio ata_id[25349]: unable to open '/dev/sdf'     Aug 14 19:30:41 vaio ata_id[25350]: unable to open '/dev/sdd'     Aug 14 19:30:41 vaio ata_id[25355]: unable to open '/dev/sdk'     Aug 14 19:30:41 vaio ata_id[25348]: unable to open '/dev/sde'     Aug 14 19:30:41 vaio ata_id[25356]: unable to open '/dev/sdi'     Aug 14 19:30:41 vaio ata_id[25353]: unable to open '/dev/sdh'     Aug 14 19:30:41 vaio ata_id[25354]: unable to open '/dev/sdj'


title: How to see interactive output when running nmap from a bash script?

text: I'm trying to run nmap from a Bash script, in a way so that when `Enter` is pressed it should give some output, as happens when running directly from the commandline. When calling a few different `nmap` scans from a Bash script, pressing `Enter` will not show the time remaining as it would if I ran it directly from the command line. An example line from my script:               nmap -T4 -iL input.txt -PN -sS -oA tcp_top_1000      Running `nmap` like this via the command line, and then hitting `Enter` results in this type of output:               $ nmap -T4 -iL input.txt -PN -sS -oA tcp_top_1000          Starting Nmap 5.21 ( http://nmap.org ) at 2013-10-18 01:21 EDT     Stats: 0:00:01 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan     Parallel DNS resolution of 1 host. Timing: About 0.00% done     Stats: 0:00:01 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan     Parallel DNS resolution of 1 host. Timing: About 0.00% done     Stats: 0:00:02 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan     Parallel DNS resolution of 1 host. Timing: About 0.00% done      However running that same `nmap` command in a shell script inhibits it's ability to do the above. Is there any way to solve this?


title: How to register application in KDE?

text: Normally, when you install regular package of KDE application, its icon shows up in KDE menu. Now, I am making package for app which came in *.zip file, I can install it, run it, but it does not show in KDE menu. So how to register it? openSUSE 11.4, KDE3.5.10 (!), app: IntelliJ IDEA.


title: How can I reconfigure my Ubuntu PC's 2.6.37.6 kernel to shrink it to 950 KB or less?

text: I need to recompile the kernel with minimum configuration so that after compiling its size stay below 950 KB and it should boot correctly after compilation. I need to compile with minimum possible features just to boot from the kernel. How can I do this?


title: Disable Bash autocompletion for a specific command only

text: Is it possible to disable Bash's autocompletion for a specific command only? Use case: For obvious reasons, I would like to disable autocompletion for the `rm` command when I'm root. It would also be a terrible pain if I disabled autocompletion altogether, so I'd like to remove it for `rm` only. Can this be done at all, preferably without hacking `/etc/bash_completion` and friends?


title: How can I use cron to display messages on the screen via notify-send

text: I am toying around with `notify-send` and `cron` (on an Arch machine) and I can't figure out a way to combine them: I tried the solution given here and here, but neither worked. How can I use them? **EDIT:** I have set the DISPLAY in the crontab and it still didn't work. I tried the same in Ubuntu and there things are working fine. Here is my cron line:               */1 * * * * DISPLAY=:0.0 /usr/bin/notify-send "hellp" || echo "er" > .er


title: New SL6 system: No hostname?

text: This is in regards to Scientific Linux 6.1 system, but should also apply to CentOS 6.1 & RHEL 6.1. I am setting up a new Scientific Linux 6.1 system, using kickstart and DHCP (via xCAT). This machine should be named `'host2.example.org'. I see that some programs are unable to resolving the hostname of this system. It seems that RedHat 6 no longer puts a hostname into `/etc/hosts` (See bug 668830 and RedHat KB DOC-57321 (login required)). In addition, the hostname is not defined in `/etc/sysconfig/network`.               # cat /etc/hosts     127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4     ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6     # cat /etc/sysconfig/network     NETWORKING=yes     HOSTNAME=localhost.localdomain     # hostname     host2     # hostname --long     hostname: Host name lookup failure      I was expecting to see the hostname in `/etc/sysconfig/network` , but it's not there. Shouldn't something (like NetworkManager) put the hostname into a file somewhere? If so, why is there no HOSTNAME line in my `/etc/sysconfig/network`? Should Kickstart or Anaconda do this? For CentOS/SL 5.6, I believe the hostname was always added to `/etc/hosts`.


title: Quoting in a function results in error

text: How should I write the `command` variable to get the expected behavior?               #!/bin/bash          function f ( )     {         echo "$2"     }     command="f --option=\"One Two Three\" --another_option=\"Four Five Six\""     $command          f --option="One Two Three" --another_option="Four Five Six"      First calling is wrong, second - right               $> ./test.sh      Two     --another_option=Four Five Six


title: How can I open a file in VIM in readonly mode if it already has a swapfile?

text: When I use the command `:e filename` to open a file and this file is already opened by another vim instance, I get a prompt asking me if I want to open the file in _read-only mode_ , edit anyway, recover, exit or abort. When I try `:silent! e filename` what happens is that vim seems to have hanged. But it is indeed asking me what to do with the swapfile, just I can't see it because I told it to be silent. Is there any command where I can tell it to open the file in _read-only mode_ **if** the file can't be opened in write mode and without requiring user interaction? (I want to integrate this into a macro to jump/open files).


title: Seems that chown is allowed to non root user

text: We are using LDAP authentication and probably another things that I did not understand well, in our company so maybe the following questions are result of this. I have found strange behavior of `chown` command, and I do not know if this is normal. Here is my scenario: GID of user mark is SK001936 and owner grup of home dir of mark is SK001778, as you can see they are not the same. The group SK001778 is allowed all operations (rwx) with home dir of user mark as owner (mark) has:               [mark@machine ~]$ id     uid=48447(mark) gid=41795(SK001936) groups=40119(SUB_SK001936_PPS),41795(SK001936)     [mark@machine ~]$ ls -lad .     drwxrwxr-x   6 mark SK001778  4096 Oct 10 13:30 .      GID of user michael and mark are both SK001936:               [michael@machine mark]$ id     uid=40570(michael) gid=41795(SK001936) groups=40119(SUB_SK001936_PPS),41795(SK001936)     [mark@machine ~]$ id     uid=48447(mark) gid=41795(SK001936) groups=40119(SUB_SK001936_PPS),41795(SK001936)      user michael cannot create file in home dir of user mark. It is the matter of that michael do not belongs to group (SK001778) which has the full (rwx) access to mark's home directory:               [michael@machine mark]$ touch michael     touch: cannot touch `michael': Permission denied      Under normal circumstances the user cannot issue the chown even if he is the owner of the file. However in this example the owner of home directory (mark) is able to change the owner group of his own home directory (and thus allows the users belonging to this group access to his home dir):               [mark@machine ~]$ chown mark:SK001936 .      The group which now has access to mark home dir is thus the same group as GID of michael, hence the michael is now allowed to create/delete files/folders in mark's home dir:               [michael@machine mark]$ touch michael      mark is unable to change back the group ownership of his home dir (remember only root is allowed to issue chown accoring to this: why-cant-a-normal-user- chown-a-file):               [mark@machine ~]$ chown mark:SK001778 .     chown: changing ownership of `.': Operation not permitted      My question is: how is possible that mark was able to change the group ownership of his home dir even when si declared that chown can be issued only by root. The box is RedHat 5.6.


title: How to make a Desktop "shortcut" that opens the terminal but under a different directory than the default home?

text: ## Objective I am looking for an easy way to consistently run a terminal that automatically opens to a specific directory. Is there a way to do that without changing the default directory? Preferably I just click on a 'shortcut' link and it opens that customized terminal to that directory or maybe runs the CD command for me. ## Full Story Currently, when I open the terminal (via the Linux Mint GUI menu) it by default 'takes' me to the home directory. This is a fine default choice for the majority of times. However, there are instances where I wish it would open elsewhere. I don't wish typing the CD command every time, for example:               cd Dropbox/GTD      Since I go to work on the files located on that specific directory every now and then (enough to be a pain), I am hoping someone can point a way so all I do is ideally   1. Click on a desktop shortcut (script or whatever mechanism)    2. Terminal opens under that specific directory without me typing any commands.   3. I can instantly work on the files located there.   4. If I open another terminal outside that 'shortcut', the terminal opens to the default home directory like usual. I have a basic understanding working with the command line and Linux in general but am not advanced. Hopefully, you can dumb it down a bit ^_^ Oh and thanks in advance for any tidbits that can help point me in the right direction.


title: Attach to existing screen session, but new window

text: So I have a screen session running on one terminal/machine I would like to write a script that would attach to that screen session on another machine, but to a new window in that screen. Does anyone know how I can do this? I feel like it might have somethig to do with `screen -x (session name) -p (window number)`...if i put "-" as the window number, it goes to a blank screen, but I want a fresh window. EDIT: Not really looking for a solution anymore myself, a neat tool called "tmux" replaces screen and makes this all trivial.


title: cannot open display "default display" in Linux Mint 15

text: I have a really strange problem, i rebooted my laptop running Linux Mint 15 with XFCE and unexpectedly it doesn't show the login screen instead i see `tty1`. The strange part is, that i haven't changed any configurations before the reboot. The system was running flawlessly weeks before today. At boot i see the animated splash logo, and then i am presented with the blinking cursor of the `tty1`. To check if my graphic card works I've rebooted to windows (it's a dual boot system). Windows works without problems. I also tried to boot older kernel versions, i checked the filesystems, everything ok. When i call `startx` from one of the ttys, i see my desktop without any XFCE stuff, no panels nothing. Cant open a terminal etc. Currently i am writing the last parts of my bachelor thesis, this problem is the total worst case. I am not to familiar with X11 and friends, that means i don't know where to look for the problem. PS: The laptop is a hp elitebook 8460p, with integrated intel hd graphics. I am running the included open source graphic drivers. **UPDATE** : When i call `startxfce4` in a `tty` after i logged in on that terminal, i get my desktop back. But why is there no login screen after all? Someone any ideas? `mdm` is responsible for the login screen in linux mint, i think that there is the problem. **UPDATE-2** : When i call `mdm` in the `tty` after booting, the login screen shows up and i can login. But why doesn't start mdm automatically?