title: Force ssh to not to print warnings

text: Is there a way to avoid ssh printing warning messages like this?               "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r",     "@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @\r",     "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r",      Although the remote host identity has changed but I know it is fine and just want to get rid of this warning.


title: How do I make apt pick a certain package from a specific source?

text: I tried pinning the `debian_testing` source, but it's not really working (I want to pick version 0.10.29):               Package: nodejs     Pin: release a=debian_testing     Pin-Priority: 1000      Here's the `apt-cache policy`:               $ apt-cache policy nodejs     nodejs:       Installed: 0.8.1-1.1+0.0.0.6.a0dcf45.5       Candidate: 0.8.1-1.1+0.0.0.6.a0dcf45.5       Package pin: (not found)       Version table:          0.10.29~dfsg-1 1000             150 http://debian.mirror.iweb.ca/debian/ testing/main amd64 Packages          0.8.1-1.1+0.0.0.6.a0dcf45.10 1000             150 http://debmirror/squeeze/ unstable/main amd64 Packages          0.8.1-1.1+0.0.0.6.a0dcf45.6 1000             150 http://debmirror/squeeze/ testing/main amd64 Packages      *** 0.8.1-1.1+0.0.0.6.a0dcf45.5 1000             600 http://debmirror/squeeze/ stable/main amd64 Packages             100 /var/lib/dpkg/status          0.6.19-1.1+0.0.0.5.9ae19bd.9 1000             150 http://debmirror/squeeze/ unstable/main amd64 Packages          0.6.19-1.1+0.0.0.5.9ae19bd.5 1000             150 http://debmirror/squeeze/ testing/main amd64 Packages          0.6.19-1.1+0.0.0.5.9ae19bd.4 1000             600 http://debmirror/squeeze/ stable/main amd64 Packages          0.6.19-1.1+0.0.0.4.b58cc24.3 1000             600 http://debmirror/squeeze/ stable/main amd64 Packages          0.6.19-1.1+0.0.0.3.4de0c44.2 1000             600 http://debmirror/squeeze/ stable/main amd64 Packages          0.6.19-1.1+0.0.0.2.f68c674.1 1000             600 http://debmirror/squeeze/ stable/main amd64 Packages      What's missing to make it pick the 0.10.29 version from `debian_testing`?


title: Desktop Actions and mime types for a DRM file format

text: I want to handle a DRM file format, which adds an encryption wrapper outside of the protected content. Please see the diagram. # _**___ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ ____** # | DRM wrapper MIME | # | **___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ ____** # | | Embedded content MIME | | # | | ** ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ ___**| | # | ** ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __ ___ __**| I also write some media applications for it. But every DRM-ware applications can support only a few embedded content MIME types. For example, a DRM-aware music player can only support DRM-protected or clear songs while a DRM-aware picture viewer can only support protected or clear pictures. So how can I write the .desktop entry of such DRM-aware applications? If I set MIME type to the DRM wrapper MIME type, my music player may be launched to open a DRM-protected picture and fails. And because the embedded content can be various while the wrapper MIME type is unique, I can expect many such failures. Is there any better practice to handle this issue? Is it feasible to invent new MIME types that mix the wrapper MIME type and the embedded content type? E.g. audio/mpeg-xx- secured or image/jpeg-xx-secured and using them in the .desktop entry of my DRM-aware applications? Great thanks! Amanda


title: SARG with no records found

text: I want to use sarg tool in linux centOS to report users using website. But when installed, and when Iuse command `sarg -x -z`, the output is:               SARG: Init     SARG: Loading configuration from /usr/local/etc/sarg.conf     SARG: TAG: access_log /var/log/squid/access.log     SARG: TAG: output_dir /var/www/html/squid-reports     SARG: TAG: date_format e     SARG: TAG: overwrite_report yes     SARG: Parameters:     SARG:           Hostname or IP address (-a) =      SARG:                    Useragent log (-b) =      SARG:                     Exclude file (-c) =      SARG:                  Date from-until (-d) =      SARG:    Email address to send reports (-e) =      SARG:                      Config file (-f) = /usr/local/etc/sarg.conf     SARG:                      Date format (-g) = Europe (dd/mm/yyyy)     SARG:                        IP report (-i) = No     SARG:                        Input log (-l) = /var/log/squid/access.log     SARG:               Resolve IP Address (-n) = No     SARG:                       Output dir (-o) = /var/www/html/squid-reports/     SARG: Use Ip Address instead of userid (-p) = No     SARG:                    Accessed site (-s) =      SARG:                             Time (-t) =      SARG:                             User (-u) =      SARG:                    Temporary dir (-w) = /tmp/sarg     SARG:                   Debug messages (-x) = Yes     SARG:                 Process messages (-z) = Yes     SARG:      SARG: sarg version: 2.3.1 Sep-18-2010     SARG: Reading access log file: /var/log/squid/access.log     SARG: Records in file: 0, reading: 100.00%     SARG:    Records read: 0, written: 0, excluded: 0     SARG: No records found     SARG: End      And this is /var/log/squid/               root@FW sarg]# ll /var/log/squid/     total 184     -rw-r-----. 1 squid squid     0 Jul 25 03:49 access.log     -rw-r-----  1 squid squid 12592 Jul 14 03:16 access.log-20130714     -rw-r-----  1 squid squid   208 Jul 25 03:49 access.log-20130725     -rw-r-----. 1 squid squid  6944 Sep  3 12:56 cache.log     -rw-r-----. 1 squid squid  1286 Aug  4 03:37 cache.log-20130804.gz     -rw-r-----. 1 squid squid   168 Aug 11 03:22 cache.log-20130811.gz     -rw-r-----  1 squid squid   929 Aug 18 03:48 cache.log-20130818.gz     -rw-r-----  1 squid squid  1285 Aug 25 03:41 cache.log-20130825.gz     -rw-r-----  1 squid squid  1301 Sep  1 13:24 cache.log-20130901.gz     -rw-r--r--. 1 root  root   6517 Jul 25 08:51 squid.out     -rw-r-----. 1 squid squid 13968 Sep  4 13:56 store.log     -rw-r-----  1 squid squid 32398 Aug  4 03:37 store.log-20130804     -rw-r-----  1 squid squid 32592 Aug 11 03:22 store.log-20130811     -rw-r-----  1 squid squid 30652 Aug 18 03:48 store.log-20130818     -rw-r-----  1 squid squid  6180 Aug 25 03:41 store.log-20130825.gz     -rw-r-----  1 squid squid  5763 Sep  1 13:24 store.log-20130901.gz      And this is `sarg.conf`               access_log /var/log/squid/access.log     output_dir /var/www/html/squid-reports     overwrite_report yes     .....      and reports in web               My Squid User Access Reports     FILE/PERIOD    CREATION     DATE    USERS   BYTES   AVERAGE 24Jul2013-24Jul2013 Wed 24 Jul 2013 03:04:28 PM     ICT 1   5.57K   5.57K 21Jul2013-25Jul2013   Thu 25 Jul 2013 09:30:37 AM     ICT 0       0 14Jul2013-25Jul2013   Thu 25 Jul 2013 10:35:22 AM     ICT 1   5.57K   5.57K Generated by sarg-2.3.1 Sep-18-2010 on     25/Jul/2013-10:35      This is very little information. How can I increase that?


title: What is the difference between /opt and /usr/local?

text: According to the Filesystem Hierarchy Standard, `/opt` is for "the installation of add-on application software packages". `/usr/local` is "for use by the system administrator when installing software locally". These use cases seem pretty similar. Software not included with distributions usually is configured by default to install in either `/usr/local` or `/opt` with no particular rhyme or reason as to which they chose. Is there some difference I'm missing, or do both do the same thing, but exist for historical reasons?


title: Everything works in the auto-generated kickstart file for installing centos-linux except for selecting target drive + boot dot

text: I discovered that if I copy the auto-generated kickstart file in CentOS Linux, I could re-install CentOS Linux without having to fill stuff, and so on.. It appears centos saves the auto-generated kickstart file to `/root/anaconda- ks.cfg` Let's see what it looks like:               # Kickstart file automatically generated by anaconda.          #version=DEVEL     install     harddrive --partition=UUID=94A9-D1AE --dir=/     lang en_US.UTF-8     keyboard us     network --onboot no --device eth0 --bootproto dhcp --noipv6     network --onboot no --device wlan0 --bootproto dhcp --noipv6     rootpw  --iscrypted $6$wWTsHJyQ8Fe88fWk$v6u7X.WanDxPm26FJCi9gCwWXlwRg9tQze25uGk150W4BHLKcGRkcgFn4lRGowrXl1C0LlBQCOLxR9sx3Rjw20     firewall --service=ssh     authconfig --enableshadow --passalgo=sha512     selinux --enforcing     timezone --utc America/New_York     bootloader --location=mbr --driveorder=sda,sdb --append="crashkernel=auto rhgb quiet"     # The following is the partition information you requested     # Note that any partitions you deleted are not expressed     # here so unless you clear all partitions first, this is     # not guaranteed to work     #clearpart --all --drives=sda     #volgroup VolGroup --pesize=4096 pv.008002     #logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup --grow --size=1024 --maxsize=51200     #logvol swap --name=lv_swap --vgname=VolGroup --grow --size=7840 --maxsize=7840          #part /boot --fstype=ext4 --size=500     #part pv.008002 --grow --size=1          #part None --fstype=efi --label="LIVE" --onpart=sdb1 --noformat          repo --name="CentOS"  --baseurl=hd:UUID=94A9-D1AE:/ --cost=100          %packages --nobase     @core     %end      To make this work better, I simply added                interactive      right above the `install` line on top. so that I can see what it is doing. Looks like it didn't auto fill the root-password. so let's remove the encrypted password and add a plain text password and then test again. Looks like it didn't select "use all space" So let's uncomment the commented lines towards the bottom portion.   Looks like there are errors, I was forced to quit installation and reboot. Here is a final version that works okay. Only some lines were uncommented, and root password was changed to plain text. it is now                Use All Space      during the installation proces. I also added `interactive` line to it.               # Kickstart file automatically generated by anaconda.          #version=DEVEL     interactive     install     harddrive --partition=UUID=94A9-D1AE --dir=/     lang en_US.UTF-8     keyboard us     network --onboot no --device eth0 --bootproto dhcp --noipv6     network --onboot no --device wlan0 --bootproto dhcp --noipv6     rootpw  aaaaaa     firewall --service=ssh     authconfig --enableshadow --passalgo=sha512     selinux --disabled     timezone --utc America/Los_Angeles     bootloader --location=mbr --driveorder=sda,sdb --append="crashkernel=auto rhgb quiet"     # The following is the partition information you requested     # Note that any partitions you deleted are not expressed     # here so unless you clear all partitions first, this is     # not guaranteed to work     clearpart --all --initlabel     part /boot --fstype=ext4 --size=500     part None --fstype=efi --label="LIVE" --onpart=sdb1 --noformat     repo --name="CentOS"  --baseurl=hd:UUID=94A9-D1AE:/ --cost=100     %packages --nobase     @core     %end      Everthing works great but it is not selecting the target hard drive, and placing a dot into the Boot thing. In other words the final step has to be done manually by hand. What should be done so that it can select the target drive and also ensure selected as the boot drive ?


