title: Sed: how to replace nextline \n symbol in text files?

text: I need to fix an error and to replace the second tag `</time>` with ` in an XML file with the following structure:               <time>20260664</time>     <tags>substancesummit ss</time>     <geo>asdsadsa</geo>     <time>20260664</time>     <tags>substancesummit ss</time>     <geo>asdsadsa</geo>      I'm trying to do it using sed and since I have 2 `</time>` closing tag per item, my idea is to replace `</time><geo>` with `</tags><geo>`. However there is a next line symbol in between, so I'm using `\n` but it doesn't work:               sed 's/time>\n<geo>/tags>\n<geo>/g' old.xml > new.xml      Any help?


title: cron not executing?

text: I have the following cron tab installed:               crontab -l     # m h  dom mon dow   command     */10 * * * * "echo" >> /tmp/cron.log      The server is at rackspace, it's a cloud server:               Linux myserver #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux     Ubuntu 10.04 LTS      When I added this entry to the crontab using `crontab -e` I got the following message when I saved it:               crontab: installing new crontab      But it's not being executed, what is missing?


title: How do I make a certain command sudo-only on Debian?

text: What user and group should I chown it to? All admins are in 'admins' group. How do I chmod it?


title: Establishing an AP on Raspberry pi

text: I'm trying to setup an access point, using Raling RT5370 USB Dongle on a Debian system, I followed the following tutorial, until "Internet connection Sharing.", I don't want to share internet, so I skip this step. After the reboot I can see the AP, but I can't connect, it seams I can't get an IP address, how can I debug on raspberry to see what's happening or where did I made the mistake? This is my dhcpd.conf file content:               ddns-update-style none;          subnet 10.10.0.0 netmask 255.255.255.0 {             range 10.10.0.2 10.10.0.16;             option domain-name-servers 8.8.4.4, 208.67.222.222;             option routers 10.10.0.1;     }      The system log:               Aug 11 20:47:46 raspberrypi dhcpd: Wrote 0 leases to leases file.     Aug 11 20:47:46 raspberrypi dhcpd:      Aug 11 20:47:46 raspberrypi dhcpd: No subnet declaration for wlan0 (no IPv4 addresses).     Aug 11 20:47:46 raspberrypi dhcpd: ** Ignoring requests on wlan0.  If this is not what     Aug 11 20:47:46 raspberrypi dhcpd:    you want, please write a subnet declaration     Aug 11 20:47:46 raspberrypi dhcpd:    in your dhcpd.conf file for the network segment     Aug 11 20:47:46 raspberrypi dhcpd:    to which interface wlan0 is attached. **     Aug 11 20:47:46 raspberrypi dhcpd:      Aug 11 20:47:46 raspberrypi dhcpd:      Aug 11 20:47:46 raspberrypi dhcpd: Not configured to listen on any interfaces!      sytemlog:               Aug 11 21:00:23 raspberrypi hostapd: wlan0: STA 5c:0a:5b:24:43:d9 IEEE 802.11: disassociated     Aug 11 21:00:23 raspberrypi hostapd: wlan0: STA 5c:0a:5b:24:43:d9 IEEE 802.11: disassociated     Aug 11 21:00:26 raspberrypi hostapd: wlan0: STA 5c:0a:5b:24:43:d9 IEEE 802.11: authenticated     Aug 11 21:00:26 raspberrypi hostapd: wlan0: STA 5c:0a:5b:24:43:d9 IEEE 802.11: associated (aid 1)     Aug 11 21:00:26 raspberrypi kernel: [  123.878201] BUG: scheduling while atomic: hostapd/1358/0x00000002     Aug 11 21:00:26 raspberrypi kernel: [  123.878227] Modules linked in: aes_generic 8021q garp stp llc snd_bcm2835 snd_pcm snd_seq snd_timer snd_seq_device snd snd_page_alloc arc4 rt2800usb rt2800lib crc_ccitt rt2x00usb rt2x00lib mac80211 cfg80211     Aug 11 21:00:26 raspberrypi kernel: [  123.878515] [<c00153d4>] (unwind_backtrace+0x0/0xfc) from [<c03f9598>] (dump_stack+0x20/0x24)     Aug 11 21:00:26 raspberrypi kernel: [  123.878580] [<c03f9598>] (dump_stack+0x20/0x24) from [<c00216d0>] (__schedule_bug+0x74/0x80)     Aug 11 21:00:26 raspberrypi kernel: [  123.878621] [<c00216d0>] (__schedule_bug+0x74/0x80) from [<c03f9e00>] (__schedule+0x568/0x670)     Aug 11 21:00:26 raspberrypi kernel: [  123.878669] [<c03f9e00>] (__schedule+0x568/0x670) from [<c03fa4cc>] (schedule+0x58/0x70)     Aug 11 21:00:26 raspberrypi kernel: [  123.878708] [<c03fa4cc>] (schedule+0x58/0x70) from [<c03fa9b4>] (schedule_timeout+0x1a0/0x34c)     Aug 11 21:00:26 raspberrypi kernel: [  123.878745] [<c03fa9b4>] (schedule_timeout+0x1a0/0x34c) from [<c03fa2c4>] (wait_for_common+0xf0/0x1c4)     Aug 11 21:00:26 raspberrypi kernel: [  123.878793] [<c03fa2c4>] (wait_for_common+0xf0/0x1c4) from [<c03fa44c>] (wait_for_completion_timeout+0x1c/0x20)     Aug 11 21:00:26 raspberrypi kernel: [  123.878842] [<c03fa44c>] (wait_for_completion_timeout+0x1c/0x20) from [<c02dd2f4>] (usb_start_wait_urb+0xac/0xd4)     Aug 11 21:00:26 raspberrypi kernel: [  123.878884] [<c02dd2f4>] (usb_start_wait_urb+0xac/0xd4) from [<c02dd538>] (usb_control_msg+0xd4/0xf8)     Aug 11 21:00:26 raspberrypi kernel: [  123.878962] [<c02dd538>] (usb_control_msg+0xd4/0xf8) from [<bf09eddc>] (rt2x00usb_vendor_request+0xc0/0x144 [rt2x00usb])     Aug 11 21:00:26 raspberrypi kernel: [  123.879030] [<bf09eddc>] (rt2x00usb_vendor_request+0xc0/0x144 [rt2x00usb]) from [<bf09ef18>] (rt2x00usb_vendor_req_buff_lock+0x70/0x120 [rt2x00usb])     Aug 11 21:00:26 raspberrypi kernel: [  123.879105] [<bf09ef18>] (rt2x00usb_vendor_req_buff_lock+0x70/0x120 [rt2x00usb]) from [<bf09f148>] (rt2x00usb_vendor_request_buff+0x78/0xbc [rt2x00usb])     Aug 11 21:00:26 raspberrypi kernel: [  123.879182] [<bf09f148>] (rt2x00usb_vendor_request_buff+0x78/0xbc [rt2x00usb]) from [<bf0bc1b4>] (rt2x00usb_register_multiread+0x48/0x50 [rt2800usb])     Aug 11 21:00:26 raspberrypi kernel: [  123.879274] [<bf0bc1b4>] (rt2x00usb_register_multiread+0x48/0x50 [rt2800usb]) from [<bf0ab014>] (rt2800_get_tkip_seq+0x50/0x80 [rt2800lib])     Aug 11 21:00:26 raspberrypi kernel: [  123.879588] [<bf0ab014>] (rt2800_get_tkip_seq+0x50/0x80 [rt2800lib]) from [<bf0528d8>] (ieee80211_get_key+0x1a8/0x1f8 [mac80211])     Aug 11 21:00:26 raspberrypi kernel: [  123.879964] [<bf0528d8>] (ieee80211_get_key+0x1a8/0x1f8 [mac80211]) from [<bf00a908>] (nl80211_get_key+0x288/0x328 [cfg80211])     Aug 11 21:00:26 raspberrypi kernel: [  123.880130] [<bf00a908>] (nl80211_get_key+0x288/0x328 [cfg80211]) from [<c036c2bc>] (genl_rcv_msg+0x1f0/0x23c)     Aug 11 21:00:26 raspberrypi kernel: [  123.880183] [<c036c2bc>] (genl_rcv_msg+0x1f0/0x23c) from [<c036b568>] (netlink_rcv_skb+0xcc/0xe8)     Aug 11 21:00:26 raspberrypi kernel: [  123.880219] [<c036b568>] (netlink_rcv_skb+0xcc/0xe8) from [<c036c0c0>] (genl_rcv+0x28/0x34)     Aug 11 21:00:26 raspberrypi kernel: [  123.880254] [<c036c0c0>] (genl_rcv+0x28/0x34) from [<c036ae78>] (netlink_unicast+0x2c8/0x320)     Aug 11 21:00:26 raspberrypi kernel: [  123.880297] [<c036ae78>] (netlink_unicast+0x2c8/0x320) from [<c036b0e0>] (netlink_sendmsg+0x210/0x328)     Aug 11 21:00:26 raspberrypi kernel: [  123.880341] [<c036b0e0>] (netlink_sendmsg+0x210/0x328) from [<c0336cf0>] (sock_sendmsg+0xb0/0xd0)     Aug 11 21:00:26 raspberrypi kernel: [  123.880380] [<c0336cf0>] (sock_sendmsg+0xb0/0xd0) from [<c033713c>] (__sys_sendmsg+0x318/0x338)     Aug 11 21:00:26 raspberrypi kernel: [  123.880428] [<c033713c>] (__sys_sendmsg+0x318/0x338) from [<c0338c38>] (sys_sendmsg+0x4c/0x78)     Aug 11 21:00:26 raspberrypi kernel: [  123.880475] [<c0338c38>] (sys_sendmsg+0x4c/0x78) from [<c000e140>] (ret_fast_syscall+0x0/0x48)     Aug 11 21:00:26 raspberrypi hostapd: wlan0: STA 5c:0a:5b:24:43:d9 RADIUS: starting accounting session 5026C775-00000001     Aug 11 21:00:26 raspberrypi hostapd: wlan0: STA 5c:0a:5b:24:43:d9 WPA: pairwise key handshake completed (RSN)      hostapd.conf               interface=wlan0     driver=nl80211     ssid=quadcopter     channel=1     hw_mode=g     auth_algs=1     wpa=3     wpa_passphrase=1234567890     wpa_key_mgmt=WPA-PSK     wpa_pairwise=TKIP CCMP     rsn_pairwise=CCMP      Interface               auto lo          iface lo inet loopback     iface eth0 inet dhcp          auto wlan0     iface wlan0 inet static      address 10.10.0.1      netmask 255.255.255.0      ifconfig               mon.wlan0 Link encap:UNSPEC  HWaddr 00-0F-53-B1-13-41-00-00-00-00-00-00-00-00-00-00                 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1812 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:545248 (532.4 KiB)  TX bytes:0 (0.0 B)          wlan0     Link encap:Ethernet  HWaddr 00:0f:53:b1:13:41                 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:11 errors:0 dropped:5 overruns:0 frame:0               TX packets:8 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:1915 (1.8 KiB)  TX bytes:1698 (1.6 KiB)      Do I have to setup something else, because I can see the AP but I can't connect. I just tested on Ubuntu 12.04 and it's working, I did the same configuration on the Raspberry Pi, without success


title: "Error: permission denied" error from Transmission Client

text: i have done the following on my Asus WL-520gu   1. Installed the dd-wrtv24-sp2 mini svn:13064   2. Updated for usb support   3. Installed optware package   4. Activated the transmission client but i keep getting a permission error for files. I think it is a user access thing. How to resolve this issue? Is there any way to ignore user permissions on a drive? **Update:** i think it is due to the permissions of the user under which the transmission daemon is running. Can I change that user to root? I know where but don't know how `/etc/init.d/transmission`. ![enter image description here](http://i.stack.imgur.com/BoWYZ.png)


title: Bash if conditions of variables within intervals

text: I have some data spread over time intervals, and I want to take some of those data within the time intervals. For example, I have data at times within 1..9, 11..19, etc., and I want to take data within 1-2, then 11-12, etc. This will be part of a more complex `bash` script, in which I want to include this condition, with a `if` cycle, to isolate the times where I can catch the data. I was thinking something like:               if (( $t_initial & $t_final )) in (begin1, fin1) or in (begin2, fin2) ...      where `t_initial` and `t_final` are calculated separately, by the script itself. I can not write this condition in `bash` syntax. I found some other solutions, but they seem extremely long and inconvenient, so I am here to ask simpler and more readable solutions. * * * It is important that the code works properly with floats. I am trying to fix the OP solution for this, but still can't find a way.


title: Command set in /etc/rc.local on Ubuntu 13.04 is ignored

text: I am trying to set my Ubuntu 13.04 machine in a way that, upon reboot, an instruction is executed and a program is launched with specific parameters, REGARDLESS of whether a user is logged on to the machine physically or by SSH. This is the instruction that needs to be executed:               /root/ccminer/ccminer -a x11 -o stratum+tcp://drk.smartcoinpools.com:7903 -u XgZLPCQkGvvpK42jAAtgRHvs8J25xKn1XS -p picciolibeddi -q      I have modified, therefore, my /etc/rc.local as follows:                #!/bin/sh -e      #      # rc.local      #      # This script is executed at the end of each multiuser runlevel.      # Make sure that the script will "exit 0" on success or any other      # value on error.      #      # In order to enable or disable this script just change the execution      # bits.      #      # By default this script does nothing.                /root/ccminer/ccminer -a x11 -o stratum+tcp://drk.smartcoinpools.com:7903 -u XgZLPCQkGvvpK42jAAtgRHvs8J25xKn1XS -p picciolibeddi -q          exit 0      I can't really understand why this instruction is totally ignored after rebooting, yet if I launch it manually from shell it works perfectly, so there are no errors of syntax in it. I would appreciate it loads if you could please help me, bearing in mind that I need to run this command BEFORE any user is logged in.


title: Invoke Syscalls from Java

text: Is there a way to invoke syscalls directly from Java, or is it necessary to first call a native method?


title: using cross-compiled Valgrind

text: I have downloaded the sources from the Valgrind trunk and built it for using on an embedded Linux system(Montavista Linux) powered by an ARM926(ARMv5t architecture). Everything went well until I tried to run it to check some application I've made; Valgrind tells me: _"valgrind: failed to start tool 'memcheck' for platform 'arm-linux': No such file or directory"._ Trying to run any other tool gives the same message. For _make install_ I used the --prefix option pointing to the embedded system's filesystem which is mounted through NFS(e.g. --prefix=/home/NFS_mounted/opt/valgrind). I checked the installation location and the _lib_ directory there contains the proper tools; I also checked the corresponding pkgconfig file for Valgrind and it seems to be OK so I'm kind of clueless right now and can't figure out what's going wrong. 2 questions:   1. Is it correct to use/install a cross-compiled Valgrind like that? Maybe I'm doing something wrong regarding the setup, or maybe there is something involving the host system that I'm missing(gdb/gdbserver like).   2. Has anyone tried running it on ARM architectures? I'm aware that the support is fairly recent so I'm wondering if I could get decent results.


title: Connecting to a network via another pc

text: What's a _simplistic_ recipe to connect my PC to my WLAN through my laptop? I have one wireless network, one desktop that (for practical reasons) has no connection to the WLAN, and one laptop with wireless and an ethernet port. I would like to run a cable from my desktop to my laptop, connect my laptop to my WLAN and forward the network to my desktop. Is there a solution?


title: Boot time discrepancy using systemd on Debian 7.4

text: I recently installed `systemd` on my Debian 7.4 system. The time from pressing the power button to usable desktop is around 42-44 seconds. The BIOS takes 6-7 seconds to load and transfer control to GRUB. GRUB has a timeout of 0, in `/etc/default/grub`. After that the system takes almost 35 seconds more. However, `systemd` reports taking just 19 seconds.               $ systemd-analyze     Startup finished in 4353ms (kernel) + 14291ms (userspace) = 18644ms      That means, that there is a 16 second delay somewhere. This delay appears to occur just after GRUB finishes and transfers control to the OS. The boot process gets stuck on a screen that says "Loading, please wait" for this time. After the 16 seconds pass, I get a feedback stating these two things:               systemd-fsck [..] : /dev/sda1 .... clean     ... bad mmio address ...      Firstly, what is taking these extra 16 seconds? Is it `fsck` or the `mmio` address error? I feel that it is `systemd-fsck`, and I have tried to solve the problem. I have edited `/etc/fstab` and changed the `pass` parameter to 0 for all volumes. However, this still continues to occur. So, how do I disable `fsck` on boot for the root (/dev/sda1) partition, or otherwise reduce the time during boot? This thread suggests a solution for non-root drives, which I haven't attempted on `/`.


title: games directory?

text: On a standard filesystem, we have:               /usr/games     /usr/lib/games     /usr/local/games     /usr/share/games     /var/games     /var/lib/games      Is this a joke, or is there some history behind this? What is it for? Why do we have separate and specialized directories for something like games?


title: MBR to GPT Conversion of existing RHEL 6 system

text: I have got RHEL 6 running on MBR (Master Boot Record), management is done using fdisk and parted commands. I would like to know the steps or procedure to convert existing system to GPT (GUID Partition Table) can be managed using (gdisk and gparted) for large disk support. Also wants to make sure whether system has got normal BIOS is EFI BIOS. Is there any command for that? And if system have got normal BIOS how to implement GPT?


title: How to access Win7 on a dual boot machine?

text: I've been dual booting Win7 and Ubuntu for about 4 months and I got on it today to change the default boot on grub, because my girlfriend kept getting locked out when it reboots and, by default, goes to the Ubuntu partition. I tried using the command promt. I used the command found here which was `sudo gedit /etc/default/grub` That didn't appear to do anything so I changed the grub using the file manager and changed "Default grub=4" which, is the boot I was supposed to use... This led to my Windows 7 partition dissapearing from the boot list, somehow, although all files are still showing up on the OS (checked through Ubuntu) and System Recovery shows my latest restore, attempted to restore and said it should be working.. So I'm assuming its hidden in some way? I'm using BT5R3. `/etc/default/grub:`               # If you change this file, run 'update-grub' afterwards to update     # /boot/grub/grub.cfg.          GRUB_DEFAULT=4     #GRUB_HIDDEN_TIMEOUT=0     GRUB_HIDDEN_TIMEOUT_QUIET=true     GRUB_TIMEOUT=10     GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`     GRUB_CMDLINE_LINUX_DEFAULT="text splash vga=791"     GRUB_CMDLINE_LINUX=""          # Uncomment to disable graphical terminal (grub-pc only)     #GRUB_TERMINAL=console          # The resolution used on graphical terminal     # note that you can use only modes which your graphic card supports via VBE     # you can see them in real GRUB with the command `vbeinfo'     GRUB_GFXMODE=1024x768          # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux     #GRUB_DISABLE_LINUX_UUID=true          # Uncomment to disable generation of recovery mode menu entries     #GRUB_DISABLE_LINUX_RECOVERY="true"          # Uncomment to get a beep at grub start     #GRUB_INIT_TUNE="480 440 1"      Shell history:               1  exit         2  startx         3  apt-get software center         4  apt-get software-center         5  sudo apt-get software-center         6  install software-center         7  mkdir /opt/java         8  mv -f jre1.70_05/ /opt/java         9  tar xzvf jre-7u45-linux-i586.tar.gz.        10  tar: tar xzvf jre-7u45-linux-i586.tar.gz        11  tar xzvf jre-7u45-linux-i586.tar.gz        12  apt-get install synaptic        13  help        14  install synaptic        15  apt-get synaptic        16  apt-get install synaptic        17  lspci -v        18  help]        19  help        20  help mapfile        21  help        22  info strict refs        23  startx        24  edit grub        25  search grub        26  apt-get install sphinxsearch        27  search grub        28  edit grub boot        29  find grub        30  startx        31  startsx        32  startx        33  -terminal        34  terminal        35  apt-get install rsplib-tools        36  --fix-missing        37  apt-get update        38  terminal        39  apt-get install rsplib-tools        40  terminal        41  update grub        42  update-grub        43  open partition manager        44  open        45  help        46  search partition manager        47  help        48  find partition manager        49  find partitionmanager        50  startx        51  find gparted        52  get gparted        53  get Gparted        54  get-apt Gparted        55  X-AppInstall-Package=gparted        56  help        57  startx        58  run history        59  history                    $ sudo grub-mkconfig > /dev/null     Generating grub.cfg ...     Found linux image: /boot/vmlinuz-3.2.6     Found initrd image: /boot/initrd.img-3.2.6     Found memtest86+ image: /boot/memtest86+.bin     done          $ sudo fdisk -l       Disk /dev/sda: 1000.2 GB, 1000204886016 bytes     255 heads, 63 sectors/track, 121601 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xb3b6d9a6                Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1          13      102400    7  HPFS/NTFS     Partition 1 does not end on cylinder boundary.     /dev/sda2              13       83647   671785946    7  HPFS/NTFS     /dev/sda3           83647      119927   291422209    5  Extended     /dev/sda4          119927      121577    13249536    7  HPFS/NTFS     /dev/sda5           83647      118706   281610240   83  Linux     /dev/sda6          118706      119927     9810944   82  Linux swap / Solaris


