How do I set up proper ownership of these files?

I need the directory `/var/www/` (and everything inside it) to be modifiable by only authorized users. The way I tried to do this was:               sudo groupadd webmasters     sudo usermod -G webmasters pi # My user is pi     sudo chown -R root:webmasters /var/www/     sudo chmod -R ug+rw /var/www/      ...but I can't modify anything in `/var/www/`, nor can I create new files in it. What am I doing wrong? How do I set this up the way it needs to be? What I'm envisioning is:   * Everyone in the group `webmasters` can create, delete, and edit files in `/var/www/`   * All newly-created files/folders are owned by `root:webmasters`   * All newly created files have permissions 775: `-rwxrwxr-x`   * Is is _vital_ that **no one** without authorization be able to have write permissions, OR any sort of Setuid/Setgid ability. (Authorization for write access can only be granted by Root.) Am I taking the wrong approach to this? Do I have the right idea, but I'm just messing something up? What's going wrong?


How and where can I permanently set $ program file to have extra argument '&'

When I run a program from terminal like so:                $ program file        For example                $ gedit myfile.txt      I cannot think of a time when I would not prefer to use '&' so that I can free up my terminal for use while the program is running. Does anyone know where or how I might set this '&' as an argument for such situations?


Difficulty setting up iptables

I'm very new to *nix operating systems, and I'm having some trouble which I believe is because of misconfiguration of the iptables firewall. My server has SSH running on port 22, and server software running on TCP port 25565. SSH and the server software respond appropriately to connections made from inside the network (that is, connections made using the server's local address, 10.0.0.xx). However, if I attempt to access them from outside the network or using the router's external IP address, they do not respond. The router is configured to forward those ports to the server; I very much doubt there is an error there. After researching iptables, I tried a few guides, but I am not seeing any results. The output of iptables -L is as such:               Chain INPUT (policy DROP)     target     prot opt source               destination     ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh     ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:25565     ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http     ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:27015     ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED          Chain FORWARD (policy ACCEPT)     target     prot opt source               destination          Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination      An nmap scan from inside the network reports that port 22 and 25565 are open, and that ports 80 and 2705 (another server software that I am not running at the moment) are closed. Running nmap with the router's external IP returns no useful results; I believe the router is detecting the scan attempt and refusing to respond. The server is running Debian in text-only mode. Does anyone see what the problem is, or have troubleshooting steps to suggest? In response to comments: netstat -tpln gives the following (among other things); I assume this is good, though the difference between tcp and tcp6 escapes me.               tcp6       0      0 :::25565                :::*                    LISTEN      3092/java      Hosts.deny is devoid of entries. However, /var/auth.log has some... _interesting_ contents. Is it normal for people to start trying to bruteforce my root password the very minute SSH is exposed? But yes, a perusal of the logs seems to suggest that I'm the only person who cannot SSH into my server.


Wake monitor from sleep remotely

I have an Ubuntu server running `xdm` with `openbox` on which is plugged a monitor that displays a video which is launched via a cron daemon. When the monitor is not used for a certain amount of time, it goes into sleep mode and I cannot wake it up with the video process : The monitor stays black. How can I wake the monitor? Without installing packages if possible, and without a physical access to the machine.


area on disk after the MBR and before the partition start-point

If I use a MBR partitioning scheme and create a primary or extended partition with `fdisk`(version 2.20.1), then it starts on sector 2048. If I remember correctly, then older versions of `fdisk` started the first partition on sector 63. If MBR needs only 512 bytes, then why doesn't the first partition start on sector 2? What is kept on those 2047 sectors? Some stage of the boot- loader?


Issues in XRDP installation on Cent OS 6.5

I already went through the similar issue tracked in Installing XRDP on Cent OS 6.5, however it haven't helped me to fix. I am using MAC and trying to install XRDP in CentOS release 6.5 (64 bit). So that I can connect to this Centos machine from MAC. I followed the steps explained in http://ajmatson.net/wordpress/2014/01/install-xrdp-remote-desktop-to- centos-6-5/ Created a new VNC user account named **_user_name_one_** and allotted a password as mentioned in http://wiki.centos.org/HowTos/VNC-Server Now, when I tried to connect Centos using Remote Desktop Connection (from MAC), I am receiving following error: ![enter image description here](http://i.stack.imgur.com/fSfDt.png) Initially my vncservers configuration in etc/sysconfig/vncservers are as follows:               VNCSERVERS="1:user_name_one"     VNCSERVERARGS[1]="-geometry 800x600"      As suggested, now changed the config values as follows:               VNCSERVERS="0:user_name_one"     VNCSERVERARGS[0]="-geometry 800x600"      **Error log in /var/log/xrdp-sesman.log:**               [20140416-06:43:43] [WARN ] [init:45] libscp initialized     [20140416-06:43:43] [CORE ] starting sesman with pid 1442     [20140416-06:43:43] [INFO ] listening...     [20140416-06:46:56] [INFO ] scp thread on sck 7 started successfully     [20140416-06:46:56] [INFO ] ++ created session (access granted): username user_name_one, ip 202.83.25.7:13889 - socket: 7     [20140416-06:46:56] [INFO ] starting Xvnc session...     [20140416-06:47:06] [ERROR] X server for display 10 startup timeout     [20140416-06:47:06] [INFO ] starting xrdp-sessvc - xpid=1717 - wmpid=1716     [20140416-06:47:06] [ERROR] X server for display 10 startup timeout     [20140416-06:47:07] [ERROR] another Xserver is already active on display 10     [20140416-06:47:07] [DEBUG] aborting connection...     [20140416-06:47:07] [INFO ] ++ terminated session:  username user_name_one, display :10.0, session_pid 1715, ip 202.83.25.7:13889 - socket: 7      **Log file found under /home/user_name_one/.vnc/SPU4-1-3-24-47230 :1.log**               Xvnc TigerVNC 1.1.0 - built Feb  4 2014 05:26:31     Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)     See http://www.tigervnc.org for information on TigerVNC.     Underlying X server release 11300000, The X.Org Foundation          Initializing built-in extension Generic Event Extension     Initializing built-in extension SHAPE     Initializing built-in extension MIT-SHM     Initializing built-in extension XInputExtension     Initializing built-in extension XTEST     Initializing built-in extension BIG-REQUESTS     Initializing built-in extension SYNC     Initializing built-in extension XKEYBOARD     Initializing built-in extension XC-MISC     Initializing built-in extension XFIXES     Initializing built-in extension RENDER     Initializing built-in extension RANDR     Initializing built-in extension DAMAGE     Initializing built-in extension MIT-SCREEN-SAVER     Initializing built-in extension DOUBLE-BUFFER     Initializing built-in extension RECORD     Initializing built-in extension DPMS     Initializing built-in extension X-Resource     Initializing built-in extension XVideo     Initializing built-in extension XVideo-MotionCompensation     Initializing built-in extension VNC     Initializing built-in extension GLX          Wed Apr 16 06:43:46 2014      vncext:      VNC extension running!      vncext:      Listening for VNC connections on all interface(s), port 5900      vncext:      created VNC server for screen 0     No protocol specified     vncconfig: unable to open display ":0"     No protocol specified     xrdb: Resource temporarily unavailable     xrdb: Can't open display ':0'     No protocol specified     xmodmap:  unable to open display ':0'     No protocol specified     No protocol specified          ** (gnome-session:1605): WARNING **: Cannot open display:       Can anyone please help me on this! Thanks.


Expansion of the word UNIX?

Is UNIX an acronym? What does it stand for?


Kate replaces alignment spaces by tabs

When indenting a block of code in Kate (3.11.2), spaces used for alignment are replaced by tabs, ruining all alignments and putting me in the hell of restoring all these spaces. Example:               if (true)     {     —→$foo = 'bar'.     —→•••••••'baz';     }      (`—→` are tabs, `•` spaces) I indent using two characters wide tabs. The problem is when I select these lines and press the `Tab` key to add an indentation level: it replaces groups of two spaces by one tab:               —→if (true)     —→{     —→—→$foo = 'bar'.     —→—→—→—→—→'baz';     —→}      Removing the last (odd) space. This is wrong since tabs width is undefined and must be able to vary without breaking the code presentation. In my settings (`Editor Component → Editing → Indentation`), I set `Indent using` on `Tabulators and Spaces` but it doesn't save it and returns immediately on `Tabulators`. Is it a bug? Or is my Kate misconfigured?


Linux driver for MSI z87 MPOWER motherboard NIC?

I am using Linux with the following hardware configuration:               1) Intel Core i7 3.4GHhz 4770k     2) MSI Z87 MPower motherboard     3) MSI GeForce GTX760 2GB DDR5 graphics card     4) 1TB hard drive     5) 16GB RAM      And I can't connect internet in it. I enabled the LAN port from BIOS. My LAN is " **MSI Z87 MPOWER Atheros Killer LAN** " I think Linux don't have any driver for this LAN port, if any body knows when can i get a driver for this LAN for Linux. Please inform me.


How would one permanently set names for network interface (wifi/ethernet) in arch

Seems every reboot the names reverse different nics ( wifi/ethernet )…


Generate suggestions for errors from a lookup dictionary

EDIT: the files were changed to tsv to deal better with spaces in text fields I have 2 csv files in the following form: ### File 1: availableText.csv (can be very big) > "id1" , "text1-1"   >  "id1" , "text1-2"   >  "id1" , "text1-3"   >  "id1" , "text1-4"   >  "id2" , "text2-1"   >  "id2" , "text2-2"   >  "id2" , "text2-3"   >  "id2" , "text2-4"   >  ... ### File 2: wrongText.csv > "id1" , "texta"   >  "id2" , "textb"   >  "id3" , "textc"   >  "id4" , "textd"   >  ... For every line in `wrongText.csv`, I want to filter the available text entries for the same id and suggest the best available option using `tre-agrep` (a grep-like functions that allows error in the pattern and using -B returns the best match) For example, for `id1`: > tre-agrep -B 'texta' (from text1-1:4) | tr "\n" "$"   >  ( will produce something like 'text1-2$text1-4' ) The desired output file would be like this: > "id1" , "texta" , "text1-2$text1-4"   >  "id2" , "textb" , "text2-1$text2-3$text2-4" Note:   1. The CSV can be converted to any format, but text may contain spaces (but not special characters)    2. IDs do contain both special characters and utf-8    3. Speed does not matter (for now at least)


How to run Gimphoto/Gimpad from command line?

