OpenBSD performance tuning (desktop)

What are your ways of tuning a freshly installed OpenBSD operating system specifically for a desktop environment (faster UI interaction etc.)? What are the most important factors here to consider?


Parsing a text-file table and aggregating information

I have long text file with the following columns, space-delimited:               Id            Pos Ref  Var  Cn   SF:R1   SR  He  Ho NC            cm|371443199  22  G     A    R   Pass:8   0   1  0  0            cm|371443199  25  C     A    M   Pass:13  0   0  1  0     cm|371443199  22  G     A    R   Pass:8   0   1  0  0             cm|367079424  17  C     G    S   Pass:19  0   0  1  0           cm|371443198  17  G     A    R   Pass:18  0   1  0  0            cm|367079424  17  G     A    R   Pass:18  0   0  1  0       I want to generate a table that lists each unique ID along with counts for:   * How many times that ID occurred   * How many of those rows were passing (column 6)   * How many had an `He` value (column 8)   * How many had an `Ho` value (column 9) In this case:               Id            CountId  Countpass   CountHe CountHO     cm|371443199   3        3          2        1     cm|367079424   2        2          0        2      How can I go about generating that table?


SIGKILLing after a grace period

I've seen a lot of process managers that try to do this. It was my understanding that you should only use SIGTERM to kill a process. The process could take an unknown amount of time to clean up after itself; on a slow system, it could take minutes. I always thought the only solution was to be patient, and wait for the program to clean up and exit gracefully. If the process does not catch SIGTERMs, then this is a bug and should be reported to the software's maintainer. I've seen popular tools like docker also trying to do this: > Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...] > > Stop a running container (Send SIGTERM, and then SIGKILL after grace period) Is this bad practice? One thing I'm also curious about is how the shutdown procedure works on a SystemV-style init system. I've had a look at some manpages and some other questions but can't find a definite answer. I'm guessing each init service (terminology?) sees the change in run-level and executes the proper "stop" function as defined in the init script. Does it do this one-by-one, making sure each service ends properly? What happens to processes not handled by init scripts? I've seen some questions vaguely mention a grace period being used before SIGKILLing them, but I was hoping someone could elaborate or at least point me in the right direction. :) If someone could help me find out more about how this works with systemd too, I'd be happy to research and find out more. I've had a look at the manpages but can't find anything definitive here either.


Why do so many programs live in PATH?

One thing that puzzles me about desktop Linux, at least, is that just about everything is in my PATH. By everything, I mean every desktop application, including things like gnome-character-map and glchess. These have no command line interfaces to speak of, so I can't think of a case where I would be regularly launching these from a terminal - and, within that unlikely case, I can't imagine being inconvenienced by needing to type their full paths. It just seems cluttery, but maybe there's a good reason. So, why _does_ this happen? Is there any noteworthy impact on performance or maintainability?


Why is a service being started if it isn't mentioned in /etc/init.d?

After a clean install of Fedora 17 and `distcc-server`, I did a `service distccd start`, which completed successfully. `man service` indicates that it would merely be running the `distccd` script at `/etc/init.d/distccd`, but that file doesn't exist. `chkconfig` also doesn't appear to know about `distccd`, which is confirmed by there being no related files in `/etc/rc[0-6].d`. There _does_ exist a file `/etc/sysconfig/distccd` that contains run options for the distcc daemon, but I can't seem to find anything linking `service` to `/etc/sysconfig` anyway. How does `service` know what to do when I type `service distccd start`? Also, I have learned that Fedora 17 may redirect `service` to `systemd`/`systemctl`. Even if that is the case, I still don't find any `distccd` related files in `/etc/systemd/{system,user}`.


How can I make unicode symbols and truetype fonts work in xterm/uxterm?

I'd like to use a truetype font in xterm/uxterm (version 278) but I get problems with unicode symbols (é for example displays fine, so I guess it's not a disabled utf8 or a locale issue):               $ echo -e "\xE2\x98\xA0"      gives me a square instead of ☠ with following config:               UXTerm*faceName: Liberation Mono     UXTerm*faceSize: 9     XTerm*faceName: Liberation Mono     XTerm*faceSize: 9      When I disable truetype fonts using the ctrl right click menu, the symbol displays fine using the default fonts which isn't nice at all. I tried uxrvt and got the same problem when I don't have enough letter spacing, but it works fine when I increase it. However, uxrvt gave me a lot of other problems, just like all the other terminal emulators I tried. Does anybody have an idea?


Running a program without the assistance of the system administrator

