How to return multiple select count in an array variable in shell

I have a 4 SQL count values which I want to return in an array record_count so that I can use that count values in some if statements later in the shell program. But I am not able to return the values in array variable. Below is my program.               record_count=`sqlplus -S $final_string <<END     SET FEEDBACK OFF     SET HEADING OFF     SELECT COUNT(1) FROM USAGE_STAGE WHERE DOMAIN = 'INTERNET Aggregated' and (DOWNLOAD < $LOWER_THRESHOLD or DOWNLOAD > $HIGHER_THRESHOLD);     SELECT COUNT(1) FROM USAGE_STAGE WHERE DOMAIN = 'INTERNET Aggregated' and (UPLOAD < $LOWER_THRESHOLD or UPLOAD > $HIGHER_THRESHOLD);     SELECT COUNT(1) FROM USAGE_STAGE WHERE DOMAIN = 'Youview Aggregated' and (DOWNLOAD < $LOWER_THRESHOLD or DOWNLOAD > $HIGHER_THRESHOLD);     SELECT COUNT(1) FROM USAGE_STAGE WHERE DOMAIN = 'Youview Aggregated' and (UPLOAD < $LOWER_THRESHOLD or UPLOAD > $HIGHER_THRESHOLD);     END`          echo "The output of select query is" $record_count


Is it possible for a daemon (i.e. background) process to look for key-presses from a USB keyboard?

I'm working on an embedded Linux project where I will be developing a program that will run automatically on bootup and interact with the user via a character display and some sort of button array. If we go with a simple GPIO button array, I can easily write program that will look for keypresses on those GPIO lines. However, one of our thoughts was to use a USB number pad device instead for user input. My understanding is that those devices will present themselves to the OS as a USB keyboard. If go down this path, is there a way for my program to look for input on this USB keyboard from within Linux, keeping in mind that there is no virtual terminal or VGA display. When a USB keyboard is plugged in, is there an entity in '/dev' that appears that I can open a file descriptor for?


Using gpg-agent to decrypt password in cron job

I have two scripts that both need to decrypt passwords using gpg-agent. Both of them run fine when launched from the terminal. The problem is that when run via cron, they both fail with these messages:               gpg: problem with the agent: End of file     gpg: decryption failed: No secret key      I have this in `/etc/profile.d/gpg-agent.sh`:               if [ $EUID -ne 0 ] ; then         envfile="$HOME/.gnupg/gpg-agent.env"         if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then             eval "$(cat "$envfile")"         else             eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")"         fi         export GPG_AGENT_INFO  # the env file does not contain the export statement         export SSH_AUTH_SOCK   # enable gpg-agent for ssh     fi      And I can verify the agent is running:               % pgrep gpg-agent     510      The cron tasks are in my own crontab. I've tried executing the scripts like this:               */30 * * * * source /home/user/.gnupg/gpg-agent.env && export GPG_AGENT_INFO && /script      But nothing I've tried works.


buildroot compiling driver

I'm using Buildroot for compiling embedded linux. It works well because I have target Makefile configurations, but now I need driver for my usb devices. I manage to compile Qt appilactions(c++) on my host linux to target linux by using buildroots `/output/host/usr/bin/arm-none-linux-gnueabi-c++` . Works well. Now I'm trying to compile c-files for this driver http://www.ftdichip.com/Drivers/VCP.htm I'm calling it like                /output/host/usr/bin/arm-none-linux-gnueabi-gcc -Wall -D__KERNEL__ -DMODULE -I/home/buildroot-2012.08/output/build/linux-2.6.35.3/include -DMODVERSIONS -include /home/buildroot-2012.08/output/build/linux-2.6.35.3/include/config/modversions.h -I /home/buildroot-2012.08/output/build/linux-2.6.35.3/drivers/usb/serial/ -O   -c -o ftdi_sio.o ftdi_sio.c      Now I'm getting error: `output/build/linux-2.6.35.3/include/linux/linkage.h:5: fatal error: asm/linkage.h: No such file or directory`   1. How I should configurate the driver compiling?   2. Is there some other way to do it for target linux. Mayby I'm not doing it the right way.


How can I get Apache working (complains about logfiles) on Ubuntu after a distribution upgrade?

I upgraded from Raring to Saucy, and it says it can't open listening sockets:               root@ip-10-250-42-219:/etc/apache2/sites-enabled# apache2ctl restart     [Tue Oct 22 13:34:05.187996 2013] [core:warn] [pid 1925] AH00117: Ignoring deprecated use of DefaultType in line 174 of /etc/apache2/apache2.conf.     httpd not running, trying to start     no listening sockets available, shutting down     AH00015: Unable to open logs     Action 'restart' failed.     The Apache error log may have more information.      How can I correct this? Nothing is listening on port 80. And I checked the log directory; /var/log/apache2 remains available. --EDIT-- After commenting out DefaultType, I tried to restart and got a somewhat simpler error message:               httpd not running, trying to start     no listening sockets available, shutting down     AH00015: Unable to open logs     Action 'restart' failed.     The Apache error log may have more information. My apache2.conf is below. It doesn't tell the whole story, as it doesn't include e.g. the sites-enabled directory contents, but here it is:               #     # Based upon the NCSA server configuration files originally by Rob McCool.     #     # This is the main Apache server configuration file.  It contains the     # configuration directives that give the server its instructions.     # See http://httpd.apache.org/docs/2.2/ for detailed information about     # the directives.     #     # Do NOT simply read the instructions in here without understanding     # what they do.  They're here only as hints or reminders.  If you are unsure     # consult the online docs. You have been warned.       #     # The configuration directives are grouped into three basic sections:     #  1. Directives that control the operation of the Apache server process as a     #     whole (the 'global environment').     #  2. Directives that define the parameters of the 'main' or 'default' server,     #     which responds to requests that aren't handled by a virtual host.     #     These directives also provide default values for the settings     #     of all virtual hosts.     #  3. Settings for virtual hosts, which allow Web requests to be sent to     #     different IP addresses or hostnames and have them handled by the     #     same Apache server process.     #     # Configuration and logfile names: If the filenames you specify for many     # of the server's control files begin with "/" (or "drive:/" for Win32), the     # server will use that explicit path.  If the filenames do *not* begin     # with "/", the value of ServerRoot is prepended -- so "foo.log"     # with ServerRoot set to "/etc/apache2" will be interpreted by the     # server as "/etc/apache2/foo.log".     #          ### Section 1: Global Environment     #     # The directives in this section affect the overall operation of Apache,     # such as the number of concurrent requests it can handle or where it     # can find its configuration files.     #          #     # ServerRoot: The top of the directory tree under which the server's     # configuration, error, and log files are kept.     #     # NOTE!  If you intend to place this on an NFS (or otherwise network)     # mounted filesystem then please read the LockFile documentation (available     # at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);     # you will save yourself a lot of trouble.     #     # Do NOT add a slash at the end of the directory path.     #     #ServerRoot "/etc/apache2"          #     # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.     #     # LockFile ${APACHE_LOCK_DIR}/accept.lock          #     # PidFile: The file in which the server should record its process     # identification number when it starts.     # This needs to be set in /etc/apache2/envvars     #     PidFile ${APACHE_PID_FILE}          #     # Timeout: The number of seconds before receives and sends time out.     #     Timeout 300          #     # KeepAlive: Whether or not to allow persistent connections (more than     # one request per connection). Set to "Off" to deactivate.     #     KeepAlive On          #     # MaxKeepAliveRequests: The maximum number of requests to allow     # during a persistent connection. Set to 0 to allow an unlimited amount.     # We recommend you leave this number high, for maximum performance.     #     MaxKeepAliveRequests 100          #     # KeepAliveTimeout: Number of seconds to wait for the next request from the     # same client on the same connection.     #     KeepAliveTimeout 5          ##     ## Server-Pool Size Regulation (MPM specific)     ##           # prefork MPM     # StartServers: number of server processes to start     # MinSpareServers: minimum number of server processes which are kept spare     # MaxSpareServers: maximum number of server processes which are kept spare     # MaxClients: maximum number of server processes allowed to start     # MaxRequestsPerChild: maximum number of requests a server process serves     <IfModule mpm_prefork_module>         StartServers          5         MinSpareServers       5         MaxSpareServers      10         MaxClients          150         MaxRequestsPerChild   0     </IfModule>          # worker MPM     # StartServers: initial number of server processes to start     # MinSpareThreads: minimum number of worker threads which are kept spare     # MaxSpareThreads: maximum number of worker threads which are kept spare     # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a     #              graceful restart. ThreadLimit can only be changed by stopping     #              and starting Apache.     # ThreadsPerChild: constant number of worker threads in each server process     # MaxClients: maximum number of simultaneous client connections     # MaxRequestsPerChild: maximum number of requests a server process serves     <IfModule mpm_worker_module>         StartServers          2         MinSpareThreads      25         MaxSpareThreads      75          ThreadLimit          64         ThreadsPerChild      25         MaxClients          150         MaxRequestsPerChild   0     </IfModule>          # event MPM     # StartServers: initial number of server processes to start     # MinSpareThreads: minimum number of worker threads which are kept spare     # MaxSpareThreads: maximum number of worker threads which are kept spare     # ThreadsPerChild: constant number of worker threads in each server process     # MaxClients: maximum number of simultaneous client connections     # MaxRequestsPerChild: maximum number of requests a server process serves     <IfModule mpm_event_module>         StartServers          2         MinSpareThreads      25         MaxSpareThreads      75          ThreadLimit          64         ThreadsPerChild      25         MaxClients          150         MaxRequestsPerChild   0     </IfModule>          # These need to be set in /etc/apache2/envvars     User ${APACHE_RUN_USER}     Group ${APACHE_RUN_GROUP}          #     # AccessFileName: The name of the file to look for in each directory     # for additional configuration directives.  See also the AllowOverride     # directive.     #          AccessFileName .htaccess          #     # The following lines prevent .htaccess and .htpasswd files from being      # viewed by Web clients.      #     <Files ~ "^\.ht">         Order allow,deny         Deny from all         Satisfy all     </Files>          #     # DefaultType is the default MIME type the server will use for a document     # if it cannot otherwise determine one, such as from filename extensions.     # If your server contains mostly text or HTML documents, "text/plain" is     # a good value.  If most of your content is binary, such as applications     # or images, you may want to use "application/octet-stream" instead to     # keep browsers from trying to display binary files as though they are     # text.     #     #DefaultType text/plain               #     # HostnameLookups: Log the names of clients or just their IP addresses     # e.g., www.apache.org (on) or 204.62.129.132 (off).     # The default is off because it'd be overall better for the net if people     # had to knowingly turn this feature on, since enabling it means that     # each client request will result in AT LEAST one lookup request to the     # nameserver.     #     HostnameLookups Off          # ErrorLog: The location of the error log file.     # If you do not specify an ErrorLog directive within a <VirtualHost>     # container, error messages relating to that virtual host will be     # logged here.  If you *do* define an error logfile for a <VirtualHost>     # container, that host's errors will be logged there and not here.     #     ErrorLog ${APACHE_LOG_DIR}/error.log          #     # LogLevel: Control the number of messages logged to the error_log.     # Possible values include: debug, info, notice, warn, error, crit,     # alert, emerg.     #     LogLevel warn          # Include module configuration:     Include mods-enabled/*.load     Include mods-enabled/*.conf          # Include all the user configurations:     # Include httpd.conf          # Include ports listing     #Include ports.conf          #     # The following directives define some format nicknames for use with     # a CustomLog directive (see below).     # If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i     #     LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined     LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined     LogFormat "%h %l %u %t \"%r\" %>s %O" common     LogFormat "%{Referer}i -> %U" referer     LogFormat "%{User-agent}i" agent          # Include of directories ignores editors' and dpkg's backup files,     # see README.Debian for details.          # Include generic snippets of statements     #Include conf.d/          # Include the virtual host configurations:     Include sites-enabled/     AddHandler php5-script .php     AddType text/html .php


