title: bring up ubuntu desktop x11 forwarding

text: I've been using rhel for a few years and when I want to bring up the desktop over x11, I use gnome-session. I'm new to Ubuntu and I was wondering what the equivalent of gnome-session was for Ubuntu?   I thought it was called Unity but when I try that it brings up the desktop with the same wallpaper but I can't see the sidebar or the menubar.   Right click menu seems to work though. I'm using ubuntu 12.10, with everything default. The one thing I'm not sure about is...   That machine is hooked up to a hi res monitor, so when I am remoting in over x11 I wonder if I'm just seeing a part of the desktop.


title: Installing new kernel (by commandline) as side of old kernel and effective configuration of ' menuconfig'

text: I need to install another kernel (2.6.34) into my fedora machine (x86) and i need to show the old and new boot up options in the boot menu (both new and old kernel) I have downloaded the new kernel and i need to compile it and need to build it. can you explain me the steps for doing that? I got the correct steps from this discussion and am having doubts in the steps 6 and 7 in the below link which explains the installation of new kernel. http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html Also can you explain the effective configuration of 'menuconfig' and its what it actually aims?


title: priv_sock_get_cmd error with vsftpd

text: I've installed `vsftpd` on my local system. When trying to connect to it using filezilla I get following error:               Status: Connection established, waiting for welcome message...     Response:   500 OOPS: priv_sock_get_cmd     Error:  Critical error     Error:  Could not connect to server