title: ksyts problem firing up GUI

text: i set my display export DISPLAY=CQIST097417W.msad.ms.com:0.0 loaded module module load syb/kerberos and kicked off ksyts ksyts but got the error : application-specific initialization failed: couldn't connect to display "CQIST097417W.msad.ms.com:0.0" invalid command name "option" while executing "option add *cursor $sytsConfigDB(cursor,$sytsConfigDB(cursor,current))" invoked from within "if { $isGuiSyts } { option add *cursor $sytsConfigDB(cursor,$sytsConfigDB(cursor,current)) option add *Text.height 4 option a ..." (file "/ms/dist/syb/PROJ/syts/4.24/dba/bin/../scripts/syts.tcl" line 6361) ANYONE ANY IDEA HOW TO FIRE UP THE ksyts GUI PLS ? john


title: Howto set access control lists ACLs in OpenLDAP

text: I'm using the Debian Squeeze OpenLDAP. Where can I set ACLs? Isn't it possible to execute the access to directives with `ldapmodify`? There's no `slapd.conf` file in Debian, they use a `slapd.d` folder


title: How can I check the charge of an Apple iPod Shuffle?

text: I am using Ubuntu and would like to know the answer to this question:   * How does one determine whether his/her Apple iPod Shuffle's charge is full in Linux? In Windows it's easy since iTunes shows the charge. But in Linux neither Rhytmbox nor gtkpod shows the battery charge. Any help regarding this.


title: What is the difference between red5 RC1 and RC2?

text: What is the difference between the red5 versions RC1 and RC2 ? and what does RC mean?


title: What tools to use to eliminate metadata in graphics files?

text: What tools can I use to delete all the EXIF, IPTC, XMP, etc metadata from graphics files?


title: How do I insert a space every four characters in a long line?

text: I've got a long line that I want to insert a space every 4 characters, on a single lone line of solid text to make it easier to read, what's the simplest way to do this? also I should be able to input the line from a pipe. e.g.               echo "foobarbazblargblurg" | <some command here>      gives               foob arba zbla rgbl urg


title: How to control the list of locales which are generated by APT?

text: Each time I install or operate in other means l10n-related packages, the APT system "rebuilds" a lot of English locales, which takes considerable time. Look at the APT log:               Configuring language-pack-en-base (1:10.10+20100930) ...     Generating locales...       en_AG.UTF-8... up-to-date       en_AU.UTF-8... up-to-date       en_BW.UTF-8... up-to-date       en_CA.UTF-8... up-to-date       en_DK.UTF-8... up-to-date       en_GB.UTF-8... up-to-date       en_HK.UTF-8... up-to-date       en_IE.UTF-8... up-to-date       en_IN.UTF-8... up-to-date       en_NG.UTF-8... up-to-date       en_NZ.UTF-8... up-to-date       en_PH.UTF-8... up-to-date       en_SG.UTF-8... up-to-date       en_US.UTF-8... up-to-date       en_ZA.UTF-8... up-to-date       en_ZW.UTF-8... up-to-date     Generation complete.      And this happens for each package. I don't need all those variants - most of the time I use non-English locale altogether. For me `en_US` and `en_GB` would be sufficient. So my questions are:   * Are all those `en_*` variants really installed on my machine? How to check that?   * If they are, how to cleanly remove them and prevent APT from generating them?


title: dmesg filled with audits every minute from cron

text: My `dmesg` is filled with output of like the following, starting from a couple of seconds after booth and continuing indefinitely:               [ 3155.216230] type=1006 audit(1393236841.859:85): pid=4206 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=84 res=1     [ 3214.742935] type=1006 audit(1393236901.406:86): pid=4227 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=85 res=1     [ 3274.960017] type=1006 audit(1393236961.646:87): pid=4245 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=86 res=1     [ 3335.143342] type=1006 audit(1393237021.853:88): pid=4266 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=87 res=1     [ 3394.290920] type=1006 audit(1393237081.024:89): pid=4325 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=88 res=1     [ 3454.269891] type=1006 audit(1393237141.024:90): pid=4344 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=89 res=1     [ 3514.802667] type=1006 audit(1393237201.575:91): pid=4424 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=90 res=1     [ 3574.320552] type=1006 audit(1393237261.119:92): pid=4441 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=91 res=1     [ 3634.364982] type=1006 audit(1393237321.187:93): pid=4498 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=92 res=1     [ 3694.503761] type=1006 audit(1393237381.347:94): pid=4559 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=93 res=1      This is caused in part by cron. If the root `crontab` includes `* * * * * echo test`, the audits appear once a minute. If it is empty, no audits appear. Why does this happen? How can I stop it? **Edit** : I'm running an updated Arch Linux. Trying to find the process that causes the audits:               $ systemctl -a | grep audit -i     auditd.service     not-found inactive dead      auditd.service


title: Recovering accidentally deleted files

text: I accidentally deleted a file from my laptop. I'm using Fedora. Is it possible to recover the file?


title: Recover deleted files on Raspberry Pi?

text: So I just rm -rf'ed a folder with a few files I need. Yes I know I should've had a backup, but it's just a Pi. It's designed to be played around with! Is there _anything_ I can do to recover that folder? Would the files be cached somewhere? Can you recommend any Linux file recovery programs? I don't want to boot into the SD again as it might write over the data :( Help! EXT4 filesystem.


title: Recover files from ext3 formatted external hard drive

text: > **Possible Duplicate:**   >  Recovering deleted files on fedora I have an external hard drive that I had been using to store some photographs, but I accidentally installed Lubuntu on it.   I'd like to know if there's any way to recover the files from it. I the drive was FAT32 beforehand; I'm not sure, though. It was a Seagate FreeAgent GoFlex (1 TB) Anway, I can't use any of the recovery tools I found, because they can't scan EXT filesystems from Windows.   I'm running a dual-boot, Windows XP and Ubuntu, plus I frequently boot into Puppy Linux from a USB drive, so it really doesn't matter which OS it's for. (No Mac-only software, though.) Anyway, it's really important that I get these photos back.


title: How to recover deleted directories "/home/pi"

text: I just deleted my `/home/pi` directory while I was trying to remove the directory under `/home/pi` which was `/home/pi/nmap`.   So, is there anyway to recover `/home/pi` directory as I have other important directories under it.   I use the commmand:               rm -rf /home/pi


title: How to recover files I deleted now by running rm *?

text: By mistake I ran rm * on the current directory where I created many c program files. I had been working on these since morning. Now I can't take out again the time that I spent since morning on creating the files. Please say how to recover. They aren't in recycle bin also!


title: Recover directory structure + files

text: ## Background: I had a dual boot of Windows + Linux Mint. Mint didn't feel right to me, so I decided to install Ubuntu to replace Mint.   I booted from a Ubuntu Live USB and started the installer. The installer asked me if I wanted to replace Linux Mint. I did, so I chose that option (big mistake). It then proceeded to format the drive and install Ubuntu.   After I booted into Ubuntu and discovered this, I quickly shut the computer down and began to work from a separate PC, hooking up PC #1's drive as a secondary to PC #2. ## Desired outcome: I would love to have all my files back - in their original directory structure and with their original file names. ## What I've tried: Primarily, I've tried two tools: **R-Linux** and **EaseUS Data Recovery Wizard**. R-Linux was able to recover what appeared to be most files (at least those that were of the file types R-Linux searches for by default). I was able to open and view these files (every file I opened; I didn't try all considering the number). However, R-Linux did _**not**_ recover the directory structure or filenames - only the files, sorted by file type and with random file names. E-DRW appeared to recover the files, filenames, and the directory structure. However, the same files that I was able to open/view when recovered by R-Linux appeared corrupt when recovered by E-DRW. JPG files (in multiple viewers) would not open. PHP, txt, and doc files all failed to open. I feel that considering one tool was able to recover file names and directory structure, and another tool was able to recover the file contents, that my goal is reachable. However, neither of these tools appear to be able to reach it completely. ## My question: Is there another tool I should/could try, or have I exhausted my options?   I have access to both a Linux (Ubuntu) and Windows system, so exclusive tools are not a problem. ## Response to duplicate flag: I do not believe this question is a duplicate. As I stated previous, I am able to recover files using R-Linux but not the meta data. The file names and directory structure are vital to the success of my efforts, as most of the files I desire to recover are useless/meaningless without this information.


title: Undo file removed by rm commend on MAC terminal

text: I unfortunately deleted `.bash_profile` file from my MAC. Accidentally I typed `rm .bash_profile`. Now how can I get my file back?


title: Getting back rsync's deleted files

text: I accidentally rsync-ed to a server using the delete attribute when I shouldn't have. Is there any chance of getting the data on the server that rsync removed.. back?


title: How to Recover Data in LINUX MINT Quiana

text: Can I recover deleted files in LINUX MINT 17 Quiana. I have deleted my folder containing data with shift+delete. Now, I want my data back.


title: I ran rm -rf. Need to recover files

text: > **Possible Duplicate:**   >  How to recover a file just deleted   >  How to undelete/restore the deleted files in ubuntu linux I ran `$rm -rf` on a machine by mistake.   But it wasn't as a super-user, so only my home directory is lost, however I need to recover the files. After the command was executed, I ran no more commands and instantly shut down the machine to prevent any data from being overwritten. I am currently running the machine through a live-disk. Can anyone help me recover the lost files?   If it's any help, I am running Arch-Linux.


title: Recover file from previous installation?

text: I recently wiped an old ubuntu server of mine and installed debian, but i forgot to backup a very important file. I know there is a chance that the computer has already wrote over the file, but what can I do to look for this file?


title: How do I simply recover the only file on an empty disk just deleted?

text: Usually, the best way to recover a deleted file is to have backups and that, if the backup failed, you should immediately remount the drive read-only. (See this thread: How to recover a file just deleted ) But in some occasions, if the deleted file wasn't that important, it just would save some time to just "undelete" it. Is there a simple way I could try on bash for the case that the deleted file on an **ext4 filesystem** was **the only file on the disk** , especially, if the disk is not used otherwise?


