title: How to find current chroot jail path on Linux <2.6.26

text: While running kernel 2.6.26 or newer it's possible to get the path of the current `chroot` jail by comparing the `mountinfo` of the current process and the `init` process. Is there a way to get the same information with kernel <2.6.26?


title: How do I get ssh-agent to work in all terminals?

text: I have set up automatic (password less) ssh login to some servers using ssh- copy-id. `ssh-agent` works only from the terminal where it was run. How do I get `ssh-add` to work in all my terminals? Naturally, I would not prefer SSH key without a passphrase.


title: Start Akregator in system tray

text: I have added Akregator to the list of startup applications, but it opens up window every time I boot into my system. Is there a way to make it not open the window and start silently in the system tray?


title: Start X in Debian Wheezy

text: I have been trying for several hours to get to the desktop in Wheezy (amd64 and i386) on Virtualbox but when I execute: `startx` i just get a slightly different looking prompt. Do I have to do something before I can access X? Contents of /var/log/installer/syslog : http://pastebin.com/5ZwpbFxR               service gdm3 start     service gdm start     service kde start      All result in unrecognized service error messages


title: E-Mail client in linux which allows to search encrypted mail

text: Is there an E-Mail client for linux which allows to search old gpg encrypted mails (i.e. find all mails which contain a particular keyword in the body, including the encrypted ones).


title: How to set DNS resolver in Fedora using network-manager?

text: I want to try out Google public DNS. For this I need to change the nameserver address. I know it's in the file `/etc/resolv.conf`, but whenever I start `network-manager`, it overwrites the values in that file with what it obtains by using DHCP. How do I tell it not to do it? I looked through the GUI, but I could only find an option to add more IP addresses. Below is the trophy :) ![enter image description here](http://i.stack.imgur.com/ZPlMI.png)


title: How can I set mouse sensitivity, not just mouse acceleration?

text: I can't find a single desktop environment that supports setting both mouse acceleration AND mouse sensitivity. **I don't want any mouse acceleration, but I want to increase the speed of my mouse.** That means that if I move the mouse the same distance, the pointer will move the same distance every time, no matter how quickly I move the mouse. KDE will let me set mouse acceleration to 1x, but the mouse moves too slow then, and I can't figure out how to increase the speed. I am willing to accept a CLI solution, but I have only been able to get `xinput` to change acceleration. I don't recall having much luck with `xset`, either.


title: grep: memory exhausted

text: I was doing a very simple search:               grep -R Milledgeville ~/Documents      And after some time this error appeared:               grep: memory exhausted      How can I avoid this? I have 10GB of RAM on my system and few applications running, so I am really surprised a simple grep runs out of memory. `~/Documents` is about 100GB and contains all kinds of files. `grep -RI` might not have this problem, but I want to search in binary files too.


title: How to show loaded kernel modules inside OpenVZ virtual server

text: I am trying to find out what kernel modules are loaded inside a OpenVZ virtual server. Command `lsmod` is empty and I believe the reason is the way how OpenVZ's virtualisation is working. Specifically, I like to know if the inotify module is loaded. **I have only access to the guest system.**


title: Directing hostname to another computer within lan using hosts file

text: There seem to be more questions like this, excuse me if this is similar. I want to redirect to an IP address om my server computer. This is what I put in my hosts file on the client computer (IMac):               192.168.3.2:8080. dev.dev      It does not resolve to that IP address. Should this normally work, or do I have to do extra things? (The IP address works in the browser).


title: What is contained in these addresses?

text: I am working on MUlti-processor record-replay feature of a virtual machine. I have a log of non-deterministic memory access done in the virtual machine by virtual CPUs.   A very high proportion of these point to kernel space memory ie above 0Xc0000000.   For example heres a list of 10 most accessed kernel memory address after running SPLASH benchmark in the Virtual machine               0xfffb5000                                                         0xc1779db0                                                    0xc18b6910                                                           0xc1771a44                                                           0xc1771a40                                                           0xc1779e00                                                           0xc18b67e0                                                           0xc18b693c                                                           0xc18b67f0                                                           0xfffa1000      I want to know if there is some way of finding what exactly are in these memory address ... is it the kernel stack , vsyscall page, scheduler's ready list ...   So that i can then think of some way of solving this overhead to speed up record replay....   Hints to where to look in the kernel code is welcome Thanks


title: Restrict file access to append only

text: I have a directory with log files and I'm putting logs from script launched by users into them. Logging with syslog doesn't seem possible in this case. (non- daemon rsync) I want the users to have only write permissions on log files. The problem is, that write permissions must be further restricted, so that users (script) can **only append** to that files. The underlying filesystem is XFS. The following doesn't work:               # chattr +a test.log     chattr: Inappropriate ioctl for device while reading flags on test.log      Is there any other solution for this? Thank you for your hints.


title: I can't open the terminal in Cinnamon

text: I have Linux Mint 13 with Cinnamon installed, but I can't open a terminal using right click nor using `Ctlr``Alt``t` this is just an issue with Cinnamon, why is that happening? **Update** I tried to solve the issue by installing Zsh, I thought that it's an issue with the default terminal, but I can't open Zsh either, the issue is with Cinnamon I believe. **Update: Solved** gnome terminal wasn't installed, i don't know if anyone is going to fix that, but i solved it by `sudo apt-get install gnome-terminal` and i posted my solution on launchpad, I'm not going to delete this question. maybe someone else faces this problem.


title: run executable on boot

text: For the life of me, I cannot get this to work. I'm running Debian on Raspberry Pi. running this command from CLI:               /home/pi/domotiga/DomotiGaServer.gambas -d      runs my home automation server. How do I go about running this on boot? I have a file in my /etc/init.d dir that does get loaded, but it doesn't launch the server file contents:               #!/bin/bash     ### BEGIN INIT INFO     # Provides:          domotigaserver     # Required-Start:    $syslog $mysql     # Required-Stop:     $syslog     # Default-Start:     2 3 4 5     # Default-Stop:      0 1 6     # Short-Description: domotiga server     # Description:     #     ### END INIT INFO          #!/bin/bash     # /etc/init.d/domotigaserver     #          # Carry out specific functions when asked to by the system     case "$1" in     start)     su pi -c '/home/pi/domotiga/DomotiGaServer.gambas -d'     echo "Starting DomotiGa Server "      ;;     stop)     pkill DomotiGaServer.gambas     echo "DomotiGa Server has been stopped (didn't double check though)"      ;;     *)     echo "Usage: /etc/init.d/domotigaserver {start|stop}"      exit 1     ;;     esac          exit 0


title: Windows-like visual style for Gnome/Cinnamon?

text: I'm secretly trying to replace a windows machine with Linux for a girl and make it look like Windows the way it is actually possible to. I was unable to find appropriate apps like panel and menu launcher for that purpose except some GNOME themes. What I need is a panel and a menu launcher for Linux that can simulate Windows XP/7. If there is any, do please link it.


title: Add USB space in conky

text: I'm setting conky and I'd like to add the usb space, I use:               $font${color DimGray}/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_free_perc /}%     ${fs_bar /}      for the full hdd, what should I write as path for USB?


title: How to write a systemd script that runs usb_modeswitch and connects to the internet at startup?

text: I have a cisco AM10 wireless adapter and every boot, I need to run               usb_modeswitch -v 1307 -p 1169 -L -I -u -l      to get it to function as an adapter. Then I have to run a `netcfg` profile to connect to the internet. I'm very new to systemd, how can I write a startup script that can run these commands, so I won't have to?


title: Creating symbolic links to applications in Mac OS X

text: I installed Aquamacs in a fresh OS X desktop, and wanted to be able to call the program from the commandline. Calling the file inside the app seems to work just fine:               Amoss-iMac:bin amosjyng$ /Applications/Aquamacs.app/Contents/MacOS/Aquamacs      But of course, the Emacs when called from the Terminal is still version 22. So I log in as root and try               sh-3.2# rm emacs     sh-3.2# ln -s /Applications/Aquamacs.app/Contents/MacOS/Aquamacs emacs      Using the symbolic link now, however, generates a bunch of problems:               Amoss-iMac:bin amosjyng$ emacs     Warning: arch-dependent data dir (/Users/dr/Nightly/Cocoa23ub/aquamacs-emacs.git/nextstep/Aquamacs.app/Contents/MacOS/libexec/emacs/23.3.50/i386-apple-darwin9.8.0/) does not exist.     Warning: arch-independent data dir (/Users/dr/Nightly/Cocoa23ub/aquamacs-emacs.git/nextstep/Aquamacs.app/Contents/Resources/share/emacs/23.3.50/etc/) does not exist.     Error: charsets directory (/Users/dr/Nightly/Cocoa23ub/aquamacs-emacs.git/nextstep/Aquamacs.app/Contents/Resources/share/emacs/23.3.50/etc/charsets) does not exist.     Emacs will not function correctly without the character map files.     Please check your installation!     Warning: Could not find simple.el nor simple.elc      What could I do to fix this? **EDIT** : So I removed the link to Aquamacs, and instead wrote a script file named `emacs` consisting entirely of               /Applications/Aquamacs.app/Contents/MacOS/Aquamacs      And now calling `emacs` from the Terminal works. Does anybody have any other ways to do this?


title: critical section for linux

text: In linux or a library for linux, is there an equivalent to critical section in win32? I am aware of Mutex, but it is not the same as critical section since a critical section uses user-mode spinlock and an event object internally, and it is must be faster than mutex.


title: Arch Linux: pacman cannot be upgraded because pacman version is too high?

text: This seems a bit like an April Fools' joke, but this is what I was greeted with this morning, when trying to bring my Arch up to date:               :: The following packages should be upgraded first :         pacman     :: Do you want to cancel the current operation     :: and upgrade these packages now? [Y/n]           resolving dependencies...     looking for inter-conflicts...     error: failed to prepare transaction (could not satisfy dependencies)     :: package-query: requires pacman<3.5      So what, should I downgrade my pacman before I'm allowed to upgrade it?


title: Can't copy/move between filesystems with SFTP

text: Are there any limitations on SFTP that prevents a user from copying between filesystems? I have a SLES with SFTP, and users can't copy/move files between filesystems, even when the target is `chmod 777`-ed and the user is root -- Filezilla just says "failed". Creating a directory on the target filesystem works fine, as does copying/moving within a filesystem, and if the user SSHes in they can copy to the target filesystem no problem. There's no SELinux, AppArmor, grsecurity, etc. What could be the problem? UPDATE: the server is a SLES 10.4


title: Why are there symlinks in /dev? (LVM)