Dovecot to ignore invalid email addresses

I have a server [Redmine] which sends notifications to users on the project and it happens that some of the user mails are not correct. The server puts everbody in the "To" or "Bcc" field depending on configuration. Is there any way to configure mail server so that when mail is sent to multiple users those non existent mail addresses are ignored. For instance               from:      to: existing_user1, existing_user2, non_existing_user     subject: ....      the message should be sent to all users apart from the last one. Currently, the server returns 5.1.1 User unknown


Can two files in a directory be on different filesystems

I'm implementing atomic writes (FWIW in Python on Linux & FreeBSD), and I'm writing to a temporary file in the same directory with the file I'm planning to write to (in order to ensure that they are on the same filesystem, and thus rename(2) succeeds and writes can be atomic). My question is that is there any condition where two files in the same directory be on different filesystems? (I am not following symlinks, so a file symlinked to another file on a different filesystem is not a problem for me).


Daily logRotate for apache at specific time

How can I execute logRotate daily at a specific time (3h30) each day? Specific details on how to do this would be appreciated. I'm on Debian.


Valgrind /usr/lib files are not regular Linux files

The problem that I encountered today (on an embedded device with Linux) is that some files (specifically, the Valgrind `/usr/lib` files) are behaving very strange and they are not copy-able with `scp` (error is: `not a regular file`). So:               $ ls -al /usr/lib/*valgrind*     drwxr-xr-x    2 root     root          4096 Sep 30 00:01 .     drwxr-xr-x   24 root     root         12288 Sep 30 00:00 ..     -rwxr-xr-x    1 root     root       1816444 Jun  6  2014 cachegrind-x86-linux     -rwxr-xr-x    1 root     root       1910732 Jun  6  2014 callgrind-x86-linux     -rw-r--r--    1 root     root         28429 Jun  6  2014 default.supp     -rwxr-xr-x    1 root     root       1884080 Jun  6  2014 drd-x86-linux     -rwxr-xr-x    1 root     root       1770688 Jun  6  2014 exp-bbv-x86-linux     -rwxr-xr-x    1 root     root       1852668 Jun  6  2014 exp-ptrcheck-x86-linux     -rwxr-xr-x    1 root     root       1910200 Jun  6  2014 helgrind-x86-linux     -rwxr-xr-x    1 root     root       1778880 Jun  6  2014 lackey-x86-linux     -rwxr-xr-x    1 root     root       1792524 Jun  6  2014 massif-x86-linux     -rwxr-xr-x    1 root     root       1942904 Jun  6  2014 memcheck-x86-linux     -rwxr-xr-x    1 root     root       1766560 Jun  6  2014 none-x86-linux     -rwxr-xr-x    1 root     root          2620 Jun  6  2014 vgpreload_core-x86-linux.so     -rwxr-xr-x    1 root     root         65296 Jun  6  2014 vgpreload_drd-x86-linux.so     -rwxr-xr-x    1 root     root         17904 Jun  6  2014 vgpreload_exp-ptrcheck-x86-linux.so     -rwxr-xr-x    1 root     root         37908 Jun  6  2014 vgpreload_helgrind-x86-linux.so     -rwxr-xr-x    1 root     root         15128 Jun  6  2014 vgpreload_massif-x86-linux.so     -rwxr-xr-x    1 root     root         26652 Jun  6  2014 vgpreload_memcheck-x86-linux.so      First of all, notice that they do not have "valgrind" string in their names. Then, they are shown as regular files (not pipes, not devices). But, very strangely, they are not found by simple `ls`:               $ ls -al /usr/lib/memcheck-x86-linux     ls: /usr/lib/memcheck-x86-linux: No such file or directory      They don't even show in the regular listing:               $ ls -al /usr/bin     (snipped)      What on Linux could cause that behaviour? More, there is no utility like "file" on the device, but I doubt that would help me much. Output of `df`:               $ df     Filesystem           1024-blocks    Used Available Use% Mounted on     /dev/root               980308    175548    754964  19% /     tmpfs                    10240       112     10128   1% /dev     tmpfs                   246728         0    246728   0% /tmp     tmpfs                     2048        12      2036   1% /var/log     tmpfs                   246728       128    246600   0% /dev/shm     tmpfs                   246728         0    246728   0% /run     tmpfs                   246728        20    246708   0% /var/run      So, `/` is a device. And:               $ whoami     root      So, I am root. Just to complete the puzzle:               $ ls -al /dev/root     ls: /dev/root: No such file or directory      So the device that is mapped does not really exist.


Why writing to /dev/random does not make parallel reading from /dev/random faster?

Typically reading from `/dev/random` produces 100-500 bytes and blocks, waiting for an entropy to be collected. Why doesn't writing information to `/dev/random` by other processes speed up reading? Shouldn't it provide the required entropy? It can be useful for unblocking `gpg` or similar software without restarting it and re-entering everything, for generating non-super-top-secret keys, etc.


Bash : command line with optional arguments

I'm running this kind of code:               #!/usr/bin/env bash     set -u     exclude1='--exclude=/path/*'     exclude2='--exclude=/path with spaces/*'     exclude3=''        # any 'exclude' can be empty     tar -czf backup.tgz "$exclude1" "$exclude2" "$exclude3" 2>&1 | grep -i 'my_reg_exp' > error.log     RESULT=("${PIPESTATUS[@]}")     ... etc ...      When I run this code, I get this error:               tar: : Cannot stat: No such file or directory      This is because "$exclude3" is translated as an empty argument. Exactly as if I did this:               tar -czf backup.tgz "$exclude1" "$exclude2" ''      One way to avoid this error is to remove the double quotes around $excludeX. But this is a problem if $excludeX contains any space or other strange characters. Another way would be to use `eval` but because I need to keep the double quotes, I don't see how to suppress the quotes AND the empty arguments when needed. The only solution I found is to construct the command-line with string concatenation:               CMD='tar -czf backup.tgz'     if [[ -n "$exclude1" ]]; then CMD+=" \"$exclude1\" "; fi     if [[ -n "$exclude2" ]]; then CMD+=" \"$exclude2\" "; fi     if [[ -n "$exclude3" ]]; then CMD+=" \"$exclude3\" "; fi     eval $CMD 2>&1 | grep -i 'my_reg_exp' > error.log     RESULT=("${PIPESTATUS[@]}")     ... etc ...      Anyone have a smarter idea?


How do I mount a CloneCD .img file?

CloneCD is proprietary. I have a bunch of images that were created with in. Inside of the `.CCD` file it says.               [CloneCD]     Version=3      How do I mount this?


How to configure FOSS ATI drivers on Debian Wheezy and ATI RS880 [Radeon HD 4250]?

Installed a fresh Debian Wheezy to enjoy Gnome 3 but it starts in fallback mode. I suppose that's because the loaded drivers do not support 3D acceleration. Installed packages I know are relevant:   * `xserver-xorg-video-ati`   * `libgl1-mesa-dri` The Gnome 3 was working fine with Ubuntu 12.04, and I belive it was using the FOSS drivers. Interestingly there is no `/etc/X11/xorg.conf` and when I try to generate it with `Xorg -configure` I get:               X.Org X Server 1.12.1     Release Date: 2012-04-13     X Protocol Version 11, Revision 0     Build Operating System: Linux 3.2.0-2-amd64 x86_64 Debian     Current Operating System: Linux blackwhisper 3.2.0-2-amd64 #1 SMP Mon Apr 30 05:20:23 UTC 2012 x86_64     Kernel command line: BOOT_IMAGE=/vmlinuz-3.2.0-2-amd64 root=UUID=e6f57a36-19aa-4dfc-9b61-32d5e08abcc6 ro quiet     Build Date: 07 May 2012  12:15:23AM     xorg-server 2:1.12.1-2 (Cyril Brulebois <kibi@debian.org>)      Current version of pixman: 0.24.4         Before reporting problems, check http://wiki.x.org         to make sure that you have the latest version.     Markers: (--) probed, (**) from config file, (==) default setting,         (++) from command line, (!!) notice, (II) informational,         (WW) warning, (EE) error, (NI) not implemented, (??) unknown.     (==) Log file: "/var/log/Xorg.0.log", Time: Sat May 19 20:15:31 2012     List of video drivers:         mga         ...MANYMORE         radeon         ...MANYMORE         ati         ...MANYMORE         vesa     (++) Using config file: "/root/xorg.conf.new"     (==) Using system config directory "/usr/share/X11/xorg.conf.d"     (II) [KMS] No DRICreatePCIBusID symbol, no kernel modesetting.     Number of created screens does not match number of detected devices.       Configuration failed.     Server terminated with error (2). Closing log file.      **ADDITION** I found now at the message boot:               [    8.121829] [drm] Loading RS780 Microcode     [    8.156063] r600_cp: Failed to load firmware "radeon/RS780_pfp.bin"     [    8.156092] [drm:r600_startup] *ERROR* Failed to load firmware!


Installing linux source

My distro(Crunchbang) was missing the source files and only the header files were present. So I installed the Linux source using:               $ sudo apt-get install linux-source      After the completion of download there were two new tar files under /usr/src/ directory:   * linux-patch-3.2-rt.patch.bz2   * linux-source-3.2.tar.bz2 I don't know how to proceed further. Is it okay to just unpack the source(second tar file) and move it under /usr/src/ ? I would like to have the documentation files present on my distro since it's missing. Apparently it only has the header files. I read somewhere that the documentation files are in the kernel source.


How to Reset/Cycle Power to a PCIe Device?

I have a PCIe device that only works correctly when the computer is fully powered off then on again. Issuing a simple `reboot` or `reboot -p` command does not appear to cycle the power to the PCIe card, which causes it not to work after the reboot. Is there a way to, from the OS, cycle power to a device in a PCIe slot? I can find it in `/sys/bus/pci/devices/0000*/`, but I can't figure out how to properly reset the board. Toggling power seems to be the only way. Barring that, can I change a setting somewhere that will cause a full power cycle on a `reboot` command? I'm running Ubuntu 12.10 by the way.


ffmpeg could not open file.mpg

When I want to convert a video with the following command:               ffmpeg -i file.wmv -sameq file.mpg      it ends with this error message:               FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.   configuration:     --extra-version=4:0.5.1-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static   libavutil     49.15. 0 / 49.15. 0   libavcodec    52.20. 1 / 52.20. 1   libavformat   52.31. 0 / 52.31. 0  libavdevice   52. 1. 0 / 52. 1. 0   libavfilter    0. 4. 0 /  0. 4. 0  libswscale     0. 7. 1 /  0. 7. 1   libpostproc   51. 2. 0 / 51. 2. 0  built on Mar 31 2011 18:53:20, gcc: 4.4.3 [wmv3 @ 0x82dbc50]Extra data: 8 bits left, value: 0          Seems stream 1 codec frame rate differs from container frame rate:     1000.00 (1000/1) -> 30.00 (30/1) Input #0, asf, from 'file.wmv':   Duration: 00:16:53.68, start: 3.065000, bitrate: 3827 kb/s         Stream #0.0: Audio: 0x0162, 44100 Hz, stereo, s16, 48 kb/s         Stream #0.1: Video: wmv3, yuv420p, 1920x1080, 3750 kb/s, 30 tbr, 1k tbn, 1k tbc Could not open 'file.mpg'      What is wrong? How can I fix it?


How to match group 1 in a regex followed by a 0 rather than matching group 10

In regex plugin of gedit, I use a regex to match/search and another for substitution. In the matching regex, I only have one group. In the substitution regex, I use \1 to refer to the group, and I also like to add a zero right behind \1, but \10 will change to mean the 10th group in matching regex. So I was wondering how to solve this problem? For example, in my original text there are cases where `0` is misinput as `o`, such as `12o` should be `120`. My matching regex is `(\d+)o`, and my substitution regex is `\10` which is not right.


How to optimize Arch linux boot time?

I've had Arch Linux installed on my system for a while now, but the problem is that it takes way too much time to boot. And so, I'm trying to optimize the boot process. A Google search led me to `quick-init` but the its' AUR page says its out-of-date. So, I just want to make sure if I should use this? Or are there any other ways?


What is meant by cache aliasing?

What is the meant by cache aliasing? I searched around some, but wasn't satisfied with the answers I found. I also saw two associated terms, instruction cache aliasing & data cache aliasing. What's the difference between those?


Where does top / gnome-system-monitor get its information about cpu usage?

I am curious where gnome-system-monitor and top (the command line tool) get their information about the CPU usage in %. Could you please explain it to me?


When a process will go to 'D' state?

I'm using "Linux hostname 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 18:40:08 UTC 2009 i686 GNU/Linux" All the client machines will use Thin-client ,I will use my laptop for working and I will mount my home directory from server to my laptop. If I open the firefox in my laptop the firefox window will not open because the process is in 'D' state, and all other users machines got hang up and the lockd process is in 'D' state, ps ajx | grep firefox               1  6187  4313  4313 ?   -1 D<    1030   3:16 /usr/lib/firefox-3.5b4pre/firefox-3.5             7610  7622  7621  7610 pts/3      7621 S+    1030   0:00 grep firefox      if I check the syslog > Jul 13 10:35:56 hostname kernel: [222583.872059] lockd: cannot monitor > laptop > > Jul 13 10:35:57 hostname kernel: [222583.872059] lockd: cannot monitor > laptop ps ajx | grep lockd > root 9178 0.0 0.0 0 0 ? D< 13:35 0:00 [lockd] > > root 11039 0.0 0.0 3340 796 pts/3 S<+ 14:18 0:00 grep lockd The same message for all the client machines. When a process will goes to 'D' state? When the lockd process will go to 'D' state? What is the purpose of lockd process.


Move to trash confirm box

I am using Fedora 14 (Laughlin) with GNOME 2.32.0. I have gconf-editor installed. In gconf-editor apps->nautilus->preference confirm_trash is enabled i.e., checked, also in nautilus file browser, home folder, Edit->Preference->Behaviour "Ask before emptying the Trash or deleting files" is checked. But I am not getting any confirm box while deleting any file or folder. I googled for the solution but came up with nothing. Is this a Bug? Is it solvable? Thank you.


How to startup FreeBSD in console mode

I have recently installed a VMware image of FreeBSD, although when I boot up I get the message: Welcome to DesktopBSD, select from the following options: http://i.imgur.com/VWahL.gif The trouble is when selecting options 1 - 4 I get the GUI and am unable to login as root, as its disabled in these modes. How can I effectively exit and go into console mode, so I can login as root?


Automatic kerberos ticket initialization on login

I'm using `ksshaskpass` to add my password protected keys into `ssh-agent` upon logging into KDE, is there something similar for kerberos?


"openssl dgst -sha1" producing an extraneous "(stdin)= " prefix and trailing newline

If you run this command on your Unix               echo -n "foo" | openssl dgst -sha1      You will get this output:               (stdin)= 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33      (followed by a newline). How can I force openssl to not show the `(stdin)=` prefix, and avoid the trailing newline?


How can I set which is the main account for a meta-contact in Empathy?

Empathy allows users to combine contacts together and create what is called a " _meta-contact_ ". So if you have a contact that uses different protocols, eg. GTalk and MSN, you can combine them together into one contact. Then, when the user starts a chat with the meta-contact, Empathy automatically selects to use the account (contact) that appears to be online most of the time. It is very easy to set up a meta-contact. One has to simply right click on one of their contacts and click "Link contacts..." and then select from his buddy list the other contact(s) that wants to be linked with that. I was wondering if there is a way to specifically set which account appears "dominant" in the meta-contact. Note that in the buddy list, this affects the visible name of the meta-contact. Thank you for any enlightment! PS: Please someone, add the tag "/empathy" if possible as me, being a newbie can't create tags yet :)


pgrep and pkill alternatives on mac os x?

Are there alternatives to `pgrep` and `pkill` commands on Mac OS X or should I just create aliases for them using other commands available for me?


How do you change the color for all the items in the status bar in the i3 WM?

In the _i3_ window manager you have this status bar. The configuration to enable the bar and tell it which file to load for it is in the `~/.i3/config` file. This points to `/etc/i3status.conf` which contains the following to match the font color I use in my terminal emulator:               general {        colors = true        color_good = "#00A5FF" #some neon blue        color_degraded = "#006298"        color_bad = "#FF0000"        output_format = i3bar        interval = 5     }      If I enable a status element which doesn't work in my case - for instance _ipv6_ - it accordingly displays in red. But why are the rest of the statuses all appearing in white and not in blue like I specified? Isn't _color_good_ the default color?


Which tasks to learn and which books to read to become more skilled at Unix/Linux internals?

I recently interviewed at a major company and did well on programming questions such as:   * "What is the time complexity of quicksort?    * What is the opposite in C of malloc?    * What is the opposite in C++ of new?    * What is the first argument in a Python function?" However, I couldn't answer many of the networking / operating system questions so I wonder how to fill this gap. I plan to read the book "Operating Systems" by Tanenbaum and I wonder even though SO is not a recommendation engine in this case if you can tell me other pointers or concrete recommendation how to practice linux/unix internals besides using a linux system in most ways I can and studying the aformentioned book? I read this thread which is basically a duplicate of my questions Recommended reading to better understand unix/linux internals And I therefore have ordered the book "The Unix Programming Environment" even though it is old. Any other advice / answer / comment? Maybe about 1) which tasks to perform to become more knowledgable about linux / unix internals. Thanks


What makes grep consider a file to be binary?

I have some database dumps from a Windows system on my box. They are text files. I'm using cygwin to grep through them. These appear to be plain text files; I open them with text editors such as notepad and wordpad and they look legible. However, when I run grep on them, it will say `binary file foo.txt matches`. I have noticed that the files contain some ascii `NUL` characters, which I believe are artifacts from the database dump. So what makes grep consider these files to be binary? The `NUL` character? Is there a flag on the filesystem? What do I need to change to get grep to show me the line matches?


Non-interactive configuration of linux kernel

Is there any method to configure linux kernel in such way (just an example): `make config CONFIG_OPTION=y && make config CONFIG_OPTION1=no CONFIG_OPTION3=64 CONFIG_OPTION4=/path/` and all the dependencies and alternatives of these configuration options will be set automatically in non-interactive mode.


errors from Windows clients accessing printer via Samba despite CUPS working

On CentOS 6.4 (newdc), I have CUPS 1.4.2-50.el6_4.5 installed, can access its web interface. There I set up our main shared printer, an OCE Imagistics cm2520, and successfully printed a test page. With SerNet Samba 4.0.9 on the same box configured every which example way I could find, I cannot seem to get it to the point where double-clicking the printer in Windows (W2K3, OLDDC) opens up the print queue (as it does from \olddc). The closest I get, by manually defining the printer in smb.conf, is that it shows up in \newdc in Windows Explorer, but double-clicking the BackOfficeCopier printer gives this error:               ---------------------------     Printers     ---------------------------     Operation could not be completed. Either the printer name was typed incorrectly, or the specified printer has lost its connection to the server.  For more information, click Help.     ---------------------------     OK   Help     ---------------------------      If I double-click the "printers" share, I get:               ---------------------------     \\newdc     ---------------------------     \\newdc\printers is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.          Incorrect function.          ---------------------------     OK     ---------------------------      Neither of these causes an entry to appear in log.samba. However, double- clicking on Printers and Faxes shows me a folder containing just "Add Printer" and generates this log entry in log.samba:               [2013/08/23 09:18:39.921226,  0] ../source4/smb_server/smb/service.c:127(make_connection)       make_connection: couldn't find service ::{2227A280-3AEA-1069-A2DE-08002B30309D}: NT_STATUS_OBJECT_NAME_NOT_FOUND     [2013/08/23 09:18:39.935896,  0] ../source4/rpc_server/spoolss/dcesrv_spoolss.c:1189(dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx)       unable to call back to \\OLDDC     [2013/08/23 09:18:39.952321,  0] ../source4/rpc_server/spoolss/dcesrv_spoolss.c:1189(dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx)       unable to call back to \\OLDDC      If I then try "Add Printer" and click Next, my only choice is the top one and there are no ports listed. Trying "Next" again at that point just gives:               ---------------------------     Add Printer Wizard     ---------------------------     Operation could not be completed.     ---------------------------     OK     ---------------------------      About the first error, the queue name in CUPS is OCE, and in smb.conf I have this:               [global]             workgroup = MYDOMAIN             realm = mydomain.lan             netbios name = NEWDC             server role = active directory domain controller             server services = rpc, nbt, wrepl, ldap, cldap, kdc, drepl, winbind, ntp_signd, kcc, dnsupdate, smb, dns             allow dns updates = true             dns forwarder = 192.168.1.1     #        dns recursive queries = yes             dcerpc endpoint servers = epmapper, wkssvc, rpcecho, samr, netlogon, lsarpc, spoolss, drsuapi, dssetup, unixinfo, browser, eventlog6, backupkey, dnsserver, winreg, srvsvc     #       dcerpc endpoint servers = winreg srvsvc             load printers = yes             printing = cups     printcap name = cups          [netlogon]             path = /var/lib/samba/sysvol/mydomain.lan/scripts             read only = No          [sysvol]             path = /var/lib/samba/sysvol             read only = No          [printers]          comment = All Printers          path = /var/spool/samba/             guest ok = Yes          browseable = Yes          read only = No          printable = Yes             create mask = 0700          [print$]          comment = Point and Print Printer Drivers          path = /var/lib/samba/printing          read only = No          [BackOfficeCopier]          path = /var/spool/samba/          browseable = yes          printable = yes          printer name = OCE          [mytest]             path = /home/srv/samba-test-share             read only = No      As far as ACL goes for the second error, etc.:               $ sudo ls -l /var/spool/     ...     drwxrwxrwt.  2 root   root   4096 Aug 15 18:10 samba          $ sudo ls -l /var/lib/samba/     ...     drwxr-xr-x.  4 root root    4096 Aug 22 22:19 printing      I copied everything from \olddc\print$ to \newdc\print$ before chmodding printing back to 755. I followed the HOWTO. CUPS set up my printer correctly. Permissions seem to be right. What am I missing?


wget command not working in cronjob

here is my command :               wget -c -O /home/alireza/Desktop/1.mkv http://mysite.com/myfile      and here is my `/etc/crontab` file :               SHELL=/bin/bash          PATH=/sbin:/bin:/usr/sbin:/usr/bin          MAILTO=root     HOME=/     0 2 * * * root wget -c -O /home/alireza/Desktop/1.mkv http://mysite.com/myfile      I want to run my wget command on 2:00 AM by crontab and it never runs,I dont know whats the problem. the command works fine on command line . is there any problem to run wget command on crontab ? UPDATE :: Im using centos 6.4


Make zsh show autocomplete choices even when a possible match is entered

On my current system (openSUSE 12.3 with zsh 5.0.2) the autocomplete function does not give me a choice of possible completions if I have already entered a possible completion match. For example, if I am in a directory with two files named _file_ and _file2_ and I type:               cat file<TAB>      Then a space will be appended, and I will have no indication that _file2_ was also a possible match. Is it possible to change this behaviour? Bash behaves better in this case (it will show both _file_ and _file2_ without adding a space), but any solution that does not hide possible matches would also be interesting.


dpkg won`t install any package