I attempted `yum update` while installing VLC player so while updating my system got shutdown without my presence.   After that when i wanted to reboot my system im getting an error   `"Oh no! Something has gone wrong. A problem has ocurred and the system can't recover. Please contact a system administrator"`   Did anybody ever face that problem, do you know what solution could work ?


title: How secure is keeping non-root owned scripts in /etc/init.d?

text: I have an application which runs as a daemon and is controlled by a script in /etc/init.d   Sometimes we need to change some parameters of startup/control of these scripts and then restart the daemon. These scripts only have write permission for the root user, so when editing these scripts I need root privileges. What I was thinking is that should I make a non-root user the owner of those scripts. This way only root and a special user can edit these scripts. Is it acceptable to keep some non-root owned files under /etc/init.d directories?   Or it is absurd, disturbing the natural order of the system?


title: How do I replace symlinks in a path with their target within a script?

text: I want to extract part of a file path up to a symlink, use `readlink` to find the path to the link target, and then replace the link name with the actual path. This has to be done within a script. For example, say I my original path is:               /path/to/*latest*/files/test.txt        # where *latest* is the symlink      Then I run `readlink` to reveal the target of the symlink:               readlink /path/to/*latest*     ver2      The output of the script would then be               /path/to/ver2/files/test.txt      NOTE that the original path could have several links so I don't want to run readlink -f on the whole path and file name. i.e. readlink -f /path/to/latest/files/test.txt /data/today/to/v2/files/test.txt