In short, my question is this: what command line should I use to run Gimpad? Because Gimphoto it simply doesn't wont to react to my command when I click on the icon although it is installed and it worked fine at first, for several times. So, I think that if I will use a command line, I will force it to arise from the dead. My OS came with Gimp pre-installed, but I have tried Gimphoto on a Windows system and I liked a lot. So I tried to install it on my Linux too. Unfortunately, doing that is very difficult and tricky for a beginner, as you can see on their site. After several attempts I saw that Gimpad appeared in the menu and, it responded to my clicks. But all this worked only for several times. Now it has stopped to respond, although, since the moment I saw it works, I have made no changes related to Gimp and its "family". So, can you tell me an useful command line to force Gimpad to appear (and thus, to have a real Gimphop)? Even so, using a command line every time I open Gimpshop, is not very handy, so, if you have any other - permanent and easy - solution to solve this problem, I would be most grateful to hear it. Note: I don't know if this information is helpful, but I have observed that after installing Gimpshop, the splash-screen and everything related to the program remained labelled as Gimp, not Gimphoto or else, like you can see under Windows, when you use the Gimp-family. I am using Zorin OS which is based on Ubuntu 12.04, and I am quite new to it although I like to use the terminal for small things like updating and upgrading system, installing and even opening apps (mostly if and when they get stubborn like in this case).


When networkmanager is used, OpenSuSe gets stuck during boot for 10 minutes

I have this problem on all machines that I every installed (different configurations, different geographical locations, even different OpenSuSe versions) and it's extremely irritating. When I turn on network manager, all machines simply hang during boot. It seems that they hang on mounting network file systems. This happens even if the machines are connected to wired network (I would understand if it would happen only on WiFi). Now, this problem disappears if I turn of auto mounting of NFS partitions (each machine mount at least one), by setting the noauto in /etc/fstab. A solution would be keeping the noauto and leaving the automount to some daemon, that is started later, or fixing the problem with network manager. Any ideas?


best BSD distro for Desktop PCs?

I want to know if the bsd distros are for the desktop usage at all If yes; What is the Best bsd distro for desktop usage some thing like ubuntu linux which is easy to use and good GUI management instead of command line system management


calling sigprocmask from bash

I have a process that spawn a bash command with `system()` while the signal mask has all the signals blocked. This cannot be fixed easily. The bash command eventually `exec`s into a process. The all blocked signal mask is inherited from the original process through bash to the final process, so in the end I get a process that is "immune" to all the signals (except of course `SIGKILL`, `SIGSTOP`, etc). The workaround would be resetting `sigprocmask` from bash, but I cannot find any related command. Is it possible to do?


How do I redirect command completion output?

On the command line, I can redirect or pipe output of a command to a file or another command using the `>` or `|` operator after the command. I have come across a less standard situation that I would like to redirect the output to a file, but I don't seem to have the oppurtunity to redirect it: When at a new terminal,               [chiliNUT ~]$      if I press `Tab` without typing anything first, I get asked               display all 1725 possibilities? (y or n)      and if I then type `y`, I get a nice long list of different commands. How can I redirect or pipe this output to a file? I don't seem to get the chance to type `> myfile.txt` anywhere. Using _CentOS release 6.4 (Final)_.


Configuring CentOS apache server to default to a specific port for ExpressJS and Node

Completely new to Linux and virtual private servers so please bear with me. I have a webapp built on ExpressJS and NodeJS that runs on `port 5000` of my server, accessible via web by typing: `http://00.000.000.000:5000`. When you go to my non-port IP address (`http://00.000.000.000`) it shows the CentOS Apache setup welcome page. I've tried running my Express app on `port 80`, but I get an `Address In Use` error. What do I have to do to set up CentOS so that accessing its IP address at `00.000.000.000` loads up my Express app? I've tried adding `port 5000` to listeners in my `/etc/httpd/conf/httpd.conf` file but this did nothing.


Having trouble executing a compiled C program

I am running an Ubuntu v10.04 through VirtualBox. To test the persistence of files I create in the virtual machine, I wrote a very basic C program. When I shutdown the virtual machine and restart it, I see that the files have been retained. **What happens:**   * I can check the directory with `ls /root/` and see both `program_name.c` and the compiled `program_name`   * I use this command to compile: `gcc program_name.c -o program_name`   * I can run `./a.out` and the program will execute properly.   * Opening the C code with `nano program_name.c` shows the program, as I expect it to be. **The problem is...**   * When I try to the program via `./program_name`, nothing happens!   * If I check the exit status (`echo $?`), it is zero. **So what gives...?** I am a beginner, clearly, and I am having difficulties understanding why I can't run the compiled C program, even though I can find it. It is most bizarre to me considering I can locate all the files AND `./a.out` executes it properly. **EDIT:** Edited for clearer presentation. **Edit regarding answer...** In the off chance that someone else comes to this looking for help, it should be noted that while the `file program_name` command did expose that the file was blank, the cause hasn't been determined. I successfully ran the executable before I restarted the virtual machine. Perhaps I didn't shut down the virtual machine properly? Anyways, checking the file was/is certainly helpful!


when update kernels do they close bugs?

I'm not an expert in linux but when I upgrade my kernel to latest stable one which is 3.12.2, **does it close all security bugs**? How linux security bugs be closed? by installing newer kernel or how ??and who closes these bugs?


Screwed up my bash prompt, what happened?

I just thought I might get version information about the current bash by entering               bash -v      That brought many lines of code to stdout and left me with a line that appears right above my usual promt               printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"     [foo@bar path]$      I think I have a tiny clue what this might be (the code that renders how the prompt looks like), but I have no idea whatsoever how to get rid of this. Who does?


/var has most of the drive space. Need / to have most of it

So when my host setup my dedi, they seemed to apply most of the drive space to /var I am on cpanel, and need most of the space for the /home directory where all the accounts and data are. But on previous dedi's ive had the majority of the drive was just assigned to / This is what I get when I do a                   df -h                   Filesystem            Size  Used Avail Use% Mounted on         rootfs                 20G   16G  3.7G  81% /         /dev/root              20G   16G  3.7G  81% /         none                   16G  404K   16G   1% /dev         /dev/md2               92G   14G   74G  16% /var         /dev/loop0            4.0G  139M  3.7G   4% /tmp         /dev/loop0            4.0G  139M  3.7G   4% /var/tmp         /dev/root              20G   16G  3.7G  81% /var/named/chroot/etc/named         /dev/root              20G   16G  3.7G  81% /var/named/chroot/usr/lib64/bind      Not sure why its like this. Can I somehow use the 92G for / rather then /var without losing any data and things going tits up? I am on centos 6 if that helps. thanks mike


Why does mount require root privileges?

Why does Linux require that a user be root/using sudo/specifically authorized per mount in order to mount something? It seems like the decision as to whether to allow a user to mount something should be based on their access rights to the source volume/network share and to the mount point. A couple of uses for non-root mounting are mounting file-system images to a user owned direction and mounting a network share to a user owned directory. It seems like if the user has control over both sides of the mount equation everything should be cool. **Clarification of access restriction:** I feel I should be able to mount anything that the user otherwise would have access to to a mount-point that the user is the owner of. For instance, on my computer /dev/sda1 is owned by user root and group disk with permissions `brw-rw----`. Therefore non-root users can't mess with /dev/sda1 and clearly mount shouldn't allow them to mount it. However if the user owns /home/my_user/my_imagefile.img and mount point /home/my_user/my_image/ why shouldn't they be able to mount that image file on that mount point with:               mount /home/my_user/my_imagefile.img /home/my_user/my_image/ -o loop      As kormac pointed out there is a suid problem. So some restrictions would have to be added to prevent suid from being a problem as well as potentially some other issues. Perhaps one way to do this would be to make the OS treat all files as belonging to the user that did the mounting. However for simple read/write/execute, I don't see why this would be a problem. **Use case:** I have an account in a lab where my home space is restricted to 8GB. This is tiny and very very annoying. I would like to mount an nfs volume from my personal server to essentially increase the amount of room that I have. However, because Linux does not allow such things I'm stuck with scp'ing files back and forth to stay under the 8GB limit.


Determine if the current user has write permission in a directory

I know you can determine the owner of directory by doing:               ls -ld ~/foo | awk '{ print $3 }'      You could then compare it to the current user by doing this:               if [[ $(ls -ld ~/foo | awk '{ print $3 }') == "$USER" ]] # or $(id -u -n ) instead of $USER     then         echo "You are the owner"     else         echo "You are NOT the owner"     fi      But you can have permissions to write without being the owner. How do you determine this?


Prevent tmux from starting up on SSH

I would like `tmux` to create a new-window when I ssh onto a machine from an existing tmux session. However, I do not want a tmux session started on the new machine! I have the following in my `.bashrc`, so that `tmux` automatically starts up:               if [[ "$TERM" != "screen" ]]     then        # try to attach to existing session, or start a new one        tmux attach-session -t "$USER" || tmux -2 new-session -s "$USER"        exit     fi      I also have an `ssh` function:               alias ssh='ssh_func'     ssh_func (){         if [[ "$TERM" == "screen" ]]; then             tmux new-window -n "$1" "ssh $@";         else             /usr/bin/ssh "$@";         fi     }      This works ok, but I do not want a tmux session started on the machine I ssh to, because this gives me 2 sessions in the same terminal window. Is there anything I can put in my `.bashrc` so that tmux does not start up on a machine if the ssh command has been invoked from a tmux session? I am using PuTTY and tmux 1.5.


enabling thinkpad fn keys in openbox

I recently abandoned `gnome` and switched to a minimal `openbox` setup without any desktop environment. However, of the function keys on my laptop (ThinkPad), only the brightness keys are now responsive (they all worked properly in my previous desktop environment -- gnome 3 fallback). How can I restore function to the other Fn keys (volume, display device, etc)?


Arch Linux and Windows

I know this place maybe isn't the best place to ask for help with this specific question, but I guess you can help. I have a UEFI system with partitions arranged as follows:               #      # /etc/fstab: static file system information     #     # <file system> <dir>   <type>  <options>   <dump>  <pass>     # /dev/sda2     UUID=1839555a-70c8-4fec-8938-cfd7a16ecc6d   /           ext4        rw,relatime,data=ordered,discard,noatime    0 1          # /dev/sdb1     UUID=6d26afd2-cc3e-44a4-b5bd-ea209cd4343d   /home       ext4        rw,relatime,data=ordered,discard,noatime    0 2          # /dev/sda1     UUID=7628-D37A          /boot       vfat        rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro    0 2          # /dev/sdb2     UUID=f37bdb49-1d0f-4455-8f2d-559b923bfb40   /var        reiserfs    rw,relatime 0 2          # /dev/sdb3     UUID=96c1dbed-cf83-4a2e-9fc2-dcd9fa01a6bb   /tmp        reiserfs    rw,relatime 0 2      (note that this is my system's fstab) now, here is some info about how these partitions are arranged and their sizes: hardware:               SSD - 60Gb     HDD - 500Gb      / - about 20Gb on the SSD   /boot - about 1Gb on the SSD /home - about 100Gb on the HDD   /var - 10Gb on the HDD   /tmp - 1Gb on the HDD That means that I have about 389 Gb of empty space on the HDD, I want to use 100~200Gb from those to install Windows for games but I also want to keep some space for installing Gentoo. What would be the easiest way to install Windows? I don't want to put it on the SSD and won't use it for anything other than gaming, and I don't want to ruin my current Arch setup. Also can use the same /tmp partition in Arch or Gentoo? or it isn't possible? Same question but with a swap partition (that is if I eventually have to use one). BTW what about using a VM? is it worth it? I have 8Gb RAM and can easily get more... And do you have any other recommendations?


