title: LXC apparmor profile limits executing scripts in /run/*

text: LXC is blocking a trusted container from running scripts in /run/*, how do I configure LXC to allow scripts to run here?


title: Sort fields inline

text: I'm trying to sort within a line of input over an unknown number of fields: Input:               ab bc     bc ab     cd ef bc      bc cd ef     cd bc ab     ef ab bc cd gh      Output:               ab bc     ab bc     bc cd ef     bc cd ef     ab cb cd     ab bc cd ef gh      I've been using something like `awk '{if($2 < $1) print $2,$1;else print}'` but seems like it would get messy over more than two fields. Any help?


title: BASH_ENV and cron jobs

text: I have several questions related to non-interactive, non-login shells and cron jobs. **Q1.** I have read that non-interactive, non-login shells only "load" `$BASH_ENV`. What does this exactly mean? Does it mean that I can point `$BASH_ENV` to a file, and that this file will be sourced? **Q2** : Assuming that I have an entry in `cron` pointing to a Bash script with a Bash shebang, what environment variables and definitions can I assume my Bash script is loaded with? **Q3** : If I add `SHELL=/bin/bash` to the top of my `crontab`, what exactly does this do? Does it mean that:   1. `cron` itself runs in Bash?   2. The commands **specified** in `crontab` are interpreted in Bash?    3. The scripts that do **not** have `shebangs` in them, are run under `$SHELL` something else? **Q4** : How can I set `BASH_ENV` for cron jobs?


title: Autofs timeout when accessing read-only file system

text: I've configured a auto-mount system (using `autofs`) with a timeout to mount a read-only (squashfs) file system. The mount gets unmounted after the timeout even though there is read only activity on the file system constantly. Is this expected behavior of automount?


title: mount info for current directory

text: I can do `df .` to get some of the info on the mount that the current directory is in, and I can get all the info I want from `mount`, but get to much info. I can grep it down, but am wondering if there is a better way. Is there some command `mountinfo` such that `mountinfo .` gives info I want (like `df .`, but with the info that `mount` gives.) * * * I am using Debian Gnu+Linux.


title: Execute script on Linux Mint from a Windows Machine

text: Basically I am trying to use Linux Mint to display Powerpoint presentations. The presentations will be updated on a Windows machine, the user will then execute a script which 'refreshes' the presentation at the presentation terminals. We have this in place now, but using Windows XP, which we now have to remove because of the support ending. The issue I am having with Mint is I don't know how I execute a script from a Windows machine, that will kill the current presentation process, transfer the latest copy of the presentation and then execute. I have tried using plink to script this via an SSH connection but it doesn't show the presentation because it runs in the 'SSH' session rather than console. Any ideas are much appreciated I've hit a mental wall! Thanks


title: A shell script for joining two files

text: I want to write a `shell script` that get two files `A` and `B`, and get a result like this: File `A`:               user_a tel_a addr_a     user_b tel_b addr_b      File `B`:               process_1 user_a     process_2 user_a     process_3 user_b      And the result:               user_a process_1 tel_a addr_a     user_a process_2 tel_a addr_a     user_b process_3 tel_b addr_b      How can i do this? `awk` or something else?


title: redirect output for a command that takes in multiple arguments

text: this command is to redirect output of `time` to with multiple args:               $ time wc test >wc.out 2>time.out      unix programming environment book shows that the error output of `time` redirects to `time.out`, but it seems that it's treating the `2>time.out` portion as part of the `wc` command and not redirecting the error output to `time.out` as I expected, so what is the problem?


title: xterminal dosen't pass key-strokes to emacs

text: I opened emacs using `emacs -nw`. Now, when I press `M`-`v`, it opens the view menu of the terminal, instead of passing the command to emacs. Is there a way to prevent this from happening? (I'm running on linux mint)


title: How to stop a windows virus run in Wine from infecting executables?

text: Yesterday all *.exe files on my machine were infected by Win32.Neshta virus after I ran one program via wine. I cured the machine with `rm -rf ~/.wine`, but it's no good anyway. So, I decided to set owner root:root and mode 644 on all *.exe, *.com... files. But the owner of the directories is still me. So, I (and, therefore, viruses) can freely rename/remove *.exe files. It's bad. How can I protect *.exe files from being modified/ renamed/ removed by viruses? Now I have two ideas:   * `chattr +i`   * make a hardlink for all *.exe to a separate root directory


title: Is it possible to switch the user logged in to desktop environment via the terminal?

text: Is there any possibility to login as a different user while changing also the environment (or how do you say the wallpaper, shortcuts,...) via terminal command like `su`, `ssh` or `login`? Like when you click switch user in the up right corner where your name is and then you log in to a different account. By environment I mean the thing you see when you boot up the computer and normally login through the login screen. You have your wallpaper, toolbar etc. So I just want to open terminal in my adam's environment and type `login --change-enviroment john`, rather than clicking adam in the up right corner, logging off and logging in like john


title: User's executed commands log file

text: In Unix based systems, is there a `log file` that stores user's executed command(s)?


title: Install debug flash player in Chrome?

text: I am trying to adapt the instructions from here, here, and here to install the debug version of the flash player on my Ubuntu 13.04 installation such that Chrome 30.0.1599.66 can use it. Interestingly, it appears that I already have the official Adobe flash plugin installed and useable by Chrome, so the problem changes from "installing flash" to "replacing regular flash with the debugger version". ![enter image description here](http://i.stack.imgur.com/PRIDm.png) So I need to replace `libflashplayer.so` with the one downloaded from Adobe. Sounds simple. I selected this file (Linux Flash Player 11.2 Plugin content debugger), decompressed it and installed the Flash Player Local Settings configurations files as directed. I then replaced `/usr/lib/flashplugin/installer/libflashplayer.so` with the version included in the debugger install, and restarted Chrome. To my surprise, the second Adobe Flash Player listing in `chrome://plugins` just disappeared! ![enter image description here](http://i.stack.imgur.com/UvGyU.png) It's as if Chrome doesn't like the debugger plugin for some reason. I tried various things to get the debugger plugin to appear but to no avail:   * `chmod +rx libflashplayer.so`   * `nspluginwrapper -i libflashplayer.so` (Results in error `no appropriate viewer found for libflashplayer.so`)   * `mkdir /opt/google/chrome/plugins; mv libflashplayer.so /opt/google/chrome/plugins` How can I get Chrome to recognize the Flash debugger plugin?


title: gnome-terminal: keep track of directory in new tab

text: I'm on Arch linux, and when I open a new terminal tab, it always goes to `$HOME`. How can I make it so that when I open a new tab, it opens the shell in the directory I was in previously?


title: Automatic replacement of strings in gedit

text: I want to replace some strings defined by me in gedit, after a word has been completed and/or the document has been saved. For example \ðrac should be replaced with \frac How do I do this in gedit or with a plugin for gedit? If it is not possible in gedit, then I'm happy for suggestions of other programs that has the feature with the same basic feature set as gedit.


title: No ethernet/wireless connection after dist upgrade - "network UNCLAIMED"

text: I did an upgrade from Xubuntu 12.04 to 12.10, and I can't connect to the internet now. When I press the network button on the panel, I see "No network devices available" on top (greyed out), then "VPN Connections", "Enable Networking" with a checkmark next to it, "Information" (greyed out) and "Edit". Here's the output from some commands that seem relevant: `                ~ % lspci | grep -i ethernet     03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 07)     ~ % lspci | grep -i network     02:00.0 Network controller: Intel Corporation Centrino Wireless-N 1030 (rev 34)     ~ % sudo lshw -C network     PCI (sysfs)       *-network UNCLAIMED            description: Network controller            product: Centrino Wireless-N 1030            vendor: Intel Corporation            physical id: 0            bus info: pci@0000:02:00.0            version: 34            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress bus_master cap_list            configuration: latency=0            resources: memory:f7c00000-f7c01fff       *-network UNCLAIMED            description: Ethernet controller            product: RTL8111/8168B PCI Express Gigabit Ethernet controller            vendor: Realtek Semiconductor Co., Ltd.            physical id: 0            bus info: pci@0000:03:00.0            version: 07            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress msix vpd bus_master cap_list            configuration: latency=0            resources: ioport:e000(size=256) memory:f0004000-f0004fff memory:f0000000-f0003fff     ~ % uname -a     Linux bleen 3.5.0-030500-generic #201207211835 SMP Sat Jul 21 22:35:55 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux     ~ % 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:472 errors:0 dropped:0 overruns:0 frame:0               TX packets:472 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:35080 (35.0 KB)  TX bytes:35080 (35.0 KB)     ~ % ifconfig eth0 up     eth0: ERROR while getting interface flags: No such device      ` I think that UNCLAIMED means I don't have a driver for the Ethernet controller. It seems that the driver should be called something including 816 (I don't remember where I found that), and it does seem to be missing: `               ~ % lsmod | grep 816     ~ %       ` I tried downloading and installing the driver (after moving on a USB stick from a computer with a connection), but I get this issue: `               ~/r8168-8.037.00 % sudo ./autorun.sh      Check old driver and unload it.     Build the module and install     make: *** /lib/modules/3.5.0-030500-generic/build: No such file or directory.  Stop.     make1: _**[clean] Error 2     make: *_ * [clean] Error 2      ` Not sure what to do next.


title: Extracting text from a text file in bash

text: I have a large text file that is all one line. In the text are several sections that looks like `foo=12345` and I need to extract them all as separate lines, ignoring the rest of the file. For example:               random junk foo=12345 more junk random junk foo=2345 junk foo=7654 junk random foo=5432 junk      What I want to get out is:               12345     2345     7654     5432      I know how to write the regex to extract the `foo=([0-9]+)`, but I'm not sure how to apply that to the text and get the lines out in bash.


title: What does this command-line do?

text: Please explain this in ways that I can understand. I'm very new to this stuff:               ps ax >mytemp; more <mytemp … same as … ps ax | more     cat mytemp | grep barrymp … same as … ps ax | grep “barrymp”


title: Change the location of .bashrc

text: Is it possible to change the location of `.bashrc` from `/home/orhanc/.bashrc` to some other directory?


title: View shell function's current definition

text: So I am editing bashrc constantly, and I have a terminal open with a working function definition, although bashrc has been updated with a wrong function definition. (Because the definition do not change until I source the updated bashrc) How can I look up the working function definition in this case? For example, if I type:               alias function_name      I can see what the definition is for that alias. Is there a command similar for function? If not, is there a command to output entire bashrc that the current terminal is using?


title: kernel address space mappings with respect to virtual address space - a question based on text by Robert Love

text: In LKD 3rd edition, chapter 12 under Zones, Robert Love says: > In particular, Linux has to deal with two shortcomings of hardware with > respect to memory addressing: > >   1. Some hardware devices can perform DMA (direct memory access) to only > certain memory addresses. > >   2. Some architectures can physically addressing larger amounts of memory > than they can virtually address. Consequently, some memory is not > permanently mapped into the kernel address space. > > My Questions:   1. First is okay, what does he mean by 2?   2. Does he mean to say: Some architectures can address larger amounts of physical memory than they can address virtual addresses?   3. How's that possible? I thought virtual address space is larger than physical memory or at least (if any) equal to physical memory.   4. Also, isn't it because VAS (virtual address space) is larger than physical memory, some memory is not permanently mapped into KAS (kernel address space). But I'm guessing that only physical memory is mapped into KAS. Let me know what he means by point #2 above and what wrong assumption(s) I'm making here.


title: phpmyadmin is listing my server version and client version as being different

text: In a continuation of this question, I have purged the 5.1 client via `sudo apt-get purge mysql-client-core-5.1`. I have reinstalled the 5.5 client - `sudo apt-get --reinstall install mysql-client-5.5 mysql-client-core-5.5`. I've also restarted apache and MySQL. Despite that, phpmyadmin still lists the client as being 5.1. Any ideas how to fix it? EDIT: It tells me that `mysql-client-5.1` is not installed. `mysql --version` returns:               $ mysql --version     mysql  Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (x86_64) using readline 6.2


title: Deleting all files that begins with parenthesis

text: I have many files in a directory that begins with parenthesis. They are generated by Dropbox due to conflict. Any combination of escaping does not seem to help:               rm -rf "(*"     rm -rf "\(*"     rm -rf \(*      AS frostschutz mentioned, they do not seem to be ASCII characters. How can I find out if this is the case, and what is the work around?


title: Solaris find previous log line

text: We are running solaris 10 at work. What I'd like to do is find the line previous to another line. Real live example. I can find out that some of our requests are timing out with the following query. grep timeout log.log. This gives me something similar to:               2010-11-30 20:59:57,495 ERROR [82.69.73.87 - 342E15CB9651927BE715780FC40DEC53 - 3675058] Send Call (AbstractEngineServlet.java:288) > - Merchant error HTTPS Comms found. Merchant Trans Id: 22283845800 The host did not accept the connection within timeout of 60000 ms      In the log files though but it may be several lines previous we log about to call `2010-11-30 20:56:57,495 INFO [82.69.73.87 - 342E15CB9651927BE715780FC40DEC53 - 3675058] about to call http://www.example.com` So what I would like to do is identify all timeouts and then identify all the "about to call" lines which are directly previous and have the same IP address or session. In the above example it would be finding the previous row containing "342E15CB9651927BE715780FC40DEC53" is this possible with the standard shell tools?


title: Using nohup on Solaris 10

text: I need to transfer a large number of files over SFTP (only between Solaris servers) which takes a very long time. I cannot keep my PC on for this duration. I tried:               nohup sftp server1      While the shell is open, I see files are downloaded. When I close the shell it stops. In `ps -ef` I don't see the `sftp` process. The file nohup.out states: Killed by signal 15 If instead I do `ctrl-z`, `bg`, `disown` it works. However this requires the bash shell; how can I do this in ksh?


title: How to upgrade shared library without crash?

text: Here it says that you can rewrite an executable file and the process will run just fine - it will be re-read when a process restarts. However, when I try to replace a binary file while the process is running (with scp, from dev to test server) it says 'file busy'. And if I replace a shared library file (*.so), all the processes that link it crash. Why so? Am I missing something? How can I replace the binary files without stopping/crashing a process?


title: How to install vsftpd package

text: I am having a rhel6 server i want to install vsftpd package from there to my client machine How to do this.


title: Two GUI applications as different users on the same screen

text: I am logged as user A. I want to run a GUI application as user B. User, not root. User B is local too, not remote, I only need different environment variables. I don't want to run the second X, I want them on the same display. I have no problem with programs running in terminal, the `su - ...` works. For graphical there is an error message:               Application initialization failed: couldn't connect to display ":0.0"      or               Gtk-WARNING **: cannot open display: :0.0      Is there a good way to fix it? The article about correct using of `xhost` or something?


title: D-Link Wireless N 150 USB Adapter on Ubuntu

text: Link DWA-123 wireless adapter, on my desktop running Ubuntu 9.10 the device is being recognized as in, when I hit lsusb i get this entry               Bus 001 Device 010: ID 2001:3c17 D-Link Corp. [hex]      How do i get this working so that i can connect it to my wireless network at home? Thanks in advance


title: Force to use specific DNS provider at network

text: OpenDNS offers a quite simple way for internet filtering by categories. Of course who could get the correct IP address can easily bypass the filter but it would be enough for my expectations. The bigger problem is that changing DNS provider at client side is not a big deal. **So my question is whether it is possible to force to use only specific DNS provider at local network.** The target device is a WiFi router with OpenWRT. (However I would welcome any similarly simple to set up filtering solution but the main question is the DNS provider forcing.)


title: Two-way rsync results in oscillating content

text: I am trying to sync content between two servers. The servers are identical builds (Ubuntu 12.04LTS) and have this cron job running to sync the content: `rsync -arzc --update --delete /htdocs/testing/www/cms_uploads/* root@123.123.123.123:/htdocs/testing/www/cms_uploads/` but I'm getting some strange results when I am testing the process as detailed below. **First test**   * Uploaded aaaa.jpg to Node2   * syncs to Node1    * Delete from Node1   * Reappears on Node1    * Delete from Node2   * Removed from Node1 **Second test**   * Uploaded bbbb.png to Node1   * Syncs to Node2   * Delete from Node2   * Reappears on Node2   * Delete from Node 1   * Reappears on Node1 All I am trying to do is make sure the same content is exactly the same on both servers all the time. What am I doing wrong?


title: CentOS eth0 not starting

text: Why would my new CentOS Virtual Machine not start eth0 on startup? I have to start it manually every time. How can I fix this? Thanks.


title: Auto change splash screen after log on

text: I know how to change the splash screen, however I would like it to change automatically. Say I have a folder of images and I want each of them appear to be splash screen randomly every time I log on. I use KDE.


title: zsh completion - show more options than just the alias

text: I am trying to modify the behaviour of zsh completion and its menus. I'm stuck, and I've read so much documentation it's making my head spin. The following is only an example; I'd prefer answers that aren't specific to `cd`. I have zsh set up to only show the select menu if the completion is unambiguous (`zstyle ':completion:*:*:*:*:*' menu select=2`). I have an alias `alias cd='nocorrect cd'`. When I do `cd<TAB>` (no space), zsh thinks it is unambiguous, and completes the alias. zsh thinks it is unambiguous--indeed, when I do `cd<^D>`, it only shows the one possible completion. In my mind, it should show other completion options like `cdiff`. Indeed, when I do `cd<^Xn>`, I see those other options. This is also the demonstrated behaviour in the ZSH User's Guide, section 6.5.2. I sort of see what's going on. I have my completers set up as `zstyle ':completion:*' completer _expand _expand_alias _complete _ignored _match _correct _approximate _prefix`, so I can understand why it thinks expanding that alias is the first priority. I just can't figure out why it's the _only_ option. I would think it's something to do with `tag-order`, like in the second example in the user guide section 6.4.2. However, I don't have anything like that set up for this context (`:completion::complete:-command-::`), or anything else it might inherit from. All of my completion-related settings are in this file on Github. Going up from there, you can see my zsh configuration in its entirety; however, I don't have anything set up for `:completion:` outside of this file, including in my `.zshrc`, so I doubt anything's overriding it. So, can someone please explain to me what to do to get the behaviour I want? FYI, I am using zsh with the Prezto framework, which I believe is irrelevant since the problem is entirely related to built-in zsh features and modules. * * * Some output: `cd<TAB>`: just changes `cd` to `nocorrect cd`, no menu.               $ cd<^D>     -- alias --     nocorrect cd          $ cd<^Xn>      -- external command --     cdbs-edit-patch    cd-fix-profile     cdiff                                    cd-create-profile  cd-iccdump                                                 -- builtin command --     cd      -- shell function --     cdls      -- alias --     cd      -- parameter --     CDPATH                                cdpath


title: What's the difference between Primary Selection and Clipboard Buffer?

text: I am tweaking in Webkit-browser land in **Linux** and I come accross the terms " _Primary Selection_ " and " _Clipboard selection or buffer_ " very often.   * I want to understand what are they and what difference do they have?   * Where does drag and drop pasting fit in?   * What is the job of `xclip` in this matter exactly?


title: Run wc and display only the word count

text: I have been trying to create a file called `~/dictwords.txt`, which contains the number of words found in the file `/usr/share/dict/words`. I already created the file then I removed it because I did it wrong I originally did the echo command. Then I tried this command and was so excited because I thought I was correct.               wc -w /usr/share/dict/words > ~/dictwords.txt      It's still wrong, I am supposed to have just the number, without a file name.


title: git, setting up remote repository without ssh

text: I want to set up a remote git repository on a openSuse machine, and I have the following question. Do I really need ssh on the machine, to set up the remote git repository? Initially is it possible to set it up without ssh, as I am new to Linux and git at this stage, and want to get the hang of the things before I go the ssh way? Would really appreciate your suggestions.


title: How to get new release updates for debian ( 7.1)

text: my sources.list file seems like this :               deb http://ftp.ca.debian.org/debian/ wheezy main     deb-src http://ftp.ca.debian.org/debian/ wheezy main      ... and executed apt-get update several times but linux version id is still 7 in /etc/os-release e.g               PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"     NAME="Debian GNU/Linux"     VERSION_ID="7"     VERSION="7 (wheezy)"     ID=debian     ANSI_COLOR="1;31"     HOME_URL="http://www.debian.org/"     SUPPORT_URL="http://www.debian.org/support/"     BUG_REPORT_URL="http://bugs.debian.org/"      I am looking for exact steps to get the latest updates(7.1)


title: Problem with installing fedora 17 in usb

text: I am trying to install Fedora 17 ( 32 bit Desktop Version ) on a usb which will be run on a Eee PC. My problem is that the usb is being made bootable by the software ( Universal USB Installer ) and when I boot from the usb, then prompt screen appears which asks me to select two options:- Fedora or troubleshooting. On selecting fedora, the screen goes completely blank and nothing happens for a long time. Nothing at all. Can you help me? I have searched on the net but couldn't to get any relevant information. Note:- My system is a ASUS 1GB RAM, 1.60 Intel Atom, UEFI system.


title: Modifier keys cannot be mapped to regular keys on USB keyboard with udev

text: Using an hwdb file, `/etc/udev/hwdb.d/99-keyboard.hwdb`, I can remap the left `Alt` key on my USB keyboard as the `Ctrl` key:               keyboard:usb:v*p*      KEYBOARD_KEY_700e2=leftctrl      This also works when I try to remap the left `Shift` key as the `Ctrl` key. But when trying to remap `Caps Lock` as the `Ctrl` key, it does not work:               keyboard:usb:v*p*      KEYBOARD_KEY_70039=leftctrl      Running `evtest` indicates that it should be working:               Event: time 1399438713.757082, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039     Event: time 1399438713.757082, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1     Event: time 1399438713.757082, -------------- SYN_REPORT ------------     Event: time 1399438713.885078, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0     Event: time 1399438713.885078, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0     Event: time 1399438713.885078, -------------- SYN_REPORT ------------      It also does not work on other non-modifier keys I tried, such as `Z`. I have also tried to map `Caps Lock` to the left `Ctrl` key on a non-USB keyboard, as such:               keyboard:dmi:bvn*:bvr*:bd*:svn*:pn*:pvr*      KEYBOARD_KEY_3a=leftctrl      This works perfectly. I tried udev versions 208 and 212 with a few different USB and non-USB keyboards, on Fedora 20 and on Arch Linux. How can I remap a non-modifier key such as `Caps Lock` to a modifier key such as `Ctrl` on a USB keyboard using **udev**? ## Update If the left `Ctrl` is itself remapped to another key, then the remapped key starts to work as the left `Ctrl` key. For example:               keyboard:usb:v*p*      KEYBOARD_KEY_700e0=grave      KEYBOARD_KEY_70035=esc      KEYBOARD_KEY_70039=leftctrl      KEYBOARD_KEY_70029=capslock      This behaviour is different from a non-USB keyboard, where both the remapped key and the original key may remain as a modifier.


title: Unix: how to read line's original content from file

text: I have a data file, the content is as follows:               department: customer service  section: A     department: marketing         section: A     department: finance           section: A      When I read each line, I would extract the department name using `cut` command. Unfortunately, the program will automatically `trim` all redundant space and thus I cut the department name incorrectly.               cat dept.dat | while read line     do         echo $line         echo $line | cut -c 12-29     done      e.g. the original line is:               department: marketing         section: A      While the program treats this line as:               department: marketing section: A      How can I read the line without trimming all the redundant space?


title: Problem with the installation of synaptic from command line

text: I can't install Synaptic package manager from command line. When I try to install it, it shows...               $ sudo apt-get install synaptic          Reading package lists... Done     Building dependency tree            Reading state information... Done     Package synaptic is not available, but is referred to by another package.     This may mean that the package is missing, has been obsoleted, or     is only available from another source          E: Package 'synaptic' has no installation candidate      Please help.


title: chkconfig does not display runlevel links correctly

text: I am using chkconfig to manipulate runlevel links on my Debian System (LSBInitScripts). I have noticed some inconsistencies, for example According to chkconfig, the script `umountiscsi.sh` is turned off in all runlevels:               chkconfig umountiscsi.sh --list     umountiscsi.sh            0:off  1:off  2:off  3:off  4:off  5:off  6:off      however, I can see the symlinks in `/etc/rc1.d/` and `/etc/rc6.d/`               ls -lAhF /etc/rc{1,6}.d/*umountiscsi.sh     lrwxrwxrwx 1 root root 24 Jul 23 13:38 /etc/rc1.d/K01umountiscsi.sh -> ../init.d/umountiscsi.sh*     lrwxrwxrwx 1 root root 24 Jul 23 13:38 /etc/rc6.d/K01umountiscsi.sh -> ../init.d/umountiscsi.sh*      the symlinks in `rc1.d` and `rc6.d` mean, that this script will be run in runlevel 1 and 6 (which is the way it is supposed to be run). But why does chkconfig not display it correctly ?


title: To which audio format can I convert aac lost-free with ffmpeg?

text: Since I did not manage to get the audio work with               ffmpeg -i video.mp4 -acodec copy -vcodec copy out.avi      I'm searching for an audio format to which I can convert `aac` lost-free. Does such an audio-format exist for this scope?


title: Why safecopy won't recover to /media/?

text: I tried to recover a HDD to a mounted device:               safecopy --stage1 /dev/sdb3 /media/Volume/abc      Than it says `Error opening destination: /media/Volume/abc is a directory` and If I run `safecopy` with               safecopy --stage1 /dev/sdb3 /dev/sdc1      it starts working. But after finishing this process I can't open the destinaton. It should simply copy all files from the bad HDD to the new HDD (not cloning, just copy the data) so what is the problem?


title: Having tmux load by default when a zsh terminal is launched

text: My current workflow is:   1. `CTRL`+`SHIFT`+`T` to launch a new terminal window. That starts a new zsh terminal.   2. Type `tmux` to start tmux. How can I have tmux load by default with a new terminal window?


title: How can I revert a chmod on the etc directory?

text: I accidentally executed the following command on the etc directory:               sudo chmod -R 700 /etc      I know that I have done something very wrong. My terminal now prints:               I have no name!@ubuntu: /$      How can I revert my etc directory to its earlier state? I tried changing the permissions but it is failing now. Also, it would be very helpful if someone can explain what actually went wrong when I executed that command on etc. It was only file permissions. Then why does the whole system seems completely blown up? Why is it that no login passwords are working now? I know that there is a file in etc directory that has to do with users. But how did changing permissions jeopardize everything? Some technical details about this would be very helpful.


title: How to use Public IP in case of Two ISP which difers from each other Pfsense

text: Please bare with my long explanation but this is important to explain the actual problem. Please also pardon my knowledge with PFsense as i am new to this. I have single PFSense box with 3 Ethernet adapter. Before moving to configuration for these, i want to let you know i have two Ethernet based Internet Leased Line Connectivity let's call them ISP A and ISP B. Then last inetrface is LAN which is connected to network switch. Typical network diagram * * * ISP A ----->                                           PFSense ----> Switch ---- > Servers      ISP B -----> * * * ISP A (Initially Purchased) * * * WAN IP:- 113.193.X.X /29 Gateway IP :- 113.193.X.A and other 4 usable public IP in same subnet(So the gateway for those IP are also same). ISP B (Recently Purchased) * * * WAN IP:- 115.115.X.X /30 Gateway IP :- 115.115.X.B and other 5 usable public IP in different subnet(So the gateway for those IP is different), for example if 115.119.X.X2 is one of the IP from that list then the gateway for this IP is 115.119.X.X1. * * * Configuration for 3 Interfaces * * * Interface : WAN Network Port : nfe0 Type : Static IP Address : 113.193.X.X /29 Gateway : 113.193.X.A Interface : LAN Network Port : vr0 Type : Static IP Address : 192.168.1.1 /24 Gateway : None Interface : RELWAN Network Port : rl0 Type : Static IP Address : 115.115.X.X /30 (I am not sure of the subnet) Gateway : 115.115.X.B * * * To use Public IP from ISP A i have done following steps * * * a) Created Virtual IP using either ARP or IP Alias. b) Using Firewall: NAT: Port Forward >> i have created specific natting from one public IP to my internal Lan private IP for example :- WAN TCP/UDP * * 113.193.X.X1 53 (DNS) 192.168.1.5 53 (DNS) WAN TCP/UDP * * 113.193.X.X1 80 (HTTP) 192.168.1.5 80 (HTTP) WAN TCP * * 113.193.X.X2 80 (HTTP) 192.168.1.7 80 (HTTP) etc., c) Current state for Firewall: NAT: Outbound is Manual and whatever default rule are defined for the WAN those are only present. d) If this section in relevant then for Firewall: Rules at WAN tab then following default rule has been generated.   * RFC 1918 networks * * * * * Block private networks    * Reserved/not assigned by IANA * * * * * * * * * To use Public IP from ISP B i have done following steps * * * a) Created Virtual IP using either ARP or IP Alias. b) Using Firewall: NAT: Port Forward >> i have created specific natting from one public IP to my internal Lan private IP for example :- RELWAN TCP/UDP * * 115.119.116.X.X1 80 (HTTP) 192.168.1.11 80 (HTTP) c) Current state for Firewall: NAT: Outbound is Manual and whatever default rule are defined for the RELWAN those are only present. d) If this section in relevant then for Firewall: Rules at RELWAN tab then following default rule has been generated.   * RFC 1918 networks * * * * *    * Reserved/not assigned by IANA * * * * * * * * * Last thing before my actual query is to make you aware that to have multiple Wan setup i have done following steps * * * a) Under System: Gateways at Groups Tab i have created new group as following MultipleGateway WANGW, RELWAN Tier 2,Tier 1 Multiple Gateway Test b) Then Under Firewall: Rules at LAN tab i have created a rule for internal traffic as follows   * LAN net * * * MultipleGateway none c) This setup works if unplug first ISP traffic start routing using ISP 2 and vice-versa. * * * Now my main query and problem is i am not able to use public IP address allocated by ISP B, i have tried many small tweaks but not successful in anyone. The notable difference between the two ISP is a) In case of ISP A there Public usable IP address are on same subnet so the gateway used for the WAN ip is same for the other public IP address. b) In case of ISP B there public usable IP address are on different subnet so the obvious the gateway IP for them is different from WAN gateway's IP. Please let me know how to use ISP B public usable IP address, in future also i am going to rely for more IPs from ISP B only.


title: How to create a list of installed packages for easy/automatic reinstall after disk is formatted

text: I'll change my system from 32 bits to 64 bits, and will be the same I had before, Debian Squeeze, but I do not want to lose the programs I installed before, because I do not remember the name of them all. So I wanted a command to do this for me, save the name of all the programs I installed on a file, but not the standard programs that came with the system, and when I'm using the other system I would mention the name of the file and your directory for everything to be installed automatically. One more question: is it possible to do this with programs that were installed manually with `dpkg-i package.deb`? If so, how can I do that?


title: Plan 9 from Bell Labs book

text: I would really like to obtain a book on Plan 9's design and ethos. Do such things exist? Anybody have a recommendation? (Asking here on the basis that Plan 9 was once meant to be Unix's successor, AIUI)


title: CGroup Processes Not Terminated even when main process has been killed through Systemctl stop command

text: I am running `systemctl stop process` command for some process. Please find the output for `systemctl status process` below:               Loaded: loaded     Active: deactivating (stop-sigterm)     CGroup: name=systemd:process                       ├ 15768 process1                       ├ 15769 process2                       └ 15822 /bin/systemctl restart named.service      Even after running systemctl stop process, the status of Main Process remains "deactivating" only. As per the default behavior, once the main process has exited, the processes in the cgroup should have been killed. Can someone please provide some hint to resolve this issue. Thanks


title: Iptables not forwarding. Input instead

text: I have set up iptables on my ubuntu headless server:               iptables -S          -P INPUT ACCEPT     -P FORWARD DROP     -P OUTPUT ACCEPT     -A INPUT -s 10.1.3.90/32 -i eth0 -j LOG --log-prefix "INPUT: "     -A INPUT -i eth1 -j ACCEPT     -A INPUT -i ppp0 -j ACCEPT     -A FORWARD -s 10.1.3.90/32 -i eth0 -j LOG --log-prefix "FORWARD: "     -A FORWARD -i eth0 -j ACCEPT     -A FORWARD -i eth1 -o eth0 -j ACCEPT     -A FORWARD -i ppp0 -o eth0 -j ACCEPT          iptables -S -t nat          -P PREROUTING ACCEPT     -P INPUT ACCEPT     -P OUTPUT ACCEPT     -P POSTROUTING ACCEPT     -A PREROUTING -s 10.1.3.90/32 -j LOG --log-prefix "ROUTE: "     -A PREROUTING -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT     -A PREROUTING -i eth0 -p tcp -m tcp --dport 11108 -j DNAT --to-destination 169.254.1.2:11108     -A PREROUTING -i eth0 -p udp -m udp --dport 11108 -j DNAT --to-destination 169.254.1.2:11108     -A PREROUTING -i eth0 -p tcp -m tcp --dport 5555 -j DNAT --to-destination 169.254.1.2:5555     -A PREROUTING -i eth0 -j DNAT --to-destination 169.254.2.2     -A POSTROUTING -o eth0 -j MASQUERADE     -A POSTROUTING -s 169.254.1.2/32 -o eth0 -j MASQUERADE     -A POSTROUTING -s 169.254.2.2/32 -o eth0 -j MASQUERADE      When i send UDP packet to port 11108 it should be routed to ppp0 169.254.1.2:11108 and FORWARD rule should apply. instead a INPUT rule is applied and packet is not routed. this is the log from kernel. there is no FORWARD:               Jun 20 10:58:51 ubuntu kernel: [  337.871043] INPUT: IN=eth0 OUT= MAC=00:1c:42:02:04:dd:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.117 LEN=52 TOS=0x00 PREC=0x00 TTL=128 ID=22127 PROTO=UDP SPT=11108 DPT=11108 LEN=32      Jun 20 10:58:53 ubuntu kernel: [  339.865420] INPUT: IN=eth0 OUT= MAC=00:1c:42:02:04:dd:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.117 LEN=68 TOS=0x00 PREC=0x00 TTL=128 ID=22484 PROTO=UDP SPT=11108 DPT=11108 LEN=48      Jun 20 10:58:55 ubuntu kernel: [  341.864446] INPUT: IN=eth0 OUT= MAC=00:1c:42:02:04:dd:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.117 LEN=68 TOS=0x00 PREC=0x00 TTL=128 ID=22818 PROTO=UDP SPT=11108 DPT=11108 LEN=48      Jun 20 10:58:57 ubuntu kernel: [  343.707469] ROUTE: IN=eth0 OUT= MAC=ff:ff:ff:ff:ff:ff:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.255 LEN=229 TOS=0x00 PREC=0x00 TTL=128 ID=23133 PROTO=UDP SPT=138 DPT=138 LEN=209      Jun 20 10:58:57 ubuntu kernel: [  343.863994] INPUT: IN=eth0 OUT= MAC=00:1c:42:02:04:dd:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.117 LEN=68 TOS=0x00 PREC=0x00 TTL=128 ID=23266 PROTO=UDP SPT=11108 DPT=11108 LEN=48      Jun 20 10:58:59 ubuntu kernel: [  345.877465] INPUT: IN=eth0 OUT= MAC=00:1c:42:02:04:dd:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.117 LEN=52 TOS=0x00 PREC=0x00 TTL=128 ID=23684 PROTO=UDP SPT=11108 DPT=11108 LEN=32      Jun 20 10:58:59 ubuntu kernel: [  345.879215] INPUT: IN=eth0 OUT= MAC=00:1c:42:02:04:dd:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.117 LEN=68 TOS=0x00 PREC=0x00 TTL=128 ID=23707 PROTO=UDP SPT=11108 DPT=11108 LEN=48      Jun 20 10:59:00 ubuntu kernel: [  346.010347] ROUTE: IN=eth0 OUT= MAC=ff:ff:ff:ff:ff:ff:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.255 LEN=78 TOS=0x00 PREC=0x00 TTL=128 ID=23798 PROTO=UDP SPT=137 DPT=137 LEN=58      Jun 20 10:59:00 ubuntu kernel: [  346.759893] ROUTE: IN=eth0 OUT= MAC=ff:ff:ff:ff:ff:ff:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.255 LEN=78 TOS=0x00 PREC=0x00 TTL=128 ID=23811 PROTO=UDP SPT=137 DPT=137 LEN=58      Jun 20 10:59:01 ubuntu kernel: [  347.509887] ROUTE: IN=eth0 OUT= MAC=ff:ff:ff:ff:ff:ff:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.255 LEN=78 TOS=0x00 PREC=0x00 TTL=128 ID=23944 PROTO=UDP SPT=137 DPT=137 LEN=58      Jun 20 10:59:01 ubuntu kernel: [  347.878185] INPUT: IN=eth0 OUT= MAC=00:1c:42:02:04:dd:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.117 LEN=68 TOS=0x00 PREC=0x00 TTL=128 ID=24086 PROTO=UDP SPT=11108 DPT=11108 LEN=48      Jun 20 10:59:01 ubuntu kernel: [  347.881900] INPUT: IN=eth0 OUT= MAC=00:1c:42:02:04:dd:00:1c:42:d7:b0:24:08:00 SRC=10.1.3.90 DST=10.1.3.117 LEN=52 TOS=0x00 PREC=0x00 TTL=128 ID=24109 PROTO=UDP SPT=11108 DPT=11108 LEN=32


title: Debian 7 remote access - grey background

text: I Have got problem. After installing gnome/kde and vnc I have a problem while opening remote vnc- viewer. Grey background occeress http://i.imgur.com/QomWGIR.png What is the problem with it? Debian 7/64bit/wheezy


title: Find any lines exceeding a certain length

text: Is it possible to find any lines in a file that exceed 79 characters?


title: Unable to concatenate files with find ./subdir/* -print0 | sort | xargs -0 cat > merge.txt

text: I am trying to concatenate thousands of files that result from processing the pieces output by `split` with               find ./subdir/* -print0 | sort | xargs -0 cat > full_merge.txt      The files under `subdir` are:               something.foo.aaaaa.output     something.foo.aaaab.output     something.foo.aaaac.output          ...      But I get `File name too long` Why?


title: audit activity on abstract domain sockets?

text: Using the audit system (`auditd`, `auditctl`) on Linux, is it possible to log connections to Unix domain sockets on the abstract namespace (or more exactly to filter them based on the (abstract) _path_ )? For instance, I can log connections to the X server on `:0` via `/tmp/.X11-unix/X0` with:               auditctl -a exit,always -F arch=b64 -S connect -F path=/tmp/.X11-unix/X0      But how would I do the same with connections on the abstract namespace (`@/tmp/.X11-unix/X0`)?


title: What is the relationship between SLED and OpenSUSE?

text: I have read that OpenSUSE is to "SUSE Linux Enterprise Desktop" what Fedora is to Red Hat Enterprise Linux, but is there a document that explains this in more detail?   For example, from what version of OpenSuse is SLED 11 built? What are the update policies of the two distros? (Edit: Someone asked something similar here)


title: Silencing all stdout during bootup

text: I am looking for a completely silent bootup of my Ubuntu Server 13.04 installation (dumped to file rather than stdout). What I want is the screen to be blacked out (eventually replaced with a logo) until my system logs in. I have silenced the commands in bash, but it looks like I still get commands coming from 'Upstart' and possibly some other services.


title: GNU toolchains against GCC SVN?

text: Is there anything like CodeSourcery which provides prebuilt binaries for arm toolchains built against gcc-svn. http://elinux.org/Toolchains#Prebuilt_toolchains Otherwise, a working instruction for successfully building against gcc-svn would be fine.


title: How can I display syntax highlighting on a file?

text: Is there a variant of `cat` that outputs syntax-highlighted lines of code when used on a source file? An idea: maybe `vi[m]` or another editor can be asked to dump the syntax- highlighted contents of said files to `stdout` and exit immediately?


title: How to `cat` file with syntax highlight?

text: In my hello.c: > /* Hello World program */ > > #include > > main() { >   >   >     printf("Hello World"); >   > > } How can i `cat` this file on terminal with syntax highlight?