text: [root@SERVER ~] ls -la /dev/vg/root     lrwxrwxrwx 1 root root 17 2012-10-28 10:29 /dev/vg/root -> ../mapper/vg-root     [root@SERVER ~]       **QUESTION:** Why are there symlinks? Why there couldn't be only 1 entry in the /dev for a normal LV in an LVM?? (OS: ubuntu 10.04lts)


title: Creating a NAT from loopback to a remote server

text: My goal is to redirect connections from the local host to a remote server, and be able to change the remote address on the fly, without any client config changes. I can do this now using a nat on the external interface like so:               LOCAL_IP=10.1.1.10     LOCAL_PORT=8888     REMOTE_IP=10.1.1.11     REMOTE_PORT=9999          iptables -t nat -A OUTPUT -p tcp -d $LOCAL_IP --dport $LOCAL_PORT -j DNAT --to-destination $REMOTE_IP:$REMOTE_PORT     iptables -t nat -A POSTROUTING -p tcp -d $REMOTE_IP --dport $REMOTE_PORT -j SNAT --to-source $LOCAL_IP      This works fine, but still couples the client's config to the hosts IP address. What would be really nice, is to be able to NAT traffic going to `127.0.0.1:8888`, to `10.1.1.11:9999`. This seems like something that should be possible using a DNAT/SNAT|MASQUERADE combination, but I haven't come up with a working configuration yet. Any configurations I try seem to silently drop the packets (possibly caught by the martian rules? I do have ip_forward enabled).


title: SCP and/or SSH command with password in line

text: First, I'm TRYING to use rsa keys because I'm using the script to create RSA keys, but initially I have to connect to the remote machine to pass over the newly generated authentication key. Having premade keys is what I'm doing, but I'd like an easier way to get the key to all of these machines. So here's the deal: I need to connect to 100+ machines and pass over a public key file plus set permissions and turn on key authentication. Right now I can do it in 2 lines: one scp command to transfer and one ssh command to set permissions and turn key authentication back on. But as it is, it's asking for the password twice, for each machine. With over 100 machines needing these keys so I never have to do the password thing again, I don't want to type this password 200 times. I need some way to insert the password during the connection, just this once (well twice technically). I was hoping for the ability to store the password in a variable while the script ran and then be done with it after the connections are made and the public key is transferred to all these machines. Thoughts? Edit: forgot to mention, I can't install anything. So I can't use expect.


title: Creating an empty file having a variable name in a script

text: I need to create an empty file using a shell script. The filename will be determined by examining all the files in a directory matching a pattern, say `TEST.*`, and appending `_END` to it so that the new file might look like `TEST.2011_END`. Let the current directory be `$DIR`. So I tried:               for file in $DIR/TEST.*     do         touch $file_END       done      This gives an error. I also tried replacing `touch $file_END` with:               filename=$file_END       touch $filename        but with no luck. What should I do?


title: sox segmentation fault

text: My attempt to record sound with sox on Raspberry PI fails:               pi@raspberrypi ~/tmp $ rec new.wav     Segmentation fault      And so does play:               pi@raspberrypi ~/tmp $ play test.wav     Segmentation fault      Yet it will convert files for me:               pi@raspberrypi ~/tmp $ sox message.wav message.flac rate 16k     pi@raspberrypi /tmp $ mplayer message.flac     ==========================================================================     Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders     libavcodec version 53.35.0 (external)     Mismatching header version 53.32.2     AUDIO: 16000 Hz, 2 ch, s16le, 160.0 kbit/31.26% (ratio: 20004->64000)     Selected audio codec: [ffflac] afm: ffmpeg (FFmpeg FLAC audio)     ==========================================================================      The debug information don't seem to provide a whole lot of info:               pi@raspberrypi ~/tmp $ sox -V5 -d new.wav     sox DBUG formats: opening format plugin `lsx_amr_nb_format_fn': library 0x1af6308, entry point 0x4038f2c8     sox DBUG formats: opening format plugin `lsx_amr_wb_format_fn': library 0x1af6a80, entry point 0x4000ee10     sox DBUG formats: opening format plugin `lsx_ao_format_fn': library 0x1af71e0, entry point 0x4003ebb8     sox DBUG formats: opening format plugin `lsx_ffmpeg_format_fn': library 0x1af7918, entry point 0x403de914     sox DBUG formats: opening format plugin `lsx_flac_format_fn': library 0x1afe1e0, entry point 0x419f70a8     sox DBUG formats: opening format plugin `lsx_gsm_format_fn': library 0x1b0e570, entry point 0x403e8cf4     sox DBUG formats: opening format plugin `lsx_lpc10_format_fn': library 0x1b0e978, entry point 0x41a5dcc4     sox DBUG formats: opening format plugin `lsx_mp3_format_fn': library 0x1b0ed80, entry point 0x41a6bd1c     sox DBUG formats: opening format plugin `lsx_oss_format_fn': library 0x1b0fb00, entry point 0x41a77d74     sox DBUG formats: opening format plugin `lsx_pulseaudio_format_fn': library 0x1b0ff70, entry point 0x41ac9a80     sox DBUG formats: opening format plugin `lsx_sndfile_format_fn': library 0x1b153f8, entry point 0x41e98ec0     sox DBUG formats: opening format plugin `lsx_vorbis_format_fn': library 0x1b15830, entry point 0x41ad49ec     sox DBUG formats: opening format plugin `lsx_wavpack_format_fn': library 0x1b15c68, entry point 0x41ea57c8     sox INFO oss: OSS driver only supports bytes and words     sox INFO oss: Forcing to signed linear word     Segmentation fault      Here is some version data that might be helpful:               pi@raspberrypi ~/tmp $ sox --version     sox:      SoX v14.4.0          pi@raspberrypi ~/tmp $ cat ~/.asoundrc     pcm.!default {         type asym         playback.pcm {             type plug             slave.pcm "hw:2,0"             }         capture.pcm {             type plug             slave.pcm "hw:1,0"             }     }          pi@raspberrypi ~/tmp $ uname -a     Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux


title: Definition of word in ZLE (zsh)