Stat usage in truss command?

I want to get the access time and modification time of the file in unix solaris machine. The `stats command was not found in that solaris machine. Could you please suggest which is the alternative command to find the access time and modification time of the file? I used the following (which clearly didn't work):               sftp> truss -f -v 'lstat,lstat64' ls -d 140901.log     Invalid command.      Could you please suggest the command?


debian/XFCE Virtualbox Guest on a Mac: how to use home and end keys?

So I have a Mac, and rather than boot debian/XFCE directly and have to configure hardware drivers I'm using VirtualBox. This means that my multitouch trackpad works well, and I can jump in and out of the VM very easily. I have correctly configured my keyboard mapping, including those pesky alt shortcuts, and everything. The problem comes from the lack of `home`/`end` keys. In OS X, I've got used to using `Ctrl+A` for `home` and `Ctrl+E` for `end`, which works everywhere (Terminal, obviously, plus TextMate, and even in forms in Chrome). However, in XFCE this only works inside a terminal by default. I'd like to extend that shortcut (or, indeed, something like `Ctrl+Left`/`Ctrl+right`, since `Ctrl+E` seems to actually be used in applications like eclipse) to map to `home`/`end` as global keyboard shortcuts. However, the two places where we can configure shortcuts in XFCE (Settings -> Keyboard -> Application Shortcuts, and Settings -> Window Manager -> Keyboard) the first wants a "command" to run on a particular shortcut, and the second doesn't allow you to add custom actions. Do I want to do this in a lower level configuration, like Xorg or something, or is there a way to configure global shortcuts like this in XFCE?


Unable to ping gateway & other Linux boxes on same network

I'm somewhat new to Linux, but I'm trying to network a few Linux machines. I can't seem to be able ping the gateway or the other Linux machines. My scenario: I have a few Linux boxes set up on a `10.45.89.x` subnet with the gateway being `10.45.89.1`. On all of these, I'm unable to ping anything except `127.0.0.1`. I'm wondering if I need to modify any of the routing tables or hosts file. Below is a few commands and their output. Perhaps I need to check something else? ### netstat -r output:               10.45.89.0   *   255.255.255.0    U     10.112.0.0    *    255.255.0.0    U     169.254.0.0    *    255.255.0.0    U     default    10.45.89.1    0.0.0.0    UG      ### /etc/hosts               127.0.0.1 localhost.localdomain  localhost     127.0.0.1 localhost.localdomain  localhost     9.37.253.154 rpt.rhn.linux.ul.com      ### /etc/resolv.conf               domain demolotus.com     namserver 127.0.0.1      ### /etc/sysconfig/network               NETWORKING=yes     NETWORKING_IPV6=no     HOSTNAME=st852.demolotus.com      ### ip route show dev eth0               10.45.89.0/24  proto  kernel  scope  link  src  10.45.89.138     default via 10.45.89.1      ### ifconfig               eth0    Link encap:Ethernet  HWaddr 00:0C:29:01:28:CD     inet addr:10.45.89.138  Bcast:10.45.89.255 Mask:255.255.255.0     UP BROADCAST MULTICAST MTU:1500 Metric:1          eth0:0 Link encap:Ethernet HWaddr 00:0C:29:01:28:CD     inet addr:10.45.89.139  Bcast:10.45.89.255 Mask:255.255.255.0     UP BROADCAST MULTICAST MTU:1500 Metric:1      ### ip addr show dev eth0               2: etho0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000     link/ether 00:0c:29:01:28:cd brd ff:ff:ff:ff:ff:ff     inet 10.45.89.138/24 brd 10.45.89.255 scope global eth0     inet 10.45.89.139/24 brd 10.45.89.255 scope global secondary eth0:0      Any suggestions are greatly appreciated. Thanks!


locate vs find: usage, pros and cons of each other

In Linux and Unix systems there are two common search commands: `locate` and `find`. What are the pros and cons of each? When one have benefits over the other?


What are the steps needed to get Redhat/Centos 7 to boot from an mdadm RAID?

I've spent a day on this. Figured it was time to ask. In the end I couldn't get around "Bad magic number in super-block ..." On an average install, my sda exits setup as an EFI. I'm cool with that but it makes it tough to follow most of the recipes out there. These 2, found 'em here (Best way to create RAID on an existing system drive) got me close to joy: http://community.spiceworks.com/how_to/show/340-lvm- single-drive-to-lvm-raid-1-mirror-migration http://www.howtoforge.com/how-to- set-up-software-raid1-on-a-running-lvm-system-incl-grub2-configuration- ubuntu-10.04 I'm running SSDs so I really want my sys on RAID1 ... Appreciate the help!!


Matching two files for similar first line

I have 2 set of files. File one contains ID's ex:               1111     2222     6666     3333     4444      File two contains ID and username:               1873 Neil     1111 Roger     7632 Tim     3333 Oscar     8723 Greg     4444 Roy     6666 Patrick      I want to extract the ID and username, but only the ones that has the same ID as in file 1. I did the normal `grep -f file1 file2`, on two test files I made, with few Id's such as the ones i just posted. However, when i apply this to the two proper files, where file1 contains 3500 ID's and File2 contains 12000 ID's + Username, instead of extracting the 3500 lines that occur in both files, it extracts 12000 lines. However, with the 2 test files, and a few dummy ID's it will only extract the correct ids and leave the others. Any tip on what's wrong?


Why I failed to reboot my centOS after I updated linux kernel?

I got a reboot error like the one showing in the picture      ![enter image description here](http://i.stack.imgur.com/HRCpM.png) I installed kernel using these commands:               make mrproper     cp /boot/config-2.6.18-371.11.1.el5 .config     sh -c 'yes "" | make oldconfig'     make menuconfig     make -j4     make -j4 modules_install     make install       No errors were found. Then I changed `/etc/grub.conf` to set default boot kernel. I could log in CentOS if other Linux kernel version was selected.


Run level script - Help

I want the following command to be ran, as soon as system boots.               glances -s -P redhat &      How to achieve that? I tried writing a run level script which didn't work as expected.


FreeBSD on RPi doesn't see TP-Link wifi dongle

I've installed FreeBSD 10 on a Raspberry Pi via Crochet. I'm trying to get it to work with a TP-Link TL-WN727N v3 USB wifi adapter, which should be supported and seems to work for others (though presumably on more standard hardware) via the `run` driver. However, though I can see a message in `dmesg` when the device is connected, I don't seem to see something indicating that the driver recognizes it and can use it, nor does `ipconfig` seem to want to have anything to do with it. Here's all that appears in `dmesg` when I connect the dongle:               ugen0.4: <TPlink> at usbus0      I should be seeing more messages from `run`, right? At any rate, `ifconfig` does not abide:               Pi ~> sudo ifconfig wlan0 create wlandev run0     ifconfig: SIOCIFCREATE2: Device not configured      The instance of the system that Crochet creates was pretty bare-bones, so I can't help but wonder if I'm missing a needed kernel module or something, but I'm not sure what I could be missing. Here's output that may be relevant…               Pi ~> cat /boot/loader.conf      ehci_load="YES"     uhci_load="YES"     ohci_load="YES"     usb_load="YES"     wlan_load="YES"     wlan_wep_load="YES"     wlan_ccmp_load="YES"     wlan_tkip_load="YES"     wlan_amrr_load="YES"          if_run_load="YES"     runfw_load="YES"          Pi ~> kldstat     Id Refs Address    Size     Name      1   27 0xc0100000 5b0290   kernel      2    1 0xc06b1000 222f0    if_run.ko      3    3 0xc06d4000 ae48     firmware.ko      4    6 0xc06df000 5b51c    wlan.ko      6    1 0xc0751000 1391c    uhci.ko      7    1 0xc0765000 12fac    ohci.ko      8    1 0xc0778000 a024     wlan_wep.ko      9    1 0xc0783000 e418     wlan_ccmp.ko     10    1 0xc0792000 b3c4     wlan_tkip.ko     11    1 0xc079e000 9c18     wlan_amrr.ko     12    1 0xc07a8000 ac34     runfw.ko      So `ehci` isn't loading, though it doesn't load manually either, and at any rate I don't know if that's relevant to this…               Pi ~> sudo kldload ehci     kldload: can't load ehci: No such file or directory     Pi ~> ls /boot/kernel/ehci.ko     /boot/kernel/ehci.ko      What should I look at next? EDIT: `usbconfig` output by request:               Pi ~> sudo usbconfig     …     ugen0.4: <802.11 n WLAN TPlink> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (450mA)


Arrow keys spontaneously stop working in vim

I recently upgraded from OS X 10.6 (I think) to 10.9. Since then it seems, while editing in `vim`, the arrow keys will "spontaneously" stop working. At one point, in frustration I "mashed" one of the arrow keys and was _eventually_ shown a "E388 Couldn't find a definition" error. All other times I've experienced it, the arrows, having worked for awhile, suddenly start _dinging_ at me! Quitting and reopening solves the problem _temporarily_. But, I'd like to _prevent_ it! Anyone know what this might be? And how to fix it? * * * It looks like my default `vimrc` was modified during the update. If my memory is correct, it was a pretty big file previously. Now, it just contains this:               " Configuration file for vim     set modelines=0         " CVE-2007-2438          " Normally we use vim-extensions. If you want true vi-compatibility     " remove change the following statements     set nocompatible        " Use Vim defaults instead of 100% vi compatibility     set backspace=2         " more powerful backspacing          " Don't write backup file if vim is being called by "crontab -e"     au BufWrite /private/tmp/crontab.* set nowritebackup     " Don't write backup file if vim is being called by "chpass"     au BufWrite /private/etc/pw.* set nowritebackup      I have no idea what these options do yet. I'll look into it -- but, hopefully someone here knows more quickly than I can google and read ...


Find out current working directory of a running process?

What command(s) can one use to find out the current working directory (CWD) of a running process? These would be commands you could use externally from the process.


Updating Linux Mint Without Internet Access

I can't afford to have an internet connection at home. Is there any way of figuring out what update I need for my system so that I can download the same onto my USB stick from the office internet connection, take it home and then update my system with the USB stick. EDIT: I'm using windows 7 in the office which is connected to the internet and I need to download all the updates that are needed for the proper functioning of my Linux mint system at home.


How to reduce chrome's virtual memory usage?

I am running a Debian Jessie and having memory issues when using Google Chrome ![Screenshot of a htop sorted by memory usage](http://i.stack.imgur.com/JfJY4.jpg) I tried disabling extensions, disabling cache, flushing the cache, and disabling the web 3d rendering, but nothing really improves. I am getting huge lags some times and I am really wondering where this is coming from.


Emacs font size changes frame size?

I'm using emacs 23.1.1. I set the font size in my .emacs with               (set-face-attribute 'default nil :height 100)      The problem is that my emacs is now really small. The outer box (what I call a window and what I think emacs calls a "frame") is sized normally, but the inner box (which I call a "frame" and emacs a "window", I think) is too small. I tried the suggestions here, but neither of them seem to work. Any ideas? I'm on ubuntu netbook if that's relevant. My entire startup file is:               (add-hook 'after-make-frame-functions       (lambda (frame)         (progn           (set-frame-height frame                 (/ (x-display-pixel-height)                    (frame-char-height)))           (set-frame-width frame                 (/ (x-display-pixel-width)                    (frame-char-width))))))               (autoload 'octave-mode "octave-mod" nil t)     (setq auto-mode-alist           (cons '("\\.m$" . octave-mode) auto-mode-alist))     (add-hook 'octave-mode-hook               (lambda ()                 (abbrev-mode 1)                 (auto-fill-mode 1)                 (if (eq window-system 'x)                     (font-lock-mode 1))))     (tool-bar-mode -1)     (set-face-attribute 'default nil :height 100)      Here is a picture of what it looks like. It might be hard to tell, but the "window" is taking up the whole screen; that whitespace is all inside emacs. ![Emacs](http://i.stack.imgur.com/EQrWA.png)


I am failing to build DocBook-utils

I was following these instructions (DocBook-utils 0.6.14), and now I get the following failure when running `make`:               ...     SGML_CATALOG_FILES=/etc/sgml/catalog \     SGML_SEARCH_PATH=../../doc:.. \         nsgmls ../../doc/docbook-utils.sgml | \         sgmlspl ../../helpers/docbook2man-spec.pl     nsgmls:../../doc/docbook-utils.sgml:1:55:W: cannot generate system identifier for public text "-//OASIS//DTD DocBook V3.1//EN"     nsgmls:../../doc/docbook-utils.sgml:9:0:E: reference to entity "BOOK" for which no system identifier could be generated     nsgmls:../../doc/docbook-utils.sgml:1:0: entity was defined here     nsgmls:../../doc/docbook-utils.sgml:9:0:E: DTD did not contain element declaration for document type name     nsgmls:../../doc/docbook-utils.sgml:11:11:E: there is no attribute "LANG"     nsgmls:../../doc/docbook-utils.sgml:11:19:E: there is no attribute "ID"     nsgmls:../../doc/docbook-utils.sgml:11:34:E: element "BOOK" undefined     ...      This goes on for several more lines.


standard VCS ignore list

What all do you think is the best standard list of ignored files for VCS? For example here's my .gitignore_global file.               # Compiled Sources #     ###################     *.pyc     *.pyo     *.exe     *.so     *.o     *.a     *.la     *.dex     *.class     *.elf     *.ko               # Build Enviornment #     #####################     CMakeCache.txt     CMakeFiles               # Packages #     ############     *.bz2     *.iso     *.dmg     *.7z     *.tar     *.gz     *.zip     *.apk     *.ap_                    # Logs and Databases #     ######################     *.log     *.sql     *.sqlite               # OS and Application #     ######################     .DS_Store     enthumbs.db     *~     *.sw?     Thumbs.db               # IDE Crap #     ############          # Eclipse     .classpath     .project     .metadeta     .pydevproject     .cproject               # KDevelop     *.kdev4               cscope.*     ncscope.*          # Other VCS #     #############     .svn     .hg          !.gitignore          *.old     *.orig     \#*#      Any comments? Things I'm missing? Things that should be there? (I'm sure I'm missing windows ones. Feel free to add them, but I don't dev on windows so I'm going to stay out =] ) I'm trying to keep this as project/language/IDE agnostic as possible. Ie I know the `bin` and `gen` folders in android projects should be ignored, but that should go in the `.gitignore` file in the project imo.


Laptop web cam not recognised by Linux Mint

I am new to Linux and I have a 64-bit Linux Mint 10 but it does not recognise my Lenovo Y650 camera. When I try to open the Video4Linux Control Panel, I get the following error: > Unable to open file /dev/video0   >  Permission denied. Could you please give me any suggestions?


Error: Can't open display: (null) after some time

Each time after a certain amount of time, any attempt to run a graphical program is causing the error "Can't open display". For example:               [shhdup@localhost ~]$ LANG=C xterm      No protocol specified     xterm: Xt error: Can't open display: :0          [shhdup@localhost ~]$ LANG=C xdotool getactivindiw     No protocol specified     Error: Can't open display: (null)     Segmentation fault (core dumped)      Some system info:               Linux localhost.localdomain 3.10.6-2-ARCH #1 SMP PREEMPT Tue Aug 13 09:47:01 CEST 2013 x86_64 GNU/Linux     i3 version 4.6 (2013-08-07, branch "tags/4.6") © 2009-2013 Michael           Stapelberg and contributors     X.Org X Server 1.14.2     Release Date: 2013-06-25     X Protocol Version 11, Revision 0     Build Operating System: Linux 3.9.7-1-ARCH x86_64      Current Operating System: Linux localhost.localdomain 3.10.6-2-ARCH #1 SMP PREEMPT Tue Aug 13 09:47:01 CEST 2013 x86_64     Kernel command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=3bca1b94-7f18-4ec7-a589-e50f295db4fc rw quiet     Build Date: 01 July 2013  10:48:42AM          Current version of pixman: 0.30.2


What is the local6 (and all other local#) facilities in syslog?

## What I understand On *nix servers, we configure sending logs using `facility.severity`, where `facility` is the name of the (let's call it) "component" of the system, such as kernel, authentication, and so on; and `severity` is the "level" of each of the logs logged by a facility, such as `info` (informational), `crit` (critical) logs. So, if I want to send kernel critical logs, I'll use `kern.crit`. The combination of facility and severity is known as the priority, for example...   * priority = kern.crit   * facility = kern   * severity = crit ## Question There are "facilities" called `local0` to `local7`. What in the world are these `local#` facilities? I'm asking specifically about `local6`, since it's usually the most common one I find in searches. My question is actually because I'm configuring Snort (SourceFire Intrusion Sensor) to send logs, so I wanted to know which `facility` to use. My question is not Snort specific though, because `local#` facilities are everywhere; on Cisco and IBM's WebSphere Application Server for instance. ## Research   * `RFC3164`, which is where the syslog protocol is defined, only says:              local6 - local use 6      Which doesn't really describe it, as opposed to:              auth   - security/authorization messages        * In Ubuntu, `man syslog` shows:                 LOG_LOCAL0 through LOG_LOCAL7                       reserved for local use      Also, vague.