title: How to recover a file just deleted

text: I just deleted a file in Nautilus with Shift+Delete, which warned me that "If you delete an item, it will be permanently lost." I wonder if there is no way to recover the file? My OS is Ubuntu 10.10. Thanks!


title: Recover deleted Directories in centos

text: How can we recover deleted directories in CentOS 64 bit. I have tried it with `test-disk` but unable to update. Can anyone let me know the solution?


title: How to undelete/restore the deleted files in ubuntu linux

text: > **Possible Duplicate:**   >  Recovering deleted files on fedora   >  undelete files from local fileserver I accidentally did rm * in a directory instead of another directory from console in a Ubuntu11 machine.is there any way to recover these files.


title: Recover an overwritten file

text: I had a linux plain text document file with close to 100000 lines, a size of 10 Mb. I accidentally overwrote the file via python code. But I got an exception in the middle of the code and think the file socket did not get closed properly. The new file has a few new lines (250) ,BUT the size of the file corresponds to the old one.   I was wondering if the old content will still be there within the file and any chances of recovering the same. I tried using TestDisk and poked around a little bit. But it did not have any option for working on a particular file or maybe I am doing it wrong. I dont have any expertise in file systems and would really appreciate any pointers on how to proceed.   Thanks


title: rm -rf /home/ Recovery

text: OS :-Suse Linux Enterprise 12.0 File System :- ext3 I hit `rm -rf /home/`, immediately I did `Contol`+`C` so the command got canceled but until that time I lost ~9GB of data from this `/home` dir. I don't have System GUI access. Please suggest a suitable recovery command or packages so that i can recover my lost `/home` files. I just want to recover only one lost dir from this `/home` dir that is, `/home/cubot/etl/script`. This `/home/cubot/etl/script` was having some important scripts and it is not visible now completely.


title: Restore deleted Mysql Directory in linux

text: My MySQL directory has been deleted from directory /root/var/ by mistake, we need to restore it, Is it possible ?


title: Unix/Linux undelete/recover deleted files

text: Is there a command to recover/undelete deleted files by `rm`?               $ rm -rf /path/to/myfile      How can I recover `myfile`? If there is such a tool how can I use it?


title: How to recover: Deleted accidently important files

text: I've accidentally deleted today the `/var/www` with 2 Joomla-Homepages on it. Is there any possibility to recover all these files? I'm using PhotoRec right know, but the recovered files are named like: f3411984.html I have not create backups, which I should have. I there a better way to recover these files.


title: Restore overwritten /usr/local/bin

text: > **Possible Duplicate:**   >  Recovering deleted files on fedora I accidentally overwrote my `/usr/local/bin` directory when installing something. Is there a way I can restore this directory? What can I do to get Ubuntu functional again?


title: undelete files from local fileserver

text: I have a NAS (mybook world white light) in my living room where all my music and stuff is stored. I've mounted the music folder of the nas in the local music folder of my home directory on my desktop computer. My fstab entry looks like this:               //192.168.2.222/Public/Shared\040Music/ /home/simon/Musik/ cifs credentials=/home/simon/.smbcredentials,defaults 0 0      A few minutes ago, I moved my home directory on my local desktop computer with the help of this (german) tutorial. At first everything looks great, but then I realised that my music folder was empty. I think I deleted everything in this step during the tutorial:               umount /home     rm -rf /home/*       Because the music folder was still mounted to `/home/simon/Musik :/` Is there a possibility to recover something of the data? As I realized what happened, I shut down the NAS.


title: su to another user using ssh keys?

text: Assuming that `user_A` and `user_B` set up and exchange public ssh keys with each other, is it possible for `user_A` to `su` into `user_B` on the same machine?


title: What is the difference between invoking a perl script via sh or perl

text: I have a simple Hello World perl script.               #!/usr/bin/perl          print 'Hello world.';      It works fine if I run it via `perl <file_name>`, but it fails I run it via `sh <file_name>`. My understanding of the first line is that it invokes the perl shell (similar to #!/usr/bin/bash will invoke a bash shell). So what exeactly is the difference between the two commands? I found this thread http://ubuntuforums.org/showthread.php?t=1133334 that states `sh <file_name>` "In that case, you don't run Perl at all, but the shell, which will call the program 'print'." IF that's the case is the #! just being interpreted as a comment. If so, is it needed at all? (I am aware that I can chmod +x the file and run it dirrectly, but I just want to know the difference between the two methods I was using)


title: Automount CIFS shares on boot?

text: I have a script saved that mounts my CIFS share, but I have to run it manually every time I boot into Linux and I connect to the internet. Is there a way that I can set the script to run as root every time Linux boots, and have it continually run until it connects to the drives? I'm running Linux Mint. **UPDATE:** I already have the package installed. I have a working script to mount it:               #!/bin/sh          mount -t cifs //xxx.xxx.xxx.xx/usb1-1share1 /media/Private -o username=xx,password=xx,domain=WORKGROUP     mount -t cifs //xxx.xxx.xxx.xx/Uploads /media/Uploads -o     username=xx,password=xx,domain=WORKGROUP


title: Using awk for data manipulation

text: I have an input file in the following format.               #track     chr11   61731756    61735132    FTH1    -     chr12   6643584 6647537 GAPDH   +     chr11   18415935    18429765    LDHA    +     chr12   21788274    21810728    LDHB    -     chr22   24236564    24237409    MIF +     chr4    6641817 6644470 MRFAP1  +     chr15   72491369    72523727    PKM -     chr10   73576054    73611082    PSAP    -     chr2    85132762    85133799    TMSB10  +     chr13   45911303    45915297    TPT1    -      I want to get an output file in which if the 5th column is + then subtract 5000 from column 2 and add 2000 to column 3 so as to output following               chr11   18410935    18431765    LDHA    +     chr2    85127762    85135799    TMSB10  +      If the 5th column is "-", then add 5000 to column 3 and subtract 2000 from column 2 so as to get following output               chr11   61729756    61740132    FTH1    -     chr12   21786274    21815728    LDHB    -      So I want the output to be in the same order as input. Also I want to output the first line #track as it is. I want to do this in awk. How can I perform this. I am new to awk and still learning. Thanks


title: Where would I find where an .htaccess file is located and being used on a Mac OS X Lion server that sets Basic Auth on an Apache server?

text: I've installed some software, namely, a continuous integration (CI) server (Jenkins) on a Mac Mini running Lion Server. The server, by default, runs from port 8080 on local host via the url: `http://localhost:8080`. However, when I try to access the page it seems to be protected by Basic Auth and it asks me for a name and a password. Granted, I never set that Basic Auth and I've been told I can remove the authentication and use that port for the CI server. However, I'm hard pressed to find an `.htaccess` file anywhere that sets the Basic Auth? If it's not set in an `.htaccess` file then where would Basic Auth be set?


title: Emacs won't open file in Bazaar repository

text: I have a Bugzilla installation, and am trying to open `/Bugzilla/Install/CPAN.pm` using emacs. However, I get this error when attempting to do so:               Searching for program: no such file or directory, bzr      As I am kind of unfamiliar with `emacs` beyond the basics, and very unfamiliar with `perl`, I have no idea what this means. Why do I get that message? Why won't `emacs` load the file? How do I fix this problem? If any additional info is needed, I will be happy to oblige. EDITS: I am trying to open it with the command `emacs Bugzilla/Install/CPAN.pm` while in the `bugzilla` directory. ![enter image description here](http://i.stack.imgur.com/wt8Kl.png)


title: How to check whether a usb Wifi supports Hotspot or not

text: I found a wifi card here:- Wifi Now, how can I check whether It can enter master mode and have support for hotspot? As my current in-built Wifi card is giving me this:-               Error for wireless request "Set Mode" (8B06) :         SET failed on device wlan0 ; Invalid argument.      On executing:-               sudo iwconfig wlan0 mode master      I am seeing `SoftAP` in its heading. Should I assume that I will go in master mode on my linux box?


title: Escaping dash in `dch` call

text: I'm using `dch` to modify the changelog for a debian package that is being built using some bash script. The messages for changelog are taken from some data source and are just passed to `dch --append`. And today I noticed that it fails to do its job if starts with dash (`-`) character:               $ dch --append "- when"     Unknown option:     Unknown option: w     Usage: dch [options] [changelog entry]     Run dch --help for more details      How would one properly escape such a string?


title: Bare-bones linux?

text: I am working on a homemade OS and I was originally going to write it myself in Assembly and Python, but I decided that doing this would just be easier, faster, and more Linux-y. I have the Python part done, I just need to do the Linux part. So, I was wondering if you had any idea of a place I could get a pre-made ISO of any (preferably Debian based) Linux distro, with BASH, Aptitude, Python 2.7.6, and crontab installed, and with NO xorg or xvesa or whatever. It would also be extremely helpful if instead of posting links to places without a proper explanation and what-not, if you could just give me a download link.


title: How to stop gnome from forcing me to logoff / logout?