title: ls -l --group-directories-first (act on symlinks as well)

text: `ls` option `\--group-directories-first` causes directories to be listed on the top, which makes the output of `ls` nice and clean:               ls -l --group-directories-first      However, it does not act on `symlinks`, which are actually `symlinks` to directories. There is a possibility to use               ls -l -L --group-directories-first      which will list both kind of directories on top, but will not distinguish between proper directory and symlinked directory, which is again confusing. Can `ls` display symlinked directories on top, while still keeping them distinct from regular directories? **EDIT:** I am using `bash`.


title: shell symbol for the just previously typed item?

text: Is there a way I can specify to bash to reuse the item I just previously typed? For instance, if I wanted to rename a file, adding a few characters as a prefix, I want to do something like               $> mv file.txt new_{prev}      and end up with `new_file.txt`. Is there such a symbol?


title: Can somebody explain the difference between IMAP and POP3

text: I dunno if I have right understanding or somewhat faulty understanding of the three topics. From a user-end perspective both IMAP or POP3 credentials are what I need if I need to have mail incoming to my e-mail client (let's say Mozilla Thunderbird) while SMTP credentials are needed for outgoing mail. I have read the Wikipedia article on all three and it doesn't tell me which of the two are more widely used and why. For instance, webmail services such as Gmail used to provide pop3 and smtp the last time I looked Update: Apparently this was in 90's and now everybody gives IMAP. Looking to know more.


title: while using '$?' expression in bash script

text: I'm writing a simple bash script               #!/bin/bash          ls xyzzy.345 > /dev/null 2>&1     status =' echo $?'     echo "status is $status"      which finds the file `xyzzy.345` and logs the result to `/dev/null`. But when it comes to the line `status =' echo $?'`, I get this error:               status: Unknown job: = echo $?      But `echo $?` is recognized in the terminal. Can anybody help me? My OS is ubuntu 12.04 LTS


title: Characters are encoded twice when I ask SSH to reattach a screen session on the remote host

text: I want to be able to SSH to a remote host and restore a screen session with one command. Both hosts use UTF-8 locale. My problem is that then, inside the screen session, characters are encoded twice. As stated in other related questions, I need to pass the `-t` option to `ssh` command in order to allocate a pseudo-tty for an interactive session: http://stackoverflow.com/questions/474967/automatically-or-more-easily- reconnect-to-a-screen-session-after-network-inter Thus the command I use is `ssh -t remotehost screen -dr`. When I restore screen this way, the characters I send from the keyboard are encoded twice, and the characters I receive from the remote host are decoded twice:               localhost % ssh -t remotehost screen -dr     remotehost % echo ä | hexdump -C     0000000 c3 83 c2 a4 0a     0000005      This doesn't happen if I first connect to the remote host and then restore screen:               localhost % ssh remotehost     remotehost % screen -dr     remotehost % echo ä | hexdump -C     0000000 c3 a4 0a     0000003      What I mean by "characters are encoded twice" is that normally I see the same output if I type:               localhost % echo ä | iconv -f ISO-8859-1 -t UTF-8 | hexdump -C     00000000  c3 83 c2 a4 0a     00000005      The pseudo-tty allocation alone doesn't cause the problem. I've tried:               localhost % ssh -t remotehost /bin/zsh     remotehost % screen -dr     remotehost % echo ä | hexdump -C     0000000 c3 a4 0a     0000003


title: super user group or user?

text: I am using the following command in Oracle Exadata:                    sudo su - odiadmin      As sudo prompts for my own password, I am wondering if I upgrade myself to super user or do I switch to superuser 'odiadmin'. Also, is odiadmin a superuser group or just another user. Can anyone shed some light?


title: Find service by network activity

text: I see a strange DNS request at tcpdump and I want to find service which is originated from. I've already tried to find it with different monitoring tools but still no luck. Is there any proven solution? **UPD** : I find "-k NP" switch for `tcpdump` on Mac, it is showing log like:               13:09:41.589264 (proc Skype:182) IP 192.168.xx.xx.33576 > 157.55.xx.xx.40034: UDP, length 35     13:09:41.674938 (proc Skype:182) IP 213.199.xx.xx.40003 > 192.168.xx.x.33576: UDP, length 20      I need the same for Debian.


title: How can I tell whether a build is Debian-based?

text: I'm starting to work with a box that has a custom (small) Linux build on it. How can I tell whether this is a Debian or Red Hat-based build? This is what I know so far:               $ cat /proc/version     Linux version 2.6.31-2.5 (build@build-desktop) (gcc version 4.4.3 (Broadcom stbgcc-4.4.3-1.2) ) #7          $ apt-get     -sh: apt-get: command not found          $ yum     -sh: yum: command not found


title: Origin of the word cron?

text: Trying to settle a friendly argument. Is "cron" an acronym for something? Additionally, did it's current canonical name "cron" originate from something shortened for something like chronos or chronological? A quick google search didn't find what i was looking for. It ended up being a forum thread that was unsettled


title: Is IBus stopped developing?

text: Is this project became abandoned? As Bcooksley stated at this post, the authors has stopped developing IBus, and this is the reason why Kubuntu removed the Language Option in the System Settings. I want to have a confirmation. Is it dead? Or is it just not suitable for Kubuntu


title: what programming language required to develop linux O.S?

text: I want to know, what programming language is required to develop Linux operating system?. How to start and what are the required concepts ? I want to create my own O.S to my PC. I have knowledge in `C` and `C#.NET` as basic Programmer. Please suggest me the way.


title: Convergence with Firefox 3.6?

text: On many Linux distributions by default there is only Firefox 3.6. However, when I try to install Convergence I get: ![Convergence 0.08 could not be installed because it is not compatible with Firefox 3.6.24](http://i.imgur.com/xUmjj.png) How can I install Convergence on a distro that runs Firefox 3.6 (e.g. Scientific-Linux 6.1 or Ubuntu 10.04 LTS)?


title: linux + dose openswan vpn can support checkpoint gateway + client to site configuration

text: Openswan is a VPN client for linux Please advice if this VPN can support the following configuration VPN client to site ( client to Checkpoint gateway ) The following diagram explain the scenario                        VPN client on Linux machine  --> fire wall (checkpoint NGR75) -->  Checkpoint gateway (FW)  -->  target Linux machine        * Openswan formal site: https://www.openswan.org/   * openswan WIKI https://github.com/xelerance/Openswan/wiki


title: I get a "command not found" error, though the script file is shown by "ls"

text: I want to run `yii` console commands in shell. I run `protected/yiic` in the console, yet it fails, yielding `-bash: yiic: command not found` What's the problem? See the shell commands and responses I have:               ls -l     ...     -rw-r-----  1 srv50213 srv50213   94 Aug 21 09:26 test      -rw-r-----  1 srv50213 srv50213   75 Aug  4 21:05 yiic      -rw-r-----  1 srv50213 srv50213  395 Aug  4 21:05 yiic.bat     -rw-r-----  1 srv50213 srv50213  178 Aug  4 21:05 yiic.php     [srv50213@cl10-m protected]$ test     [srv50213@cl10-m protected]$ test     [srv50213@cl10-m protected]$ yiic     -bash: yiic: command not found     [srv50213@cl10-m protected]$ yiic.php     -bash: yiic.php: command not found     [srv50213@cl10-m protected]$       the `yiic` content:               #!/usr/bin/env php     <?php          require_once(dirname(__FILE__).'/yiic.php');      the `yiic.php` content:               defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));          defined('YII_DEBUG') or define('YII_DEBUG',true);          require_once(dirname(__FILE__).'/yii.php');          if(isset($config))     {       $app=Yii::createConsoleApplication($config);       $app->commandRunner->addCommands(YII_PATH.'/cli/commands');     }     else       $app=Yii::createConsoleApplication(array('basePath'=>dirname(__FILE__).'/cli'));          $env=@getenv('YII_CONSOLE_COMMANDS');     if(!empty($env))       $app->commandRunner->addCommands($env);          $app->run();      # Update I've changes the permissions as suggested, yet now when i run `./yiic` the result is **: No such file or directory** With `./test` it works fine:               -rwxr-----  1 srv50213 srv50213   94 Aug 21 11:33 test      -rwxr-xr-x  1 srv50213 srv50213   75 Aug  4 21:05 yiic      -rw-r-----  1 srv50213 srv50213  178 Aug  4 21:05 yiic.php     [srv50213@cl10-m protected]$ test     [srv50213@cl10-m protected]$ ./test     test OK     [srv50213@cl10-m protected]$ ./yiic     : No such file or directory     [srv50213@cl10-m protected]$ echo $PATH         /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/web/users/srv50213/bin     [srv50213@cl10-m protected]$       What's wrong? # Update 2 Actually yiic.php contains:               <?php          // change the following paths if necessary     $yiic=dirname(__FILE__).'/../../framework/yiic.php';      $config=dirname(__FILE__).'/config/main.php';          require_once($yiic);       where `/../../framework/yiic.php` is the path to the framework's yiic.php file exposed in main part of question. There is the yii.php file in the framework folder too.               [srv50213@cl10-m protected]$ cd ..     [srv50213@cl10-m doc]$ cd ..      [srv50213@cl10-m htdocs]$ cd framework     [srv50213@cl10-m framework]$ ls -l     total 432     drwxr-s---  2 srv50213 srv50213   4096 Jul 16 23:37 base     drwxr-s---  3 srv50213 srv50213   4096 Jul 16 23:37 caching     drwxr-s---  5 srv50213 srv50213   4096 Jul 16 23:37 cli     drwxr-s---  2 srv50213 srv50213   4096 Jul 16 23:37 collections     drwxr-s---  2 srv50213 srv50213   4096 Jul 16 23:37 console     drwxr-s---  4 srv50213 srv50213   4096 Jul 16 23:38 db     drwxr-s---  9 srv50213 srv50213   4096 Jul 16 23:38 gii     drwxr-s---  4 srv50213 srv50213   4096 Jul 16 23:41 i18n     drwxr-s---  2 srv50213 srv50213   4096 Jul 16 23:41 logging          drwxr-s--- 11 srv50213 srv50213   4096 Jul 16 23:45 web     -rw-r-----  1 srv50213 srv50213  37100 Jul 16 23:37 YiiBase.php     -rw-r-----  1 srv50213 srv50213    358 Jul 16 23:37 yiic     -rw-r-----  1 srv50213 srv50213    577 Jul 16 23:37 yiic.bat     -rw-r-----  1 srv50213 srv50213    834 Aug 21 13:05 yiic.php     -rw-r-----  1 srv50213 srv50213 304900 Jul 16 23:37 yiilite.php     -rw-r-----  1 srv50213 srv50213    638 Jul 16 23:37 yii.php     -rw-r-----  1 srv50213 srv50213    175 Jul 16 23:37 yii-powered.png     -rw-r-----  1 srv50213 srv50213    694 Jul 16 23:37 yiit.php     drwxr-s---  4 srv50213 srv50213   4096 Jul 16 23:45 zii     [srv50213@cl10-m framework]$       Should i change mode (chmode) for yii.php and yiic.php in framework folder too? # Update 3 as suggested i ran `[srv50213@cl10-m protected]$ php yiic.php` and it issued php debug info:                   exception 'CException' with message 'Property "CConsoleApplication.defaultController" is not defined.' in /home/srv50213/htdocs/framework/base/CComponent.php:173         Stack trace:         #0 /home/srv50213/htdocs/framework/base/CModule.php(515): CComponent->__set('defaultControll...', 'site')         #1 /home/srv50213/htdocs/framework/base/CApplication.php(161): CModule->configure(Array)         #2 /home/srv50213/htdocs/framework/YiiBase.php(125): CApplication->__construct('/home/srv50213/...')         #3 /home/srv50213/htdocs/framework/YiiBase.php(113): YiiBase::createApplication('CConsoleApplica...', '/home/srv50213/...')         #4 /home/srv50213/htdocs/framework/yiic.php(23): YiiBase::createConsoleApplication('/home/srv50213/...')         #5 /home/srv50213/htdocs/doc/protected/yiic.php(7): require_once('/home/srv50213/...')      # DONE Thank you to everyone. One problem was in there (as stated in debug info) `/home/srv50213/htdocs/framework/yiic.php(23)` with `$config` - `$app=Yii::createConsoleApplication($config);`. So I've changed the $config var in _/home/srv50213/htdocs/doc/protected/yiic.php(5)_ from `$config=dirname(__FILE__).'/config/main.php';` to `$config=dirname(__FILE__).'/config/console.php';` and it has worked!!! **Should i still run`php yiic.php` instead of `./yiic` for example in cron command?**


title: What happens to the signals requested recursively?

text: People often hit `Ctrl + c` or `Ctrl + z` to cancel or abandon the job if the process gets sluggish, in this case which of these signals get processed, the **first** one or the **last** one? is _each_ signal processed? if not, then which ones are _ignored_?


title: Getting the size of parent folders when using find to search for criteria?

text: I am hunting for a certain regular expression within the filenames and am seeking to return the parent folders with their sizes in a unique fashion. For example, here is the command that I expected to work:               find -E . -type f -regex '.*[fF][oO][oO].*' -maxdepth 2 | rev | cut -d'/' -f2- | rev | egrep -v '\.$' | uniq | xargs du -sh      This failed with a: `xargs: unterminated quote` thanks to varied quote marks within the filenames. So I ended up utilizing `find` with `-print0` and `xargs` with `-0`:               find -E . -type f -regex '.*[fF][oO][oO].*' -maxdepth 2 -print0 | rev | cut -d'/' -f2- | rev | egrep -v '\.$' | uniq | xargs -0 du -sh      Yet I ended up an error: `du: Binary file (standard input) matches` thanks to `uniq` apparently munging the output from find's `-print0` formatting. How would you suggest finding the parent folder size when searching for any file or folder under them that match? I repeat, I simply want to find the top level folder names with their accompanying sizes (`du -sh`) and no subfolder path or file information so that I ultimately end up with just a nice neat list of main folders that have matching criteria.


title: Vim: VimRepress and Wordpress.com - how to insert code snippets?

text: I've started using Vim and VimRepress plugin to blog. My blog is on Wordpress.com - so I cannot install plugins etc. A lot of my posts have code snippets in them - and in Markdown syntax, I indent them 4 spaces so they get rendered as a pre/code tag. Is there anyway to mimic the behavior of the Wordpress.com [sourcecode] tag so I can get proper syntax highlighted code snippets in my blog posts? http://en.support.wordpress.com/code/posting-source-code/


title: How can I install Adobe Reader in Fedora 20?

text: I'm not able to find an appropriate RPM to install adobe reader. Does anybody have a good way for installing it? The system is 64-bit.


title: Init script leaves thousands of defunct processes

text: My problem is that I have an init script that is generating thousands of defunct bash processes. My goal is to have a program called "fr24feed" in its own screen session on boot. After looking at examples on the web I've written this init script.               PROG="fr24feed"     PROG_PATH="/home/pi/fr24feed"     PROG_ARGS="--fr24key=xxxxxx --bs-ip=127.0.0.1 --bs-port=30003"     PIDFILE="/var/run/fr24feed.pid"          start() {       if [ -e $PIDFILE ]; then           ## Program is running, exit with error.           echo "Error! $PROG is currently running!" 1>&2           echo "Already running"           exit 1       else           echo "Starting"           cd $PROG_PATH           sleep 2           sudo -u pi screen -S fr24feed -d -m ./$PROG $PROG_ARGS 2>&1 > /dev/null &           echo "$PROG started"           touch $PIDFILE       fi     }          stop() {       if [ -e $PIDFILE ]; then           ## Program is running, so stop it          echo "$PROG is running"          killall $PROG          rm -f $PIDFILE          echo "$PROG stopped"       else           ## Program is not running, exit with error.           echo "Error! $PROG not started!" 1>&2           exit 1       fi      }          ## Check to see if we are running as root first.     ## Found at http://www.cyberciti.biz/tips/shell-root-user-check-script.html     if [ "$(id -u)" != "0" ]; then       echo "This script must be run as root" 1>&2       echo "This script must be run as root" 1>&2 >> /home/pi/fr24feed.log       exit 1     fi          case "$1" in       start)           start           exit 0       ;;       stop)           stop           exit 0       ;;       reload|restart|force-reload)           stop           start           exit 0       ;;       **)           echo "Usage: $0 {start|stop|reload}" 1>&2           exit 1       ;;     esac     exit 0      Using ps -ax I see               2063 ?        Ss     0:19 SCREEN -S fr24feed -d -m ./fr24feed --fr24key=xxxxxx --bs-ip=127.0.0.1 --bs-port=30003     2064 pts/4    Ssl+  49:19 ./fr24feed --fr24key=xxxxxx --bs-ip=127.0.0.1 --bs-port=30003      Followed later by thousands of entries like               3073 pts/4    Z+     0:00 [bash] <defunct>     3078 pts/4    Z+     0:00 [bash] <defunct>     3083 pts/4    Z+     0:00 [bash] <defunct>     3088 pts/4    Z+     0:00 [bash] <defunct>     3092 pts/4    Z+     0:00 [bash] <defunct>      Since they're all on pts/4 I suspect they're being generated by my init script but don't see where I've gone wrong. Perhaps STDERR and STDOUT are not being correctly redirected to /dev/null?


title: How to create a git repo using Nginx?

text: I've a CentOS 5 server at domain.fr. I am trying to set a subdomain so that I can use it with git : git.domain.fr My repositories are in /home/git (example /home/git/repos.git) I've installed `git-http-backend` and Nginx. I've set a repostory like this:               cd /home/git/repos.git && git --bare init      I've set my `git.conf` (included in `nginx.conf`) as below. However, on my client shell, I get the fatal error "repository not found": `git clone http://git.domain.fr/repos.git` Does anyone know what I should do? It seems so simple, I'm getting frustrated because I'm sure it's nothing.               server {              listen          80;         server_name     git.domain.fr;         root            /home/git;              location ~ /(/.*) {                  include /etc/nginx/fastcgi_params;             fastcgi_param   SCRIPT_FILENAME /usr/bin/git-http-backend;             fastcgi_param   GIT_HTTP_EXPORT_ALL     true;             fastcgi_param   GIT_PROJECT_ROOT        /home/git;             fastcgi_param   PATH_INFO               $1;             fastcgi_pass unix:/var/run/fcgiwrap.socket;         }     }


title: "Expect" automation tool output to shell variable

text: #!/bin/bash          # more commands here          expect << EOD     spawn telnet localhost 9151     expect -exact "Trying 127.0.0.1...\r     Connected to localhost.\r     Escape character is '^]'.\r"     send -- "AUTHENTICATE $COOKIE\r"     expect -exact "250 OK\r"     send -- "SIGNAL NEWNYM\r"     expect -exact "250 OK\r"     send -- "GETINFO circuit-status\r"     expect "250 OK\r"     send -- "QUIT\r"     expect -exact "250 closing connection\r     Connection closed by foreign host.\r"     EOD          # more commands here      This is about `Expect`. The script above establishes a telnet connection to the tor client and after clearing the current circuits, it gets the new circuit status. `GETINFO circuit-status` outputs something like               250+circuit-status=     7 BUILT $D313CCBD93E756A53CD667D0A1A97E82B7740067~melco,$DA24B9CD2AA8C02B9068A168C420DC302D969937=TorExit1488,$C00DE13988B4ABC93B43617C0FADAA8E1D4A0293=nabtor BUILD_FLAGS=NEED_CAPACITY PURPOSE=GENERAL TIME_CREATED=2014-02-09T13:11:29.264485     5 BUILT $9DD5F90D641D835C4FCA7153148B156E6FD49CEE=darwinfish,$B013CA64C82EDC616BB3EC5DBE35BB7344EDFC2A=sipsrelay,$A59E1E7C7EAEE083D756EE1FF6EC31CA3D8651D7=chaoscomputerclub19 BUILD_FLAGS=IS_INTERNAL,NEED_CAPACITY,NEED_UPTIME PURPOSE=GENERAL TIME_CREATED=2014-02-09T13:11:05.263323     4 BUILT $5B8CCA69DFD88B0281D5E67C7764CA6B5177F210=IchGebDirNeuland,$A587BBB611657B0743CD9E6E70B6497BE209FFD2=RelayW,$D313B081A3EFC5492BE95AFE39F715413DD35586=ToileLibre BUILD_FLAGS=IS_INTERNAL,NEED_CAPACITY,NEED_UPTIME PURPOSE=GENERAL TIME_CREATED=2014-02-09T13:11:04.263266     2 BUILT $9DD5F90D641D835C4FCA7153148B156E6FD49CEE=darwinfish,$F16658975D729B8C4100A6DC649C5EDCAD1687A8=afo8,$35F51DCE73B988CBAE06B06312B4D1271979FE3B=thoreau BUILD_FLAGS=NEED_CAPACITY PURPOSE=GENERAL TIME_CREATED=2014-02-09T13:11:02.272687     .     250 OK      I checked the man page, _Exploring Expect - A Tcl-based Toolkit for Automating Interactive Programs_ (O'Reilly) and SO but I cannot make `expect_out(buffer)` work with `set`, `set env` nor `puts`. How can I put it in a variable for use in my bash script? How can I parse a part of it (e.g. `C00DE13988B4ABC93B43617C0FADAA8E1D4A0293` above) and put it in a variable for bash?


title: Starting screen without welcome screen

text: Running `screen` I see this: > ![](http://i.stack.imgur.com/m0Y3K.png) How can I start screen directly, without this welcome screen?


title: Weird escape sequence

text: I need help identifying what this escape sequences represents. I see this sequence is autogenerating on my server's console, but I'm not sure what is the reason for that. Escape sequence: ^[[[D I've checked this chart of escape sequences as reference: http://ascii- table.com/ansi-escape-sequences-vt-100.php , but haven't found anything matching.


title: Seeing SSH debug messages in Terminal/console

text: I am seeing "debug3: Received SSH2_MSG_IGNORE" appear in the terminal on a RHEL 6 Linux server. I thought maybe rsyslog had a console entry, but it doesn't. sshd_config has logging at AUTHPRIV, and rsyslog sends authpriv to messages and secure only. What could be happening?


title: How to diff files ignoring comments (lines starting with #)?

text: I've two configuration files, the original from the package manager and a customized one modified by myself. I've added some comments to describe behavior. How can I run `diff` on the configuration files, skipping the comments? A commented line is defined by:   * optional leading whitespace (tabs and spaces)   * hash sign (`#`)   * anything other character The (simplest) regular expression skipping the first requirement would be `#.*`. I tried the `\--ignore-matching-lines=RE` (`-I RE`) option of GNU diff 3.0, but I couldn't get it working with that RE. I also tried `.*#.*` and `.*\\#.*` without luck. Literally putting the line (`Port 631`) as `RE` does not match anything, neither does it help to put the RE between slashes. As suggested in “diff” tool's flavor of regex seems lacking?, I tried `grep -G`:               grep -G '#.*' file      This seems to match the comments, but it does not work for `diff -I '#.*' file1 file2`. So, how should this option be used? How can I make `diff` skip certain lines (in my case, comments)? Please do not suggest `grep`ing the file and comparing the temporary files.


title: How is using a public-key for logging in to SSH any better than using a password?

text: I'm not asking about password vs key authentication. I've seen a few times (and even Amazons AWS) says that even if SSH has a major vulnerability that key authentication would make such an exploit less vulnerable. But, what if there is an exploit with how the keys are verified; isn't this just making an assumption based on the authentication mechanisms? Why is this the thought? Is it because we all know passwords are a poor form of authentication so the assumption has just been "use a private key"?


title: system wide SOCKS5 Proxy

text: I connect to my Server on the internet using `ssh -D 3128 user@rootserver.com`. If I am right I thereby open a SOCKS v5 Proxy to my Server. Using firefox and FoxyProxy I can now add this to my proxys and tunnel my HTTP-Traffic over it. Howsoever I'd like to use this SOCKS Proxy for all my traffic. Friends told me that they've seen this by modifying your route or using iptables howsoever I can't find anything about it.


title: What do the numbers in a man page mean?

text: So, for example, when I type `man ls` I see `LS(1)`. But if I type `man apachectl` I see `APACHECTL(8)` and if I type `man cd` I end up with `cd(n)`. I'm wondering what the significance of the numbers in the parentheses are, if they have any.


title: What are the difference between man1, man2, man3... folders?

text: > **Possible Duplicate:**   >  What do the numbers in a man page mean? What are the differences between man _X_ pages? Why are they separated?


title: man pages: meaning of '2' in STAT(2)?

text: What's the significance of the number, like the `2` in `STAT(2)`, seen in man pages? For example, `man 2 stat` yields a man page with `STAT(2)` at the top and a description that begins, `The stat() function...`, while `man stat` yields a man page with `STAT(1)` at the top and a description that begins, `The stat utility...` I noticed the page for `STAT(1)` says `BSD General Commands Manual`, while that for `STAT(2)` says `BSD System Calls Manual`, so maybe the number is a code for the type of command?


title: What is the significance of the "1" in ls(1)?

text: > **Possible Duplicate:**   >  What do the numbers in a man page mean? I see functions referred to with numbers in the parenthesis in documentation. What does this mean? It takes one argument? Sorry, noob.


title: What does the number mean in a man page?

text: > **Possible Duplicate:**   >  What do the numbers in a man page mean? If I type`man ls`, I see`LS(1)` in the top left and top right corners of the manpage. I also see programs on the internet being refered to this way. ex. `man(1), xman(1x), apropos(1), makewhatis(8) and catman(8).` What are these numbers (and in some cases letters)?


title: What means the "integer argument" in system call descriptions?

text: > **Possible Duplicate:**   >  What do the numbers in a man page mean? All system calls described in manpages have an associated number such as `exec(3)`. What is the meaning of this number?


title: About the command and the number in the man

text: > **Possible Duplicate:**   >  What do the numbers in a man page mean? such as:               http://www.postfix.org/qmgr.8.html     The qmgr(8) daemon awaits t      what's the meaning of 8? just don't know it.


title: What is the meaning of the number part of man pages?

text: > **Possible Duplicate:**   >  What do the numbers in a man page mean? As in the "(1)" in git-svn(1)


title: How to get file to a host when all you have is a serial console?

text: When all you have is a serial console (say via telnet through a terminal server), what methods can be used to transfer files in/out of a host? Cut/paste works for the small/printable stuff and I've played with a combination of uuencode/uudecode (with gzip) handle the unprintable but it's all very limiting.


title: Feeding /dev/random with disk reads etc

text: Is there any way to feed `/dev/random` with sufficient entropy? The data doesn't have to be truly random, i.e. I can append time of day with pid and add 27 to it, it doesn't matter I just want to make it run faster. I tried to get the ball rolling with `dd if=/dev/zero of=/dev/null` . I want to know if there's some way I can use `add_keystroke_randomness` in `/linux/random.h` to artificially feed `/dev/random` so that I don't get those unpredictable blocking calls. i.e. I'm willing to sacrifice some randomness in return for speed. P.S. - please don't suggest using `/dev/urandom`


title: GRUB and JFS partitions : specific configuration?

text: Recently, I decided to organise my partition scheme differently. Before I apply the changes on my physical machine, I decided to test it virtually, and met a little problem with GRUB. Let me give you some information first. There is the scheme I plan to deploy :   * / (primary), JFS, 40G (2GB on the virtual machine)   * /boot (primary), ext2, 500M (200MB on the virtual machine)   * /home (logical), ext4, 200G (8GB on the virtual machine)   * /srv (logical), ext4, 5G (200MB on the virtual machine)   * swap (logical), 4G (512MB on the virtual machine) The new distribution will be Arch Linux, 64 bits (32 bits on the virtual machine). I successfully installed the new system on the virtual machine, but on reboot, GRUB seems to have a problem due to the JFS root partition : it cannot find several files in /boot/grub/i386-pc (mods, such as relocator or all_video). At first, I thought it was due to the separate boot partition, but the problem persists if I include it in the primary root. However, when I use an ext4 for the / partition, GRUB loads perfectly. It may be a problem with GRUB handling JFS partitions, however I remember that the GNU GRUB project applied a patch to fix this issue a while ago. As another test, I've created the same structure, but using ext4 instead of JFS for / : GRUB loads correctly. Is there any specific configuration to be applied for GRUB to load a JFS partition without problems ?


title: Unknown entries in the default /etc/postfix/aliases file

text: While setting up a new Postfix installation on a Mageia 3 Linux system, I came upon a few entries in the default `/etc/postfix/aliases` file that I do not know the background of:               # Common aliases for system accounts.     ...     foo:            root     falken:         root          # traps to catch security attacks     ...     moof:           root     moog:           root      None of these aliases exists in the `aliases` file included in the Postfix source code distribution and I was unable to find any concrete reference to justify their existence.   1. Does anyone know why these aliases may have been included? Is there perhaps some interesting historical background?   2. Considering that I do not intend to have people send mail to `root` through any of these aliases, do they actually offer any sort of functionality in some other scenario? Or are they just noise to be removed?


title: There are 4 SSDs but df only listed one. Why?

text: I just replaced SSDs There are 4 hard disk               Disk /dev/sda: 240.1 GB, 240057409536 bytes     255 heads, 63 sectors/track, 29185 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xc4521435             Device Boot      Start         End      Blocks   Id  System     /dev/sda1               1       29185   234428481   83  Linux          Disk /dev/sdb: 240.1 GB, 240057409536 bytes     255 heads, 63 sectors/track, 29185 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xc8c906e0             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1               1       29185   234428481   83  Linux          Disk /dev/sdd: 120.0 GB, 120034123776 bytes     255 heads, 63 sectors/track, 14593 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00061c96             Device Boot      Start         End      Blocks   Id  System     /dev/sdd1   *           1          14      103424   83  Linux     Partition 1 does not end on cylinder boundary.     /dev/sdd2              14         536     4194304   82  Linux swap / Solaris     Partition 2 does not end on cylinder boundary.     /dev/sdd3             536       14594   112921600   83  Linux          Disk /dev/sdc: 250.1 GB, 250059350016 bytes     255 heads, 63 sectors/track, 30401 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x4fa82c2a             Device Boot      Start         End      Blocks   Id  System     /dev/sdc1               1       30401   244196001   83  Linux     root@host [/home]#      But if I type df, only one shows up. This could be problematic. Should I open a new ticket for this?               root@host [/home]# df     Filesystem           1K-blocks      Used Available Use% Mounted on     /dev/sdd3            111148848  28170020  77332748  27% /     /usr/tmpDSK            1006872     18208    937516   2% /tmp     tmpfs                  7990772         0   7990772   0% /dev/shm


title: keep losing IP with dhcpcd

text: I have an Arch Linux install in a VirtualBox VM, and as I'm working all of a sudden, it will lose it's dynamic IP address. When this happens, if I check on the status of the `dhcpcd` service it says it's running.               $ systemctl status dhcpcd.service        Loaded: loaded (/usr/lib/systemd/system/dhcpcd.service: enabled)        Active: active (running) since Sat 2013-09-28 20:10:32 EDT; 49min ago      Main PID: 166 (dhcpcd)      I can try to restart the service, but it does not establish and IP .               $ sudo systemctl restart dhcpcd.service          * _No output is returned from the command_ I can set an address manually, and it will work for a while, but then it'll drop again after a few minutes.               $ sudo ifconfig enp0s3 10.0.0.109 netmask 255.255.255.0 up     $ sudo route add default gw 10.0.0.1      I can also run `dhcpcd` manually, and it will successfully get an IP address, but again it will drop after a few minutes.               $ sudo dhcpcd enp0s3     dhcpcd[2580]: sending commands to master dhcpcd process      I have tried disabling `dhcpcd.service` and using `dhcpcd@enp0s3.service`, but it has the same results. Any ideas?


title: Deleting many files except one type

text: > **Possible Duplicate:**   >  Deleting all files in a folder except files X, Y, and Z I am writing a script to compile many `.tex` files. After that, many auxiliaries files were created. So, I would like to remove them at the end of the script. I tough to use `rm $file.xxx` but I would have to write all the extensions by hand, since that I want to keep my source file and the pdf output, so I can not use the * to delete all. How to delete all the extensions except those with extension `.tex/.pdf`? Thanks.


title: How can I get `cacafire` to show up in the original gnome-terminal, instead of a separate window?

text: If I am in a Linux virtual terminal (pressing `Control-Alt-F1` on Ubuntu), and I use the command `cacafire`, I get the flames inside the actual terminal. However, if I am in the gnome environment, and I start a terminal and run `cacafire`, I get a separate window popping up that displays the fire. How can I force it to display the fire in the same terminal that it is run from?


title: touch & gzip all HTML, CSS, JS files in a directory recursively

text: I'm trying to optimize Nginx server. I've enabled Gzip_Static_Module to serve pre-compressed gzip static files like CSS, JS, HTML. Nginx Wiki says that the timestamps of the compressed and uncompressed files match. So, I'm trying to touch the files before Gzipping. I'm trying to touch and generate `*.gz` for these static files using the commands below:               $ su -c "find . -type f -name "*.css" -size +1024b -exec sh -c "touch {} \         && gzip -9v < {} > {}.gz" \;"          $ su -c "find . -type f -name "*.js" -size +1024b -exec sh -c "touch {} \         && gzip -9v < {} > {}.gz" \;"          $ su -c "find . -type f -name "*.html" -size +1024b -exec sh -c "touch {} \         && gzip -9v < {} > {}.gz" \;"      but I receive "User {} not found" error. Can anyone please help me what's wrong in the above command? And is there any better approach for generating *.gz automatically, whenever the timestamp of any uncompressed file changes (Cronjob may be)?


title: Can I color-calibrate a Dell U2413 wide-gamut monitor under Linux?

text: If I get a Dell U2413 wide-gamut monitor to use with Fedora for photography, will I be able to use it properly? I've got a ColorHug, and I see that there's a U2410 ccmx profile; will that get me in a reasonable enough ballpark? Or should I just go with the standard-gamut U2412M (for half the price)? I'd prefer the wider-gamut color in the ideal world, of course, but I'd prefer perfectly-working 8-bit sRGB to miscalibrated wide-gamut. (PS: Linux only; no dual-boot.)


title: stable, stable/updates and stable-updates in the sources.list

text: Very often now I have seen `sources.list` files (including my own) that contain lines like these:               deb     http://security.debian.org/         testing/updates main contrib non-free     deb     http://security.debian.org/         wheezy/updates  main contrib non-free     deb     http://http.debian.net/debian       wheezy-updates  main      I understood the meaning of the components (`main`, `contrib` and `non-free`). I also partially understood the meaning of the distribution (`wheezy`, `testing`, `stable` etc.) and that of the path. This is all well documented in the wiki.   * But what does the `/updates` or `-updates` mean?   * Should I write it with `-` or `/` myself?   * How am I supposed to know that?


title: How to binding right and left ctrl keys separately in Emacs

text: I reassigned `left ctrl` key to `capslock` key to use ctrl in Emacs. Is there a way to bind right and left ctrl keys separately? For example, I want to bind `left-ctrl-a` to `select all` and `right-ctrl-a` to `beginning-of-line`. In other words, I want to emulate `ctrl` and `command` key concept of OS X.


title: Why "ls" doesnt show the file that "find" discovered ?

text: (New to unix)   In ubuntu When I am up in "/" folder i type               sudo find . -name  .erlang.cookie      and the result is               ./var/lib/rabbitmq/.erlang.cookie      then when I am on the folder - /var/lib/rabbitmq - and I type "ls" I see one file named mnesia. ( when I type again find command i see ./.erlang.cookie what does that mean?)


title: Enumerating\writing files in a specific directory hangs the command

text: I'm communicating with a machine remotely through `ssh`. This machine runs a custom-built Linux and it has very limited set of commands. At some point, a specific directory refuses files to be written to it. Running `ls`, hitting "tab" to auto-complete a file name or deleting files using a wild card, hangs the command. After opening a new `ssh` session, hitting `ps | grep D` shows the following:                 PID  Uid        VSZ Stat Command       628 root            DWN [jffs2_gcd_mtd4]       930 root       2912 D   rm /mnt/flash/system/config       995 root       2400 D   scp -t /mnt/flash/system/      2083 root       3044 D   ls -AlSh /mnt/flash/system      6994 root       2912 D   chmod +x /mnt/flash/system/config     13281 root       3052 S   grep D     22220 root       2400 D   scp -t /mnt/flash/system/      Running the `mount` command shows the following:               rootfs on / type rootfs (rw)     /dev/root on / type ext2 (rw)     proc on /proc type proc (rw)     devpts on /dev/pts type devpts (rw)     tmpfs on /tmp type tmpfs (rw)     /dev/mtdblock4 on /mnt/flash type jffs2 (rw)      Notice that the processes with the `D` state (Which indicates that the process is performing a disk I/O operation. This state shouldn't usually be observed, yet running `ps` multiple times shows the same state, so the process is actually stuck at a I/O operation) are either deleting, listing, editing or writing files to the mounted path `/mnt/flash`. This mounted path file-system is `jffs2` (Notice that one of the processes shown is `jffs2_gcd_mtd4` with the state of `DWN`). Keep in mind, I have no solid idea about Linux so please be as simple as possible.   * So what is the `DWN` state? Is it indicating that the processes cashed (i.e. down)?   * How can I resolve this problem? I can't edit files on this path and restarting the machine is an expensive option (i.e. logistics).


title: fedora 12 sleeping forever error

text: After manually restarting freeze machine due to no response. It stuck on blue screen and gives error as **sleeping forever**. Default partitioned with LVM. Whether I need to install fresh OS or I can get installed OS back?


title: How to copy files *to* a camera?

text: I'd like to copy a firmware update file to my Canon 7D camera. After it was auto-mounted by `thunar` + `thunar-volman` + `gvfs-gphoto2` I tried the following:               $ cp eos7d-v205-win/7D000205.FIR /run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A001%2C012%5D/     $ echo $?     0     $ ls /run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A001%2C012%5D/     DCIM  MISC      So that went into a black hole. * * * The first time I try to copy it with `Ctrl`-`c` and `Ctrl`-`v` prints the following error message when pasting the file: > Error writing file. > > -108: No such file or directory. > > Do you want to skip it? If I try again after that it simply crashes:               $ thunar     Segmentation fault (core dumped)     $ echo $?     139      * * * The Gphoto 2 shell has an _undocumented_ `put` function which I also tried:               $ sudo umount /run/user/1000/gvfs     $ gphoto2 --shell     gphoto2: {.../eos7d-v205-win} /> help put     Help on "put":          Usage: put [directory/]filename     Description:             Upload a file          * Arguments in brackets [] are optional      So this function takes a **single** argument with an **optional** directory. Weird, but should be doable. Some attempts at making it work:               $ gphoto2 --shell     gphoto2: {.../eos7d-v205-win} /> ls     store_00010001/          gphoto2: {.../eos7d-v205-win} /> put 7D000205.FIR                                 *** Error ***                   You need to specify a folder starting with /store_xxxxxxxxx/     *** Error (-1: 'Unspecified error') ***     gphoto2: {.../eos7d-v205-win} /> put /store_00010001/7D000205.FIR          *** Error ***                   PTP Access Denied     *** Error (-1: 'Unspecified error') ***     gphoto2: {.../eos7d-v205-win} /> put /store_00010001/MISC/7D000205.FIR          *** Error ***                   PTP Access Denied     *** Error (-1: 'Unspecified error') ***      Maybe it's not supported? * * * Digikam has an upload feature, but that just reported ' _Failed to upload file "7D000205.FIR"._ ' Running it from the shell produced no more information. Too many WTFs per minute. **What do I need to do to copy a file to my camera in Arch Linux?**


title: Creating deb and rpm from the same source

text: Is there a standard for source packages to be able to build rpms, debs (and perhaps others) without too much customization? I'm talking mostly about Python, PyQt programs.


title: How to set up disk mirroring (RAID-1)

text: I have a computer with two WD 1TB drives and I want to configure disk mirroring on it. I tried setting up RAID during the installation by creating RAID partitions but that does not work for me. Is there a convenient software that I can install to do the job for me? If no, what shell commands can be used? Once it is set up how should I verify that it is working?


title: Moving large numbers of files and directories to a different directory

text: I'm trying to move the following move a large number of files that exist in the following structure to a /mnt/originals but I need to maintain the structure at the same time. I know cp would be a solution but can't use cp because of space limitations.               /mnt/originals-us/4     /mnt/originals.us/4/0b9     /mnt/originals.us/4/0b8     /mnt/originals.us/4/0b4     /mnt/originals.us/4/0b3     /mnt/originals.us/4/0b9/a62/     /mnt/originals.us/4/0b9/a47/     /mnt/originals.us/4/0b9/f0f/     /mnt/originals.us/4/0b9/a62/aa5/file16.png     /mnt/originals.us/4/0b9/a62/ba1/file1.png     /mnt/originals.us/4/0b9/a47/31f/file3.mov     /mnt/originals.us/4/0b9/f0f/     .     .     .      Etc. It is a pretty large set of files of different file names and types. I tried the following but it didn't work.               mv /mnt/originals-us/ /mnt/originals/       but get the following               mv: inter-device move failed: `/mnt/originals-us/10/0b9/' to `/mnt/originals/10/0b9'; unable to remove target: Is a directory      I also thought about writing a massively chanin-ed command but I don't think that would work either. This is what I have so far.               find . -type f -print | rev | cut -d '/' -f1 | rev      This obviously gives me all the filenames but how do I chain it with the first part?


title: Output multiple strings out of multiple files

text: **Hi my current code is:**               find /home/user/logfilesError/ -maxdepth 1 -type f -name "gBatch_*"\      -daystart -mtime -1 -exec grep -rl "ERROR" "{}" +  | xargs -l  basename          if [ $? -eq 0 ]; then         tday="$(date +'%d.%m.%Y')"         echo "ERROR found on $tday in the files obove!"          else         tday="$(date +'%d.%m.%Y')"         echo "No ERROR was found at the $tday !"     fi      The code currently outputs the logfiles wich are created or edited this day(not last 24 hrs) and searches if the logfiles contain "ERROR" and simply says in which logfiles is an error or if there aren´t any error he says that aswell. I censored the names a bit so dont think I messed that up and thats why it doesn´t work ;-) **Output(example):**               gBatch_2070.log     gBatch_2071.log     ERROR found on 25.06.2014 in the files obove!      **The folder looks like:** ![folder](http://i.stack.imgur.com/svsUI.jpg) **Each file looks like:** ![file](http://i.stack.imgur.com/6IAXk.jpg) **My desired output:** Name of the file + "ERROR" + the message after the error Example: gBatch_2067.log - ERROR **.batch.BatchStart = Batchverarbeitung beeendet, gBatch_2077.log - ERROR **.batch.BatchStart = Batchverarbeitung beeendet, ... Thank you in advance for your help!


title: Make a programme executable by common users

text: I've installed `hddtemp` on my Arch Linux, but it needs to be run with root permissions. I want to execute it as a normal user without using `sudo`. How can I do this?


title: What's the difference between these ways of accessing the shell?

text: From what I know it seems that there are many ways to access the shell on Linux. So far the methods I know are:   1. To use a program such as Terminal or Konsole   2. To use the shortcuts CTRL + ALT + F1-6   3. To disable X and boot straight into the command line   4. To SSH in What are the differences between these methods? Are there any more ways of accessing the shell on Linux? Apologies if this is a noob question :S


title: How to get the last file added to a directory with LFTP?

text: I am trying to get only the last file added to a directory using LFTP and parameters mirror -n, -N but all my attempts didn't work. Is there a way to do it with LFTP?


title: Why can I reach a different interface's IP address?

text: I'm wondering about this, and I can't seem to find an explanation on the internet. I have a linux gateway which has multiple interfaces:               eth0: external ip     eth1: 172.16.1.1/24     eth2: 172.16.2.1/24     ip_forward is enabled.      IPtables is configured to NAT traffic from `eth1 -> eth0` and `eth2 -> eth0`. But configured not to FORWARD traffic between `eth1 <-> eth2`. My question is: Why is it possible for a computer on the 172.16.2.0/24 subnet to ping 172.16.1.1 (ip address of eth1 interface)? **nat**               Chain PREROUTING (policy ACCEPT 647K packets, 52M bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain INPUT (policy ACCEPT 17582 packets, 1160K bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain OUTPUT (policy ACCEPT 14951 packets, 1214K bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain POSTROUTING (policy ACCEPT 187 packets, 42984 bytes)      pkts bytes target     prot opt in     out     source               destination               333K   25M SNAT       all  --  *      eth0    0.0.0.0/0            0.0.0.0/0            to:<external ip>      **filter**               Chain INPUT (policy DROP 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                  0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0                    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED         0     0 ACCEPT     tcp  --  eth1 *       0.0.0.0/0            0.0.0.0/0            tcp dpt:22         0     0 ACCEPT     tcp  --  eth2 *       0.0.0.0/0            0.0.0.0/0            tcp dpt:22         0     0 ACCEPT     tcp  --  eth0   *       <some trusted ip>       0.0.0.0/0            tcp dpt:22         0     0 ACCEPT     udp  --  eth1  *       0.0.0.0/0            0.0.0.0/0            udp dpt:53         0     0 ACCEPT     udp  --  eth2  *       0.0.0.0/0            0.0.0.0/0            udp dpt:53         0     0 ACCEPT     icmp --  eth1  *       0.0.0.0/0            0.0.0.0/0                    0     0 ACCEPT     icmp --  eth2  *       0.0.0.0/0            0.0.0.0/0                     Chain FORWARD (policy DROP 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                  0     0 ULOG       all  --  eth1  eth0    0.0.0.0/0            0.0.0.0/0            state NEW ULOG copy_range 0 nlgroup 1 prefix "NEW: " queue_threshold 1         0     0 ULOG       all  --  eth2  eth0    0.0.0.0/0            0.0.0.0/0            state NEW ULOG copy_range 0 nlgroup 1 prefix "NEW: " queue_threshold 1        0 0 ACCEPT     all  --  eth1  eth0    0.0.0.0/0            0.0.0.0/0                   0 0 ACCEPT     all  --  eth2  eth0    0.0.0.0/0            0.0.0.0/0                   0 0 ACCEPT     all  --  eth0   eth1   0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED        0 0 ACCEPT     all  --  eth0   eth2   0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED          Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                  0     0 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0


title: Recommendation of books to setup and admin a web server in Linux

text: Hi I am quite a newbie on Linux, I knew basic concept and some commands of it. And now I am going to setup and admin a web server in Ubuntu Linux distribution. I installed it by default setting, and seems all works fine, and now I need to setup it to be a virtual web host server, mainly I will create more accounts and for each account, I will setup its home/folder, and ftp, so the user with the account can upload their PHP scripts to it, also I would like to make home/bin, home/lib for the account, so they can use SSH too, to install local binary or libs, even more.. I am thinking to read some books, but I don't know which one is good for me basically it could have something about how to setup virtual web host server, admin it, and how to make it secure. Any advice is appreciated.


title: How should I configure grub for booting linux kernel from a USB hard drive?

text: I have a laptop hard drive in an external enclosure which I use as a large pendrive. For an added twist, I have installed Linux on it, so I can boot any machine with my distribution of choice (e.g. for data recovery or repairing a b0rked system or just using a borrowed laptop without destroying the preinstalled Windows). The problem is that, depending on the hardware configuration, the USB hard drive may be visible under different paths. For grub configuration I just use `(hda0,0)` as it is relative to the device the grub was launched from. I have UUID entries in `/etc/fstab`. I also specify `rootwait` in the kernel parameters so that it waits for the USB subsystem to settle down before trying to mount the device. What should I pass to the kernel as `root=` ? Currently boot from the pendrive once, check the debug messages to see what `/dev/sdX` device has been assigned to the USB drive by the kernel, then reboot and edit the grub configuration. I can't change anything on the PC besides enabling `Boot from USB hard drive` in BIOS and setting it to higher priority than internal hard drives. There are various initrd generating scripts which include support for UUID in root device path, unfortunately the Gentoo native one (genkernel) does not support `rootwait` and I had no luck trying to use others. The boot process goes like this (it is quite similar in Windows):   1. The BIOS chooses the boot device and loads whatever is its MBR (which happens to be grub stage-1).   2. Grub loads it's configuration and stage-2 files from device it has set as `root`, using `(hd0)` for the device it was loaded from by BIOS.   3. Grub loads and starts a kernel (still the same numbering, so I can use `(hd0,0)` again ).   4. Kernel initializes all built-in devices (`rootwait` does it's magic now).   5. Kernel mounts the partition it was passed as `root` (this is a kernel parameter, not grub parameter).   6. `init.d` starts the userland booting process, including mounting things from `/etc/fstab`. Part 5 is the one giving me problems.


title: LFSH ... what is '/lib/init' for?

text: I'm trying to understand the init/boot process. My system is LMDE, so I presume it will be pretty much standard Debian in that regard. I believe I more or less understand the basics of the init scripts, `/etc/init.d/`, `/etc/defaults/` and so on, but there's this strange use of `/lib/init/` for a few of the scripts that look to me like they should be in /etc/init.d/ with all the rest. Can someone explain the logic of this? There's lots of discussion of `/lib/init/rw/` but none that I can find about `/lib/init/` itself. This is all that's in there:               drwxr-xr-x 3 root 4.0K 2013-12-25//15:20:41 rw/     -rw-r--r-- 1 root 1.3K 2014-01-21//07:37:07 vars.sh     -rw-r--r-- 1 root 3.3K 2014-01-21//07:37:07 tmpfs.sh     -rw-r--r-- 1 root  741 2014-01-21//07:37:07 swap-functions.sh     -rw-r--r-- 1 root  17K 2014-01-21//07:37:07 mount-functions.sh     -rw-r--r-- 1 root 4.4K 2014-01-21//07:37:07 bootclean.sh      Running `dpkg-query -S /lib/init` returns:               initscripts: /lib/init


title: How to format history file to contain username too?

text: tail -2 /root/.bashrc     export HISTTIMEFORMAT="%d/%m/%y %T "     export PROMPT_COMMAND='builtin history 1 >> /var/log/root.log'       With this all the commands could be logged (even the ones that were in "sudo su -" ). **My question** : How can I put username info in the history file, so not just the time will be logged, but the original user, who "sudo su -"'ed username is in the history files too (or process PID from it's shell, or any unique identifier)?


title: Use an alias with watch command

text: The post repeat command every x seconds shows that `watch` is the utility that is useful for the invoking a command at fixed interval repeatedly. Now, I have very long commands, and have used aliases to group them logically to get a quicker output, like               $ alias c1='grep "checking for" file1.log'     $ alias c2='grep "validated" file1.log'     $ (echo "Checking: "`c1`) && (echo "Validated: "`c2`)      The output of 3rd command is like               Checking: 100     Validated: 80      It is a long running process, I need to check the status of this process, to get the mentioned counts. But invoking the above with `watch` gives error > $ watch '(echo "Checking: "`c1`) && (echo "Validated: "`c2`)'   >  c1 command not found I can put the entire command in there and remove the aliases, but is there any other work-around to get the aliases working with `watch` command? **Note:** Did quickly go through the man page for `watch`, but didn't find any reference to `alias` in specific.


title: GPU not listed in lspci after SysRQ reboot

text: I have my Ubuntu Server machine with XFX 7970 GPU in it, and sometimes, when ATI driver fails, I have to reboot it manually. When I'm trying to reboot the machine using SysRQ, the system reboots well, but GPU is not listed in lspci output. It appears again after hand reboot. Is there a way to reboot it without hand reboot remotely?


title: KDE-dolphin trashcan on second HDD

text: From KDE I use only dolphin. I've pulled out second hdd for a couple of days (also changed `fstab`). Now I put it back and dolphin won't "see" `/hdd2/.Trash-1000/` and if I delete file `/hdd2/file1` it moves to `~/.local/share/Trash/` but should move to `/hdd2/.Trash-1000/` How do I point dolphin to use right trash-dir?


title: Error stat of log failed: Permission denied during LogRotation

text: After installing a new CentOS 6.0 server, logrotate was working absolutely fine. Then one day due to a kernel panic, the server had to be hard booted, and ever since log rotation is not rotating the logs. So I did a separate cron entry to rotate logs manually and forcefully and redirected the output to a log file, and got the following lines for each file:               rotating pattern: /home/mail3/log/popMailProcessing.log  forced from command line (60 rotations)     empty log files are rotated, old logs are removed     considering log /home/mail3/log/popMailProcessing.log     error: stat of /home/mail3/log/popMailProcessing.log failed: Permission denied      However, if I do a logrotation manually from command line, it works flawlessly. The command I use on command line is:               logrotate -v -f /etc/logrotate.d/mail3-logs      My logrotate.conf file can be seen here. The log rotation file which logrotate uses via cron job can be seen here. My crontab entry is:               03 00 * * * root /usr/sbin/logrotate -f -v /etc/logrotate.d/mail3-logs &>> /var/log/logrotate/rotate.log      SELinux is enforcing, and it was enforcing prior to the hard boot too. The directory where the logs are kept have the root as their owner and directory has complete permissions. Any clue what is causing the permission denied error?


title: How do I know on which IDE to edit a project's source code?

text: **EDIT** : Thanks to all answerers and commenters, there's enough material to keep me busy for a while ! * * * I recently switch to Linux and wanted to do my first development steps with the following source: SDL Sopwith Beside compiling and running the program with the following lines :               ./configure     make      I couldn't figure out how to easily edit a project's source code but by editing it manually in a text editor and typing the above lines every time to test it ... without debugging and all the features that are provided by an IDE. There are other projects (i.e. AntiMicro) that I figured out how to edit in a particular IDE such as QT Creator because there was a .PRO file in the project which I quickly found out what it was for. How do someone gets a source running in an IDE when there are no IDE-specific file included in it ?


title: Difference between mergecap merging and concatenate

text: Can anyone tell me the difference between merging and concatenate the pcap files using mergecap function. I opened the output files in wireshark. I couldn't understand any difference.


title: Viewing a part of the screen in a window on Linux

text: I plan to make a presentation with a live demo using my wide screen Ubuntu 12.10 Laptop and a projector. My plan is to connect the projector as a second (small) display and put my slides and live-demo there. It would be convenient, if I could see the projector display on my laptop LCD screen within a window (no zoom or stretch needed). So my question is: How can I see selected part of a screen within a window? PS Other possibilities are:   * typing on laptop and looking on the projector screen and not at the audience   * Cloning laptop display to the projector display: zooming/stretching wide screen to a small projector screen and also being unable to put some private (like timer) information on the laptop screen.


title: Backing up post install; rsync breaks

text: I use the following command for backup, but if I do a clean install of Fedora, copy over all my backed up files, then backup again, it copies them even though they are unchanged. Why? Can I avoid this?               rsync -tvr --modify-window=1 --cvs-exclude \        --exclude-from '/run/media/user/32GB/.exclude' --progress \        /home/user/Documents/* /run/media/alex/32GB/


title: How does bash execute an ELF file?

text: When I'm on my Linux Box I use bash as a shell. Now I wondered how bash handles the execution of an ELF file, that is when I type ./program and program is an ELF file. I grepped the bash-4.3.tar.gz, there does not seem to be some sort of magic number parser to find out if the file is an ELF nor did I find an exec() syscall. How does the process work? How does bash pass the execution of the ELF to the OS?


title: What happens when a tmpfs is full and no swap space is available?

text: Let's say I have a setup with   * 16 GB of physical RAM,   * A tmpfs of max. 8 GB containing a file with 5 GB and   * A swap sized 4 GB. If I'd try to, e.g., create a copy of the 5 GB file on the tmpfs, what would happen to the file operation and what would happen to the system?


title: shall we rerun `createrepo` after copying new files in repositry

text: I have a repository installed. I wanted to update that repository with new rpm files. Can I rerun `createrepo` command on this repository for updating my new available files to servers?


title: How to change user on SWAT page (or how to control Samba by nonprivileged user)

text: I logged into SWAT with my nonprivileged user, since the root account is usually disabled on modern Linux systems. I cannot control any Samba parameters by this user. Once I enable the root account, how should I logout from SWAT and re-login into SWAT as root? Or how should I make my nonprivileged user to be able to control Samba parameters? Put the user into certain group? Specify the user in some SWAT config as a privileged one?


title: How is a message queue implemented in the Linux kernel?

text: I would like to know how Message Queues are implemented in the Linux Kernel.


title: How to change live session boot image

text: I'm trying to change live user session boot image in linux mint using squashfs.   So:   -I've Changed the boot image in /lib/plymouth/themes/mint-logo/logo.png   -I've update it using: sudo update-initramfs -u   But it shows these errors:                     sudo: unable to resolve host Out-Of-Order         update-initramfs: Generating /boot/initrd.img-3.13.0-24-generic         cryptsetup: WARNING: could not determine root device from /etc/fstab         Warning: No support for locale: en_US.utf8      (In my installed system it works perfectly but in my remastered linux it gave me the errors)


title: SNMPD only system group available!

text: I installed at fedora snmpd package...               > view    systemview    included       > .1.3.6.1.2.1.1 view    systemview        > included   .1.3.6.1.2.1.25.1.1 view        > all          included   .1 80     > ####     > # Finally, grant the group read-only access to the systemview view.     >      > #       group          context sec.model sec.level prefix read       > write  notif access  notConfigGroup ""     > any       noauth    exact  systemview     > none none access  notConfigGroup ""        > any       noauth    exact  all  none     > none      I could get only system information.... using snmpwalk or whatever.. I tried adding RFC 1213 1.3.6.1.2.11 snmp node with no luck....   What am i doing wrong?


title: remote desktop on host

text: I have a host and I need people from Europe to access application on its desktop. So far I have told them to use `ssh -x -C user@host` and then launch an application with `application&` to get the app transferred to their desktop. That works, but they were complaining about the speed. Now I thought `VNC` might work better. so I installed a vncserver `Xvnc4` and I can connect to `127.0.0.1:5902` from the local shell but how can I tunnel this through ssh from external?


title: Get the name of the physically (on front of pc) logged in user, reliably!

text: `w`, `who`, `id` and `whoami` are excluded, because they only give information about users using a tty. Is there a way to extract the name reliably from KDM?


title: How to modify the Quadro driver to install on a GeForce

text: I have a consumer GeForce GTX680. It's professional equivalent is Quadro K5000. Both cards have exactly the same chip inside (GK104), the hardware is nearly identical. I need to install the Quadro driver instead of Geforce so I can have access to quad-buffered stereo system-wide. Windows users can force a Quadro driver by unpacking it and modifying one of the *.inf files. I managed to unpack the linux driver with:               sh NVIDIA* --extract-only      I can see two files reffering to specific device IDs of cards - monitoring.conf and pci.ids But suspect that on Linux we might have just one generic driver for all cards as I downloaded both the GTX680 driver and K5000 driver and both appear to be the same from inside. So the method for Linux might be different. Does anybody know how to modify the official driver or manually choose the one for K5000 from the files?


title: FTP issues after installing DD-WRT

text: I have recently installed DD-WRT on my D-Link DIR-615 router (rev. D3). Everything seems fine but I cannot connect to some (most) FTP servers anymore. Any ideas what can cause this issue? -- Passive/active doesn't make a difference. I've discovered something interesting. I've set up a port range forwarding `1024-65535 | Both | 192.168.1.131` for the testing purposes. After that I have enabled or disabled (it doesn't really matters it seems) the UPnP service and it let me connect to FTP but just for a few seconds.


title: Install mono and Monodevelop on a new Redhat 6.5 Workstation

text: Does anyone know how to install Mono and MonoDevelop on a Redhat 6.5 Workstation. I've tried a number of different things but nothing has worked. I tried using git and building with make from the mono website but it didn't build. EDIT: I successfully installed mono, now the only problem is getting MonoDevelop installed. EDIT: I managed to get an rpm installed: Monodevelop 2.4. But the application doesn't start.


title: Why am I getting a "Cannot revert to safe mode" error whenever I try to run a game?

text: I'm using internal VGA these days and I've got a problem: I can't run any games. I always get this errors:               --------- [Loading Renderer] ---------     Initializing OpenGL display     ...setting fullscreen mode 3: 1024 768     Using XFree86-VidModeExtension Version 2.2     Xlib:  extension "GLX" missing on display ":0.0".     Error couldn't get an RGB, Double-buffered, Depth visual, Stencil Buffered     Xlib:  extension "GLX" missing on display ":0.0".     Error couldn't get an RGB, Double-buffered, Depth visual     ref_gl::R_SetMode() - invalid mode     Initializing OpenGL display     ...setting mode 3: 1024 768     Using XFree86-VidModeExtension Version 2.2     Xlib:  extension "GLX" missing on display ":0.0".     Error couldn't get an RGB, Double-buffered, Depth visual, Stencil Buffered     Xlib:  extension "GLX" missing on display ":0.0".     Error couldn't get an RGB, Double-buffered, Depth visual     ref_gl::R_SetMode() - could not revert to safe mode     ref_gl::R_Init() - could not R_SetMode()      My motherboard is K8S-MX and I'm using linux 10.04 Do you know how can I fix it?


title: How do I send HTML email using linux 'mail' command?

text: `mail -s "subject" xxxxx@gmail.com <test.html` works, but only for plain text email. What is the correct way to send HTML email using the Linux command `mail`?


title: Error when using stat, errno=2

text: The case is as this, I create many files, and after the file generation, I use stat to get the all files info under the directory. The purpose is to purge all the files which are old than the specific days. But I got a ERROR after the file generation. The code is like this:               //generate files     DIR *dp;     struct dirent *dirp;     struct stat buf;     time_t now;     const char* fileName;          now = time(NULL);     if((dp = opendir(outputDir.c_str())) == NULL)     {        WARNING("Fail to open directory: " << outputDir<< ", errno=" << ERRNO());        return;     }          while(dirp = readdir(dp))     {        fileName = dirp->d_name;        if(!strcmp(fileName, ".") || !strcmp(fileName, "..")) continue;        int ret = stat(fileName, &buf);        if(ret)        {           closedir(dp);           WARNING("Fail to get info for files "<< fileName <<" via stat, errno=" << ERRNO());           return;        }             if(now - buf.st_mtime <= days * 24 * 3600) continue;             int rret = unlink(fileName);        if(rret)        {           closedir(dp);           WARNING("Fail to remove file "<< fileName <<" , errno=" << ERRNO());           return;        }          }     closedir(dp);      I got a ERROR during this line:               int ret = stat(fileName, &buf);      The errno is 2, No such file or directory. But I checked file, it does exit, and I flush the stream after the file writing. Any one knows the cause? Thanks.


title: CentOS: List the installed RPMs by date of installation/update?

text: I'm on a CentOS 4 machine. I updated and installed some packages a few weeks back, but I don't remember the name of every package or the names of every dependency. I used `yum`. Can I list the packages on my system by the date they were last installed or updated?


title: Using LVM with SSD and SATA drives

text: I saw in this question that it is possible to place both a SSD and a standard SATA hard drive into a single LVM volume group (VG). How does this affect performance? Is there a way to force the OS to be on the SSD while the data is on the SATA drive within a single volume group? Are there any good whitepapers on using LVM with different types of drives? Would it be beneficial to create a VG for each drive type and/or speed? I was thinking of creating one VG for SSDs and one for SATA (and for each drive type I may add in the future as it comes).


title: Why does /var/log/wtmp becomes so huge? How to inspect wtmp files?

text: Just noticed some 640MB wtmp file in a virtual container (Ubuntu Hardy).               # last -n 10000 -f /var/log/wtmp.1|wc -l     384     # ls -hl /var/log/wtmp.1     -rw-rw-r-- 1 root utmp 641M 21. Sep 07:49 /var/log/wtmp.1      logrotate was not installed (I just did that and forced rotating). Are there records in there not being displayed by `last` (which should show the last 1000 entries, but apparently there are only 384). From quickly skimming the `wtmp/utmp` man page, it does not look like a single entry should use about 1,6MB. Is there another program besides `last` to inspect these files?


title: Why am I observing different behaviour of echo?

text: I am a bash beginner and observed the below behavior of echo               #!/bin/bash          x=" hello"          echo $x     echo "$x"      Now when I run the above code I get               ronnie@ronnie:~$ bash test.sh     hello      hello     ronnie@ronnie:~$      So, can someone explain to me why `whitespace` in first case is not present in output and also points me to the documentation where this behavior is defined.


title: bash - how to uppercase the command line argument?

text: I searched SO and found that to uppercase a string following would work               str="Some string"     echo ${str^^}      But I tried to do a similar thing on a command-line argument, which gave me the following error ### Tried               #!/bin/bash                  ## Output     echo ${1^^}  ## line 3: ${1^^}: bad substitution     echo {$1^^}  ## No error, but output was still smaller case i.e. no effect      Please let me know, how could we do this?


title: ls list files not matching given string in filename

text: I have a directory in which lots of files (around 200) with the name `temp_log.$$` are created with several other important files which I need to check. How can I easily list out all the files and exclude the `temp_log.$$` files from getting displayed? ### Expected output               $ ls -lrt <exclude-filename-part>     -- Lists files not matching the above given string      I have gone through `ls` man page but couldn't find anything in this reference. Please let me know if I have missed any vital information here. Thanks


title: Stop laptop keys acting as a numpad with numlock on

text: I have bought an USB number pad and it's working as expected. Anyway, to use number keys, I need num lock on, and if I turn it on, my keyboard numpad sends numbers instead of the letters... How to have letter keys with num pad on? If that matters, I'm on an Asus eee PC 900 and using the lastest Linux Mint Debian Edition.


title: sed - how to exclude multiple patterns in the match

text: I have currently a set of seds that's working well except for one thing. The particular expression I'm having an issue with is:               sed -i '/[^}.to]\.to[[:space:]]/ s/\(\S\)/expect(\1/' ../_spec_seded/"$file"      Right now this works fine.   Basically it looks for `.to` and insert `expect` at the start of the expression. In particular, it excludes `}.to` when looking to match on `.to` which works. Now I want to also exclude 'this' or 'that' from the search match. In my case `}.to` **or** `end.to` i.e. instead of               /[^}.to]\.to[[:space]]/      should I have:               /[^}.to|^end\.to]\.to[[:space]]/     /[^}.to][^end\.to]\.to[[:space]]/     /[(^}.to|end\.to)]\.to[[:space]]/     /[^(}.to|end\.to)]\.to[[:space]]/      would I even need to escape parens if using them like               /[^\(}.to|end\.to\)]\.to[[:space]]/      or even the `|` as well?               /[^\(}.to\|end\.to\)]\.to[[:space]]/      I'm trying to make the match work on:               stuff.to do thing     stuff).to do thing     this.to that     all.all.all.to do     pretend.do  # Note this edge case! (pretend contains "end"!)       but not on               this will be here }.to do     last.end}.to do     all.this at the end.to     none at allend.to      and               all.this at the      end.to # i.e. no spaces before as it is the start of the line.      Negating with OR's generally (all languages) seems tricky (due to false positives).


title: Howto Tell if a System authenticate with password only or through PAM

text: If my computer has the pam package installed and has the directory `/etc/pam.d/sshd`, does it mean for sure when I ssh to my computer, I am authenticated through pam modules? The `/etc/pam.d/sshd` looks like this:                 #%PAM-1.0       auth       include      system-auth       account    required     pam_nologin.so       account    include      system-auth       password   include      system-auth       session    optional     pam_keyinit.so force revoke       session    include      system-auth       session    required     pam_loginuid.so