I have an `rpm` for a program called KDirStat that I would like to run on a machine where I am not the system administrator. My questions are:   * Can I **install** this **rpm** package without the assistance of the system administrator? (I mean in a technical sense, aside from whether or not it's good practice)   * If I just want to **run** the program, do I necessarily need to **install** the **rpm** package? More generally, why can I not just download the binaries for my platform and execute the program? As a reference, when I run               rpm -i kdirstat-2.2.0-1.src.rpm      I get the following error:               error: cannot write to %sourcedir /usr/src/redhat/SOURCES      but does that necessarily mean that I **need** the assistance of the system administrator to install this preogram?


How do I find the process generating a lot of network traffic?

My machine is generating a lot of network traffic, all from the same source port, with many different destinations (found this out by running `iftop -P`, and from my router's logs). How do I find the process that is generating this traffic?


Trying to run Virtualbox under NX session: getting permission denied

I am running Nomachine NX server on my Ubuntu 12.04, and I'm connecting from a Windows 7 machine using NX client. When I try to start VirtualBox, I get a permission denied error. The same user that I use to connect to NX session can obviously run VirtualBox just fine. How do I fix this?


Reformatting a LaTeX document by perl

I have a `LaTeX` document in which the modifications in the text and equations are done in red color in order for them to be distinguished from unmodified text:               {\color{red} MODIFIED TEXT OR EQUATION GOES HERE.}      This modification can be a single word, a phrase, a sentence, a paragraph, or an equation. For example:                \pi \rho \hat{\bf x} \int\omega_{\color{red} \theta}      or               {\color{red} This work presents the ``numerical study'' of convection in vertical annuli;}      How can I write a `perl` one-liner which can replace `{\color{red} MODIFIED TEXT OR EQUATION GOES HERE.}` to `MODIFIED TEXT OR EQUATION GOES HERE.`? I mean to remove `{\color{red}` and the right curly brace `}` throughout the entire `LaTeX` document.


How to boot Linux to command-line mode instead of GUI?

I am using 32-bit Red Hat Linux in my VM. I want to boot it to command-line mode, not to GUI mode. I know that from there I can switch to GUI mode using `startx` command. How do I switch back to command-line mode?


CUPS timeout for change status to error

I recently installed CUPS 1.5.3 on my Debian Squeeze server. I don't think it's relevant but I think the latest version is 1.6.3, right? However, I'm installing with aptitude, so I'm getting this apparently older version. So my problem is:   * I configure 1 LPD printer   * I sent a job with printer door/cover opened, so is not printed right? But the job stays in the queue with **Spooling job, 0% complete** for infinite minutes. So, I want to limit this time, for **cups alter status to error (or any other)** , because, if I can change it, and limit the timeout, maybe with some script, I can redirect this job to another printer. How can I do that?


Typing break with Awesome WM

Is there a program that implements typing breaks that works with the Awesome Window Manager?


Why is it that these two 'cat' commands result differently?

Let's assume that infile contains a specific text, and I were to execute the following set of commands: > exec `3<infile` > > cat -n `<&3` > > cat -n `<&3` The first instance of cat will display the file's contents, but the second time does not seem to be doing anything. Why do they differ?


A triangle of forward differences in gawk

I need a `gawk` script (not a one-liner, I need a function). Given a row of integers i.e.               0 2 4 1 9 5 1 1      the function should generate successive forward absolute differences, so:               0 2 4 1 9 5 1 1      2 2 3 8 4 4 0       0 1 5 4 0 4        1 4 1 4 4         3 3 3 0          0 0 3           0 3            3      How can I do that using `gawk`?


boot fail after install f19

When I installed f19, I saw this message "system cannot install boot loader" I enter these commends:               chroot  /mnt/sysimage,     grub2-install /dev/sda  --force,     grub2-mkconfig -o /boot/grub2/grub.cfg      when system reboot system gives this message               minimal base-like line editing is supported. for the first word tab lists     possible command completions. anywhere els TAB lists possible device or      file  completions.      GRUB>


sftp a file using shell script

I have read through several threads (which have been helpful) and I'm still getting an error when trying to sftp a file (client wants it to be sftp'ed) Here is the script:               #!/bin/bash      HOST=XX.XX.XX.XX     PORT=XXXX     USER=root     FILE=/tmp/RANDY          /usr/bin/expect<<EOD          spawn sftp -o Port=$PORT $USER@$HOST     expect "sftp>"     spawn put $FILE     interact     EOD      The error I am receiving is:               spawn sftp -oPort=XXXX root@XX.XX.XX.XX     Connecting to XX.XX.XX.XX...     sftp> spawn put /tmp/RANDY     couldn't execute "put": no such file or directory         while executing     "spawn put /tmp/RANDY"      The file exists and is in the correct directory.


"Who" prints duplicated usernames

This is result of `who -uH`:               NAME     LINE         TIME             IDLE          PID COMMENT     me    :0           2013-08-29 01:29   ?          1686 (:0)     me    pts/0        2013-08-29 01:42  old         2905 (:0)     me    pts/1        2013-08-29 01:45  old         2905 (:0)     me    pts/2        2013-08-29 01:52  old         2905 (:0)     me    pts/3        2013-08-29 02:26  old         2905 (:0)     me    pts/4        2013-08-30 18:37 00:07        2905 (:0)     me    pts/5        2013-08-29 10:34  old         2905 (:0)     me    pts/6        2013-08-29 11:05  old         2905 (:0)     me    pts/7        2013-08-29 13:34  old         2905 (:0)     me    pts/8        2013-08-30 15:56 02:45        2905 (:0)     me    pts/9        2013-08-30 18:27 00:17        2905 (:0)     me    pts/10       2013-08-30 17:34   .          2905 (:0)     me    pts/11       2013-08-30 17:37 00:13        2905 (:0)     me    pts/12       2013-08-30 18:28 00:17        2905 (:0)     me    pts/13       2013-08-30 18:38 00:07        2905 (:0)      Why it lists my username in 15 lines? How do I know If someone has connected to my system remotely?


Disable hardware ad-hoc

I am running Parted Magic doing some data recovery, that I am finding myself concurrently using for some other minor tasks also. Problem being, typing is a nightmare, as the trackpad is enabled (No hardware way of disabling it), and seemingly very sensitive. Just wondering:   1. Generally is there is any way to disable hardware in Linux, without restarting X, or the machine (i.e., Ad hoc)?   2. Are their any options to address this specific problem, if not by disabling the device, perhaps redirecting it's output


wireless networking

When I connect my laptop to a **wpa2** secured router, using **wicd** I don't have any connection problems. **BUT** when I connect with the following command-line command ( as outlined here ) **UPDATED:**               ifconfig wlan0 up     wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf     dhcpd wlan0      My connection is unstable, sometimes working sometimes not, indicated by the following output:               $ ping google.com     PING google.com (64.233.179.104) 56(84) bytes of data.     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=1 ttl=56 time=190 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=2 ttl=56 time=196 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=3 ttl=56 time=184 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=4 ttl=56 time=172 ms     64 bytes from 64.233.179.104: icmp_seq=5 ttl=56 time=196 ms     ping: sendmsg: Network is unreachable     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=7 ttl=56 time=210 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=8 ttl=56 time=181 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=9 ttl=56 time=168 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=10 ttl=56 time=168 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=11 ttl=56 time=171 ms     ping: sendmsg: Network is unreachable     ping: sendmsg: Network is unreachable     ping: sendmsg: Network is unreachable     ping: sendmsg: Network is unreachable     ping: sendmsg: Network is unreachable     ping: sendmsg: Network is unreachable     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=18 ttl=56 time=171 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=19 ttl=56 time=164 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=20 ttl=56 time=181 ms     64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=21 ttl=56 time=187 ms      64 bytes from cpt01s01-in-f104.1e100.net (64.233.179.104): icmp_seq=22 ttl=56 time=192 ms     ping: sendmsg: Network is unreachable     ping: sendmsg: Network is unreachable     ping: sendmsg: Network is unreachable     ^C     --- google.com ping statistics ---     25 packets transmitted, 15 received, 40% packet loss, time 28231ms     rtt min/avg/max/mdev = 164.443/182.621/210.508/12.774 ms      My `/etc/wpa_supplicant.conf` file:               network={         ssid="1010011010"         #psk="------------"         psk=------------------------------------------     }      `dhcpcd wlan0`               $ sudo dhcpcd wlan0      dhcpcd[18320]: version 5.2.5 starting     dhcpcd[18320]: wlan0: rebinding lease of 192.168.123.102     dhcpcd[18320]: wlan0: acknowledged 192.168.123.102 from 192.168.123.254     dhcpcd[18320]: wlan0: checking for 192.168.123.102     dhcpcd[18320]: wlan0: carrier lost     dhcpcd[18320]: wlan0: carrier acquired     dhcpcd[18320]: wlan0: rebinding lease of 192.168.123.102     dhcpcd[18320]: wlan0: acknowledged 192.168.123.102 from 192.168.123.254     dhcpcd[18320]: wlan0: checking for 192.168.123.102     dhcpcd[18320]: wlan0: leased 192.168.123.102 for 86400 seconds     dhcpcd: wlan0: MTU set to 1500     dhcpcd[18320]: forked to background, child pid 18377      `ifconfig`               $ ifconfig     lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)          wlan0     Link encap:Ethernet  HWaddr 00:15:AF:78:D4:AA                 inet6 addr: fe80::215:afff:fe78:d4aa/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:3218 errors:0 dropped:0 overruns:0 frame:0               TX packets:2909 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:1959355 (1.8 Mb)  TX bytes:415438 (405.7 Kb)      `route`               $ route          Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     192.168.123.0   *               255.255.255.0   U     303    0        0 wlan0     default         192.168.123.254 0.0.0.0         UG    303    0        0 wlan0


Is there a way to add a directory to my PATH in zsh only if it's not already present?

Is there an easy way in zsh to add a directory to my PATH only if it's not already present? (or, more generally, any environment variable). I've tried:               PATH+=/my/directory      ... but if that's executed twice, it gets added twice.


Help me parse this `find` command

Following command tells me the length of mp4 video files:               find -type f -name "*.mp4" -print0 | \        xargs -0  mplayer -vo dummy -ao dummy -identify 2>/dev/null | \        perl -nle '/ID_LENGTH=([0-9\.]+)/ && ($t +=$1) && printf "%02d:%02d:%02d\n",$t/3600,$t/60%60,$t%60' | \        tail -n 1      Can someone parse it to a Linux beginner and explain why it is the way it is? It would also be helpful to know how to use it again and again without retyping it or through copy-and-paste.


What is the loopback interface

What is the **loopback** interface and how does it differ from the **eth0** interface? And why do I need to use it when _mounting an ISO_ or running a service on localhost?


What do double slashes mean in UNIX path? Is `cd dir/subdir//` valid?

> **Possible Duplicate:**   >  How linux handles multiple path separators (/home////username///file) Do `cd dir/subdir/` and `cd dir/subdir//` mean the same in UNIX? Will the later work out? Else does it have any special meaning? cd, mv, ls or any command for that sake.


When should I use a trailing slash on a directory?

> **Possible Duplicate:**   >  How linux handles multiple path separators (/home////username///file) Most commands I use in linux behave exactly the same whether I include the trailing slash `/` character on the end of a directory name or not. For example:               ls /home/cklein     ls /home/cklein/          cp foo bar     cp foo/ bar/      When does this trailing slash matter? What is the semantic meaning of the trailing slash?


What's the difference between "command directory" and "command directory/"?

> **Possible Duplicate:**   >  When should I use a trailing slash on a directory? Does the slash make any difference?


How can I find the valid values for TERM to use in tmux?

When starting `tmux` I need to pass a valid terminal type. Since I am scripting the initial startup of `tmux` I would like to cover all bases by figuring out the valid values of `TERM` on the current system. How do I find valid values to use for `tmux` and which order, including a possible 16 color fallback, should I prefer? This is mainly for Linux systems, but I presume the approach would be similar on most other unixoids.


Can disks be accessed independently in a RAID-1 volume?

I want to create a RAID-1 array with Debian 6. This array will contain 6 disks, 3 for the OS and 3 mirrors. I used this RAID before but on windows, and maybe I didn't do it good at all, because I could see 3 different disks, but only one for the OS. Is there a way that the OS will see the 3 disks like one ? or they will be like different units?


How can I find files and then use xargs to move them?

I want to find some files and then move them. I can find the file with:               $ find /tmp/ -ctime -1 -name x*      I tried to move them to my `~/play` directory with:               $ find /tmp/ -ctime -1 -name x* | xargs mv ~/play/      but that didn't work. Obviously mv needs two arguments.   Not sure if (or how) to reference the xargs 'current item' in the mv command?


Check if 2 directories are hosted on the same partition on Linux

How can I check if `/my/dir` is on the same partition as `/`? This is for integration within a script. Bind mounts should be handled correctly. POSIX compatible solutions are welcome.


clear command in Konsole

I know about the Linux `clear` command, but it just moves the previous output from the visible part of terminal window (KDE Konsole). I can still scroll up and see all previous text. Is there similar command that can erase entire content of a terminal window? (Something like clc in matlab.)


Remmina doesn't work with keyboard when connected remotely

In order to bypass firewall/GPO constraint, I want to use Ubuntu as springboard to rdp to a Windows box on the same LAN remotely. I can `xrdp` to ubuntu via sesman-Xvnc module. I can run `remmina` from the `vnc` session. But in the `remmina` Windows session, keyboard doesn't work at all. Only mouse works. Keyboard works with other apps in `vnc` session. Also, if I use remmina at local Ubuntu console, keyboard works. Any suggestions?


Dereference copy with KDE Dolphin

From the cli I can dereference copy a symbolic link with `cp -L`. Is it possible to do this with the KDE Dolphin file manager?


Number of files per directory

I have a directory with about 100000 small files (each file is from 1-3 lines, each file is a text file). In size the directory isn't very big (< 2GB). This data lives in a professionally administered NFS server. The server runs Linux. I think the filesystem is ext3, but I don't know for sure. Also, I don't have root access to the server. These files are the output of a large scale scientific experiment, over which I don't have control. However, I have to analyze the results. Any I/O operation/processing in this directory is very, very slow. Opening a file (fopen in python), reading from an open file, closing a file, are all very slow. In bash ls, du, etc. don't work. The question is: What is the maximum number of files in a directory in Linux in such a way that it is practical to do processing, fopen, read, etc? I understand that the answer depends on many things: fs type, kernel version, server version, hardware, etc. I just want a rule of thumb, if possible.


Are there any animation programs for animating static images?

I'd like to make a simple movie with my kids. I've taken some pictures of toys and cropped them to be the characters. I'd like to make a movie where these move against some background (ie the characters _themselves_ are not animated but move "as a whole"). Finding such a program seems beyond my search capabilities. Does anyone know of a good program for doing this, preferably one that is simple enough that my (young) kids can follow along with what I'm doing (I wouldn't go so far as to expect them to be able to do it, but it needs to be close enough that they won't get bored; so `blender` is probably not suitable).


Centos: Adduser/Passwd/Sudoer Script

I'm currently running a VPS on CentOS. I have an application running in the background and it will run a script under `sudo` to either disable or enable any account. So what I'm trying to create is a script that creates an account, adds a password and adds the users under "etc/sudoers". The script is being run as root so there shouldn't be any permission errors. How would I come to create this script?


Debian update fails with "Raid version incompatible"

While installing proftpd, it dropped with following error:               [....] Starting ftp server: proftpdhexadecacordis proftpd[26849]: mod_tls_memcache/0.1: notice: unable to register 'memcache' SSL session cache: Memcache support not enabled     . ok      Setting up proftpd-mod-vroot (0.9.2-2+b2) ...     Errors were encountered while processing:      linux-image-3.2.0-4-amd64     E: Sub-process /usr/bin/dpkg returned an error code (1)      I first did not notice `linux-image-3.2.0-4-amd64` error, so I tried to set up libmemcache, and it dropped with same error. So, I ran an upgrade, and everything updated, except following. So I ran it again, to display clear view of error:               # apt-get upgrade     Reading package lists... Done     Building dependency tree            Reading state information... Done     The following packages have been kept back:       xserver-xorg-input-all     0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.     1 not fully installed or removed.     After this operation, 0 B of additional disk space will be used.     Do you want to continue [Y/n]? y     Setting up linux-image-3.2.0-4-amd64 (3.2.46-1+deb7u1) ...     Running depmod.     Examining /etc/kernel/postinst.d.     run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64     update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64     run-parts: executing /etc/kernel/postinst.d/pm-utils 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64     run-parts: executing /etc/kernel/postinst.d/zz-runlilo 3.2.0-4-amd64 /boot/vmlinuz-3.2.0-4-amd64     Warning: LBA32 addressing assumed     Fatal: Incompatible Raid version information on /dev/md0   (RV=0.90 GAI=1.2)     run-parts: /etc/kernel/postinst.d/zz-runlilo exited with return code 1     Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.2.0-4-amd64.postinst line 696.     dpkg: error processing linux-image-3.2.0-4-amd64 (--configure):      subprocess installed post-installation script returned error exit status 1     Errors were encountered while processing:      linux-image-3.2.0-4-amd64     E: Sub-process /usr/bin/dpkg returned an error code (1)      I can't find any solution connected with "Incompatible Raid version information". I'm newbie in debian server administration, so please, explain me in basic english how to solve this problem.


xterm cygwin setting vtfonts -> truetype fonts, utf8-encoding, utf8-fonts set by default

I'm using cygwin and cygwin X server, I'm having a problem with xterm. Every time I start it I have to set its parameters via the menu. Is there a way to make them set to true by default? I found a file named `/etc/X11/app-defaults/XTerm` which I believe should be used to put default settings to XTerm, but I can't find correct parameters names and values.


Remapping both Caps Lock and Shift+Caps Lock in xkb

I am trying to configure xkb such that Caps Lock is mapped to the Compose key and Shift+Caps Lock functions as the traditional Caps Lock. I put the following in a new file called `/usr/share/X11/xkb/symbols/gdwatson`:               partial modifier keys     xkb_symbols "compose" {         key <CAPS> {             type[Group1] = "TWO_LEVEL",             symbols[Group1] = [ Multi_key, Caps_Lock ]         };     };      Then I ran `setxkbmap -symbols 'pc+us+gdwatson(compose)'`, which completed successfully. Caps Lock works as Compose, but Shift+Caps Lock works as Compose instead of Caps Lock. `xkbcomp :0.0` reveals the following:               key <CAPS> {         type= "TWO_LEVEL",         symbols[Group1]= [       Multi_key,       Multi_key ]     };      The second level symbol mapping is duplicating the first for some reason, rather than the separate value I tried to give it. Does anyone have strong enough xkb-fu to tell me what I've done wrong or how to fix it?


Generic notification framework/API

I'm looking for a specific functionality/piece of software, and I'm wondering if anyone can help me find it. I administer a fairly large number of servers and run some long-term jobs on some of them (system ones, php, bash, perl scripts, etc) I'm looking for something like a cross between libnotify (in that it uses DBUS/programmes hook into it and there's a notification daemon), and google's re-imagined unified notification system. Ideally it wouldn't require re-writing everything and would intercept notifications (even on headless servers) and then handle them per a user's configuration options. These would probably be sent to some centralised location and dispatched to email/chat/text message/libnotify popup. Bonus points if it handles the case for   * If I'm listed as "available" on a certain computer, it'll send notifications there, and email   * Otherwise it will failover down a list of `write`ing to my logged in terminals on that computer (like broadcast shutdown messages), IMing me, text mesasging me.   * All will send an email just in case.


Emulate unplugging a network cable with qemu-kvm

_[Background: I'd like to actually testHow to take down a static network interface when not connected? ]_ I'm setting up a QEMU-KVM virtual machine using libvirt (via `virt-manager`). I put two NICs on it (both virtio). They are bridged to a physical NIC on the host. I want to test what NetworkManager does when I "unplug" one. But there isn't button/checkbox for that in virt-manager, nor a quick Google search turn up anything. How do I emulate unplugging the network cable?


Auto mount USB devices on debian?

This isn't a big deal i was just curious so if anyone happens to know why then great. I'm not sure if usbmount is the tool as which usbmount doesn't show anything but on my debian system (no graphics) when i plugin my usb and load it in vmware i see               [sdb] Assuming drive cache: write through      I don't see it in `/media` nor `/mnt`. Using the same install CD i can install the graphic version and when i plug in the usb the same way it shows up in `/media`. Does anyone know why? I figured either nothing would happen or it would show up when i plugged it in. Now i get the msg so its like something in between.


Linux on Hard Drive Partition, Bootloader on USB Flash Drive

How can I use a USB flash drive to boot Linux from a partition on (another) hard drive? I'm trying to install Linux on an encrypted partition on the hard drive (using LVM on LUKS). Since `/boot` must be on a separate, unencrypted partition, I would like to store it on a USB flash drive. My plan was to install GRUB (2) to the flash drive (`/dev/sdb`) and boot Linux from it's MBR, or if the drive was unplugged simply boot Windows from the hard drive's (`/dev/sda`) MBR. * * * I installed GRUB (2) to `/dev/sdb`, but when I tried to boot from the flash drive I got the following message: > Grub Loading After a couple of seconds I got an additional message: > Read Error For testing purposes, I tried to delete the contents of `/boot`, and I got the same message after booting again from the flash drive. * * * **PARTITIONING DETAILS** `/dev/sda` (Hard Drive):               MBR: Windows Bootloader     /dev/sda1 - Windows System Partition     /dev/sda2 - Windows Boot Partition     /dev/sda3 - Windows Data Partition     /dev/sda4 - Linux partition      `/dev/sdb` (USB Flash Drive):               MBR: GRUB     /dev/sdb1 - Linux /boot Partition      * * * **GRUB DETAILS** `/etc/default/grub`:               GRUB_CMDLINE_LINUX="cryptdevice=/dev/disk/by-uuid/$SDA4_UUID:vg root=/dev/mapper/vg-root resume=/dev/mapper/vg-swap cryptkey=/dev/disk/by-uuid/$SDB1_UUID:ext2:/key"     ..     GRUB_DISABLE_LINUX_UUID=true      **Installation command**               grub-install --target=i386-pc --recheck /dev/sdb      I'm using Arch Linux.


command line tool to set time zone

In Centos 5.x there is the text mode interface of system-config-date to set the time zone. Although that utility still exists in Centos 6 the text mode is gone. Is there anything similar in Centos 6?


What is the recommended way of start and supervise daemons on Arch Linux?

> **Possible Duplicate:**   >  Ensure a process is always running At the moment I use a quick and dirty `nohup ... &` to start application and database servers. E.g.               su - foo -c "nohup php-cgi -b 8888 &"      This approach has obvious disadvantages of not starting my service at boot, not restarting the service and/or notifying me if it crashes, not automatically starting dependent daemons, having to `ps` to look for PID to kill etc. I found `upstart` but it seems to break the `rc.d` so I have to reconfigure all system-wide daemons such as `sshd`, `syslog-ng` etc to use it. Is there a non-intrusive alternative to `upstart` that works well with arch linux, coexists with existing `rc.d` scripts, supports running daemons under specific users and respawns them if they die? A support for dependencies and notifications on a respawn is a plus but is not required. Of course I can write a rather simple shell script myself and plug it into `rc.d`, but are there any de facto standard well-tested solutions besides `rc.d` which doesn't provide respawning? UPD: I found `monit`. Is it any good, and are there any better solutions?


Building a process Watchdog

I intend to write a process watchdog that runs out of cron or similar that watches all of the core processes denoting things like run state, VMstat, Inet operations and reports it to a file or external host. If a process dies that is deemed core it restarts it. Is an already written watchdog existent that can address my needs?


Can I limit a user (and their apps) to one network interface?

As the title really. I've actually got two scenarios to apply this:   1. Multiseat Desktop: two network connections both with internet gateways and two accounts doing bandwidth-intensive tasks on each. I want to split them up so one account only uses eth0 and the second account only uses eth1.   2. Server: I have two IPs on a server and I want to make sure the mail user only sends email from the second IP (eth0:1 alias) The second can probably be IPTabled (I just don't know how) to route email traffic through that interface but the first will be dealing with all sorts of traffic so needs to be user-based. If there is a user-based solution, I could apply this in both places.


How to record my full screen with audio?

If I want to record my desktop, I use:               ffmpeg -f x11grab -s `xdpyinfo | grep -i dimensions: | sed 's/[^0-9]*pixels.*(.*).*//' | sed 's/[^0-9x]*//'` -r 25 -i :0.0 -sameq valami.avi      But it doesn't save any audio -- how can I include sound with the video? Extra: How can I set on-the-fly encoding like with x264 + mp3:128kbit?


**/ not working with a mounted volume

I'm trying to recursively extract a set of .jpgs from a mounted volume using SMB1, to a folder on my computer. Here's what I've got:               cp -a **/97*.jpg /Users/.../All_Covers      This works as long as my current directory, and the images, are somewhere on my computer, but as soon as I `cd` to the mounted volume where the directories holding the actual images are, it fails, giving me a:               cp: **/97*.jpg: No such file or directory      Why is this failing? Is there a workaround?


How to search all subdirectories and their subdirectories for the occurence of a word using grep?

> **Possible Duplicate:**   >  Searching for string in files Suppose I have a directory called Home and it is my current directory. And in this home directory I have many other directories directory1, directory2, etc. How do I do a grep to find the occurrence of a word (say "AXN") in any of the files in all of these subdirectories (and their subdirectories?)


How use minimum number of commands to copy all .txt files from all subdirectories to one directory?

I have more than 90 subdirectories and inside each one, there will be a number of .txt files. What I need to do is to copy all those txt files out to one single directory. How can I do that?


Apache configuration with proxy and location

I want to map these domains to these ports. How can I do it?               http://test1.example.com/phpmyadmin/    example.com:80/phpmyadmin/     http://test1.example.com/app1/          example.com:8080/app1/     http://test1.example.com/app2/          example.com:8090/app2/          http://webmin.example.com/              example.com:10000/      This is what I did. The problem is, `phpmyadmin` is not working. It is forwarded to `glassfish`. `webmin` is working because it is a seperate domain. How can I map `phpmyadmin` to the same domain? http://test1.example.com/phpmyadmin/               <VirtualHost *:80>         ServerName              test1.example.com         ProxyRequests           Off         ProxyPreserveHost       On              <Proxy *>           Order deny,allow           Allow from all         </Proxy>              ProxyPass           /           http://localhost:8080/         ProxyPassReverse    /           http://localhost:8080/              ProxyPass           /admin/     https://localhost:4848/         ProxyPassReverse    /admin/     https://localhost:4848/     </VirtualHost>          <VirtualHost *:80>         ServerName      test1.example.com/phpmyadmin/         DocumentRoot    /usr/share/phpmyadmin              Alias           /phpmyadmin     /usr/share/phpmyadmin         Alias           /mysql          /usr/share/phpmyadmin     </VirtualHost>          <VirtualHost *:80>         ServerName              webmin.example.com         ProxyRequests           Off         ProxyPreserveHost       On              <Proxy *>           Order deny,allow           Allow from all         </Proxy>              ProxyPass           /               http://localhost:10000/         ProxyPassReverse    /               http://localhost:10000/     </VirtualHost>


Is there a xterm equivalent that is optimized for use over VNC?

**tl;dr** Is there a terminal emulator that uses rectangular copies for scrolling? * * * I'm doing a lot over work over the internet just now (hacking a program on my employer's cluster that can't be installed on my laptop), and that has caused some changes in my workflow. Getting a ssh tunnel with X support through the firewall to the cluster is no problem, then I have a choice.   1. **Open a couple of remote xterms and emacs and go to work directly** This is simple, but I lose all my working state anytime I disconnect from the network. Having a hairtrigger `C-x C-s` reflex means that I don't lose any edits, but I have to manage the lifetime of long jobs with `nohup` or `disown`, and there is fair amount of setup to do every time I log back in (even after writing a couple of scripts to cover the invariant parts of the setup).   2. **Run vncserver to give myself a persistent desktop** Seems like the perfect solution to the troubles of the direct connection, but over moderate speed connections my plain-ole' xterms seem to take inordinately log to update. Watching them it doesn't seem like they are doing rectangular copies which VNC is good at (indeed it is faster to drag filled in windows around the desktop than frames). So I find myself wondering if things wouldn't be faster on a terminal emulator that uses rectangular copies for scrolling? * * * _Aside:_ X is necessary as the product I'm working on uses it for display.


Cannot forward when going through welcome screen for fedora 15

I just installed fedora 15 on my laptop, but I have problem get it working. My current situation is that when the installation is done, it reboots and gives me a welcome screen. I setup username as usual, but when it comes to the "date and time" screen, it won't let me proceed any further. I press "forward" button but nothing happens. Does anybody has this same issue? How did you solve that? Thanks.


How to enable cups-lpd / port 515?

I have a print server using CUPS on a CentOS 5.3 box. On my PC, I set up a remote printer with the URI http://$PRINT_SERVER:631/printers/$PRINTER_NAME, and have successfully been able to print files to it. There is another system, which my team does not have control over, that sends all of its print requests using LPD on port 515. I need to handle this somehow. I installed the cups-lpd package and edited the /etc/xinetd.d/cups- lpd file to enable it (or so I thought):               ~$ cat /etc/xinetd.d/cups-lpd     service printer     {             socket_type = stream             protocol = tcp             port = 515             wait = no             user = lp             group = sys             passenv =             server = /usr/libexec/cups/daemon/cups-lpd             server_args = -o document-format=application/octet-stream             disable = no     }      But as far as the other computers on the network are concerned, port 515 is closed:               Starting Nmap 5.51 ( http://nmap.org ) at 2011-09-02 16:41 Central Daylight Time          Nmap scan report for [IP address]     Host is up (0.028s latency).     Not shown: 995 closed ports     PORT     STATE SERVICE     514/tcp  open  shell     631/tcp  open  ipp     1066/tcp open  fpo-fns     1067/tcp open  instl_boots     6000/tcp open  X11          Nmap done: 1 IP address (1 host up) scanned in 0.52 seconds      Is there something else I need to change in the xinetd configuration to enable the LPD port?


editing /etc/init.d/rc.local to run after login tty processes

doing a `ps-e`, I see the following on startup:               PID  TTY CMD     ...     1880 ?   my_auto_script     1881 tty1 login     1882 tty2 getty          ...      `my_auto_script` is called from `/etc/rc.local`. I have `/etc/init.d/rc.local` configured as such:               Required-Start: $all     Default-Start: 2 3 4 5      so this should run last. But it doesn't seem able to run after any `tty` processes. This is what I need. How do I make this work?


startxwin: command not found

I am trying to enable X11 forwarding on my cygwin.. And I was following this tutorial. Whenever I do `startxwin`, I always get this error -               root@ubuntu-dyn-cassandra-50686:~# startxwin     startxwin: command not found      Any thoughts?


Intermittent ssh denial

The main server in my network (nothing less...) plays tricks with its ssh connectivity. It is a CentOS 6.4/64 (runs as KVM-based virtualization host with a dozen VMs on it). It receives its IP via DHCP with fixed assignment. Its /etc/resolv.conf seems just fine, as well as its network co It would normally work, allowing me to ssh into it and being logged in, I'm able to see the internet, ping external servers etc. **But intermittently, it will deny ssh access.**   * If pinged from the LAN, it is there; also nmap or opening a socket via bash against port 22, it is there.    * Pinged from outside it won't respond. Currently open ssh sessions stay connected (but now they cannot see the internet nor ping me back).    * The VMs on top of it continue working perfectly, no issues there, all have public IPs and use bridges as per KVM best practices...(afaik).   * Not a single trace in the log about what can be going wrong with it.   * I consider the network to be healthy.   * Modified the sysctl.conf to set net.ipv4.tcp_keepalive_time=120 to no avail. Then, all of a sudden, it will come back to life and work as if nothing has happened (but it may take up to 10 may be 20 minutes to reappear... - not good for a critical component...) No iptables in the way (disabled). Any hints about how to troubleshoot this ? (This could be a duplicate of SSH getting disrupted intermittently but conditions look somewhat different).


How do I use dhcpcd in openwrt instead of udhcpc?

I'm trying to determine the reason my router is not syncing up to my ISP, I do suspect snafu on their end so I'm trying to replicate my desktops setup which includes using dhcpcd. Problem is I don't know how to tell OpenWRT to use that after I've installed it on OpenWRT. Can anyone tell me the steps to install and configure dhcpcd for WAN on OpenWRT? I'm using backfire 10.03 on a WRT54GL.


Keep track of all files accessed by a specific process?

There has recently been a (publicly unconfirmed) report that Skype is accessing files that it shouldn't be, without user intervention. I have no idea if this is the case with Skype on linux, but it would be good to be able to find out. Is there a way to keep track of all files accessed by a specific process?


Trying to understand uboot image copying

The following is snippet from `u-boot-xarm/include/configs/zynq_zc702.h`               "qspiboot=echo Copying Linux from QSPI flash to RAM...; \                     cp 0xFC100000 0x8000 ${kernel_size}; \                     cp 0xFC600000 0x1000000 0x8000; \                     echo Copying ramdisk...; \                     cp 0xFC800000 0x800000 ${ramdisk_size};\                     ping 10.10.70.101;\                     go 0x8000\0" \      Can somebody explain what is happening in these two lines:                                   cp 0xFC100000 0x8000 ${kernel_size}; \                         cp 0xFC600000 0x1000000 0x8000; \      How these addresses are chosen? And why so many addresses?


Does hexdump respect the endianness of its system?

On my machine I get the following output when I run these commands:               $ echo foos > myfile     $ hexdump myfile     6f66 736f 000a      The output from hexdump is little-endian. Does this mean that my machine is little-endian, or does hexdump always use little-endian format?


How do I use new fdisk table without reboot (kpartx)?

When I run fdisk and change the size of a partition, fdisk says at the end of its output:               The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8)      I'd like to do so without having to reboot (and then write a script that does it) How do I use kpartx to do this correctly? I've tried:               kpartx -f -v /dev/mmcblk0      Which outputs:               mmcblk0p1 : 0 102400 /dev/mmcblk0 2048     mmcblk0p2 : 0 7657472 /dev/mmcblk0 104448      and:               kpartx -a -v /dev/mmcblk0      which outputs:               device-mapper: reload ioctl on mmcblk0p1 failed: Invalid argument     create/reload failed on mmcblk0p1     add map mmcblk0p1 (0:0): 0 102400 linear /dev/mmcblk0 2048     device-mapper: reload ioctl on mmcblk0p2 failed: Invalid argument     create/reload failed on mmcblk0p2     add map mmcblk0p2 (0:0): 0 7657472 linear /dev/mmcblk0 104448      This is for an SD card in a raspi running debian. EDIT: To clarify what I am trying to do; I am deleting an unused p3 from an SD Card and resizing p2 to fill the card. The card currently contains a small boot partition p1 and p2 is where the OS sits.


Is there a way for linux to pick up the phone?

I know that there is a way to make Linux dial out using a modem. Is there a way to program Linux (using a library/device) to   1. pick up the modem (record phone calls) etc?   2. see caller id?


How can I observe memory bandwidth?

I have an embedded Linux ARM system that is showing significantly less throughput than expected on both Ethernet and USB. I suspect the memory may be contributing. Is there a way to observe the memory bandwidth that is consumed while running a throughput test on the Ethernet or USB?


Recursively find and move corrupted PDFs

### The Issue I was using `python-skydrive` to download files to my PC, and I accidentally corrupted a good amount of my PDF files. When I try to view them in Document Viewer, I get the following error message: > File type plain text document (text/plain) is not supported                $file ny.pdf      $ny.pdf      ### My Request I'm looking for a command line tool or snippet that will allow me to recursively find PDF files in a folder and its subfolders, and then move corrupted files to a designated folder. I'm using Ubuntu 13.10 on an x64 PC.


Problems installing Linux Mint

I tried to install Linux Mint 15 on my PC using a bootable USB. I had partitioned a drive on windows for the linux. But while installing from the bootable, I cannot see the partition. I am afraid I will lose my data, if I go ahead without seeing the partition.


How to download videos from Coursera with curl?

Downloading videos from Coursera is not as easy as copy and pasting the link in terminal. I also have tried exporting cookies from my browser in `cookie.txt` file and doing a:               curl --cookie cookie.txt "https://class.coursera.org/comnetworks-2012-001/lecture/download.mp4?lecture_id=37"      as suggested in this question but that produces a file named `download.mp4?lecture_id=37` with nothing in it. Can somebody tell me how can I download those video lectures? because downloading them with browser is a risk (I have a slow connection and if by chance if some error occurs my too much time is wasted in re-downloading it).


VIM substitute occurrences of pattern after a particular word in a line

I have such lines in my text. > text before pattern = garbage** text after pattern is pattern If in VIM I do `%s/pattern/saturn/` it replaces all occurrences of `pattern`. But I only want to replace those occurrences that come after `=`. It should ignore everything in the line that occurs before `=`. How to do that?


Can a shell script running in a ssh continue to run if the SSH instance closes?

I'm trying to write a shell script that does a lengthy batch job on a remote server. I'll be running the script over SSH. The thing is, I intend to start the script in the evening and collect the results the next morning; I'd prefer not to have my local computer have to run all night, as it's not needed as part of the batch process. As such, is there a way I can close the SSH connection and still have the shell script continue to run on the remote server?


Difficulty with mobile broadband device being recognized (registered as CD ROM)

I am running **_Ubuntu 10.04 LTS_** on a **Samsung n150 netbook**. I have bought a **vodafone** pay-as-you-go mobile broadband dongle. It is a **_Huawei_** device. I have ***usb_modeswitch*** installed. I installed **_betavine_** from betavineUbuntuLink. The program loads but displays that no device is detected. I tried to use **_Sakis3G_** from sakis3Glink, using both the free and full versions, and all I get is a message that it failed to connect. I tried to create the mobile broadband connection by right clicking the connection manager and setting it up from there but the connection is never registered or displayed. When the computer is booted with the usb dongle it shows on the desktop as a mounted device, and when unmounted and re-inserted it does not appear on the desktop again, but does appear in **_Places_** as `VMB_10.2.102.30707_RP171`. This usb dongle did not come with a CD for installation on Windows. In Windows, the software installed automatically from the usb device. So I believe that a further complication with this relatively new device is that it gets loaded as a CD. I tried a method of going to `gconf-editor` to uncheck the automount and autorun and see if the usb switching will work there after (I did a reboot), but this did not help. When I boot the computer with the dongle it is shown on the **_desktop_** and **_places_**. When it is removed and re-inserted it shows up in places only. A green light flashes and occasionally a blue one as well. I ran `lsusb` after removing and re-inserting the usb dongle, which shows that the device is found:               alex@alex-laptop:~/programFiles/MATLAB/bin$ lsusb     Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 003 Device 002: ID 0a5c:219c Broadcom Corp.      Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 008: ID 12d1:14d1 Huawei Technologies Co., Ltd.      Bus 001 Device 005: ID 0ac8:c33f Z-Star Microelectronics Corp.      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub      I then ran `dmesg | tail` to get the last kernel reports:               alex@alex-laptop:~/programFiles/MATLAB/bin$ dmesg|tail     [14373.720099] usb 1-7: new high speed USB device using ehci_hcd and address 8     [14373.997592] usb 1-7: configuration #1 chosen from 1 choice     [14374.182751] scsi6 : SCSI emulation for USB Mass Storage devices     14374.184812] usb-storage: device found at 8     [14374.184825] usb-storage: waiting for device to settle before scanning     [14379.184566] usb-storage: device scan complete     [14379.185273] scsi 6:0:0:0: CD-ROM            Vodafone CD ROM (Huawei)  2.31 PQ: 0 ANSI: 2     [14379.197689] sr0: scsi-1 drive     [14379.197986] sr 6:0:0:0: Attached scsi CD-ROM sr0     [14379.198192] sr 6:0:0:0: Attached scsi generic sg1 type 5     alex@alex-laptop:~/programFiles/MATLAB/bin$       It can be seen how the usb dongle device gets seen as a "Vodafone CD ROM (Huawei)" which I assume is the root of the troubles for `betavine` and `sakis3g`. I believe that the usual scenario is of seeing it as a drive and switching to broadband device and not as CD ROM and making that a mobile broadband device, but I could be wrong. Is there a course of action to be recommended to get this to work? Are there any alternative tests to perform to diagnose the exact problem? UPDATE: on the back of the usb modem it says "Model: K3770, HSPA USB Stick, FCC ID: QISK3770" UPDATE 2: On Ubuntuforums I found a thread, link to Unbuntu forum, and a post by foxy123 contained critical information. "Enter the APN as SMART. You'll also need a username and password. Both username and password are: web" Using **sakis3g** , and setting the extra options with this information assisted the final operation. This was done after following the post of ManWe.


Firefox 3.6 end of life when?

When will be Firefox 3.6 end of lifetime?


FreeNAS versus a regular (CentOS/Ubuntu) linux server?

I'm looking to build a medium sized (6TB, mini ITX board) server for personal use. Most importantly, it will serve as a seedbox and will store a whole lot of data. I will be accessing the data over my home network on a regular basis. I was looking around to decide which OS to use and fell upon FreeNAS. It looks pretty cool, but I was wondering if it would be able to do everything a regular server distro could do (package manager, easy updating, web server, etc). Is FreeNAS really only good for an actual NAS setup and not a server? (Bonus points if you also include FreeBSD as a possible server OS).


Is there any way to have console (rogue) mode programs take over only part of the terminal screen?

I like the command line because it preserves the context of what I'm doing. But if I use a "rogue" mode program like `vi` or `less`, the whole screen gets taken over. Is a middle way possible, where the console mode program takes over only half the screen (above or below the shell part)? I'm borrowing the term "rogue" from Eric Raymond: > Roguelike programs are designed to be run on a system console, an X terminal > emulator, or a video display terminal. They use the full screen and support > a visual interface style, but with character-cell display rather than > graphics and a mouse. I already use tmux and GNU screen to split the terminal into panes, but I'm looking for a way to stay in one shell session.


Help with OS choice for High Performance Computing

I have been using Ubuntu 10.04 for 2 years now and honestly, I am somewhat bored of Linux and wish to explore Unix (or Unix Like) now. I don't want a dumbed down version (like Ubuntu) anymore and want to experience Unix (or Linux if need be) in its true form. I basically want more to do with terminal and exploiting the open source nature of the OS. My requirements are plainly   1. No dumbing down. I'll take a few shots in my knee if necessary.   2. Awesome interface from parallel/high performance programming. I use Intel MKL on a daily basis. I use the computer ONLY for programming. So, all else (Flash support, Firefox blah blah) is useless.   3. It should be extremely extremely stable. (Debian like)   4. It should have good community support and long term support. I don't like changing OSes every 6 months. What would you suggest? (I have tried to make this question as objective as possible. Please don't give me a "depends" answer. Just throw a name if need be) NetBSD vs FreeBSD vs OpenBSD vs Other Unix/UnixLike vs Linux (I would really want to try a BSD/Unix now but then, if my requirements aren't met, I don't mind a Linux) P.S: I am **not** a N00B. I have tried Ubuntu, Debian, Fedora & RHEL but not long enough to make an informed choice.