text: From time to time my Gnome 3 shell or some parts of it are crashing. Gnome sees a time out and is forcing the user to logout **without** other possibilities. _"Oh no! Something has gone wrong."_ See superuser for a screenshot. (Fail whale is providing this dialog.) Is there a way to stop gnome from doing that? Since the other programs are still running and working fine... In my case its clearly a time out, since a scientific analysis eats up all memory and after its done Gnome has a hard time to recover. (I experienced also these crashes, when I was using some (combination of) extensions which are buggy. In that case the probably only or best solution is to not use those extensions... also considering the posts I've read about this.)


title: dkms versus module-assistant

text: `module-assistant` has been the de-facto method of compiling and building binary Debian packages containing kernel modules for a while now. More recently a comparable utility has appeared - `dkms`. If anyone has experience using both, please do a compare and constrast on the advantages and disadvantages of using one versus the other. One item to address in an answer is whether `dkms` builds binary Debian packages for kernel modules too, and if so, how, and if so, what the differences between the packages built by `m-a` and `dkms` are, if any. I have personally never used `dkms`, but I have used `module-assistant` sporadically over many years, and it has been a good experience. I don't have immediate plans to experiment with `dkms`, so I don't think I am the right person to write an answer. Random googling found a discussion here, also this. Needless to say, any answer should be based on first hand experience, not copying from web forums. A worked example using both would be nice. Possibly `nvidia-kernel`, since that is quite commonly used. Yes, I know it is a proprietary kernel module. :-( UPDATE: Thanks to jordanm for his answer. I'd like something that goes into a little more detail about what is going on under the hood, for both `m-a` and `dkms`, though I did not initially mention this. Also, it sounds like most of the time `dkms` will work transparently and automatically. But what are the failure modes of `dkms`. How do they both cope with manually compiled/installed kernels? Either installed from a binary package or a local install.


title: "su" with error "X11 connection rejected because of wrong authentication."

text: As root, I'm connecting to a remote host to execute a command. Only "standarduser" has the appropriate id-file and correct .ssh/config, so I'm switching the user first:               su standarduser -c 'ssh -x remotehost ./remotecommand'      The command works fine, but despite the fact that I used "-x" (disable X11-Forwarding) and having X11Forwards disabled in `/etc/ssh/ssh_config`, I still get the error message:               X11 connection rejected because of wrong authentication.      I'm not getting the error message when I'm logged in as "standarduser". This is quite annoying as I would like to integrate the command in a cron job file. I understand that the error message refers to the wrong authentication of root's .XAuth file, but I'm not even trying to connect via X11. Why is "ssh -x" not disabling the X11 connection and throwing the error message? _UPDATE_ : The message only shows when I'm logged in within a screen, when using the command stated above on the local machine itself (without screen), I don't get an error message, so this should be fine with cron, too. I also started the same command with `-v` and surprisingly got the error message FIRST, even before the status information from SSH:               root@localhost:~# su standarduser -c 'ssh -x remotehost ./remotecommand'     X11 connection rejected because of wrong authentication.     OpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013      This led me to the problem itself, it is NOT the `ssh` which is throwing the error message, it's `su`:               root@localhost:~# su standarduser -c 'echo Hi'     X11 connection rejected because of wrong authentication.     Hi      Why do I only get this error within `screen`? How can I disable this error message? (Update title)


title: Bash is not finding a program even though it's on my path

text: I have a program on my path. The program runs when executed with a full path specified. But the program cannot be found when I run it with just its name. Essentially, I want to understand how the below output is possible, and how to fix it so that my program can actually be found without a full path specified:               root:/usr/local/bin# ./siege     ****************************************************     siege: could not open /usr/local/bin/etc/siegerc     run 'siege.config' to generate a new .siegerc file     ****************************************************     root:/usr/local/bin# echo $PATH     /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games     root:/usr/local/bin# siege     bash: /usr/bin/siege: No such file or directory     root:/usr/local/bin# wtf!?!?      I'm on Ubuntu 12.04 using bash. Also please note the warning output from siege is not relevant for the purposes of this question, as I am only interested in whether or not the program can be found and invoked.


title: How can I grep for this or that (2 things) in a file?

text: I have a file that has "then"'s and "there"'s. I can               $ grep "then " x.x     x and then some     x and then some     x and then some     x and then some      and I can               $ grep "there " x.x     If there is no blob none some will be created      How can I search for both in one operation? I tried               $ grep (then|there) x.x      -bash: syntax error near unexpected token `(' and               grep "(then|there)" x.x     durrantm.../code     # (Nothing)


title: Remove 50GB oldest files in busybox when used capacity reaches 95%

text: Ok i have requested a code here but initial i didn't ask to make it busybox compatible. My bad. I'm new to linux and coding. The code needs to do the following: > Delete 50GB of oldest data (dir with files) from a directory when the HD > reaches a capacity of 95%. The code they gave me is, that is not working with busybox:               DIRS="a/ b/"     MAXDELBYTES="53687091200" # 50GB     DELBYTES="0"          find $DIRS -type f -printf "%T@ %s %p\n" | sort -r -n | while read time bytes filename     do         rm -fv "$filename"         DELBYTES=$((DELBYTES + bytes))              if [ $DELBYTES -ge $MAXDELBYTES ]; then break; fi     done      What is not working:   * -printf (changed it to -print)   * %T@ %s %p\n (dont know what to change it to)   * Do not know what else isn't working. I'm new to coding and linux. Now this need to be translated to busybox so it will work on my embed linux system. Also a cron command needs to be added so it runs every Friday. Thanks for your support!


title: Proxy software that will decide where to send requests for linux

text: Does anyone know of some proxy software that is easy to configure thus.... User makes a request Request is sent to clear internet. If website can not be found. i.e. is Blocked by ISP (China) then the same request is made to a VPN connection which is maintained.


title: good Ubuntu/Debian distro for a development/coding VM?

text: I have a Windows laptop, but I like to use Linux as a development/coding environment. Currently I am currently running Ubuntu 12.04 as a guest OS with VirtualBox. Some of the issues with this setup are:   * I need a lighter-weight distro - Ubuntu installs too many extraneous packages   * I like to work in VirtualBox's "seamless" display mode - GNOME Terminal is the app I use the most. I'd like to find a window manager which gives me more vertical real estate. The GNOME desktop manager (the classic version) works pretty well, but I don't need the top menu bar or bottom task bar, and I could do with smaller title bars on windows. Any suggestions on windows manangers, configuring GNOME or other Debian/Ubuntu compatible distros?


title: syncing two maildirs

text: I have a server that I use to frequently get email from Google using `offlineimap`. the email is stored in a maildir format on this server. What tool can I use to sync this maildir with the local maildir that is on my latop? I've tried `getmail` but that doesn't have a two-way sync. `syncmaildir` gave me headaches (kept crashing, plus has some strange dependencies on gtk). `rsync` seems too brutal. I need a simple tool that can be used over ssh to get new emails from the server, update the flags (read, etc) and delete deleted messages. What have you guys used so far? What are the perks of your proposed tools?


title: How to generate signal interrupt on a file descriptor in Linux?

text: How can I generate a signal interrupt on a file descriptor in Linux? Motivation is to generate a interrupt in userland as we have in microcontrollers. I'll have file descriptor for I/O, and want to generate a interrupt whenever there will be a change in its status? Can someone tell me? If possible please give me example.


title: Ubuntu password policy

text: I want to set the system-wide password policy on an Ubuntu 12.04 LTS server. Googling around, a lot of people point to this (very old) document: https://help.ubuntu.com/10.04/serverguide/user-management.html It says to edit the `/etc/pam.d/common-password` file and look for the `password required` line:               password    required    pam_unix.so nullok obscure min=6 max=8 md5      To set the minimum password length, adjust the `min=` setting. However, on 12.04, my file looks like this (comments removed):               password    [success=1 default=ignore]  pam_unix.so obscure sha512     password    requisite           pam_deny.so     password    required            pam_permit.so      Which line do I change? The one with `pam_unix.so`? Or the one with `password required`? Or is it now in some other file? There's nothing in that file's comments about setting the password policies.


title: What does altering a file/directory mean?

text: From `man ntfsundelete` > Look for deleted files altered in the last two days >   >   >     ntfsundelete /dev/hda1 -t 2d >   I wonder what altering files/directories mean?   1. Does deleting some files/directories count as altering them?  For example, if I created a file more than two days ago, and didn't change it until yesterday when I deleted. Will the command be able to recover it?   2. Does moving some files/directories from being under a directory to being under another directory count as altering them, even when the files/directories being moved have not been changed themselves? I am hoping to find a way to specify and undelete the directories (with files inside) that I deleted at once last time. Thanks!


title: allow webalizer in selinux (centos)

text: I roughly followed these instructions: http://library.linode.com/web- applications/analytics/webalizer/centos-5 to install and configure webalizer to run on several VirtualHosts. Unfortunately when i try and run: `webalizer -n site.net -o /var/www/webalizer /etc/httpd/logs/site.net- apache_log` I get: `Error: Can't open log file /etc/httpd/logs/site.net-apache_log` But after running: `echo 0 > /selinux/enforce` It works. How can i tell selinux to allow webalizer to run? _EDIT_               [root@web-01 logs]# ls -lZ     -rw-r--r--. root root unconfined_u:object_r:httpd_log_t:s0 access_log     -rw-r--r--. root root unconfined_u:object_r:httpd_log_t:s0 error_log     -rw-r--r--. root root unconfined_u:object_r:httpd_log_t:s0 tt.net-access_log     -rw-r--r--. root root unconfined_u:object_r:httpd_log_t:s0 tt.net-error_log     -rw-r--r--. root root unconfined_u:object_r:httpd_log_t:s0 ck.tt.net-access_log     -rw-r--r--. root root unconfined_u:object_r:httpd_log_t:s0 ck.tt.net-error_log      .               [root@web-01 ~]# service --status-all     auditd (pid  1132) is running...          [root@web-01 ~]# /opt/webalizerScript.sh      Error: Can't open log file /etc/httpd/logs/tt.net-access_log     Error: Can't open log file /etc/httpd/logs/ck.tt.net-access_log          [root@web-01 ~]# audit2allow -w -a     <no matches>


title: Does sed write to the file or give a sample output

text: when using `sed` with a file like this               sed 's/a/o' fruits      it gives the necessary output to the terminal but it does not change the contents in the file. How do I permanently change the file with the above substitution?


title: Using bash's "source" command return error though it successfully read config file

text: I want my bash script to read parameters from config file. Here is what inside the script:               #!/bin/bash     source /home/myscript/conf/config.conf          echo "$username"      and below is my config.conf:               username="jonas"      The output when I run the script:               [user@machinename bin]$ . thescript     : No such file or directoryonfig.conf     : command not found     jonas      Here I am confused, though it successfully print "jonas", why is there error "No such file or directory" and "command not found"? Am I doing something wrong?


title: Gnome can't open Sound Mixer - No volume control GStreamer plugins and/or devices found

text: I'm trying to get sound output working on a VPS, but whenever I'm trying to open the gnome sound control panel as non-root, I'm getting the error "No volume control GStreamer plugins and/or devices found." Now I found several forum topics concerning this question, but even the proposed "sledgehammer" method in those, namely setting /dev/snd chmod to 777, did not work for me. I also tried adding my user to the audio group to no avail. I'm kinda helpless, since it working with root indicates a permission problem, but setting the permissions to 777 should fix that, right? Is there maybe something I overlooked, any more permissions I may have to set or is it a different problem alltogether? Some data about the VPS:   * OS: Debian 6.0 Squeeze   * Kernel: 2.6.32-028stab107.2 If you need any more information, let me know.


title: gpg: Bad signature

text: I'm trying to sign a public PGP key but am encountering a 'Bad signature' error:               gpg --edit-key someone@somedomain.com     ...     gpg> sign     ...     You need a passphrase to unlock the secret key for     user: "My User <myuser@mydomain.com>"     2048-bit RSA key, ID 12345678, created 2012-01-01      I enter my passphrase then get:               gpg: checking created signature failed: Bad signature     gpg: signing failed: Bad signature     gpg: signing failed: Bad signature      I've done some searching online but can only find old, unrelated posts or ones relating to smart cards, which I'm not using. I'm running gnupg 2.0.25-1 on an Arch Linux box. Any help gratefully received!


title: Is a file manager in Linux a necessity or a luxury?

text: I agree that this is a kind of a personal issue - to use a file manager or not in Linux, but I heard that it's also a bad practice to use a file manager especially for newbies because first of all they have to learn the shell and all file manipulations should be done from the shell. Is that true and do Linux users use file managers?


title: Convert gnu screen status line to tmux status line

text: I am using the following screen status line, configured in my screenrc: ![screen status](http://i.imgur.com/qztsh.png) I configured it using the following line:               hardstatus alwayslastline     hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'      I did not create this theme, I don't remember where I found it, but I really like it. I am now converting my configuration to `tmux` and I can't seem to replicate this configuration in my `tmux.conf`. I got this far:               set -g status-bg black     set -g status-fg white     set -g status-left '#[fg=green]#H'     set-window-option -g window-status-current-attr bright     set-window-option -g window-status-current-bg red      Which produces this line: ![tmux status](http://i.imgur.com/wSvyi.png)] Please ignore the different hostname, it's on a different server What configuration can I use in `tmux` to produce a status line similar to the first one? Thank you!


title: Data transfer between Ubuntu and CentOS

text: How do I transfer data between Ubuntu and CentOS using LAN cable, in the same network? I tried installing Samba which did not go well in CentOS.


title: How to replace a list of placeholders in a text file?

text: I have a text (configuration) file, but the program that reads the file unfortunately doesn't allow using any kind of variables. So I'd like to use a preprocessor that replaces a set of placeholders in the config file before passing it to the program. I can define the format of the variables any way I want (e.g. `§SOME_DIR`). If I had just a few variables, I would probably use `sed`:               sed  -e "s*§SOME_DIR*$SOME_DIR*g"  my.conf | target_prog      But the list of variables is pretty long, and it should be easy to configure - so I'd prefer to put the variables in a properties file like               SOME_DIR=...     OTHER_DIR=...     ...      and then call               some_replace_tool  my.properties  my.conf  | target_prog      I'm looking for "some_replace_tool". Any ideas?


title: How do I make themes apply to windows as well as system elements?

text: I am using Linux Mint with Cinnamon. Whenever I install a theme, it changes the 'system' elements, like the menu and taskbar, but not the window borders or buttons or the like. I went on the 'Other Settings' tab in the 'Themes' window, but no options other than the ones that came with the system appear. Specifically, I want the Holo theme to be system-wide. Forgive me if this is a dumb question; I just started using Linux recently.


title: ulimit & rlimit in Linux, are they the same thing?

text: I see people use the terms `ulimi`t & `rlimit` interchangeably, can I say they are referring to the same thing?


title: Find out what processes are writing to hard drive

text: On my Lenovo T400 and Ubuntu, the light for hard drive writing keeps flashing. I was wondering if in Linux it is possible to find out what processes are doing I/O to the hard drive? Just like by `top`, you can find out what processes are using most CPU and memory.


title: Is there a pbuilder-like environment for RedHat?

text: I would like to know if is there any utility like Debian's `pbuilder`, to build RPM packages on RedHat using a clean environment (`chroot`). I've found mach which has support for something like this but under a Debian environment, and doesn't support RHEL. I need something that runs on RHEL 5.5.


title: Splitting giant files into a specific number of lines

text: I have a CSV that is 40 000 lines long. What is the simplest tool to read from line x to line y? I am sure there are more professional ways to do it but I would just like a bash script that works in the form of                readFile --from 10 --to 20      so that I can process ten lines, then call it again and bring in ten more lines. I was considering just using an AWK script but can you do it even more simply with something like `cat`, `grep`, `tail` or `head`?


title: Trying to set keyboard layout using Xorg configuration but it's not working

text: I'm trying to set my HP Pavilion g6 keyboard layout to English(us) and Arabic(ara). I'm using Fedora 18, but followed Arch Wiki anyways. Here's my `90-keyboard-layout.conf` file :               Section "InputClass"             Identifier  "keyboard"             MatchIsKeyboard "on"             MatchDevicePath "/dev/input/event*"             Driver          "evdev"             Option          "XkbModel"  "pc105"             Option          "XkbLayout"     "us,ara(qwerty_digits)"             Option          "XkbVariant"    "qwerty_digits,qwerty_digits"             Option          "XkbOptions"    "grp:alt_shift_toggle"     EndSection      I've entered `pc105` because I have no idea what's the corresponding `XkbModel` for my HP Pavilion g6 keyboard (looked in `/usr/share/X11/xkb/rules/xorg` but didn't find it). I have also this file `00-anaconda-keyboard.conf` which contains :               #This file was generated by the Anaconda installer     Section "InputClass"             Identifier  "keyboard"             MatchIsKeyboard "on"             Option          "XkbOptions"    "terminate:ctrl_alt_bksp,"     EndSection          Section "ServerFlags"             Option  "DontZap" "false"     EndSection      Here's my `setxkbmap -print`:               xkb_keymap {         xkb_keycodes  { include "evdev+aliases(qwerty)" };         xkb_types     { include "complete"  };         xkb_compat    { include "complete"  };         xkb_symbols   { include "pc+us(qwerty_digits)+ara(qwerty_digits)(qwerty_digits):2+inet(evdev)+group(alt_shift_toggle)+terminate(ctrl_alt_bksp)" };         xkb_geometry  { include "pc(pc104)" };     };      What else is missing? Layout switching is not working at all so far.


title: Linux Mint 15 Doesn't detect Windows with update-grub

text: I just installed Linux Mint 15, but `update-grub` doesn't detect Windows:               $ sudo update-grub     Found linux image: /boot/vmlinuz-3.8.0-19-generic     Found initrd image: /boot/initrd.img-3.8.0-19-generic     Found memtest86+ image: /boot/memtest86+.bin       No volume groups found     done      Video showing Mint 15 (ubuntu raring) update-grub error/bug


title: What is the default shell for .sh in AIX?

text: I am fairly new to AIX machine. We would like to deploy some program into the AIX machine which is yet to come. We have a short experience in AIX machine and after login using putty, we felt the shell is very weird and some aspects compared to the Red Hat Linux we are using. The backspace is not functional, and some arrow key have weird behaviour too. Anyway, assume this is a healthy machine, I would like to ask, if we create a .sh file and execute it, what is the default shell for it? And what is the default shell after login?


title: Mandriva 2007 Cannot setup printer

text: I tried to use a printer that is shared by a Windows PC. When I try to Mandrive Control Center > Hardware > Set up printer, the window opens but there is no content. Only a window. Seems that **`system-config-printer`** package is not installed. I try to open Software Management > Look at instalable ... and select All search by name _system-config-printer_ but the search returns nothing. What should I do next to be able to use the printer?


title: .DELETE_ON_ERROR behavior with make and pipelines

text: The `.DELETE_ON_ERROR` target will tell make to delete a target if a rule fails. But this doesn't work for pipelines, because the exit status value `$?` holds the value of the last program in the pipeline. As an example, the following makefile will not delete the newly created file _foo_.               .DELETE_ON_ERROR:     foo:         false | true > foo      Is there a way to get make to consider the rule as having failed if any of the programs in the pipeline fail (i.e., if there's a non-zero value in any of the elements of the `$PIPESTATUS` array)?


title: Creating a new partition in empty space between 2 existing ext4 partitions

text: Output of `fdisk -l`:               Disk /dev/sda: 640.1 GB, 640135028736 bytes     255 heads, 63 sectors/track, 77825 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x07f2837e             Device Boot      Start         End      Blocks   Id  System     /dev/sda1               1          13      104391   de  Dell Utility     /dev/sda2   *          14        1926    15360000    7  HPFS/NTFS     /dev/sda3            1926       27578   206055449+   7  HPFS/NTFS     /dev/sda4           27579       77826   403610625    5  Extended     /dev/sda5           27579       52921   203561523+  83  Linux     /dev/sda6           59000       59972     7811072   82  Linux swap / Solaris     /dev/sda7           59972       77826   143407104   83  Linux      A few things to note: 1) There's around 50GB of unallocated space betweed sda5 and sda6. 2) sda5 is mounted at `/` on my Ubuntu install, and sda7 is mounted at `/home`. I want to install Fedora in the unallocated space by creating a 50GB ext4 partition. I would create only a single root partition in that space without modifying any partition around, and I'll take care of all the GRUB mess. My question is: Will creating an ext4 partition between sda5 and sda6 change the sdaX numbering of the swap and /home partitions? I guess yes. In any case, will it also change the UUID of any other partition? I'm asking this because I can see in my ubuntu fstab that the partitions are identified by their UUID. If I just create a partition in the unallocated space and install Fedora, will the UUIDs change of the surrounding drives so much that the drives won't auto- mount at Ubuntu startup? Any help would be appreciated. Thanks!