I`m in deep trouble with my Ubuntu 13.04. Ubuntu stopped support of 13.04 so I added wheezy repository to sources.list then upgraded my system. After then I can neither install any package nor upgrade my system. I tried lots of things like apt-get install -f with no luck. I open my comp through live USB and chroot to broken system. I keep getting following long error message when I try to install a package                 The following extra packages will be installed:   util-linux     Suggested packages:   util-linux-locales kbd console-tools The     following NEW packages will be installed:   util-linux 0 upgraded, 1     newly installed, 0 to remove and 0 not upgraded. 10 not fully     installed or removed. Need to get 0 B/618 kB of archives. After this     operation, 1,590 kB of additional disk space will be used. Do you     want to continue [Y/n]?  Preconfiguring packages ... (Reading     database ... 588796 files and directories currently installed.)     Unpacking util-linux (from     .../util-linux_2.20.1-5.1ubuntu8.1_i386.deb) ... initctl: Unknown     job: K02screen-cleanup insserv: warning: script 'K02screen-cleanup'     missing LSB tags and overrides insserv: warning: script     'K02acpi-support' missing LSB tags and overrides initctl: Unknown     job: K02screen-cleanup initctl: Unknown job: S02screen-cleanup     insserv: Script martian is broken: incomplete LSB comment. insserv:     missing `Required-Start:' entry: please add even if empty. insserv:     missing `Required-Stop:'  entry: please add even if empty. insserv:     missing `Default-Stop:'   entry: please add even if empty. initctl:     Unknown job: S02screen-cleanup insserv: Script martian is broken:     incomplete LSB comment. insserv: missing `Required-Start:' entry:     please add even if empty. insserv: missing `Required-Stop:'  entry:     please add even if empty. insserv: missing `Default-Stop:'   entry:     please add even if empty. initctl: Unknown job: S02screen-cleanup     insserv: Script martian is broken: incomplete LSB comment. insserv:     missing `Required-Start:' entry: please add even if empty. insserv:     missing `Required-Stop:'  entry: please add even if empty. insserv:     missing `Default-Stop:'   entry: please add even if empty. initctl:     Unknown job: S02screen-cleanup insserv: Script martian is broken:     incomplete LSB comment. insserv: missing `Required-Start:' entry:     please add even if empty. insserv: missing `Required-Stop:'  entry:     please add even if empty. insserv: missing `Default-Stop:'   entry:     please add even if empty. initctl: Unknown job: K02screen-cleanup     initctl: Unknown job: S02procps insserv: warning: script 'S02procps'     missing LSB tags and overrides initctl: Unknown job: S01udev     insserv: warning: script 'S01udev' missing LSB tags and overrides     insserv: Script martian is broken: incomplete LSB comment. insserv:     missing `Required-Start:' entry: please add even if empty. insserv:     missing `Required-Stop:'  entry: please add even if empty. insserv:     missing `Default-Stop:'   entry: please add even if empty. insserv:     Default-Stop  undefined, assuming empty stop  runlevel(s) for script     `martian' insserv: warning: script 'network-interface-security'     missing LSB tags and overrides insserv: Default-Start undefined,     assuming empty start runlevel(s) for script     `network-interface-security' insserv: Default-Stop  undefined,     assuming empty stop  runlevel(s) for script     `network-interface-security' insserv: warning: script     'plymouth-splash' missing LSB tags and overrides insserv:     Default-Start undefined, assuming empty start runlevel(s) for script     `plymouth-splash' insserv: Default-Stop  undefined, assuming empty     stop  runlevel(s) for script `plymouth-splash' insserv: warning:     script 'plymouth' missing LSB tags and overrides insserv:     Default-Start undefined, assuming empty start runlevel(s) for script     `plymouth' insserv: Default-Stop  undefined, assuming empty stop      runlevel(s) for script `plymouth' insserv: warning: script     'plymouth-ready' missing LSB tags and overrides insserv:     Default-Start undefined, assuming empty start runlevel(s) for script     `plymouth-ready' insserv: Default-Stop  undefined, assuming empty     stop  runlevel(s) for script `plymouth-ready' insserv: warning:     script 'screen-cleanup' missing LSB tags and overrides insserv:     warning: script 'squid3' missing LSB tags and overrides insserv:     Default-Start undefined, assuming empty start runlevel(s) for script     `squid3' insserv: Default-Stop  undefined, assuming empty stop      runlevel(s) for script `squid3' insserv: warning: script     'networking' missing LSB tags and overrides insserv: Default-Start     undefined, assuming empty start runlevel(s) for script `networking'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s)     for script `networking' insserv: warning: script     'udev-fallback-graphics' missing LSB tags and overrides insserv:     Default-Start undefined, assuming empty start runlevel(s) for script     `udev-fallback-graphics' insserv: Default-Stop  undefined, assuming     empty stop  runlevel(s) for script `udev-fallback-graphics' insserv:     warning: script 'network-interface' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s)     for script `network-interface' insserv: Default-Stop  undefined,     assuming empty stop  runlevel(s) for script `network-interface'     insserv: warning: script 'plymouth-log' missing LSB tags and     overrides insserv: Default-Start undefined, assuming empty start     runlevel(s) for script `plymouth-log' insserv: Default-Stop      undefined, assuming empty stop  runlevel(s) for script     `plymouth-log' insserv: warning: script 'udevtrigger' missing LSB     tags and overrides insserv: Default-Start undefined, assuming empty     start runlevel(s) for script `udevtrigger' insserv: Default-Stop      undefined, assuming empty stop  runlevel(s) for script `udevtrigger'     insserv: warning: script 'nagios' missing LSB tags and overrides     insserv: warning: script 'rsyslog' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s)     for script `rsyslog' insserv: Default-Stop  undefined, assuming     empty stop  runlevel(s) for script `rsyslog' insserv: warning:     script 'kmod' missing LSB tags and overrides insserv: Default-Start     undefined, assuming empty start runlevel(s) for script `kmod'     insserv: Default-Stop  undefined, assuming empty stop  runlevel(s)     for script `kmod' insserv: warning: script 'procps' missing LSB tags     and overrides insserv: Default-Stop  undefined, assuming empty stop      runlevel(s) for script `procps' insserv: warning: script 'mongodb'     missing LSB tags and overrides insserv: Default-Start undefined,     assuming empty start runlevel(s) for script `mongodb' insserv:     Default-Stop  undefined, assuming empty stop  runlevel(s) for script     `mongodb' insserv: warning: script 'avahi-daemon' missing LSB tags     and overrides insserv: Default-Start undefined, assuming empty start     runlevel(s) for script `avahi-daemon' insserv: Default-Stop      undefined, assuming empty stop  runlevel(s) for script     `avahi-daemon' insserv: warning: script 'plymouth-stop' missing LSB     tags and overrides insserv: Default-Start undefined, assuming empty     start runlevel(s) for script `plymouth-stop' insserv: Default-Stop      undefined, assuming empty stop  runlevel(s) for script     `plymouth-stop' insserv: warning: script 'udev' missing LSB tags and     overrides insserv: Default-Stop  undefined, assuming empty stop      runlevel(s) for script `udev' insserv: warning: script     'acpi-support' missing LSB tags and overrides insserv: warning:     script 'udev-finish' missing LSB tags and overrides insserv:     Default-Start undefined, assuming empty start runlevel(s) for script     `udev-finish' insserv: Default-Stop  undefined, assuming empty stop      runlevel(s) for script `udev-finish' insserv: warning: script     'network-interface-container' missing LSB tags and overrides     insserv: Default-Start undefined, assuming empty start runlevel(s)     for script `network-interface-container' insserv: Default-Stop      undefined, assuming empty stop  runlevel(s) for script     `network-interface-container' insserv: warning: script     'plymouth-upstart-bridge' missing LSB tags and overrides insserv:     Default-Start undefined, assuming empty start runlevel(s) for script     `plymouth-upstart-bridge' insserv: Default-Stop  undefined, assuming     empty stop  runlevel(s) for script `plymouth-upstart-bridge'     insserv: warning: script 'udevmonitor' missing LSB tags and     overrides insserv: Default-Start undefined, assuming empty start     runlevel(s) for script `udevmonitor' insserv: Default-Stop      undefined, assuming empty stop  runlevel(s) for script `udevmonitor'     insserv: There is a loop between service tlp and nagios if stopped     insserv:  loop involving service nagios at depth 2 insserv:  loop     involving service tlp at depth 1 insserv: Stopping nagios depends on     tlp and therefore on system facility `$all' which can not be true!     insserv: exiting now without changing boot order! update-rc.d:     error: insserv rejected the script header dpkg: error processing     /var/cache/apt/archives/util-linux_2.20.1-5.1ubuntu8.1_i386.deb     (--unpack):  subprocess new pre-installation script returned error     exit status 1 Errors were encountered while processing:      /var/cache/apt/archives/util-linux_2.20.1-5.1ubuntu8.1_i386.deb E:     Sub-process /usr/bin/dpkg returned an error code (1)      How can I recover my system? > dpkg --audit The following packages have been unpacked but not yet > configured. They must be configured using dpkg --configure or the configure > menu option in dselect for them to work: initramfs-tools tools for > generating an initramfs module-init-tools transitional dummy package > (module-init-tools to kmod) procps /proc file system utilities ifupdown high > level tools to configure network interfaces mountall filesystem mounting > tool kmod tools for managing Linux kernel modules plymouth graphical boot > animation and logger - main package upstart event-based init daemon > initscripts scripts for initializing and shutting down the system udev rule- > based device node and kernel event manager ========================================================================


Problems with sound in Linux Mint 15 on video

**Problem:** I think you'll enjoy this fun problem. I set-up a dev/media server. Steps to reproduce:   1. Start up any video file (with Banshee or VLC or xfce player - doesn't matter) -- all is well. Sound plays properly.   2. Pause the file. Unpause. Sound stops and there is no way of bringind it back. That's problem nr 1. Now after playing this file, try to start up another video file:   * Play another file in Banshee/Integrated/XBMC. There is no sound.    * Play another file in VLC, you'll get get a ~0.2s looping white noise instead of the sound. Also, when changing the VLC volume by mouse or keyboard (in steps), it will temporarily change the volume (for like 1s) and the revert back to 87%. When changind the volume by the VLC slider, the volume stays at that level. **And the most interesting thing:** If I play another audio application (tested only with a browser playing Grooveshark) before opening the second file, the sound will be proper (with the aforementioned pause caveat). This has no effect on the pause bug (i.e. pausing the video, then playing other audio with the browser and unpausing does **not** fix the sound). **Config:**   * Mainboard: FM2-A75IA   * CPU: A10 5800K (with Radeon HD 7660D)   * OS: Linux Mint 15 with Xfce or straight up XBMC 13   * Latest ATI catalyst drivers - stable (13.4)   * Display: A 42 inch Panasosic plasma connected via HDMI


generate a hyperlinked table of contents and insert into existing PDF

I have an existing PDF (without any corresponding source file), and a text file which is a list of items referencing sections within the PDF file, along with a page number for each item. I would like to generate a new PDF which starts with a generated table of contents index, followed by the contents of the original PDF. The generated index needs to be hyperlinked so that clicking on any item will automatically jump to the page containing the referenced section. I'm looking for a suitable set of tools (preferably CLI-oriented) to accomplish this on Linux; all the tools I've looked at so far don't seem to offer a solution. I'm an experienced programmer, and am more than happy to write code if required (preferably in Ruby/Python/Perl/shell) to parse my text file and convert it into a hyperlinked index, but I can't find the right tools to solve it. I think part of the problem is that the hyperlinks need to point to within the same file, but their targets won't exist until later when the ToC is joined with the original PDF. I'm also familiar with various markup languages, e.g. Markdown, reStructuredText, TeX, LaTeX, org-mode, and an ideal solution would use one of these as an intermediate step for generating the hyperlinked ToC.


proper configuration of visudo NOPASSWD for bash backup script

The abstract question is: If script `x` calls program `y`, do I need a NOPASSWD entry in /etc/sudoers for `x`, `y` or both `x` & `y`? (And can `x` then call `sudo -v` without a password?) **Details:** I'm trying to figure out what should go into the /etc/sudoers file to allow a user on Ubuntu (i.e., user ID 1000 who has sudo privileges) to execute a pre- configured full backup without entering a password. My backup script is: `/usr/local/bin/backup`   (See below for script.) The actual backup program called by my script is `/opt/storeBackup/bin/storeBackup.pl`   (See http://storebackup.org/) I tried several approaches with `visudo` but regardless of what I tried, I was still prompted for the password when running the script. I expected that adding a final line to /etc/sudoers (using visudo) like the following would work:               myuser ALL=(ALL) NOPASSWORD:/usr/local/bin/backup      That didn't work. Neither did this:               myuser ALL=(ALL) NOPASSWORD:/usr/local/bin/backup, /opt/storeBackup/bin/storeBackup.pl      Is the problem due to my script calling `sudo -v` near the beginning? Or is something else the problem? To execute the following script, I expect the user to open a terminal and type `backup`. I want it to be that simple and I don't want them to be prompted for a password at all.               #!/bin/bash          sudo -v     # Keep-alive: update existing sudo time stamp if set, otherwise do nothing.     while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &          #do a bunch of stuff that could take a while...          #finally, do backup without asking for password:     sudo /opt/storeBackup/bin/storeBackup.pl -f backup.conf      Thanks


How to get total number of bytes/sectors/blocks written to disk since booting?

I'm considering and update from HDD to SSD. But since Flash cells can only sustain limited writes. I want to know how much data my computer write during normal operation. So I can determine how long lifetime I can expect from the SSD. Is it possible to get (rough) numbers somehow?


How to turn off color with `ls`?

It is normally nice to have color output from `ls`, `grep`, etc. But when you don't want it, is there a switch that can turn it off? `ls -G` turns it on (with BSD-derived versions of `ls`) if it's not the default, but `ls +G` does not turn it off. Is there anything else that will?


Explanation for background tasks on bash

First, I write a simple PHP script               <?php     while(true)       {         echo 'hey'.PHP_EOL;         sleep(1);       }      Then I run it like:               php test.php &      Obviously goes into background, but keeps running and prints `hey` repeatedly. Now run it like:               php test.php      and hit `Ctrl+Z` while it is running. It goes into background but stops running. Why stop running? How to keep it running while it goes into background? Think of time when you run something and in the middle of it, you realize you should do something real quick.


Determine users of nearby machine from CLI

Ok, so at my house I have three computers, and I frequently enjoy using `ssh` and `scp` to run commands that allow me to do wonderful things. Primarily transferring downloaded files, and running media remotely (music, video etc.). Usually I use the `arp -a` command to determine which other computers are on my network, but this only shows the local IP's. I often forget the **users** that exist on my other machines, and I would like to be able to: **have a command that shows me the users of a remote computer either by network or IP address**


How is it that missing 0s are automatically added in IP addresses? (`ping 10.5` equivalent to `ping 10.0.0.5`)

I accidentally typed               ssh 10.0.05      instead of               ssh 10.0.0.5      and was very surprised that it worked. I also tried `10.005` and `10.5` and those also expanded automatically to `10.0.0.5`. I also tried `192.168.1` and that expanded to `192.168.0.1`. All of this also worked with `ping` rather than `ssh`, so I suspect it would work for many other commands that connect to an arbitrary user-supplied host. Why does this work? Is this behavior documented somewhere? Is this behavior part of POSIX or something? Or is it just some weird implementation? (Using Ubuntu 13.10 for what it's worth.)


How to extract boot.img?

I am trying to see the content in a `boot.img` file from an Android image. I googled and got http://javigon.com/category/development-tools/ to extract `system.img`. But it doesn't work for `boot.img`. When trying to do this for `boot.img`, it is showing the following:               Invalid sparse file format at header magi     Failed to read sparse file      Is `simg2img` used only for extracting `system.img`?   1. If so, Is there any other method to extract `boot.img`?   2. If not, what is the problem for not extracting `boot.img`?


whiptail or dialog

I am going to create script which will use user input, so I decided to use whiptail, but little bit confuse that which one is portable and will work in ubuntu 10.x and higher and CentOs5.x and higher. I know `read`, but I want dialog like tool, so if anybody know any alternative just let me know.


Partitioning EFI machine with two SSD disks in mirror

I have two SSD disks, I want to put them in a software mirror RAID. But whatever I do the OpenSuSe installation keeps telling me that due to the partitioning scheme he won't be able to install the bootloader. How should I partition the disks? Also what block sizes should I use for the raid? I tried the following:               ssd1 -> FAT EFI (256MB)          -> Raid 1/2 mirror swap (4GB)          -> Raid 1/2 mirror LVM (~50GB)          ssd2 -> empty (256MB)          -> Raid 2/2 mirror swap (4GB)          -> Raid 2/2 mirror LVM (~50GB)          LVM  -> root (25GB)          -> home (~25GB)


Prevent text/screen blinking when doing clear

My script doing something like:               while :;        clear             do_a_lot_of_output_here             sleep 1     done      Is it any options to prevent screen of blinking when I'm doing clear and output? I want to do it like in `watch` command (but it's written in `C`). Any advices? `clear | hexdump -C`               00000000  1b 5b 48 1b 5b 32 4a                              |.[H.[2J|     00000007      PS. I'm using `bash` only.


Apt-cache search only specified source

I use backtrack and I have a Packages.gz file with some packages on my hard drive. I want to use "apt-cache search" to search only the folder which contain Packages.gz. Is this possible?


NFS server optimization for maximum performance

I'm looking for maximum of performance for a NFS mount. I'm on local network, it could be completly unsecure, the performance is the most important in my case. What I already found : In /etc/export I've defined _async_ mode, and it already helped a lot. In /etc/default/nfs-kernel-server I've found following variables, which could potentially increase the performance :               # Number of servers to start up     RPCNFSDCOUNT=8     # Runtime priority of server (see nice(1))     RPCNFSDPRIORITY=0     # Options for rpc.mountd.     RPCMOUNTDOPTS=--manage-gids      The NFS server is on Linux Mint, and the client, which mount remote partition is Debian 6. If there are any recommendation for maximum performance of NFS server ? Should I change the RPCNFSDPRIORITY ? If there are any other parameters, which could boost NFS server ? Cient actually mounts the NFS partition with following configuration :               server:/remotepath    /localpath    nfs4 rw,intr,hard,noatime,rsize=32768,wsize=32768 0 0      Is that optimal mounting options for NFS v4 share ?


Why is there a ! in the password hash?

In `/etc/shadow`, I have a line that begins:               ubuntu:!$6$Pi4BKmX8$........................      Why is there a `!` before the `$6$` in the hash?


Impossible to execute a command by using su for another (system) user

I've created my user like this:   `sudo adduser --disabled-password --system --home /var/lib/deluge --gecos "Deluge server" --group deluge` The content of `/etc/passwd`:   `deluge:x:110:114:Deluge server,,,:/var/lib/deluge:/bin/false` The directory I'm in :               root@xxxxxx:/var/lib/deluge/.flexget# ls -al       drwxr-xr-x 2 deluge deluge 4096 15 mars  11:39 .       drwxr-xr-x 7 deluge deluge 4096 15 mars  11:40 ..       -rwxr-xr-x 1 deluge deluge 3881 15 mars  11:39 config.yml      What I'm trying to do :               su deluge -c "flexget --test execute"      But nothing happens, I've got no error shown, I also tried just `su deluge` but the same still root. How can I run a command using this user ? (I'm not using `sudo`)


Is there a command-line email client and auto-download attachment to a file?

Is there a linux email client that can run on command line and can be configured to fetch and automatically save attachments to the filesystem? Im currently using Thunderbird and it has a nice add-on called 'Attachment extractor' which automatically downloads attachments to the filesystem once the mail arrives. My problem is I want to run a custom php script the can process the attached file once it arrives. Thanks!


How to disable root account on openSUSE?

Is there a way to disable the root account completely on openSUSE so you can administer your system like the way you would do in Ubuntu?


Getting keyboard to work in debian 6.0 in order to unlock root partition

I just installed Debian 6.0, encrypted `/` and now I'm trying to boot. When GRUB comes up, I select Debian, it loads the initrd and asks for the root password, however I can't enter anything, because the system doesn't recognize my keyboard. It is a standard USB keyboard. What can I do to get my keyboard working?


How can I remove a stubborn docker image?

I was trying to remove a Docker image as follows and could not figure out how to do this. ### List of docker images               $ docker images     REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE     <none>              <none>              04251cf7a8b9        About a minute ago   356.1 MB     pg-image            latest              1060b3e656b6        5 minutes ago        323.9 MB     redis-image         latest              8df469463da3        14 minutes ago       137.7 MB     ubuntu              12.04               822a01ae9a15        2 weeks ago          108.1 MB      Docker image I'd like to remove:               $ docker rmi 042     Error response from daemon: Conflict, cannot delete 04251cf7a8b9 because      the container 4ac3a09ab4d3 is using it, use -f to force     2014/08/27 15:16:15 Error: failed to remove one or more images      When I attempted to remove it using `-f` it was unsuccessful. How do I properly remove this image, and why can I not remove it using `docker rmi -f 042`?


How to edit/fix a theme to make it support a newer version of gnome?

**What I have:**   1. gnome 3.12    2. the Faence theme, http://tiheum.deviantart.com/art/GTK3-Gnome-Shell-Faience-255097456 **Current issue:** The faence theme "only" supports gnome 3.10, I don't want to downgrade to gnome 3.10. As can be seen in the below image, the buttons on gtk popup windows and the buttons in nautilus are not rendering correctly: ![http://i.imgur.com/VjAIWuW.png](http://i.stack.imgur.com/wwa6U.png) **What I want to do:** I do not want to downgrade to gnome 3.10. I just want to edit this theme but the task seems daunting. I know that it is stored in `~/.themes` but tracking this bug down does not seem very productive. Does anyone have any idea where _start_ looking in order to edit/fix these render issues on the buttons?


Deny/allow a user's access to a port dynamically

I have stumbled upon this little tech dilemma yesterday, and know that there is a solution to it (IRC BNC resellers have it implemented already). However, the exact details and implementation elude me, and this is what I'd like to find out. I have a server running nginx to proxy a whole load of web services for a whole load of virtual hosts, all of them dynamically generated. I have a complete list of what each vhost should have in terms of ports, and more importantly, what they shouldn't have. A typical example: Host 1:   * port 9000: PHP-FPM   * port 9001: Node Host 2:   * Port 9002: PHP-FPM   * port 9003: Node   * port 9004: IIS (remote forward) Each server/forward is done as the user, and I know ahead of time which port is given to which user. My question is therefore pretty straightforward: is there a way to deny a user bind/listen rights on a port based on its UID? The reason I want to do this is to prevent Host 1 from subverting Host 2's ports or vice versa.


Files copied to flashdrive only on unmount

I use Debian wheezy with KDE4. Most of the time when I copy something to a flashdrive, the write does not actually take place until I unmount. This even happens with relatively large amounts of data (i think some music around 100MB was still buffered until unmount). Is there any way to tell the OS to write immediately when I tell it to write so I don't have to worry too much about removing my flashdrive without properly unmounting it?


Local, regular file causes `stat` or `ls -l` to hang

I've seen a few different questions about `ls` hanging. It's usually because they use the `-l` switch, which causes a `stat` on the file, which in turn is a bad symlink or pointing to an NFS mount or some such. I have a local file (in an old copy of the Git source that somebody else unpacked, of all things) that causes `stat` to hang, but responds to `CTRL-C`. It also causes `ls -l` to hang, hard, such that it does not respond to `kill` (but does terminate on a `kill -9`). It's not a symlink. The other files in the directory appear to `stat` without issue. I've recently rebooted the machine with forced `fsck`, which came out clean, and `dmesg` shows no disk-related messages. How can this be?


GPG Problems When Releasing With Leiningen

I'm trying to use `lein release` (default, not the plugin). Now, I've installed gpg-agent and pinentry-curses, and gotten to the point where a separate curses screen appears, asking me for my secret key. However, the screen does not respond to my key inputs and just hangs there. I have to interrupt (Ctrl-c) the dialog to get back keyboard responsiveness. Now, I've been following these guides, but haven't been able to solve this problem yet. Any insights?   * https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html   * How to configure gpg to enter passphrase only once per session   * http://fvue.nl/wiki/Debian_4.0:_Installing_gpg-agent


What should I set my locale to and what are the implications of doing so?

This question was stimulated by asking the question Chromium browser does not allow setting the default paper size for "Print to File", and also by a conversation with @Gilles on chat. As pointed out by @don_crissti, and as verified by me, changing the locale (at least `LC_PAPER`) makes a difference in what paper size is selected. I had never given much thought to what to select, and had always gone with `en_US.UTF-8` because it seemed like a reasonable default choice. However, per @Gilles on chat (see conversation starting at http://chat.stackexchange.com/transcript/message/17017095#17017095). Extracts: > Gilles: LC_PAPER defaults to $LANG > > Gilles: You must have LANG=en_US.UTF-8. That's a bad idea: it sets > LC_COLLATE and that's almost always a bad thing > > Gilles: LC_COLLATE doesn't describe correct collation, it's too restrictive > (it goes character by character) remove LANG and instead set LC_CTYPE and > LC_PAPER > > Gilles: plus LC_MESSAGES if you want messages in a language other than > English Clearly, there are issues here I am not aware of, and I am sure many others are as well. So, what issues should you consider when setting locales, and how should you set them? I've always just run `dpkg-reconfigure locales` in Debian, and not thought twice about it. Specific question: Should I set my locale to en_IN.UTF-8? Are there any drawbacks of doing so? See also: Does (should) LC_COLLATE affect character ranges?


wget - Considers download done after 1 second even though it isn't

I am trying to use wget to download the Raspbian image for the Raspberry Pi (http://downloads.raspberrypi.org/images/raspbian/2012-07-15-wheezy- raspbian/2012-07-15-wheezy-raspbian.zip). It starts downloading fine but then finished after a second without error but clearly not finished and leaves a tiny file instead of the full one:               kemra102@iacon:~/Downloads$ wget http://downloads.raspberrypi.org/images/raspbian/2012-07-15-wheezy-raspbian/2012-07-15-wheezy-raspbian.zip     --2012-08-13 20:26:57--  http://downloads.raspberrypi.org/images/raspbian/2012-07-15-wheezy-raspbian/2012-07-15-wheezy-raspbian.zip     Resolving downloads.raspberrypi.org (downloads.raspberrypi.org)... 94.136.44.110     Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|94.136.44.110|:80... connected.     HTTP request sent, awaiting response... 301 Moved Permanently     Location: http://downloads.raspberrypi.org/download.php?file=/images/raspbian/2012-07-15-wheezy-raspbian/2012-07-15-wheezy-raspbian.zip [following]     --2012-08-13 20:26:57--  http://downloads.raspberrypi.org/download.php?file=/images/raspbian/2012-07-15-wheezy-raspbian/2012-07-15-wheezy-raspbian.zip     Reusing existing connection to downloads.raspberrypi.org:80.     HTTP request sent, awaiting response... 200 OK     Length: unspecified [text/html]     Saving to: `2012-07-15-wheezy-raspbian.zip'              [ <=>                                                                                ] 17,012      --.-K/s   in 0.04s             2012-08-13 20:26:57 (373 KB/s) - `2012-07-15-wheezy-raspbian.zip' saved [17012]          kemra102@iacon:~/Downloads$ ls -l 2012-07-15-wheezy-raspbian.zip      -rw-rw-r-- 1 kemra102 kemra102 17012 Aug 13 20:26 2012-07-15-wheezy-raspbian.zip     kemra102@iacon:~/Downloads$       I cannot find anything anywhere on the net to indicate what could possible be causing the issue.