How to see which URLs are blocked by Privoxy

I want to see a log of which URLs are blocked by Privoxy, but I cannot find this anywhere. Relevant lines in my configuration file (`/usr/local/var/log/privoxy/logfile`) are as follows:               confdir /usr/local/etc/privoxy     logdir /usr/local/var/log/privoxy     logfile logfile      The log file `/usr/local/var/log/privoxy/logfile` is empty. Are blocked URLs logged in another file? Or how do I turn logging of blocked URLs on?


Why is lighttpd saying "unknown config-key: accesslog.filename"?

I have created a simply vhost on Lighttpd web server and put these lines on the .conf file.               server.errorlog                = "/var/log/lighttpd/error.log"     accesslog.filename             = "/var/log/lighttpd/access.log"      I have read error.log and I found this:               2011-04-22 00:36:58: (server.c.954) WARNING: unknown config-key: accesslog.filename (ignored)      How is it possible? `accesslog.filename` exists, it's an option of the server. I found it on their website: http://redmine.lighttpd.net/wiki/lighttpd/Docs:ConfigurationOptions What can I do?


OpenSuse 13.1 I have an embarrassingly simple question that I'm compelled to ask: How can I tell which apps will "work" inside my desktop environment (Gnome 3)? Do certain apps require KDE? What should I look out for that would tell me? For example, I'm curious about Linux video game emulator programs and noticed a list here: http://www.linuxlinks.com/article/20081012160727880/VideoConsoles.html It's unclear to me which of these require Gnome, which require KDE, and which of these don't work at all inside desktop environment.


Arch Linux iMX6 capacitive touch LCD panel

I want to create an embedded system with a 7 inch capacitive touch screen and am planning on using Arch Linux on a Varscite made Freescale iMX6 quad based SOM development kit for this purpose. What I am struggling to find info on is how I should approach getting Arch Linux ARM running on a new board, as far as I can determine this should not be to hard as there is already a generic release for the iMX6 but I apparently still have to do something to get it running on this specific board but I have no idea what it is and how I should go about doing it. Another thing that I am struggling to figure out is how to deal with setting up Arch to display to an LCD panel like the FM-TPM070800480-01 from Fannal, how is this dealt with? Where do I need to configure timing for the display etc.? The last thing I need to find out is how I would go about getting Arch to respond to the i2c touch events that capacitive panels generate?


What is the structure of Libvirt Qemu VM dump/save files?

I need to do some exploration of Qemu-KVM virtual machines physical memory (particularly I need to check the fact of the physical memory intersection). In order to do that I'm trying to save VM's state with a `virsh dump` or `virsh save` command. The dumped files have binary structure, and I cannot find a description for that, exepting this unofficial(?) tool. It is told there that `virsh dump` creates file of _QEMU-savevm format_ while `virsh save` gives a Libvirt-QEMU- save formatted file. However, I didn't manage to find these terms on the Internet. I'll be glad if someone could clarify this situation, maybe giving a link to the mislaid documents. Thank you,


Selinux is denying access to mysqld

I have a script that dumps a mysql database. It then compresses the file and this gets stored in my home folder by using cron. The problem is I seem to be getting an error message. > mysqldump: Couldn't execute 'show fields from `auth_group`': Can't > create/write to file '/tmp/#sql_151e_0.MYI' (Errcode: 13) (1) > c2duo_db-22072011.sql Now on my centos server graphical end, it says selinx has denied access to mysqld. Ofcourse if I disable selinux this works fine. _But I need selinux enabled._ Is there a way around this problem? **cron**               10 11 * * 5 /home/sh/mysqlbackup.sh      **mysqlbackup.sh**                 #!/bin/sh              mysqldump -uroot -ppassword --opt c2duo_db > /home/sh/c2duo_db-`date +%d%m%Y`.sql              cd /home/sh         tar -zcvf c2duo_db.tgz *.sql      **EDIT:** Here what I get from the command `grep mysqld /var/log/audit/audit.log | tail | audit2why`.               type=AVC msg=audit(1311581788.889:12363): avc:  denied  { write } for  pid=22102 comm="mysqld" path="/tmp/#sql_151e_0.MYI" dev=dm-0 ino=103481390 scontext=root:system_r:mysqld_t:s0 tcontext=root:object_r:httpd_sys_content_t:s0 tclass=file             Was caused by:                     Missing or disabled TE allow rule.                     Allow rules may exist but be disabled by boolean settings; check boolean settings.                     You can see the necessary allow rules by running audit2allow with this audit message as input.      Also, my mysql server was already installed on this machine. So I guess it is an official repo.


How to use netperf on specific NIC port?