title: Execute on the basename of a find command

text: Suppose I have a directory structure as follows               test     test/a     test/b      Now I want to execute a command, such that in the `.` folder I can execute a command on the basename of the files `a` and `b`. So basically, I want something like this, which I naively tried               find test -type f -exec touch `basename {}` \;      Only, this does not result in empty files `a` and `b` in the parent directory. Suppose that my touch command can only take a single argument. This will result in a directory structure like this               a     b     test     test/a     test/b      I know how to do this in a bash script, but I am interested in single command solution.


title: Replacing backslashes with commas in Bash

text: I tried writing a script in which I am reading through a file line-by-line. I am supposed to replace a backslash (\) with a comma (,). The input file is as follows:               1,2,3,WORKSTATION1\A,5     1,2,3,WORKSTATION2\B,5     1,2,3,WORKSTATION1\C,5     1,2,3,WORKSTATION1\D,5     1,2,3,WORKSTATION1\E,5     1,2,3,WORKSTATION1\F,5     1,2,3,WORKSTATION1\G,5      The piece of code I've written is as follows:               #!/bin/bash          cat $1 | while read -r line     do     ln=$(echo $line | xargs | sed 's/\\/,/g' )     echo $ln     done          echo Done!      When I run `./script.sh file.csv`, I am getting following output:               1,2,3,WORKSTATION1A,5     1,2,3,WORKSTATION2B,5     1,2,3,WORKSTATION1C,5     1,2,3,WORKSTATION1D,5     1,2,3,WORKSTATION1E,5     1,2,3,WORKSTATION1F,5     1,2,3,WORKSTATION1G,5     Done!      Whereas, I am expecting an output as follows:               1,2,3,WORKSTATION1,A,5     1,2,3,WORKSTATION2,B,5     1,2,3,WORKSTATION1,C,5     1,2,3,WORKSTATION1,D,5     1,2,3,WORKSTATION1,E,5     1,2,3,WORKSTATION1,F,5     1,2,3,WORKSTATION1,G,5     Done!      I also tried replacing `sed 's/\\\/,/g'` with `tr "\\\" ","`, but it is not helping. Any modifications needed?