How to make svn look for if there is an update once a minute and if there is call some script?

I am developing a server app. I have a remote machine with Debian that I use for testing. Currently I update the server manually when each new svn version comes out. It is just a testing server and traffic on it is free for me. I created a simple script that downloads the latest svn (`HEAD`) revision and recompiles my server. I wonder if it is possible to create a .sh script (Debian compatible) that a normal user (not SU) would be able to start with something like `nohup ./superScript.sh >& /dev/null &` and which would once a minute look into some SVN, find out current version and, if there was an update, run commands like:               kill `ps aux | grep -F 'ServerAPP' | grep -v -F 'grep' | awk '{ print $2 }'`      ./server_automated_net_setup.sh     cd server/install-dir/     export LD_LIBRARY_PATH=./:~/server/install-dir/lib_boost:~/server/install-dir/lib_openSSL     nohup ./ServerAPP >& /dev/null &      that would kill the currently running app, run some auto-update script we already have in the user's home (`~`) and run it again. Is it possible to create such a script and how do I do it?


What is the simplest method to redirect traffic using either a proxy or iptables?

I need to redirect all incoming traffic on port 7777 to a specific destination_ip:port. I have about 40 Litecoin (scrypt) mining rigs that I have to manually reconfigure each time I'd like to switch coins or pools. Instead I would like to be able to just modify the destination address on my proxy box to direct the farm. I am currently using Dante proxy which has a redirect module available that looks perfect. I don't have $400 to spend on that module however. Also, Dante seems to take up huge amounts of memory for every connection. Also, instead of using a proxy, I tried using iptables as a solution but received an error:               root@xx:~# iptables -t nat -A PREROUTING -p tcp -d x.x.x.x --dport 7777 -j DNAT --to x.x.x.x:7777     root@xx:~# iptables -t nat -A POSTROUTING -d x.x.x.x -j MASQUERADE     iptables: No chain/target/match by that name.      I could not get that to work nor am I sure if that would even be a solution to what I'm after. Any ideas on how to best achieve my desired result would be great!