title: PDF viewer with reflow capabilities for linux?

text: Anyone know of a PDF viewer for linux that can reflow text on the fly? There are a few for android, and at least one for windows, but I haven't found any for Linux. **NOTE:** I'm doing this on a 1600x900 laptop. The resolution is not the problem, badly formatted PDFs with hard-to read wide columns is the issue I'm trying to get around.


title: What is produced after using cat on an image?

text: Let's say one creates a file like so:               touch myFile      You enter some text in it with vim or whatever, and then use `cat myFile` to spit the contents out into the terminal. Now, what happens when I use cat on any image? Say,               cat myPNG.png      I just get a bunch of garbage. It just made me think about what the `cat` command is attempting to do, and where all of this "garbage" comes from. Just curious.


title: IPTABLES chain need help for restriction

text: I have two network cards               eth0:- 172.16.91.70 (External Zone)     eth1:- 172.16.85.70 (Internal Zone)      I have clients in my Internal Zone which can access the external network. The ping goes fine and can access external net. Now I want to restrict the access for the internal zone. The external zone connects to another network that is 172.16.81.0 and that connects to 172.16.79.0 Now I want my internal zone be able to access complete 172.16.91.0 network, drop packets from 81.0 network and access 79.0 network. But I also don't want it to access internet because the squid proxy server is in 81.0 network.


title: Copying the newest files

text: We have a script running which picks up the report generated monthly on remote servers. I was trying to find a way to pick up the latest file from the remote servers only. Will find work in script or that's a bad practice?               for host in "${hosts[@]}"; do         scp "$host":"$remote_path" "$local_target_dir"/filename."$host"     done      File format = servername_BBC-3.0_2014-06-04_164510_.txt


