title: How do you change the root password on Debian?

text: I want to change the password I assigned to root on my Debian webserver to something longer and more secure. Bit of an obvious newbie question, but how do I do that? I haven’t forgotten/lost the current password, I just want to change it.


title: What params do I pass to grep to return only file names?

text: I'm trying to use grep to find a specific piece of text in a bunch of files on my web server. No problem, except that it returns way more information than I want! Ideally it would just return a list of files, and if the text exists in more than one place in the file it would only list the file name once. Currently I'm using something like this:               grep -ir essay_ "mysite"      to do a case-insensitive recursive search for the word essay_ in all directories of my site. What it returns is something like this:               mysite/dot/contest_declaration.php:$questions = $db->get_results("SELECT * FROM dot_essay WHERE active = 1 order by display_order asc");     mysite/dot/contest_declaration.php:     $db->query("DELETE FROM dot_essay_xref WHERE entry_id = $svar_entry_id");     mysite/dot/contest_declaration.php:     $id = $question->essay_id;     mysite/dot/contest_declaration.php:     $answer = ${"essay_$id"};     shoppermarketexpo/dot/print_declaration.php:        $questions = $db->get_results("SELECT * FROM dot_essay WHERE active = 1");      What I'd like to get back is:               mysite/dot/contest_declaration.php     mysite/dot/print_declaration.php


title: chroot jail that can access the filesystem

text: chroot jails seem to be simply a different world, with no interaction with the actual filesystem. Thus, the entire environment has to be replicated inside the chroot, which would mean making a full installation of a system inside it. However, is there some way to make the chroot jail have read access to the main filesystem? Additionally, I would also like to have the ability of the chroot preferring its own files. For example, if `/usr/bin/wget` exists within it, then that should be preferred over the system's `/usr/bin/wget`. (I'm actually looking for something that behaves like Sandboxie.) Is the above feasible?


title: merge pcap files