Why do 'ssh host echo $PATH' and printing the $PATH after ssh'ing into the machine give different results?

On a particular host, when I ssh into the machine and enter `echo $PATH` I get               /home/wxy/bin64:/home/wxy/bin:/usr/kerberos/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin      and if I execute `ssh host 'echo $PATH'` I see this:               /usr/local/bin:/bin:/usr/bin      Why is this discrepancy? Also what can I do if I wanted to see the former result using the latter command?


Networking between two Virtual machines on different hosts

I have openSuse installed as a virtual machine(Oracle Virtual Box) on DeskTop(win 7), and another openSuse installed on as a virtual machine(Oracle Virtual Box) on my Laptop(win 8.1). Please see the attached image, in which I have captured the various network adapter information. I want to network these two VMs, please guide me in the right direction as how to achieve this. The following is the additional information that may enable you to guide me. Desktop Host machine(win 7)               C:\Users\Adofo>ipconfig     Windows IP Configuration     Ethernet adapter Local Area Connection:      Connection-specific DNS Suffix  . : domain.invalid      Link-local IPv6 Address . . . . . : fe80::bd2b:ef06:53ea:740b%11      IPv4 Address. . . . . . . . . . . : 192.168.0.108      Subnet Mask . . . . . . . . . . . : 255.255.255.0      Default Gateway . . . . . . . . . : 192.168.0.1          Ethernet adapter VirtualBox Host-Only Network:      Connection-specific DNS Suffix  . :      Link-local IPv6 Address . . . . . : fe80::35d5:acd3:5f50:fc20%18      Autoconfiguration IPv4 Address. . : 169.254.252.32      Subnet Mask . . . . . . . . . . . : 255.255.0.0      Default Gateway . . . . . . . . . :          Tunnel adapter Teredo Tunneling Pseudo-Interface:      Media State . . . . . . . . . . . : Media disconnected      Connection-specific DNS Suffix  . :          Tunnel adapter isatap.{DB8941A3-825F-4824-B421-6E1625173A6E}:      Media State . . . . . . . . . . . : Media disconnected      Connection-specific DNS Suffix  . :          Tunnel adapter isatap.domain.invalid:       Media State . . . . . . . . . . . : Media disconnected       Connection-specific DNS Suffix  . :      OpenSuse 12.3 on Virtual Machine: (VirtualBox installed on Desktop, Windows 7)               linux-gn77:~ # ifconfig     eth0      Link encap:Ethernet  HWaddr 08:00:27:08:FF:6C             inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0           inet6 addr: fe80::a00:27ff:fe08:ff6c/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:2 errors:0 dropped:0 overruns:0 frame:0           TX packets:43 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:1180 (1.1 Kb)  TX bytes:9748 (9.5 Kb)          lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:52 errors:0 dropped:0 overruns:0 frame:0           TX packets:52 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:4891 (4.7 Kb)  TX bytes:4891 (4.7 Kb)      Laptop: Windows8.1 Host C:\Users\Harbir PC>ipconfig Windows IP Configuration               Ethernet adapter Bluetooth Network Connection:      Media State . . . . . . . . . . . : Media disconnected      Connection-specific DNS Suffix  . :     Wireless LAN adapter Local Area Connection* 2:      Media State . . . . . . . . . . . : Media disconnected      Connection-specific DNS Suffix  . :     Wireless LAN adapter Wi-Fi:     Connection-specific DNS Suffix  . : domain.invalid     Link-local IPv6 Address . . . . . : fe80::555b:6b6a:18c5:9326%3     IPv4 Address. . . . . . . . . . . : 192.168.0.106     Subnet Mask . . . . . . . . . . . : 255.255.255.0     Default Gateway . . . . . . . . . : 192.168.0.1     Ethernet adapter VirtualBox Host-Only Network:     Connection-specific DNS Suffix  . :     Link-local IPv6 Address . . . . . : fe80::a0d1:2b1d:ba1c:9158%26     IPv4 Address. . . . . . . . . . . : 192.168.56.1     Subnet Mask . . . . . . . . . . . : 255.255.255.0     Default Gateway . . . . . . . . . :     Tunnel adapter isatap.{AB29F882-C104-4E87-BB48-3C1DDD3136B9}:      Media State . . . . . . . . . . . : Media disconnected      Connection-specific DNS Suffix  . :     Tunnel adapter isatap.domain.invalid:      Media State . . . . . . . . . . . : Media disconnected      Connection-specific DNS Suffix  . :      OpenSuse 12.3 on Virtual Machine: (VirtualBox installed on Laptop, Windows 8.1)               linux-gn77:~/line/client1 # ifconfig     eth0      Link encap:Ethernet  HWaddr 08:00:27:41:7A:77            inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0           inet6 addr: fe80::a00:27ff:fe41:7a77/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:57266 errors:0 dropped:0 overruns:0 frame:0           TX packets:31879 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           RX bytes:77472539 (73.8 Mb)  TX bytes:2640470 (2.5 Mb)        lo        Link encap:Local Loopback            inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:113 errors:0 dropped:0 overruns:0 frame:0           TX packets:113 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0           RX bytes:5861 (5.7 Kb)  TX bytes:5861 (5.7 Kb)      ![enter image description here](http://i.stack.imgur.com/JHTvS.png)