I have two servers, `SERVER` and `CLIENT`. Each server has its own onboard 1 GbE ports, and its own NIC with a 10 GbE port. `SERVER` and `CLIENT` are interconnected on both a 1 GbE switch (administrative traffic) and a 10 GbE switch (data traffic). I want to test the performance of a specific 10 gigabit connection using `netperf`. How do I specify to use the 10 GbE NIC ports instead of the 1 GbE onboard ports? Right now this is what I'm doing:               root@SERVER:~$ netserver     Starting netserver at port 12865     Starting netserver at hostname 0.0.0.0 port 12865 and family AF_UNSPEC          root@CLIENT:~$ netperf -H SERVER -l 15


Use a specific interface for a specific destination subnet (source IP setting)

I am looking for some sort of routing trickery to set a specific source IP: Local machine has two IPs; Eth1: 192.168.0.1 Eth1:2 192.168.0.2 Default gateway is 192.168.0.254 via Eth1 Remote subnet is 10.0.0.0/24 Any traffic that is sent to 10.0.0.x host, I want to leave via Eth1:2 so that it has IP 192.168.0.2 when it is received by the remote hosts, or some how force 192.168.0.2 to be my source IP when talking to 10.0.0.x hosts.


Cant make dual screens work

I installed manjaro on my system. Only one screen is working. The screen that is working is connected to the GPU (nVidia GTX 770). The other screen is connected to the Motherboard (Integrated graphics, Intel HD4600). Xrandr Output is that one screen is connected. I want to point out that this setup works on Ubuntu and Linux Mint. Someone told me it was about Xorg, but he didnt have enough knowledge about it. How can i make it work on Manjaro?


Editing /etc/init.d/mysql to remove mysql.sock automatically

I am running MySQL on a CentOS release 6.5 (Final) virtual machine. It is used for testing Joomla. The phyiscal host reboots frequently, which is fine. The VM, however, does not perform a clean shutdown. When it reboots there is a lock file here: `/var/lib/mysql/mysql.sock` I built a shell script that will remove it for me that i currently execute manually. This works perfectly well but requires that i run it.               #!/bin/bash     sudo mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak     sudo service mysqld restart      It was suggested to me that I edit the /etc/init.d/mysql to automatically remove the lock file for me. While this seems like a good idea the lock file does perform a valuable purpose and to tamper with that im mysqld might be more harmful that good. What can i do to remove the lock file automatically after a reboot?


Why doesn't xsetwacom work from udev?

I made a script to rotate my Wacom Bamboo tablet 180 degrees. It works fine when I execute it as myself (user) or root, but when started from `udev` (i.e. when plugging the tablet into a `usb` port) it won't work. **Udev rules** :               SUBSYSTEMS=="usb", ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d1", ATTRS{manufacturer}=="Wacom Co.,Ltd.", RUN+="/usr/local/bin/red-wacom-bamboo.sh"      **Wacom script /usr/local/bin/red-wacom-bamboo.sh** :               #!/usr/bin/env bash          exec > /tmp/red-wacom.log     exec 2>&1          # I had to do this otherwise xsetwacom would say:     # "Failed to open Display ."     # Is there a way to do this without using my username?     export XAUTHORITY=/home/redsandro/.Xauthority     export DISPLAY=:0          /usr/bin/xsetwacom set "Wacom Bamboo 2FG 4x5 Pen stylus" Rotate half     /usr/bin/xsetwacom set "Wacom Bamboo 2FG 4x5 Finger touch" Rotate half      **Result in /tmp/red-wacom.log** :               Cannot find device 'Wacom Bamboo 2FG 4x5 Pen stylus'.     Cannot find device 'Wacom Bamboo 2FG 4x5 Finger touch'.      (Note that the error in the log means the udev rule itself is not the problem.) I tried setting a `sleep` in the script, maybe it needs a few ms. But that doesn't help.   * Why doesn't this script work when called directly from `udev`?      * How do I fix this?   * Can I call a script from `udev` as a specific user? (e.g. sync `/home` to external backup drive - /home/ is only visible to it's user)


Why does NOEXEC not prevent the specified program from running?

I have tried the NOEXEC in my CentOS6.4 I have edited my `/etc/sudo.conf` file as below :               Path noexec /usr/libexec/sudo_noexec.so      and `/etc/sudoers`:               ssh ALL=(root) ALL,NOEXEC:/usr/bin/passwd      I am sure that the lib for noexec exists in the right path, but as the user ssh still can change password. The NOEXEC did not make any effect, can anyone give some suggestions on it?


how to get Cisco IOS public key for automatic scp connection

I want to backup the running-config of all switches per SCP to a server. Question 1: is this possible with kron? Is there a better way and why? Question 2: how can I get the public key of the switch to auto-authentificate the user to the server? Thank you very much.


How do I find the repo information to setup yum?

I am running openSUSE 12.3 with the KDE 4 desktop. I am trying to install software, and most sites say to use `yum` to do it. I try this, but it appears that I do not have any of these repositories configured for yum. I have added one text file `repo` to the `/etc/yum.repos.d/` directory, which worked fine, but when I do not know how to find out the repository information for all of these other software packages. The sites seem to assume that you have the repository configured already, which in my case does not appear to be true. Can anyone explain to me the best way to get this setup?


Makefile $wildcard only matches top directory

I am trying to implement a makefile for my C project which has a directory structure as follows:               PROJECT_FOLDER:         folder1         folder2         folder // n number of folders         main.c          FOLDER1:         subfolder1         subfolder // n number of subfolders      And subfolder 1 can have further subfolders etc.. etc.. I don't intend on being stupid with my directory structure, the deepest I may go is 1-2 MAYBE 3. Thus far I have:               # A Makefile to build our First_Game_2 project          dirs = * */parse          PROJECT =  main     HEADERS =  $(PROJECT).h     OBJ     =  $(foreach dirz, $(dirs), \             \             $(patsubst %.c,%.o,$(wildcard $(dirz).c)) \             \         )          C99     =  gcc -std=c99     CFLAGS  =  -Wall -pedantic -Werror           $(PROJECT) : $(OBJ)             $(C99) $(CFLAGS) -o $(PROJECT) $(OBJ)               %.o : %.c $(HEADERS)             $(C99) $(CFLAGS) -c $<          clean:             rm -f $(PROJECT) $(OBJ)      My problem is if `parse` contains a subfolder, say `test` to give the structure               PROJECT_FOLDER/parse/test      In such a case, nothing is returned from               $(foreach dirz, $(dirs), \             \             $(patsubst %.c,%.o,$(wildcard $(dirz).c)) \             \         )      I tested the output of the function with the following makefile               # A Makefile to build our First_Game_2 project          dirs = * */parse          PROJECT =  main     HEADERS =  $(PROJECT).h     OBJ     =            C99     =  gcc -std=c99     CFLAGS  =  -Wall -pedantic -Werror           $(foreach dirz, $(dirs), \             \             $(patsubst %.c,%.o,$(wildcard $(dirz).c)) \             \         )      Which, given a structure of:               dirs = * */parse */parse/test      Produces an output of:               main.o parse/parse.o      Ignoring `*/parse/test` Why is this the case, what can I do to fix my OBJ assignment to recognize `*/parse/test` or otherwise?


How to force Intel GMA 3150 use only fixed rectangle of the screen e

I have Atom N455 with Intel GMA 3150 and Debian 6 xfce x64. It's connected to 1680x1050 display by VGA cable. The problem is that the screen looks blurry (on Win also). I found that the maximum resolution supported by this integrated graphics is 1400x1050. So, I want to make it clear, how to turn off screen auto scaling to achieve 1400x1050 visible area on display.


connecting (bridging) two networks

I would like to connect (bridge) two networks (ppp0 and eth2). Normally you would do this with brctl but one of the network-interface is a ppp-device so it won't work (ppp can't transport ppp-frames). What I could do, is enable ip- forwarding but that is not enough as I want traffic from that ppp-device only go to eth2 and vice versa. NAT is fine. Another problem is that as far as I know you cannot push routing information to ppp-clients? Any help is appreciated! (solutions that work with windows/mac/android clients would be nice but not absolutely required)


Xorg.conf, which modules should be loaded for better performance?

In general what is supposed to be in the Module section of the Xorg.conf file in order to get maximum performance from a graphic card? At the moment my Module section is empty... also because I didn't find any useful doc about modules. ...and if it matters, my graphic card is an ATI Radeon HD 5700 Series and I've already installed the Catalyst 12.6 drivers on my Ubuntu 12.04 box.


How to setup whatever.localhost.dev to resolve into 127.0.0.1 on Ubuntu 12.04?

I'm running Ubunut 12.04 I want *localhost.dev to point to 127.0.0.1. Ubuntu 12.04 comes with dnsmasq-base installed with network-manager. But there is no /etc/dnsmasq.conf.   1. So I installed the dnsmasq package   2. The /etc/dnsmasq.conf file appeared   3. I added: address=/localhost.dev/127.0.0.1   4. sudo restart network-manager Doesn't work. How do I solve this? EDIT: Turns out it works after a restart.


How to get the time of several commands with a loop

I have this command:               time -p sh -c 'command1; command2;'      So `command1`and `command2` is executed and I get the real, user and sys time printed on the console. But I want that `command1; command2;` is looped 10 times and then I want to get the time which is used for the two commands.


arm-linux-gnu-gcc Vs arm-linux-gcc

What is the difference between `arm-linux-gnu-gcc` and `arm-linux-gcc` Which should be used for cross compiling a C program for ARM ?


Besides the journal, what are the differences between ext2 and ext3?

I just saw an answer question about filesystems for embedded hardware on another Stack Exchange site. The question was "What file system format should I use on flash memory?" and the answer suggested the ext2 filesystem, or the ext3 filesystem with journaling disabled a'la `tune2fs -O ^has_journal /dev/sdbX` This made me wonder... What would the advantage be to using ext3 (with journaling disabled) over ext2? As far as I understood, the only real difference between the two was the journal. What other differences between ext2 and ext3 are there?


Is it recommended to use zsh instead of bash scripts?

Can I assume that enough people have `zsh` installed to run scripts with a               #!/usr/bin/env zsh      as shebang? Or will this make my scripts un-runnable on too many systems? Clarification: I’m interested in programs/scripts an end user might want to run (like on Ubuntu, Debian, SUSE, Arch &c.)


Which would mount faster initrd or initramfs ?

I want to boot my linux as fast as possible. I have to make a choice between initrd and intiramfs. Which one should mount faster and have smaller size?


Suspend Linux (Mint) with external hard drive plugged in