title: Why does installing Debian from DVD download many packages?

text: I know Debian is general purpose, so a Debian install could just as easily be a server as a desktop. It seems, however, that even with a DVD of disk1 from Debian, it is downloading a tremendous number of files from the network mirror. I would have thought a DVD would be enough to get a base desktop installation running. What am I missing here? Let me clarify: I chose "SSH Server" and "Desktop Environment" in tasksel. Is GNOME not a part of the primary installation DVD?


title: Identical mount points for two file systems when installing Linux

text: So, I'm going through Crunchbang's installer (very similar to Debian's), and am at the partitioning step. I chose the 'Guided - use entire disk and set up encrypted LVM' method (usually I do manual without encryption). It wiped my disk, and I set my encryption pass phrase. So now this is my current partition configuration               LVM VG $HOSTNAME,    LV root - 242.7 GB Linux device-mapper (line          #1           242.7 GB     f  ext4      /     LVM VG $HOSTNAME,    LV swap_1 - 7.1 GB Linux device-mapper (line          #1             7.1 GB     f  swap      swap     Encrypted volume (sda5_crypt) - 249.8 GB Linux device-mapper (cry          #1           249.8 GB     K  lvm     SCSI1 (0,0,0) (sda) - 250.1 GB ATA WDC WD2500BEKT-7          #1  primary  254.8 MB  B  F  ext2      /boot          #5  logical  249.8 GB      f  crypto    (sda5_crypt)     SCSI5 (0,0,0) (sdb) - 16.0 GB JetFlash Transcend 16GB         #1  primary    16.0 GB  B     fat32      The last entry is obviously the USB drive I've booted from, but I'm including it for completeness. I may have inadvertently done something to it. When I try to write changes to disk, I get the following error message                                    [!!] Partition disks                    Identical mount points for two file systems     Two file systems are assigned the same mount point (/): LVM VG     $HOSTNAME, LV root and SCSI1 (0,0,0), partition #5 (sda).          Please correct this by changing mount points.


title: Is it possible to configure dynamic loader for an executable

text: I am looking for a way to allow an executable to find its shared library, but in order to avoid conflict with any package that could use a different version of the same shared library I prefer to keep these libraries in a 'private path' (not /usr/lib). The possible ways seems :   * embbeded rpath in the executable   * set LD_LIBRARY_PATH when executable is started   * add libraries path in ldconfig configuration in a ld.so.conf.d file rpath links target structure to the build, ld.so.conf.d configure path for the system, LD_LIBRARY_PATH need the caller process to be aware of it. So I wondering if it is possible to use ld.so.conf.d (or similar loader configuration) applied only for an executable ?


title: extract lines according to a particular column

text: I have a CSV file like               CK,ck     XYZ,xyz,xyzs     ABC,abc,abcs     PQR,pqr,pqrs     LMN,lmn,     IJK,ijk,      I have to check if something is written in column 3 except whitespace, then display the whole line.the output will be:               XYZ,xyz,xyzs     ABC,abc,abcs     PQR,pqr,pqrs


title: Clock skews on remote machines

text: I am performing some experiments on a network of about 10 remote Linux computers which are geographically scattered. I suspect some of them have clock skews but they are seen transiently (eg. once in a week or twice in a month). I was wondering if there exists some tools which could detect and quantify such clock skews. Also wondering if clock skew is the right term for what I am witnessing or could it be called clock synchronization.


How can I cat a directories files apending the file name to the row of text and removing the header row? So as to only have 1 header row in the all.txt file.


title: SUID permissions - Which is correct?

text: Trying to secure a Linux server and have little experience with SUID. After executing               find / -perm +4000      many programs were discovered. I have seen conflicting advice here and hereon what should be enabled and not. SUID Enabled   ` /bin/su   /usr/bin/passwd   /usr/bin/gpasswd   /sbin/unix_chkpwd ` SUID Disabled `   /usr/bin/crontab   /usr/bin/newgrp   /bin/ping   /bin/ping6   /bin/umount   /bin/mount   /usr/bin/chsh   /usr/bin/chfn   /usr/libexec/pt_chown   /usr/bin/sudo   /usr/bin/sudoedit   /usr/bin/chage   /usr/sbin/userhelper   /usr/sbin/usernetctl   /usr/sbin/suexec` UNSURE   `/usr/libexec/openssh/ssh-keysign   /sbin/pam_timestamp_check ` Server will host multiple sites with few Linux / SFTP users.   What should change? Also, how should I test?


title: selecting a field when you cannot count from the start

text: I have a long file ( 20000+ lines) where each of the lines is a description of a book:                book_number "title of the book" size type author_number      Where the element in quotes is a string with quotes and the others are numbers, except for type which is a single word:                23446 Raising Steam 537724 EPUB 4      I want to extract all the size fields but using cut you cannot use negative numbers to count from the back of the result of splitting with `-d " "`:                cut -d " " -f -2 books.txt      I cannot count from the front as the books may have any number of spaces in the title (I did not make up this format, I would have used CSV or JSON which require quoting). Am I missing some option that allows using `cut`? What else could I use to get the second-before-last field with a one line solution?


title: What tool can preview console font?

text: I don't know about the console font format, for a normal truetype font, I could use gnome-font-viewer to preview it, but what about console font? If I don't switch back to another tty, and use setfont command, is there a way to view it in X?


title: How to burn iso to a CF card?

text: Slax Linux installation file is only available in .iso format. How to burn it to a Compact Flash card? It also uses KDE, I think GNOME 2 or MATE might be more light weight. I want to install it on a one board computer, namely a PC Engine ALIX board.


title: How to search '(+1)' character substring in a string

text: I want to search for (+1) in a string (which is a GDG dataset name to confirm if it is a GDG) and want to get a binary answer if it has (+1) as part of the string or not. Can some one please help?


title: How to set up properly zram and swap

text: I'm configuring & compiling new 3.0 kernel. One of the goodies I planned to use for some time (by patching) that was merged into 3.0 is zram. Is it possible to set both hdd swap and zram swap so the zram is used first and only spilled pages are put into actual swap?


title: Is there a command to list all open displays on a machine?

text: When SSH'd locally into my computer (don't ask, it's a workaround), I can't start graphical applications without running:               export DISPLAY=:0.0      If I run this first and then run a graphical application, things work out. If not, it doesn't work, there's no display to attach to. Is there a command for listing all available displays (ie: all possible values) on a machine?


title: Copy files with permission 200

text: I want to recursively copy a directory, preserving file attributes, which contains a directory tree including some files that have permission 200 (i.e. `\--w-------`). The copy command `cp -ar sourcedirectory targetdirectory` skips those files, saying, for each one, something like this:               cp: cannot open `sourcedirectory/foo/somefile.bar' for reading: Permission denied`      **My question: without altering their permissions, how can I prevent the copy command from skipping those files?** _If you think I ought to use a utility other than`cp` in my copy command, please explain why._


title: Weight-based block IO control for VMs

text: I use KVM to manage my virtual machines. I am trying to limit the resources provided for VMs. I am able to limit the CPU and memory allocated for VMs using libvirt/cgroups. Now I want to control the disk time allotted for each VM by applying some weights. I looked at blkio control from cgroups. Since VM is just a Linux process, I will be able to use cgroups but I am not sure whether it will work for asynchronous IO too. If not, can someone suggest a good alternative solution?


title: How to parse options in a shell function to navigate multiple projects

text: I can use help with this bit of bash I am trying to write. The scripts purpose is to speed up my development while working with multiple projects. I labeled the parts that I have questions about in the code.               # is there a way to persist this through working enviornments besides this?     declare -x WORKING=`cat ~/.working`          #alias p='builtin cd $WORKING && pwd && ls'     alias pj='builtin cd $WORKING/public/javascripts && pwd && ls'          function pp {     echo `pwd` > ~/.working     }               # is there a way to close the scope of this function?     function p {            # how do I process flags here?       # -f and -d etc. can exist but may not       # either way I want $1 to be set to the first string if there       # is one                 if [ -z "$1" ]       then         echo '*'         builtin cd $WORKING && pwd && ls         return       fi                      BACK=`pwd`       builtin cd $WORKING            #f=`find . -iname "$1"`       f=( `echo $(find . -type d -o -type f -iname "$1") | grep -v -E "git|node"` )       #echo ${f[1]}            if [ -z "${f[0]}" ]       then         return       fi                 if [ -z "${f[1]}" ]       then         # how can I write this as a switch?         if [ -f ${f[0]} ]         then           vim ${f[0]}           return         fi         if [ -d ${f[0]} ]         then           builtin cd ${f[0]}           return         fi       else         echo "multiple found"       #for path in $f       #do       # sort files and dirs       #  sort dirs by path       #  sort files by path         #done            #  display dirs one color       #  display files another color       #     offer choices       #     1) open all files       #     2) open a file       #     3) cd to selected directory       #     4) do nothing            fi                # nothing found      builtin $BACK     }


title: Tell tcpdump to skip custom header

text: I have an IP packet with x bytes of custom header coming in on an interface. Is there a way to tell `tcpdump` or `tshark` to ignore the first x bytes and decode and display the IP packet? Any pointers would be helpful; I don't want to write a custom discector


title: man gives the error about locale

text: I have               $ locale     LANG=en_GB.UTF-8     LC_CTYPE=ru_RU.UTF-8     LC_NUMERIC=en_GB.UTF-8     LC_TIME=en_GB.UTF-8     LC_COLLATE=ru_RU.UTF-8     LC_MONETARY=ru_RU.UTF-8     LC_MESSAGES=en_GB.UTF-8     LC_PAPER=ru_RU.UTF-8     LC_NAME=ru_RU.UTF-8     LC_ADDRESS=ru_RU.UTF-8     LC_TELEPHONE=ru_RU.UTF-8     LC_MEASUREMENT=ru_RU.UTF-8     LC_IDENTIFICATION="en_GB.UTF-8"     LC_ALL=          $ locale -a     C     en_GB.utf8     POSIX     ru_RU.utf8      But `man` gives the error:               $ man     man: can't set the locale; make sure $LC_* and $LANG are correct     What manual page do you want?      If I set the `LC_ALL`, the error disappears:               $ LC_ALL=en_GB.UTF-8 man     What manual page do you want?      But I don't want to set `LC_ALL` because I set some `LC_` to the other locale. How to solve this problem with `man`?


title: Bash script for Angstrom

text: I have written a bash script to automate cross-compiling an OpenCV program:               echo "Compiling started for: $1"     if [[ $1 == *.c ]]     then         gcc -ggdb `pkg-config --cflags opencv` -o `basename $1 .c` $1 `pkg-config --libs opencv`;     elif [[ $1 == *.cpp ]]     then         g++ -ggdb `pkg-config --cflags opencv` -o `basename $1 .cpp` $1 `pkg-config --libs opencv`;     else         echo "Only c or c++ files"     fi     echo "Output: ${1%.*}"      But now I noticed that there does not exist a bashrc at the Angstrom distribution. So what can I do? Regards


title: Determining what process is bound to a port

text: I know that using the command:               lsof -i TCP       (or some variant of parameters with lsof) I can determine which process is bound to a particular port. This is useful say if I'm trying to start something that wants to bind to 8080 and some else is already using that port, but I don't know what. Is there an easy way to do this without using lsof? I spend time working on many systems and lsof is often not installed.


title: Print specific Exif image data values with exiv2

text: How do I print the image Exif date with a tool like exiv2? My goal is to write the image year and month into separate variables. Do I really have to parse the output with regex or is there a alternative to something like this:               exiv2 DSC_01234.NEF -ps | grep 'Image timestamp' | ...regex to parse the date


title: Find both regular files and directories

text: How can I tell ( if I can tell !) find to find files of both the directory and file type?               find -type fd      _It is like the heuristic dark ages up in here._


title: Resume from Suspend/Hibernate issues

text: I have a peculiar problem while trying to resume from both suspend and hibernate. I believe the problem to be within the kernel itself since I have tried different distros (Ubuntu, Suse, Mageia) on different kernel version (12,13,16) with different GPU drivers. Suspend works, if for a short time. If the machine is asleep for a long duration (shortest I've seen is 90 minutes but may be less) it will not resume. When I say won't resume I don't mean the usual power on but no screen, I mean the chassis fan LED will flash once and nothing will power up. In addition, neither the reset button nor holding the power button work. I have to physically cut the power, wait for the capacitors to discharge then power on. All of the suspends are issued from the shell (not GUI) using pm-suspend. I've tried the pm_trace method, looked into the logs and found a "Magic number" but there was no "hash matches" entry. I've tried adding ALL modules to `/etc/default/acpi-support` and the problem persists. It's almost as if the system clock is overwriting something. My system specs: Asus M4A78LT-LE mainboard with latest BIOS. ATI Radeon HD6790 GPU. AMD Phenom 2 X4 965 Processor **Update:**   I now need to try a custom kernel as stated in this ubuntu reference to detect if the BIOS is jumping back into the kernel. To do this I need to modify the `arch/x86/kernel/acpi/wakeup_64.S` file to emit a series of system beeps. The problem, I do not know Assembler. I need this for the 3.13.0 kernel, which I know to work on my system, and targeted for AMD 64. If the problem is indeed the BIOS not jumping back, how might I correct it?


title: Cancel auto-fill in Emacs

text: When using Emacs (version 24.1 if that makes any difference), I would like to have a way to remove all the automatic line breaking inserted by the `auto- fill` minor mode. Disabling `auto-fill-mode` is enough to avoid inserting new automatic line breaks, but does nothing about cancelling the existing ones. I found a way to do what I want, but I wonder if it's the best way to go about it. I'm describing it here with the hope that it'll help explain my issue better:   * `C-u 1000 C-x f`: Set the `current-fill-column` to an arbitrary large value.   * `C-x h`: Select all text in buffer   * `M-q`: Re-arrange line breaks according to the new `current-fill-column` value. If the value is large enough, this will emulate the behavior I'm looking for.   * `M-x auto-fill-mode`: Disable Auto Fill mode. I'm relatively new to emacs, and I seriously wonder if this is a good way to go about it or whether there's a better way.


title: x11vnc window manager

text: I am using `x11vnc` and started it so it created the X server by itself like this:               x11vnc -localhost -rfbauth -create /root/.vnc/passwd       But the VNC session created, does not have a window manager, just an `xterm` in the upper left corner. How can I specify one? By the way, is there a way to automatically stop the X-Server if I disconnect from `x11vnc`, so this essentially works as `X` on demand?


title: Configuring OpenVPN to use Firewalld instead of iptables on Centos 7

text: I need some help configuring OpenVPN on Centos 7 using `firewalld`. I used iptables on Centos 6.5 and only had to add the following lines to `/etc/sysconfig/iptables`:               -A POSTROUTING -s "10.0.0.0/24" -o "wlan0" -j MASQUERADE      -A FORWARD -p tcp -s 10.0.0.0/24 -d 0.0.0.0/0 -j ACCEPT      run the command: echo 1 > /proc/sys/net/ipv4/ip_forward      open port 443.


title: Unique lines based on the first field

text: How can you find unique lines or duplicate lines in a file based on the content of the first field, or the first n characters ? The uniq command on OS X lacks the `-w` switch that is available under Linux: `-w, --check-chars=N : compare no more than N characters in lines`, which solves the problem. Can it be done without reimplementing `uniq` in awk ? The number of fields is not constant. I would like to use only default tools installed on OS X. I use Macports a lot, but in this case, I don't want to use them.


title: How to "send" variable to sub-shell?

text: I run the following script:               VAR="Test"     sh -c 'echo "Hello $VAR"'      But I get :               # ./test.sh     Hello      How can I "send" the variable `VAR` of my script to the shell created with `sh -c`?


title: What kind of support/options are there for switchable graphics on linux?

text: I've been trying to breath new life into my brothers Lenovo t400, but it has both integrated and discrete graphics (AMD and Intel respectively). When I install any form of Linux, both cards run, making the the whole thing burning hot. I've searched for answers, but most require some command line voodoo after every start; my brother isn't the most technically minded, so I am trying to make it as easy as possible for him. Also, most of what I've found hasn't been update for a few years, so I don't know if its still applicable. Has there been any new support for switchable graphics lately that I can take advantage of?


title: configure postfix to accept mail from two WANs

text: I have a mac server but my question has long left the realm of the GUI. My last hope is a unix forum. I have a cisco router with two WAN ports. The mac uses postfix 2.8.3. I have correctly configured the port forwarding for in this case port 25. When I however try to open a telnet session from an external host to the IP addresses of my WAN ports using port 25, I only get a postfix reply on WAN1. WAN2 gives me an "Unable to connect to remote host: Connection time out". If I however have WireShark running I can see that the router forwards the request, but postfix just doesn't seem to "pick up". I reviewed my main.cf and there was nothing that suggested that postfix should be picky which WAN it wants to use. inet_protocols is set to all and I even tried adding the static ip addresses of each of my WAN ports to the my networks variable. I can't seem to get it to work though - does anyone have any tips where I can look next? Thanks


title: Use an USB tethered phone as network adapter

text: I am running CentOS 6 and was able to tether my HTC phone using a proxy called proxoid . This allows me to redirect HTTP. But how do I redirect the entire TCP traffic, e.g. if I need to setup openvpn connection to my VPN server? It seems it can be done because software similar to proxoid (exactly same principles, e.g. easytether), which sets up network adapter. I couldn't find anything on internet perhaps because I don't have the right keywords - maybe this is a virtual network adapter that I am trying to setup?


title: Querying a remote POP3 Mail server using BASH

text: I'd like to connect to our mail server via POP3, look for a certain pass phrase in the subject and if found then run a script. How can I achieve this with BASH other than awkwardly scripting Telnet? Thanks!


title: How does traceroute resolve names?

text: While writing a script, I wanted to reference a machine by the computer name that I gave it (e.g. "selenium-rc"). I could not ping it using "selenium-rc", so I tried the following commands to see if the name was recognized.               > traceroute 192.168.235.41     traceroute to 192.168.235.41 (192.168.235.41), 64 hops max, 52 byte packets      1  selenium-rc (192.168.235.41)  0.545 ms  0.241 ms  0.124 ms      Ok, traceroute "found" the name. How? Next ...               > traceroute selenium-rc     traceroute: unknown host selenium-rc      Hmm ... the lookup mechanism here must be different because the host is unkown. I'm assuming this is using a system name resolution process whereas the first example was using a process specific to traceroute. Correct? Then when I came back a bit later ...               > traceroute 192.168.235.41     traceroute to 192.168.235.41 (192.168.235.41), 64 hops max, 52 byte packets      1  minint-q4e8i52.mycorp.net (192.168.235.41)  0.509 ms  0.206 ms  0.136 ms      Ok, different result. The "selenium-rc" name did not change on the machine itself, but the traceroute name resolution process must include some sort of priority and now gives a presumably more authoritative result assigned by another system/service on the network. (Unfortunately, I'm assuming it's a dynamic name that I do not control, and thus it would not be useful in a script.) Can someone explain the results?


title: Test for a particular file format

text: This is a followup to Normal looking text file, detected by file as ASCII Pascal program text It seems `file` can't be trusted all the time. It seems possible that a particular file may be detected as having both `encoding/format1` and `encoding/format2`. `file` tells me it's `encoding/format1`, but I need to check, whether it also satisfies the constraints of `encoding/format2`.   * Is there a way to do that?   * Is there a way I can ask "Check if this file follows the rules of ASCII English Text (or _some other encoding_ )" and the answer will be "yes" or "no"?


title: Why VNC performance seems to have dropped over the years?

text: I've been using VNC since around 2000 (even earlier), back then I used a 19k cellular modem to connect to my desktop.   Lately I've been connecting to my Ubuntu desktop from my Android phone.   It seems to me that it works more slowly. Why is that? I believe that the connection speeds increased much faster than resolutions (I'm on 1920x1080) and frame rates since then.   Am I underestimating the load that the higher resolutions add to the bandwidth required?   Could it be because back then I used TightVNC and now I'm using Vino? Can something be done to make my remote X session bearable? I read about other technologies (such as NX and SPICE) but from what I understood, they can only be used with separate X sessions and not to take over an existing one (did I miss an option that does).


title: How to have service that makes sure program keeps running?

text: I made a service called `thin_keep_alive_service` in `/etc/init.d`. I gave it `chmod +x` rights. The script looks as follows:               #!/bin/bash          ### BEGIN INIT INFO     # Provides:          thin_keep_alive_service     # Required-Start:    $local_fs $network     # Required-Stop:     $local_fs     # Default-Start:     2 3 4 5     # Default-Stop:      0 1 6     # Short-Description  Keeps Thin servers running     # Description:       This service checks every 30 seconds if at least      #                    two light weight thin web servers are alive and      #                    restarts them all from the bundle if not.     ###END INIT INFO          while true     do         # Store an array of the pids of thin         thin_pid_arr=($(pgrep -f thin))              # When there are less than two Thin servers left we reboot them all         if [ ${#thin_pid_arr[@]} -lt 2 ]; then             cd /root_to_app && bundle exec thin -C /etc/thin/app.yml restart         fi              #Wait 30 seconds before checking again         sleep 30     done      It does work when I run it as `service thin_keep_alive_service start`. But it does not run in the background continuously after startup, since my two servers die after a while and no new ones are rebooted. How to make sure it runs in the background?


title: Allow audio from only one application

text: I'd like to only allow audio from a certain application. That is, I'd like to have audio turned off by default for new programs. I'm aware that in PulseAudio one can mute programs, but the problem is that (for me) new programs always begin unmuted.


title: How to securely automate running commands as root with "sudo su -"?

text: hint (on client side, how to encrypt files/pwd's):               # encrypt pwd with ssh key:      openssl rsa -in ~/.ssh/id_rsa -outform pem > ~/.ssh/TEMP-id_rsa.pem 2>/dev/null     openssl rsa -in ~/.ssh/id_rsa -pubout -outform pem > ~/.ssh/TEMP-id_rsa.pub.pem 2>/dev/null     echo $PWDHERE > ~/.ssh/TEMP.pwd     openssl rsautl -encrypt -pubin -inkey ~/.ssh/TEMP-id_rsa.pub.pem -in ~/.ssh/TEMP.pwd -out ~/.ssh/TEMP.pwd.enc 2>/dev/null     rm ~/.ssh/TEMP.pwd > /dev/null 2>&1          # decrypt:      PWDHERE=`openssl rsautl -decrypt -inkey ~/.ssh/TEMP-id_rsa.pem -in ~/.ssh/TEMP.pwd.enc`      So.. it would be a very easy task to automate running commands via SSH on servers with the root user on server side (in the end we need to run a script from a desktop machine on server side with root user, but running a command automated would be enough to know, from there we could do the thing..). BUT: the **Question is** that how to securely automate running commands with root if we have to "sudo su -" first on the server, and give password in it? UPDATE: modifying the sudoers file is not an option. (maybe puppet can do this??) UPDATE#2:               echo myPassword | sudo -S ls /tmp      isn't secure AFAIK. (because if other users 'ps -ef' they could see the pwd for a little time?) So that's not a solution either. UPDATE#3: I want to do "Remote control a machine(s) with ad-hoc commands"


title: output in json form

text: The following command gives memory usage into normal form.               awk '/^Mem/ {printf("%u%%", 100*$3/$2);}' <(free -m)      I want to get it in valid json form. **Desire output:**   Example:               {"Memory":"80"}


title: Where is the printer default option configuration file?

text: I am using CUPS 1.6.1. I have a problem with printing the pages with one side only. Default option is "one-sided", as in the CUPS web interface configuration. But when I do the printing, it prints out "two-sided-long-edge" result. I want to configure it manually. Where is the exact configuration file location? Whenever I make the changes from the CUPS web interface for default options, the /etc/cups/printers.conf time is modified, but content is not changed. But in the web interface, the default option is changed. Which file is the default options configuration?


title: How to Wrap a file with Tags in Bash

text: I have an `xml` file named `test.xml`, without a root tag like this:               <cat></cat>     <name></name>     <id></id>     <cat></cat>     <name></name>     <id></id>      How can I wrap this file with a root tag to make the output look like this:               <root>       <cat></cat>       <name></name>       <id></id>       <cat></cat>       <name></name>       <id></id>     </root>


title: Other than Alt + Shift to switch keyboard layout, any other Xorg key combinations?

text: All I can find about XkbOptions was:               Option "XKbOptions" "grp:alt_shift_toggle"      Seems I can only use `alt`+`shift` combination to switch keyboard layout, any other keys that I can use ?


title: How can I move framebuffer or X screen relative position?

text: A long time ago ~~in a galaxy far, far away~~ I had fixed boot screen using this nice solution. Since that time I have been looking for the way to move framebuffer in virtual console slightly to the right and down, relatively to X screen position (or vice-versa), because it is shown in wrong position, and part of symbols cannot be seen. I reproduced look and feel of this problem using Crop tool and `fbgrab` command: ![Console Screenshot](http://i.stack.imgur.com/i79Mt.png) The GRUB menu also hides it's left side behind the screen, but I don't know how to make screenshot there without VirtualBox (and I doubt this screenshot will be useful). However, the main X screen shows itself on the correct place (as it seems to me), and my monitor (ACER AL1916) always autotunes to this position, even if virtual console is shown. I looked in many sources including AskUbuntu, but have found only one solution: switch from VGA cable to DVI, which it is not acceptable, because my graphic card (NVIDIA 6150SE) has only VGA port onboard. I also found that `fbset` command can adjust screen parameters but need help for getting how does it work. Here is the output of `sudo fbset` command:               mode "1280x1024-77"         # D: 131.096 MHz, H: 80.328 kHz, V: 76.649 Hz         geometry 1280 1024 1280 1024 32         timings 7628 160 32 16 4 160 4         rgba 8/16,8/8,8/0,8/24     endmode      UPD: during reporting non-affected bug found one line that says:               .proc.driver.nvidia.warnings.fbdev:      Your system is not currently configured to drive a VGA console      on the primary VGA device. The NVIDIA Linux graphics driver      requires the use of a text-mode VGA console. Use of other console      drivers including, but not limited to, vesafb, may result in      corruption and stability problems, and is not supported.      So, does anyone know how to adjust position of Virtual Console or X screen relatively to each other?


title: Telnet login prompt very slow on Static IP only, possible rDNS issue?

text: I've switched my CentOS machine from DHCP to static routing, using telnet to connect to it has gone from practically instantaneous, to taking around 30 seconds for the initial login prompt to display. Apparently, this has something to do with the server doing a reverse DNS lookup to figure out who is connecting to the box, which relies on the hosts file. Should I add something to /etc/hosts to speed up the process? My file is extremely limited right now, this is pretty much a fresh install.               [root@Azaz07]# cat /etc/hosts     127.0.0.1       localhost.localdomain localhost     ::1     localhost6.localdomain6 localhost6      Telnet0 done locally responds right away.


title: How to kill two or more processes with one kill command?

text: I am using the following command to kill one java process via shell script: > pidof java|xargs kill -9 $1 What if the list of `pidof` output has more than one elements? How do I kill them both with the same one command?


title: Creating a bootable Linux installation USB without unetbootin

text: I want to install Scientific Linux from USB. I don't know why unetbootin doesn't work but I am not curious to find out: after all, I transferred to Linux from Windows to see and learn the underlying procedures. I format my USB drive to FAT32 and run this command as root:               # pv -tpreb /path/to/the/downloaded/iso | sudo dd of=/path/to/the/USB/device       While it works for Live-CDs or network installs (that are less than 1GB) it doesn't work for the actual installation DVDs that are about ~4GB. I would be really grateful if anyone can help me fix this problem. Considering the fact that it works for smaller .iso files, I guess it has to do with the File System, am I correct? What other options do I have?


title: What command can be used to force release everything in swap partition back to memory?

text: What command can be used to force release everything in swap partition back to memory ? Presume that I have enough memory.


title: How can I find available network interfaces?

text: This is in regard to linux, but if anyone knows of a general *nix method that would be good. I booted a system yesterday with an ethernet cable plugged in. "NetworkManager" is not installed, so once it started I went to look for the name of the ethernet interface with `ifconfig` to start a DHCP client manually, but it did not show anything other than `lo`. The NIC was listed via `lspci`, and the appropriate kernel driver was loaded. The system normally uses wifi, and I could remember the interface name for that was `wlan0`. When I tried `ifconfig wlan0 up`, `wlan0` appeared. But the only ethernet interface names I could remember were `eth[N]` and `em[N]` -- neither of which worked. This document refers to "predictable interface names" but does not do a good job of explaining what they might be in simple terms. It does refer to a piece of source code which implies the name in this case might be deduced from the the PCI bus and slot numbers, which seems like an unnecessarily complicated hassle. Other searching around led me to believe that this might be determined by `systemd` in conjunction with `udev`, but there are almost 100 files in `/usr/lib/udev/rules.d` and spending an hour trying to determine where (and _if_ ) there's a systemd config file for this also seems ridiculous. It would also be nice to know for certain that they are available, not just how they might be named _if_ they are, so I can rule out hardware problems, etc. **Isn't there a simple way to find the names of available network interfaces on linux?**


title: Send a specific signal to an external USB keyboard? Or, how do I fix fdopen()?

text: Some background: I'm trying to make the caps lock light on an external keyboard light up on-command when I run a command from the command line. Ideally it would be scriptable, so that I can use it for alerts and things (I disassembled the keyboard). I got this command which looks like it should work:               fd=fdopen("/dev/console"); ioctl(fd, 0x4B32, 0x04);      When I try to run this command on either OS X or on a Ubuntu server I have laying around, this happens:               me@server1:~$ fd=fdopen("/dev/console"); ioctl(fd, 0x4B32, 0x04);     -bash: syntax error near unexpected token `('     me@server1:~$ fd=fdopen(/dev/console);     -bash: syntax error near unexpected token `('      So it looks like the problem is in the first part. Do I need to install a set of software/utilities? How can I manually control the caps lock light on my external keyboard?


title: What is log_daemon_msg ?

text: I was looking through `/etc/init.d/ssh` to get an idea of how a "proper" sys daemon is run at boot (I'm trying to add `svnserve` to that list). I saw this `log_daemon_msg` used as a command, but I have no idea what it is ? `which log_daemon_msg` and `man log_daemon_msg` came up empty. ### Example:               log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true     if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then         log_end_msg 0 || true     else         log_end_msg 1 || true     fi      How does that work? I tried goggling around, but the only things I could were questions about where it records its messages, which is useless since I hardly know how to use it or what it even is - a command, a builtin, or something else ?


title: Combined su and screen at startup

text: I want to start a long running custom script at boot. The script must run under a specific username. So far I have successfully used the screen command and switched to the user in the custom script. But I rather have the screen command run under that user so that I can later login to that user and resume the screen. This one does work when run as root in the console but it does not work as a line in a startup script. su -c "screen -S sessionname -d -m /path/cot/bash/script" username


title: Build, link processes in linux

text: I'm newbie to linux. I'm not able to get difference between build and compile. Are they same? how exactly linking works? What exactly .so file and .o file contains and how I am supposed to use them? These all files I see everyday but I don't know exactly what they contain. Can anyone suggest some tutorial to clearly tell these processes?