text: I'm trying to merge 15 pcap files using wireshark. The merging is successful. I'm using appending function so that the second file is just added to the bottom of the first file. But when this is done, I get -ve value in time column. How can I change this? What I intend to do is, replace these 15 smaller files with this one merged files. ![enter image description here](http://i.stack.imgur.com/BnfzO.png)


title: How can I search history with what is already entered at the prompt in zsh?

text: In zsh, I know that I can search history with `Ctrl`+`r`. However, oftentimes I start to type a command directly at the prompt, but then realize I should be searching history. When I hit `Ctrl`+`r`, it brings up a blank history search prompt like this: ![history search prompt not pre-filled](http://i.stack.imgur.com/BbABO.jpg) Notice how there is text at my prompt but not at the history search prompt. How do I start the history search with the text already in the prompt, so it looks like this: ![history search prompt pre-filled](http://i.stack.imgur.com/D012k.jpg)


title: Cannot authenticate Admin account in Linux Mint

text: On the "User Accounts" settings in Linux Mint, I changed the settings so that the Admin account didn't require a password. To change any settings I have to click the unlock button and type in a password. However, as I removed the password for the only account I now cannot change the settings. How can this be fixed?


title: PPTP server with NIC aliases

text: I have set up a VPN on a VPS Server using PPTP. I have one NIC with two aliases.   * eth0   * eth0:1   * eth0:2 The 3 interfaces have public addresses. `eth0` is a French IP, `eth0:1` is UK, and `eth0:2` is American. I have tried configuring IP forwarding and IPtables, but the users traffic is always routed to `eth0`. When I set up a user to use `eth0:1` to use the UK IP, the user was able to connect but there is no traffic. I want to be able to assign a user to an interface that they might use to access a specific service.


title: tar files from another directory without copying them

text: This should be very simple for experts in here. I have a Linux account with user disk quota of only 6GB. There is some data- folder in `/opt` with about 3GB of data with when compressed comes up 1GB. There are some symbolic links within `data-folder`. Usually for taking a work backup I used to do the following.               cp -rvfL /opt/data-folder ~/     cd ~/     tar -zcvf data-folder.tar.gz data-folder     rm -rvf data-folder      Now I have already consumed 2.5GB in my user disk quota, I have just enough space to copy files to my home, but not to `tar` it again. Is there any way to tar and copy the folder with in a single command, say by using a pipe. P.S. I cannot tar in `/opt` because I have only read access to `/opt`.


title: Configure reboot on Linux kernel panic

text: You can put "panic=N" on the kernel command line to make the system reboot N seconds after a panic. Is there a config option to specify this (other than the default kernel command line option)?


title: Center Mutt pager horizontally

text: Is there a way to horizontally center emails when reading them in a larger terminal using mutt? I'm not interested in centered justification of the text in the email, but I am interested in forcing the block of text to be left- aligned, 78 characters wide and centered in a 120 character terminal. For example, right now I have something that looks roughly like this:               +------------------------------------------------------------------------------+     | This is an email displayed in mutt.                                          |     | Let's say it's 78 characters wide,                                           |     | even though it's clearly not.  Let's                                         |     | also pretend that the width of this                                          |     | box is 120 characters, which is                                              |     | also not true.                                                               |     +------------------------------------------------------------------------------+      Is there a way to configure mutt's pager so that it looks closer to something like this:               +------------------------------------------------------------------------------+     |                     This is roughly centered text that's                     |     |                     left-aligned and (let's pretend) also                    |     |                     78 characters wide.  I'm not worried                     |     |                     about perfection as much as I am just                    |     |                     getting the text closer to the middle                    |     |                     of the screen.                                           |     +------------------------------------------------------------------------------+      I've searched the standard documentation, but I haven't found anything. Should I use something other than the default pager to get this effect?


title: Bash globbing of multi-part argument

text: Below are some examples of a `find` command I'm trying to run. I'm looking for different ways that I might be able to use globbing to generate (as an example) a find command with predicates joined together. Doesn't work because `find` needs a -name before each one and a -o between each.               find . -name \*.{sh,pl,sql}     #find . -name *.sh *.pl *.sql      Doesn't work because of trailing `-o`. Could pull a guaranteed to fail argument there, but not ideal. Also, my shortcut is now longer than my output.               find . `for X in {sh,pl,sql}; do echo -name \\\*.$X -o ;done`     #find . -name \*.sh -o -name \*.pl -o -name \*.sql -o      Fails because they're grouped as one argument (`find: unknown predicate '-name *.sh'`). Also, still exhibiting a lack of joining with -o.               find . -name\ \*.{sh,pl,sql}      Works, but doesn't involve globbing (re: non-answer):               find .  -regex '.*\(sh\|pl\|sql\)'


title: How can I tunnel traffic for a NATted host to another server?

text: I have a device on my private network which I don't wish to allow to directly access the internet from my gateway. Instead, I want to tunnel that traffic from my gateway to another server (also mine) and have the traffic appear to originate there. My gateway is a smoothwall firewall and the other server is a ubuntu server. I'm hoping there's a solution that will divert all traffic from a given MAC through the tunnel to the remote server... but any solution that will accomplish this is welcome.


title: learning to output custom rsyslogs

text: I've installed `rsyslog`. I want to log why my server is refusing to show my index page in the browser in               /var/log/browser.log      Should it be listening on a standard port? I can see `netstat -tpan`. To be frank I need a good tutorial to set this up with editing `rsyslog.conf` as I am more familiar with coding than SSH Unix commands. * * * The logs error and access were handled by `virtualmin`. I uninstalled `virtualmin`, so that I could learn how to secure the server with pure config files. Running `yum list installed` shows `httpd-tools.x86_64` highlighted in yellow as well as the webpage not being available - `ERR_CONNECTION_REFUSED`.


title: How to insert text after a certain string in a file?

text: Right now I'm using `echo "Hello World" >> file.txt` to append some text to a file but I also need to add text below a certain string let's say "[option]", is it possible with `sed`? EG: Input file               Some text     Random     [option]     Some stuff      Output file               Some text     Random     [option]     *inserted text*     Some stuff


title: What permissions should I set for an executable I'm likely to share?

text: I'm writing a bash script that does a little house-cleaning for me (clearing the log files from any Rails projects in the current directory). I'm making it executable, and I'm not sure what best practice dictates as far as setting the "group" and "others" file permissions. Should I just set permissions to 700 (only the owner can rwx)? Part of my confusion is how "ownership" is determined when a file is copied from one system to another. If my UID is 509 and I set `my_file.sh` file- permissions to 700, I'm guessing the file-ownership is determined by storing a UID on the file. If I share `my_file.sh` and someone downloads it to their system, does the UID get changed to match their own? Does it depend on how the file is transferred (scp, git, http, etc.)?


title: Preparing a Linux image in a virtual machine

text: I am trying to set up a system to prepare a Linux system on a virtual machine and then deploy it onto an SD card. The target system has an Atom processor, so there aren't architecture compatibility concerns. **Do any of the mount points have to be in a special, physical location for this to work or can GRUB grok the filesystem?** **How do I set up the SD card to boot this system using GRUB?** Would it be better to rsync the filesystem over or dd a filesystem image? I much prefer the former because I don't have to change my VM much when going between different card sizes. EDIT: I assume that I'll have to prepare the card before hand using something like parted, then I'll have to install GRUB to it, which isn't a big deal. The major question is, **will GRUB find the kernel if it isn't in a guaranteed, physical place on the partition?** In other words, is GRUB smart enough to read an ext2, ext3, or ext4 partition and find the appropriate mount points? My disk will look something like this (2 partitions): [GRUB] [grub loader stuff] [GRUB partition] [OS partition]


title: Can gdb debug suid root programs?

text: I wrote a program that calls `setuid(0)` and `execve("/bin/bash",NULL,NULL)`. Then I did `chown root:root a.out && chmod +s a.out` When I execute `./a.out` I get a root shell. However when I do `gdb a.out` it starts the process as normal user, and launches a user shell. So... can I debug a setuid root program?


title: Bonding wireless and 3g on Fedora 15

text: I have access to the internet through either wireless or a 3G CDMA card. Is it possible to bond both connections and join the bandiwdth and have a failover?


title: What's the standard used by yum prompt "Is this ok [y/N]:"?

text: I can see that uppercase letter means default here. Is there a standard for this? I'd like to read the full standards.


title: Corosync & Pacemaker IPTables Rules

text: When using Corosync with two rings via multi-cast addresses 226.94.1.1 (Port 5405) & 226.94.1.2 (Port 5406) what iptables rules are required to allow two nodes to communicate optimally without giving any undue access and making the rules too lenient? I currently have:               iptables -A INPUT -p udp -m multiport --dports 5404,5405,5406 -j ACCEPT      Will that allow all the communication a Corosync/Pacemaker setup requires for both rings? I have heard arguments that something like:               iptables -I INPUT 1 -m pkttype --pkt-type multicast -j ACCEPT      is required. However I cannot seem to replicate a situation where this assists if the first rule I listed above is already in place. The Red Hat documentation would seem to support the first approach. There is some IBM documentation espousing the second but is it just a case of a rule that is far too lenient when the first would do the job equally well whilst leaving no unnecessary ports open? I'm leaning more towards the first rule being sufficient but wanted to get some more opinions on the matter.


title: How to show the CUPS printer jobs history?

text: I am printing some files from a remote computer to a network printer with the lpr command. It apparently worked, but some minutes later when I typed lpstat or lpq, the job had already disappeared, it had probably already printed the file. Is there a way to check the history or the log of my successfully completed jobs in the printer queue?


title: Newly compiled kernel not booting up (vanilla kernel 3.12.14)

text: I downloaded, configured and installed kernel downloaded from kernel.org. While booting up this new kernel for the first time, this error screen shows which is pointing towards a missing or wrongly mentioned root device probably. But I didn't mention it explicitly, installation scripts did it. So if this is the error, can someone please tell how to fix? Or if the cause may be something else, please tell what it can be? NOTE: I am using VirtualBox for all this process. Don't want my laptop to become unbootable for this experiment.![enter image description here](http://i.stack.imgur.com/pqPMi.jpg) NOTES:   1. Grub entries are fine, as it is same for another kernel running on this system and other kernel is working fine.   2. DEVTMPS is just creating a warning, I think programmers care about errors only, not warnings, so hopefully this is not the major cause as well.   3. TSC is giving an error, I investigated, it is probably a clock mode, nothing very related to root device.   4. Again UUID is not an issue, because other working kernel grub entry is using same ID and booting up correctly.


title: Blurry image between Radeon / DVI-to-HDMI / LG LCD monitor

text: I've got an ATI Radeon (not sure exact card; forgot to write it down when I left this morning; will update when I get back) and it is connected to an LG IPS237L 23" IPS LED monitor. As you can seen in the xrandr output below, the resolution is currently set to 1920x1080. The monitor's information panel indicates this as well. The auto- adjustment is disabled as it's connected via HDMI, so the only thing I can really adjust is turning the over-scan on. It helps a little, but the text is still blocky and the output doesn't extend to the end of the screen. It's almost as if 1920x1080 wasn't the monitor native resolution, but everything I've found on the monitor indicates that is the native resolution. I'm using a DVI-HDMI cable, but that really shouldn't make any difference since they both use the same TMDS protocol. What am I missing here? ![Photo of Screen](http://i.stack.imgur.com/mMqGL.jpg)


title: Where is the cron information stored on my gentoo system?

text: I have a Linux gentoo system, which performs a cronjob every day at 3:10 in the morning. However, no file in `/etc` contains any related information to this particular cronjob, and the result of `crontab -l` is               # check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly     MAILTO=""     0  *  * * * rm -f /var/spool/cron/lastrun/cron.hourly     1  3  * * * rm -f /var/spool/cron/lastrun/cron.daily     15 4  * * 6 rm -f /var/spool/cron/lastrun/cron.weekly     30 5  1 * * rm -f /var/spool/cron/lastrun/cron.monthly     */10 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons      The directory `/etc/cron.daily` probably contains the job in question, but for a time at 3:01! Why is that? Is the actual cronjobn stored somewhere else? Does it take gentoo 9 minutes to realize to execute a job? Additional information:   * I have a different crontab job for 13:20 (in cron.d) which is executed exactly at 13:20 every day.


title: How to batch convert bitmaps to SVGs?

text: I have many gray scale bitmaps that I need to convert to a vector format, such as SVG. I have been using Inkscape, which gives nice results, but this takes about 10-15 minutes to open, convert, and save a file. Is there a batch or command line tool that can convert these?


title: Manage only a section of a config file with Puppet (multiline file_line)

text: There is a config file e.g. /etc/network/interfaces. I want to manage only a certain section of that file using Puppet. Example:               # At the beginning at least is some dynamic content that can be different     # from machine to machine and changed by an admin manually     auto eth0     iface eth0 inet static         address 192.168.108.5         netmask 255.255.255.0          # BEGIN PUPPET WLAN0     allow-hotplug wlan0     iface wlan0 inet static         address 192.168.109.5         netmask 255.255.255.0     # END PUPPET WLAN0          # Potentially more stuff that I do not want to touch through Puppet     # But could be static if it makes it more easy. E.g. simply force sections to end of file.      The stdlib file_line resource is very close to what I need. A regex and content to replace a match with. However, unfortunately, there is no way to make file_line match over multiple lines and replace with new content. Alternative 1: create a bash script: ugly Exec resources and temp files. Alternaitve 2: Use Augeas: seems overkill for a simple search & replace. Is there another module than stdlib that allows me to do a regex match & replace over multiple lines? Any other handcraft solutions better than juggling temp bash script and Exec resource?


title: Asrock H61M-ITX sensors

text: I just installed a small home server with Ubuntu 12.04.01 but I have a problem with the fan that run on full all the time. The server specs are:   Linkworld Mini ITX 920-01   Asrock H61M-ITX mITX USB3 SATA6   i3 2120 3.3Ghz 3MB Output from `sensors` shows               $ sensors     coretemp-isa-0000     Adapter: ISA adapter     Physical id 0:  +41.0°C  (high = +82.0°C, crit = +102.0°C)     Core 0:         +41.0°C  (high = +82.0°C, crit = +102.0°C)     Core 1:         +41.0°C  (high = +82.0°C, crit = +102.0°C)          nct6776-isa-0290     Adapter: ISA adapter     Vcore:         +0.97 V  (min =  +0.00 V, max =  +1.74 V)     in1:           +0.22 V  (min =  +0.00 V, max =  +0.00 V)  ALARM     AVCC:          +3.44 V  (min =  +2.98 V, max =  +3.63 V)     +3.3V:         +3.42 V  (min =  +2.98 V, max =  +3.63 V)     in4:           +0.55 V  (min =  +0.00 V, max =  +0.00 V)  ALARM     in5:           +1.74 V  (min =  +0.00 V, max =  +0.00 V)  ALARM     3VSB:          +3.42 V  (min =  +2.98 V, max =  +3.63 V)     Vbat:          +3.49 V  (min =  +2.70 V, max =  +3.30 V)  ALARM     fan1:            0 RPM  (min =    0 RPM)  ALARM     fan2:         2673 RPM  (min =    0 RPM)  ALARM     fan3:            0 RPM  (min =    0 RPM)  ALARM     fan4:            0 RPM  (min =    0 RPM)  ALARM     fan5:            0 RPM  (min =    0 RPM)  ALARM     SYSTIN:        +39.0°C  (high =  +0.0°C, hyst =  +0.0°C)  ALARM  sensor = thermistor     CPUTIN:       +127.5°C  (high = +80.0°C, hyst = +75.0°C)  ALARM  sensor = thermistor     AUXTIN:        -35.5°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor     PECI Agent 0:  +40.5°C       cpu0_vid:     +0.000 V     intrusion0:   ALARM     intrusion1:   ALARM      Anyone with same motherboard that knows if its possible to config so Ubuntu can control my fans according to the temperature.


title: Executing a script from Nagios event handler fails to run

text: I have Nagios running on a webserver. For this one Nagios service check in particular, if it fails, it will run a script. This script is triggered via Nagios event handlers. Nagios event handler command:               define command{             command_name    testDisableServer             command_line    /usr/local/nagios/etc/objects/event_handlers/testDisableServer.sh     }      I am executing a script called testDisableServer.sh from Nagios event handlers that looks like this:               #!/bin/bash     wall "Script execution started";     /usr/bin/sudo /root/scripts/disableServer.sh force      This script 'testDisableServer.sh' has the following permissions:               -rwxr-xr-x 1 nagios nagios 2.0K Oct 12 14:57 testDisableServer.sh      When the service goes down, I will get a wall post in my SSH connection saying "Script execution started", but it will not trigger my disableServer.sh script. I tried to place another wall post inside of disableServer.sh and it did not trigger it. This script is being run by the user 'nagios'. 'nagios' was added in visudo, as such:               nagios  ALL=(ALL)NOPASSWD:/root/scripts/disableServer.sh      Running this script as the user 'nagios' from a command line works perfectly fine. However, when the event handler triggers it, there is no output. I tried to catch the output into a log file, and I came up with nothing. These are the permissions on /root/scripts/disableServer.sh:               -rwxr-xr-x   1 root root 2.0K Oct 12 15:01 disableServer.sh      Why would the event handler hit 'testDisableServer.sh', but not execute 'disableServer.sh' from a Nagios event handler, but work just fine in an SSH connection as the user nagios? BTW, 'testDisableServer.sh' is just an extra layer added to see if the event handlers were working, which they seem to be. This will be removed after this script execution is all sorted out.


title: Install Fedora20 on external HD

text: I've been trying to install Fedora20 on my external HD, but have run into problems. Somehow I cannot choose the hard disk to install Fedora. Here is what I've done: First, I went and downloaded the .iso file from fedoraproject.org, then I erased my external HD and partitioned it (this all happened on windows 8). The external HD now has two partitions and some free space that I left alone. Of the initial 500GB, I now have partitioned   * 1GB to boot Fedora   * 370GB for general use   * 128GB left alone, unformatted Booting Fedora from the ext. HD worked fine. So I tried to _install to hard drive_. That also works fine until I have to specify where to install Fedora. At this point I am shown the following disks ![enter image description here](http://i.stack.imgur.com/O9bjM.png) which shows my external HD as having 128GB free. But then I check that disk and press 'done', suddenly the following pops up ![enter image description here](http://i.stack.imgur.com/J5Fhx.png) with 0B of free space and 0B of reclaimable space?? When I go to 'custom partitioning' and try to automatically set mount points, then I obtain an error message ![enter image description here](http://i.stack.imgur.com/foPfO.png) What am I doing wrong? What should I do instead?


title: Specifying ciphers and protocol 2 in .ssh/config

text: I would like to be able to specify in my `.ssh/config` file that ssh uses protocol 2 (command line argument `-2`), and which ciphers to use with it. The following does not seem to work (I get bad configuration option: `Cyphers`)               Host XXX         HostName YYYY         User ZZZZ         Compression no         Cyphers arcfour,blowfish-cbc         ControlPath ~/.ssh/%r@%h:%p         IdentityFile ~/.ssh/seas/id_rsa      Also, how do I know which version of ssh (or OpenSSH) I am using? `which ssh` or `man ssh` does not reveal much information.


title: Output some sections of a text file

text: I have input like the following:               >gi|481443199|gb|MH447771.1|     49      0       0       0       1     50      0       0       1       0     >gi|987078004|gb|RTYJ01067061.1|     412     0       0       1       0     413     1       0       0       0     >gi|557075006|gb|ERTJ01078061.1|     41     0       0       1       0     41     1       0       0       0     >gi|787073002|gb|WERJ01045061.1|     612     0       0       1       0     613     1       0       0       0     >gi|887079001|gb|WERJ01045061.1|     715     0       0       1       0     716     1       0       0       0      I want to print some lines, but skip every other line that starts with `>` (along with all the lines after it, until the subsequent `>`). For the example input above, the output would be:               >gi|481443199|gb|MH447771.1|     49      0       0       0       1     50      0       0       1       0     >gi|557075006|gb|ERTJ01078061.1|     41     0       0       1       0     41     1       0       0       0     >gi|887079001|gb|WERJ01045061.1|     715     0       0       1       0     716     1       0       0       0      How can I do that?


title: Break down a pcap file into individual flows and modify them

text: I have a pcap file and I want to:   1. separate every flow   2. separate responses and requests in each flow   3. modify ip and port in some packets   4. reply packets Is there any utility in linux that helps me for do this?


title: Launch a program on boot (Debian server)

text: Path to folder: `root/CumulusServer` Command to execute: `./CumulusServer --daemon [--pidfile=/var/run/CumulusServer.pid]` I've spent considerable time trying to figure out how to modify `init.d`? Any help would be appreciated in resolving this issue. * * * Errors:               [FAILED] cd /root/CumulusServer | ./CumulusServer --daemon [--pidfile=/var/run/CumulusServer.pid] to /etc/rc.local          [FAILED] /root/CumulusServer | ./CumulusServer --daemon [--pidfile=/var/run/CumulusServer.pid] to /etc/rc.local          [FAILED] cd /root/CumulusServer && ./CumulusServer --daemon


title: Is it safe to remove a script file from within that script?

text: Imagine I have a script `foo`. It should be run once when the user logs in and isn't needed after a successful run. My question: Is it safe to remove the script file from within the script? E.g.:               #!/bin/bash          # do something     ...          # if successful     rm /path/to/foo     exit 0


title: "Could not connect to display" in one user account

text: I have a GUI application written in Qt and I wanted to run tests by ssh (or Jenkins). There is only one user account, which allows to run it in display mode (ofc when I previously do "export $DISPLAY=:0". On other user, jenkins, I see a nerror:               QXcbConnection: Could not connect to display :0      Aborted (core dumped)      What should I do to allow this user to run applications in graphical mode? I use Ubuntu 14.04.


title: Redhat subscriptions - synchronise subscriptions

text: I have inherited a system admin role of a small cluster of redhat machines - most running rhel5 and one machine running rhel6. My sys admin skills are at the moment poor but I would like to improve things. Looking at the CLASSIC SUBSCRIPTION MANAGEMENT System List page (https://rhn.redhat.com/rhn/systems/SystemList.do) for our cluster I am met by the following mess               Updates Errata  Packages    System  Base Channel    Entitlement              319     205     blue1   Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              127     105     bobcat  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              30      12      cheetah Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              38      19      cougar  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              137     113     forth   Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              75      44      fox     Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              311     203     jaguar  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              314     237     leopard Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              25      4       lion    Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              318     200     lynx    Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              312     203     ocelot  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              65      87      panther Red Hat Enterprise Linux Workstation (v. 6 for x86_64)  Management              25      4       puma    Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              320     194     red1    Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              30      12      serval  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              57      32      tiger   Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)         Basically I have a red warning system on each machine with different numbers of errata and packages missing. What is the best way to normalise subsriptions and packages installed on each system to stop such divergences in the future? Any links on how to properly manage subscriptions / system administrate. I'm in at the deep end at the moment. Best way to learn I guess


title: cannot ping vagrant machine

text: My experience with vagrant is very little as most of the time is seems to work. In this case however, I have not been able to get the desired behaviour. I am trying to work on a rails application and it comes with its own Vagrantfile. While I can acess the machine via ssh I am unable to ping the machine or access the rails application running on port 80 on the vm. Btw, I am running Vagrant 1.6.3 and VirtualBox 4.1.3 on an archlinux machine. I would really appreciate it if someone can point me in the right direction.


title: oh-my-zsh theme doesn't seem to update unless I re-launch zsh

text: I've begun making my own `oh-my-zsh` theme, but I've run into a bit of a problem. I'm trying to change the color of the git output based on the name of the branch, and it works fine except for one important caveat: it changes the color to the correct one when `zsh` launches, but never re-evaluates what the color should be unless I re-launch `zsh`. Here's a screenshot of the problem in action: ![Screenshot of the problem](http://i.imgur.com/uuzmMwu.png) Here's a gist with my current `zsh` theme. Am I doing something wrong, or does `oh-my-zsh` or `zsh` not support this kind of thing?


title: How to configure a filesystem+LVM for effective usage of SSD?

text: ext4 is one of the filesystems recommended for using on SSDs (with a number of built-in techniques and advices how to tune it for better performance and wear-levelling of SSDs). I want to install a Linux system onto an SSD, and I'm going to use ext4, because it is the better tested FS (I don't want to use the more experimetal btrfs). But what if I add LVM between ext4 and SSD? Will the performance and wear- levelling tweaks for ext4 loose their effect? (Because LVM would hide the actual disk layout from the FS.) Can LVM be configured so that it will use the SSD features effectively? (I want to use LVM to able to have snapshots of older states of the system, as well as for more flexibility with the sizes of the partitions.)


title: How to set up a script to run as root non-interactively?

text: I need to set up the following script to run _as root_ whenever I log in:               #!/bin/zsh     truncate -s 0 ~yourstruly/.juniper_networks/network_connect/ncsvc.log      I know how to run the script as root interactively (namely through `sudo`), but I can't figure out how to make the script run as root _non-interactively_ whenever I log in. How can I do this? FWIW: the script is currently owned by root, has permissions 6755, and the file to be truncated is also owned by root and has permissions 0644, but when I run the script, the call to `truncate` fails with a "Permission denied" error.


title: How to setup dualview without restart X11

text: I'm using latest ArchLinux with dual monitor, but my second monitor is not detected               $ lspci | grep VGA     00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Richland [Radeon HD 8570D]          $ pacman -Q | grep xorg-server     xorg-server 1.15.1-1     xorg-server-common 1.15.1-1     xorg-server-utils 7.6-3          $ pacman -Q | grep catalyst     catalyst-hook 14.4-10     catalyst-libgl 14.4-11     catalyst-utils 14.4-10     lib32-catalyst-utils 14.4-11     lib32-opencl-catalyst 14.4-10     opencl-catalyst 14.4-10          $ cat /etc/X11/xorg.conf     Section "ServerLayout"             Identifier     "aticonfig Layout"             Screen      0  "aticonfig-Screen[0]-0" 0 0     EndSection          Section "Module"     EndSection          Section "Monitor"             Identifier   "aticonfig-Monitor[0]-0"             Option      "VendorName" "ATI Proprietary Driver"             Option      "ModelName" "Generic Autodetecting Monitor"             Option      "DPMS" "true"     EndSection          Section "Device"             Identifier  "aticonfig-Device[0]-0"             Driver      "fglrx"             BusID       "PCI:0@0:1:0"     EndSection          Section "Screen"             Identifier "aticonfig-Screen[0]-0"             Device     "aticonfig-Device[0]-0"             Monitor    "aticonfig-Monitor[0]-0"             DefaultDepth     24             SubSection "Display"                     Viewport   0 0                     Depth     24                     Modes    "1280x1024"             EndSubSection     EndSection          $ xrandr -q     Screen 0: minimum 320 x 200, current 1600 x 900, maximum 16384 x 16384     DFP1 disconnected (normal left inverted right x axis y axis)     CRT1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 434mm x 236mm        1280x1024     75.02 +  60.02          1600x900      60.00*+        1440x900      60.00          1280x960      75.02    60.02          1280x768      75.02    60.02          1280x720      60.00          1024x768      75.03    70.07    60.00          1024x600      75.03    70.07    60.00          800x600       72.19    75.00    60.32    56.25          800x480       72.19    75.00    60.32    56.25          640x480       75.00    72.81    67.00    59.94            $ xrandr --output CRT1 --mode 1600x900 --output DFP1 --mode 1366x768 --right-of CRT1     xrandr: cannot find mode 1366x768      The question:   1. How to fill xorg.conf when I don't know which BusID to put (I'm using onboard graphic card), the current display are the VGA/D-Sub port, the other one is DVI-D/24+1 port --> the one that new monitor plugged in   2. What should I really put when I need horizontal span on my first monitor AOC E2070SWNL (1600x900) and the second new monitor Acer P166HQL (1366x768)?


title: How to trace a process to original user?

text: Say, on a Solaris server, `user1` logs in, switches to someother user, say `sruser`, using `su -` and then starts a process of id `X`. And then another user `user2` logs in, switches to `sruser` the same way and starts a process of id `Y`. (Multiple users can log in and swithch to `sruser` simultaneously.) In the above scenario, is there any way we can trace the processes of ids `X` and `Y` to the actual users `user1` and `user2`? How can we trace a process to the original user?


title: Give a warning when something is about to be deleted (by root)

text: I know that root can do anything, but is there a way to at least alert root that they are about to delete a folder that perhaps shouldn't be deleted? We keep a work directory in our `/tmp` folder, and from time to time an administrator will come along and purge the `/tmp` folder with roughly `sudo rm -rf *`. Is there a way to give something like a prompt or alert that they are about to delete a specific folder? Something along the lines of:               The folder XXXXX is protected from deletion - do you really want to delete this folder? (y/n)      I know, the best solution is to move this folder elsewhere (the `/tmp` folder is called temp for a reason after all!), but that has other problems. Hence my question. Asking this question makes me wonder, is it bad practice to actually blindly delete all the contents of the `/tmp` folder? Isn't a better approach to only delete files that are more than a certain age?


title: Can't fetch R updates

text: since my version of R is not compatible with a package I need for my work I wanted to update it today but received the following error message when trying to download the updates with synaptic: > W: Failed to fetch http://ftp.yalwa.org/cran/bin/linux/debian/squeeze- > cran/r-base-core_2.15.0-1~squeezecran.0_amd64.deb Could not resolve > 'ftp.yalwa.org' > > W: Failed to fetch http://ftp.yalwa.org/cran/bin/linux/debian/squeeze- > cran/r-cran-boot_1.3-4-1~squeezecran.2.15.0_all.deb Could not resolve > 'ftp.yalwa.org' > > ... and several other messages all pointing towards yalwa.org , can't post > them due to spam prevention well the given urls seem to be outdated, how can I fix this?


title: How to access a shared directory with Virtualbox OSE

text: I would like to share data between a VirtualBox OSE guest OS and the host. This location should be also writable by either of the two.


title: Does IP tables need to be configured or is a stand alone firewall sufficient?

text: I have two desktops and a laptop running Arch Linux. I have not setup any iptable rules on any of the machines, and I am curious if I should. One desktop is only used in my home network and is "protected" by a cheap cable modem/router/firewall that is essentially unconfigured and unmaintained (I changed the default password when I got it and haven't looked at it since in 3 years). The desktop runs standard home user applications (e.g., web browsing and Skype) as well as an SSH server. As far as I can tell the firewall default configuration blocks all incoming connections since I can only connect to the SSH server from within my home network. The other desktop is behind my University's firewall. It is more permissive (I can SSH into the machine from off campus) and hopefully better maintained. Apart from the SSH server the machine doesn't do anything network related other than web browsing and Skype. The laptop is used behind the home firewall, the University firewall and sometime on unsecured public wireless and wired networks (e.g., hotels and coffee shops). Is it worth configuring IP tables and if so should the configuration vary across the machines? Potentially related, is it worth setting up a separate independent firewall to protect my home network?


title: Colour is not working with ncurses on target embedded system built with buildroot

text: I have built an embedded linux environment for AMD Geode target. The kernel, cross toolchain and root file system were built using `buildroot` and the root file system resides on my host machine and is mounted over NFS. To test the environment I cross compiled a very basic ncurses application which simply changes the background colour of some text and moves it around the console. Everything is positioned correctly but no colours are displayed. I know the system is capable of displaying colour as the output from `ls` commands are coloured so I know its not a monitor problem. The application also works as expected on my host machine. Is it possible that I need to configure something within the kernel and rebuild it to enable coloured console output using ncurses or is it likely that it is a problem with the buildroot crosstools or cross-compiled ncurses library?? I am not a linux expert and frankly was very surprised that this application didn't work as expected and really am at a loss as to where to start to identify the cause.


title: Truncate a file on a certain pattern

text: How would I go about truncating a binary file when a certain pattern is found? For instance, I want to truncate the file at the first occurrence of the pattern `0xFFFFFFFF`. I think something like `awk` could do the trick... but I'm not exactly sure how. thanks


title: Most idiomatic way to set an optional parameter?

text: Suppose you have the following problem: Depending on if a script is executed within a pipe or not, you want to append the `-print0` parameter to `find`. There are at least two ways to do this:               [[ -p '/dev/stdin' ]] && local null_terminated='-print0'     find -mindepth 1 -maxdepth 1 ! \( "${args[@]}" \) "$null_terminated"      Or                   if [[ -p '/dev/stdin' ]]; then             find -mindepth 1 -maxdepth 1 ! \( "${args[@]}" \) -print0         else             find -mindepth 1 -maxdepth 1 ! \( "${args[@]}" \)         fi      Which one would be the most idiomatic way?


title: feeding the password without any terminal window (stdout)

text: I have a command like this:                echo "12345" | sudo abcde      where `12345` is supposed to be the root password and `abcde` a program or a command. I have a shortcut which runs this command. I have tested the command in a terminal window. It works, as the terminal output shows. But will it work when it is run without terminal window, for instance by a shortcut or shortcut key? (where no output is shown)


title: Is it possible to have total no. of blocks taken by same files be different on two PCs?

text: I used               ls -l mysoftware/      on two different machines, each running ubuntu 12.04. But the 'total' returned by this command is different on the two machines. On one machine it is printing 6, and on another machine it is printing 24. Although I can see same number of files listed. Actually I copied compressed folder mysoftware.tar.bz2 from my pendrive to these machines and then untar using the following command:               sudo tar xvfj mysoftware.tar.bz2      After that I used `ls -l` as above. Since I was not able to install some software on the machine where I'm getting 6, I suspect some files are missing. The question is can the two 'total' be different on different machines?


title: Difference between /dev and /sys/class?

text: What is the difference between the device representation in `/dev` between the one in `/sys/class`? Is one prefered over the other? Is there something one offers and the other doesn't?


title: Expected behavior of `find -depth` if execute permission denied for subdirectory?

text: I'd like to know if I can rely on the behavior I am seeing when using `find` with `-depth` option and user does not have execute permission for a subdirectory. Assume the following directory structure:               drwxrwxrwt. 10 root    root     12288 Mar 14 04:31 .     dr-xr-xr-x. 24 root    root      4096 Dec  6 03:33 ..     drwx------   4 root    root      4096 Mar 14 04:03 jen      Run the following command as non-root user:               find -type d      The output is:               .     ./jen     find: `./jen': Permission denied      So `find` found the directory _jen_ and output that. It then tried to descend into _jen_ , but didn't have permission so it printed the error. The first line above is printed to `stdout` and the second line to `stderr`. Now run the following as non-root user:               find -depth -type d      And the output is:               find: `./jen': Permission denied     .      So the pathname is not output to `stdout` unless the user has permission to list the contents of the directory. This output is perfect for what I want to do. However, I'm not sure if this is just a coincidence or not. **Can I rely on this behavior?** I'm using GNU findutils 4.4.2. I'm wondering if this behavior is the same across all versions of `find`. And if not, is it at least the same across all versions of GNU find. It doesn't matter to me (for this use case) whether or not _jen_ is printed in the first example. I'm just wondering if I can **_depend_** on it being excluded when `-depth` is used. Normally, it's not a good idea to rely on undocumented behavior. But, to me, this side effect makes sense. So I'm thinking that this might be the _intended_ behavior. The manual says: > — Option: **-depth** > > Process each directory's contents before the directory itself. This is _exactly_ what I want, but it's not clear that the pathname of the directory itself will be excluded from the output if it doesn't descend into it. Thanks to a hint from Hauke Laging, I discovered that I can list _only_ directories and explicitly exclude directories where permission to list their contents is denied:               find -type d \( \( -type d \( \! -executable -or \! -readable \) \) -prune -or -print \)      This also has the effect of stopping the "Permission denied" errors because `find` never tries to descend into a directory if it doesn't have permission. Unfortunately, there are two reasons why this will not work for my needs.   * I want the error messages   * I need the `-depth` option Quoting from the manual > If the ‘-depth’ option is in effect, the subdirectories will have already > been visited in any case. Hence ‘-prune’ has no effect in this case. So I am back to where I started. **It's still not clear whether or not "Process each directory's contents before the directory itself." _also means_ "Don't process the directory if you can't process it's contents".**


title: Difficulty with EncFS on CentOS

text: I'm trying to figure out `encfs`, but am having some difficulty. This is what I have done so far: I created 2 test folders               mkdir /home/oshiro/Desktop/encrypted     mkdir /home/oshiro/Desktop/decrypted      The difficulty is that the next command gives me a `permission denied` message:               encfs /home/oshiro/Desktop/encrypted /home/oshiro/Desktop/decrypted      When I run that command in Ubuntu 12.04, it works perfectly and both folders work correctly, i.e. I can create files folders in the `decrypted` folder, and they appear in the `encrypted` folder automatically etc. However, when I try to run that command in CentOS 6.5, I get a `permission denied` error. When I add `sudo` infront of that command, it mounts the `decrypted` folder as normal, but I can't open the folder as a normal user, I get a `permission denied` error. On Ubuntu 12.04, I don't need to use `sudo` to run `encfs`. How do I run that command without `sudo` on CentOS 6.5, or is that unsafe? If it's unsafe, how to I mount that folder so I can access that folder by the user logged in? Here is the full error I get when I try to run `encfs` on CentOS 6.5 without `sudo`:               [oshiro@centos- ~]$ encfs /home/oshiro/Desktop/encrypted /home/oshiro/Desktop/decrypted     EncFS Password:      fuse: failed to exec fusermount: Permission denied     fuse failed. Common problems:     - fuse kernel module not installed (modprobe fuse)     - invalid options -- see usage message     [oshiro@centos ~]$


title: removing each . after ] appear in a line in complete text file

text: I have a file in which I need to eliminate . after the ] on every line e.g               xyz[1.2]35.23     xyz[1.2.3]35.234      output should be               xyz[1.2]3523     xyz[1.2.3]35234


title: Copy selected files had subtitutions in name

text: I have some folders:               oldA with A_1.aaa, A_2.aaa, A_1.bbb, A.def, A.ghi      oldB with B_1.aaa, B_2.aaa, B_1.bbb, B.def, B.ghi     and so on      and need to copy them to another folder with selection. I want only A.def and A.ghi copy to /newA, so do with B. I have written a script but it doesn't work.               for i in A B C D     do       folder="new${i}"       mkdir $folder;       cp path/to/old${i}/${i}{.def,.ghi} $folder       cd $folder; some commands       cd ..     done      The error is `cp: cannot stat ‘oldA/A{.def,.ghi}’: No such file or directory` However, when I use direct command `cp path/to/oldA/A{.def,.ghi} newA`, it works well. What should I do? If I want to copy only A_1.aaa and A_2.aaa, will the procedure be similar? This is my actually script.               #!/bin/bash     folder="Disperse"     mkdir $folder     cp 3B7V.pdb $folder     cd $folder          #awk '$5 != "C"' 3B7V.pdb > 3B7V_temp.pdb     #awk '$4 != "C"' 3B7V_temp.pdb > AB.pdb     sed -n 403,1981p 3B7V.pdb > A.pdb     sed -n 1982,3586p 3B7V.pdb > B.pdb          cd ..;mkdir EM;cd EM     for i in A B     do        folder="${i}_EM"       mkdir $folder       cp ../em.mdp ../Disperse/${i}.pdb $folder       cd $folder            echo -e "\n4" | pdb2gmx -f ${i}.pdb -o ${i}.gro -water none       grompp -f em.mdp -c ${i}.gro -p topol.top -o ${i}_em.tpr       mdrun -v -deffnm ${i}_em       #grompp -f em.mdp -c ${i}_em.gro -p topol.top -o ${i}_em_mead.tpr       cd .. #at EM folder     done          cd ..;mkdir PQR;cd PQR     for i in A B     do       folder="${i}_PQR"       mkdir $folder       cp ../EM/${i}_EM/${i}* $folder       cd $folder            editconf -f ${i}_em.gro -o ${i}_em.pdb       awk '$1 != "REMARK"' ${i}_em.pdb > ${i}_temp.pdb       pdb2pqr --ff=AMBER --apbs-input ${i}_temp.pdb ${i}.pqr -v > log_${i}       #editconf -f ${i}_em_mead.tpr -mead ${i}_gro.pqr       #for j in *.pqr; do sed 1,8d "$j" > ../"${j/.*}"_sed.pqr; done       cd .. #at PQR folder     done          cd ..;mkdir APBS;cd APBS     for i in A B     do       folder="${i}_APBS"       mkdir $folder;ls       cp ../PQR/${i}_PQR/${i}{.pqr,.in} $folder       cd $folder            abps ${i}.in       cd .. #at APBS folder     done      Also, I have another problem in Konsole. I don't know whether it is relevant or not but I will post here too.


title: Is it possible to create an alias to rlogin and pass login paramteres?

text: There is a system I need to rlogin to for work, and each time it asks for my username and password and after the login I have to type in a code-word in order to get to the view I want. Is it possible to create an alias that will automate that? I was able to create a login macho with Reflection X, but i want to use putty instead.


title: Is there a way to tell sudo to set my username as owner for the files created instead of root?

text: If I do a `sudo cp /etc/foo.txt ~/foo.txt`, the new file is created with `root` as the owner. Right now, I see no way around this other than using the last two commands (`ls` to clarify use-case):               belmin@server1$ ls /etc/foo.txt     >  -rw------- 1 root root 3848 Mar  6 20:35 /etc/foo.txt     >     belmin@server1$ sudo cp /etc/foo.txt ~/foo.txt     belmin@server1$ sudo chown belmin: $_      I would prefer:   1. Doing it in one `sudo` command.   2. Not having to specify my current user (maybe using a variable?).


title: Does cut support non-white-space to white-space delimeters?

text: The default delimiter in awk is white-space to non-whitespace change. The default for cut is the tab character. Can I tell cut to use non-white-space to white space delimters? E.g. a:               foo  bar          cut -d' ' -f2 a      prints just a space, but should print _bar_.               awk '{ print $2; } a      print bar. Sure, often you can just use awk as a cut replacement if you need that semantics. But cut has the advantage that it is very memory efficient. Especially it does not load unused columns into memory (unlike some awks).


title: How do I switch from an unknown shell to bash?

text: I was surprised that I didn't find this question already on the site. So, today `$` came up after I logged in as a new user. This was unexpected because my main user's prompt starts with `username@computername:~$`. So, how do I switch from this other shell to bash?


title: What is the file-naming convention for regular text files?

text: For regular `*.txt` text files that contain documentation and notes and such, and which are not READMEs, is there a Unix convention for naming them? Namely,   * Should the filenames be all lowercase? camelcase? all caps?    * Should words separated by hyphens, underscores, or escaped spaces?   * Should short names be favored over longer, more explicit ones?


title: nmap script needed to output text into csv format

text: ultimately I am looking to insert some info into a database. So I'm trying to output a file from something (probably nmap) that is formatted like this:               10.1.150.1,Up,1/3/2012,host.domain.lan     10.1.150.2,Down,1,3/2012,host2.domain.lan      I do not HAVE to get the date from the nmap scan but it would be helpful. I can add it when I insert the data into the DB. I'm pretty sure that nmap can do this along with some grep, awk, and sed foo, but those things aren't my strongest points. EDIT: I'm open to suggestions about output formats.. XML? I need to run this daily (give or take) and import the results to MySQL EDIT2: I've gotten this far;               nmap -sn -oG - 192.168.0.50-100 | grep Host | awk  '{print $2","$5","$3}'      Which gives me this:               192.168.0.75,Up,()     192.168.0.76,Up,(server01.domain.com)     192.168.0.77,Up,(server02.domain.com)     192.168.0.78,Up,(server03.domain.com)      Next; Can I remove the parens? add the date? Nmap always says what time it starts and finishes but it doesn't include that on each line... so I can't grab it w/ the awk statement.


title: script to scan ip range and return results in a certain format

text: This script scans IP's and returns a status of Up or Down. How can I alter it so it doesn't scan everything twice? As it sits it scans everything and returns the "Up" addresses only and then scans all over again and only returns the "Down" status addresses.               #!/bin/bash          is_alive_ping()     {       ping -c 1 $1 > /dev/null       [ $? -eq 0 ] && echo $i,Up       [ $? -eq 1 ] && echo $i,Down     }          for i in 10.1.150.{1..10}     do     is_alive_ping $i & disown     done      Bonus points if anyone can make it also return the DNS name of the IP if it has one. Thanks in advance.


title: Detach a daemon using sudo?

text: I noticed that `sudo` continues to run after executing any of the following lines. Is there any way to detach the daemon completely so `sudo` does not continue running?               sudo -u user daemon &     sudo -u user -b daemon


title: Why does tailing an output log sometimes give partial lines?

text: Sometimes, tailing an output log which is constantly being updated doesn't give the whole lines. Why is that?               grep pattern input_file > output.log &     tail output.log      Why doesn't it print the last line in full?


title: shell script options pass through to sub-command

text: I'm writing a wrapper script for that uses `getopts` to set various options for `mysqldump`. It's working well so far. However one thing I would like to do is be able to add another option in my shell script, the contents of which should be passed to the mysqldump command exactly. Sort of like an options pass through like this:   `./mysqldumpwrapper.sh -u username -p password -h localhost -o "--no-create-db --replace"`   with the string content of the -o argument passed exactly through to my `mysqldump` command. Because I'm using `getopts` when trying the above I get the following output:   `Invalid option: --` Does anyone know how to work around this?   Is there a way to escape the entry of options so that `getopts` won't parse the contents as another option? Then when it comes to triggering the actual command from my shell script, this is what I've got:   `mysqldump "$OPTIONSPASSTHROUGH" --host=$MYSQL_HOST --user=$MYSQL_USER --password=$MYSQL_PASS "$DB" > "$FILE_DEST"`   Because there may well be spaces in the OPTIONSPASSTHROUGH variable, I have quoted that variable in that command. Is that correct?


title: Yum stopped working after upgrading it

text: I just did `yum upgrade yum` and now I can't use it. It keeps showin this error:               [root@devlon5 www]# yum install pdftohtml     epel/primary_db           100% |=========================| 3.8 MB    00:00          epel-erlang               100% |=========================| 2.3 kB    00:00          Traceback (most recent call last):       File "/usr/bin/yum", line 29, in ?         yummain.user_main(sys.argv[1:], exit_code=True)       File "/usr/share/yum-cli/yummain.py", line 254, in user_main         errcode = main(args)       File "/usr/share/yum-cli/yummain.py", line 109, in main         result, resultmsgs = base.doCommands()       File "/usr/share/yum-cli/cli.py", line 353, in doCommands         self._getTs(needTsRemove)       File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 99, in _getTs         self._getTsInfo(remove_only)       File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 110, in _getTsInfo         pkgSack = self.pkgSack       File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 774, in <lambda>         pkgSack = property(fget=lambda self: self._getSacks(),       File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 564, in _getSacks         self.repos.populateSack(which=repos)       File "/usr/lib/python2.4/site-packages/yum/repos.py", line 279, in populateSack         sack.populate(repo, mdtype, callback, cacheonly)       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 164, in populate         if self._check_db_version(repo, mydbtype):       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 223, in _check_db_version         return repo._check_db_version(mdtype)       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1227, in _check_db_version         repoXML = self.repoXML       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1417, in <lambda>         repoXML = property(fget=lambda self: self._getRepoXML(),       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1409, in _getRepoXML         self._loadRepoXML(text=self)       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1399, in _loadRepoXML         return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1375, in _groupLoadRepoXML         self._commonRetrieveDataMD(mdtypes)       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1348, in _commonRetrieveDataMD         urlgrabber.progress.text_meter_total_size(0)     AttributeError: 'module' object has no attribute 'text_meter_total_size'      Is it because its dependencies are outdated? Can anybody help me to resolve this. Thank you so much


title: What is the recommended filesystem to use when reaching sizes of 50TB?

text: My initial google searches say XFS or ReiserFS, but what does the community have to say about this? What are your experiences with 50TB sizes and up? Edit: After inquiring on IRC I think I would recommend Ext4, and splitting up the storage into 10TB chunks. But I'd still be very interested to hear experiences.


title: Fix Fn-keys for keyboard illumination

text: I've tried following the Ubuntu hotkeys/media keys troubleshooting guide and `/usr/share/doc/udev/README.keymap.txt.gz` to make the `Fn` keys work. After copying the map file and modifying `/lib/udev/rules.d/95-keymap.rules` I get the correct key names from `sudo /lib/udev/keymap -i input/event4`, but none of them do anything at all. How do I make sure that at least `wlan` and `kbdillumup`/`kbdillumdown` work?               $ /lib/udev/findkeyboards     AT keyboard: input/event4     $ cat /sys/class/dmi/id/sys_vendor     SAMSUNG ELECTRONICS CO., LTD.     $ cat /sys/class/dmi/id/product_name     90X3A      `samsung-90x3a` map file:               0xCE prog1 # Fn+F1 Unknown     0x8D prog3 # Fn+F6 Economy mode     0x97 kbdillumdown # Fn+F7 Keyboard background light down     0x96 kbdillumup # Fn+F8 Keyboard background light up     0xD5 wlan # Fn+F12 Wifi on/off      `$ udevadm info --export-db` **Update** : The information below will be from Arch Linux since I no longer have Ubuntu. `xdotool key XF86KbdBrightnessUp` prints nothing, but returns with exit code 0. I'm not sure if that means anything. `acpi_listen` prints nothing when pressing `Fn`+`F7`/`Fn`+`F8`.


title: Installing yum on CentOS 5

text: I have a CentOS vm that I'm currently working on. I tried to update `yum` and it broke, so I removed it. So I need to re-install it on my vm, can anybody tell me how to install `yum` on CentOS5?


title: Xrandr not saving setting

text: Hello xrandr at install doesnt detect my tv to be 1920x1080@60hz, so I have to add the setting manually and when I do that with xrandr it works this is the commands I used               xrandr --addmode HDMI-0 1920x1080     xranrd --output HDMI-0 --mode 1920x1080 --rate 60      When I do that the monitor works great and it's fine and all, problem is whenever I reboot, it goes back to 1360x768 and the mode that I added is not there anymore, I have to add it everytime, is there any ways to save the settings? Also how can I set the size of dual monitors? I am using fedora 15 Thanks


title: Emacs: Deleting a line without sending it to the kill ring

text: I would like to use `C-k` to delete a line without sending it to the `kill- ring`. I have the following on my `.emacs` file               (delete-selection-mode 1)      but this only seems to work for `C-d` (`delete-char`) I have also read the solutions described in this thread: Emacs: how to delete text without kill ring?, but I didn't see anything that addresses this precise problem.


title: Vim: mouse support lost after using netrw in xterm

text: Every time I access the filesystem using:   * `:tabe dirname` (e.g.: `:tabe .`)   * `:vsp dirname`   * `:sp dirname` in order to open some file while editing another one, I lose the mouse support inside the Vim session. I'm running **Vim 7.3.346** inside a fresh install of **Debian Wheezy** , using xterm. I've tested with the minimal settings for Vim, for example with this `.vimrc`:               set nocp     set showmatch     set ts=4     set shiftwidth=4     set expandtab     set foldmethod=syntax     syntax on     set autoindent     set smartindent     set mouse=a     set encoding=utf-8     set fileencoding=utf-8      Is there any solution, or a patch to a bug for this version of Vim? * * * **Update** : At work this problem has never happened, the computers and servers we have are:   * Ubuntu 10.04.3, Vim 7.2.330   * SUSE Linux Enterprise Server 11, Vim 7.2.108   * Red Hat Enterprise Linux Server release 6.0, Vim 7.2.411 Should this be a problem of Vim 7.3?


title: (How) can I create a tmpfs as a regular (non-root) user?

text: The distribution is an Ubuntu server running the 2.6.35-30 Linux kernel. I would like to have a directory that sits completely in memory. Is this possible without root privileges?


title: Rsync --backup-dir seems to be ignored

text: I want to use `rsync` to backup a directory from a local location to a remote location, and store changed files in another remote location. I did use:               rsync -rcvhL --progress --backup \       --backup-dir=user@url.com:/home/user/Changes/`date +%Y.%m.%d` . \       user@url.com:/home/user/Files/      The `--backup-dir` stays empty, while it should be filled. Is it possible what I'm trying to accomplish is not possible or am I doing something wrong?


title: Mounting Linux root fs NFS share on OS X?

text: I am attempting to share the root filesystem (`/`) of a CentOS 6.5 virtual machine to my OS X host system. While this should be relatively simple process, I'm hitting some kind of wall. Presently my linux `/etc/exports` contains:               / 192.168.0.0/255.255.255.0(rw,sync,no_root_squash) 127.0.0.1(rw,sync,no_root_squash)      And I can connect to it, while on the linux system (localhost), via this command:               mount localhost:/ /mnt/root     #Where I did `mkdir /mnt/root` first      But when I flip on over to OS X and attempt a variety of iterations of mount, I just can't get it to work. For example, if I issue:               sudo mount -t nfs hostname:/ /mnt/centos      I'll get a `mount_nfs: can't mount / from hostname onto /mnt/centos: Cennection refused` Oddly I don't see any entries in any `/var/log` files and so I don't see the error messages associated with this refusal.


title: Apache Request Hangs For 2 Minutes Exactly

text: I am experiencing some odd behavior with apache. I have requests that are hanging for exactly two minutes. The request could be one file one time, and then a completely different file another time. Here are a couple of screenshots of my network inspector. ![ss #1](http://i.stack.imgur.com/hH4y0.png) _original URL:http://tiny- img.com/image.php?di=QNKO_ ![ss #2](http://i.stack.imgur.com/mFeJh.png) _original URL:http://tiny- img.com/image.php?di=3BFS_ ![ss #3](http://i.stack.imgur.com/VoVgd.png) _original URL:http://tiny- img.com/image.php?di=49VN_ I'm not sure how to troubleshoot this, there are no errors in the logs, and I'm not finding anything referring to similar issues on the web. Any ideas on how I can troubleshoot this, and/or if you know what is going on, I would appreciate any insight to what I can do to correct this.


title: Dealing with overscan without distorting [fglrx-legacy]

text: My TV forces overscan. I cannot find a way to turn it off, even using the service menu, and I believe the screen may actually have less than 1280x720 pixels. ATI Catalyst defaults to underscan, which I have already fixed. The only acceptable setting I could find was turning the underscan completely off (using a script file to set the size to 1280x720 and position to 0,0 via aticonfig). Otherwise, there is noticeable distortion, and XBMC's test patterns also indicate distortion. This, however means that the TV's overscan is now a problem. XBMC seems to adjust resolution differently, however, and correcting for the overscan in XBMC sizes the screen perfectly without distortion. But, everything outside XBMC still shows overscan. Is there a way to, system-wide, enforce the type of resizing that XBMC does instead of the type that aticonfig seems to do? I don't understand why aticonfig distorts at anything other than max size, yet xbmc allows ANY resolution without distortion. I am using fglrx-legacy on Debian Wheezy. Thanks


title: How to examine an apt repository?

text: I am trying to set up riak on Debian wheezy. I've followed their instructions to add the basho apt repositories...               $> curl http://apt.basho.com/gpg/basho.apt.key | sudo apt-key add -     $> sudo bash -c "echo deb http://apt.basho.com $(lsb_release -sc) main > /etc/apt/sources.list.d/basho.list"      ... and performed `apt-get update`:               ...     Hit http://apt.basho.com wheezy Release.gpg     Hit http://apt.basho.com wheezy Release     Hit http://apt.basho.com wheezy/main i386 Packages     Ign http://apt.basho.com wheezy/main Translation-en_US     Ign http://apt.basho.com wheezy/main Translation-en     ...      However apt still says there's no such package:               $> apt-get install riak     Reading package lists... Done     Building dependency tree     Reading state information... Done     E: Unable to locate package riak      I suspect their instructions might be out of date, having an old package name. How can I query the basho apt repositories to see what packages it holds? I think that if I saw the list of packages, I could see which one it was that I wanted.


title: Process Monitoring on Solaris

text: $ prstat -t     NPROC USERNAME  SWAP   RSS MEMORY      TIME  CPU     164 oracle   5446M 5445M   8.3%  13:47:50 1.6%     52 root      576M  728M   1.1%  42:29:50 1.0%      1 noaccess  300M  273M   0.4%   0:20:54 0.0%      1 smmsp    2192K 9912K   0.0%   0:00:06 0.0%      1 nagios    584K 4256K   0.0%   0:01:54 0.0%      6 daemon   8360K   11M   0.0%   0:12:39 0.0%          Total: 225 processes, 839 lwps, load averages: 1.68, 1.58, 1.46      Above is the output of `prstat` command on Solaris Box which has `Oracle 11g` installed. The RAM on the Solaris box is `64GB` however the oracle process seems to be swapping around `5.5 GB`, is that normal? Would appreciate any recommendations on getting more fine-grained information!


title: Find which directories each group can access

text: I need to take the /etc/group file (RHEL) and check what high level subdirectories each group has access to. Here is a made up example:               Group 100 - \xxx\xxx\xxx     Group 150 - \xx\xxxxx\x      **Is that possible to know in someway? Or perhaps using another workaround rather than /etc/group file?**


title: Notify on email sent - Postfix

text: I have a small postfix server, on a Linux server (Arch Linux) mainly used as a http server. I use postfix to send database backups and notifications of my web sites. To avoid spamming, I'd like to monitor the output mail queue (e.g. a report of sent emails). Is there a simple way to do that?


title: gnome 3 hibernate option

text: I switched to gnome 3 (which I like) and of all the things that have changed the only one that bothers me is the fact that there is not a hibernate option. Now, I know of the pm-hibernate command but it does not lock my x-window on boot up. Just right back into where I left off without requiring a password. Any suggestions?


title: How to perform an action only on the first line?

text: sed 's/.\(.*\)/\1/' myfile      Say myfile contains:               abc     def     ghi      I want to remove the first character only from the first line but the above removes it from all the line.


title: Linux - How to open a console and display command results on startup?

text: I have a Linux server with a screen always displaying the end of a very usefull file. How could I automatically enter a shell and display the end of this file when the server starts? I'd like to do absolutely nothing and see the result of tail -fn 50 /very/usefull/file


title: non-line-oriented tool for string replacement?

text: I recently asked a question about how to remove the newline character if it occurs after another specific character. Unix text-processing tools are very powerful, but almost all of them deal with lines of text, which is fine most of the time when the input fits in the available memory. **But what should I do if I wish to replace a text sequence in a huge file that doesn't contain any newlines?** For instance replace `<foobar>` with `\n<foobar>` without reading the input line-by-line? (since there is only one line and it is 2.5G characters long).


title: echo a file without the first and last lines

text: Is there a simple way I can echo a file, skipping the first and last lines? I was looking at piping from `head` into `tail`, but for those it seems like I would have to know the total lines from the outset. I was also looking at `split`, but I don't see a way to do it with that either.


title: Debian: How to delay configuration when installing/upgrading?

text: One of my Debian systems is rarely upgraded. So when it is time to upgrade, there are loads of packages. Right now I basically have to monitor the upgrade, because every 50 packages or so there is a package that needs help deciding if it should keep the config or have a new configuration put in. My system is really slow, so I would prefer if I could tell the system to deal with as many packages as it can on its own and leave the rest for me. So what I am looking for is something similar to `make -k` but for `apt-get` or `aptitude`. What I am not looking for is non-interactive configuration of packages: I _do_ want to configure the packages, but I want the system to install/upgrade as many packages as it can before asking me to configure anything. That way I hope to return later, configure a bunch of packages, and the install the remaining (hopefully) few packages. Edit: Also it would be nice that when I _do_ return to configure that I can get to configure as many as possible. So it should start by postponing all packages that need configuration and when I return it should prioritize all packages that can be configured at this point.


title: How to deal with end of options -- in getopts

text: I use getopts to parse arguments in bash scripts as               while getopts ":hd:" opt; do       case $opt in         d ) echo "directory = $OPTARG"; mydir="$OPTARG"; shift $((OPTIND-1)); OPTIND=1 ;;         h ) helptext           graceful_exit ;;         * ) usage           clean_up           exit 1       esac     done          exeparams="$*"      `exeparams` will hold any unparsed options/arguments. Since I want to use exeparams to hold options for a command to be executed within the script (which can overlap with the scripts own options), I want to use -- to end the options passed to the script. If I pass e.g.               myscript -d myscriptparam -- -d internalparam      `exeparams` will hold               -- -d internalparam      I now want to remove the leading `--` to pass these arguments to the internal command. Is there an elegant way to do this or can I obtain a string which holds just the remainder without `--` from getopts?


title: /etc/init.d/script, or /etc/inittab - respawn on die

text: I have a daemon/service (milter-regex), that is dying. I'm only using it temporarily (A few months), so don't care too much, but I want it to restart when it dies. It is an init.d script. 'service milter-regex start' etc. The init script lives at /etc/init.d/milter-regex I know if I have something in /etc/inittab, it will automagically respawn if it dies. Are init scripts supposed to do this as well, or do I need to put it in inittab? It could be failing to restart as it isn't cleaning up a stale sock file, which I will fix today, but thought I'd ask the question anyway. Running on RHEL4 (Yes, old) Thanks, Brock


title: openSuSE, Linux, cannot create directory-permission denied

text: I am using openSuse 12.3, and logged in as a user. I am trying to create a directory in the `/home/` , but getting permission denied. any idea, how to fix this.               harbir@linux-gn77:/home> mkdir testDir     mkdir: cannot create directory ‘testDir’: Permission denied     harbir@linux-gn77:/home>


title: What process is sending TCP SYNs on Solaris 10?

text: Some process on my Solaris 10 machine is sending TCP SYNs to a remote machine. The remote machine never responds, so the connection is not established. How do I find out what process is initiating this? I've been looking at DTrace scripts but a) I don't know Dtrace well enough to create my own, b) haven't found an existing script, and c) some that I have found use probes not available in my version. Thanks for any insight. Gary


title: Remove old icons in Gnome 3

text: I have been installing several version of Komodo editor. (The installation consist of extracting a .tar.gz archive and then running an `.sh` script as root.) Yesterday I installed Gnome 3. Now I see in "Application" section of Gnome Shell both "Komodo Edit 7" and "Komodo Edit 5" despite of only "Komodo Edit 7" is installed. How to remove the old icon?


title: What is the difference between who > lp and who | lp?

text: Why does the `who > lp` creates a file but `who | lp` leads the output to program `lp`? What is the underlying principle behind these two simple commands? Can somebody explain it with an example?


title: Gnome Network-Manager OpenVPN

text: I cannot get OpenVPN to work with GNOME NetworkManager. Authentication-Type is "Certificates (TLS)" I have 3 files:   * UserCert: user.crt   * CACert: ca.key   * PrivateKey: user.key All live in my home-directory. Connection fails with the following message:               Feb 25 23:16:49 archpad nm-openvpn[1138]: OpenVPN 2.3.2 x86_64-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6     Feb 25 23:16:49 archpad nm-openvpn[1138]: WARNING: No server certificate verification method has been enabled.  See http://openvpn.n     Feb 25 23:16:49 archpad nm-openvpn[1138]: NOTE: the current --script-security setting may allow this configuration to call user-defi     Feb 25 23:16:49 archpad nm-openvpn[1138]: WARNING: file '/home/mak/Downloads/user.key' is group or others accessible     Feb 25 23:16:49 archpad nm-openvpn[1138]: Cannot load CA certificate file /home/mak/Downloads/ca.key (OpenSSL)     Feb 25 23:16:49 archpad nm-openvpn[1138]: Exiting due to fatal error     Feb 25 23:16:49 archpad NetworkManager[422]: <warn> VPN plugin failed: 1     Feb 25 23:16:49 archpad NetworkManager[422]: <info> VPN plugin state changed: stopped (6)     Feb 25 23:16:49 archpad NetworkManager[422]: <info> VPN plugin state change reason: 0     Feb 25 23:16:49 archpad NetworkManager[422]: <info> Policy set 'tb303' (wlp3s0) as default for IPv4 routing and DNS.     Feb 25 23:16:49 archpad NetworkManager[422]: <warn> error disconnecting VPN: Could not process the request because no VPN connection      **UPDATE** Output of               openssl x509 -in  /home/mak/Downloads/ca.key -noout -text      is               unable to load certificate     140493069354640:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE


title: High RX packet error count with modem - how to analyze?

text: I'm testing a CDMA modem on my Debian embedded Linux system. I'm doing some wgets of large files and am seeing the connection drop now and then. Looking at the ifconfig output for the PPP interface I see the count for errors seems to be pretty high (353 errors). Is there any easy way of determining what those errors actually are?               ppp0      Link encap:Point-to-Point Protocol               inet addr:166.248.251.38  P-t-P:66.174.217.80  Mask:255.255.255.255               UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1               RX packets:6490 errors:353 dropped:0 overruns:0 frame:0               TX packets:5901 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:3               RX bytes:7712851 (7.3 MiB)  TX bytes:568635 (555.3 KiB)


title: Renaming files with its path name

text: I have a .bdf file inside subfolders. All the .bdf have the same name: Loads.bdf Example:               /home/user/folderxx/folderxxx/Load.bdf     /home/user/folderxx/folderxxx/Load.bdf      I need to find (and copy to a new folder) all Load.bdf files and rename them with its path name. Example: After the intended operation, it should show something like this.               folder001_folderAAA_Load.bdf     folder002_folderBBB_Load.bdf


title: "Unable to connect to X server" after TTY login

text: I'm using Ubuntu 13.10. Whenever I login on the command line (tty1-tty6) I get the following output:               Last login: ...     Welcome to Ubuntu 13.10 ...          Unable to connect to X server     Unable to connect to X server      And then the regular prompt. I'm wondering if there is a way to track down what is causing the "Unable to connect to X server" message. What processes/files run when I login this way?


title: launch x11vnc on bootup

text: I am using archlinux version 3.10.27-1-ARCH on my remote PC and I would like it to launch x11vnc server on successful bootup. Though i can start the x11vnc server manually, I am having trouble starting it up automatically. The configuration of `/etc/systemd/system/x11vnc.service` is as follows * * *               [Unit]     Description=VNC Server for X11     Requires=graphical.target     After=graphical.target          [Service]     ExecStart=/usr/bin/x11vnc -display :0 -nopw      * * * The status of the service using command:`systemctl status x11vnc`               x11vnc.service - VNC Server for X11        Loaded: loaded (/etc/systemd/system/x11vnc.service; enabled)        Active: inactive (dead)      * * * And the dBus output of command: `dmesg|grep x11vnc`               [    5.467201] systemd[1]: Found dependency on x11vnc.service/start     [    5.467285] systemd[1]: Breaking ordering cycle by deleting job x11vnc.service/start     [    5.467335] systemd[1]: Job x11vnc.service/start deleted to break ordering cycle starting with graphical.target/start      * * * I do feel from the `dmesg` output there is a cyclic dependency, but I am not able to understand what.


title: Expanding comma-separated list into separate lines

text: I have a file with some data in this form:               Prefix text: First Name, Second Name, Third--      The prefix differs by line. The number of names varies from one to several. The suffix (`--` in the example) is optional and non-alphabetic. I need to expand the comma-separated list of names into multiple lines (easy: `s/,/\n/g`), but in such a way that prefix and suffix (if present) surround each of the new entries:               Prefix text: First name--     Prefix text: Second name--     Prefix text: Third--      Instead of banging out a too-long python script, I thought it'd be more fun to ask if someone here can think of the perfect one-liner. Any ideas?


title: Arch-Linux: no boot messages

text: I'm fairly new to Arch-Linux so maybe this Question is a little bit ridiculous. If I boot the "Live-CD" of Arch-Linux, I see which services are successfully started, indicated by a green [OK] message. After installing Arch-Linux I only get a blank Screen till the login-prompt appears. What should I do to display these messages again?


title: Shell script works when saved with nano but not when saved with Notepad++

text: I've been working on a bash script all day and have been testing on the machine I will be using it on. When I copy the script across from Notepad++ into a new file with nano editor inside SSH and save. It runs fine. (sh ./install). But if I save the file (Exact same contents), upload to my web server, download it using Wget on the same machine. I get syntax errors. I've checked the encoding and they seem to be the same. I have since used a plethora of character encoding to see if it will resolve the issue. I am also setting the file to executable once I download it using wget! The file runs fine and I have zero errors when copy and pasting using nano. Any idea what this may be? Anyone experienced the same issue?


title: I messed up my EFI boot, what do I do?

text: I have Debian Wheezy installed on my computer using EFI boot. It used Grub2 as the bootloader. I then decided to install Arch Linux, using EFI as well, on another partition and chose Grub bootloader over Gummiboot. When I rebooted my computer, the first Grub menu to display was the one that came with Arch Linux. I tried booting off of it but there was an error and Arch wouldn't boot. It was about an unaligned pointer 0x22 and it advised me to press a key to exit. I did that. Then the Grub menu for Debian came up and I was able to boot into it. I didn't like having 2 grub menus so I searched for a way to remove the arch grub as it wouldn't boot anyway. That's when I found this post. It basically says that Grub is not necessary for booting and it can be handled by efi stub. I'm using the backported 3.11 kernel so I (thought) didn't need to recompile the kernel. So I reformatted my EFI system partition and followed the instructions posted by Marco and rebooted. I now only get a blinking cursor. I've removed the Arch partition and I want to boot back into Debian Wheezy. What do I do?


title: Checking if folder exist using case/switch

text: Is it possible to use case to check if folders exist? I have these folders. I need to check if they exist then do something afterwards, I have 5 folders I need to check, and if it does exist, I process something different in each of the folders. Can it be done? If not, what is the best way for that? perhaps a multiple if statements?


title: Using wget and grep to download HTML pages and filter by keywords

text: KEYWORDS=("dolphins" "fish" "dogs" "cats" "iguanas")     IFS=$'\n'     find . -type f -size +1c ! -exec grep -qF "${KEYWORDS[*]}" {} \; -exec truncate -s 0 -f {} \;      * * * If a file is over 1 byte, search for keywords. If keyword is not found, truncate it to 0 bytes. I get the following error:               truncate: invalid option -- 'f'     Try `truncate --help' for more information.


title: Why starting firefox (from command line) in VM starts the firefox in the host machine and vice-versa?

text: I have a SLED 10 host machine and I am using a SLES 10 VM via `ssh -X`. When I start `firefox` in my VM using `firefox &` then it runs the `firefox` which is installed in the VM. So that's fine. However, if my host machine's `firefox` is running, and then I start VM's `firefox`, then instead of starting its own, a new session of host's `firefox` starts running. Same happens the opposite way also, if VM's `firefox` is running then I am not able to start host's `firefox`.


title: mount Linux NFS. rpc.statd is not running

text: I have Ubuntu 12.04 as the NFS server. The clients are Linux. My `/etc/exports` file has 1 line,               /folderToExport *(rw,async,no_subtree_check)        `/etc/init.d/nfs-kernel-server status` shows that the NFS share is working as expected. The problem is that whenever I attempt to mount the NFS share from another Linux host, stdout says               mount.nfs: rpc.statd is not running but is required for remote locking     mount.nfs: use '-o nolock'...or start statd      `ps -ef |grep statd` shows that `rpc.statd` is already running, so why do they say to "start statd"? Including their `-o nolock` suggestion allows for the mount NFS to occur, but then the mounted NFS becomes read-only. The `/etc/exports` file asks for `rw`. How do you start statd? Is the NFS client or server missing some configuration? * * * Here's what worked for me. Make a declaration for each shared folder in `/etc/exports`, e.g.               /folderToExport *(rw,async,no_subtree_check)       `statd` can be started by `service statd stop` followed by `service statd start`. Then `ps -ef |grep statd` shows `statd 1994 1 0 15:23 ? 00:00:00 rpc.statd -L` Once you've verified that `statd` is running, next run `mount` from the Linux client, `mount 192.168.1.3:/folderToExport /mountFolder` There should no longer be a message `rpc.statd is not running ... start statd` Finally, be sure that permissions on NFS server allow for `rw` permissions. (Modifying the `/etc/exports` file alone was insufficient) `chmod 0777 /folderToExport -R`


title: apt-get update could not resolve addresses

text: When I run `apt-get update` (on Ubuntu 12.04) I keep getting these errors:               Err http://security.ubuntu.com precise-security Release.gpg       Could not resolve 'false'     Err https://get.docker.io docker/main amd64 Packages       Couldn't resolve proxy 'false'     Err https://get.docker.io docker/main i386 Packages       Couldn't resolve proxy 'false'      When run `nslookup` on those addesses it works. `/etc/resolv.conf`:               nameserver 8.8.8.8      Any idea what could cause this error?


title: suEXEC problem start one site, but don't - other one

text: Running **Apache 2.**2 on **CentOS 6.5**. Config files:               # cat /var/www/php-cgi/domain.com/php.cgi     #!/bin/sh     PHPRC=/etc/     export PHPRC     export PHP_FCGI_MAX_REQUESTS=500     export PHP_FCGI_CHILDREN=4     exec /usr/bin/php-cgi          # cat /var/www/php-cgi/setevoy.org.ua/php.cgi     #!/bin/sh     PHPRC=/etc/     export PHPRC     export PHP_FCGI_MAX_REQUESTS=500     export PHP_FCGI_CHILDREN=4     exec /usr/bin/php-cgi      `VirtualHosts` configs:               # cat /etc/httpd/conf.d/setevoy.org.ua.conf     <VirtualHost 127.0.0.1:8080>       DocumentRoot /var/www/vhosts/setevoy/setevoy.org.ua       ServerName setevoy.org.ua       ServerAlias www.setevoy.org.ua       CustomLog /var/log/httpd/setevoy.org.ua-access.log combined       ErrorLog /var/log/httpd/setevoy.org.ua-error.log            <IfModule mod_fcgid.c>         SuexecUserGroup setevoy setevoy         <Directory /var/www/vhosts/setevoy/setevoy.org.ua>           Options +ExecCGI           AllowOverride All           AddHandler fcgid-script .php           FCGIWrapper /var/www/php-cgi/setevoy.org.ua/php.cgi .php           Order allow,deny           Allow from all         </Directory>       </IfModule>     </VirtualHost>          # cat /etc/httpd/conf.d/domain.com.conf     <VirtualHost 127.0.0.1:8080>       DocumentRoot /var/www/vhosts/User/domain.com       ServerName domain.com       ServerAlias www.domain.com       CustomLog /var/log/httpd/domain.com-access.log combined       ErrorLog /var/log/httpd/domain.com-error.log            <IfModule mod_fcgid.c>         SuexecUserGroup User User         <Directory /var/www/vhosts/User/domain.com>           Options +ExecCGI           AllowOverride All           AddHandler fcgid-script .php           FCGIWrapper /var/www/php-cgi/User/domain.com/php.cgi .php           Order allow,deny           Allow from all         </Directory>       </IfModule>     </VirtualHost>      Correct grants:               # ls -l /var/www/php-cgi/ | grep User     drwxr-xr-x 3 User     User     4096 Sep 12 14:47 User          # ls -l /var/www/vhosts/ | grep User     drwxr-xr-x 3 User     User     4096 Sep 12 14:47 User      If I run domain.com with next:               # su -l User     [User@venti ~]$ cd /var/www/vhosts/User/domain.com/     [User@venti domain.com]$ cat index.php | /var/www/php-cgi/User/domain.com/php.cgi | head     X-Powered-By: PHP/5.3.3     Content-type: text/html          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">     <html><head>     <style type="text/css">     body {background-color: #ffffff; color: #000000;}     body, td, th, h1, h2 {font-family: sans-serif;}     pre {margin: 0px; font-family: monospace;}     a:link {color: #000099; text-decoration: none; background-color: #ffffff;}      It works. But if run via browser - I got just PHP-code:               [User@venti domain.com]$ curl http://domain.com     <?php echo phpinfo(); ?>     Hello      And - nothing in errors (both `/var/log/httpd/domain.com-error.log` and `/var/log/httpd/error_log`). Also - nothing in `/var/log/httpd/suexec.log`, just entries with:               [2014-09-12 15:30:31]: uid: (500/setevoy) gid: (500/setevoy) cmd: php.cgi      after setevoy.org.ua access. So, seems - **suEXEC** doesn't run `/var/www/php-cgi/User/domain.com/php.cgi` at all... But - why? Can't find - what I'm missed there?


title: Is there a UNIX command to list all recently removed files from a system

text: Accidentally a `rm -rf` command was launched to my root directory instead of current directory. I stopped file removing by `Ctrl`+`C` but some files has already been removed. Is there a LINUX command to list all recently removed files from the system to get the affected applications ? Operating System: CentOS 6.3


title: What UNIX File permissions would be necessary for someone to GCC compile my .C program?

text: I have written a .C program and submit this file to someone in UNIX. However, I didn't change the permissions for the file, beyond whatever they were when it was created. I am simply wondering if i royally screwed up, and they will not be able to use gcc to compile the program, and then run a.out. The permissions were listed as:               -rw-------


title: Install OS in a directory

text: We can have the full filesystem structure of any OS in a directory. To which we can `chroot`, so it will behave as good as native login. Is there any way to install the an OS onto a partition with the help of chroot ? e.g. I want to install Ubuntu-14.04 in my `/home/SHW/Ubuntu-14.04` directory. Once installed, I can chroot into it and can do some user-space work ( Installing the OS onto a partition and mounting that at /home/SHW/Ubuntu-14.04 is not what I'm looking for)


title: Which directories are writeable in a system following FHS?

text: I need to ensure that, when deleting a specific user from a system, all of his/her files are removed. User creation/deletion will happen a lot on this system, so I want to reuse UID's and want to ensure the new user does not have access to any files of the old user. My question is two-fold:   1. Is there a general and easy way to find all files owned by a specific user? Or is a system-wide `search -uid n` my only option?   2. If a system-wide search is the only option, then which directories are generally writeable by a normal user (suppose a distribution following FHS)?      * His home directory     * /tmp     * ?? The user does not have `sudo` privileges, so he can only write in places that are world-writable in a standard Unix filesystem.


title: Synchronize software packages between different Linux distributions

text: Is there any way to synchronize software packages between different Linux distributions? There are several software packages that I need to synchronize between a Linux Mint installation and an Ubuntu installation. Ubuntu already provides a software synchronization service, but it would be even better if software packages could be synchronized between multiple Linux distributions. In order to do this, I would need to find a package installation method that would work on all Linux distributions, and periodically download a list of packages from a central server.


title: How to rebuild a two drive raid 1 array on Linux?

text: I need to rebuild a two drive (160x2) raid 1 (mirror) array. It was an Intel raid from a 7 year old Dell computer (Windows). Both drives are assumed to be functioning. The raid was created with an on-board motherboard raid program. It's been quite a while since I had to rebuild a raid, and the last time it was a raid 5 that had been created on Slackware. Where do I get started? I'm putting them in my personal machine and I'm guessing that Linux is going to be the tool to get this done.


title: No communication services enabled following startup

text: I recently installed Parsix (Debian) on my system, and I've been struggling to figure out how to autostart my services. Of the list of services that don't run and should run are:   * ssh   * apache   * mysql They run easily enough with the generic: `service ssh start`, and when I run               > update-rc.d ssh defaults      System startup links for /etc/init.d/ssh already exist.      As an added note:               > service ssh status     [FAIL] sshd is not running ... failed!      Edit: `ls /etc/rc*.d/*ssh*` produces               /etc/rc0.d/K50ssh  /etc/rc2.d/K50ssh  /etc/rc4.d/K50ssh  /etc/rc6.d/K50ssh     /etc/rc1.d/K50ssh  /etc/rc3.d/K50ssh  /etc/rc5.d/S50ssh      (does K mean "Kill"??)   Also, the current run-level is set to 5.


title: Why do piping and redirection work differently with here documents?

text: Combining a redirect with a here document seems logical enough:               $ bash > foo <<EOF     echo Hello     EOF          $ less foo     Hello      But with a pipe it behaves differently:               $ bash | tee foo <<EOF     echo Hello     EOF          $ less foo     echo Hello      What's also weird is if you immediately type 'history':               $ bash | tee foo <<EOF     echo Hello     EOF     $ history     $ history     1 ...      That is, the first command still seems to be inside the newly created bash. What's going on? Why does the pipe behave differently?


title: Can't install iwlwifi driver in Crunchbang

text: i just installed Crunchbang 10 to my Laptop in dual boot with win7, my wlan card is a Intel(R) Centrino(R) Wireless-N 2230. I saw i had no wifi, so I tried to install the driver from here, by extracting them and typing:               sudo su     cp iwlwifi-2030-6.ucode /lib/firmware      After that i rebooted and still had no Wifi. Why?


title: Linux Mint 16: Petra - Can't wake from hibernate

text: I have used Linux Mint 16 Petra - cinammon version for a few months. At first hibernate worked pretty well. Now I cannot wake from it - when I try to, the screen just goes blank and nothing responds and I need hard reboot. Here are some commands from suggestions from another thread (ask me if you need more info): `uname -a`:               Linux bartoszkalinowski-PC 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux      `inxi -G`:               Graphics:  Card: Intel Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller                 X.Org: 1.14.3 drivers: intel (unloaded: fbdev,vesa) Resolution: 1920x1080@60.0hz                 GLX Renderer: Mesa DRI Intel Ivybridge Desktop GLX Version: 3.0 Mesa 9.2.1      I use Intel graphics HD4000 I think (i5 3570K) - maybe the case is with graphic drivers? I tried installing them manually but I've read they are included in the kernel and there shouldn't be any trouble with this integrated graphics card.