I simply try to suspend the session while my external hard drive is plugged in (doesn't matter whether I have mounted or dismounted it, and this error does not apply to other filesystems, like flash drives). The computer does not suspend the session, and it goes back to the login screen, as if I had locked the screen. When I access the shell (and doing an ALT+LEFT after the CTRL+ALT+F1), I can see the following:               [ 5602.723820] dpm_run_callback(): scsi_bus_suspend+0x0/0x200 returns -5     [ 5602.723828] PM: Device 2:0:0:0 failed to suspend async: error -5     [ 5602.723820] PM: Some devices failed to suspend      Is there any way to fix this? Thanks.


Automatized restoring of display settings

I have two displays: my laptop's main monitor, running at resolution 1366x786 and second, external, running at resolution 1920x1080. My default display setting is to use both monitors at these resolutions, but the secondary monitor is at the left side of the primary monitor (instead of default right side). But some programs, especially games, change the resolution and usually use only one display (the second one is being disabled). After exiting such application it usually is restoring only the resolution of the first display, and the second one is disabled. After that I need to re-enable my default settings and do a lot of clicking in the settings panel. So my questions are:   1. Where can I find or how can I save my default two-display setting?   2. How can I automatize the restoration of my default settings? (maybe some bash script) The one-click solution would be great. I use Mint 16 and nvidia graphics.


How can I connect to a Mac OSX Maverick Shared Screen from Fedora 18?

I used to use TigerVNC to connect to a Mac MINI running Mountain Lion from my laptop running Fedora Core 18. After upgrading the Mac to Maverick, I now get the error "No Matching Security Types" I've tried every setting I can change through the GUI with the same result. I have also tried using other free VNC viewers, and still have had no luck. I know for a fact that Screen Sharing is working, I am able to connect using another Mac. Is there a way to do this without having to purchase a VNC viewer like RealVNC that I don't know will work? The other viewers I tried are:   * remmina (only appears to have SSH or SFTP as protocol options)   * NoMachine (only has SSH and NX as options)   * I downloaded gtkvncviewer but it doesn't appear to actually do anything and give no error report


How to install Liquidsoap & Airtime on CentOS 6.5?

That's the question, i already try some tutorials but i don't get any one to works What repositorys are needed? Is there any repo than i can add than have it to install it directly? Is there any way to avoid using Debian Box? I wanna keep the server without graphic interphase, although the webinterphase of Airtime is acceptable. I'm trying to use it to Broadcast music from an external HDD, to transmit when the DJ's will not be on air, like an AutoDj function I'm using icecast for the server, i do some test and it works, but i wanna automatize it and then i must add liquidsoap and/or airtime for this. This is the link to the page of the aplication http://savonet.sourceforge.net/ Any help? Thanks in advance. PS: Any suggestion of another software to do this than will be actualy supported would be very welcome. PS2: If you think i can receive a better answer in another StackExchange place, or think you know a forum, or a place/tutorial that can work, please let me know ;) I already try IRC btw... PS3: I'm asking this here because in the "Amateur Radio" Stack there are not so many online radio questions & because someone there put a doubt about if that was the place to post it, which i'm not sure if is or not... but like there is a Linux-Software question too, i want it to ask it here too.


How long is a TCP local socket address that has been bound unavailable after closing?

On Linux (my live servers are on RHEL 5.5 - the LXR links below are to the kernel version in that), `man 7 ip` says: > A TCP local socket address that has been bound is unavailable for some time > after closing, unless the SO_REUSEADDR flag has been set. I am not using `SO_REUSEADDR`. How long is "some time"? How can i found out how long it is, and how can i change it? I've been googling around this, and have found a few morsels of information, none of which really explain this from an application programmer's perspective. To wit:   * TCP_TIMEWAIT_LEN in `net/tcp.h` is "how long to wait to destroy TIME-WAIT state", and is fixed at "about 60 seconds"   * /proc/sys/net/ipv4/tcp_fin_timeout is "Time to hold socket in state FIN-WAIT-2, if it was closed by our side", and "Default value is 60sec" Where i stumble is in bridging the gap between the kernel's model of the TCP lifecycle, and the programmer's model of ports being unavailable, that is, in understanding how these states relate to the "some time".


kfreebsd ISO boot to grub menu

Having obtained the **kfreebsd** ISO image from here, I set up a VirtualBox VM to install from the ISO. When I boot up the VM, the session ends up with the grub menu instead of initializing the installation process or starting a shell.   1. How can I proceed from the GRUB menu to boot up kfreebsd for installation?   2. What could be causing the boot disc to enter grub instead of loading kfreebsd?


How can I use procmail to modify the body of an email and then forward it to an external address?

I'm struggling to get procmail to first transform, and then forward, a received email. Here's what I'd like to do:               :0 f     | ~/bin/encryptemail.pl | mail foobar@gmail.com      That is, I want to run the _encryptemail.pl_ script on the body of email that I receive, and then forward the encrypted email to _foobar@gmail.com_ . Piping the output to mail sort of works, except that the forwarded email is wrapped in a second set of headers. I'd like to cleanly forward the encrypted email so that the body of the original email has been replaced with the encrypted content.


Extract substring using regular expression on a Unix file

I have file with below contents .               /ABC/RTE/AD_900_VOP_123/OPP     /ABC/RTE/TRE/AD_900_VOP_145/BBB     /ABC/RTE/AN_900_VFP_124/FBF     /ABC/RTE/HD_900_FOP_153/WEW     /ABD/RDV/AD_900_VOP_123/OPP     /ABC/RTE/WD_900_VOP_123/GRR/TRD     /ABC/RTE/RTD/AR_900_VOP_443/SDD      How can I use regular expression on this file such that I get the output such as               AD_900_VOP_123     AD_900_VOP_145     AN_900_VFP_124     HD_900_FOP_153     AD_900_VOP_123     WD_900_VOP_123     AR_900_VOP_443


Why do iptables rules disappear when restarting my Debian system?

I add this rule:               sudo iptables -t nat -A OUTPUT -d a.b.c.d -p tcp \            --dport 1723 -j DNAT --to-destination a.b.c.d:10000        1. When restart computer rules are deleted. Why?   2. What I can do to make the rules persist?


Kill process when it stops to produce further output

Is there a shell tool which can probe if a subprocess is still producing output, and otherwise kill it after a specified timeout? I'm using `offlineimap` for Gmail backup, but that's very very very flaky. Processing stops regularily due to IMAP conditions or whatever. The process needs to be constantly restarted to see any progress. Hencewhy I'm currently using:               (ulimit -t 300 ; offlineimap)      in a loop. Which restarts the tool every five minutes; no matter what. That's somewhat unsatisfactory, as it either kills the process prematurely the few times when it's actually still performing some work, or still waits 4 minutes longer when it's already blocking. I would rather have something like:               offlineimap > output.log &     stillmakingoutput? --timeout 60 output.log || kill $!      That's probably doable with a custom exec/watching script, but isn't there some generic approach for such cases? stdout   output


Sed not working as intended

I would like to use this script with the intention of replacing all instances of the letter _Q_ within a file with the contents of the file "question.txt". Instead what happens is that all the instances of _Q_ in the file disappear and the contents of "question.txt" are printed at the bottom of the new file. Any ideas?               sed -i.bkp '/Q/{     s/Q//g     r /Users/ericbrotto/Desktop/question.txt     }' Commision.txt       **EDIT 1** I'm trying to find out what version I have, but keep on getting this: ![enter image description here](http://i.stack.imgur.com/XZnKj.png)


Why is procmail not being run?

I'm running Fedora 13 Linux, and sending mail to myself using mutt, and I can't seem to get procmail to run. Below is what my `.procmailrc`, `~/Procmail/rc.testing`, and `.forward` files all look like. As you can see, they are very simple. .procmailrc               HOME=/home/cory     SHELL=/bin/bash     PMDIR=$HOME/Procmail     LOGFILE=$PMDIR/pmlog     LOG="     "     LOG="My PATH is currently $PATH     My SHELL is currently $SHELL     "     VERBOSE=yes     MAILDIR=$HOME/Mail          INCLUDERC=$PMDIR/rc.testing      rc.testing               :0:     * ^Subject:.*test     IN-testing      .forward               #.forward     "|/usr/bin/procmail"      The Fedora Project documentation says that the existence of `.procmailrc` should "invoke Procmail whenever an MTA receives a new message." As I understand it, when I send myself a message using mutt, `.procmailrc` will be read by `procmail` and the logfile `pmlog` should be created in my `Procmail` directory. However, this log file never gets created, so it appears that procmail is never being run! The documentation also states "Fedora 13 provides two MTAs: Sendmail and Postfix. If both are installed, postfix is the default MTA." Since `which postfix` results with nothing on my machine, I assume sendmail is being used. Why doesn't sendmail invoke procmail?


Where Nautilus/Gnome keeps track or log of user activity?

Today I came across a file called `~user/.nautilus/saved-session-XXXXXX`. In it one could see some sort of logging user's activity via Nautilus. Also in `~user/.gconf/apps/gedit-2` one could find interesting things. Is there a file where Nautilus tracks user's activity? Is there a file which states files accessed, moved, copied, deleted, etc. via Nautilus?


How do I tell which GPG key an RPM package was signed with?

The cryptographic signature of an RPM can be verified with the `rpm -K` command. This returns a string containing `gpg` (or `pgp`) and ending in `OK` if the signature is in RPM's database and is valid. If the package is not signed but the checksums are valid, you'll still get `OK`, but no `gpg`. If the package is signed but the key is missing from the RPM database, you get `(GPG)` (capital letters) and `NOT OKAY`, followed by `(MISSING KEYS: GPG#deadbeef)`. That's handy if I want to figure out what key I should find to install to make my package installation work. But what if I want to verify _which_ of several keys in my RPM keyring was used to sign a given package?


Different Title formats for different Terminal apps?

I use a script which either activates an already running window of a program, or starts that program if it is not running. It uses different shortcut-keys; one for each of my most used apps — it checks for a unique window title format. This has worked fine, until today, when I decided to use `terminator` along side of `gnome-terminal`. These two terminal apps display the same title format, and I don't know how to change them independently (actually I don't know how to change them at all). I also use `konsole` (because it displays Unicode better than gnome-terminal), and it has a _profile-option_ which allows changes to the _tab-title format_ which is mirrored in the window's title, but `terminator` and `gnome-terminal` don't have this option. Is there some way to have different title formats for different terminals?


zsh kill Ctrl + Backspace, Ctrl + Delete

How to configure zsh such that `Ctrl`+`Backspace` kills the word before point? How to achieve that `Ctrl`+`Delete` kills the word after point? I use urxvt as terminal emulator.


Linux software raid assembled "itself" with failed drive. Why?

I have two raid1 arrays: md3 (sda3 + sdb3) and md5 (sda5 + sdb5). I deliberately failed the sdb disks because I wanted to change the partition table:               # mdadm /dev/md3 --fail /dev/sdb3     # mdadm /dev/md5 --fail /dev/sdb5      Some time later I checked /proc/mdstat and it says               Personalities : [raid1] md5 : active raid1 sdb5[1]           104792064 blocks super 1.2 [2/1] [_U]          md3 : active raid1 sda3[0]           52396032 blocks super 1.2 [2/1] [U_]          unused devices: <none>      **So although I failed sdb5, md5 was assembled with sdb5 instead of sda5. How could this happen?** I am using mdadm v3.3 and kernel is 3.14.3-200.fc20.x86_64