text: I came across the following two snippets in zsh: Snippet 1:               autoload select-word-style     select-word-style shell      Snippet 2:               setopt shwordsplit      My question is, what is the difference between them? (i.e. what do they do?) Also, is there an index by keyword on the zsh documentation? (e.g. I couldn't easily find information on the documentation about these two snippets). If such index doesn't exist, does anybody have any suggestions, other than the trivial Google searches or asking on this site, on how to find documentation on keywords such as `shwordsplit` or `select-word-style`?


title: root shell isn't using --color=auto

text: Does anyone know why the root user doesn't have a colour coded shell? It would seem to me the one person who navigates the file system the most is the root user, s/he would benefit most from the colour coding. Is it off for a reason? BTW I'm using bash.


title: Omitting results containing '//' from grep searches

text: I'm trying to search a substantial C++ codebase for a single line that is outputing text to the terminal that I'd like to suppress. I have grepped for `std::cout` and have had around 40 different files returned. The problems I face are:   * I did not add this myself so I have no idea where it is.   * It is a pointer only outputing memory location so I have no context in which to search for it.   * The codebase is enourmous and contains a great many other instances of `sdt::cout` that have once been used for debugging purposes and have since been commented out. My question pertains to the last one. I am using               grep -rle 'std::cout' .      to search, which will return positive for instances of `std::cout`, `//std::cout`, `// std::cout` and any other occurence of `std::cout` sitting on a line that is actually commented out. How can I modify my `grep` to omit any line containing `//` so I can eliminate the commented lines?


title: Grub - Windows Invalid EFI file path

text: I have 2 hdd, Windows on the first, I installed Mint on the second. This destroyed the bootloader so I used boot-repair to restore it.   Boot-repair identified both OS. Now my fresh Mint install boots fine but my Windows tells me > Invalid EFI file path Here is my boot-repair info Can someone help me to restore my Windows boot ?


title: Super slow internet requests

text: My Internet connection seems to be extremely slow on loading pages, specifically (it appears) when the browser sends the request for the first time. It takes like 5-6 seconds just to send the request and read the response back. I don't think there are problems with the router, since the problem appeared only after a system reinstall (ArchLinux) and I probably misconfigured something. How can I indentify the bottleneck here? The problem seems to be appearing only with the browser (Chromium). Also, what's strange is that my Ethernet interface, which was `eth0`, now (after the reinstall) is `enp2s0`. Another thing that is strange is that `localhost` is not reachable (but I set up a server behind it): > Chromium's connection attempt to localhost was rejected. The website may be > down, or your network may not be properly configured. **but** `localhost:8001` can be reached without any problems. I suspect the problem is the last Chromium suggested, i.e. a misconfigured network. What can I do to diagnose it? Here is the contents of `/etc/resolv.conf`:               # Generated by resolvconf     nameserver 192.168.0.1      **EDIT** : The problem seems to be DNS lookup. What do you suggest? Should I look into Google DNS?


title: Difference between [[ $variable ]] and [[ -n $variable ]]?

text: In bash, are `[[ $variable ]]` and `[[ -n $variable ]]` completely equivalent? It appears to be the case judging by the output below, but I see both forms of usage prevalent in shell scripts.               $ z="abra"     $ [[ $z ]]     $ echo $?     0     $ [[ -n $z ]]     $ echo $?     0     $ z=""     $ [[ $z ]]     $ echo $?     1     $ [[ -n $z ]]     $ echo $?     1     $ unset z     $ [[ $z ]]     $ echo $?     1     $ [[ -n $z ]]     $ echo $?     1


title: array[@] output all messed up?

text: I've got this code:               Unix+=("Stock List")     while read line; do        result=$(wget -O - -o /dev/null "http://finance.yahoo.com/d/quotes.csv?s=$line&f=sl1&e=.csv" | tr ',' '    ' | tr '"' ' ')       Unix+=("$result")     done < stock.txt          echo ${Unix[@]}     echo ${Unix[0]}     echo ${Unix[1]}     echo ${Unix[2]}      that reads a text file with only these lines in it:               SXX.L     QPP.L      And outputs this:                QPP.L 14.2495.L 27.50     Stock List     SXX.L 27.50     QPP.L 14.2495      Why is the `array[@]` output missing information and messed up?


title: Catdoc xls2csv converting only one sheet

text: I have Catdoc's `xls2csv` installed on Debian/Squeeze. It used to work beautifully when I copied files to a folder like `/var/www/xyz`, converting all sheets into `.csv` format, separated by `^L`. But now, for whatever reason, it converts only the first sheet when I use the command:               xls2csv filename.xls > filename.csv      Any suggestions on what I could be doing wrong here?


title: What's so special about directories whose names begin with a dot?

text: I was wondering what the difference between these two were:               ~/somedirectory/file.txt      and               ~/.somedirectory/file.txt      It's really difficult to ask this on Google since I didn't know how to explain the `.` when I didn't even know what to call it. But can someone describe the difference between including the dot and excluding it?


title: How does iptables MASQUERADE work on the incoming side?

text: I'm still reading the iptables manual page and other documents and digging around questions and their answers. This is the problem which arises. When we setup the NAT we use a POSTROUTING rule such as this:               iptables -A POSTROUTING -t nat -j MASQUERADE -o eth0       It seems when a packet hits this chain then an internal host needs to initialize some connection with the internet right? Incoming traffic will route through the same path without hitting the chain? Am I right on this?


title: UI toolkit + programming language to develop linux applications

text: Suggest good GUI designer tool with programming language for linux based application. For a developer who knows winform and C#. Don't want to use mono on linux to run .net application on linux. I have heard about GTK+ and Qt. What will be good for me. found the link, which mention so many options? http://linuxmafia.com/faq/Devtools/ides.html


title: Why does eth0 only go up sometimes on boot?

text: I just installed Arch with Archboot. On boot, there's about 50% change of eth0 to go up. If it doesn't I'll have to reboot. What could cause this? If it goes up, dmesg contains:               [ 7.9...] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready     [11.5...] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None     [11.5...] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready      If it doesn't, only the "link is not ready" line is there. The server is configured for a static IP at 192.168.1.16, gateway 192.168.1.1 and DNS 192.168.1.1.


title: efibootmgr not found while grub-install --recheck on Arch linux install

text: I'm not an expert on linux. I've been used Ubuntu for a year or something. When I bought a new laptop (Lenovo G500) and wanted to install Arch Linux on this machine. I followed the steps of official Turkish wiki of Arch Linux installation http://archtr.org/wiki/index.php/Arch_Linux_Kurulumu_(Resimli_Anlat%C4%B1m) on the check grub installation step               # grub-install --recheck /dev/sda      I get an error that               which: no efibootmgr in (/usr/local/sbin:usr/local/bin:/usr/bin:/usr/bin/core_perl)     efibootmgr: Not found      I don't know how to install that manager nor why this error pops up. PS: is it related or not I don't know, but there is a warning on my computer when I try to boot some of the modern Linux distros:               That KVM disabled by bios.      ### EDIT #1 I hacked a little and got a new error               EFI distribitor id isn't specified


title: How to install listings package in Kubuntu for LaTeX?

text: I installed LaTeX on my Kubuntu with those commands:               sudo apt-get install abntex     sudo apt-get install texmaker     sudo apt-get install texlive-latex-base texlive-latex-extra texlive-latex-recommended texlive-fonts-recommended texmaker      but I also need to use `listings` package for my assignment paper. Please, help, how to install `listings` package for LaTeX here? **EDIT:** Ok it turned out that `listings` wasnt missing it was something different which caused the problem. I found solution which helped me:               mkdir -p /usr/share/texmf-texlive/tex/latex/floatflt     cd /usr/share/texmf-texlive/tex/latex/floatflt     rm -f floatflt.* float*.tex     wget http://mirror.ctan.org/macros/latex/contrib/floatflt/floatflt.ins     wget http://mirror.ctan.org/macros/latex/contrib/floatflt/floatflt.dtx     latex floatflt.ins     texhash /usr/share/texmf-texlive


title: How to get files downloaded by yum?

text: I install a software package on Fedora from the terminal using the command like > `# yum install live-usb-creator` Now at first it downloads some of the packages from online repository and then later it install that files on to the system. Now I want a backup of that downloaded files so that in future I can install that packages directly without connecting to internet. But the problem is that I don't know where does it download that all files. If it is possible to get those files then I have two systems having `Fedora 13 i686` installed on both of them. One has Internet connection and other has nothing like that. Now I want to install sofwares using `yum` on the first system from the online repository and after that can I install the same sofwares on my second system from the downloaded files on the first system?


title: Some FTP clients timing out on data connection to Pure-FTPd

text: I'm trying to connect to a server via FTP and I'm having some problems. Server is a CentOS with Pure-FTPd. My usual client is `lftp` which on this server gets stuck at "Making data connection". All google results about this suggest setting `ftp:ssl-allow no` but that didn't help in my case. I also tried other clients and experienced the same behavior with `ncftp` and the graphical gnome `gftp`: connection is made but no data is transferred even for a simple `ls`. However, connection and data transfer work with basic `ftp` client and from a Perl script using Net::FTP module. Any suggestion on what options I can try to get the other clients working?


title: gedit: tabs or spaces dependent on syntax

text: I almost always use the `Insert spaces instead of tabs` feature in gedit. The one exception is when writing a `Makefile` which requires tabs. I don't suppose there is a way to make this option dependent on the syntax being used? I.e. automatically switch back to tabs when `Makefile` is detected.


title: Echoing Total Page Number in Bash Script

text: I have the following script for batch pdf-ocr processing & it works fine               #!/bin/sh     # apt-get install exactimage tesseract-ocr ghostscript     # bash tut: http://linuxconfig.org/bash-scripting-tutorial     # Linux PDF,OCR: http://blog.konradvoelkel.de/2013/03/scan-to-pdfa/          y="`pwd`/$1"     echo Will create a searchable PDF for $y          x=`basename "$y"`     name=${x%.*}          mkdir "$name"     cd "$name"          # splitting to individual pages     gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r300 -dTextAlphaBits=4 -o out_%04d.jpg -f "$y"          # process each page     for f in $( ls *.jpg ); do       # extract text       tesseract -l eng -psm 3 $f ${f%.*} hocr      # echo Page ?? of ?? done!             # remove the “<?xml” line, it disturbed hocr2df       grep -v "<?xml" ${f%.*}.html > ${f%.*}.noxml       rm ${f%.*}.html            # create a searchable page       hocr2pdf -i $f -s -o ${f%.*}.pdf < ${f%.*}.noxml       rm ${f%.*}.noxml       rm $f     done          # combine all pages back to a single file     # from http://www.ehow.com/how_6874571_merge-pdf-files-ghostscript.html     gs -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=../${name}_searchable.pdf *.pdf          cd ..     rm -rf $name      I just want to echo which page being completed out of the total pages of the input pdf file?


title: Can only browse files mounted via gvfs, not open them

text: I have a new Arch Linux installation using awesome wm and no desktop environment. If I put `smb://server/share` as a URI on pcmanfm, the mount succeeds after prompting me for my credentials, and I can browse the files and directories, but not open or copy anything. Right-clicking and choosing `properties` shows owner and group of `0`, and there aren't any files under `/run/user/...`. If I mount it as follows (not using gvfs), I can access the files as expected, so I know the server end is working.               sudo mount -t cifs //server/share /mnt/share -o 'user=user,password=password,workgroup=workgroup'      I would really like to get it working under gvfs, because this is a very Windows-heavy workplace and the shares I need to access change frequently. What could be causing this issue, and how to fix it?


title: Difficulty with EncFS on Debian

text: I created 2 test folders:               mkdir /home/oshiro/Desktop/encrypted     mkdir /home/oshiro/Desktop/decrypted          oshiro@debian:~/Desktop$ ls -l     total 8     drwxr-xr-x 2 oshiro oshiro 4096 Feb 15 20:34 decrypted     drwxr-xr-x 2 oshiro oshiro 4096 Feb 15 20:33 encrypted      I installed `encfs`:               sudo aptitude install encfs      I then tried using `encfs` with the 2 folders I created above:               oshiro@debian:~/Desktop$ encfs /home/oshiro/Desktop/encrypted /home/oshiro/Desktop/decrypted          Creating new encrypted volume.     Please choose from one of the following options:      enter "x" for expert configuration mode,      enter "p" for pre-configured paranoia mode,      anything else, or an empty line will select standard mode.     ?> p          Paranoia configuration selected.          Configuration finished. The filesystem to be created has     the following properties:     Filesystem cypher: "ssl/aes", version 3:0:2     Filename encoding: "nameio/block", version 3:0:1     Key Size: 256 bits     Block Size: 1024 bytes, including 8 byte MAC header     Each file contains 8 byte header with unique IV data.     Filenames encoded using IV chaining mode.     File data IV is chained to filename IV.     File holes passed through to ciphertext.          New Encfs Password:      Verify Encfs Password:       But then I got this error:               fuse: failed to open /dev/fuse: Permission denied     fuse failed. Common problems:     - fuse kernel module not installed (modprobe fuse)     - invalid options -- see usage message     oshiro@debian:~/Desktop$       I've configured `encfs` on Ubuntu 12.04 without any issues, I had an issue on CentOS 6.5 which I corrected by running:               sudo chmod +x /usr/bin/fusermount      but that was for a slightly different error message. I tried the same command on Debian 7.4, but it made no difference. Anyone know how to get this to work?


title: How does fsnotify setting affect system performance?

text: Occasionally a software package I install complains that the default fsnotify setting is far too low for decent performance. Intellij IDEA or crashplan are two examples. They suggest using fsnotify value several orders of magnitude than the default value and I follow the suggestions. How come the default value is so low when it doesn't seem to make a lot of difference when you set it to some very high value like 512000 and is there a maximum value? Can very high values on large file systems cause problems? I'm struggling to find any information about how to tune this setting.


title: How do you check the support for a specific CPU in the Linux or BSD kernel?

text: Assuming that I have the sources for my kernel and I know the name of a SoC or a CPU, how I can check that the hardware is supported without compiling and running ?


title: How to share wifi under Gentoo?

text: My system is Gentoo 64bit, with KDE. I want to share my wifi connection with other devices. I am able to do this with Windows 7, so I think my device is able to setup an AP. And I find out that in KDE, the NetworkManager can set up a _shared_ wifi connection. But my problem is, after I setup this _shared_ wifi connection profile, I cannot activate it. I can not see it from the network connection drop down list, neither can I find it with my phone.


title: Why does MV(1) copy objects if permission to move denied?

text: Does `mv` act as `cp(1)` if permission for process to move denied? If so, isn't it against the rule do one thing and do it well?


title: What does "LC_ALL=C" do?

text: What does the `C` value for `LC_ALL` do in Unix-like systems? I know that it forces the same locale for all aspects but what does `C` do?


title: Is 32bit still preferable to 64bit?

text: > **Possible Duplicate:**   >  Should I install 32 or 64 bit? I want to migrate from Ubuntu to OpenSUSE, and I need to decide between the 32bit and the 64bit versions. 6 years ago, when I purchased a Windows desktop, I was advised to stick with the 32bit version of Windows XP due to compatibility reasons. That was 6 years ago, so I assume things are different now. Also, that was on Windows, and Linux works differently(which can either make things better or worse), so I need to know:   1. How much of the software library of OpenSUSE(Linux in general?) compatible with 64bit?   2. Is there a performance difference between a 32bit Linux running a 32bit application on a 64bit processor and a 64bit OS running a 32bit application in 32bit emulation mode?   3. In the rare occasions 32bit emulation mode fails to activate(happened to me once on Windows Server 2008...), is there a way to force Linux to activate it for specific applications? Thanks in advance! Most of the data I find on Google is old, and probably outdated...


title: where is network layer protocols source code

text: that's all I can find tcp **source code** on my Ubuntu, also the place of data link layer is on the network interface. So where is network layer protocols **source code** on ubuntu ? Also I am looking for routing table. Where can I find the sourcecode for the network layer?


title: file descriptors and /dev/fd

text: Are file descriptors unique across a process, or throughout the whole system. Because every file seems the use the same descriptor for stdin and stdout. Is there something special with these? How does stdin and stdout work? I realize the `dev/fd`, is a link to `proc/self/fd`, but how do they all have the same number? _Edit:_ Even after looking at other processes most of the file descriptors are about the same numbers.


title: How do I convert a ssh-keygen public key into a format that openssl PEM_read_bio_RSA_PUBKEY() function will consume?

text: I'm having an issue generating a public key that the openssl `PEM_read_bio_RSA_PUBKEY()` function can consume. I keep getting errors. Obviously I cannot simply use the ASCII string in the `ssh-keygen <>.pub` key file as it is in SSH file format or I perhaps `SubjectPublicKeyInfo` structure. Here's the key gen code: `ssh-keygen -t rsa -b 1024 -C "Test Key"` I found a converter in php on the web which will convert the contents of the public key into a base64 PEM ASCII string format. However the function still doesn't like it. The Openssl documentation states:   1. “RSA_PUBKEY() function which process a public key using an EVP_PKEY structure”   2. “RSA_PUBKEY functions also process an RSA public key using an RSA structure” How do I get my OpenSSH public key into either format that the OpenSSL function will consume it?


title: How to "manually fix this package" (aptitude error)?

text: Whenever I try to `aptitude install` something I get this error:               E: I wasn't able to locate a file for the libxmlrpc-c3 package.      This might   mean you need to manually fix this package. (due to missing arch)     Writing extended state information... Done     E: I wasn't able to locate a file for the libxmlrpc-c3 package.      This might   mean you need to manually fix this package. (due to missing arch)     E: Internal error: couldn't generate list of packages to download      I `aptitude remove`d and deleted the package from `/var/cache/apt/archive`, but get the same error when I try again. This is the from dpkg/status:               Package: libxmlrpc-c3     Status: deinstall reinstreq half-installed     Priority: optional     Section: libs     Version: 1.06.27-1.1      This is the from `lsb_release -a; uname -a; dpkg-architecture; apt-cache policy ttf-mscorefonts-installer`:               DEB_BUILD_ARCH=i386     DEB_BUILD_ARCH_OS=linux     DEB_BUILD_ARCH_CPU=i386     DEB_BUILD_ARCH_BITS=32     DEB_BUILD_ARCH_ENDIAN=little     DEB_BUILD_GNU_CPU=i486     DEB_BUILD_GNU_SYSTEM=linux-gnu     DEB_BUILD_GNU_TYPE=i486-linux-gnu     DEB_HOST_ARCH=i386     DEB_HOST_ARCH_OS=linux     DEB_HOST_ARCH_CPU=i386     DEB_HOST_ARCH_BITS=32     DEB_HOST_ARCH_ENDIAN=little     DEB_HOST_GNU_CPU=i486     DEB_HOST_GNU_SYSTEM=linux-gnu     DEB_HOST_GNU_TYPE=i486-linux-gnu     ttf-mscorefonts-installer:       Installed: (none)       Candidate: 2.7       Version table:          2.7 0             500 http://ftp.cn.debian.org lenny/contrib Packages      How do I fix this error?


title: how to close ports with no process attachedto it

text: how do you close ports if there are not processes attached to it? I used to run an application and they're using this ports previously for some reason the application crashed but if i restart the application, i frequently need to change the port because the port is being used. But if I try to issue this command.               netstat -lnp          Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name              tcp6       0      0 :::8090                 :::*                    LISTEN      -         tcp6       0      0 :::8080                 :::*                    LISTEN      -      PID/Program Name is not attached to a process its just "-". So anyone know hows to close off this port? # SOLVED Just discovered that some process are being run by root and it would not show if you don't do sudo keyword before the command.               sudo netstat -tulpn          Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name          tcp6       0      0 :::8090                 :::*                    LISTEN      1242/java     tcp6       0      0 :::8080                 :::*                    LISTEN      1491/java


How do I install the nagios NRPE plugin on CentOS 5 using yum? I've tried `yum install nagios-plugins` but it's only downloading a fraction of a megabyte. Then if I do a search for one of the commands that was supposed to be installed, like `check_users` nothing comes up. When I look in `/etc/yum.repos.d/` I'm only seeing three files               CentOS-Base.repo     CentOS-Media.repo     EPEL.repo      Do i need to add a source? If so, which one?


title: Can't ssh to github from a remote machine: what should I do?

text: I am sshing into a remote server. From the remote server, I want to be able to ssh to github. I don't want to put my private key on the remote server, because other people have access to the machine. When I try to ssh to github from the remote server, I get the errors shown here: http://stackoverflow.com/questions/24961682/github-permission-denied- message-even-though-key-has-been-added I have set the following in `~/.ssh/config` on my local machine, but it's not helping:               Host remoteHost         ForwardAgent yes      Can I set up a new keypair on the remote machine and add this to github? Or will this destroy my ability to ssh into the remote machine from my local machine?


title: Why my systemctl v208 command doesn't support some features?

text: I'm presuming there's a patch somewhere where Debian decided to disable it, but I can't find it nor the changelog entry. There are several commands that aren't available, like `dot`, `dump`, `list-timers` and others more nifty. Where are them? `systemctl --help` also doesn't list them.


title: When was process substitution first introduced?

text: I'm curios to know how long process substitution has been around. What shell first had it? When did it get added to other shells?


title: How Do I Shrink the Visible Area of the X11 Root Window?

text: I would like to make the visible workspace of my desktop fill up less space than the entire monitor while keeping image fidelity constant. Presumably, any solution would leave a black border around the new, smaller main window. I am pretty sure this involves making some tweaks to xorg.conf (like changing the DisplaySize and X and Y position of the root window or something), but nothing has worked for me. I am running Debian "Squeeze".


title: Is there a way to control the speed at which Curl reports progress?

text: I'm using Curl in Cygwin to automate a daily download. I want to keep progress in a log but Curl is just a little too noisy for my taste. I tried `man curl` and Google, but didn't find anything. Can I slow down the frequency at which Curl reports progress?


title: Why does newgrp change my PS1 and how to prevent it?

text: I have a customized PS1 to show several parameters. When I switch to a different group using `newgrp`, it switched my PS1 to default ($) and that is annoying. The default remains even when I switch back to my default group from the changed group. Any way to stop it from doing that and just keep the PS1 I set in my .profile?               >uname -a     SunOS he2unx207 5.10 Generic_147440-19 sun4u sparc SUNW,Sun-Fire-880      Of course, if I resource my .profile after newgrp, the PS1 gets correctly applied but I am annoyed because newgrp effectively cancels what was set in .profile. Why can't it just change the effective group I am associated with without changing other settings?


title: Installing trac - "Trac requires Python 2.5 or later"

text: I am having a little trouble getting `trac 1.0` installed via `easy_install`:               [box]# easy_install Trac==1.0          Downloading http://pypi.python.org/packages/source/T/Trac/Trac-1.0.zip#md5=3dd2e883179879c8fa5b98c984f15058     Processing Trac-1.0.zip     Writing /tmp/easy_install-FOeJcG/Trac-1.0/setup.cfg     Running Trac-1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-FOeJcG/Trac-1.0/egg-dist-tmp-b2610A     Trac requires Python 2.5 or later     error: Setup script exited with 1      Python 2.6 is also installed on my system ( `/usr/bin/python26`, `/usr/include/python2.6/`, `/usr/lib/python2.6/`, `/usr/lib64/python2.6/`, ect ). Could I pass one of these as a prefix for `easy_install`? If so, which am I looking to include - the libs or the include path? **EDIT** Using this answer in SO, I tried making a symlink to python/python26. Continue to get the same error as above.


title: Close ssh session that has ControlPersist and is kept alive in the background

text: I have `ControlPersist 4h` in my `.ssh/config` and it works perfectly,   Every now and then I need to connect to this server that requires some special authentication, and if I don't use that account for while it locks my account, the problem happens like this, I don't use my account for a while, then I ssh into the server, it checks and my account is locked so it says so but it does not actually kick me out, so if I go away (Ctrl-D, or closing the terminal) and contact the admin to unlock my account and try to connect again, my session is "kept alive" on my end and it basically does not try again, unless I reboot, or kill all ssh related processes, which is annoying, Is there a way to close these sessions which are living in the background?


title: Recursive glob?

text: I'd like to write something like this:               $ ls **.py      in order to get all .py filenames, recursively walking a directory hierarchy. Even if there are .py files to find, the shell (bash) gives this output:               ls: cannot access **.py: No such file or directory      Any way to do what I want? **EDIT:** I'd like to specify that I'm not interested in the specific case of `ls`, but the question is about the glob syntax.


title: Preserving color output with cut

text: Using bash interactively I am trying to use cut to prevent the lines from going longer than my terminal width. But when using a command with colorized output all the color gets removed by cut. For example: `ls -lG | cut -c 1-$COLUMNS`. Is there anyway to get cut to preserve the color formatting?


title: A Way Around: Host Accessing Guest in Internal Network?

text: folks. I have installed a Linux virtual machine in VirtualBox with 2 adapters: vnet0 is a host-only network and vnet1 is an internal network. I am able to get the IP address given by vnet0. Theoretically, the host machine cannot access the internal work because internal network adapter is designed to isolate the guest machine, but I wonder if I can access another machine in the internal network (at least 'ping') through redirecting traffic from vnet0 to vnet1. If I can, how do I route the traffic? How do I create a (persistent) route to access the internal machine? Is there a better way to do it?


title: How to create a gzip file without .gz file extension?

text: I would like to create a gzipped file that retains the original file name. For example gzipping "example.txt" should output a gzipped file named "example.txt" rather than "example.txt.gz." Is it possible to do this elegantly with one command (not doing a subsequent `mv`)?


title: Why do some applications use ~/.config/appname for their config data while others use ~/.appname?

text: I've noticed that some applications put their configuration files to `~/.config/appname` while others use `~/.appname` (the classic way, AFAIK) for this. What's the sense in this distinction and what could be better to consider for an application of mine? UPDATE: Looks like my (XUbuntu 11.10 default) $XDG_CONFIG_HOME is set to `~/` and the most of the applications in my system (like Mozilla Firefox, Adobe Flash Player, Midnight Commander, Opera, Wine, etc.) comply to this. But there are still many applications (like Compiz, Deadbeef, VLC, Qt Creator, Google Chrome, XFCE, etc.) using `~/.config/` instead. Another suspicious thing is that directories in `~/.config/` are not themselves hidden (no dot in their names) - aren't application config dirs expected to have constant own names without depending on the location ($XDG_CONFIG_HOME value)?


title: Refresh env variables after editing bashrc file

text: I frequently edited the `.bashrc` file to export new environment variables. Rather than close the console and start a new one to refresh the env variables, is there a convenient way to refresh?


title: Change value of USB "max_sectors" for an entire family of devices

text: I've been using Linux for a while, but only since I started using "recent" distros (ie.: anything non-Debian) I have started having I/O problems with most of my USB devices. Basically when trying to write any nontrivial amount of data into them the lose connection and or reboot themselves. In the system log I observe these kinds of messages:               kernel: usb 1-7: reset high speed USB device using ehci_hcd and address 2     kernel: usb 2-1: device descriptor read/64, error -71     kernel: usb 2-4: new high speed USB device using ehci_hcd and address 13      This happens with both "pendrives" and USB-connected hard drives. I can not find any useful pattern to detecting which devices will bork and which won't except perhaps size - I've never had 1 or 2 GB pendrives bork with these messages (but then again, no one sells those anymore). When those errors happen, pending reads to drive get locked, also locking whatever program was doing the work until I physically unplug the drive. Of course, after I reconnect the drive, I find files or partitions corrupted, thus losing me a lot of work and forcing me to some other work. Researching around I've found links in places such as the ArchWiki or the SUSE Forums or even this very community indicating that the culprit is the default value of the USB tree attribute `max_sectors` which specifies how much can be read or written to a USB drive in one go. Any more than what the drive supports and the device resets or crashes. I've found mentions that the value is too high in Linux (`240`) compared to old kernels or Windows installs (`128` or even `64`) which of course don't face this problem. Since I value data integrity more than "blinding" speed (and I hope most people do!) I'd like to somehow **change the`max_sectors` value for "any" USB storage device** where the meaning of "any" could be ample enough that I can avoid having to write custom commands or rules for the most part. Unfortunately, look where I try I haven't been able to find any configuration line or kernel boot option that can change this value (unlike, say, USB autosuspend). What have I missed or what can I do next? I know that I can write something like the following in a more or less automatic using the `udev` system, something like this:               SUBSYSTEMS=="usb", DRIVERS=="usb-storage", ATTRS{manufacturer}=="Some Company", ATTRS{serial}=="xxxxxxxxxx", ATTRS{max_sectors}=="240", ATTRS{max_sectors}="128"      And then reload or reboot the service, but I have not been able to find a _generic_ enough `udev` rule that would fit as many devices as possible (so long as they are connected via a USB plug). I have the understanding that I can write more specific rules for devices whose `max_sectors` I want to restore or preserve, but here I'm only interested in a sort of wildcard. I have tried wildcard in some attributes, such as `ATTRS{manufacturer}=="* "` to no avail. What is a generic `udev` rule that can match me as many USB-plugged devices as possible? Is this even the "correct" way of handling this issue via software? (unloading USB 2.0 modules -as eg.: Ubuntu Forums suggest- seems to be not an option, as at least Fedora seems to have them integrated to the kernel). * * * **EDIT** : As suggested by frostschutz, I'm using `RUN+=` to set up the attribute, which actually works (unlike using `ATTR=`). That's half a solution. I've been able to create a udev rule that matches pretty much everything, but I fear it matches too much.               SUBSYSTEMS=="usb", DRIVERS=="usb-storage",  \      RUN+="/bin/sh -c 'echo 64 > /sys/block/%k/device/max_sectors'"      The problem with this rule is that it'll set `max_sectors` for everything, including devices that have a lower value than 64. I've tried to make it more specific:               SUBSYSTEMS=="usb", DRIVERS=="usb-storage", ATTRS{max_sectors}=="240", \      RUN+="/bin/sh -c 'echo 64 > /sys/block/%k/device/max_sectors'"      But this doesn't work. I think I'm using the correct scope for udev rules (use attributes from one part of the tree and from **one** parent). What am I doing wrong? **EDIT2** : Accepted the answer below. As it turns out, `RUN+=` does the trick, whereas using `ATTRS{…}=` for some reason doesn't. Also, the reason why I couldn't get to make a generic rule work was because I had misunderstood from the udev manpage. A rule must have **at most** attribute from **one** parent - that means if I want to use two sections, the second one must be the actual dvice. These two work mostly perfectly:               SUBSYSTEM=="scsi", ATTRS{max_sectors}=="240", \      RUN+="/bin/sh -c 'echo 64 > /sys/block/%k/device/max_sectors'"      (note the singular for the attribute, first attribute is from the **actual** USB device and second one from **a singular** ancestor at the device tree)               SUBSYSTEMS=="usb", DRIVERS=="usb-storage", ATTRS{max_sectors}=="240", \      RUN+="/bin/sh -c 'echo 64 > /sys/block/%k/device/max_sectors'"      (this one uses two attributes from the **same** ancestor at the device tree)


title: Installing Epel repository on CentOS fails

text: This has been working on my vagrant vm for a few month without any issues. I didn't change anything, it has been `vagrant up` and `vagrant destroy`'d several times before with no problems. But now it fails and I can't find out what the problem seems to be. I can't even install vim. ### Version Information               [root@localhost ~]# uname -a     Linux localhost 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux          [root@localhost ~]# cat /etc/*{release,version}     CentOS release 6.5 (Final)     CentOS release 6.5 (Final)     CentOS release 6.5 (Final)      ### Installing EPEL               [root@localhost ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/$(uname -i)/epel-release-6-8.noarch.rpm     Receiving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm     Warning: /var/tmp/rpm-tmp.RGvUnd: Header V3 RSA/SHA256 Signature, Key-ID 0608b895: NOKEY     Preparing...                ########################################### [100%]        1:epel-release           ########################################### [100%]     [root@localhost ~]# yum clean all     [root@localhost ~]#      ### /etc/yum.repos.d/epel.repo               [epel]     name=Extra Packages for Enterprise Linux 6 - $basearch     #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch     mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch     failovermethod=priority     enabled=1     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6      ### Trying to check update (FAILS)               [root@localhost ~]# yum check-update     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: ftp-stud.fht-esslingen.de      * epel: mirrors.ircam.fr      * extras: mirror2.hs-esslingen.de      * updates: mirror2.hs-esslingen.de     http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     [...]      ### Trying to check update excluding epel (WORKS)               [root@localhost ~]# yum --disablerepo="epel" check-update     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: ftp-stud.fht-esslingen.de      * extras: mirror2.hs-esslingen.de      * updates: mirror2.hs-esslingen.de     [vagrant@localhost ~]#      ### URLGRABBER_DEBUG               [root@localhost ~]# URLGRABBER_DEBUG=1 yum check-update 2> debug.log          2014-09-03 07:39:10,534 MIRROR: trying repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2 -> http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2     INFO:urlgrabber:MIRROR: trying repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2 -> http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2     2014-09-03 07:39:10,535 combined options: {       'checkfunc'    : (<bound method YumRepository.checkMD of <yum.yumRepo.YumRepository object at 0x27c8490>>, ('primary_db',), {}),       'copy_local'   : 1,       'http_headers' : (),       'range'        : None,       'reget'        : 'simple',       'size'         : '6623767',       'text'         : 'epel/primary_db',       'delegate'     : {         'bandwidth'    : 0,         'cache_openers': True,         'checkfunc'    : None,         'close_connection': 0,         'copy_local'   : 0,         'data'         : None,         'delegate'     : None,         'failure_callback': (<bound method YumBaseCli.failureReport of <cli.YumBaseCli object at 0x276c0d0>>, (), {}),         'ftp_headers'  : None,         'http_headers' : (),         'interrupt_callback': <bound method YumBaseCli.interrupt_callback of <cli.YumBaseCli object at 0x276c0d0>>,         'keepalive'    : True,         'max_header_size': 2097152,         'opener'       : None,         'password'     : None,         'prefix'       : None,         'progress_obj' : <output.YumTextMeter instance at 0x279e4d0>,         'proxies'      : None,         'quote'        : None,         'range'        : None,         'reget'        : 'simple',         'retry'        : 10,         'retrycodes'   : [-1, 2, 4, 5, 6, 7],         'size'         : None,         'ssl_ca_cert'  : None,         'ssl_cert'     : None,         'ssl_cert_type': 'PEM',         'ssl_context'  : None,         'ssl_key'      : None,         'ssl_key_pass' : None,         'ssl_key_type' : 'PEM',         'ssl_verify_host': True,         'ssl_verify_peer': True,         'text'         : None,         'throttle'     : 0,         'timeout'      : 30.0,         'urlparser'    : <urlgrabber.grabber.URLParser instance at 0x28f1f38>,         'user_agent'   : 'urlgrabber/3.9.1 yum/3.2.29',         'username'     : None,         }       }     DEBUG:urlgrabber:combined options: {       'checkfunc'    : (<bound method YumRepository.checkMD of <yum.yumRepo.YumRepository object at 0x27c8490>>, ('primary_db',), {}),       'copy_local'   : 1,       'http_headers' : (),       'range'        : None,       'reget'        : 'simple',       'size'         : '6623767',       'text'         : 'epel/primary_db',       'delegate'     : {         'bandwidth'    : 0,         'cache_openers': True,         'checkfunc'    : None,         'close_connection': 0,         'copy_local'   : 0,         'data'         : None,         'delegate'     : None,         'failure_callback': (<bound method YumBaseCli.failureReport of <cli.YumBaseCli object at 0x276c0d0>>, (), {}),         'ftp_headers'  : None,         'http_headers' : (),         'interrupt_callback': <bound method YumBaseCli.interrupt_callback of <cli.YumBaseCli object at 0x276c0d0>>,         'keepalive'    : True,         'max_header_size': 2097152,         'opener'       : None,         'password'     : None,         'prefix'       : None,         'progress_obj' : <output.YumTextMeter instance at 0x279e4d0>,         'proxies'      : None,         'quote'        : None,         'range'        : None,         'reget'        : 'simple',         'retry'        : 10,         'retrycodes'   : [-1, 2, 4, 5, 6, 7],         'size'         : None,         'ssl_ca_cert'  : None,         'ssl_cert'     : None,         'ssl_cert_type': 'PEM',         'ssl_context'  : None,         'ssl_key'      : None,         'ssl_key_pass' : None,         'ssl_key_type' : 'PEM',         'ssl_verify_host': True,         'ssl_verify_peer': True,         'text'         : None,         'throttle'     : 0,         'timeout'      : 30.0,         'urlparser'    : <urlgrabber.grabber.URLParser instance at 0x28f1f38>,         'user_agent'   : 'urlgrabber/3.9.1 yum/3.2.29',         'username'     : None,         }       }     2014-09-03 07:39:10,535 attempt 1/10: http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2     INFO:urlgrabber:attempt 1/10: http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2     2014-09-03 07:39:10,535 opening local file "/var/cache/yum/x86_64/6/epel/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2" with mode ab     INFO:urlgrabber:opening local file "/var/cache/yum/x86_64/6/epel/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2" with mode ab     * About to connect() to mirrors.ircam.fr port 80 (#0)     *   Trying 129.102.1.37... * connected     * Connected to mirrors.ircam.fr (129.102.1.37) port 80 (#0)     > GET /pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2 HTTP/1.1     User-Agent: urlgrabber/3.9.1 yum/3.2.29     Host: mirrors.ircam.fr     Accept: */*          * The requested URL returned error: 404 Not Found     * Closing connection #0     2014-09-03 07:39:10,610 exception: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     INFO:urlgrabber:exception: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     2014-09-03 07:39:10,610 calling callback: (<bound method YumBaseCli.failureReport of <cli.YumBaseCli object at 0x276c0d0>>, (), {})     INFO:urlgrabber:calling callback: (<bound method YumBaseCli.failureReport of <cli.YumBaseCli object at 0x276c0d0>>, (), {})      Any ideas?


title: How to set up `screen` to modify the window title and xterm-window title?

text: I'd like to have my current `$PS1` prompt (`\u@\h:\w$(__git_ps1 "(%s)")\$` plus some coloring) to be also used as `screen`'s window title (in the hardline) and as the xterm window title. How can this be achieved?


title: Detecting multihomed machine

text: Is there a way to reliably detect whether or not a machine is multi-homed? I'd like to be able to write a script that will return a true or false regarding that information.


title: How is user space process/thread controlled by the operating system

text: I understand this: User code executes in a process/thread context in a process address space, in user mode, and can address only user code/data defined for the process, with no access to privileged instructions. How does operating system know the process/thread created by user is in the user space, and in user mode, instead of kernel space and kernel mode? Is it controlled by register/cpu/hardware settings? How exactly does it work?


title: Should I install npm in Kubuntu?

text: I am using Kubuntu. I am looking into installing a plugin to help in javascript. This seems to be good jshint but it mention `npm install`   What is this? My understanding is that in Kubuntu I should only use `sudo apt- get` to install packages and not `yum` or anything else. What is this `npm`? Should I use it or will I have conflict issues with my package manager?


title: Can I make a symlink point to different locations on different machines?

text: Before you say "no", a workaround would also be fine. Here is the situation: I have two machines `local` and `compile`, both including the same `~` over nfs from a third machine `files`. I would like to have a directory on `compile:/opt/foo/` instead of `files:~/foo/` for speed. But I want to still be able to work from `local` without having to work on a different path. I can sshfs mount `compile:/opt/foo/` locally on `local:~/compile/opt/foo/` but if I want to have one directory at the same path **inside my`~`** on both machines, symlinks don't seem to cut it, as they want to point at the same path. Is there a solution for this problem that enables me to have my files sitting on the local drive of `compile` instead of the nfs mount? Note: I cannot gain root privileges on any of these machines.


title: Installing Java into Ubuntu 10.04 Firefox/Chrome

text: I'm having a really hard time getting the Java browser plugin to install in Ubuntu 10.04. I've tried searching all over the place, but everyone seems to recommend installing the packages that no longer exist in the Ubuntu repositories. Several places suggested installing the OpenJDK, which I did. Still doesn't work. If you can give me any help at all getting Java plugins to work in either Chrome or Firefox, I'd be most gracious.


title: PPC Debian: eth0: switching to forced 10bt / 100bt

text: I recently installed debian on an old G4 iMac, and everything is working fine except that the console is constantly spammed with alternating               eth0: switching to forced 10bt     eth0: switching to forced 100bt      messages. eth0 isn't configured at all in `/etc/network/interfaces`; I'm using the wireless interface on eth1 (which works fine). `sudo ifconfig eth0 down` doesn't give any message; the alternating messages just keep coming. Is there any way to get rid of them?


title: KDE custom global shortcuts

text: How can I set a global shortcut in KDE (4.4) to run a bash script?


title: How to block abusive IP addresses with pf in OpenBSD?

text: We can see from the nginx logs that there is an IP address doing nasty things. How can we block it with a `pf` command and then later permanently with the `/etc/pf.log`? How can we block a `x.x.x.x/24` for that IP? It is example: 1.2.3.4 UPDATE: no, looks like OpenBSD doesn't have allow/deny file in /etc. And AFAIK the best advise for blocking abusive IP addresses are using pf.               # cd /etc      # ls -la|egrep -i 'deny|allow'     # uname -a     OpenBSD foo.com 5.4 GENERIC.MP#0 amd64     #


title: What does LIBGL_ALWAYS_INDIRECT=1 actually do?

text: KDE SC 4.5.0 has some problems with some video cards including mine. Upon Release Arch recommended several workarounds. One of which was > export "LIBGL_ALWAYS_INDIRECT=1" before starting KDE I decided that it was the easiest, best method. But I don't know what it does or how it impacts my system. Is it slower than the default? should I remember to keep an eye on the problem and disable it later once it's fixed?


title: How to set permissions in /sys/ permanent?

text: I'm starting X as a user and need to set my keyboard brightness in `/sys/class/leds/asus\:\:kbd_backlight/brightness`. The `/sys/` directory gets recreated after reboot, so the permissions will reset too. How do I set it up so I don't need to make the file writable by all users after every boot? I'm using Archlinux with SDDM as the login manager and KDE as DE.


title: Rehashing /etc/shadow. Can I force NIS users to change password?

text: I'm currently migrating a CentOS environment to a Debian one. The users log in over the network using NIS. I was hoping to copy `/etc/shadow` from my old server to my new one so that we can offer continuity to the users. I discovered two problems with it:   * **User ID conflicts** This is easily resolvable by adding 500 to the UIDs in the CentOS `shadow` file since CentOS started UIDs at 500 while Debian starts them at 1000.   * **Different password hashes** This is what's killing me. It seems CentOS hashes its passwords with `md5` while Debian uses `sha-512`. I would like to have the users be able to log in to the system without having to consult me. An acceptable solution I found after some Googling was as follows:               passwd -d uname     chage -d 0 uname      The first line sets an empty password for the user `uname` so they can login directly. The second line causes `uname`'s password to expire so that they're forced to change it on next login. I figure this is a good enough compromise. This is all well and good if the user logs in on the server. It does not work if the user attempts NIS authentication from a different box. They still get the message of "Password change required" but it's immediately followed by "Authentication Token Manipulation Error"; which, I'm guessing, is due to the fact that the password change is attempted via `passwd` rather than `yppasswd`. So this is the pickle I'm currently in. How can I achieve continuity without awkwardly forcing the users to first log in on the server? * * * **EDIT**   * This is similar to what I'm talking about; except it makes no mention of NIS.   * This seems to suggest that it's actually impossible. Can anyone refute that or confirm it? * * * **EDIT 2** I just noticed that when users try logging in on the server, they can do so normally without error messages. On a different box (to test NIS), I switched to root then tried `su`'ing into one of the NIS users. It succeeds while giving me a warning that says "Authentication failed (Ignored)". I'm guessing this comes from the PAM policy chain.


title: Rock-stable filesystem for large files (backups) for linux

text: What filesystem would be best for backups? I'm interested primary in stability (especially uncorruptability of files during hard reboots etc.) but how efficiently it handles large (>5GB) files is also important. Also, which mount parameters should I use? Kernel is Linux >= 2.6.34. **EDIT:** I do _not_ want backup methods. I need the filesystem to store them.


title: How to find application's path from command line?

text: For example, I have `git` installed on my system. But I don't remember where I installed it, so which command is fit to find this out?


title: Is there a way to sync only one partition?

text: Is there a way to sync only one partition instead of all partitions? Something like "sync /dev/sdc1".


title: Should OpenVPN point to point tunnels be on different ports?

text: The OpenVPN cookbook shows an example for site-to-site VPN (3 sites). They configured each tunnel on a unique port:   1. site A to site B: 1194    2. site A to site C: 1195   3. site B to site C: 1196 The author does not give any information about it. I didn't find anything useful in the man pages.   Is this a rule? Should we assign a unique port for every single point to point tunnel?


title: How to interact with the concrete file system?

text: Can a userspace program interact with the concrete file system(not VFS). What i have got is, that VFS allow linux to treat all file systems alike and gives a abstracted api to user space. I want to achieve a condition where a custom file system should be able to give a api for read, write and erase on disk(SSD) at page level usable at userspace. For which i will need to have a method to achieve interaction to the concrete file system bypassing the VFS.


title: Own distro, own name?

text: There are lots of tools to modify the system of Linux distro. I would like to start own OS. But I am not good at such programming. If I take Linux Fedora... I would use this tools and install important packages. Could I call this a new distro, like "Linux XYZ"? I've seen that about Linux Backtrack, which is just remade Ubuntu. May I also remake ready Linux distro to my own? Shortly, may I modify Linux distro and give it my own name?


title: Java SWT App: Need 64-bit swt.jar

text: I have a Java app that I want to run in Ubuntu, but I have Java 64 so I can't run it because it only has the 32-bit swt.jar. I can't build it myself, so Is there anyone that can provide the 64-bit swt.jar?


title: Retrieving email from POP3 server for multiple addresses and storing for local users

text: I have about 20 email users with accounts on our web host's POP3 server who are getting bombarded with hundreds of spam emails every day. I setup an Untangle box to deal with the spam, and it does a really good job of getting rid of most of the junk. The problem is, that throughout the night they receive so much spam that when they attempt to get their email, in the morning it can sometimes take literally hours for all of the messages to be scanned and then delivered to the inbox. What I'd like to do is setup a server to continually get the mail from the web host's POP3 server and store it until the user retrieves it and hopefully avoid the bottleneck of having to filter hundreds or thousands of messages in the morning. I think I can use MailUtils to get the mail from the remote server, but where I fall short is how to store the mail locally and be able to have the users get their mail from the local server. It seems logical that I'll have to setup a POP3 server for the users to get the stored mail, but how do I "transfer" (for lack of a better term) the mail into my local POP3 server after I've pulled it from the remote server?


title: Is it possible to use a lamp server for serving files from a nas?

text: In my current home-network setup, i am running freenas 8 on a mini-itx box (on which i store all my files). I'm thinking about building an extra l.a.m.p. server with some spare parts (for use in my web-development, and related projects). I'm thinking it would be great to have this lamp server also be the middle man in serving files (from my nas) to selected friends and family (preferably over a web interface, something like ajaxplorer for example). So in this setup the lamp server will be the gateway between my home-network and the web (and will thus hopefully make it easier to control access from and to the web). Is this possible? Does anyone have any experience with this kind of setup, and what are the potential pitfalls?


title: Why can I only use apt-get when I use "su"?

text: Not sure what info you need here, if any. Just let me know. I have a proxy that bypasses the corporate net set in my profile file for both su and normal user. When I do a sudo or regular apt-get install as a normal user, it hangs as if it can't communicate out, I have inter-web access though. When I do the same apt-get as a su, it works, no problem. What you think ?


title: How to create Maildir directory with enough permissions for Postfix?

text: I have CentOS 5.5 with Postfix installed on it. I want to use **local** delivery agent with default setting, but I want it to store mail with **Maildir directory** style mailboxes. When I set the mailboxes to be stored ( as default ) in:               mail_spool_directory = /var/spool/mail/      And I manually create maildir, so it looks like this:               [root@dx2200 /]# ls -lah /var/spool/mail/     total 32K     drwxrwxr-x  4 root  mail 4.0K Mar 15 15:01 .     drwxr-xr-x 13 root  root 4.0K Mar 15 14:33 ..     drwxr-xr-x  5 root  root 4.0K Mar 15 14:52 marshra     drwxr-sr-x  5 pedro mail 4.0K Mar 15 15:01 pedro     [root@dx2200 /]#      [root@dx2200 /]# ls -lah /var/spool/mail/pedro/     total 40K     drwxr-sr-x 5 pedro mail 4.0K Mar 15 15:01 .     drwxrwxr-x 4 root  mail 4.0K Mar 15 15:01 ..     drwxr-sr-x 2 pedro mail 4.0K Mar 15 15:01 cur     drwxr-sr-x 2 pedro mail 4.0K Mar 15 15:01 new     drwxr-sr-x 2 pedro mail 4.0K Mar 15 15:03 tmp     [root@dx2200 /]#      And then I try to send mail to local user `pedro`, the message is not being delivered, and my `/var/log/maillog` says:               Mar 15 15:11:00 dx2200 postfix/local[4266]: warning: maildir access problem for UID/GID=1014/1014: error writing message: Permission denied     Mar 15 15:11:00 dx2200 postfix/local[4266]: warning: perhaps you need to create the maildirs in advance     Mar 15 15:11:00 dx2200 postfix/local[4266]: 8D5D11310056: to=<pedro@dx2200.it.eclocal>, orig_to=<pedro>, relay=local, delay=0.04, delays=0.02/0.01/0/0.01, dsn=5.3.0, status=bounced (maildir delivery failed: error writing message: Permission denied)      I've had similar problem with **virtual** delivery agent, and changing `virtual_mailbox_base` from `/var/spool/vmail` to home directory `/home/vmail` did help. Do I have to do it also with **local** delivery agent ? **AND IF SO** - why can't I store mail in `/var/spool` ?


title: How to kill a ghost process? AIX 6.1

text: oslevel: 6100-05-01-1016 according to topas:               root    1769602       1  93 20   112     0   128 32498:07 87.1    0    0 ldmp_pro      according to ps:               -bash-4.1# ps -ef | egrep -i "1769602|ldmp"         root  9502842 22806540   1 13:24:32 pts/17  0:00 egrep -i 1769602|ldmp      -bash-4.1#       kill:               -bash-4.1# kill -9 1769602     -bash-4.1#       and it keeps going in topas/nmon, but i still can't see it in ps.. :D How can I kill the "ldmp_pro"? It consumes a lot of CPU..


title: How do I record disk performance on slow hardware and then replay it to faster hardware and benchmark it?

text: I am currently performing various development tasks that are slow on my current system because of IO performance. Is there a way to record disk operations while performing IO consuming tasks, including performance info (writes/second, reads/second, etc) and then replay them on a new system to see which would the performance be there _(without having to re-run the same command over the same set of data)_? Would **blktrace** , **blkparse** or **fio** help me in this case? For example: Let's say on my system I want to benchmark a               find -name "*.php" | xargs grep -r "test_string"      inside a folder containing 50 000 files (on multiple levels, of course) I'd like to capture all the disk operations, including statistics, and then replay them on another system that does not have the 50 000 files folder. Basically, just simulating the operations and checking out if they are done any faster. I've tried capture the disk samples by using               blktrace -d /dev/sda -o myfile.blk      but I do not know how I can try and replay them with **fio**. Is this possible? Thanks


title: Pen Drive Not detected in Linux

text: I inserted a new pendrive. The following is the dmesg output:               [127321.248105] usb 2-2: new high speed USB device using ehci_hcd and address 9         [127321.380898] scsi11 : usb-storage 2-2:1.0         [127322.381159] scsi 11:0:0:0: Direct-Access     XXXXXXXX U1170CONTROLLER  0.00 PQ: 0 ANSI: 2         [127322.384481] sd 11:0:0:0: Attached scsi generic sg2 type 0         [127322.387127] sd 11:0:0:0: [sdb] Attached SCSI removable disk              But after executing the `fdisk -l` there is no device showing /dev/sdb Following is the output of fdisk command:                  Device Boot      Start         End      Blocks   Id  System                 /dev/sda1   *           1       19103   153443296    7  HPFS/NTFS            /dev/sda2           19103       34764   125794300    7  HPFS/NTFS            /dev/sda3           34764       38914    33333249    5  Extended            /dev/sda5           34764       34776       97280   83  Linux            /dev/sda6           34776       35025     1998848   82  Linux swap / Solaris            /dev/sda7           35025       38914    31235072   83  Linux    `      Can somebody please tell me how to debug this problem ? **Edit:** _There is one sdb created in the /dev directory after inserting the usb drive._ On executing the the following command I am getting the output as:               root@pradeep-laptop:~# mount /dev/sdb /mnt     mount: /dev/sdb: unknown device      Here is the output of `lsusb` command :               Bus 005 Device 002: ID 1c4f:0002 SiGma Micro      Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 002 Device 002: ID 0a5c:2101 Broadcom Corp. Bluetooth Controller     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 007: ID 048d:1170 Integrated Technology Express, Inc.      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub      The Line `Bus 001 Device 007: ID 048d:1170 Integrated Technology Express, Inc.` was added after inserting the pen drive. ![Here is the error which I received while creating partition table using gparted](http://i.stack.imgur.com/MP6DY.png)


title: Alternative for `sleep seconds` that takes system load into account?

text: So I develop my server app and some client apps for it. After each rebuild I start my server (which tends to load qup all services for something like 2 seconds) and then I start my clients... So his is what I have in my script:               cd $RUN_DIR     nohup ./CloudServer >& /dev/null &     sleep 5     nohup ./CloudClient --server=localhost --username=$ROBOT1_NAME --robot >& /dev/null &     nohup ./CloudClient --server=localhost --username=$ROBOT2_NAME --robot >& /dev/null &      I wonder are there any alternatives for `sleep` in Bash? Like wait at least 5 seconds and then until CPU activety on process `X` will go down to 1% and then launch what I need?


title: open() console for default file descriptors

text: I'm reading a shell program implementation in C ( the xv6 shell from MIT's 6.828 Operating System Engineering course ). The `main()` function for this shell starts with the following code:               //Assumes three file descriptors open     while((fd = open("console", O_RDWR)) >= 0){         if(fd >= 3){             close(fd)             break;         }     }      This is a quote from the xv6 book which explains the code above: > _"The shell ensures that it always has three file descriptors open which are > the default file descriptors for the console."_ * * * I understand that `open()` will return a file descriptor with the lowest number available, thus this code is making sure that there are no more than three file descriptors open, which is pretty obvious after reading the author's explanation. But, the part which I don't understand is:   1. Why does the shell wants to close all file descriptors but 0, 1 and 2 ? After all it is guaranteed that 0, 1 and 2 will be associated with the console, isn't it? Why should the shell care about file descriptors with a greater number being closed?   2. I guess I don't really understand the purpose of the console ( /dev/console ? ) file here.


title: Autocomplete of filename in directory

text: This question is quite similar to this one, but I can't understand the solution. I also know this tutorial, but still I am unable to understand what I am doing wrong. I am trying to autocomplete the list of directories that are placed in `/something/`:               $ ls /something/          One    Other    Three      in a way that this will happen:               $ hi [TAB]          One Other Three     $ hi O[TAB]          One Other      Only when the first word is `hi` and not only inside `/something/`. This is what I am doing in `.profile`:               _codeComplete()     {         local cur=${COMP_WORDS[COMP_CWORD]}         COMPREPLY=( $(compgen `ls /something/` -- $cur) )          }     complete -F _codeComplete "hi "


title: Having some trouble using "find -exec {} +"

text: Disclaimer: I am a novice to Unix/Linux, but I am looking forward to learning! I have tried a search on this stackexchange and read the the `man find`, but I can't seem to figure this out. I want to use the `find ... -exec {} +` command to recursively find all files with a particular file extension and run a command on the list of files. There are approximately 100k files that I need to convert. The command that I am running accepts the filename (or a list of filenames, eg `f1 f2 f3`) as a parameter, but I also need to specify additional parameters to run the command. What I tried so far: This works:               find . -iname "*.extension" -exec <command> {} <additional parameters> \;      This doesn't seem to work:               find . -iname "*.extension" -exec <command> {} <additional parameters> +      I get the error message, `find: missing argument to '-exec'`. I am guessing that I cannot specify additional parameters after the `{}`? Some notes: The command in question takes the filename as the first parameter, and then I need to designate some additional parameters, such as the output directory `-o <outputDir>` and the variables to extract from the files `-v <var1,var2,...>`. I am running this on the terminal in Ubuntu 12.04, if that makes any difference.


title: su command with -p or -m flags

text: What is the difference between the following su commands?               su -m     su -p      I know that both flags are used to preserve the current environment but I don’t know the differences if there are any.


title: booting very slow

text: I have Linux Mint 14 and it was fine, but lately it takes a lot longer to boot. I have my linux installation on one partition. I had a dual boot first, then I removed windows. So, that freed up 2 more partitions, which I added entries to /etc/fstab to mount them automatically instead of requiring me mounting them manually every time. Not always, but sometimes a screen shows up during boot that says the /tmp drive is not ready and gives me the options to wait, cancel or manually. I am not sure why it takes so long to boot now when it used to be fine earlier. Here is the bootchart - http://dl.dropbox.com/u/521537/laptop- nadia-20130409-1.png. I can see some long delays but I dont think I can understand why or how to fix it. Can anyone help me out?


title: Can I rollback an apt-get upgrade if something goes wrong?

text: Is there a way, before starting an `aptitude upgrade` or `apt-get upgrade`, to set up something so that you can "easily" rollback your system to the "apt" state it was before the actual upgrade, if something goes wrong? That is, for example, reinstall the old version of the packages that were upgraded during the process. (EDIT) _A few hints_ : I know that `etckeeper` for example uses some hook on `apt` so that it is notified whenever `apt` installs or uninstalls a package. I suppose there could be some kind of script that could save the list of newly installed package and their previous version number to be able to reinstall them from the `apt` cache (`/var/cache/apt/archives`). There is also `checkinstall` which can keep track of file modifications... Any details on how to achieve that properly?


title: Attach multiple times to a single screen session

text: I've been using `screen -dRaA -S x` to open up a single session between different workstations as I move about. Handy. Is it possible to connect multiple times to a single session, though, without disconnecting others? When I have two machines I'm quickly moving between even reconnecting starts to slow me down.


title: broken pipe error with popen and JS ffi

text: I am using a ffi for nodejs which for the most part has nothing to do with this question which is really about understanding pipes better, but does offer some context               function exec(cmd) {       var buffer = new Buffer(32);       var result = '';       var fp = libc.popen('( ' + cmd + ') 2>&1', 'r');       var code;            if (!fp) throw new Error('execSync error: '+cmd);            while( !libc.feof(fp) ){         libc.fgets(buffer, 32, fp)         result += buffer.readCString();       }       code = libc.pclose(fp) >> 8;            return {         stdout: result,         code: code       };     }      which brings me to this bit of code that when i run using this exec function                tr -dc "[:alpha:]" < /dev/urandom | head -c ${1-8}      I get the error               write error: Broken pipe     tr: write error      but I do get the output I expect 8 random numbers, this confused the hell out of me but then in some wild googling I found this stack answer which perfectly fit my situation. I am left with these questions though... Why does               tr -dc "[:alpha:]" < /dev/urandom | head -c ${1-8}      throw a broken pipe error when called with my exec command but not when called from the shell. I don`t understand why when I call               tr -dc "[:alpha:]" < /dev/urandom      it reads endlessly but when I pipe it to               head -c ${1-8}      It works with out throwing a broken pipe error. It seems that head would take what it needs and tr would just read for ever. At least it should throw broken pipe, head would consume the first 8 bytes and then tr would still be putting out output and broken pipe would be thrown by tr because head has stopped running. Both situations make sense to me but it seems that they are some what exclusive to each other. I don`t understand what is different between calling               exec(tr -dc "[:alpha:]" < /dev/urandom | head -c ${1-8})      and               tr -dc "[:alpha:]" < /dev/urandom | head -c ${1-8}      directly from the command line and specifically why < an endless file into something and then | it to something makes it not run endlessly, ive been doing this for years and never questioned why it works this way. Lastly is it ok to ignore this broken pipe err? Is there a way to fix it am I doing something wrong in my c++ ish javascript code. Am I missing some kind of popen basics? ------ EDIT messing around some more the code               exec('head -10 /dev/urandom | tr -dc "[:alpha:]" | head -c 8')      throws no pipe error!


title: Installing openjdk-7-jdk does not update java (which is still version 1.6)

text: I am having issues updating Java. I am running Ubuntu 11.10. I can execute `sudo apt-get install openjdk-7-jdk` and it completes successfully. `javac -version` is 1.7, however `java -version` is 1.6. This is similar to this problem but my issue is not, as far as I can tell, the path.               $ echo $PATH     /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games      Thanks.


title: Accessing bash [internal] brace expansion iteration number/variable

text: ## Question: Is it possible to access which number of a bash iteration is currently being processed? ### Psuedo-Command               mv {1..5}.something.{1..5} $x1.$x2.something        * Note: This is a logical representation; a non-working sample. ### Pseudo-Output               mv 1.something.1 1.1.something     mv 1.something.2 1.2.something     ...     mv n.something.m n.m.something        * Where n and m are both the iteration of their respective brace expansion. ### Explaination I am familiar with loops such as:               for x in {1..10}; do echo -n "$x "; done      As you can see, bash is setting the iteration to $x. I wish to learn if it is possible, and how to access the variable which bash uses when I am not defining which variable to use. When bash is given a _brace expansion_ without a variable to iterate over, it must do so [internally] somehow. I am hoping that this variable is accessible at run-time of the script. Thanks to all the folks on #bash


title: Why 2 linux machine behave differently with command of the same syntax?

text: I am using 2 machine , which is both _Red Hat Enterprise Linux AS release 3 (Taroon Update 2)_ ( I check it in /etc/*-release ). I checked they are using the same default shell by `ps -p $$`, which is bash. I tried to execute a find command with wildcard pattern: find path -name pattern -type f -ctime +3 and the pattern contain * character as wildcard. The first machine seems to expanded the wildcard character and causing error:               find /home/primbat/testing -name sftp_bcs_report_*.log -type f -ctime +7     find: paths must precede expression      and I need to either make the pattern in between 2 delimited qoute, e.g: `\"sftp_bcs_report_*.log\"` or using `set -f` in the script to suppress wildcard expansion. Which in the other machine, it have no such problem. Do you have any idea?


title: FuncName(){} vs function FuncName() {}

text: There is two ways to define function in bash script. 1.               function FuncName() {         echo "$FUNCNAME"     }      2.               FuncName() {         echo "$FUNCNAME"     }      So my questions is what's the different between in this and which one should be use.


title: USB 500GB external drive mounted with undetermined permissions, missing data

text: _**Note:** This situation is evolving. Please see the output at the end of this question for the current situation._ I'm using Linux Mint 14. Recently, I repartitioned one of my hard drives, and I backed up all my data to an external USB 500GB drive. Now I am trying to copy that data back. However, the drive is behaving strangely. When I plug it in, it shows up on my desktop: ![USB drive on desktop](http://i.stack.imgur.com/sOQNL.png) ... but when I right click and select to view "Properties", underneath the "Permissions" tab, it says: > The permissions of "USB500" could not be determined. ![The permissions of "USB500" could not be determined](http://i.stack.imgur.com/L2gYQ.png) Also, it shows that 359.7 GB of the drive is used, which is about the right amount for the data I backed up: ![Data used](http://i.stack.imgur.com/dbiIL.png) ... but, when look into the drive, most of the files are not visible to me. For example, when I look at the properties of the "dave" directory, where most of my files are backed up, it says it's only 1.3 MB in size: ![folder properties](http://i.stack.imgur.com/SWZum.png) There should be more like 300GB in that folder. Why are most of my files seemingly missing when the data used on disk is so much larger? Why is the permissions not determined? Most importantly, what is the safest process for me to diagnose problems and retrieve the data off this disk? * * * **Update:** This output was requested in an answer below:               $ mount | grep USB500     /dev/sdd1 on /media/dave/USB500 type ext4 (rw,nosuid,nodev,uhelper=udisks2)      When I ran the following command, I got a huge stream of lines that ended with `Input/output error` (too many to reproduce here, but they're all basically the same):               $ sudo find /media/dave/USB500 -ls | less     find: `/media/dave/USB500/dave/.guayadeque': Input/output error     find: `/media/dave/USB500/dave/.compiz-1': Input/output error     find: `/media/dave/USB500/dave/.anthy': Input/output error     find: `/media/dave/USB500/dave/.compiz': Input/output error     find: `/media/dave/USB500/dave/Apache_Logs': Input/output error     find: `/media/dave/USB500/dave/.avidemux': Input/output error     find: `/media/dave/USB500/dave/.dvdrip': Input/output error      On the one hand, this seems to indicate a possible hardware failure(?). On the other hand, it is listing all the files I'm hoping to recover... so is it possible they are accessible? I really hope so... * * * **Update 2:** I tried running fsck in hopes of repairing the drive and recovering at least some data, but I got this response:               $ sudo fsck -y /dev/sdb     fsck from util-linux 2.20.1     e2fsck 1.42.5 (29-Jul-2012)     fsck.ext2: Attempt to read block from filesystem resulted in short read while trying to open /dev/sdb     Could this be a zero-length partition?      Sometimes the drive does not seem to mount, I have not determined a pattern as to what causes it to become un-mountable. After turning it off and on, or after a reboot, I seem to be able to get it back. I removed the hard drive from it's USB interface and connected it to the computer's internal P/SATA bus, but it seemed that the drive behaved exactly the same, with identical symptoms. I believe this drive is dying, so right now the goal is to try to find some way to access the data that should be there just long enough to copy as much of it as possible. Suggestions on how I might do that would be most appreciated. There are actually just a few key directories I would like to access, so hopefully, if the failure is not too global, I might be able to get what I need. * * * **Update 3:** I'm currently running the following command. I started it a day ago, and it's still going. I hope it is doing something useful. If anyone can confirm for me what the output below indicates about its progress, that would be very helpful.               $ sudo ddrescue -r3 /dev/sdb /home/dave/RECOVERY/usb500.image     /home/dave/recovery_usb500.logfile               Press Ctrl-C to interrupt     Initial status (read from logfile)     rescued:         0 B,  errsize:       0 B,  errors:       0     Current status     rescued:         0 B,  errsize:    500 GB,  current rate:        0 B/s        ipos:     5366 MB,   errors:       1,    average rate:        0 B/s        opos:     5366 MB,     time from last successful read:       1 d     Splitting failed blocks...


title: cron from multiple files

text: How do I make cron daemon check cron entries from more than one files. In my project I need to frequently update cron file, so instead of manipulating the existing file I was planning to write my project cron entries in a dedicated cron file.