postfix add single IPv6 address

I have my webserver set up to send out email as a smartserver using postfix and it does not allow any other machines on my network to send mail through it. I've been able to send email from my webserver to any address I like and it still works like that. But I want to change the fact that postfix refuses all clients on the local LAN. I want my desktop PC to be able to send out email through my webserver, but I can't get past these log messages:               Aug 13 21:58:01 localserver postfix/smtpd[21838]: connect from diablo[2001:980:1b7f:1:d568:1d76:bc9a:e356]     Aug 13 21:58:05 localserver postfix/smtpd[21838]: disconnect from diablo[2001:980:1b7f:1:d568:1d76:bc9a:e356]      I tried adding the IPv6 address to the `mynetworks` line in main.cf, but it doesn't solve the issue.               smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)     biff = no          append_dot_mydomain = no          readme_directory = no          # TLS parameters     smtpd_tls_cert_file = /etc/ssl/certs/ssl-mail.pem     smtpd_tls_key_file = /etc/ssl/private/ssl-mail.key     smtpd_use_tls = yes     smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache     smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache          myhostname = localserver.local     alias_maps = hash:/etc/aliases     alias_database = hash:/etc/aliases     myorigin = /etc/mailname     mydestination = some.server.nl., localserver.local, localhost.local, localhost     relayhost =      mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104     mailbox_size_limit = 0     recipient_delimiter = +     inet_interfaces = all     home_mailbox = Maildir/     smtpd_sasl_auth_enable = yes     smtpd_sasl_type = dovecot     smtpd_sasl_path = private/dovecot-auth     smtpd_sasl_authenticated_header = yes     smtpd_sasl_security_options = noanonymous     smtpd_sasl_local_domain = $myhostname     broken_sasl_auth_clients = yes     smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination     smtpd_sender_restrictions = reject_unknown_sender_domain     mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-mail-stack-delivery.conf -n -m "${EXTENSION}"     smtp_use_tls = yes     smtpd_tls_received_header = yes     smtpd_tls_mandatory_protocols = SSLv3, TLSv1     smtpd_tls_mandatory_ciphers = medium     smtpd_tls_auth_only = yes     tls_random_source = dev:/dev/urandom      Hints/tips anyone?