What is the space overhead of different filesystems?

I backed up/restored a filesystem from a Ubuntu system to a Fedora 17 one. I noticed that according to `df` output the used space increased by 30 %. What could be the reasons for this? At the Fedora system `df` displays: 78 GB used At the Ubuntu system `df` displays: 60 GB used Differences between the systems: Ubuntu: ext3 (created years ago) Fedora 17: ext4 (created with a vanilla `mkfs.ext4` call) Restoring to an XFS filesystem (on Fedora 17) yields 78 GB used space. Backup and restore was done with GNU tar. The filesystem contains a wide range of different sorts of files (i.e. from source trees, maildirs to ISO's etc.).


How do I find a bunch of files with a string in its filename (or body text) and then move all those files to a specific folder?

Say - what if I wanted to move every HTML file in several independent directories with the word "heavengames" in its filename (and as a second question, every HTML files with the word "heavengames" in its body text) to a new directory named "heavengames-threads"?


Fedora 17 boot hangs after changing to CDM

I am running the stock Xfce spin of Fedora 17 in a VirtualBox virtual machine, and just installed the CDM display manager via yum. I modified the /etc/cdmrc file to start xfce, and added the following to /etc/sysconfig/desktop: > DISPLAYMANAGER=/usr/bin/cdm However, upon reboot the process hangs right after the Fedora logo appears with this: > Cannot open font file True Can anyone help me diagnose and troubleshoot this problem? Thank you very much!


How to set up two-factor authentication with OTP on FreeBSD?

I have a FreeBSD hosted server that I like to be able to get to from anywhere. Normally I use SSH publickey to log in, or if I don't have my SSH private key available then I might use regular password over SSH. However, when logging in from an untrusted machine there's always the risk of a keylogger capturing my password as I type it. FreeBSD already has support for OPIE which is a one-time password scheme. This works great, but the one-time password is the _only_ authentication needed. If I print out a list of one-time passwords to use later, then if I lose that list then that's all somebody needs. I'd like to set up the authentication so that I need a one-time password _plus_ something I know (a password, except not my usual login password). I have a feeling the answer has something to do with PAM (and `/etc/pam.d/sshd`) but I'm not certain on the details. How can I set up authentication where two methods are required?


Caching bugzilla webpages for offline use

I have a long wifi free journey ahead of me and I would like to continue to productively review bugs even without the ability to change them. Is there an easy way to cache all the pages generated from the query below? https://bugzilla.gnome.org/buglist.cgi?product=banshee&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_severity=blocker&bug_severity=critical&bug_severity=major&bug_severity=normal&bug_severity=minor&bug_severity=trivial&gnome_version=


What is the significance of the "wheel" group?

I've commonly seen references to a `wheel` user group online as well as when setting up my `sudoers` file. Does naming a group `wheel` imply something special about the group or is it just a name for a generic group used in the same manner that `foo` and `bar` are thrown about?


Is nohup indefinite?

If I run a program with an infinite loop with `nohup`, will the program run indefinitely (until the machine is reset or until I manually terminate it)?


Installed Fedora in dual boot Windows desktop. Now I can't get full monitor resolution with my AMD Radeon HD 6450

I have a 1900x1080 resolution monitor, and after installing Fedora to create a dual boot machine, the maximum resolution Fedora 14 (previously only Windows 7 was installed) can achieve is 1280x1024. Why is this the case? How do I figure out what to do to get full native resolution on my monitor in Fedora?


How do I install mplayer from a terminal?

I need a command to run on Linux to install mplayer. I'm not finding the command anywhere, and when I try to use the `zypper` command to install mplayer it tells me I am not a sudoer. What should I do?


Google Hangouts with dual monitor and GNOME Shell

I have a laptop with a built-in screen and an attached monitor. When I start a Google's video Hangout and share my desktop, I would like to be able to share only the attached screen, but I don't know how. Right now I have two monitors: `LVDS1` corresponds to my laptop's screen, which is configured as the secondary screen and `DP1` which is my primary screen. But the problem still remains if I change my laptop's screen to be the primary screen.               $ xrandr     Screen 0: minimum 320 x 200, current 3286 x 1468, maximum 8192 x 8192     LVDS1 connected 1366x768+1920+700 (normal left inverted right x axis y axis) 344mm x 194mm        1366x768      60.06*+        1024x768      60.00          800x600       60.32    56.25          640x480       59.94       VGA1 disconnected (normal left inverted right x axis y axis)     HDMI1 disconnected (normal left inverted right x axis y axis)     DP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 475mm x 267mm        1920x1080     60.00*+        1280x1024     75.02    60.02          1152x864      75.00          1024x768      75.08    60.00          800x600       75.00    60.32          640x480       75.00    60.00          720x400       70.08        Whenever I start sharing my desktop in the Hangout, only the built-in (smaller) screen is shared. Best thing would be to be able to chose which one to share, but if not, how could I share only the attached (bigger) screen? I bet Google's Hangout is looking for a configuration file to choose which screen to share, but don't know which file it is. ## NOTE Using Fedora 20, x86_64, Linux 3.15.10-200, GNOME Shell 3.10.4-8 ## NOTE 2 Using Firefox 31. Using Chrome makes Google Hangouts share both screens at the same time instead of only the laptop's screen, which I think is even worse. Still trying to find out how could I choose which screen to share.


Changing TTY font to a non-default font

I found two ways to change the TTY font:   1. dpkg-reconfigure console-setup   2. editing /etc/default/console-setup Either way I'm limited to the fonts in /usr/share/consolefonts (I'm using Debian).   * How do I install new console fonts?   * What are the requirements for this kind of font?   * ... in particular: would it be possible to use Anonymous Pro as console font?