Batch file rename with substitution lookup

Using bash, how I can batch rename a large number of files, where I need to construct a new name for each file, based on its existing name and a 'contextual map' - don't know what else to call it – of name fragments. I have a lot of files in like this:               001.jpg     003.jpg     004.jpg     007.jpg     ...      and a map like this:               001,white     003,grey     004,red     007,green     ...      And now I want to rename all files, so that 001.jpg becomes 001-white.jpg etc.. How can I do this?


Count entries for each directory in tree

Say I have the following tree:               root:     d foo      d bar          /foo:     d A     - tmp.txt          /bar:     d B     - tmp2.txt          /foo/A:     - tmp3.txt          /bar/B:      d = directory and - = file I need to answer the following question: which directory (excluding the root) contains the least entries? I have tried                 find . | grep -oE '/([a-zA-Z]+/)+'      to get the number of occurrences for each directory. The problem is this command exclude empty directories, in this case /bar/B is excluded. Any guidance on how to solve this would be appreciated.


Read contents in a line in bash

I have a file with contents in this order which is separated by space                 4096 1230 4560 1024.... n      How can i read each number and pass it on to another command, eg divide each number by 1024.


Make a bootable CD without ISO file but from a CD

I have a Windows XP CD which I want to install on a USB Drive. However my own CD drive is broken. I have a friend's laptop on which Windows 7 is installed (and no idea if it has a CDROM of not). Please tell me how to do get the ISO from the CDROM to an USB pendrive? I am using Debian 7


linux cron: want to backup a folder

Hello I would like to backup a folder using cron on a centos. The folder `c2duo_mms` is located in `/usr/local/src/djcode/c2duo_mms`. I would like it backed ip every 1:00pm on Tuedays to my home folder `/home/sh`. Problem is I need help to do this problem. I am assuming you have to edit the crontab file? (a guess).


Installing Linux Mint 11 LXDE x64 on top of ubuntu-minimal

I want to install a 64bit version of Linux Mint 11 LXDE. It seems as though I should be able to easily install it on top of ubuntu-minimal if I knew the correct meta package(s).   1. Install ubuntu-minimal x64   2. Add linux mint repos to sources.list   3. Install linux mint LXDE meta package with ignore recommendations (similar to ubuntu-desktop) I've done this before with ubuntu-desktop and lubuntu-desktop. How can I get a list of meta-packages? Or a package dependency tree? EDIT: seems there is some confusion. "Linux Mint 11 LXDE" is a distro in itself. http://blog.linuxmint.com/?p=1793 It's the lubuntu to Linux Mint. I am trying to replicate this distribution by installing it on top of ubuntu-minimal. Which is way different than installing LXDE on top of either linux mint or ubuntu. Update: I tried to take all the packages marked as manual in Linux Mint 32 and installed them on ubuntu-minimal. This seemed to work fine, and I seem to have a Linux Mint install except now upstarts now hangs at "Checking Battery Status", which seems to be a common issue that people have when upgrading. It looks like I should also disable fglrx to see if it fixes it. In any case, I've since then tried using arch linux, but it's alot more work and I'm not sure I am going to stick with it.


Centos or Scientific Linux

When I need to create a new server I've always chosen Centos mainly for it's compatibility with Red Hat which i consider the standard de-facto for the general purpose linux server.   Now the problem is that Red Hat 6 has been out for quite a while and there is no sign of the Centos 6 (event Centos 5.6 iso is still missing).   As in the need to create a new server what will you do? Stay whit the old Centos 5.5 or switch to the recently released Scientific Linux 6.0?   I looked on SL 6.0 website and they declare great attention to compatibility with RH, I've never tried it by myself so I just wanted someone's real life opinion.


sorting filenames numerically when they have non-numeric prefix

I have files in the following format: `x1 x2 ... x10 x11 ... x101 ...` I want to rename these files, so they all have the same name length: `x001 x002 ... x010 ...` I can do this with files, that don't have the non-numeric prefix (just using `sort -n` followed by a `while read x;`), but sort doesn't recognize the numeric value, when it's not on the beginning of the file-name.


Check if display is powered on in Linux

Is there a way to check if a display is powered on in Linux? I tried `xrandr` and `xset` but neither of these two gives me any information about monitor power. Using `xrandr` I can identify if the vga cable is connected but not if power is connected. I need this because many of our lab systems keeps lying unused just because someone pulls out the power cable or something.


What program do I use to check mail?

I'm receiving "You have mail" messages and according to How to remove “You have mail” welcome message I should read my mail with `mail`. However I cannot find the command in my system (Ubuntu 10.04 server). What do I need to install?


How do I create a virtual secondary screen in X11?

I'm trying to use xvfb as a secondary screen, but I am struggling getting the two screens working together. xvfb does not seem to have the randr extension. So is there another possibility to create a virtual screen that could be in dual-head mode together with my real screen?


checking an argument to a bash script is a string of all digits

The Bash FAQ says If you're validating a simple "string of digits", you can do it with a glob:               # Bash     if [[ $foo = *[!0-9]* ]]; then         echo "'$foo' has a non-digit somewhere in it"     else         echo "'$foo' is strictly numeric"     fi      I thought, "Goody, that looks nice and simple". I then pasted exactly that into a script, except I added "exit 1" after the first echo and changed `$foo` to `$1`, so that it looked like               if [[ $1 = *[!0-9]* ]]; then         echo "'$1' has a non-digit somewhere in it"         exit 1     else         echo "'$1' is strictly numeric"     fi      I then tried to run this and got               $ sh foo.sh bar     bar     foo.sh: 6: [[: not found     'bar' is strictly numeric      I'm Bash illiterate, I'm ashamed to say, so I've no idea what could be wrong here. I had the impression, supported by the online Bash manual that the operator for matching with regexes is `=~`, but changing that doesn't make any difference. And that `[[` operator that seems to be problematic here looks standard, though I don't know what the difference is between `[[ ]]` and `[ ]`, which both correspond to testing the expression, as far as I know. I'm using Debian squeeze with bash               $ bash --version     GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)      Debian says version `4.1-3`.


How do I get sound to work outside lightdm

If for whatever reason I `sudo stop lightdm` running on mint and just use a simple xinit session with mutter, is there some way I can get sound to work? Whenever I do that, it seems there's no sound.


Excessively high memory usage reported (3 GB) after reboot

**Brief problem description:** A 64-bit Gentoo on Intel Core-2 Q6600 reports about 3GB used out of 8GB total memory after reboot. This memory is neither claimed by any process, nor is it used by buffers/cache. **Context:** I have first noticed this behavior after the OOM killed the `emerge` process when trying to build octave from source. When the system became responsive again, there still remained about 3GB of reportedly used memory that was not used by any process. (Please note, that I can't say for sure that this was really on the beginning - maybe I just didn't notice before.) I tried reboot, as I am not familiar with the OOM possible issues, but the memory was reportedly used again. Then I tried Memcheck86+ which reported one "failing address" error on 3246.3MB (test repeated 5x). I lowered the RAM frequency and the error disappeared (test repeated 3x). However, on my Gentoo, 3GB is persistently reported as used with no apparent explanation (please see the diagnostic reports below). I have also tried a live distro (Parted Magic), which apparently behaves normally (about several hundreds of used memory after boot up). Any suggestions about the possible cause or even solution? **Edit:** _I am now able to overcome the problem, but still could not explain it. I describe what I've tracked so far:_   * The 3GB of memory is not used when started in a single-user mode.   * Starting `iptables` results in the 3GB usage, while dmesg reports: nf_conntrack: falling back to vmalloc   * subsequent stopping `iptables` does not revert the process, the memory remains used. Then I changed my kernel configuration so that the `nf_conntrack` is no longer built-in, but rather it is loaded as module. After reboot, `iptables` starts without the `falling back to vmalloc` message and also without consuming the 3GB. I have no idea, how this can be explained. Maybe some kernel developer can help explaining, what exactly could have caused this behavior? **Relevant reports:** ![enter image description here](http://i.stack.imgur.com/fqo7l.png) ![enter image description here](http://i.stack.imgur.com/Zhyyo.png)


Backup a Windows PC to a Linux Machine

What is a good backup strategy to backup a Windows 7 box to a Ubuntu box that are on the same network? The solution I am thinking would be to mount a Windows folder to Ubutnu then use `rsync`. But I'm new at this, so that might not be the best way to do it.


Exiting a pipeline if a former command fails

I'm trying to check the number of running and queued PBS jobs by parsing the output of `qstat -tn1` from a `bash` script. So far, this has worked:               count ()     {         qstat -tn1 | awk '             BEGIN { R = 0; Q = 0; }             $10 == "R" { R++ }             $10 == "Q" { Q++ }             END { print R, Q }'     }          if read -r R Q < <(count)         ...      However, I see that `qstat` occasionally fails for unknown reasons. In that case, it prints nothing to `stdout` and some error message to `stderr`, and exits with a non-zero status (fairly standard). However, `awk` doesn't know that `qstat` failed, and happily prints `0 0` for the empty input it received. Then `read` assigns 0 to both `R` and `Q` without knowing that `qstat` actually failed.   1. I need to initialize `R` and `Q` with 0 in the `BEGIN` block of the `awk` script, because there may be no running processes or no queued processes, and I need to print `0`, not just an empty string, for the number of such processes.   2. I could do `set -o pipefail`, which would allow `count` to exit with a non-zero status, but `read` cannot see the exit status, and `awk` gets executed and prints `0 0` for the empty input anyway.   3. I could try a named pipe and subprocesses, but having to manage them feels like an overkill too complicated. Is there any good way to allow the caller of `count` to detect its failure?


Jump to specific character in a line in VI

In VI, I know that if you do               :some_number      and hit enter, you will jump to the line specified by "some_number". Is there an equivalent for jumping to a specific character in a single line? Basically, I have a large csv and there is some characters that are breaking the parser; so I have to debug it. I'm getting an error message that basically says "unexpected character on line XXX character YYY". I know how to get to XXX but how do I get to YYY?


How to use Sony VAIO buttons to lock the screen?

I have a Sony Vaio VPCEG laptop, like this. I'm using Lubuntu 11.10. I'd like to use those 3 buttons (Assist, WEB and VAIO). They work with Windows 7, to recover the system and to open the browser. But in Linux, they don't work. How to set up them to lock the screen or to start the screen saver when pressed?


How good is the support for NUT-based UPSs against APC?

My choice of UPS is this -- **CyberPower** CP900EPFCLCD or **APC** Smart-UPS 750VA (SMT750I). I intend to connect UPS with USB for data transfer, not Ethernet. According to UPS HowTo http://tldp.org/HOWTO/html_single/UPS-HOWTO/, the first one is adviced to run with NUT, and the second with Apcupsd. Are those package equally good? Another issue -- support. When I run into problems, and I would look for some help, with which package (and community related to it) I will solve my problems faster? In short, **which package you think will cause less problems with configuring and using (with UPS)?** I am asking this, because those UPSs looks almost the same for me (*), the only thing I don't know now is how good are they when working with Linux. If you are a user of one of those UPS+packages, please simply answer with your experience "I had no problems at all" or "I had to install Windows to make it work properly". You don't have to know both of them to answer. (*) _The first one is cheaper (price for device, and less energy consumed), the other provides longer power support. For me it is a draw at this point._