What are inodes good for?

I wonder if storing the information about files in inodes instead of directly in the directory is worth the additional overhead. It may be well that I'm overestimating the overhead or overlooking some important thing, but that's why I'm asking. I see that something like "inodes" is necessary for hardlinks, but in case the overhead is really as big as I think, I wonder if any of the reasons justifies it:   * using hardlinks for backups is clever, but efficiency of backups is not important enough when compared to the efficiency of normal operations   * having neither speed nor size penalty for hardlinks can really matter, as this advantage holds only _for the few files_ making use of hardlinks while the access to _all files_ suffers the overhead   * saving some space for a couple of equally named binaries like `bunzip2` and `bcat` is negligible I'm not saying that inodes/hardlinks are bad or useless, but can it justify the cost of the extra indirection (caching helps surely a lot, but it's no silver bullet)?


Sound messed up in Starcraft. What's the deal?

I'm trying to run Starcraft through Wine. The sound is all distorted, as if it were playing underwater. Then, about 10 minutes into the game the sound is perfect for 1-2 seconds. Then, there's no sound at all. I have another sound issue which might give a hint. If I'm playing a video on YouTube, and I open vlc to play a movie, the movie will have no sound. If I close Chrome, the sound then starts on the video. vlc often gives me this error when I do this: > Audio output failed: The audio device "sysdefault:CARD=SB" could not be > used: Device or resource busy. I have no idea where to start. I've looked through a bunch of forums where people have similar problems but, after pages of querying, no solution is found. If you need more info, please ask in the comments and I will update this question asap.


Ubuntu 13..04 reinstall Unity and gnome3

I remove unity and gnome 3 in my Ubuntu. I am using now just mate desktop. But I would like to restore Unity and Gnome3. So I tried this re-install solution, but now i get:               The following information may help to resolve the situation:          The following packages have unmet dependencies.      libunity-core-6.0-dev : Depends: libglib2.0-dev but it is not going to be installed                              Depends: libnux-4.0-dev (>= 4.0.0) but it is not going to be installed                              Depends: libunity-dev (>= 4.0.0~) but it is not going to be installed                              Depends: libdee-dev but it is not going to be installed      nautilus : Depends: nautilus-data (< 1:3.7) but 1:3.8.2-0ubuntu1~ubuntu13.04.1 is to be installed      nautilus-sendto-empathy : Depends: empathy (= 3.6.4-0ubuntu4.1) but it is not going to be installed     E: Unable to correct problems, you have held broken packages.      What can I do to resolve this? EDIT: I already tried apt-get install -f but there is no list to repeare


Ubuntu + CISCO VPNC CLIENT for my new ubuntu version (32 bit )

I have newest Ubuntu Linux version 10.04.4 (32 bit ) I want to install Cisco VPNC client on this linux machines in order to connect to other customers I little confuse , which VPNC cisco version will fit for my Ubuntu Linux machine , I see in google allot of information But I can’t understand what the right instruction ( VPN Version ), in order to install VPN cisco client on Ubuntu Linux version 10.04.4 (32 bit ) ,


'ls' not working, wrong PATH variable

`ls` is not working               [root@xilinx ~]# echo $PATH     /root/usr/bin:/root/usr/bin     [root@xilinx ~]# ls      bash: ls: command not found      Was trying to add;               > PATH=/root/CodeSourcery/Sourcery_G++/bin:$PATH     > export PATH      And when tried:               root@xilinx bin]# arm-none-linux-gnueabi-g++     bash: arm-none-linux-gnueabi-g++: command not found      I have checked `arm-none-linux-gnueabi-g++` is indeed located at `/root/CodeSourcery/Sourcery_G++/bin` And then every thing is messed up. What do I do to: 1- recover PATH so that ls starts working again 2- correctly set PATH for Codesourcery


Can I limit total cputime used by a cgroup?

Although cgroups seemingly allow to control the CFS bandwidth of a cgroup, I don't see a way of enforcing a cpu time limit on a cgroup. The use case is that I would like to catch student programs that e.g. go into an infinite loop.


How do I display a manpage with groff in/on msysgit?

I've been unable to correctly set up a `MANPATH` environment variable in `msysgit` (1.9.0; 20140217) on Windows 7 (which is not my main concern here). Every time I execute the `man` command, I recieve the following errors:   1. /usr/local/lib/man.config: No such file or directory.   2. Warning: Cannot open local configuration file /usr/local/lib/man.config.   3. No manual page for {command} As stated above, this is not a concern, merely an inconvenience as I know it's possible to use `groff [something] -T ascii /path/to/manpage` to display manpages. However, I am unable to find the command necessary to do so, having searched SE. (I know there was a question asking for it, but it doesn't show in my searches.) As a work-around, I've been using online manpages, but I'd prefer not to search the Web every time I want to view a manpage. So, first prize is the `groff` command for displaying man pages and the second is instructions on how to set up `man.config` (including file contents) for `msysgit`.


Using a make rule to call another

I am writing a LaTeX project that I am using a makefile for. I have a clean function to clean the excess LaTeX files:               .PHONY: clean     clean:         \rm *.aux *.blg *.out *.bbl *.log      But in some cases I need to get rid of the generated files as well as the PDF file. I have attempted this using:               .PHONY: clean_all     clean_all:             $(clean) \rm *.pdf      This does not work as it only removes the PDF file. My question is how do I invoke the `clean` rule inside the `clean_all` rule?


Jail only a specific user with vsftpd

I'm using both Redhat and CentOS. When I do followings:                # vi /etc/vsftpd/vsftpd.conf      chroot_local_user=YES      # service vsftpd restart      Then all users are jailed in their home directory. How can I jail a specific user only?


What is the advantage of using pthreads in Linux?

I read somewhere that Linux threads are really implemented as processes in the kernel since with today's hardware and on the Linux platform, the thread model is inefficient compared to the process model. If this is the case then why do we still use pthreads programming in our projects (other than for backward compatibility)? Why is there so much hesitation in deprecating the pthreads model in Linux?


tmux status-bar corrupted after catting a binary file, how to reset?

I accidentally screw up my tmux terminal after `cat`ing a binary file. Now my `tmux` is messed up. Detaching and re-attaching doesn't help, nor does a redraw (C-b r). Running `reset` only redraws the active pane, not the rest. Running `ssty sane` either in- or outside `tmux` doesn't help either. ![tmux messed up](http://i.stack.imgur.com/NrmBK.jpg) Within each pane, I have normal feedback from what I type (the initial call of `reset` immediately after the terminal got messed up solved this), but I can't seem to fix the status-bar. In `gnome-terminal`, every update to the status-bar leads to the status-bar to grow (see screenshot above). For example, this happens when I run a new application, when I switch panes, or when I resize a pane. Forcing a redraw (By `C-b r`, by running `reset` or via the gnome-terminal menu) shrinks back the status-bar to a single line, but it remains corrupted. In `xterm`, the status-bar does remain within one line, but it remains corrupted as pictured. I'm using tmux 1.5.   * How do I fix my `tmux`-terminal? This bug report from 2008 seems to describe the same issue, but it was marked as fixed. I don't know in what version it was fixed, but tmux 1.5 ought to include a fix from 2008.


How to make executable of all files excluding a few file types?

I have a folder containing many C source file and the same number of its compiled output files. I set executable bit to all this files but for some reason it was lost, making them not executable. _(I think that's because I moved that folder to a NTFS partition for a while)_. I would like to make them (but not the other files in my directory) executable again. One possible way is to move all source file from that folder to a temporary folder and do:               chmod +x *      Then move source files back to current folder. Is it possible to do the same without moving files around? ### Note: Compiled output files are extension-less _(in C)_.


Update Route Entry On another DD-WRT upon New IP address (WAN) SSH linux

I have two routers on two different gateways/ISPs but on the same local subnet (192.168.). If router A (192.168.1.1) gets IP address from the ISP (for example 24.64.10.15, non-static), I would like router A to login router B (192.168.1.2) (via ssh or telnet) and update the Routing Entry. ### Example: Router B (192.168.1.2)   Set number: 1   Route Name: routename   Metric: 0   Destination LAN Net: 24.64.10.15   Subnet Mask: 255.255.255.255   Gateway: 192.168.1.1   Inference: LAN & WLAN


What's the difference between <Directory /> and <Directory /var/www/> in apache?

I was playing with the apache configuration files after a system restore when I noticed something I have never really though about too much. Here are the first lines of the default `/etc/apache2/sites-available/default`:               DocumentRoot /var/www     <Directory />         Options FollowSymLinks         AllowOverride None     </Directory>     <Directory /var/www/>         Options Indexes FollowSymLinks MultiViews         AllowOverride None         Order allow,deny         allow from all      </Directory>      Since the root of a web server is usually `/var/www`, why is there the need to add a `<Directory />` in here?


FedUp, unable to upgrade to Fedora 20

I am upgrading my Fedora OS to the latest version 20 as the current one is nearing end of life. Fedora introduces a new upgrade method called FedUp that allows user to perform an upgrade over the network. I followed the instructions in there and everything went smoothly with no errors in the fedup log:               # fedup --network 20     setting up repos...     getting boot images...     .treeinfo.signed                                              | 2.0 kB  00:00:00     setting up update...     finding updates 100% [==========================================================]     verify local files 100% [=======================================================]     testing upgrade transaction     rpm transaction 100% [==========================================================]     rpm install 100% [==============================================================]     setting up system for upgrade     Finished. Reboot to start upgrade.     Packages without updates:       btparser-0.25-1.fc18.x86_64       firstboot-18.6-2.fc18.x86_64       google-chrome-stable-31.0.1650.63-1.x86_64       kernel-3.11.10-100.fc18.x86_64       kernel-3.11.7-100.fc18.x86_64       kernel-modules-extra-3.11.10-100.fc18.x86_64       kernel-modules-extra-3.11.7-100.fc18.x86_64       libgssglue-0.4-1.fc18.x86_64       mysql-connector-c++-1.1.2-1.fc18.x86_64       mysql-workbench-5.2.47-2.fc18.x86_64      Upon reboot, I encountered three errors: > Failed to start Load Kernel Modules.   >  Failed to start IPv6 firewall with ip6tables.   >  Failed to start IPv4 firewall with iptables. After logging in and upon further examination with lsmod, I notice that several modules are missing, preventing the network from working. The missing modules include:               ebtable_nat     ebtables     ip6table_filter     ip6_tables      microcode     nf_conntrack     nf_conntrack_ipv4     nf_conntrack_ipv6     rt2800lib     rt2800usb     snd     uinput     xt_conntrack     xt_limit      It appears there are many missing modules, preventing me from completing the upgrade to the latest OS version. Next I tried upgrading to version 19 by running the command `fedup --network 19`, but it seems to do an upgrade to the same version 20 instead. I also tried upgrading using the non-recommended way from DVD iso file and it generates warnings, advising me not to do so. I am really fedup. What should I do now?


how do i check if (manually) upgrading software will break existing software?

As an example, let's say I want to upgrade sqlite3. The version I have after (apt-get) updating and upgrading is 3.7.13. The most current version is 3.7.14. If I install the most current version from source, can I somehow know it won't break existing software on this computer? Is there some list of what software depends on what other software? It's not really necessary with sqlite3, but I still want to know in general. I'm running debian wheezy.


Sudo does not work in chroot

I would like to be able to use the sudo command in a chroot environment. I start the chroot as follows:               chroot /debian-squeeze /bin/bash      Now I'm logged in as root in the chroot. I can do `su user` to log in as a user named `user`. Now, `sudo` does not work:               user@HD:/$ sudo ls     sudo: must be setuid root      Some diagnostics:               user@HD:/$ which sudo     /usr/bin/sudo          user@HD:/$ ls -al /usr/bin/sudo     -rwsr-xr-x 2 root root 143884 May 23  2012 /usr/bin/sudo          user@HD:/$ ls -aln /usr/bin/sudo     -rwsr-xr-x 2 0 0 143884 May 23  2012 /usr/bin/sudo          root@HD:/# cat /etc/sudoers     Defaults    env_reset     root    ALL=(ALL) ALL     user ALL=(ALL) ALL     %sudo ALL=(ALL) ALL      As root, I can execute `sudo` without error. Can anyone explain me why `sudo` (or `setuid`) does not work like this?


Figure out the emitted keycode for Fn+F6

On my Lenovo IdeaPad Yoga 2 Pro on Windows, there is a function available `Fn`+`F6` that should **turn the touchpad on and off** (I would like to map the correct key to the script here on askubuntu). But on Linux, it doesn't work. How can I find out the event keycode that it emmits when I press this combination? I tried `showkey -a`, `showkey -k` and `xev` which both shows most keys codes when pressed, but at `Fn`+`F6` they stay quiet. The other `Fn`+`F1-F5` show output, only `F6` doesn't, although it works on Windows. What other **alternatives** are there to `xev` and `showkey`? The only hint i found so far is:               grep TOUCHPAD /usr/include/linux/input.h          #define KEY_TOUCHPAD_TOGGLE 0x212   /* Request switch touchpad on or off */     #define KEY_TOUCHPAD_ON     0x213     #define KEY_TOUCHPAD_OFF    0x214      _source: comment inhttp://askubuntu.com/a/270428/34298 with link to this article_ Maybe someone has an idea?


Unmet dependencies using apt-get on Ubuntu

I am working on a `Ubuntu 12.04.2 LTS (GNU/Linux 3.5.0-43-generic x86_64)` machine. It is a server running in production environment with other projects so I have to be quite careful. I have to install a certain list of programs, so first I run the usual `apt- get update` and then I proceeded to run the following command:               apt-get install python-dev libxslt1-dev libpq-dev git python-pip nginx supervisor wget libxml2-dev mongodb build-essential libxslt1-dev libxrender1 libxext6`      This is what I get:               root@SERVERLINUX:~# apt-get install python-dev libxslt1-dev libpq-dev git python-pip nginx supervisor wget libxml2-dev mongodb build-essential libxslt1-dev libxrender1 libxext6     Reading package lists... Done     Building dependency tree            Reading state information... Done     git is already the newest version.     python-pip is already the newest version.     build-essential is already the newest version.     libxext6 is already the newest version.     libxrender1 is already the newest version.     libxrender1 set to manually installed.     python-dev is already the newest version.     You might want to run 'apt-get -f install' to correct these:     The following packages have unmet dependencies:      libpq-dev : Depends: libpq5 (= 9.1.14-0ubuntu0.12.04) but 9.1.9-0ubuntu12.04 is to be installed                  Depends: libkrb5-dev but it is not going to be installed                  Depends: comerr-dev but it is not going to be installed      libxml2-dev : Depends: libxml2 (= 2.7.8.dfsg-5.1ubuntu4.9) but 2.7.8.dfsg-5.1ubuntu4.6 is to be installed      linux-image-generic-lts-quantal : Depends: linux-image-3.5.0-44-generic but it is not going to be installed      mongodb : Depends: mongodb-server but it is not going to be installed                Depends: mongodb-dev but it is not going to be installed      nginx : Depends: nginx-full but it is not going to be installed or                       nginx-light but it is not going to be installed      supervisor : Depends: python-medusa (>= 0.5.4) but it is not going to be installed                   Depends: python-meld3 but it is not going to be installed                   Depends: python-support (>= 0.90.0) but it is not going to be installed     E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).      What should I do to manage to install the packages with "unmet dependencies"? HOw can I meet those dependencies? I am afraid to use the `-f` option as suggested because it might just mess everything up. Please bear with me, I just want to be extra cautious before taking any risk in this server.


Cannot connect CentOS on port 9200

![enter image description here](http://i.stack.imgur.com/rMey5.png)Hello all, I cannot connect to my CentOS server on port 9200, the port ElasticSearch uses. This is my iptables file (see image above). As you can see I tried to open port 9200, but apparently without success. I can curl localhost:9200 on the CentOS server successfully. But when I try to curl 192.168.2.229:9200 (which is the ip address of eth0) I receive an error (curl:(7) couldn't connect to host). And ofcourse, when I try to connect the address 192.168.2.229:9200 form my windows machine I cannot connect either. Does someone no the problem? And the netstat results: ![enter image description here](http://i.stack.imgur.com/HMVKU.png)


Why is find looking in the current directory?

I have a bash script `/var/www/scripts/process_sounds.sh` that uses the command:               find /var/www/unprocessed_sounds/ * -type f      It's supposed to find all the files in the `unprocessed_sounds` directory, which it does, but it also find all the files in the scripts directory (and then processes them like sound files, which is not what I want). Why would `find` return things in the current directory?


Why are partion size and df output different?

I have a partition /dev/sda1.   Disk utility shows, it has capacity of 154 GB.   **df -h** shows                 Filesystem            Size  Used Avail Use% Mounted on     /dev/sda1             123G  104G   14G  89% /     devtmpfs             1006M  280K 1006M   1% /dev     none                 1007M  276K 1006M   1% /dev/shm     none                 1007M  216K 1006M   1% /var/run     none                 1007M     0 1007M   0% /var/lock     none                 1007M     0 1007M   0% /lib/init/rw      Why are the results different? Where are the missing 31 GB? Thank you


Packages needed to get sound working

I just installed Ubuntu Server 12.10. I am using openbox and startx for my gui session. I decided not to post in the Ubuntu forum because I felt this issue might be relevant to other distros as well, especially Debian based ones. I installed `firefox` and `flashplugin-installer` so I could watch youtube videos. The videos seem like the work fine, however, I seem to be without sound. I also got `volumeicon-alsa` and `alsa-utils` but when I run `alsamixer` I get:               cannot open mixer: No such file or directory      when I try to run `volumeicon` I get               volumeicon: alsa_backend.c:86: asound_get_volume: Assertion `m_elem != ((void *))' failed.      I don't mind using something other than alsa if I need to. I would just like to know what packages I need to install to be able to get sound on youtube videos.


Mount changes directory time to 1970

We are developing an embedded Linux system using BusyBox v1.19.4. The system is working fine except for a strange mount issue with time and date. When we create a directory it has the correct time and date:               \$ ls -l     drwxrwxrwx    2 root     root            40 Jul 21 16:16 media_2e040     \$      However, once we mount a device, the time and date changes:               \$ mount /dev/sdb1 media_2e040     \$ ls -l     drwxr-xr-x    9 root     root         16384 Jan  1  1970 media_2e040     \$      Not knowing much about mounting, I can run `touch` on the directory, and the time/date updates to the correct time. Is there a reason for this operation of mount? Should we be running `touch` to keep the time and date? Thanks.


xrandr command not executed within shell command called from udev rule

I own a Thinkpad with an UltraBase (a docking station). My operating system is Ubuntu 10.10. Now, I would like to react on the "docking" event by setting the resolution of my external display correctly. Here is what I've done already:               $ udevadm info -a -p /sys/devices/platform/dock.0          Udevadm info starts with the device specified by the devpath and then     walks up the chain of parent devices. It prints for every device     found, all possible attributes in the udev rules key format.     A rule to match, can be composed by the attributes of the device     and the attributes from one single parent device.          looking at device '/devices/platform/dock.0':       KERNEL=="dock.0"       SUBSYSTEM=="platform"       DRIVER==""       ATTR{modalias}=="platform:dock"       ATTR{docked}=="0"       ATTR{flags}=="16"       ATTR{uid}=="0"       ATTR{type}=="dock_station"          looking at parent device '/devices/platform':       KERNELS=="platform"       SUBSYSTEMS==""       DRIVERS==""      Then, I've created a udev-rule:               $ cat /etc/udev/rules.d/99-docking.rules     KERNEL=="dock.0", ATTR{docked}=="1", RUN+="/usr/local/sbin/dock.sh"      The script /usr/local/sbin/dock.sh is as follows:               #!/bin/sh     # turn external display on, internal off     echo "hello world" >> "/home/hoppe/udev.out"     /usr/bin/xrandr --output LVDS1 --off     /usr/bin/xrandr --output DP2 --mode "1920x1080"     echo "hello world" >> "/home/hoppe/udev.out"     exit      Both echo-commands are execute without any problems. Also, while calling the script manually, the resolution is set correctly. What have I done wrong?


How can I tell bash valid tab-completions for arguments to my Python script

Say I have a program hello.py and one possible valid argument to it is:               ./hello.py autoawesomesauce      Is is possible to type in:               ./hello.py auto[tab]      at which point the partially completed argument is sent to hello, which recognizes it as such and then completes it on the shell to:               ./hello.py autoawesomesauce      I know git does something like this, but can it be done for a Python script + Bash?


In Arch Linux how can I find out which package to install that will contain file X?

I'm looking for a package that provides a specific binary, so I can install it. how can I search to find out what packages provide this binary? _(note: I know there's at least one tool that does this, but I have forgotten its name.)_