CLI network management

I've set up a console typewriter: a laptop with a minimal Debian install and no X server. I use it as a typewriter and I use wifi to sync my documents. I connect to wifi using wpa-supplicant. That involves editing /etc/network/interfaces each time I connect to a new network - and that a little tiresome. What would be a good CLI network manager that could make connecting to new networks easier. It should be able to:   * Shows a list of available networks   * Let me select one and connect by time the WPA password   * Remembers passwords and automatically connect to the connections that I've used before


re-initialize the framebuffer when program crashes

I'm using SDL to display images on a monitor, without X installed. When my program ends successfully, the monitor goes back to the login prompt (as expected). But when my program crashes, the last image stays frozen on the monitor (even if I launch the program again, the last image of the previous execution stays stuck on the monitor). How could I kill the display in order to "use" it again ? The only solution that I found is to reboot the computer but I need to avoid that because other processes run on the computer and cannot be interrupted.


How can I force a script to use more resources?

I'm running a very time-consuming script which takes many hours to end. Watching `top` I see that it's only taking 5% of the CPU at best, usually around 3%. Is there any way to force the script to use more CPU in order to end faster? Edit: Basically the script is bruteforcing 5 chars length passwords given a the salt and the hash. Not at home right now, but something like:               charset = ['a','b',.........'z'];     for i in $charset do        for j in $charset do            for k in $charset do                for l in $charset do                   for m in $charset do                       pass = `openssl passwd -salt $1 $i$j$k$l$m`                       if [ pass == $2 ]]; then                          echo "Password: $i$j$k$l$m";                          exit;                       fi                    done                 done             done         done      done