title: End process from another SSH window

text: I forgot to use `screen` and I have a task that has been running for quite some time, and I do not want to lose the saved data. Basically `Ctrl``c` will end the task and save the data if I am on the same terminal session, is there a way to stop it in different SSH window? I do not have access to the same terminal window at the moment.


title: How to add GTK Theme Preference on Gnome 2 using FreeBSD

text: GTK Theme Preferences is available in the Shimmer Project PPA for Ubuntu 12.04 Precise Pangolin and 12.10 Quantal Quetzal. Add the PPA and install it using the following commands:               sudo add-apt-repository ppa:shimmerproject/ppa     sudo apt-get update     sudo apt-get install gtk-theme-config      The commands are for Linux system and I have a FreeBSD System . So my question is how can I istall on FreeBSD ?


title: Arch Linux installation on VMWare will not proceed

text: I'm trying to install Arch Linux 2013.14.01 on VMWare Player, but after I select "Boot Arch Linux (i686)", it goes directly to:               archiso login: root (automatic login)      In the tutorials I've seen they go directly to the blue setup screen. Why isn't that happening for me?


title: mount.cifs fails while smbclient succeeds

text: I'm trying to mount a NetApp CIFS share to one of our servers and I keep getting "Permission Denied" printed to stderr and `NT_STATUS_WRONG_PASSWORD` printed to the running `dmesg`.               root@xxxehpvld05 ~ $ mount.cifs -vv //zhp-nas.xxx.com/perspectives /mnt/secure/cifs -o credentials=/etc/cifs.creds     mount error(13): Permission denied     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)     root@xxxehpvld05 ~ $ dmesg | tail     CIFS VFS: cifs_mount failed w/return code = -13     Status code returned 0xc000006a NT_STATUS_WRONG_PASSWORD     CIFS VFS: Send error in SessSetup = -13     CIFS VFS: cifs_mount failed w/return code = -13     Status code returned 0xc000006a NT_STATUS_WRONG_PASSWORD     CIFS VFS: Send error in SessSetup = -13     CIFS VFS: cifs_mount failed w/return code = -13     Status code returned 0xc000006a NT_STATUS_WRONG_PASSWORD     CIFS VFS: Send error in SessSetup = -13     CIFS VFS: cifs_mount failed w/return code = -13      The `smbclient` command, however works without issue, using the same exact credentials file:               root@xxxehpvld05 ~ $ smbclient -L //zhp-nas.xxx.com/perspectives -A /etc/cifs.creds     Domain=[XXX] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]                  Sharename       Type      Comment             ---------       ----      -------             IPC$            IPC       Remote IPC             ZHPSubmit-dev   Disk         [...snip...]      It seems like if one works the other should as well especially since the credentials file also specifies the domain name.