Make kernel detect garmin device

I'm trying to connect a usb garmin forerunner device to my system, but the usb device is not detected. I have loaded the following mods: garmin_gps 11544 0 usbserial 25449 1 garmin_gps But I never see any device detected in neither lsusb nor dmesg when I connect the device. Other USB devices like disks and mp3 players seems to work fine. I'm unsure how I can continue debugging to find the issue and wonder if someone can guide me?


Shell and applications

Is it true that all commands that can run in bash are not actually part of bash? I'm gradually realizing I have been confusing the shell and the applications that can run in it.


Is there a linux equivalent of the Mac OS X command "textutil"?

On Mac OS X there's a very handy command called `textutil`, that can be invoked from the terminal and allows to convert a document from a format to another; Sometimes I use it to convert a RTF file into HTML, but it's also able to convert doc, docx, odt and other formats. I used to believe that it was a standard unix command, but I cannot find it and when I try to write `sudo apt-get install textutil` Ubuntu said that it have no idea of what `textutil` is... maybe I have searched in the wrong place for the command? Do you know if something similar exists for Linux? I need to invoke that command from a script that will run on a linux server.


Python-friendly machine configuration management systems

Are there machine configuration management systems akin to:   * Puppet   * Chef which are natively, or at least intimately, Python-friendly? Any recommendations with supporting evidence and/or backing reasoning as to why? (The two systems above have a penchant for Ruby.)


How can I automatically kill the process with the highest CPU load?

Sometimes programs will lock up in the background and cause high CPU usage. Is there any way I can programmatically ascertain which process is causing the highest CPU load at the moment and kill it?


Which linux is the most "free"?

I would like to make my very personal own linux baby, which is not to get whole world users get involved but myself to use it and do lots of experiment with it, so that when things does not work with other linux, i can show myown linux actually works and i will name it NeverMindMyOwnLinuxCanDoIt. So that when ever anyone need a solution, i can provide my own tested OS and get out of those company and license issues involved. Which Linux is really the freedom of choice that has no other involvement pure open and allow others to do what they want to do? I am thinking to go with Red hat linux and customize it for my own use. But can i?


xkbcomp doesn't update keymap for running xterms?

When I use setxkbmap all programs use the new layout but when I change the keyboard layout with xkbcomp to my own only newly started programs are affected (using xkbcomp with a file with a default keyboard that was created by xkbcomp it works). Why is that and how can I use xkbcomp and still get the new layout in already running programs?


Can't get DBUS data for automatic statuschange of pidgin

I'm using a script based on the work posted here: Update pidgin status using cron I'm trying to make a wicd script that automaticly disconnects before Wifi- disconnect and reconnects on Wifi-reconnect. But somehow dbus/pidgin can't seem to find the dbus session, eventhough the environment variable is set. **My setup:**   * Arch linux   * Pidgin 2.9.0   * Libpurple 2.9.0-2 Autoload script (runs on Xfce start):               #!/bin/bash     touch /tmp/dbus_session_data     env | grep DBUS_SESSION_BUS_ADDRESS > /tmp/dbus_session_data     echo 'export DBUS_SESSION_BUS_ADDRESS' >> /tmp/dbus_session_data      The tmp-file after runnign script:               [skaverat@eeepthought ~]$ cat /tmp/dbus_session_data      DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-gZMqzhdS2S,guid=9b8b3169f14346902127832000000043     export DBUS_SESSION_BUS_ADDRESS      Okay, let's get into another environment:               [root@eeepthought ~]# env | grep DBUSD     [root@eeepthought ~]# source /tmp/dbus_session_data      [root@eeepthought ~]# env | grep DBUS     DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-gZMqzhdS2S,guid=9b8b3169f14346902127832000000043     [root@eeepthought ~]# purple-remote getstatus     No existing libpurple instance detected.      purple-remote call in normal environment:               [skaverat@eeepthought ~]$ purple-remote getstatus     available      Any idea what could be wrong?


strange noise in some gui programs

I have Debian testing, I use XFCE. Recently, shortly after dist-upgrade, I noticed that XFCE terminal has some noise in it - especially near the end of long lines or when I use midnight commander. The noise looks like that: ![](http://i.stack.imgur.com/Ycfzc.png) I started using gnome-terminal instead and problem disappeared. Now I noticed I have similar problem with GIMP - the toolbox contains noise instead of tools: ![](http://i.stack.imgur.com/oEp7y.png) I can't even guess where should I start investigation. Is it problem with GIMP, XFCE, GTK, X, hardware? Or something else? I tried to start raw X, without any window manager (without Gnome, without XFCE etc) and problem is still the same - so I guess it's not X's fault. What do you advice?


Bash function to compare two binary files

I need a function to compare 2 binary files, here the requirements:   * 2 files, not 3 or 4   * files can't be assumed to exist   * avoid running checksum (CRC/MD5/SHA/...) until one must   * if running multiple checksums, do so from least expensive to most expensive (order above)   * print out meaningful error messages   * usage: binary_compare_two_files file1 file2 Here's what I have got, I think it can be done much better than this. How?               #!/bin/bash          function binary_compare_two_files() {            REQUIRED_ARGUMENTS=2            n_arguments="$#"            if [ ! "${n_arguments}" -eq $REQUIRED_ARGUMENTS ]; then         printf 'Invalid number of arguments. Required: %d, supplied: %d\n' \           $REQUIRED_ARGUMENTS $n_arguments         echo 'usage: binary_compare_two_files file1 file2'         return       fi            file1="${1}"       file2="${2}"            if [  ! -f "${file1}" -o ! -f "${file2}" ]; then         echo 'Invalid arguments. Both arguments need to refer to existing files.'         return       fi            file1_size=$(stat -f "%z" "${file1}")       file2_size=$(stat -f "%z" "${file2}")            if [ ! ${file1_size} -eq ${file2_size} ]; then         return $((file1_size - file2_size))       fi            file1_md5=$(md5 -q "${file1}")       file2_md5=$(md5 -q "${file2}")            if [ ! "${file1_md5}" == "${file2_md5}" ]; then         return -1       fi            return 0     }      I have opted not to use diff/bdiff because I am not sure whether those `stat` and check for sizes first... I would need to look at the src.


How can I use codecs etc. from one file to encode another with avconv?

I'm trying to use my camcorder as a portable TV, so I would like to use files from the camcorder (a Sony Handycam HDR-CX280) to encode my other video files in a format it will play. Here's the output of `avconv -i` on two different sample video files from my camcorder:               avconv version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers       built on Feb  6 2014 20:59:46 with gcc 4.8.1     Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '#MAH00466.MP4':       Metadata:         major_brand     : MSNV         minor_version   : 22675568         compatible_brands: MSNVmp42isom         creation_time   : 2014-02-22 15:10:21       Duration: 00:00:31.20, start: 0.000000, bitrate: 6137 kb/s         Stream #0.0(und): Video: h264 (Main), yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 6006 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc         Metadata:           creation_time   : 2014-02-22 15:10:21         Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 127 kb/s         Metadata:           creation_time   : 2014-02-22 15:10:21     At least one output file must be specified      and               avconv version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers                                                                                built on Feb  6 2014 20:59:46 with gcc 4.8.1                                                                                [mpeg @ 0x94e8fe0] max_analyze_duration reached                                                                                Input #0, mpeg, from 'M2U00038.MPG':                                                                                Duration: 00:00:39.23, start: 1.000000, bitrate: 752 kb/s                                                                                Stream #0.0[0x80]: Audio: ac3, 48000 Hz, mono, s16, 48 kb/s                                                                                Stream #0.1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x564 [PAR 188:135 DAR 16:9], 104857 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc                                        At least one output file must be specified


joining 2 files on 2 columns but at different column numbers using awk

I have 2 files which has to be joined on $1,$2 of 1st file and $1,$8 of 2nd file using awk.Can anyone please provide the solution for this as this is an urgent requirement. Thanks in Advance file1:               111,123abc,eee,ttt,yyy     222,234bcd,ttt,yyy,333      file2: 111,hhhh,eeee,rere,,23,2014,123abc 222,jjkj,7878,uhjj,1,45,2013,234bcd 333,aaa,hhh,jjjj,2,78,590,567acd output:               111,123abc,hhhh,eeee,rere,,23,2014     222,234bcd,jjkj,7878,uhjj,1,45,2013


Window title in X shows wrong application name

I am using LXDE environment in Debian, but I think my question is general. When I have a window opened (i.e. terminal emulator running bash) the window has a window title with the text `/bin/bash`. When I start `mc` in the terminal, the title changes to `mc [martin@localhost]`. The same text also appears as the window name on the window panel, where I can switch between opened windows. My problem is, the window name does not refresh, it still shows `mc [martin@localhost]`, even when I am already logged on another machine. Only when I start `mc` does the title refresh again. Is there a way to make the title refresh automatically?


can color-theme bind to a buffer?

I want to use different color-theme for different file types. I tried to use **add-hook** to set the color-theme for the major-mode, but it only applies when the buffer is first load. If I switch to another buffer and switch back, the color-theme will stay the same as it is in the previous buffer. Then I tried to set the **window-configuration-change-hook** , but the window blinks every time I press C-x, or M-x, or whatever that change the window properties. Is there a better way to set the color-theme for each buffer?


gcc make install error

I'm trying to compile `gcc` with `make install` to a drive wich is an linux from scrach bulid to a directory called tools and it gives me this:               make[1]: Entering directory `/media/BOSS/sources/gcc-build'     /bin/bash ../gcc-4.8.1/mkinstalldirs /tools /tools     /bin/bash: line 3: cd: ./fixincludes: No such file or directory     make[1]: *** [install-fixincludes] Error 1     make[1]: Leaving directory `/media/BOSS/sources/gcc-build'     make: *** [install] Error 2      I'm currently compiling it for lfs also I'm in a separate directory on a 32 bit computer on Emmabuntüs Log file soon


apt: reinstall older version of a package without altering dependent packages

I have got some problem with sound. In order to investigate the problem I tried to reinstall older version of package libasound2 (I have upgraded it recently). I typed `apt-get install libasound2=1.0.1.23-2.1` and the manager wanted to unistall lots of software I use and I don't like idea that I have to install it again. How can I change the version of selected package without all the problem with dependent software?


How to substitute awk argument?

I want simplify awk command for common usage so instead of writing `awk '{print "rm -r"$4 }'` each time I want to write `myawk "rm -r"$4`. I've tried to write such function `myawk() { awk '{ print $1 }' }` and it dosn't work.. How can I write function such that in Ubuntu?