How to get the port number a program is listening on in a shell script?

I have a program (beam) running, and I need to figure out which TCP / IPv6 port it is listening on. I know `netstat` will tell me, but I haven't fully been able to parse its output:               RABBIT_PORT=$(netstat -tupln | grep beam)     echo $RABBIT_PORT      Gives:               tcp  0 0 0.0.0.0:47858 0.0.0.0:* LISTEN 4533/beam      tcp6 0 0 :::5672       :::*      LISTEN 4533/beam      But I need to extract just the port number (5672), how can I do so? Alternatively, is there a better command than `netstat` to do this (that'll be as widely available as `netstat`, at least on Linux?)


Does the shebang determine the shell which runs the script?

This may be a silly question, but I ask it still. If I have declared a shebang               #!/bin/bash       in the beginning of `my_shell_script.sh`, so do I always have to invoke this script using bash               [my@comp]$bash my_shell_script.sh      or can I use e.g.               [my@comp]$sh my_shell_script.sh      and my script determines the running shell using the shebang? Is it the same happening with `ksh` shell? I'm using AIX.


Starting up and keeping up a process

I am having an Ubuntu box on which I am having a Haskell process (think of it as a random server process) that I built. I want to start it on boot and restart it in case it fails for whatever reason (ideally with some kind of logging that it failed, what exec code it failed with, etc.). How to do that? Right now I wrote a shell script which is located in /etc/init.d/ which will fire up the haskell process and pipes it output to /var/log/.log . How to do the monitoring/restarting though?


Which is more efficient, ls or ls -l?

As I understand, the `ls` command calls `getdents`, which returns up to x number of directory entries. Are there any other system calls involved? If I run `ls -l`, are there any more system calls? I am trying to determine if `ls -l` is more expensive and hence slower than `ls`.


how can I recursively delete empty directories in my home directory?

> **Possible Duplicate:**   >  How to remove all empty directories in a subtree? I create directories very often, scattered over my home directory, and I find it very hard to locate and delete them. I want any alias/function/script to find/locate and delete all empty directories in my home directory.


Installing fonts via terminal

I have downloaded font files in .ttf format, I want to install these fonts via the terminal, What is the command for that?


VirtualBox: Same IP address for both network interfaces on same machine (scientific linux)?

When booting up the VM (Scientific Linux 6.4) in VirtualBox (4.3), I'm getting the same ip address for both network interfaces. VirtualBox has NAT for the first network adapter, and Host-Only for the second network adapter. VM is configued as follows: ifcfg-eth0               DEVICE=eth0     BOOTPROTO=dhcp     ONBOOT=yes     NM_CONTROLLED=no     Type="Ethernet"      ifcfg-eth1               DEVICE=eth1     BOOTPROTO=static     IPADDR=192.168.56.107     NETMASK=255.255.255.0     NM_CONTROLLED=no     ONBOOT=yes     Type="Ethernet"      Results of ifconfig               eth0      Link encap:Ethernet  HWaddr 08:00:27:E8:14:8B                 inet addr:192.168.56.107  Bcast:192.168.56.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fee8:148b/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          eth1      Link encap:Ethernet  HWaddr 08:00:27:92:0A:6D                 inet addr:192.168.56.107  Bcast:192.168.56.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fe92:a6d/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1      If I execute the following:               # ifdown eth0     # ifup eth0      Then eth0 gets the correct ip address.               eth0      Link encap:Ethernet  HWaddr 08:00:27:E8:14:8B                 inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fee8:148b/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1      Why is it not picking up the correct ip address on boot? How do I configure it to have the correct ip for eth0?


How to automatically mount Truecrypt volume at login without a prompt?

How do I automatically mount a Truecrypt volume at user login without any prompt? The Truecrypt volume is based on a file, not a partition. I'm running Kubuntu 12.04 and Truecrypt 7.1a (latest).


mdadm large memory consumption

I am building a RAID 6 with `mdadm` (8 WD Red 3 Tb) on Ubuntu 13.10x64 server with ext4 filesystem. When I download torrent on the array, server RAM is filled for maximum cap (8 Gb) memory is free when I manually enter               sync;echo 3 > /proc/sys/vm/drop_caches      The `mdadm -D` output:               /dev/md127:             Version : 1.2       Creation Time : Sun Feb 16 18:47:05 2014          Raid Level : raid6          Array Size : 17580801024 (16766.36 GiB 18002.74 GB)       Used Dev Size : 2930133504 (2794.39 GiB 3000.46 GB)        Raid Devices : 8       Total Devices : 8         Persistence : Superblock is persistent              Update Time : Wed Feb 19 14:30:40 2014               State : clean       Active Devices : 8     Working Devices : 8      Failed Devices : 0       Spare Devices : 0                   Layout : left-symmetric          Chunk Size : 512K                     Name : corvsrv:2  (local to host corvsrv)                UUID : d6ca33d3:925c7c82:891c9f07:1f2cb07a              Events : 121              Number   Major   Minor   RaidDevice State            0       8       33        0      active sync   /dev/sdc1            1       8       49        1      active sync   /dev/sdd1            2       8       65        2      active sync   /dev/sde1            3       8       81        3      active sync   /dev/sdf1            4       8       97        4      active sync   /dev/sdg1            5       8      113        5      active sync   /dev/sdh1            6       8      129        6      active sync   /dev/sdi1            7       8      145        7      active sync   /dev/sdj1      How to fix the memory consumption?


GNU Screen makes Vim ESC key slow

Screen makes my `ESC` key wait for more commands I beleive, and if it does not get those commands, it sends it to my terminal Session (which I am running VIM in). `ESC` is used alot in VIM and currently I do not make any use of the `ESC` key in Screen. How would I go about changing the timeout? I have read that these commands below inside of .screenrc should fix it, but it doesn't seem to be working for me:               maptimeout 0     defc1 off


svn command to see a tally of my changes

Is there an SVN command that I can run to see a tally of all of my contributions? Something like:               added 1800     deleted 15


How to compress and transfer folders from one server to another over network

Do we have any option to transfer folder from one server to another, that is faster and compressible and bandwidth limit settable method? The servers run on Linux. I tried tar + ssh but I couldn't set bandwidth limit to 3 or 4 MBPS likewise. Any other service does it?


Unable to install erlang

I am trying to install `Erlang` for `RabbitMQ` on `CentOS release 6.4 (Final)` > yum install -y erlang It gives me the following error :               Error: Package: erlang-R12B-5.12.el5.rf.x86_64 (rpmforge)     Requires: libodbc.so.1()(64bit)      I can't find solution for `libodbc.so.1` I also installed `unixODBC` and `unixODBC-devel`


How can I safely give a shell to somebody?

I have a question about giving a shell account to somebody. How safe is it? He could read /etc. How can I give a secured shell account that will only restrict the user to some bins and his own home? Is the only way a chroot jail?


Using wget to target files within a date range

I'm using `wget` to download some log files from a remote server. Is it possible to use `wget` to target files using date ranges (based on the last modified file header) ? For example:               wget --after-date=03112014 http://foo/bar


stripping out the last two [end] with sed?

I'm working on a script that improves the `fluxbox` 'menu', and my script has this line:               sed -i 's/\[end]//g' ~/.fluxbox/menu;sed -i '/^\s*$/d' ~/.fluxbox/menu      but this has the unfortunate effect of stripping out _all_ of the `[end]` which is bad, I only want it to strip out the last two occurrences of `[end]` in that file. So how do I do it please?


Is it possible to install a CentOS and some packages then put whole result into a installable iso?

I need to fresh install a CentOS Then install some packages with some configs Then save all into a installable ISO. Is it possible to build it?


Understanding output of lvdisplay in LVM/Linux

I am new to Linux admin field I just want to know the meaning of following fields in lvdisplay output               root@sandbox: lvdisplay rootvg/swaplv | grep -i '# open'      # open                 2     root@sandbox: lvdisplay rootvg/swaplv | grep -i 'Segments'       Segments              1      Thanks in Advance Note - I asked same question on ask ubuntu but got no reply.


How to rename all files and add image size to file name