title: Configuring networked printer to archive print jobs

text: Our existing infrastructure has a shared printer running on a windows machine. It may be upgraded to a real network tcp/ip based printer in the near future. How can I make it automatically keep a copy of whatever it is printing as a pdf? Maybe use cups on a Linux machine, which will act as the print server, and create two print jobs: one to the pdf printer, the other to the network printer? Something like that? Is there something easily available or a bunch of things I can glue together to make this work?


title: How to split the output and store it in an array?

text: This is the output:               3,aac-lc, 93.8, aaclc, 77.3, h.264, 1024.6, h.264, 1029.1, 31, 31, 0,0,0.000000,31,31,0,0,0.000000,7,0,0,0.000000,30,1280 720,10,0,0,0.000000,30,1280 720      I tried with 2 scenario:   1. Storing in an array                @arr=split(',',$stats);       echo "statistics: $stats"        2. Storing in a variable               echo $stats | cut -d ',' -f | read s1      echo $s1      But neither scenario is working.


title: How to obtain inverse behavior for `tail` and `head`?

text: Is there a way to `head`/`tail` a document and get the reverse output; because you don't know how many lines there are in a document? I.e. I just want to get everything but the first 2 lines of `foo.txt` to append to another document.


title: How to run a command when a directory's contents are updated?