title: What does ${3#?} do?

text: I have a script with the following variable assignment:               TEST_VARIABLE=${3#?}      What does the `${3#?}` do?


title: Resources System V vs BSD

text: I'm searching for some detailed resources about the differences of System V and BSD concepts. For example:   * Interprocess Communication   * Sockets vs TLI   * ... Some sort of pro/cons discussion with historical background would be really nice. Any ideas?


title: Using cp, what is the difference between copying to DEST and DIRECTORY?

text: In the man page for `cp`, what is the difference between copying to DEST and DIRECTORY? `cp` copies a SOURCE to a DEST and SOURCES to a DIRECTORY.                  SYNOPSIS             cp [OPTION]... [-T] SOURCE DEST        cp [OPTION]... SOURCE... DIRECTORY


title: Pamd not mounting ecryptfs disk anymore since upgrade

text: I have encrypted my home disk a long time ago and I configured pam to mount it automatically on login. However after update to version 1.1.5-3 pam is not mounting the disk anymore. Here are the logs :               PAM adding faulty module: /usr/lib/security/pam_ecryptfs.so     pam_unix(login:session): session closed for user ben     PAM unable to dlopen(/usr/lib/security/pam_ecryptfs.so): /usr/lib/security/pam_ecryptfs.so: cannot open shared object file: No such file or directory      Seems like the pam-ecryptfs library has been removed. How can I fix this?


title: Preseeding Ubuntu 10.04

text: I need to preseed a dual boot installation of Ubuntu 10.04. I want partman to use all already existing Linux partitions and all free space (like the option when installing Fedora) what would that recipe look like?


title: Streaming to an Apple TV (3) from Linux

text: Alright, here is the setup:   * One apple tv 3 in the living room, connected to the network (wired).   * One pc running Linux (Arch Linux x64, AMD), containing all music, movies and series (wired). Now I know that the atv can stream music and stuff shared from a windows/mac using iTunes and home sharing. The box containing the files is however running Linux. I've tried to setup forked-daapd, which is recognized as a server by all iTunes instances in house, but not by the atv. I've read that this is due to forked-daapd supporting DAAP, but not home sharing. I've also tried several other DAAP servers for Linux:   * mt-daapd (the predecessor of forked-daapd), same story as with forked-daapd.   * tangerine. Was recognized by iTunes, but didn't offer any media. Not sure whether the atv saw it, but I don't think so.   * spydaap. This didn't work with the latest version of iTunes, which seems to be a known issue I've also attempted to install the horror that is called iTunes on my pc running Linux, but that failed. It installed, gave a bunch of errors, starts, and does absolutely nothing. It's just a blank screen. Now I know that normally such a setup would be possible by jailbreaking the atv, and installing XBMC on it. However, the atv3 is not yet jailbreakable, so unfortunately this is not an option for me. Now my question is, what options do I have. Are there ways to make the atv recognize forked-daapd that I missed, or are there alternatives to forked- daapd that work with the atv? Is there an way to make iTunes run on my system? Is there any other way to stream the media on my Linux PC to the atv?


title: KUbuntu 10.04 / Dolphin File Manager: Is there a way to make .desktop files display the filename the same as the NAME= in the metadata?

text: As shown in the below screenshot, if I have a Folder Widget setup to point to the Desktop "place", the .desktop files appear with the filename of the Name= value in the file. ![filename of the Name= value](http://i.stack.imgur.com/P13gv.png) However, if I browse to this folder in Dolphin / make the Folder Widget point to the absolute path to the desktop / Click "Open in Dolphin" in the context menu of the Folder Widget pointing to the absolute path to the desktop, I get the real filename of the .desktop file: ![real filename](http://i.stack.imgur.com/eVGm5.png) Is this a changeable setting, or hard-coded?


title: VirtualBox networking host-only: Linux host XP Guest

text: I'm having trouble connecting XP ( Guest system on VBOX ) to Debian Testing (host). The version VirtualBox 4.1.12 Relevant parts of the output of commands. ### ifconfig on debian:               eth0         inet addr:192.168.158.5  Bcast:192.168.158.255  Mask:255.255.255.0          vboxnet0       inet addr:192.168.158.199  Bcast:192.168.158.255  Mask:255.255.255.0      ### ipconfig on XP:               IP Address 192.163.158.200      Subnet mask 255.255.0.0      `File->Preferences->Network->edit vboxnet0` yields the following dialogs:               Host-Only network Details      Adaptor:       Ipv4 Address:192.168.158.199       Subnet Mask: 255.255.255.0               DHCP Server       Server Address: 192.168.158.198       Server Mask:255.255.255.0       Lower Address Bound: 192.168.158.200       Upper Address Bound:192.168.158.254      I cannot ping either machine from the other. Any idea what the problem is?


title: How can I open a window on a different monitor?

text: With multiple monitors, I have so far been dragging windows manually around. Is there a way to make a window open on a specific screen in a dual-head setup? (Not to be confused with multiple X server displays.) Something like: `SCREEN=2 firefox` or `open-in-screen 2 firefox`. If it matters, my environment is KDE using the KWin window manager. KWin window rules can only match some properties like title, but I could not find an environment variable as filter. The secondary display extends the primary screen:               $ xrandr -q     Screen 0: minimum 320 x 200, current 3520 x 1080, maximum 32767 x 32767     LVDS1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 382mm x 214mm        1600x900       60.1*+        1024x768       60.0          800x600        60.3     56.2          640x480        59.9       VGA1 disconnected (normal left inverted right x axis y axis)     HDMI1 connected 1920x1080+1600+0 (normal left inverted right x axis y axis) 477mm x 268mm        1920x1080      60.0*    50.0     59.9          1920x1080i     60.1     50.0     60.0          1680x1050      59.9          1280x1024      75.0     60.0          1440x900       59.9          1280x960       60.0          1280x720       60.0     50.0     59.9          1024x768       75.1     70.1     60.0          832x624        74.6          800x600        72.2     75.0     60.3     56.2          720x576        50.0          720x480        60.0     59.9          640x480        75.0     72.8     66.7     60.0     59.9          720x400        70.1       DP1 disconnected (normal left inverted right x axis y axis)


title: Any way for Unix to ignore lpoptions and let Java do it's job?

text: I'm using the javax.print API to print a Jasper Report on Debian Linux. For some reason the saved lpoptions (CUPS settings) always override settings chosen on the Java Print dialog. At this point the only way I am getting around this problem is to delete the .lpoptions file in the user's directory. This doesn't appear like something I can control with Java so is there a way to keep the Unix CUPS settings from overriding the print settings?


title: Shrink Windows partition to install Fedora 20

text: I want to install Fedora 20 along already installed Windows 8.1 on my notebook. I found a good how-to on Techotopia, however, the installer for Fedora 20 looks completely different, is simpler ( _cough_ more _cough_ stupid _cough_ ), and doesn't offer the partition shrink. So I'm looking for a best way how to do it **without destroying my Windows** (since they came with the notebook and I can't re-install). I think that once I manage to shrink the partition and create enough empty space on the disk, the Fedora installer will be happy, but I don't know how to do it.


title: How to log the output of a daemon application?

text: I have a Java program running as a daemon (thanks to YAJSW, a wrapper for java). The thing is that this java application writes several lines of console text, (simply imagine a Hello World App). If I run it from the console of course I can read those lines. But when it runs as a daemon, where do those lines of text go?


title: View Files from mirrored RAID outside the device

text: The Product I have is a Western Digital My Book The device has stopped working but there is nothing wrong with either of the two mirrored drives. I would like to take out the two mirrored hard drives, and recover the data if at all possible. How would I go about this on ubuntu 11.10? Both of the drives are recognized but I can not see the data anywhere. The relevant software I have on the system are: **Disk Utility** and a terminal application called **mdadm**. I am trying to be cautious and not accidentally wipe the data. Any help will be much appreciated.


title: Strange directory name, shown with a backslash

text: I have copied and pasted a directory of files into another. The result is now this one `development\ /` I do not know what that means? Linux does not even recognize it as a directory now. Also the owner of this directory is wrong. But when I try to do this `chown -R zugul /development`, the result is: `chown: impossibile accedere a`/development': No such file or directory` Looks like something went wrong when I have pasted the copied directory. How can I fix this issue?


title: Could not bind socket: Permission denied when trying to start NDOUtils using UNIX socket

text: I followed these directions to a tee: http://shah- oss.blogspot.com/2010/12/ndoutils-installation-on-centos-for.html Everything was going well until I actually tried to run this command (there is a typo in the article, I've corrected it here):               /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg      My results:               # /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg      Could not bind socket: Permission denied      I'm running this command as root already. I chose to use the UNIX socket rather than TCP. The Nagios log shows the following after a fresh reboot but nothing if I try to run that command manually.               [1371152186] ndomod: NDOMOD 1.5.2 (06-08-2012) Copyright (c) 2009 Nagios Core Development Team and Community Contributors     [1371152186] ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...     [1371152186] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.      Looking at the process tree, I see no "ndo" process of any kind running. Looking at netstat, I see this:               unix  2      [ ACC ]     STREAM     LISTENING     841374 /var/run/saslauthd/mux     unix  2      [ ACC ]     STREAM     LISTENING     840356 @/com/ubuntu/upstart     unix  2      [ ]         DGRAM                    840610 @/org/kernel/udev/udevd     unix  10     [ ]         DGRAM                    841162 /dev/log     unix  2      [ ACC ]     STREAM     LISTENING     841337 /var/lib/mysql/mysql.sock     unix  2      [ ]         DGRAM                    857504      unix  2      [ ]         DGRAM                    847472      unix  2      [ ]         DGRAM                    841625      unix  2      [ ]         DGRAM                    841584      unix  2      [ ]         DGRAM                    841534      unix  2      [ ]         DGRAM                    841517      unix  2      [ ]         DGRAM                    841373      unix  2      [ ]         DGRAM                    841212      unix  3      [ ]         DGRAM                    840614      unix  3      [ ]         DGRAM                    840613       I tried to enable debugging for this utilility:               debug_level=-1     debug_verbosity=1     debug_file=/usr/local/nagios/var/ndo2db.debug     max_debug_file_size=1000000      But nothing is written to /usr/local/nagios/var/ndo2db.debug


title: LAN only VNC help

text: **GOAL:** I have 2 computers in a LAN environment (I will refer to them as [computer A] and [computer B]) and I want to log into [computer B] via [computer A]. I have a VNC client on [computer A] `Remote Desktop Viewer` and I have setup `Desktop Sharing Preferences` on [computer B], see screenshots below. The LAN IP address of [computer A] is 192.168.0.1 and the LAN IP address of [computer B] is 192.168.0.2. Both computers have no problem pinging to each other! * * * **QUESTION:** My question is, how do I connect to [computer B] from [computer A]? * * * **ERROR MESSAGE:** I am currently getting the following error message when I try to connect:               connection to 192.168.0.2 was closed      192.168.0.2 is the IP address of [computer B]. * * * **PORTS / FIREWALL:** I can't see the port 5900 listed when I run `sudo lsof -i -P | grep -i listen`. I don't have a firewall installed either. I've now installed Gufw on both [computer A] and [computer B]. I am not sure how to configure it. Do I set it up to allow incoming connections for vnc on [computer B] and allow outgoing connections for vnc on [computer A]? * * * **OTHER INFO:**               Computer A = 192.168.0.1 = Ubuntu 12.04     Computer B = 192.168.0.2 = Debian Stable      Both are fully updated * * * **IPTABLES (same on server and client):**               Chain INPUT (policy ACCEPT)     target - prot opt source - destination          Chain FORWARD (policy ACCEPT)     target - prot opt source - destination          Chain OUTPUT (policy ACCEPT)     target - prot opt source - destination      * * * **LISTENING PORTS**               sudo lsof -i -P | grep -i listen     rpcbind   1853        root    8u  IPv4   5755      0t0  TCP *:111 (LISTEN)     rpcbind   1853        root   11u  IPv6   5762      0t0  TCP *:111 (LISTEN)     rpc.statd 1884       statd    8u  IPv4   5818      0t0  TCP *:56428 (LISTEN)     rpc.statd 1884       statd   10u  IPv6   5826      0t0  TCP *:39576 (LISTEN)     cupsd     2615        root    6u  IPv6  17952      0t0  TCP localhost:631 (LISTEN)     cupsd     2615        root    8u  IPv4  17953      0t0  TCP localhost:631 (LISTEN)     mysqld    3042       mysql   10u  IPv4   7466      0t0  TCP localhost:3306 (LISTEN)     exim4     3855 Debian-exim    3u  IPv4   8075      0t0  TCP localhost:25 (LISTEN)      * * * **SCREENSHOTS:** This is the client software I have on [computer A]: ![enter image description here](http://i.stack.imgur.com/sMtMm.png) This is the software (server software I guess) I have on [computer B]: ![enter image description here](http://i.stack.imgur.com/n1mFa.png)


title: How to access user's fpath as opposed to system's fpath with a script?

text: test.zsh:               #!/usr/bin/env zsh                                                                                for f in ${fpath}; do         echo ${f}     done      outputs:               /usr/local/share/zsh/site-functions     /usr/share/zsh/functions/Calendar     /usr/share/zsh/functions/Completion     /usr/share/zsh/functions/Completion/AIX     /usr/share/zsh/functions/Completion/BSD     /usr/share/zsh/functions/Completion/Base     /usr/share/zsh/functions/Completion/Cygwin     /usr/share/zsh/functions/Completion/Darwin     /usr/share/zsh/functions/Completion/Debian     /usr/share/zsh/functions/Completion/Linux     /usr/share/zsh/functions/Completion/Mandriva     /usr/share/zsh/functions/Completion/Redhat     /usr/share/zsh/functions/Completion/Solaris     /usr/share/zsh/functions/Completion/Unix     /usr/share/zsh/functions/Completion/X     /usr/share/zsh/functions/Completion/Zsh     /usr/share/zsh/functions/Exceptions     /usr/share/zsh/functions/MIME     /usr/share/zsh/functions/Misc     /usr/share/zsh/functions/Newuser     /usr/share/zsh/functions/Prompts     /usr/share/zsh/functions/TCP     /usr/share/zsh/functions/VCS_Info     /usr/share/zsh/functions/VCS_Info/Backends     /usr/share/zsh/functions/Zftp     /usr/share/zsh/functions/Zle      While the command line output has a few extra entries:               ╭─ting@core ~/code/autojump  ‹install-zsh-local*›     ╰─➤  echo $fpath            /home/ting/code/oh-my-zsh/plugins/git     /home/ting/code/oh-my-zsh/functions     /home/ting/code/oh-my-zsh/completions     /usr/local/share/zsh/site-functions     /usr/share/zsh/functions/Calendar     /usr/share/zsh/functions/Completion     /usr/share/zsh/functions/Completion/AIX     /usr/share/zsh/functions/Completion/BSD     /usr/share/zsh/functions/Completion/Base     /usr/share/zsh/functions/Completion/Cygwin     /usr/share/zsh/functions/Completion/Darwin     /usr/share/zsh/functions/Completion/Debian     /usr/share/zsh/functions/Completion/Linux     /usr/share/zsh/functions/Completion/Mandriva     /usr/share/zsh/functions/Completion/Redhat     /usr/share/zsh/functions/Completion/Solaris     /usr/share/zsh/functions/Completion/Unix     /usr/share/zsh/functions/Completion/X     /usr/share/zsh/functions/Completion/Zsh     /usr/share/zsh/functions/Exceptions     /usr/share/zsh/functions/MIME     /usr/share/zsh/functions/Misc     /usr/share/zsh/functions/Newuser     /usr/share/zsh/functions/Prompts     /usr/share/zsh/functions/TCP     /usr/share/zsh/functions/VCS_Info     /usr/share/zsh/functions/VCS_Info/Backends     /usr/share/zsh/functions/Zftp     /usr/share/zsh/functions/Zle      How can I get the script to access the user's fpath as opposed to the system's?


title: Recover data from raid 1 when both drives are faulty

text: I had a RAID 1 on my server, and apparently both of hard drives have failed at the same time. Server support did a quick check to confirm that               HDDTEST-W1F21M6K    ERROR   Finished (Selftest, Device: sda);      HDDTEST-W1F22Y9M    ERROR   Finished (Values-Check, Device: sdb);          However, there still seems to be a partition table on sdb.     Your server is currently booted into our rescue system. Please try      to backup your data if possible and contact us again if      you wish to proceed with a hard drive replacement.      I'm able to boot the system from other drive and see the following structure               cat /proc/mdstat     Personalities : [raid1]      md3 : active raid1 sdb4[1]          1822442815 blocks super 1.2 [2/1] [_U]          md2 : active raid1 sdb3[1]       1073740664 blocks super 1.2 [2/1] [U_]          md1 : active raid1 sdb2[1]       524276 blocks super 1.2 [1/1] [U]          md0 : active raid1 sdb1[1]       33553336 blocks super 1.2 [2/1] [_U]      What I need is to be able recover some important data from the `/dev/md2` partition. I'm trying to mount md2 and getting the following:               mount /dev/md2 /mnt          mount: wrong fs type, bad option, bad superblock on /dev/md2,        missing codepage or helper program, or other error        In some cases useful info is found in syslog - try        dmesg | tail  or so      Any ideas how to fix this? _Update 1_ Some more data               mdadm -E /dev/sdb3     /dev/sdb3:           Magic : a92b4efc         Version : 1.2     Feature Map : 0x0      Array UUID : 39c5b7f5:c3bed499:e383ce7f:0868fc3e            Name : rescue:2  (local to host rescue)     Creation Time : Wed Feb  6 07:23:32 2013      Raid Level : raid1      Raid Devices : 2          Avail Dev Size : 2147481600 (1024.00 GiB 1099.51 GB)      Array Size : 1073740664 (1024.00 GiB 1099.51 GB)     Used Dev Size : 2147481328 (1024.00 GiB 1099.51 GB)     Data Offset : 2048 sectors      Super Offset : 8 sectors           State : clean     Device UUID : 3d68ec1a:3b125641:fa4b1d34:c829f017          Update Time : Wed Aug  6 13:21:28 2014        Checksum : dad4eccc - correct          Events : 18773099                Device Role : Active device 0      Array State : A. ('A' == active, '.' == missing)      _Update 2_ Volumes available               ls /dev/sd     sda   sdb   sdb1  sdb2  sdb3  sdb4  sdb5            mdadm -E /dev/sda     mdadm: No md superblock detected on /dev/sda.      dmesg output after mount /dev/md2 /mnt attepmt               [Wed Aug  6 16:11:12 2014] ata2.00: exception Emask 0x0 SAct 0x600fffff SErr 0x0 action 0x0     [Wed Aug  6 16:11:12 2014] ata2.00: irq_stat 0x40000008     [Wed Aug  6 16:11:12 2014] ata2.00: cmd 60/08:e8:70:3b:d4/00:00:43:00:00/40 tag 29 ncq 4096 in     [Wed Aug  6 16:11:12 2014]          res 41/40:08:70:3b:d4/00:00:43:00:00/00 Emask 0x409 (media error) <F>     [Wed Aug  6 16:11:12 2014] ata2.00: configured for UDMA/133     [Wed Aug  6 16:11:12 2014] sd 1:0:0:0: [sdb] Unhandled sense code     [Wed Aug  6 16:11:12 2014] sd 1:0:0:0: [sdb]       [Wed Aug  6 16:11:12 2014] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE     [Wed Aug  6 16:11:12 2014] sd 1:0:0:0: [sdb]       [Wed Aug  6 16:11:12 2014] Sense Key : Medium Error [current] [descriptor]     [Wed Aug  6 16:11:12 2014] Descriptor sense data with sense descriptors (in hex):     [Wed Aug  6 16:11:12 2014]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      [Wed Aug  6 16:11:12 2014]         43 d4 3b 70      [Wed Aug  6 16:11:12 2014] sd 1:0:0:0: [sdb]       [Wed Aug  6 16:11:12 2014] Add. Sense: Unrecovered read error - auto reallocate failed     [Wed Aug  6 16:11:12 2014] sd 1:0:0:0: [sdb] CDB:      [Wed Aug  6 16:11:12 2014] Read(16): 88 00 00 00 00 00 43 d4 3b 70 00 00 00 08 00 00     [Wed Aug  6 16:11:12 2014] end_request: I/O error, dev sdb, sector 1137982320     [Wed Aug  6 16:11:12 2014] ata2: EH complete     [Wed Aug  6 16:11:15 2014] JBD2: Failed to read block at offset 1134     [Wed Aug  6 16:11:15 2014] JBD2: IO error -5 recovering block 1134 in log     [Wed Aug  6 16:11:16 2014] JBD2: recovery failed     [Wed Aug  6 16:11:16 2014] EXT4-fs (md2): error loading journal      _Update 3_ for sdb               smartctl -d ata -A /dev/sdb     smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.14.10] (local build)     Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net          === START OF READ SMART DATA SECTION ===     SMART Attributes Data Structure revision number: 10     Vendor Specific SMART Attributes with Thresholds:     ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE       1 Raw_Read_Error_Rate     0x000f   101   099   006    Pre-fail  Always       -       216425892       3 Spin_Up_Time            0x0003   095   095   000    Pre-fail  Always       -       0       4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       6       5 Reallocated_Sector_Ct   0x0033   092   092   010    Pre-fail  Always       -       10928       7 Seek_Error_Rate         0x000f   081   060   030    Pre-fail  Always       -       149168536       9 Power_On_Hours          0x0032   085   085   000    Old_age   Always       -       13145      10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0      12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       6     183 Runtime_Bad_Block       0x0032   099   099   000    Old_age   Always       -       1     184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0     187 Reported_Uncorrect      0x0032   064   064   000    Old_age   Always       -       36     188 Command_Timeout         0x0032   100   098   000    Old_age   Always       -       12885098499     189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0     190 Airflow_Temperature_Cel 0x0022   067   052   045    Old_age   Always       -       33 (Min/Max 26/36)     191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0     192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       4     193 Load_Cycle_Count        0x0032   092   092   000    Old_age   Always       -       17084     194 Temperature_Celsius     0x0022   033   048   000    Old_age   Always       -       33 (0 22 0 0)     197 Current_Pending_Sector  0x0012   097   097   000    Old_age   Always       -       504     198 Offline_Uncorrectable   0x0010   097   097   000    Old_age   Offline      -       504     199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0     240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       128896263532923     241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       10152724077     242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       40689314539      and for sda               smartctl -d ata -A /dev/sda     smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.14.10] (local build)     Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net          Error SMART Values Read failed: Input/output error     Smartctl: SMART Read Values failed.          === START OF READ SMART DATA SECTION ===


title: Matching values within columns

text: I have tab-delimited text file containing about more than 1500 rows. input.txt               id   sno1        EN1  Nucus_2158_mri_1/2_Co_1.0_Le_3104     EN2  Nucus_2158_mri_4/2_Co_1.0_Le_3104     EN3  Nucus_2158_mri_1/2_Co_1.0_Le_3104     EN4  Nucus_2158_mri_1/2_Co_1.0_Le_3106     EN5  Nucus_2158_mri_1/2_Co_1.0_Le_3104     EN6  Nucus_2159_mri_1/2_Co_1.0_Le_3104      I want to get exact match within column (sno1) by capturing bracketed values (`Nucus_{2158}_mri_{1/2}_Co_1.0_Le_{3104}`) and print their matching ids list. Any help in awk/sed appreciated. output.txt               Nucus_2158_mri_1/2_Co_1.0_Le_3104 EN1,EN3,EN5


title: CUPS and printer security

text: I would like some help on securing a networked printer. Specifically, I'm interested in the following: 1) Preventing unauthorized access to the printer: I would like only certain laptops that connect to the printer's network over Wi-Fi to be able to print but I would definitely want to prevent guest laptops from printing. 2) Have some sort of accounting enabled whereby I can figure out who (read: which machine) printed/scanned/copied how many pages. Is there a generic solution for this under *nix or does it depend on the printer?


title: `cron` service and `at` command

text: Help to understand: is there any relation between `cron` and `at` command. Actually if I stop the `cron` services in SUSE by running following command:               /etc/init.d/cron stop      after above, if I run `at` command with `at` work?   example:               at -f /u01/script1.sh now


title: Not able to see the progression of a file with "tail -f"!

text: It's a surprise why now this command isn't working which earlier was. See I've the below command to run for backup.               ubuntu@ubuntu:~$ sudo tar -cvf /media/ubuntu/My*Linux/ub*data/zebra.tar /media/ubuntu/home > z1 2> z2 && echo "pass" || echo "fail"      To see the output & error, there are those 2 files z1 & z2. Now why the below isn't working. I want to see the output of the command on a terminal from file z1.               ubuntu@ubuntu:~$ tail -f z1      This command is not showing the data that's getting appended with time. What's wrong here. I'm working on live install of Ubuntu 14.04.1 using usb pen drive. Can this be the reason!!!


title: Change color balance on Intel Graphics

text: My laptop has some screen or cable problem, because of which the screen is all pink colour. In Windows I use my Graphic Card configuration software to change the screen colours mixing colour channels and hence changing the screen colour to a very normal colour that I can work on. ![Graphic card driver software I use on Windows](http://i.stack.imgur.com/uq1JX.png) Now is there a similar software that I can use on linux. I am now on linux and trying out different linux. Now I am using Mint. Can I find A software that I can use Like the one on windows.


title: Gnome3 memory comsuption high

text: I recently installed ArchLinux on my desktop. I simply installed the base system and installed GNOME and GDM and the system work "fine". However today (after 10 hours) when I tried to open any application the system now tells me that it can't do it because the memory is full.


title: xfreerdp keeps disconnecting

text: I'm logging into an rdp environment using Linux. Everything works fine if the session is constantly in use. However, if the user walks away from his/her desk, and comes back say 5 minutes later, the session has automatically closed, and the user has to connect again. Anyway to stop this from happening? * * * The terminal shows the following message when the session is closed:               rpc_client_on_fragment_receiving_event: Receiving Out-of_sequence RTS PDU     Network disconenct!     Failed to check FreeRDP file descriptor


title: Terminator doesn't open new window

text: Terminator 0.95 (running on Debian stable under Gnome) has shortcuts for "Spawn a new Terminator process" and "Create a new window". However, when I set them (to several different options, in case there is a conflict) and try to use, instead of a new window I get a lightbulb in the header of the current tab. There are no error messages in the terminal I am running Terminator from, but looking again at keybindings, the shortcuts become disabled. Trying to use the shortcut without closing the preferences window didn't work either. What does it mean and how can I avoid it?


title: How to properly lock desktop when hibernating?

text: If I lock the screen, hibernate by closing the laptop lid, open the laptop lid and press the power button, the screen will just show a black surface and I can start typing the password immediately. If I _don't_ lock the screen before hibernating, wait about 30s, open the laptop lid and press the power button, the screen will show the desktop and then fade to black as if `xscreensaver` had been activated _after exiting_ hibernation. Only after the fadeout can I deactivate the screensaver. How can I make sure `xscreensaver` is always properly activated when hibernating, so that I won't have to wait for the fadeout?


title: My Centos Server cannot resolve the DNS host name

text: My Server OS: Centos 6.3 x64. The server `iptables` is:               *filter     :INPUT DROP [0:0]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [0:0]     -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT      -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT      COMMIT      But I get neither a response issuing               ping www.google.com      OR               curl -I http://www.google.com      from the server. Both receive no response! How to modify my `iptables` rules?


title: Not able to access my local machine from remote server; what's my local IP address?

text: This is where I spent much time to know why I'm unable to connect to my local box from my own remote server (VPS); seems to be my local box's IP address issue. To begin with, let me 1st tell how I operate in Internet. I connect my laptop with my cellphone Nokia N73 having Vodafone sim card. This way (dial- up) my laptop is connected to Internet. Regarding the remote server (VPS), I purchased it from http://lvpshosting.com/ They provide 100 Mb/s net speed. I have remote's IP address. I ssh it and connect. Now, to connect from there to my local, I need my local IP add. So, checked my IP executing `ifconfig` on my local box. Please see the output below:               ravbholua@ravbholua-Aspire-5315:~$ ifconfig     eth0      Link encap:Ethernet  HWaddr 00:1b:38:d0:45:ea                 UP BROADCAST MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)               Interrupt:18           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:493 errors:0 dropped:0 overruns:0 frame:0               TX packets:493 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:85372 (85.3 KB)  TX bytes:85372 (85.3 KB)          ppp0      Link encap:Point-to-Point Protocol                 inet addr:10.224.108.37  P-t-P:10.6.6.6  Mask:255.255.255.255               UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1               RX packets:4848 errors:0 dropped:0 overruns:0 frame:0               TX packets:5375 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:3                RX bytes:2352345 (2.3 MB)  TX bytes:698847 (698.8 KB)          ravbholua@ravbholua-Aspire-5315:~$      From here, I suppose it to be 10.224.108.37 But when using this from remote, it doesn't work to connect to my local box. I have tried using the following for my local IP address. http://www.ipchicken.com/ http://whatismyip.org/ These 2 links gave IP address but none worked. As someone told that the address given by these 2 links are of my cell phone and not of my laptop. Also when I connect to my remote from local via `ssh`, then when I log in to my remote, the remote server messages as seen below:               ravbholua@ravbholua-Aspire-5315:~$ ssh  rs     ravbholua@rs's password:      Welcome to Ubuntu 13.04 (GNU/Linux 2.6.32-042stab076.5 i686)           * Documentation:  https://help.ubuntu.com/          No mail.     Last login: Tue Sep 10 08:04:49 2013 from 123.63.112.140     ravbholua@ravi:~$      This IP address as mentioned above is similar to what I get from the 2 links above. (and is not the one given by command `ifconfig` .) So, one told me that the remote server displays the IP of the cell phone which is acting as a router and your local machine is not reachable. But I couldn't get any further solution on how my local box would be reached. Please have a note here that I had posted this query on a different site (mentioned below) but couldn't get solution. It would be very useful if one please have a look at that thread of mine in that forum: http://www.linuxquestions.org/questions/linux-networking-3/not-able-to-do- password-free-access-to-remote-machine-4175475825/ Much of my other related tasks are pending due to this issue. I am too hopeful from this site as a few other earlier unsolved queries of mine got solved in this site.


title: Authconfig contiously rewriting the /etc/sysconfig/authconfig file, messing up Puppet run

text: I have been using this LDAP module for a long time in my Puppet environment. The module uploads these files to the RHEL-servers:               /etc/openldap/openldap.conf     /etc/pam_ldap.conf     /etc/nsswitch.conf     /etc/sssd/sssd.conf     /etc/sysconfig/authconfig     /etc/sudo-ldap.conf     /etc/openldap/cacerts/cacert.pem      After running this, it will run `authconfig --updateall` and the LDAP will start working. This worked perfectly fine on the RH6.2-servers we have, but RH6.4 gives an issue, while the only difference is an additional `FORCELEGACY=YES line`. What can I do about this behaviour? The logical thing seemed to upload the `/etc/sysconfig/authconfig` file generated by /sbin/authconfig to the Puppetmaster, but it keeps rewriting the `/etc/sysconfig/authconfig` and all it does it change the order:               [root@rhel-server ~]# puppet agent --test     Info: Retrieving plugin     Info: Loading facts in /var/lib/puppet/lib/facter/extra_info.rb     Info: Caching catalog for rhel-server.domain.local     Info: Applying configuration version '1379669638'     Notice: /File[/etc/sysconfig/authconfig]/content:      --- /etc/sysconfig/authconfig   2013-09-20 13:18:24.165303819 +0200     +++ /tmp/puppet-file20130920-17419-lgtzfu-0 2013-09-20 13:44:05.388741384 +0200     @@ -5,22 +5,22 @@      USESSSDAUTH=no      USESHADOW=yes      USEWINBIND=no     +USESSSD=no      USEDB=no      FORCELEGACY=yes      USEFPRINTD=yes     -USEHESIOD=no      FORCESMARTCARD=no     -PASSWDALGORITHM=md5      USELDAPAUTH=yes     +USEPASSWDQC=no      IPAV2NONTP=no     -USELDAP=yes     +USELOCAUTHORIZE=yes      USECRACKLIB=yes      USEIPAV2=no      USEWINBINDAUTH=no      USESMARTCARD=no     -USELOCAUTHORIZE=yes     +USELDAP=yes      USENIS=no      USEKERBEROS=no      USESYSNETAUTH=no     -USESSSD=no     -USEPASSWDQC=no     +PASSWDALGORITHM=md5     +USEHESIOD=no          Info: FileBucket got a duplicate file {md5}b8bd9dc8120ab4be6b41ac5bb57e1192     Info: /File[/etc/sysconfig/authconfig]: Filebucketed /etc/sysconfig/authconfig to puppet with sum b8bd9dc8120ab4be6b41ac5bb57e1192     Notice: /File[/etc/sysconfig/authconfig]/content: content changed '{md5}b8bd9dc8120ab4be6b41ac5bb57e1192' to '{md5}f1cf038ce9c007f9eefe3b83fb674584'     Info: /File[/etc/sysconfig/authconfig]: Scheduling refresh of Exec[/usr/sbin/authconfig --updateall]     Notice: /Stage[main]/Ldap/Exec[/usr/sbin/authconfig --updateall]: Triggered 'refresh' from 1 events     Notice: Finished catalog run in 6.17 seconds     [root@rhel-server ~]#       So it seems no matter the order I have on the Puppetmaster for the authconfig- file, authconfig keeps rewriting it. This has in effect that every Puppet run (30 minutes) Puppet replaces the file and then authconfig changes the order in that file. How can I solve this issue?


title: Programs installed with depothelper dump core

text: Anything I install via depothelper on HP-UX 11.23 (ia64) seems to crash. I installed the packages using the following command: `/depothelper -a ia64 -c /var/tmp/mydir -o 11.23 vim` And here is what I get when I try to execute the programs:               bash-2.05b# whereis vim     whereisvim: /usr/local/bin/vim /usr/local/man/man1/vim.1 /usr/local/share/man/man1/vim.1     bash-2.05b# whereis rsync     rsync: /usr/local/bin/rsync /usr/local/share/man/man1/rsync.1     bash-2.05b# /usr/local/bin/rsync     Bus error (core dumped)     bash-2.05b# /usr/local/bin/vim     Bus error (core dumped)      The system is an RX1620 and everything else seems to work just fine on it.


title: ECC on a single block device

text: I have an SSD that I suspect failing silently now and then. I have run `badblocks` on it and it is clear that it is not bad sectors but might instead be some race condition in the electronics, in which case a retry would probably read the data correctly. Normal magnetic disks have some ECC to correct errors by taking up more space. Can Linux add an ECC layer on top of my block device? I am thinking of something similar to device mapper, so maybe:               dmsetup create-ecc /dev/orig /dev/mapper/with_ecc      so any read and write to /dev/mapper/with_ecc will be converted to an ecc- read/write on /dev/orig. Edit: It seems others have been looking for it, too: http://permalink.gmane.org/gmane.linux.kernel.device-mapper.devel/8756


title: Difference between top and ps output

text: I have seen What is the difference between ps and top command? but I think my question is unrelated.   My system is Lubuntu 13.04.   I run `top` in one lxterminal window and `ps -eo %c%C --sort -%cpu | head -6` in another.   I play a YouTube video in Firefox.   Very quickly, the values for `plugin-container` in the `top` screen "stabilize" whereas the values I get by repeatedly issuing `ps -eo %c%C --sort -%cpu | head -6` rise slowly.   Similarly, when I close the Firefox tab that was playing the YouTube video, the plugin-container entry in `top` goes away promptly but it lingers on in the output of `ps -eo %c%C --sort -%cpu | head -6`, declining slowly as can be seen below:                   [04:43 PM] ~ $ ps -eo %c%C --sort -%cpu | head -6         COMMAND         %CPU         plugin-containe 21.5         firefox          4.9         Xorg             1.6         lxpanel          0.2         dropbox          0.2         [04:43 PM] ~ $ ps -eo %c%C --sort -%cpu | head -6         COMMAND         %CPU         plugin-containe 21.3         firefox          4.9         Xorg             1.6         lxpanel          0.2         dropbox          0.2         [04:43 PM] ~ $ ps -eo %c%C --sort -%cpu | head -6         COMMAND         %CPU         plugin-containe 20.9         firefox          4.9         Xorg             1.6         lxpanel          0.2         dropbox          0.2         [04:43 PM] ~ $ ps -eo %c%C --sort -%cpu | head -6         COMMAND         %CPU         plugin-containe 20.2         firefox          4.9         Xorg             1.6         lxpanel          0.2         dropbox          0.2         [04:44 PM] ~ $ ps -eo %c%C --sort -%cpu | head -6         COMMAND         %CPU         plugin-containe 20.0         firefox          4.9         Xorg             1.6         lxpanel          0.2         dropbox          0.2         [04:44 PM] ~ $ ps -eo %c%C --sort -%cpu | head -6         COMMAND         %CPU         plugin-containe 18.9         firefox          4.9         Xorg             1.6         lxpanel          0.2         dropbox          0.2         [04:44 PM] ~ $       `plugin-container` does eventually go away, but how should I modify `ps -eo %c%C --sort -%cpu | head -6` to make it go away quicker? (All this is done on a Dell 1545 Core2Duo laptop.)


title: How do I mount drive from one machine to another machine?

text: I am running two linux machines in VMWare - and would like to mount a drive from machine_1 on machine_2. Is it possible if I can ssh from one machine to another?


title: How to know what to enable in the kernel?

text: I'm a gentoo user. When compiling the kernel there are a lot of options which one may enable depending on one's hardware. My question is how to know what to enable/disable, I'm aware of the hardware I'm using (processor instruction set, number of cores, etc./ motherboard NB and SB/sata drives, etc.) but still don't have a clear idea what to do when choosing options in the kernel setup script. I've had weird issues because of this (solved after some help from #gentoo). Can someone give me some references on this topic? How do people learn to do this? P.S. Please don't tell me I should not be compiling the kernel, it's something I want to learn and also why not get some speed and better use of my hardware.


title: Preparing an initrd for qemu

text: I have compiled a bzImage but when I try to run it in qemu I get a kernel panic because I don't have an initrd file. So I create one by following the steps in this question but I cannot get it to work. What can I do?


title: How to get UUID for a USB drive?

text: I want to mount my USB to a mount point which holds the UUID name. But I don't know how to express this in a command line! Can someone help me how to do it? I have searched and found that I have to run:               blkid      then a command which searches for a USB flash or hard disk drive, then something like               blkid | tail -n 1 | cut -f4 -d' '      but `tail` is wrong because I don't know the number of USB I have! Is there a way to tell it to just get me the lines with USB type?


title: Implementing rollback in bash

text: I have a script that is composed of staged operations which work mostly in a start/stop/status manner. The issue I have is that when starting, each of the operations can fail and I need to do a safe rollback using the stop actions. How could I do this in bash? I was thinking of something like the following (which doesn't work):               operation1_start() {}     operation2_start() {}     operation1_stop() {}     operation2_stop() {}          operation1_start && rollback=operation1_stop;$rollback     test_validity || $($rollback)     operation2_start && rollback=operation2_stop;$rollback     test_validity || $($rollback)


title: How to implement package install suggestion on Debian?

text: I have noticed that while on Ubuntu, if I type the following:               mc      and it isnt installed, I get the message below:               The program 'mc' is currently not installed. You can install it by typing: sudo apt-get install mc      However in Debian, that is not available. It just gives a "-bash: /usr/bin/mc: No such file or directory" message. How can I implement the same functionality in bash command line on Debian? Yes, I know that if it is package suggestion that I want, I can simply do a regex search using _apt-cache search_. However I was hoping for the simpler suggestion immediately on typing the name of the program. As per discussions, the functionality is provided by the package **_command- not-found_**. However even after installing it, and also installing bash- completion package, this isnt available on the Debian bash shell.


title: Bind to execute command with last argument of previous command

text: I want to create a bind that executes `g++ !$` in the same way that the shell would interpret it if I just typed it. I tried:   * `bind '"\ee": "g++ !$"'`, but it doesn't execute command (just "pastes" it)   * `bind -x '"\ee": "g++ !$"'`, but it doesn't interpret the `!$` part correctly Any way to overcome it without using some custom shell scripts?


title: tunneling FON traffic via Tor

text: I would like to tunnel the traffic of my FON router through Tor. For that I added a second network card to a local server and connected the FON router to it. Then I set up a DHCP server and configured the Tor service. That all works. Now comes the part which doesn't work: I configured a couple of iptables rules to redirect the FON traffic via the normal internet connection and the FON-client traffic through Tor. This somewhat works: the FON router can register itself at FON but somehow after a while fon says the router is offline. The iptables rules are:                   # 192.168.69.0/24 -> fon lan          # destinations not routed through Tor     NON_TOR="192.168.0.0/16 172.29.0.0/24"          # TOR user     TOR_UID="117"          # Tor's TransPort     TRANS_PORT="9040"          # interface to tor router     INT_IF="eth2"     # interface to internet     EXT_IF="eth0"          iptables -F     iptables -t nat -F          iptables -t nat -A POSTROUTING -o $EXT_IF -j MASQUERADE     # radius     for i in 160 161 162 163     do         iptables -A INPUT -i $INT_IF -p udp --destination-port 1812:1813 -j ACCEPT         iptables -A FORWARD -i eth2 -o $EXT_IF -p udp -s 192.168.69.0/24 --destination-port 1812:1813 -d 213.134.45.$i -j ACCEPT         iptables -A OUTPUT -p udp -s 192.168.69.0/24 --destination-port 1812:1813 -d 213.134.45.$i -j ACCEPT         iptables -A INPUT -i $INT_IF -p tcp --destination-port 1812:1813 -j ACCEPT         iptables -A FORWARD -i eth2 -o $EXT_IF -p tcp -s 192.168.69.0/24 --destination-port 1812:1813 -d 213.134.45.$i -j ACCEPT         iptables -A OUTPUT -p tcp -s 192.168.69.0/24 --destination-port 1812:1813 -d 213.134.45.$i -j ACCEPT         iptables -A INPUT -i $INT_IF -p udp --destination-port 1812:1813 -j ACCEPT     done     # 1938     iptables -A INPUT -i $INT_IF -p tcp --destination-port 1938 -j ACCEPT     iptables -A FORWARD -i eth2 -o $EXT_IF -p tcp -s 192.168.69.0/24 --destination-port 1938 -d 213.134.45.190 -j ACCEPT     iptables -A OUTPUT -p tcp -s 192.168.69.0/24 --destination-port 1938 -d 213.134.45.190 -j ACCEPT     # 53     iptables -A INPUT -i $INT_IF -p udp --destination-port 53 -j ACCEPT     iptables -A FORWARD -i eth2 -o $EXT_IF -p udp -s 192.168.69.0/24 --destination-port 53 -d 213.134.45.190 -j ACCEPT     iptables -A OUTPUT -p udp -s 192.168.69.0/24 --destination-port 53 -d 213.134.45.190 -j ACCEPT     # 1937     iptables -A INPUT -i $INT_IF -p tcp --destination-port 1937 -j ACCEPT     iptables -A FORWARD -i eth2 -o $EXT_IF -p tcp -s 192.168.69.0/24 --destination-port 1937 -d 213.134.45.191 -j ACCEPT     iptables -A OUTPUT -p tcp -s 192.168.69.0/24 --destination-port 1937 -d 213.134.45.191 -j ACCEPT     # 123     iptables -A INPUT -i $INT_IF -p udp --destination-port 123 -j ACCEPT     iptables -A FORWARD -i eth2 -o $EXT_IF -p udp -s 192.168.69.0/24 --destination-port 123 -j ACCEPT     iptables -A OUTPUT -p udp -s 192.168.69.0/24 --destination-port 123 -j ACCEPT          iptables -A FORWARD -i eth2 -o $EXT_IF -d 192.168.0.0/16 -j REJECT     iptables -A FORWARD -i eth2 -o $EXT_IF -p udp -d 0.0.0.0/0 -j REJECT     iptables -t nat -A OUTPUT -o lo -j RETURN     iptables -t nat -A OUTPUT -m owner --uid-owner $TOR_UID -j RETURN     for NET in $NON_TOR; do       iptables -t nat -A OUTPUT -d $NET -j RETURN       iptables -t nat -A PREROUTING -i $INT_IF -d $NET -j RETURN     done     iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 53     iptables -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT          iptables -t nat -A PREROUTING -i $INT_IF -p udp --dport 53 -j REDIRECT --to-ports 53     iptables -t nat -A PREROUTING -i $INT_IF -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT          iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT     for NET in $NON_TOR 127.0.0.0/8; do       iptables -A OUTPUT -d $NET -j ACCEPT     done     iptables -A OUTPUT -m owner --uid-owner $TOR_UID -j ACCEPT     iptables -A OUTPUT -j REJECT


title: Bash Command (History) Number In PS1

text: I am a noob in bash to be honest. I have Googled around and cannot find an answer to this: `history` lists previous commands and their number e.g.               $ history     286 clear      I want to be able to see the command number as I type a new command, instead of having to type `history` Essentially: `[ username ubuntu ~ ] $` becomes `[ username ubuntu ~ ] 286 $` Does anyone know how to achieve this in .bashrc, .bash_profile, .profile etc..?


title: Getting pid of bash script from itself

text: I have a bash script with doing lot of things called `script.sh`:               #!/bin/bash     #It     #Is     #Doing     #Things      Is there a way that I be able to get the proccess of script and then kill it after 5 minutes? Like:               #!/bin/bash     #Now here give pid of script.sh then kill it after 5 minutes     #It     #Is     #Doing     #Things      # update Imagin I have this script:               #!/bin/bash     while :     do           echo "line printed"     done      If we use these answers it doesn't show the output... I want out put be printed and after 5 minutes `cntrl + c` signal kill the process of bash... Is this good idea?               PID=$$     kill -SIGINT $PID      Where should be put?


title: Is there a faster way to remove a line (given a line number) from a file?

text: A related question is here. I often have to edit a large file by removing a few lines from the middle of it. I know which lines I wish to remove and I typically do the following:               sed "linenum1,linenum2 d" input.txt > input.temp      or in-line by adding the -i option. Since I know the line numbers, is there a command to avoid stream-editing and just remove the particular lines? input.txt can be as large as 50 GB.


title: Can anyone help me finding a simple *nix distro that can run Wine

text: I am looking a distro of either Linux or Unix, that is so very limited that I don't even need a desktop or any applications, it's only use would be to run wine. I actually would prefer it didn't have a desktop but I am not sure if it would be possible to run windows applications in wine without it? I am looking for as light weight as possible, and small as possible but has the ability to run Wine and the windows applications that Wine runs. I know it seems like a weird request but I am a hobbyist building a gadget that runs windows applications. I have seen some small distros but I havent found official wine releases for them so I am not sure if they would run it properly. Is it possible to run windows apps from wine without a desktop and just a command line Distro? I spent hours lastnight trying to find something suitable to no avail, I am very unfamiliar with the *nix world though.


title: grub2: how to bypass "press any key"?

text: I recently updated my motherboard and moved my grub2 onto EFI partition. I have same grub menu, but after I select a menu entry and press Enter, a message "Press any key" comes and the loading stops until I press any key. Is there any way to just tell grub2 to ignore any errors and do not block loading of an operating system?


title: Not able to create a custom Tiny Core Linux ISO image

text: I'm trying to create a custom version of Tiny Core Linux. I extracted the ISO image, added the required tcz files, and made a new ISO, but VMWare Virtual Machine was not able to boot from it. So I just extracted the ISO, recreated it without any changes, and it still didn't get detected by the VM. What am I doing wrong?


title: Not mounting after restart?

text: I am mounting a drive via SSH, and then editing the fstab to reflect the changes, however after I reboot, the drive doesnt mount? I dont understand what I'm doing wrong? This is my fstab and its /md0 that isnt mounting after reboot, am I missing something?               # <file system> <mount point>   <type>  <options>   <dump>  <pass>     /dev/md4    /   ext3    errors=remount-ro,usrjquota=quota.user,jqfmt=vfsv0  0   1     /dev/md0    /BACKUP ext3    defaults    0   1     /dev/md1    /boot   ext3    errors=remount-ro   0   1     /dev/md2    /var/tmp    ext3    usrjquota=quota.user,jqfmt=vfsv0    1   2     /dev/sda3   swap    swap    defaults    0   0     /dev/sdb3   swap    swap    defaults    0   0     proc        /proc   proc    defaults        0   0     sysfs       /sys    sysfs   defaults        0   0     tmpfs       /dev/shm    tmpfs   defaults    0   0     devpts      /dev/pts    devpts  defaults    0   0


title: Monitoring Disk Latency

text: We have quite a few physical machines in our environment, yet we have no trending data over a period of time for disk latency statistics. We can easily run the standard iostat commands to see what the latency is at any particular point in time. But there is no historical data that we can pull from easily. Are there any recommended tools to monitor disk latency other than screen scraping the output of iostat in a script? We have IOPs graphs, but those are generally not overly useful unless we have latency statistics paired with them. We have MRTG available currently for trending, and can use Nagios for alerting of a particular threshold being exceeded. We're generally using RHEL systems on Dell platforms. So if there are any specific easy-to-use tools provided by these providers that I'm unaware of, pointing those out would be beneficial as well.


title: Why can I not see some files in my USB stick on Windows that I can see on Linux?

text: I'm having a little problem with my USB stick. There are files and folders on the USB stick I can see and manipulate on my Linux machine (Fedora 20) but some of those files and folders appear nowhere when use the USB stick on a Windows machine. Moreover, according to Windows the USB stick has got almost 2.9 GB of files stored on it, but the files I can use amount to just 500+ MB. I don't know why this happens, but it's not the first time. What can I do to solve this problem permanently?


title: dot file not sourced when running a command via ssh

text: When I run my program interactively, it works fine:               ssh somehost     $ ~/some/path/somescript.py      When I run my program over ssh directly, it doesn't work. The variable `PYTHONPATH` is not set, because `.bashrc` is not sourced.               ssh somehost ~/some/path/somescript.py      If I run `ssh somehost 'source ~/.bashrc; ~/some/path/somescript.py'`, it works fine. But the latter wouldn't work for some other folks, e.g. using tcsh and not having a `~/.bashrc` at all). What is _the_ command to run a thing via ssh on another host that works for all shells?


title: SQLPLUS withing shell script loops

text: Hello I am trying to run a loop and get the details of a project. I have these projects in my work space. How do I loop over the SQL code?               #!/bin/bash                   workspace=$(sudo locate -r '/workspace$')         cd $workspace         echo "" > ~/Desktop/workspace.txt         for projectName in `ls -d *`;         do             echo $projectName >> ~/Desktop/workspace.txt         done              cat workspace.txt | while read Name         sqlplus $1/$2 <<ENDOFSQL > ~/Desktop/$Name.txt         DESC PROJECTS;         SELECT ID_NAME, VALUE FROM PROJECTS WHERE ID_NAME='%${Name}%';         exit;         ENDOFSQL              echo "Testing"      When I run it, I get the error               ./sql_parameters.sh: line 24: syntax error: unexpected end of file


title: Mouse detected as keyboard

text: I have tried to use my mouse (perixx mx-2000) on Fedora 18 and Crunchbang 11, and for both of them, the mouse does not work. The "funny" thing is that the mouse seems to be detected as a keyboard:               $ xinput     Holtek USB Gaming Mouse    id=15 [slave keyboard (3)]      I would like to know if there is a way to correct that kind of bug. If there is not, does can an adapter usb/mouse do the trick?


title: List all files in a directory recursively but exclude directories themselves

text: Simple question, I'm running the following find command:               find . -type d \( -path ./.git -o -path ./log -o -path ./public -o -path ./tmp \) -prune -o -print      To list all the files in my directory, excluding the specified directories. This works great, however, what I want to also do is exclude any actual directories from the output, so if there is a directory structure as follows:               test       -- foo.text       -- bar.text      when I run my command I'd like to see:               ./test/foo.text     ./test/bar.text      instead of:               .     ./test     ./test/foo.text     ./test/bar.text      Can anybody help?


title: `echo test?` prints `test2` but `ls test?` prints nothing

text: I was playing with bash globbing recently and I noticed the following: First, make 2 dirs:               $ mkdir test     $ mkdir test2      Then:               $ echo test?      Outputs (correctly):               test2      But:               $ ls test?      Outputs nothing ... But, if you make one more directory (test3), `echo` and `ls` work as supposed. Does anyone has any idea why this happens?


title: Effect if any of changing LD_LIBRARY_PATH environnment variable on emacs fonts?

text: The rendering of my emacs fonts changes if I define a specific list of directories under the LD_LIBRARY_PATH environment variable just before I call emacs. I changed this because I wanted to use emacs to debug a specific program that requires some of the libraries in the path, but I wasn't expecting the emacs fonts to change. What could be causing this effect on my emacs fonts? I get this warning:               emacs: /somewhere/libpng12.so.0: no version information available (required by emacs)


title: Connect to Webdav (https) with domain\user

text: I have a problem trying to connect with our network webdav share on mac osx. I can connect from windows, so it's working. On Mac OSX I have set the routes, and I can connect when using "Transmit" but not with "Mac Finder" or any other webdav client for mac so it's not a network or login problem, but a problem with the applications. I tried Mac Finder, Cyberduck, AnyClient and lot's of webdav clients from sourceforge. I could buy Transmit, but we have a lot of users and 34$ per license is a lot of money, if you only want to connect to webdav with it. Facts:               - Two company networks, each with it's own MS ActiveDirectory infrastructure     - Webdav is in network A, I have an Account for network A     - My Macbook is in network B, and the routes are set. (as said, works with Transmit)     - I don't have administrative access to the webdav server, so changing settings is not an option :(      Since I'm in a different network as the webdav server I need to specify the domain on logon, so login on transmit looks like this:               Protocol: https     Port: 443     Server: 192.168.0.3     Path: webdav_transfer     user: domainA\username (otherwise, the macbook would set domainB as default)      As said, this works on Transmit, but not on any of the other clients. I think it's a problem with the domainA\username part. Somehow transmit can use it, while the others can't. It's also working in Safari, but I can't upload from there. I already tried the following in mac finder:               https://domainA\username@192.168.0.3/webdav_transfer     https://username@192.168.0.3/webdav_transfer     https://domainA\\username@192.168.0.3/webdav_transfer     https://domainA\\\\username@192.168.0.3/webdav_transfer     https://domainA:username:password@192.168.0.3/webdav_transfer      I found out that some apps change the URL to               https://domainA%5Cusername@192.168.0.3/webdav_transfer      So the \ changes to %5C It's probably just a format error, but I don't know how I can get the domainA part properly into my https request. EDIT: New information: I tried mounting the webdav share with mount_webdav, which didn't work either - no error message, but the share isn't mounted either. I think (have no proove), that the problem with mount_webdav (and therefore Mac Finder) that it lacks proper ssl support. Through port I installed cadaver, a Unix webdav command line client (sudo port install cadaver). With cadaver I'm able to connect to the webdav share and download/upload stuff. Unfortunately, even though everything works for me now, this is no possible solutions for our maclings (they want a GUI). I'll keep looking.


title: How to remove Notepad from the applications list?

text: After installing Wine, Notepad has became a default application to open unknown textual files by double click. I'd like to eliminate this behaviour and remove Notepad from the list of applications offered to open an unknown type file. I've deleted `/usr/share/applications/wine-notepad.desktop`, but this didn't help. How can I disable Notepad correctly? I use XUbuntu 11.10 (XFCE 4.8) and Wine 1.3.


title: Routing through iptables

text: I have this vpn client that touches the routing table and then keeps watching it to exit if it gets touched.   It is the kind of setup needed for an endpoint, such as a laptop. I want to use a small pc as vpn endpoint and route through it for other machines on my LAN(192.168.0.0/24).   As I can't touch the routing table and all the packets are forced through the vpns tun0 device, I was thinking iptables could help me POSTROUTEing packets to the 192.168.0.0 network back to the eth1 device.   I am not sure though, how would this work, because once it exits eth1 it should resolve the IPtoMAC because it is already on the destination network, and I don't know if the packet has already that resolved or won't happen till it reaches the iface.   Any hints?


title: Which software supports DoD 5220-22-M 7 pass standard for SLES 10.4?

text: "DoD 5220-22-M 7 pass standard" is a secure deletion method. But what software supports it for a SLES 10.4 64bit?


title: How to read the file line by line and to print the previous line where the file contains a single token

text: For example my file is like:               59 6 18 2014 169 7 14 2 7671912 7849744 201 4     60 6 19 2014 170 5 49 2 7671912 7849744 201 5     61 6 20 2014 171 6 8 2 7671912 7849744 201 6     62 6 23 2014 174 5 3 2 7671912 7849744 201 7     63 6 23 2014 174 7 17 2 7671912 7849744 201 8     64 6 24 2014 175 16 13 2 7671912 7849744 201 9     65 6 25 2014 176 8 20 2 7671912 7849744 201 10     10     1 1 49 6 16 2014 7 39 201 1 0 1043 <au_launchpad_back.gif> 201 gif <SIZE> 871     1 2 49 6 17 2014 13 15 201 1 0 1043 <au_launchpad_back.gif> 201 gif <SIZE> 871     1 3 49 6 18 2014 1 38 201 1 0 1043 <au_launchpad_back.gif> 201 gif <SIZE> 871     1 4 49 6 18 2014 7 14 201 1 0 1043 <au_launchpad_back.gif> 201 gif <SIZE> 871     1 5 49 6 19 2014 5 49 201 1 0 1043 <au_launchpad_back.gif> 201 gif <SIZE> 871      I need to print the previous line of single token entry "10" which should be               65 6 25 2014 176 8 20 2 7671912 7849744 201 10      How can I do this?


title: Migrating from Funtoo to Gentoo on a running system

text: I have a Funtoo system now, but want to migrate (back) to Gentoo. If possible keeping a usable system during the installation (not rebuilding from scratch using a live CD). Both systems should be `~amd64`. I found an old description of someone who did it the other way round. To me it sounds as if the steps are:   1. Replace `/usr/portage/` with a gentoo portage snapshot.   2. Regenerate the manifest of portage's ebuild.   3. Reemerge portage and do `emerge --sync`   4. Rebuild system (`emerge -e @system`).   5. Rebuild the rest where necessary (`emerge -uND @world`) Do I miss anything? What about the profiles? Are there possible incompatibilities in the init scripts (e.g. network interfaces and configuration)? Should I expect problems from UEFI during boot (using grub)? Are there differences in genkernel?


title: How to free space taken by rdiff-backup data?

text: I use rdiff-backup for my backups. My disk runs out of space. I would like to clean some rdiff-backup data by removing either:   * the backup data of small files with a large number of different versions   * the backup data of very large files which have been deleted In order to free space, how to identify those files?


title: Output file from Archive

text: Given that I have this archive `my_archive.tar.gz` which has this file in it: `README`. How can I output the content of `README` without having to extract the archive? OS: Debian 7


title: Shell attempts to interpret Perl script in spite of correct shebang

text: I have looked through the forums and I can't seem to find how to fix this. I have a very simple perl code that works fine on Windows, but when I try it on Linux and Solaris I get the following errors:               bash: ./test.pl: line 2: syntax error near unexpected token `('     bash: ./test.pl: line 2: `print '$_\n' for @Config{qw(myuname osname osvers)};'      This is my code:               #!/usr/bin/perl     use Config;     use strict;     print '$_\n' for @Config{qw(myuname osname osvers)};      Any thoughts on how I can get around this?


title: CUPS Color & Black and White

text: Yesterday I set up CUPS to turn a USB printer into a network printer. All of the print jobs are being sent to the server from windows and it's working great except for one problem. When I set the color option in Windows, it prints in color. When I set it to black and white in Windows, it still prints in color. When I modify the settings for the printer in CUPS I can set the Color Mode: to either Color or Monochrome. How can it simply get the color mode dynamically from windows?


title: Is there any way I can use notebook's touchpad as a pressure-aware pointer in a paint program?

text: I have a notebook (ASUS N56VZ) with multitouch touchpad. Apparently my touchpad supports pressure levels (in Xorg.0.log I have line `synaptics: ETPS/2 Elantech Touchpad: pressure range 0 - 255`) It would great, If I could use the pressure information in paint programs and use it as a poor-man's tablet. Is it possible at all? If so, what paint programs are supported?


title: Linux multi-user system: Each user's home partition on its own Hard Drive

text: I've got a pogoplug running Arch Linux that I'm using for a NAS with `rsync` backing up my data over SSH. Right now, I'm the only one using it, but I'd like to add my roommate as well. She has her own external hard drive on which to store her backup data. Would it be strange to mount `/home/my-user/` on the hard drive I currently have my data backing up to, and `/home/roommate-user/` on her hard drive? Or is there a more sensible way to do it? What's the best practice here?


title: Automount of NTFS USB partitions on Gnome fails if device name is sdb (FAT32 is OK)

text: When I plug a USB storage device (i.e. USB key) on my computer with Gnome, the filesystems available on the device are automatically mounted (in `/media/<partition-label>`), and a file explorer (`nautilus`) popup appears showing the device content. However, **this automounting does not work with NTFS filesystems**. On various forums, people suggest to set ntfs-3g SUID root :               # chmod u+s /usr/bin/ntfs-3g      This does not solve the problem, here is the popup message:               Error mounting: mount exited with exit code 1: helper failed with:     Error opening '/dev/sdb2': Permission denied     Failed to mount '/dev/sdb2': Permission denied     Please check '/dev/sdb2' and the ntfs-3g binary permissions,     and the mounting user ID. More explanation is provided at     http://ntfs-3g.org/support.html#unprivileged [=> DEAD LINK]      However, since I have all necessary rights (I'm on the "floppy" group which has _read/write_ permission on `/dev/sdb1`), I can mount the filesystem myself:               $ ntfs-3g /dev/sdb1 /home/me/mymount      How can I achieve this automounting with NTFS filesystems? Avoiding, if possible, changing `/etc/fstab`. I'm currently using Debian 6.0 (Squeeze). EDIT: Also, I just noticed a strange behavior: when there is already a `sdbX` mounted filesystem, I plug my NTFS USB device (as `sdc`...), and everything works as expected, automount works. But not if the device name is `sdb`...


title: Connecting to wireless USB adapter - Puppy Linux Wary

text: Trying to connect to my WLAN on an Acer Travelmate 2301LM. System installed is a Puppy Linux Wary 5.3. Since it doesn't have an internal adapter I'm trying to integrate a Netgear N300 WLAN-USB-Mini-Adaptor - precisely a WNA3100M. The Puppy Internet Connection Wizard doesn't list the wireless device. If I plug it into my Ubuntu desktop and run lsusb it reads               [..]     Bus 001 Device 007: ID 0846:9021 NetGear, Inc.       lsusb -v reveals               Bus 001 Device 007: ID 0846:9021 NetGear, Inc.      Device Descriptor:       bLength                18       bDescriptorType         1       bcdUSB               2.00       bDeviceClass            0 (Defined at Interface level)       bDeviceSubClass         0        bDeviceProtocol         0        bMaxPacketSize0        64       idVendor           0x0846 NetGear, Inc.       idProduct          0x9021        bcdDevice            2.00       iManufacturer           1        iProduct                2        iSerial                 3        bNumConfigurations      1       Configuration Descriptor:         bLength                 9         bDescriptorType         2         wTotalLength           46         bNumInterfaces          1         bConfigurationValue     1         iConfiguration          0          bmAttributes         0x80           (Bus Powered)         MaxPower              500mA         Interface Descriptor:           bLength                 9           bDescriptorType         4           bInterfaceNumber        0           bAlternateSetting       0           bNumEndpoints           4           bInterfaceClass       255 Vendor Specific Class           bInterfaceSubClass    255 Vendor Specific Subclass           bInterfaceProtocol    255 Vendor Specific Protocol           iInterface              0            Endpoint Descriptor:             bLength                 7             bDescriptorType         5             bEndpointAddress     0x81  EP 1 IN             bmAttributes            2               Transfer Type            Bulk               Synch Type               None               Usage Type               Data             wMaxPacketSize     0x0200  1x 512 bytes             bInterval               0           Endpoint Descriptor:             bLength                 7             bDescriptorType         5             bEndpointAddress     0x02  EP 2 OUT             bmAttributes            2               Transfer Type            Bulk               Synch Type               None               Usage Type               Data             wMaxPacketSize     0x0200  1x 512 bytes             bInterval               0           Endpoint Descriptor:             bLength                 7             bDescriptorType         5             bEndpointAddress     0x03  EP 3 OUT             bmAttributes            2               Transfer Type            Bulk               Synch Type               None               Usage Type               Data             wMaxPacketSize     0x0200  1x 512 bytes             bInterval               0           Endpoint Descriptor:             bLength                 7             bDescriptorType         5             bEndpointAddress     0x84  EP 4 IN             bmAttributes            3               Transfer Type            Interrupt               Synch Type               None               Usage Type               Data             wMaxPacketSize     0x0040  1x 64 bytes             bInterval               1      How can I get it to connect?


title: Installed Fedora 18 on UEFI machine, got lvm.mod not found error

text: I've installed Fedora 18 on UEFI system, when I boot the computer I get this error message:               File "/EFI/fedora/x86_64-efi/lvm.mod" not found     no server specified      What should I do?


title: Debian not reachable via its hostname in LAN

text: My debian is not discoverable via its hostname in my LAN. I have a couple of other ubuntu machines in the LAN and they are all pingable via their hostnames. on my debian:               pi@raspberrypi ~ $ hostname     raspberrypi      on another machine in the same LAN:               ping raspberrypi     ping: unknown host raspberrypi


title: Multiple ssh sessions in single command

text: I'm trying to copy a database from one server to another. I tried using the following command and it's getting tied up on entering the ssh passwords. If I put in one server's password, it complains about the other and vice versa. `ssh root@server1 mysqldump --databases db | ssh root@server2 mysql` I managed to do the transfer by holding the dumps temporarily on my computer, just wondering if there is a way to get this to work.


title: Git-SVN Not Allowing Me to Authenticate

text: Git 1.7.9.1 on Arch Linux:               git svn init -s https://app.svn.beanstalk.com/repo     Initialized empty Git repository in /path/to/repo/.git/     Authentication realm: <https://app.svn.beanstalk.com/repo:443> SVN         Password for 'localuser':     Authentication realm: <https://app.svn.beanstalk.com/repo:443> SVN     Username: remoteuser     Password for 'remoteuser':     Authentication realm: <https://app.svn.beanstalk.com/repo:443> SVN     Username:      No matter how many times I enter my details, it never accepts them. I have logged in successfully with the same credentials in a web browser. I have also tried this without the `-s`, and with the `\--no-minimize-url` flags. What's going on?


title: How do I equally balance tmux(1) split panes?

text: I'm looking for a behavior that is similar to how vim(1) handles its split windows with `^w =`. I know tmux(1) has predefined layouts with `^b Meta[1-5]`, but this likely does not have the layout that I am currently using. When splitting a window, it halves the current window for both panes. Split again, and it halves that pane into two new. Combine vertical and horizontal splits, and they continue to halve each other, each new pane getting smaller and smaller. How can I keep the new layout I've just created, but have all vertical and horizontal splits equally balanced, like vim(1) does with `^w =`?


title: user disappeared during update error

text: I did a upgrade to FreeBSD 9 a few weeks ago and just started using it, and when I try and create a new user, I get the follow:               pw: user 'todd' disappeared during update     adduser: ERROR: There was an error adding user (todd).      I first noticed this issue when trying to install postfix and got a similar error. Anyone know what this is or how to fix it without a complete re-install? Some people have suggested shutting down the nscd daemon, but that doesn't fix the problem.


title: Help with a php web program running a shell script?

text: I'm a sys admin as well as web developer at my job. I have a php program that prompts the user for a number of parameters which then using those parameters must execute a batch shell script. I've got this functioning using:               $cmd =  "echo \"podcast -c $TCname\" | at $_stimehr:$_stimemn $_sdate";          exec("$cmd", $_RetVal);      This gets queued and even runs. But I believe I have a permissions issue that I can't seem to conquer. My apache2 runs as user www-data and I've made sure that the shell script is executable by everyone and also my working directory tree currently set to 777 (temporarily until I figure this out). And it still starts then fails without any error messages and I've got logging on to the wazoo! No errors. It appears to stop when trying to change directories. Hopefully some other *nix guru who may have run into this before will have a simple answer as I've be struggling and doing trial and error for a couple of months on and off now.


title: Why does dd from /dev/random give different file sizes?

text: I am running the following command on an ubuntu system:               dd if=/dev/random of=rand bs=1K count=2      However, every time I run it, I end up with a file of a different size. Why is this? How can I generate a file of a given size filled with random data?


title: SPEC %files attribute and Shell variables

text: I have a spec file which unpacks a library which is deployed at location which is exported in the shell. ie               %file     ${AXIS2_C}/bin/services/services.xml      This fails with :               error: File not found: root/rpmbuild/BUILDROOT/i386/${AXIS2_C}/bin/services/services.xml      I.e the shell variable does not get expanded. Is there any way around this ? Thanks!


title: udev rules don't appear to be working

text: I'm running Arch Linux on my server, and I need to let users of the group **usb** access my weather station. Here's my rule: /etc/udev/rules.d/usb-70.rules               SYSFS {idVendor} == "1941", SYSFS {idProduct} == "8021", MODE = "0666", GROUP = "usb"      Users in the usb group still can't see the device (permission denied). The Vendor and Product ID is confirmed correct, and I've rebooted 50 million times to no avail. Anyone have any ideas?


title: Read and parse XML input via TCP

text: I'm setting up something where I'll need to be able to setup a service that accepts input on a TCP port and then parses the XML provided and extracts the necessary data, then posts that to Google's universal analytics via HTTP GET. What is the easiest thing to use for this? Perl? C? Are there any libraries that you know of for those languages that would make this easier? A little bit of background: I'm trying to export data from a POS which has a "Security DVR" output option for basic transaction info (X item added to invoice, $50 cash was paid, etc). I'm outputting this info to this server that I'd need to setup, and then exporting that to Universal analytics. This will allow me to see sales volumes in google analytics.


title: Renaming files based on the contents of a text file

text: I have lots of point files I need to change for model input. I want to rename lots of these files based on the contents of a file. These files are text files arranged in rows. file name: `data_lat_long.txt`               1 data_20_20     2 data_30_40     3 data_50_60     .     .      and so on my files are named `1`, `2`, `3`, `4`, etc,. I want `1` to be changed in to `data_20_20`, `2` in to `data_30_40` and so on.


title: How can I get gmake to give me a list of all included makefiles?

text: I've inherited a major mess of a makefile network that was itself inherited from another project, with makefiles included all over the place. I'm trying to make a simple change without gutting the whole thing (tempting though that is, I just don't have the time right now). Is there any way to coax a full makefile out of gmake, _i.e._ , with all the included files already included? I know how to get the database dumped, but that's just about as hard to follow with all the extraneous junk that gets loaded in.


title: Can a domain be configured to only have secondary DNS nameserver records?

text: I'm asking if someone can verify if my DNS hosting idea is possible or has any flaws. We would host our own primary DNS server for all zones and configure it to allow zone transfers to a set of IPs which will host the same data as secondary dns. At my registrar for each domain, I'd like to set the NS records to only point at the secondary DNS servers because we don't want folks to rely on our primary server being available at all times. Assuming the zone transfers have completed for the secondary nameservers already, will this plan work even though the primary DNS server is not listed in the zone for every domain?


title: Mint login screen: wrong keyboard layout

text: After installing Mint 15 / updating to Mint 17, i'm unable to login using the gui login screen and german localisation with a password containing special characters. Changing the language using the language selector doesn't help. It seems to be an issue regarding the window manager (`mdm`), since i'm able to login using a text console (e.g. using `ALT`+`CTRL`+`F1`). Adapting the file `/etc/default/keyboard` (as proposed on launchpad) or reconfiguring the keyboard configuration didn't change anything.


title: Fedora: How to unlock fedora printers and add printer through command line?

text: I'm using a laptop which is with limited root privilege. The system is                [kit@gand wgong]$ uname -r       3.10.10-100.fc18.x86_64      I want to use a networked printer in my lab. But I can't find the printer in my printer setting interface. I notice there is a `Printers` interactive window where there is `add printer` option, however, I need to unlock it with root password, but I don't have. I can only use the limited root privilege through command line. So are there anyways to unlock the `printers` and add printers through command line?


title: Memory consumption of a script

text: Is there way to check the memory (physical & virtual) consumption of a script, of course in the moment of its execution. Calculating the used memory minus the used memory before and after the execution is not a good solution I think.


title: Problem with installing mcsima+

text: I am trying to install mcsima+, but I am facing an issue over step 5 which requires me to compile the program. The instruction I ran for step 5 is, ` 5\. Compile a test program 'stream' \- cd /home/scale/McSim/stream \- make ` Running the instruction gave me this error, `cannot find -lm` The terminal in the figure below shows more details of the error, ![A screenshot with the details of the error.](http://i.stack.imgur.com/WoG5x.png)


title: Changing letterSpacing dynamically in urxvt

text: My URxvt configuration includes dynamic font settings for each F-key. With XFT fonts, I'm getting a very wide letter-spacing. I do not want to use the `letterSpacing` setting because my other font settings are not XFT, so spacing is fine. I toggle between fonts regularly with my F-keys. Is there a way to **dynamically** set the `letterSpacing` setting in urxvt?


title: bash: is it safe to eval $BASH_COMMAND?

text: I am working on a shell script that constructs a complex command from variables, e.g. like this (with a technique that I've learned from the Bash FAQ):               #!/bin/bash          SOME_ARG="abc"     ANOTHER_ARG="def"          some_complex_command \       ${SOME_ARG:+--do-something "$SOME_ARG"} \       ${ANOTHER_ARG:+--with "$ANOTHER_ARG"}      This script dynamically adds the parameters `\--do-something "$SOME_ARG"` and `\--with "$ANOTHER_ARG"` to `some_complex_command` if these variables are defined. So far this is working fine. But now I also want to be able to print or log the command when I'm running it, for example when my script is run in a debug mode. So when my script runs `some_complex_command --do-something abc --with def`, I also want to have this command inside a variable so I can e.g. log it to the syslog. The Bash FAQ demonstrates a technique to use the `DEBUG` trap and the `$BASH_COMMAND` variable (for example for debugging purposes) for this purpose. I've tried that with the following code:               #!/bin/bash          ARG="test string"          trap 'COMMAND="$BASH_COMMAND"; trap - DEBUG' DEBUG     echo "$ARG"          echo "Command was: ${COMMAND}"      This works, but it doesn't expand the variables in the command:               host ~ # ./test.sh     test string     Command was: echo "$ARG"      I guess I have to use eval to expand `echo "$ARG"` to `echo test string` (at least I haven't found a way without `eval` yet). The following does work:               eval echo "Command was: ${COMMAND}"      It produces the following output:               host ~ # ./test.sh     test string     Command was: echo "$ARG"     Command was: echo test string      But I'm not really certain if I can use `eval` safely like this. I've unsuccessfully tried to exploit some things:               #!/bin/bash          ARG="test string; touch /x"     DANGER='$(touch /y; cat /etc/shadow)'          trap 'COMMAND="$BASH_COMMAND"; trap - DEBUG' DEBUG     echo "$ARG" $DANGER          echo "Command was: ${COMMAND}"     eval echo "Command was: ${COMMAND}"      It seems to handle this well, but I'm curious if someone else sees an issue that I've missed.


title: inittab '-' character in process field

text: I have a an `inittab` file with the following entry:               console::askfirst:-/bin/ash      According to this Man page a '+' character in the process field means > **init** will not do utmp and wtmp accounting for that process. However, it does not say anything about a '-' character. What does having the '-' character in the process field do?


title: Can't ifdown eth0 (main interface)

text: I can't ifdown an interface on a Debian 6.0.5 box;               user@box:/etc/network$ sudo ifdown eth0 && sudo ifup eth0     ifdown: interface eth0 not configured     SIOCADDRT: File exists     Failed to bring up eth0.          user@box:/etc/network$ cat interfaces      auto lo     iface lo inet loopback          allow-hotplug eth0      allow-hotplug eth1           auto eth0     iface eth0 inet static     address 10.0.0.1     netmask 255.255.255.0     gateway 10.0.0.254          auto eth1     iface eth1 inet manual      I'm stumped. Any help would be greatly appreciated. Thank you. **UPDATE** As requested by marco;               user@box:/etc/network/$ cat run/ifstate      lo=lo     eth1=eth1


title: Help with unzipping a .dd.gz, possibly corrupted

text: I recieved this file that I was told was a copy of a hard drive (or disk). The file is "sheeva-mem.dd.gz". I tried to unzip the file in a linux Fedora machine. This yielded "unexpected end of file". Someone told me to mount the file to a partition within the linux machine, and then I would be able to view the information within the file. I assume the file has to be unzipped before this can happen? If that is the case, is there anyway around the "unexpected end of file" (maybe a repair, or something that ignores the errors)? This is the only copy of the file.


title: What is the relationship between a program's output, standard output, and its file descriptors?

text: Let's assume that I am running `wget` which is downloading something. It's printing some text to my terminal and writes the downloaded data into a file. From a terminology point of view, what is the difference between the downloaded file and the information appearing in the console? What does this depend on that we consider something as "standard output" instead of "output"? Who/What decides if some output is accessible via `/proc/self/fd/1` or by other means (file in the filesystem, window of a GUI program, etc.)?


title: detect if key is pressed from script

text: I would like to detect if a key is being pressed when running a script. I have the following script:               #!/bin/bash     sleep 0.5     xte 'str sometext'      I run this script using a shortcut to paste "sometext" where I'm at in kde. I used a sleep 0.5 here because the script itself is run with a shortcut that uses ctrl and alt. If the sleep 0.5 is omitted, the result is that ctrl+s, ctrl+o, etc... is sent. I think the solution would be to add some bussy wait at the beginning that would block untill no keys are being pressed. How can I get this to work in the script?


title: Shell scripting to divide numbers inside a file

text: I have a single column and 12 rows. Each row has numerical values. I want to divide each row values by some constant number (say C) using shell (bash) scripting. How to do this ? Thanks in advance..


title: Pattern match in Bash script to zero-pad file names

text: I want to zero-pad file names. I'm using this script from here.               #!/bin/bash     num=`expr match "$1" '[^0-9]*\([0-9]\+\).*'`     paddednum=`printf "%03d" $num`     echo ${1/$num/$paddednum}      This script output file name with zero-pad for former numbers:               $ zeropad "folder01/01.jpg"     folder001/01.jpg      But I want to zero-pad latter numbers like this:               $ zeropad "folder01/01.jpg"     folder01/001.jpg      How can I do it? And is there a web page that I can see a lot of examples of Bash pattern matches?


title: How to setup SVN server permissions properly?

text: I use Debian 7 and have Subversion installed. I can't figure out what permissions and owners to set to the repositories once I create them. I want to have 2 types of repositories: 1) `svn/private/*` - only one specified user can read&write 2) `svn/public/*` - only a specified user group can read&write here `*` means multiple repos there I want all users to be taken from the Linux system, not specified in passwd file or something. So how do I set the repositories permissions (talking about linux permissions) properly to achieve that? Also for the public repositories it should be possible for the authorized users to commit and this not to break the repos (because I had such a problem before). We are talking about svn+ssh access only. I have read lots of tutorials on the internet but none of them have what I need. Can you help me?


title: GNU MIX Development Kit build error

text: I am trying to compile the GNU MIX assembly development kit on Mac OS X 10.8.4. I've installed the dependencies through homebrew, and when I run `configure` in the mdk directory, I get a success message:               *** GNU MDK 1.2.7 has been successfully configured. ***          Type 'make' to build the following utilities:         - mixasm (MIX assembler)         - mixvm (MIX virtual machine)      But when I run `make`, It spits out this error:               ~/Downloads/mdk-1.2.7 > make     make  all-recursive     Making all in po     make[2]: Nothing to be done for `all'.     Making all in intl     make[2]: Nothing to be done for `all'.     Making all in doc     Making all in img     make[3]: Nothing to be done for `all'.     make[3]: Nothing to be done for `all-am'.     Making all in lib     rm -f libreplace.a     ar cru libreplace.a     ar: no archive members specified     usage:  ar -d [-TLsv] archive file ...       ar -m [-TLsv] archive file ...       ar -m [-abiTLsv] position archive file ...       ar -p [-TLsv] archive [file ...]       ar -q [-cTLsv] archive file ...       ar -r [-cuTLsv] archive file ...       ar -r [-abciuTLsv] position archive file ...       ar -t [-TLsv] archive [file ...]       ar -x [-ouTLsv] archive [file ...]     make[2]: *** [libreplace.a] Error 1     make[1]: *** [all-recursive] Error 1     make: *** [all] Error 2      It looks like `ar` is failing, although I don't know why. How can I debug this further?


title: Merging columns from two separate files

text: How to create a new file merging selective columns from two separate files using awk? Without messing up the elements orders of BOTH files. Exemple: File 3 may contain column 1,2,3 from File 1 and column 4 from File 2.               File 1     A   23  8   T     A   63  9   9     B   45  3   J          File 2     A   0     A   6        B   5          File 3     A   23  8   0     A   63  9   6     B   45  3   5


title: Grsecurity Policy Generation - role_allow_ip 127.0.0.6

text: the Grsecurity policy generation from a learning log file frequently yields role definitions with role attributes like               role_allow_ip 127.0.0.6      when in fact I have logged in via IPv6. Since Grsecurity does not yet support IPv6 addressing - is this the way how a policy can express this?


title: I want to learn Linux and UNIX, from where and what should I start?

text: please advise that how can I learn Linux and UNIX.


title: K800 USB Wireless Keyboard - keyboard repeat rate intermittent problems

text: Any advice as to how to debug this: My K800 USB Wireless Keyboard's repeat rate intermittently stops working. It will start behaving erratically and when holding a key down it will either not repeat at all, or only repeat 3-4 times. This occurs from any X11 (using xmonad), including konsole or gnome-terminal, etc. If i switch to a pseudo/virtual terminal ( C-Alt-F2 etc. ) , then the repeat rate is fine. I have tried `xset r rate 350 30` and it doesn't work. I have left it overnight and come back the next day to find that, magically, it all of a sudden works correctly. Then randomly, at some point in the future, it will start again. And randomly it will stop later on. I don't even know how to start to investigate this problem. I suspected maybe it is udev related? I tried something like this, as a gamble:               sudo rm -rf /dev/usb/*     sudo rm -rf /dev/bus/usb/*     sudo udevadm trigger      and it didn't help. Also - when selecting text with the mouse in konsole ( but not firefox ),   the same stutter/stop occurs when the problem is happening. I can select maybe 1 or 2 lines and then it stops selecting ( despite still having the mouse button pressed down ) uname: Linux 3.5.6-1-ARCH #1 SMP PREEMPT Sun Oct 7 19:30:49 CEST 2012 x86_64 GNU/Linux


title: default argument parsing section

text: I created a bash script where I would like to add a help options like `-h`, `\--help`, `\--verbose` and some others. If I create it like described here Will this be a standard solution?               # Execute getopt on the arguments passed to this program, identified by the special character $@     PARSED_OPTIONS=$(getopt -n "$0"  -o h123: --long "help,one,two,three:"  -- "$@")          #Bad arguments, something has gone wrong with the getopt command.     if [ $? -ne 0 ];     then       exit 1     fi          # A little magic, necessary when using getopt.     eval set -- "$PARSED_OPTIONS"               # Now goes through all the options with a case and using shift to analyse 1 argument at a time.     #$1 identifies the first argument, and when we use shift we discard the first argument, so $2 becomes $1 and goes again through the case.     while true;     do       case "$1" in              -h|--help)           echo "usage $0 -h -1 -2 -3 or $0 --help --one --two --three"          shift;;              -1|--one)           echo "One"           shift;;              -2|--two)           echo "Dos"           shift;;              -3|--three)           echo "Tre"                # We need to take the option of the argument "three"           if [ -n "$2" ];           then             echo "Argument: $2"           fi           shift 2;;              --)           shift           break;;       esac     done      Or is there another defined way how to implement this?


title: HGRCPATH kept in /etc/sudoers, yet ignored by hg?

text: I'm trying to follow the directions here under "sudo and multiple users". I believe I managed to modify `/etc/sudoers` correctly enough (by adding `Defaults :me env_keep += "HGRCPATH"` at the beginning of the defaults section, but later cutting `:me` because sudo was giving me parse errors) because I get this:               [me /]$ su     Password:     [root /]$ echo $HGRCPATH     /home/me/.hgrc      However, when I try to actually use `hg`, I run into trouble:               [me /]$ sudo hg commit -m "Initial check-in."     abort: no username supplied (see "hg help config")      Indeed:               [me /]$ sudo hg debugconfig --debug | grep read     read config from: /usr/etc/mercurial/hgrc     read config from: /etc/mercurial/hgrc     read config from: /etc/mercurial/hgrc.d/mergetools.rc     read config from: /root/.hgrc      Why does `hg` appear to be ignoring $HGRCPATH and looking in `/root/.hgrc` rather than `/home/me/.hgrc`? **UPDATE** Here are the non-commented lines of `/etc/sudoers`:               $ sudo cat /etc/sudoers | grep '^[^#]'     Defaults env_keep += "HGRCPATH"     Defaults    requiretty     Defaults   !visiblepw     Defaults    always_set_home     Defaults    env_reset     Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"     Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"     Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"     Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"     Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"     Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin     root    ALL=(ALL)       ALL     me     ALL=(ALL)       ALL


title: Which regular expression methods to validate input could be used in shell scripting?

text: #!/bin/sh          re="\/$"          if [ $1 =~ $re ]; then             echo "${ATTENTION_PREFIX}$1 DIRECTORY MAY NOT CONTAIN A \"/\" OR LITERAL SLASH!${ATTENTION_POSTFIX}"             exit 1     fi      Executing `sudo file.sh hello/` results in `[: 29: hello: unexpected operator` It looks like that this regular expression method is incorrect for shell scripting.