I can`t make this work. I have a lot of images and i want to rename his name and append image size to name using exiv2 `eviv2 pr *` prints all info about file               # exiv2 pr 9b523e5a002268fe5067a928     File name       : 9b523e5a002268fe5067a928     File size       : 356433 Bytes     MIME type       : image/jpeg     Image size      : 1920 x 1200      Now i want rename my file to look like               9b523e5a002268fe5067a928_1920x1200.jpeg      I already make something like this               exiv2 pr * | grep "Image " | awk -F':' '{ print $2 }' | sed 's/ //g'      It gives me the image size, but how do i extend this to get the image MIME type to get the .jpeg correct ?


TTY not work after X starts

I have a HP Envy4 5306tx laptop with Intel+Nvidia dual cards, and I install fedora 19 X64 on it without NVidia proprietory driver. However, there are some problems about the X and TTY。   * The TTYs are normal and switchable through `Ctrl`+`Alt`+`Fn`, when booting with runlevel 3.   * When X starts, I cannot switch to any TTY. If I press `Ctrl`+`Alt`+`Fn`, I get a blank screen(black/grey/blue), and cannot go back to X.   * When I exit Windows manager, I also get a blank screen. And I have to press power key to poweroff. There are some errors in `Xorg.0.conf`:               [26.217] (EE) Failed to load module "glamoregl" (module does not exist, 0)     [26.448] (EE) open /dev/dri/card0: No such file or directory     [26.461] (EE) open /dev/fb0: No such file or directory      There are also some errors in `/var/log/messages`:   * Failed to activate service 'org.freedesktop.Consolekit': time out   * [system] Activation via systemd failed for unit 'dbus-org.freedesktop.nm-dispatcher.service' How that happens? Is it related to the dual cards?


How to detect dos format files in git bash

Git Bash is a nice bash shell you get in Windows as part of the installation of Git. It comes with other typical unix tools bundled inside, such as grep, sed, awk, perl. It doesn't have the file command. In this shell, I want to detect files that have DOS-style line endings. I thought this command would work but it doesn't:               grep -l ^M$ *      It doesn't work, even files that don't have CR line endings match. For example if I create 2 sample files `hello.unix` and `hello.dos`, I can confirm with `wc` that `hello.unix` has 6 characters and `hello.dos` has 7 characters because of the extra CR, but both files match with `grep`. That is:               $ cat hello.*     hello     hello          $ wc hello.*           1       1       7 hello.dos           1       1       6 hello.unix           2       2      13 total          $ grep -l ^M hello.*     hello.dos     hello.unix      Is this a bug in the `grep` implementation or what? Is there another way to find all files with DOS-style line endings?


How can I detect that no options were passed with getopts?

I have this code -               #getoptDemo.sh     usage()     {         echo "usage: <command> options:<w|l|h>"     }     while getopts wlh: option     do         case $option in                 (w)                         name='1';;                 (l)                         name='2';;                 (h)                         name='3';;                 (*)                         usage                         exit;;         esac     done     print 'hi'$name      When I run `bash getoptDemos.sh` (without the option) it prints `hi` instead of calling the function `usage`. It calls usage when options other than w, h and l are given. Then can't it work when no options are specified. I have tried using `?`, `\?`, `:` in place of `*` but I can't achieve what I wanted to. I mean all the `docs` on `getopt` says it to use `?`. What am I doing wrong?


what happens when a window manager is put to background

I am trying to understand the situation why .xsession file expects the last process to be in foreground otherwise it is supposed to stop X11 session. I have a small stand-alone script. when I run this, it immediately quits as 'less' is but in background.               $ ls -l total 4     -rwxr-xr-x 1 user user 17 Feb 28 21:17 a     -rw-r--r-- 1 user user  0 Feb 28 20:22 b      $ cat a      less b &      echo $!        1. I understand 'less' tool primarily interacts in foreground. I do not know how it is implemented, but I guess it realizes that it no more runs in foreground and it can't get input or show some output to user so it is no more useful to run so it quits. Or what is really happening?   2. when you put a 'window manager' in background, why does it quit? Does it quit because it does not run in foreground and cannot get any keyboard/mouse input through X server and it cant be anymore useful so it quits?


What is the difference between gksu and sudo?

I presume this applies to any Gnome desktop. What is the difference between these two commands? According to the Ubuntu documentation and questions that reference it, the former also sets the `$HOME` environment variable and copy the .Xauthority variable to temporary location, but are those the only differences for all systems running Gnome, or do they only apply to Ubuntu?


How does chroot's use of qemu for cross compile environments work?

To be able to do cross compiling there's a trick where you copy a static qemu binary into your `<different-arch-root-to-be>/usr/bin` and when you chroot into that filesystem, which has non-native binaries, magically the binaries are executable by the host cpu, and `uname -a` and similar claim that you are on the target architecture. The net result is that you can get dead simple cross compiling. I can imagine a way this might work, but it would require `chroot` to be `qemu` aware. Is this the case? I can't seem to find any documentation as to how this works.


Software like Iceweasel and LibreOffice wont run without root/sudo

I recently decrypted my home directory by making a backup of my home directory, deleting the directory, and then replacing it again with the backup (followed a guide). Ever since, I can no longer run standard built in software like Iceweasel and LibreOffice without root access. Whenever I try to open the programs, they give me some sort of error like "Iceweasel is already running" (which it isn't). But when I run them from the command line with sudo, they work fine. I think it has something to do with the permissions of my home directory, not entirely sure. I'm wondering how I can give my user permissions to run all the software in my home directory without having to use sudo in the command line. I'm pretty sure when I was moving my home directory around, it messed with the permissions. (This is just a guess, not sure why I need root permissions to run these types of software). Thanks, all help is appreciated.


How to compile the C compiler from scratch, then compile Unix/Linux from scratch

Let's say I work for a large services organisation outside the US/UK. We use UNIX and Linux servers extensively. Reading through this article it mentions that it would be easy to insert a backdoor into a C compiler, then any code compiled with that compiler would also contain a backdoor. Now given recent leaks regarding the NSA/GCHQ's mandate to put backdoors/weaknesses in all encryption methods, hardware and software, the compiler is now a critical point of failure. Potentially all standard UNIX/Linix distributions could be compromised. We cannot afford to have our systems, data and our customers data compromised by rogue governments. Given this information, I would like to build a trusted compiler from scratch, then I have a secure base to build on so I can build the Operating System and applications from source code using that compiler. ## Question **What is the correct (and secure way) to go about compiling a compiler from source code (a seemingly chicken-egg scenario) then compiling a trusted Unix/Linux distribution from scratch?** You can assume I or others have the ability to read and understand source code for security flaws, so source code will be vetted first before compiling. What I am really after is a working guide to produce this compiler from scratch securely and can be used to compile the kernel, other parts of the OS and applications. The security stack must start at the base level if we are to have any confidence in the operating system or applications running on that stack. Yes I understand there may be hardware backdoors which may insert some microcode into the compiler as it's being built. Not much we can do about that for the moment except maybe use chips not designed in the US. Let's get this layer sorted for a start and assume I could build it on an old computer potentially before any backdoors were inserted. As Bruce Schneier says: **_"To the engineers, I say this: we built the internet, and some of us have helped to subvert it. Now, those of us who love liberty have to fix it."_** Extra links:   * http://nytimes.com/2013/09/06/us/nsa-foils-much-internet-encryption.html?pagewanted=all&_r=0   * http://theguardian.com/commentisfree/2013/sep/05/government-betrayed-internet-nsa-spying


Unable to ping CentOS virtualbox

I have created a virtual machine for CentOS in VirtualBox using an NAT connection (It wont work under Bridged). Now the problem is I can ping from CentOS to my IP on Ubuntu with no problem but I cannot ping from Ubuntu or from my work terminal to `CentOS`. I have disabled `ufw` on Ubuntu and still cannot get ping. I have disabled `iptables`,`ip6tables`, and `selinux` on CentOS and still cannot get a response. Is there something else that may be preventing me from pinging that I overlooked? FYI I have been successfully able to ping www.google.com and surf the web so I know it is not a network problem from Ubuntu's end or even my work putty terminal but something is getting lost somewhere.


Wait for background processes to finish with inverse match process ID

I'm looking to run a number of background processes in a loop, but only want to wait for all of those processes to finish, still allowing another background process to continue. After doing some research, I only see solutions that would require me to list every process ID I wish to `wait` for instead of matching them inversely against a single process ID. It seems that something like `wait != $pid` would be very useful. example script:               #!/bin/bash          command1 &     pid=$!     for i in ${array[@]}; do         for n in $(seq 3); do             if [ $n -eq 1 ];                 command2 > file &             else                 command2 >> file &             fi         done     done      In this example I'm looking to wait for every process to finish except `$pid` without having to list them all using the `wait` command. Is this possible?


Check argument before program run

I have noticed that, when I type `unzip` in bash and press **tab** , auto- complete works only on files with .zip extension. How is that done? What if I would like to make program that would accept only image files, how to restrict auto-complete to certain extensions (eg .jpg and .png only). Is this some kind of system setting or an programming setting that vary for languages (bash, C++, python) ?


Parsing the log file test into tabular format

How to display below test file in tabular format as below: Output should be like:               ma1-test1.cor.dns.com                                                                     cmd                         -                   stdout            -             stderr          splunk status | grep -i splunkd  -   splunkd is not running.  -                 -     ps -ef | grep -i httpd | wc -l        -           0                             -          ma1-test2.cor.dns.com                                                                 cmd                         -                   stdout            -             stderr          splunk status | grep -i splunkd  -   splunkd is running  (PID: 31286). -        -     ps -ef | grep -i httpd | wc -l       -            0         -      Log contents:   =================               ma1-test1.cor.dns.com-cmd:-splunk status | grep -i splunkd     ma1-test1.cor.dns.com-stdout:-splunkd is not running.     ma1-test1.cor.dns.com-stderr:-     ma1-test2.cor.dns.com-cmd:-splunk status | grep -i splunkd     ma1-test2.cor.dns.com-stdout:-splunkd is running (PID: 31286).     ma1-test2.cor.dns.com-stderr:-     ma1-test1.cor.dns.com-cmd:-ps -ef | grep -i httpd | wc -l      ma1-test1.cor.dns.com-stdout:-0     ma1-test1.cor.dns.com-stderr:-     ma1-test2.cor.dns.com-cmd:-ps -ef | grep -i httpd | wc -l      ma1-test2.cor.dns.com-stdout:-0     ma1-test2.cor.dns.com-stderr:-


Disk Scheduler in Linux

I am studying about Disk Scheduling in my OS class. Thought about the disk scheduler in Linux. When I run               cat /sys/block/sda/queue/scheduler      noop anticipatory deadline [cfq]       Someone explain about this noop anticipatory deadline [cfq]. Text books says scan, cscan, look, fifo, sstf...


List all RPM packages installed from repo "X"

How can I get a list of all of the RPM packages that have been installed on my system from a particular repo (e.g., "epel")?


Override the window title for an arbitrary window in KDE and set a custom window title

Using KDE here, but there might be a solution that works with other desktops environments too. I often am dealing with many many windows. Most windows contain many tabs (e.g. a Dolphin window with many tabs, or Firefox, Konsole, etc). The window title will change based on my current tab (which for the most part is helpful most of the time), but when working with so many windows I'd like to organize them a bit and **be able to manually re-name the window, overriding the the window title that the application gives**. I might name one Firefox window "Research" and other Firefox window "Documentation" to be able to easily distinguish between the windows that I've used to organize and group different tabs accordingly. Ideally I'd be able to click on a window title bar and easily give it a custom name, but I'd settle for a solution that's slightly more cumbersome as long as it works. I've tried `wmctrl -r :SELECT: -T "Research"` but that only works temporarily (the title is reverted when the application changes it, for example when switching tabs).