text: There is a directory A whose contents are changed frequently by other people. I have made a personal directory B where I keep all the files that have ever been in A. Currently I just occasionally run rsync to get the files to be backed up from A to B. However I fear the possibility that some files will get added in A, and then removed from A before I get the chance to copy them over to B. What is the best way to prevent this from occurring? Ideally i'd like to have my current backup script run every time the contents of A get changed.


title: Run script when file is created

text: How do I run a script when a file is created in a certain directory? I am using an IDE to write a program which is run on a different computer. Every time the program is compiled it is copied onto the other computer to /tmp/myFile. The script sets up and runs the program but it I have to run it manually unless it listens for the file creation.


title: Is it possible triggering a script with a change of amount of files in a directory?

text: Is it possible to create some kind of directory watcher and trigger a script when the folder is not empty? I have a CentOS machine with jenkins CI on it. i would like to create a job that will move all build artifacts to my web server folder each successful build. is it possible? I want to avoid timed triggered cronjob.


title: FTP Upload Hook

text: > **Possible Duplicate:**   >  How to run a command when a directory's contents are updated? I need to be notified and perform other tasks when a file is uploaded onto my server. Is there any method/system call that will be triggered or anything that I can hook onto? I'm using vsftpd as my ftp server.


title: Running a bash script each time a file is uploaded?

text: I have an FTP server (Debian) setup where users send JPG images. I need a process running on the background that every time a picture is sent via FTP a bash script is executed for generating thumbnail files for each image uploaded. I already have the script that generates the thumbnail, the problem is it needs to be executed manually, but what I want is the script to be executed each time an image file is uploaded. How can this work?


title: How to monitor specific files in unix

text: > **Possible Duplicate:**   >  How to run a command when a directory’s contents are updated? Any one know how to monitor files in Unix. I want to take backup of that files when its modified and store it in another server.


title: Why Ubuntu and Windows show different amount of free space

text: For all my NTFS partitions, Ubuntu always shows 1~2GB more free space than Windows. What's the cause of this? Will some of my files be overwritten just because Ubuntu thinks there is more free space than there actually is?


title: Some files under `/` are owned by UID `501`, is this dangerous?

text: I just noticed that that the directory `/usr` was owned by UID `501` on my system. Such a user does not exist on my system, as verified by looking at `/etc/passwd`. Have I suffered a security breach, or is there some more normal reason for this to happen?


title: bashrc that calls other bashrc depending on linux distro

text: I login to a system that reads my bashrc file and loads some software ready to use. I'd like to load a given bashrc file depending on the linux system that I am logging into. Specifically, if I am logging into a system with centOS 6, I'd like to load my centos6 bashrc:               cat /etc/*-release     CentOS release 6.4 (Final)     LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch     CentOS release 6.4 (Final)     CentOS release 6.4 (Final)      and if I am logging into a system with centOS 5.7, I'd like to load my centOS 5.7 bashrc.               cat /etc/*-release     CentOS release 5.7 (Final)      I am thinking along the lines of having 3 bashrc files in my home dir: .bashrc with an if condition such that if finds that I was logging in into centOS6 would run,               source ~/.bashrc.centos6      and an else, such that if finds that I was logging in into centOS5.7 would run,               source ~/.bashrc.centos5      So I guess my .bashrc code would look kind of like this:               if cat /etc/*-release == "CentOs release 6.4"        source ~/.bashrc.centos6     elif cat /etc/*-release == "CentOs release 5.7"        source ~/.bashrc.centos5      I am still new to bash scripting so I have no idea how I'd do that and if its a god way to go to achieve my goal.


title: Midnight Commander displays 'Unselect' dialog when I press F4 to edit a file

text: When I press F4 in Midnight Commander, I expect it to edit a file. It displays the 'Unselect' dialog instead. What could have caused it and how can I fix it? This may or may not be caused by my attempts to change the editor to `nano`


title: Why is the Debian package I've created for a single Python script empty?

text: I have a quite simple Python project that might be very useful for some people. So I thought about packaging it. The project is called `maptool` and is a tool that allows people who have Panasonic cameras to add GPS information to it (see repository). I did the following steps according to this video:   1. Created a folder `panasonic-maptool-1.0` with all the contents (`maptool.py`, a desktop launcher and an icon).   2. Created `.tar.gz` of this folder   3. Put the `.tar.gz` into the `panasonic-maptool-1.0` folder.   4. Run `dh_make -c mit -f panasonic-maptool-1.0.tar.gz` in that folder to create a "single binary package".   5. Inside of the `/debian` folder, I've adjusted `rules`, `control` and `copyright`.   6. Run `lumix_map_tool/panasonic-maptool-1.0$ fakeroot dpkg-buildpackage -F` But when I look at the package that was created, it is empty. Can anybody please explain why? All sources for the package creation are in the repository. One thing where I suppose I could have made an error is the rules file:               #!/usr/bin/make -f          icon = $(CURDIR)/maptool-icon.png     script = $(CURDIR)/maptool.py     launcher = $(CURDIR)/maptool.desktop          DEST1 = $(CURDIR)/debian/maptool/usr/share/maptool     DEST2 = $(CURDIR)/debian/maptool/usr/share/applications          build: build-stamp          build-stamp:         dh_testdir         touch build-stamp          clean:         dh_testdir         dh_testroot         rm -f build-stamp         dh_clean          install: build clean $(icon) $(script) $(launcher)         dh_testdir         dh_testroot         dh_clean -k         dh_installdirs              mkdir -m 755 -p $(DEST1)         mkdir -m 755 -p $(DEST2)              install -m 666 $(icon) $(DEST1)         install -m 777 $(script) $(DEST1)         install -m 777 $(launcher) $(DEST2)          # Build architecture-independent files here.     binary-indep: build install         dh_testdir         dh_testroot         dh_installchangelogs         dh_installdocs         dh_installexamples     #   dh_installmenu     #   dh_installdebconf     #   dh_installlogrotate     #   dh_installemacsen     #   dh_installpam     #   dh_installmime     #   dh_installinit     #   dh_installcron     #   dh_installman     #   dh_installinfo     #   dh_undocumented         dh_installman         dh_link         dh_compress         dh_fixperms         dh_installdeb     #   dh_perl         dh_gencontrol         dh_md5sums         dh_builddeb          # Build architecture-dependent files here.     binary-arch: build install     # We have nothing to do by default.          binary: binary-indep binary-arch     .PHONY: build clean binary-indep binary-arch binary install


title: unable to mount smb share in fedora 14 through nautilus connect to server

text: I'm unable to mount smb share on my university network. Trying through the nautilus connect to server dialog just brings the password dialog up repeatedly. I'm able to mount the share using mount.cifs as root, but it'd be great to mount it through nautilus as well. More specifically, no matter how many times I try, I get the dialog telling me: > Password required for share courses on courses.its.carleton.edu


title: How to remove multiple lines per occurrence in a file?

text: Say I have this 857835 line file, containing stuff like this:               a1     rubbish1     rubbish2     rubbish3     rubbish4     a1     rubbish5     rubbish6     rubbish7     rubbish8      And I wish to remove all occurences of `a1` and the next line (`rubbish1` and `rubbish5` in this example). How do I do it? I've tried `grep 'a1' -v -A1` to no avail, and my sed skillz are not really great :} My Google-fu has not been able to help me this time, someone please help!


title: re-entrency of interrupts in Linux

text: I was reading "Linux device drivers, 3rd edition" and don't completely understand a part describing interrupt handlers. I would like to clarify:   * are the interrupt handlers in Linux nonpreemptible?   * are the interrupt handlers in Linux non-reentrant? I believe I understand the model of Top/Bottom halves quite well, and according to it the interrupts are disabled for as long as the TopHalf is being executed, thus the handler can't be re-entered, am I right? But what about high priority interrupts? Are they supported by vanilla Linux or specific real-time extensions only? What happens if a low priority interrupt is interrupted by high priority one?


title: Does LVM impact performance?

text: I have to migrate a few servers to Linux, and one important aspect that I need to evaluate is that my new host system must have elastic storage capacity. Naturally, doing some basic research, I came across LVM. Is there any performance penalty for using lvm? If so, how can I measure it? What I am considering right now is to have Linux as a host OS with LVM and virtualized Linux boxes running on top of it (should I add LVM on the guest OS as well?).


title: shell scripts that respond to console output

text: _Disclaimer:: I am not an active shell scripter_ How does one create a script that responds to console output? For instance, I'm trying to setup a cron that periodically svnsync 's changes to my repository to a backup server every midnight. The problem is, in order to sync, it prompts for authorization credentials. svnsync sync accepts no options to specify a login thus a simple cron command is out. I believe I can launch a script but I'm trying to figure out how to make it respond to console output. For instance:               ken@server:~$ svnsync sync https://svn3.backup.net/svn/mirror     Authentication realm: <https://svn3.backup.net/svn/mirror:443> backup.net Subversion Backup     Password for 'ken':     ***<send return key>***     Username:***<specify backup.net username>***     Password for '<the name>':***<specify password for username>***     <It proceeds to check out>      where `***< message >***` is the action I want the script to respond to.


title: CentOS 5.5 Install Customization

text: I'm having a frustrating time with customizing my initial CentOS 5.5 installation. I want to have a specific set of the packages installed (e.g. I want Java and httpd but not OpenOffice or NewsServer) but each time I carefully go through all the customization screens on installation it seems to somewhat randomly select and deselect other options. I'm trying to write up a repeatable step-by-step doc but something isn't right. I've tried picking just "Desktop - Gnome" or "Server GUI" or even none of them. Then I choose the "Customize now" option and go through each of the packages that I want. What's odd is what comes out after the reboot is different each time. Does it matter which default package group I choose if I'm going to customize the lists? Another oddity happens if I try to customize after the fact. For instance, if I try to just remove OpenOffice, it removes Gnome as a side-effect. I didn't uncheck the Gnome box but it appears that since OpenOffice is dependent upon Gnome, it gets removed as well. This implies that I need to do a minimal install and build it up as needed. Am I missing some core metaphor that the installer is using? I'm using the exact same DVD image each time so I'm confused why I'm having such different results. Also I'm using the graphical installation mode. Ideally I'd be able to create a kickstart config from a good install. Any pointers would help.


title: Delete files of certain size range

text: I want to delete files which size is between certain values. For example I have the following list of files:               -rw-r--r-- 1 smsc sys  558 Apr 30 13:07 stats.sfe.1.20120430130513.xml.Z     -rw-r--r-- 1 smsc sys  388 Apr 30 15:32 stats.sfe.1.20120430153013.xml.Z     -rw-r--r-- 1 smsc sys  386 Apr 30 15:36 stats.sfe.1.20120430153513.xml.Z     -rw-r--r-- 1 smsc sys  389 Apr 30 15:42 stats.sfe.1.20120430154013.xml.Z     -rw-r--r-- 1 smsc sys  390 Apr 30 16:02 stats.sfe.1.20120430160013.xml.Z     -rw-r--r-- 1 smsc sys  385 Apr 30 16:12 stats.sfe.1.20120430161013.xml.Z      From the above list, I want to delete only the files which size varies between **386b** and **390b**. I know that I can use the following command to delete files which size exceed certain `<size>`:               find . -size +<size>-delete      But how can I add one more boundary for files which size is less than a given value?


title: Any tool for inspecting GTK3 elements?

text: gtkparasite is great for GTK2, but unfortunatelly it can't do GTK3 applications. Is there any alternative?


title: How to install .tar.bz and .tar.bz2 packages?

text: I would like to know how to install .tar.bz and .tar.bz2 packages on Debian, please give me a complete explanation.


title: Linux workstations intermittently lose internet connections

text: About three months ago, a strange phenomenon started happening in our network. Firstly, let me describe the network layout (only the details which I think I'll be allowed to divulge):   * We have a router which establishes a VPN connection over the internet to our client's network.    * Checkpoint is used for the VPN connection   * I don't know the exact model of the router. But our IT admins refer to it as the "Nokia firewall"   * Workstations set their gateway to the router's IP address and that gives them both internet and VPN access. So there's the problem: About four months ago, Linux workstations intermittently lose internet and VPN connections. This does not happen to Windows workstations. The problem appears to only plague the ones running on Linux. We can see that packets gets sent to the gateway but no response is received. This lasts for about 3-5mins and then internet and VPN connectivity is reestablished. We fail to see any pattern on the occurrence. The said problem reoccurs at intervals ranging from a few seconds up to a few hours. To rule-out the Linux workstations as being the problem, we tried switching a couple of them to a different gateway. A plain router (let's call it GateWay-B). The problem does not occur when a different gateway is used. One thing I did was to setup the IP tables so that:   * All packets bound to workstations over the VPN, use the "Nokia/checkpoint" gateway   * All other packets use another gateway; GateWay-B. With this, I no longer loose internet connection. However, the VPN connection remains intermittent. Question: Does anyone have an idea what the problem is? Is it possible for a gateway to determine the OS where an incoming packet came from?


title: recover mysql databases after reinstall debian

text: I've recently reinstalled my Debian server but forgot to backup mysql databases which were in folder /var/lib/mysql. I need to recover them and tried to use PhotoRec but I can't find the mysql databases there. I have shutdown my server for the moment so it doesn't deteriorate the recovering process. Is there any better way to do that, perhaps something with more chance of success? Thank you so much!!


title: How to trace calls to library from library?

text: I have an program that calls libcurl, and libcurl calls libgssapi_krb5. If I want to debug calls to libcurl, then ltrace works. But now I want to debug calls to libgssapi_krb5, then `ltrace my_program` does not give out anything.


title: How to tweet using terminal?

text: I would like to tweet a message using terminal. I tried something like:               curl -u 'TwitterUsername':'TwitterPassword' -d status=”Your Message Here” https://twitter.com/statuses/update.xml      but seems this isn't working anymore. I get a error like this one:               <?xml version="1.0" encoding="UTF-8"?>         <errors>         <error code="53">Basic authentication is not supported</error>     </errors>      So, how could we tweet from the terminal? PS.: my motivation to this is because I use the Yakuake terminal a lot, and it would be awesome to tweet from there.


title: How to test that X11Forward is working or not?

text: X11Forwarding yes      was enabled and sshd reloaded. But how can I test that X Forwarding works or not? xclock is not installed. Perl and python-base is installed, are there any tricks ex.: pop-up a GUI window with Perl? 'echo $DISPLAY' doesn't displays anything.


title: Binding single key (such as 'F1') to multiple keys (such as 'Ctrl+C') in Gnome

text: I know how to map a single key to a command using the gconf settings. I also know how to map a single key to another key (`F1` -> `ctrl`) using Xmodmap. My question is how can I map a single key such as `F1` to a multi-key operation such at `ctrl`+`c`. I am basically trying to set up a single key to simulate copy. I can think of two ways to possibly do this:   * Map single key to multiple keys so that when the single key is pressed it is essentially pressing `ctrl`+`c`.   * Use gconf settings to execute the copy “command” upon the single key press. I am not sure if there is a “command” to copy text.


title: Preventing script execution and file downloads in a directory?

text: I have a directory on my website where I'm storing files uploaded by users. I use a whitelist for uploaded file types and also save the files with hashed names, but from what I've read another good security precaution is to stop script execution in the directory. I also want to prevent files in the directory from being directly accessed since I don't want users to be able to download files that aren't theirs. My server runs Linux with Apache. Is the following .htaccess file correct for what I'm trying to achieve?               order deny,allow     deny from all     <FilesMatch .php>         SetHandler None     </FilesMatch>


title: RHEL7 text-only installation

text: I want to install RHEL7 in purely text-only mode. Although I added the `inst.text` and `inst.cmdline` kernel option (since I want it to install from kickstart) it still requires more than a console as it is pushing its output through the framebuffer. Is there a way to force it to disable the framebuffer entirely and have everything visible to a plain console in text on Red Hat 7? There seems to be no `nofb` option.


title: Courier IMAP - Account's mailbox directory is not owned by the correct uid or gid

text: so i poked around and found out that `DEFDOMAIN="@domain.se"` is messing things up, so i removed that from `/etc/courier/imapd` and i got to the point where `SMTP` work and i get this from the `IMAP`:               Jul  2 13:23:10 HOST authdaemond: Authenticated: sysusername=anton, sysuserid=<null>, sysgroupid=20001, homedir=/storage/vmail/anton, address=anton, fullname=Anton, maildir=<null>, quota=<null>, options=<null>     Jul  2 13:23:10 HOST authdaemond: Authenticated: clearpasswd=MyPasswd, passwd=$3e$04$AC1c10x0A3etWCJFrla.Rl2sevNhq24yXYxrq8IN7mEeGI20.     Jul  2 13:23:10 HOST imapd-ssl: anton: Account's mailbox directory is not owned by the correct uid or gid      But i'm not sure why because:               # ls -l /storage/vmail/     -rw-r--r--  1 vmail  vmail   22 Mar 13 01:06 .Xdefaults     -rw-r--r--  1 vmail  vmail  773 Mar 13 01:06 .cshrc     -rw-r--r--  1 vmail  vmail  398 Mar 13 01:06 .login     -rw-r--r--  1 vmail  vmail  113 Mar 13 01:06 .mailrc     -rw-r--r--  1 vmail  vmail  218 Mar 13 01:06 .profile     drwx------  2 vmail  vmail  512 Jun 30 10:44 .ssh     drwxr-xr-x  3 anton  anton  512 Jun 30 10:44 anton      my `/etc/courier/imapd` says:               MAILDIRPATH=/storage/vmail      But i've also tried:               MAILDIRPATH=Maildir      And `/etc/passwd` states:               # cat /etc/passwd | grep anton                                                                                anton:*:20001:20001:Anton:/storage/vmail/anton:/sbin/nologin      Where am i going wrong?


title: Reversing the value key pairs of array using sed or pattern replacement or brace expansion?

text: #!/bin/bash     arr=(a b c d)     declare -A brr     for i in ${!arr[@]}     do       brr[${arr[$i]}]=$i     done     echo ${brr[@]}                             #0 1 2 3      Is there any way to reverse the values and key pairs using `sed` or any other command. I think I would have to just **do some pattern change of text instead of using bash loops** , perhaps something like.               brr=($(echo ${!arr[@]} | sed commands))      so that the new array becomes like `brr=([a]=0 [b]=1 [c]=2 [d]=3)` if I use brace expansion it can come up to this point:               #!/bin/bash     arr=(a b c d)     declare -A brr     var=${arr[@]}     var=${var// /,}     brr=$(eval echo [{$var}]=)     echo $brr                              #[a]= [b]= [c]= [d]=      now I just need to add the keys 0,1,2,3 **EDIT** : I was able to do it but can I make it shorter and simpler especially the `sed` lines               #!/bin/bash     arr=(a b c d)     declare -A Rev     var=${arr[@]}                    #var is equal to a b c d     var=${var// /,}                  #var is equal to a,b,c,d after adding , for space     brr=$(eval echo Rev[{$var}]=)    #brr equal to Rev[a]= Rev[b]= Rev[c]= Rev[d]=          #NOW I NEED TO CHANGE      #Rev[a]= Rev[b]= Rev[c]= Rev[d]=     #to     #Rev['a']=0;Rev['b']=1;Rev['c']=2;Rev['d']=3          r="$(echo $brr |      sed 's/ /\n/g' | sed '/./=' | sed '/./N; s/\n//' |        sed 's/\(^[0-9]\{1,\}\)\(.*\)/\2$(echo \1 - 1 | bc)/' | tr '\n' ';' |                                                               sed "s/\[/\[\'/g;s/\]/\'\]/g")"     #pipe the output of echo(Rev[a]= Rev[b]= Rev[c]= Rev[d]=) to sed     #convert space to newlines     #add line numbers     #put the line numbers adjacent to the values Rev[a],Rev[b],Rev[c],Rev[d] like     # 1rev[a]=     # 2Rev[b]=     # 3Rev[c]=     # 4Rev[d]=     #change 1Rev[a]= format to Rev[a]=1     #convert newlines to ; looking like Rev[a]=0;Rev[b]=1;Rev[c]=2;Rev[d]=3     #put quotes around the keys Rev['a']=0;Rev['b']=1;Rev['c']=2;Rev['d']=3          eval $r     echo ${Rev[@]}      #0 1 2 3     echo ${!Rev[@]}     #a b c d


title: How can I mimic `sudo su - user` in a script?

text: I need to deploy my app to server called `lovelyplace` by a Fabric script. Unfortunately, the server's setup is horrible, but I can do nothing about it - I have to live with it. There is one non-root user I can use for ordinary stuff, let's name her `alice`. Then there is another user, let's name him `bob`. `bob` has root privilegies. The admin who prepared the server installed all stuff to places where one can operate only as root, so `bob` is needed for practically everything I do. I have a password only for `alice`'s account. I have no password for `bob`, but I was told I can use his powers by typing `sudo su - bob` and then doing stuff. And that's true - in a shell I can do this (with no password prompts!) and then I am logged in as `bob` and I can do anything. However, I need to do this non-interactively, in a script. Something like `sudo su - bob && whoami`. But I could not come up with any other way to gain `bob`'s power: E.g. `sudo su -c whoami bob` results in `[sudo] password for alice:` and then `Sorry, user alice is not allowed to execute '/bin/bash' as bob on lovelyplace.` I tried many combinations of `su`, `sudo`, etc., but the result is always the same - password prompt and after that, rejection. I need to come up with the way to programmaticaly log in to the server as `alice` and then execute stuff as `bob`. I need a non-interactive one liner similar to `sudo whoami`, which would print out `bob`. Otherwise I am not able to deploy my app by script. Any suggestions how to mimic this strange `sudo su - bob` in script? **UPDATE:** `bob` does not have the same powers as root. He can't read sudoers, etc., so he has more privileges than `alice`, but apparently not that much to adjust root settings.


title: Is there a graphical front end to the Solaris Service Management Facility?

text: I have a few service errors at startup on an opensolaris installation that I keep put off fixing since I would need to figure out the line commands again. Is there an easier to use front end?


title: Xterm is not completely erasing field lines

text: We are running Windows Clients with Cygwin XServer that has a bash script application running on AIX Unix. We have a login script using expect to ssh into the server and then xterm to create the client terminal. This is working fine except on any form screen, after the fields are updated and the `______` line is erased a single `.` is left at the end. I tried different fonts and sizes but no matter what I do, that single `.` is left after the line is erased. Any ideas?


title: Is there a way to tar multiple files in a directory (Linux/Unix)?

text: Is there a fairly simple way to `tar` several (specific) files in a directory? For example let's say the following is a directory:               -rw-r--r-- 1 allend bin     98 Jul 20 15:50 scriptlog.log     -rw-r--r-- 1 allend bin  19533 Jul 29 21:47 serveralert.log     -rwxr--r-- 1 allend bin   1625 Jul 29 21:47 orion     -rw-r--r-- 1 allend bin  24064 Jul 29 21:49 orion_files.tar     -rwxr--r-- 1 allend bin    156 Aug  4 21:22 htmltest     -rw-r--r-- 1 allend bin    131 Aug  4 21:23 page.html      What if I only want to `tar` the files `serveralert.log` and `page.html`?


title: Can I connect to or view abandoned ssh sessions?

text: I have a virtual instance of redhat running that I can `ssh` to from any host on the corporate network. My `ssh` session was dropped while running some scripts that may or not have caused me to disconnect. The `who` command locally still lists the dropped connection. Reconnecting with `ssh` starts a whole new session. Is there a way to connect to the original session? If not can I kill it? I have root and physical access. I was not using screen in the original session.


title: Was my Unix server compromised?

text: Someone asked if this constituted a break-in and wondered if their server had been compromised. > Jan 12 04:16:51 foo sshd[26725]: Failed password for root from 61.174.51.207 > port 1076 ssh2   >  Jan 12 04:16:54 foo sshd[26822]: Disconnecting: Too many authentication > failures for root   >  Jan 12 04:16:54 foo sshd[26825]: Failed password for root from > 61.174.51.207 port 1076 ssh2   >  Jan 12 04:16:54 foo sshd[27324]: PAM 5 more authentication failures; > logname= uid=0 euid=0 tty=ssh ruser= rhost=61.174.51.207 user=root "secure" > 229L, 24376C How does one go about diagnosing whether their server was compromised?


title: How to do I convert an animated gif to an mp4 or mv4 on the command line?

text: What command would I use to convert an mp4 or mv4 video file to an animated gif, and vice versa. That is, convert a animated gif to a mp4 or mv4.


title: How do I get Fedora 17 boot media to boot my laptop?

text: I have been using Ubuntu since Ubuntu 11.10 came out. I was very satisfied with how Ubuntu has evolved over the past few years, but now I would like to try out Fedora 17 since that has been out for a while simply for a change. I first had Windows 7 and Ubuntu on a dual boot; however, I got rid of the dual boot and installed Ubuntu 12.04 (32-bit recommendation) from a CD as my primary operating system. My problem is, now that Ubuntu 12.04 LTS is my primary operating system, how can I install Fedora 17 in its place? I downloaded the Fedora 17 iso file (64-bit) and installed it on both a CD and USB, but I cannot get it to run from either. I investigated the problem and tried going into my BIOS by pressing f2 to make the USB the primary boot; however, this didn't work either. When I put the USB first in boot order, I receive a message that states "bootmgr is missing, press ctl+alt+del to restart". I've searched all over the internet in hopes of figuring out a way to fix this, but to no avail. Also, I have tried pressing f12 to pick the CD to boot from, but this option is nonexistent (I remember when I had Windows 7 that it was an option though). If anyone needs any more information about my situation, please don't hesitate to ask. If it helps at all, I'm working with a Lenovo Ideapad Z560. Also, let me make it clear that I want to remove Ubuntu 12.04 LTS from my laptop completely and replace it with Fedora 17; I do not want a dual boot of Fedora and Ubuntu.


title: Use socks proxy for commands in terminal

text: I connect to a remote ssh server by running this command:               ssh -D 12345 bob@myserver.com      This creates a socks proxy that I can use with Firefox to bypass censorship in my country. However, I can't take advantage of it to in the command line. Let's say my country blocks access to youtube. How can I use the ssh connection to run a command such as:               youtube-dl youtube.com/watch?V=3XjwiV-6_CA      Without being blocked by the government? How I can set a socks proxy for all terminal commands?


title: Strange crontab-script interaction (bash)

text: I'm running Ubuntu 12.04 and bash. I've written a pair of shell scripts that allow me to set an alarm which, after ringing, unsets itself. The first, `alarmset`, allows me to enter a time and modifies the alarm line in my user crontab. That line launches the second script, `alarmring`, which launches a radio player in a browser window and then comments out the alarm line in the crontab. `alarmring` is behaving strangely. If I run it myself directly, it performs both actions: it launches the browser window and edits the crontab. But if I run `alarmset`, when the crontab launches `alarmring` at the appointed time, `alarmring` edits the crontab, but does not launch the browser window. Finally, when crontab runs `alarmring`, it ignores the `set -x` command, whereas when I run it directly, `set -x` is executed. So it's as though the crontab is skipping the first ten lines. Any ideas on what's going on? I'll paste the two scripts and the crontab below. **alarmset:**               #!/bin/bash          # alarmset          set -x          usage()     { echo "alarmset [ hour minute | -h ]" }          editcrontab()      {          echo $'/alarmring/s/^\(.*\)\(\* \* \*\)/'$2$' '$1$' \\2/' > ~/Documents/crontab_script.txt          crontab -l | sed --file=/home/username/Documents/crontab_script.txt > ~/Documents/new_crontab.txt crontab ~/Documents/new_crontab.txt      }          ### MAIN      case $# in          2 ) editcrontab $1 $2 ;;          * ) usage              exit ;;      esac          set +x      **alarmring:**               #!/bin/bash          # alarmring          set -x          env DISPLAY=:0          # Ring the alarm : launch BBC World Service in Firefox      firefox --new-window http://www.bbc.co.uk/radio/player/bbc_world_service          # Unset the alarm : comment out the alarm line in the crontab      crontab -l | sed '/alarmring/s/^/#/1' > ~/Documents/new_crontab.txt      crontab ~/Documents/new_crontab.txt          set +x      **crontab:**               SHELL=/bin/bash      PATH=~/bin:/usr/bin:/bin      #      # m h dom mon dow command      53 07 * * * /home/username/bin/alarmring


title: package require XXXX tcl

text: I have to install a program but it always fails. When I try package require XXX, it return "can't find package XXX". I have a folder with the setup files in it, among which there is a pkgIndex.tcl, I have been looking online about package and pkgIndex.tcl but I cannot find any clear explanation. All this is a bit confusing for me...


title: Is there a way to specify a name for "/etc/apt/sources.list" file?

text: Can the location for APT sources, named **/etc/apt/sources.list** , be named differently (e.g. **/foo/my-renamed-apt-sources-file** "), without breaking APT (i.e. via some configuration)?


title: Installing Unity or Gnome 3 in Debian

text: I am using Debian 6 .I would like to install any of Unity or Gnome 3 desktop Environments . so guide me how could i do that ?


title: understand if systray displayed in a desktop environment

text: I'm author of a couple off apps that make use of systray. Recently, since in some desktops only the indicator is supported (see ubuntu unity), I introduced a check and if indicator is supported the app uses indicator in place of systray.               try:         import appindicator         HAS_APPINDICATOR = True     except: HAS_APPINDICATOR = False      which works pretty good, the problem is that I still would like to use systray in place of indicator if systray is supported. Is there a way to understand if systray is supported/not blocked from the current desktop environment?


title: In Ubuntu, is there a way to virtually merge two folders without unionfs or aufs?

text: I've got a source control system at work that I can't modify which scatters a bunch of files in unfortunate places. My IDE expects these folders to be in a single unified location. Normally I'd just symlink the shit out of everything, but to make things worse, some of the folders must be recursively merged. I have a guarantee that there are no overlapping filenames, but we're talking about thousands of files, more than I'll do by hand. I've looked into unionfs and aufs, but it's a corporate machine, so no mucking about with the kernel (not to mention the "getting started" docs for these wang chung). Is there another way to do this?


title: xfce4 device automount / xfce4-gvfs-mount

text: I'm not sure how to fix my auto mount problem with xfce4. I have asked on here before but since my system went threw some hell it seems to be a different problem. This is what would be in the /var/log/messages file after I plug in my usb drive               Jun 26 15:19:41 core dbus[9204]: [system] Activating service name='org.freedesktop.ConsoleKit' (using servicehelper)     Jun 26 15:20:06 core dbus[9204]: [system] Failed to activate service 'org.freedesktop.ConsoleKit': timed out      [I'm running gentoo] Now I get this... (no more dbus error and I'm not sure what is happening)               Aug  7 21:24:31 core kernel: [883400.930642] ehci_hcd 0000:00:16.2: GetStatus port:2 status 001803 0  ACK POWER sig=j CSC CONNECT     Aug  7 21:24:31 core kernel: [883400.930661] hub 3-0:1.0: port 2, status 0501, change 0001, 480 Mb/s     Aug  7 21:24:31 core kernel: [883401.034095] hub 3-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x501     Aug  7 21:24:31 core kernel: [883401.085055] ehci_hcd 0000:00:16.2: port 2 high speed     Aug  7 21:24:31 core kernel: [883401.085060] ehci_hcd 0000:00:16.2: GetStatus port:2 status 001005 0  ACK POWER sig=se0 PE CONNECT     Aug  7 21:24:31 core kernel: [883401.136023] usb 3-2: new high-speed USB device number 24 using ehci_hcd     Aug  7 21:24:32 core kernel: [883401.505080] ehci_hcd 0000:00:16.2: port 2 high speed     Aug  7 21:24:32 core kernel: [883401.505096] ehci_hcd 0000:00:16.2: GetStatus port:2 status 001005 0  ACK POWER sig=se0 PE CONNECT     Aug  7 21:24:32 core kernel: [883401.805130] usb 3-2: default language 0x0409     Aug  7 21:24:32 core kernel: [883401.806266] usb 3-2: udev 24, busnum 3, minor = 279     Aug  7 21:24:32 core kernel: [883401.806268] usb 3-2: New USB device found, idVendor=154b, idProduct=0048     Aug  7 21:24:32 core kernel: [883401.806270] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3     Aug  7 21:24:32 core kernel: [883401.806272] usb 3-2: Product: USB 2.0 FD     Aug  7 21:24:32 core kernel: [883401.806274] usb 3-2: Manufacturer: PNY Technologies     Aug  7 21:24:32 core kernel: [883401.806275] usb 3-2: SerialNumber: AAB11C0300000270     Aug  7 21:24:32 core kernel: [883401.806332] usb 3-2: usb_probe_device     Aug  7 21:24:32 core kernel: [883401.806335] usb 3-2: configuration #1 chosen from 1 choice     Aug  7 21:24:32 core kernel: [883401.806505] usb 3-2: adding 3-2:1.0 (config #1, interface 0)     Aug  7 21:24:32 core kernel: [883401.806542] usb-storage 3-2:1.0: usb_probe_interface     Aug  7 21:24:32 core kernel: [883401.806546] usb-storage 3-2:1.0: usb_probe_interface - got id     Aug  7 21:24:32 core kernel: [883401.806616] scsi31 : usb-storage 3-2:1.0     Aug  7 21:24:32 core kernel: [883401.806684] drivers/usb/core/inode.c: creating file '024'     Aug  7 21:24:33 core kernel: [883402.895675] scsi 31:0:0:0: Direct-Access     PNY      USB 2.0 FD       8192 PQ: 0 ANSI: 0 CCS     Aug  7 21:24:33 core kernel: [883402.895799] sd 31:0:0:0: Attached scsi generic sg2 type 0     Aug  7 21:24:33 core kernel: [883402.896415] sd 31:0:0:0: [sdb] 15663104 512-byte logical blocks: (8.01 GB/7.46 GiB)     Aug  7 21:24:33 core kernel: [883402.897293] sd 31:0:0:0: [sdb] Write Protect is off     Aug  7 21:24:33 core kernel: [883402.897296] sd 31:0:0:0: [sdb] Mode Sense: 43 00 00 00     Aug  7 21:24:33 core kernel: [883402.898304] sd 31:0:0:0: [sdb] No Caching mode page present     Aug  7 21:24:33 core kernel: [883402.898307] sd 31:0:0:0: [sdb] Assuming drive cache: write through     Aug  7 21:24:33 core kernel: [883402.901831] sd 31:0:0:0: [sdb] No Caching mode page present     Aug  7 21:24:33 core kernel: [883402.901841] sd 31:0:0:0: [sdb] Assuming drive cache: write through     Aug  7 21:24:33 core kernel: [883402.902926]  sdb: sdb1


title: Why does this fail as crontab but works as script

text: > **Possible Duplicate:**   >  What’s wrong with these two cron job’s? I want to print a formatted output from a file containing lines of date, time, long number, and long number. I set `LC_NUMERIC` to UTF and use the `%'d` flag characters to produce numeric grouping of thousands. The following line in crontab produces an error of               /bin/sh: -c: line 0: unexpected EOF while looking for  matching `"'      when the cronjob runs.               @daily LC_NUMERIC=en_US.UTF-8 /usr/bin/printf "%s %s %'d %'d\n" \               $(/usr/bin/tail -n 31 /var/log/bandwidth)      Newline added for readability The identical line (without `@daily`) in a script works fine. I would guess that cron is choking on the `%'d` part and can't find the closing `"`. Why?


title: Compiz + MATE windows jump to previous workspace

text: I have a fresh Mint 13 Maya (MATE edition) with Compiz enabled. I also have a two-monitor set-up with the nVidia drivers with TwinView. I have set up 4 horizontal workspaces via CompizConfig Settings Manager. Here is the behavior I try to eliminate: I open a window, say, browser, and put it to workspace number 2. When I switch to workspace 3 or 4, then back to workspace 2, the window is gone. It has jumped to workspace 1 somehow. This annoys a lot. Could anyone help? Here are some details:   * If you stay on workspace 2 windows never jump   * If you switch to workspace 1 and back to worspace 2 - windows do not jump. They seem to jump only if you switch to the right    * I have 2 monitors, and this behavior occurs only with windows displayed on the left monitor


title: Make box only communicate on lan only?

text: I am running a VM with Debian as the guest OS (I can choose another distro). It has nginx running along with some other software. Some of the software tries to make outgoing connections (for example checking for updates or sending usage information). I'd like to block it. I'd also be willing to block incoming connections so only the LAN or my own computer (the host) can communicate with it. How do I setup Linux or the hypervisor (I'm using VMWare player) to not allow Internet usage—only allow my computer and maybe the LAN? The host OS is Windows 7.


title: How to get all lines between first and last occurrences of patterns?

text: How can I trim a file (well input stream) so that I only get the lines ranging from the first occurrence of pattern `foo` to the last occurrence of pattern `bar`? For instance consider the following input :               A line     like     foo     this      foo     bar     something     something else     foo     bar     and     the     rest      I expect this output:               foo     this      foo     bar     something     something else     foo     bar


title: Difference Between #include "file.h" and #include <file.h>

text: What is the difference between the `#include "file.h"` and the `#include <file.h>`? Surely they mean the exact same thing, because I have a file that has something like this:               #include <file1.h>     #include <file2.h>     #include "file3.h"     #include "file3.h"


title: Unable to install Mono 2.6 on CentOS

text: I have an application that breaks on mono 2.10, so I'm trying to install an older mono instead. I found an RPM and tried to install it, but it won't install (I believe) because the glibc and gcc versions that are on CentOS 6.3 are too high. (it actually says it lacks the dependencies for GLIBC_2.7 and GCC_3.3.1 even though I have versions 2.12 and 4.4 installed as part of CentOS 6.3, so I can only assume it's a problem because they're too high) How should I proceed?


title: Run command when checking for new mail in mutt

text: I'd like to run a command (specifically `imapfilter`) whenever Mutt is checking for new email, to avoid getting "wrong" messages about email in `=INBOX` which hasn't been filtered yet.


title: Tutorial about key maping in KSH in EMACS mode

text: Are there any good tutorial to learn about Key Maping in Korn Shell (AIX) in EMACS mode ?


title: Which GNU/Linux distribution for a 12-year old system?

text: I have a 12-year old Toshiba Libretto laptop with a Transmeta Crusoe Processor TM 5600 running at about 600 MHz, 128 MB RAM and S3 Savage graphics. Which Ubuntu (or any other GNU/Linux based OS) could I use for stable operation? I intend to use the laptop for basic computing needs including surfing and Skype without video.


title: stop parallel processing for a cron triggered process

text: I have configured my webservers cron jobs to trigger some php script, every 15min, but sometimes the script takes morethan 15 min to complete execution, by the time another process of the same script starts. which is creating problems in our logic. I want only one instance of the same process running, and if it is completed then only let the other process execute(dont want to put process in a queue, just terminate at that moment and execute at next interval). Example: I have three php file which will be called by the webservers cron job every 15 min. let say a.php, b.php, c.php. the script might take more than 15 min to complete execution. on end of execution it updates our database, hence cant run two copy of same script file(this will break our logic). like say a.php is triggered at 4.00 pm and at 4.15pm again cron will trigger a.php. here i want to check if a.php has completed execution, if not skip the call. and trigger it at 4.30pm by checking the same case. but b.php, c.php and a.php anc run parallel(but same instances cant).


title: How to select/delete until end of file in vim/gvim?

text: Accidentally I managed to copy-paste a paragraph in vim a zillion times. How do I select and then delete the text from my current position to the end of file? In Windows, this would be Ctrl-Shift-End, followed by Delete.


title: Delete the first n bytes of files

text: I've got an extreme problem, and all of the solutions I can imagine are complicated. According to my UNIX/Linux experience there **must** be an easy way. I want to delete the first 31 bytes of each file in `/foo/`. Each file is long enough. Well, I'm sure somebody will deliver me a suprisingly easy solution I just can't imagine. Maybe awk?


title: How to mount a NRG file on Linux?

text: I'm trying to mount an old NRG image file in my Arch Linux box. In Windows 7 I can mount it using PowerISO without problems. When I try to mount it in Linux I get the following error messages:               $ sudo mount -o loop file.nrg folder/     mount: wrong fs type, bad option, bad superblock on /dev/loop0,     missing codepage or helper program, or other error          In some cases useful info is found in syslog - try     dmesg | tail or so.      `dmesg` gives me the following output:               $ dmesg | tail     [103618.787063] EXT4-fs (loop0): VFS: Can't find ext4 filesystem     [103618.787129] EXT4-fs (loop0): VFS: Can't find ext4 filesystem     [103618.787185] EXT4-fs (loop0): VFS: Can't find ext4 filesystem     [103618.788898] ISOFS: Unable to identify CD-ROM format.      If I check for the file type of the image:               $ file file.nrg      file.nrg: AIX core file fulldump 32-bit 64-bit      How can I mount this image in Linux?


title: How can I connect to Gnome 3 with a Windows VNC client?

text: I used to be able to connect to my Gnome 3 desktop from a Windows machine with a VNC client. But after an upgrade (on the Linux side) a while ago, it quit working. When I attempt to connect, all I can get is a message saying "No matching security types" or "No supported authentication methods!" (depending on which client I try). In Gnome 3, I've turned on Screen Sharing under Settings > Sharing. Under that, I have Remote View on, Remote Control on, Approve All Connections on, Require Password off. I'm running Arch Linux with vino 3.8.1. On the Windows side, I've tried TigerVNC 1.0.1 & 1.2.0 and UltraVNC 1.0.9.6.2. How can I get this working?


title: Debian Iceweasel 4 problems running from command line

text: Followed this tutorial How to install Iceweasel 4 on Debian? in attempt to install iceweasel 4 on my debian 6 "Squeeze" machine.   After installation it seems that I can only open the first instance of iceweasel from Applications/Internet, but not from commmand line.   Trying to open it from command line results in this error:               /usr/lib/iceweasel/firefox-bin: symbol lookup error: /usr/lib/libcairo.so.2: undefined symbol: FT_Library_SetLcdFilter      If iceweasel instance is already running I am able to open a new instance of iceweasel from command line without any errors. Edit: I am using Gnome window manager in this setup Any ideas?


title: How can I convert a PEM key into a RSA key pair?

text: I was just sent a PEM key from a client as a means to access their Amazon EC2 instance. How do I convert this into something I could use with OpenSSH?


title: Is it possible to nest a 'find -exec' within another 'find -exec'?

text: Something like the following is what I what I'm after, but my code doesn't work, no matter how I escape `{}` and `+` `;`               find ./ -maxdepth 1 -type d -name '.*' -exec \         find {} -maxdepth 1 -type f -name '*.ini' -exec \             md5sum \{\} \\; \;      After seeing this Unix-&-Linux question, I found that the following code works, but it isn't nesting _find_ as such, and I suspect there is a better way to do this particular job.               find ./ -maxdepth 1 -type d -name '.*' \     -exec bash -c 'for x; do         find "$x" -maxdepth 1 -type f -name "*.ini" \         -exec md5sum \{\} \;; \     done' _ {} \+      Is there some way to nest `find -exec` without the need to invoke a shell (as above), with all its whacky quoteing and escape constraints? Or can this be done directly in a single find command, using a blend of its many parameters?