Actkbd as service with systemd

A while ago I asked for how to stop a music player while the screen is locked. The answer was to use actkbd which works like a charm. Now I wanted to add actkbd as a service to systemd in order to start it automatically when booting. So as you can see the service is started correctly and it shows up in htop as well. Some output below:               [root@hostname init.d]# systemctl start actkbd.service     [root@hostname init.d]# systemctl status actkbd.service     actkbd.service - Actkbd: Daemon for X-independent shortcuts           Loaded: loaded (/etc/systemd/system/multi-user.target.wants/actkbd.service)           Active: active (running) since Tue, 10 Apr 2012 17:50:36 +0200; 2s ago          Process: 23526 ExecStart=/usr/local/sbin/actkbd -d /dev/input/event3 -D (code=exited, status=0/SUCCESS)         Main PID: 23527 (actkbd)           CGroup: name=systemd:/system/actkbd.service                   └ 23527 /usr/local/sbin/actkbd -d /dev/input/event3 -D     [root@hostname init.d]# systemctl stop actkbd.service     [root@hostname init.d]# ps -C actkbd       PID TTY          TIME CMD      I have the following `actkbd.service` file in `/etc/systemd/system/multi- user.target.wants/`               [Unit]     Description=Actkbd: Daemon for X-independent shortcuts          [Service]     Type=forking     ExecStart=/usr/local/sbin/actkbd -d /dev/input/event3 -D     ExecReload=/bin/kill -HUP $MAINPID     ExecStop=/bin/kill -15 $MAINPID     Restart=always     User=root      So the problem is that after starting the service with systemctl nothing happens if I press my usual shortcut for pausing Rhythmbox. If I instead just execute the command `/usr/local/sbin/actkbd -d /dev/input/event3 -D` via the a root terminal everything works fine. Why that? Sorry if it's something obvious, I'm new to the systemd business but I couldn't find anything that helped me. Cheers. EDIT: This is still not working. If somebody has some time I'd appreciate it if one could try and reproduce it. If that is possible then I will file a bug report.


Private Debian repository to serve selected packages to selected machines

I have a private Debian repository setup with a few custom built packages (along with other official Debian packages). All my machines have this repository(only) configured in `/etc/apt/sources.list`. I want to know if there is a way to serve certain packages to certain machines. For example - machine1 should be able to connect to the repository but should be able to download package1 and package2 only. machine2 should not be able to upgrade package1 even if a new version is available in the repository. I know how to do the above on the client side - by running (or not running) the appropriate commands on machine1 and machine2. I want to automate this - I was planning to run a cronjob on those machines to do `apt-get update && apt- get upgrade` once every day but only the packages intended for them should be installed/upgraded. I have looked up online for weeks but couldn't find anything useful. Is this even doable?


What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

I think these terms almost refer to the same thing, when used loosely:   * terminal   * shell   * tty   * console What exactly does each of these terms refer to?


Difference between pts and tty

> **Possible Duplicate:**   >  What is the exact difference between a 'terminal', a 'shell', a 'tty' and a > 'console'? I always see pts and tty when I use the `who` command but I never understand how they are different? Can somebody please explain me this?


Why isn't the -rt (RT-Preempt) kernel patch included by default in the mainline kernel?

According to https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO , the RT- Preempt patch converts Linux into a fully preemptible kernel. The magic is done by:   1. Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes.   2. Critical sections protected by i.e. spinlock_t and rwlock_t are now preemptible. The creation of non-preemptible sections (in kernel) is still possible with raw_spinlock_t (same APIs like spinlock_t)   3. Implementing priority inheritance for in-kernel mutexes, spinlocks and rw_semaphores.   4. Converting interrupt handlers into preemptible kernel threads: The RT-Preempt patch treats soft interrupt handlers in kernel thread context, which is represented by a task_struct like a common userspace process. However it is also possible to register an IRQ in kernel context.   5. Converting the old Linux timer API into separate infrastructures for high resolution kernel timers plus one for timeouts, leading to userspace POSIX timers with high resolution.  Are there any drawbacks of being real-time instead of just multi-tasking?


Is it bad to select remember me option in the browsers of a compromised machine?

I was reading an article on how to sniff network packets. (of course for knowledge purposes only). I came across these particular lines. > For instance, say I was sniffing traffic on the network, and you logged in > to Facebook and left the Remember Me On This Computer check box checked. > That signals Facebook to send you a session cookie that your browser stores. > I potentially could collect that cookie through packet sniffing, add it to > my browser and then have access to your Facebook account. So, assuming my Linux client is compromised and am unaware of it currently, does that mean if I have clicked on `remember me` on this machine to login to my accounts, my personal details are compromised? How can the compromised machine's cookie information can be used in any hacker's browser?


Root not affected by file permissions?

Why does this work as root?               # touch test1     # chmod 000 ./test1     # echo "test" > ./test1      I take it root is not affected by file permissions?


Unity: Stop Dock Repopulation at Restart

Unity is currently the default window manager on my system, a window manager that's available for many Linux distributions, meaning this question isn't Ubuntu-specific. I have disabled the dock's autohide using `debconf`, but apart from that I haven't altered any of the default settings. My usage pattern is centred around the Windows key; whenever I wish to start something, whether it be Firefox, GVim, or a terminal window, I just hit the windows key, start typing the name, and hit enter when Unity guesses what it is I want. This use means I have no need to keep anything in the launcher. Given that I only start applications using the keyboard, I only need the dock to show me currently running applications. Naturally, my response was to simply remove everything I could from the dock, meaning all that remains is running applications. It doesn't work though. If I remove all 'pinned' applications from the dock, the system repopulates it to the defaults on restart of Unity. I assume that Unity thinks everything being removed is either a user error or a clobbered configuration file somewhere, and as such 'repairs' it by restoring the pinned applications. How can I suppress this setting so I can have an empty dock?


MySQL Workbench Cannot start SSH tunnel manager

I don't know why this error is happening when I try to connect by MySQL Workbench. > Cannot start SSH tunnel manager. I'm using slackware 14.1 and installed all dependencies.    ![enter image description here](http://i.stack.imgur.com/7rhtr.png)


Adding a character to every other text line

I have a huge (ca. 20G) text file which contains millions of passages (a.k.a. paragraphs) with headers. Headers and paragraphs are always one line each, e.g., > Sunshine   >  This is a sunny day.   >  Darkness   >  A cave is a dark place. What I try to come up with is a terminal command which goes through the text and adds a '>' in front of every header, i.e., every _odd-numbered line_ (lines 1, 3, 5, …), e.g., > >Sunshine   >  This is a sunny day.   >  >Darkness   >  A cave is a dark place. Any ideas? If this is relevant: the above text was just an example. Most of the headers are MD5s, followed by a DNA sequence ('paragraph'), e.g., > 0002ebd9ca12d6b69dfc3066356fc299   > > CATTAACCATTGGATACCTTCGGGTATATCCCATCCGTGTCTACATACTCTTGTTGCTTTGGCAGGCCGTGGTCACACACTGTGGGCTATGCCTGCATGTGCCTGCCAGAGGACCA … which I'm trying to convert to > >0002ebd9ca12d6b69dfc3066356fc299   > > CATTAACCATTGGATACCTTCGGGTATATCCCATCCGTGTCTACATACTCTTGTTGCTTTGGCAGGCCGTGGTCACACACTGTGGGCTATGCCTGCATGTGCCTGCCAGAGGACCA


Automate DISA STIG controls for RHEL/CentOS?

I am deploying systems that must be configured using the Red Hat 6 (v1r2) Security Technical Implementation Guide(STIG) published by the Defense Information Systems Agency (DISA). Link to site. I've started developing a Kickstart file to automate many of these settings based on other KS files I've found via Google. Does anyone have any advice, additional tools, or other resources that will help? I do not _need_ to use Kickstart, it just seemed like the easiest way to get started. I'm looking for any resources: playbooks for Ansible, basic shell scripts, etc.


Ubuntu 12.04.1 LTS - /boot is using 98.4% of 193MB

I have a problem. I have noticed that my VPS is saying : > => /boot is using 98.4% of 193MB Looks like something went wrong, doesn't it? I have tried to run `dpkg -l | grep linux` to check what's there. Here is the output:               ii  libselinux1                        2.1.0-4.1ubuntu1             SELinux runt                                                                                ime shared libraries     ii  linux-firmware                     1.79.7                       Firmware for                                                                                Linux kernel drivers     iU  linux-generic-pae                  3.2.0.56.66                  Complete Gen                                                                                eric Linux kernel     ii  linux-headers-3.2.0-45             3.2.0-45.70                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-45-generic-pae 3.2.0-45.70                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-48             3.2.0-48.74                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-48-generic-pae 3.2.0-48.74                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-51             3.2.0-51.77                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-51-generic-pae 3.2.0-51.77                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-52             3.2.0-52.78                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-52-generic-pae 3.2.0-52.78                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-53             3.2.0-53.81                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-53-generic-pae 3.2.0-53.81                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-54             3.2.0-54.82                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-54-generic-pae 3.2.0-54.82                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-55             3.2.0-55.85                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-55-generic-pae 3.2.0-55.85                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-56             3.2.0-56.86                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-56-generic-pae 3.2.0-56.86                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-generic-pae          3.2.0.56.66                  Generic Linu                                                                                x kernel headers     ii  linux-image-3.2.0-29-generic-pae   3.2.0-29.46                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-45-generic-pae   3.2.0-45.70                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-48-generic-pae   3.2.0-48.74                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-51-generic-pae   3.2.0-51.77                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-52-generic-pae   3.2.0-52.78                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-53-generic-pae   3.2.0-53.81                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-54-generic-pae   3.2.0-54.82                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-55-generic-pae   3.2.0-55.85                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     iF  linux-image-3.2.0-56-generic-pae   3.2.0-56.86                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     iU  linux-image-generic-pae            3.2.0.56.66                  Generic Linu                                                                                x kernel image     ii  util-linux                         2.20.1-1ubuntu3              Miscellaneou        What can I do to solve this problem? What may I safely remove?


"mke2fs -r fs-revision-level" - how is this used?

`mke2fs -r` offers > Set the filesystem revision for the new filesystem. Note that 1.2 kernels > only support revision 0 filesystems. The default is to create revision 1 > filesystems. Trying to look up what was meant by that I found loads of screenshots etc. of `dumpe2fs`containing the line > Filesystem revision #: 1 (dynamic) ## Question: _What does that mean? What does the option actually do and what is meant with this output?_ Where is documented what a value of zero would mean, what _dynamic_ actually means; and is there a value of two also? I could live with » _keep untouched as you won't ever need to change it_ « - but as there is an option for that and no note about backward compatibility, this makes me wonder…


Append output to a file and redirect stderr to null

How can I append the result of a command to a file and redirect stderr to null?


Running C Programs on Linux

I watched a video lecture today that introduced C and things like how to make a C program that will run in Linux. I followed the steps given and now I'm stuck with a bit of a problem. I created my C file (HelloWorld.c) and used the command `gcc -o HelloWorld HelloWorld.c` to compile the file, both of these steps were successful. Afterwards I checked to make sure that HelloWorld had been created by using the command `ls`, and it had been. However, when I use the command `HelloWorld`, which is supposed to run the program, I get an error that says `HelloWorld: command not found`. In the video lecture the professor did mention that this worked for 32-bit systems and I'm using a 64-bit system. Perhaps this could be the problem? EDIT: Also in the video lecture the professor mentioned that when I use the command `ls` I should see `HelloWorld*`. I see only HelloWorld (without the star).


Where kernel configuration file is stored?

I currently run Angstrom Linux 2.6.32. I intend to upgrade linux kernel from 2.6.32 to 3.0.7. For this reason, I had to configure kernel 3.0.7 running `make menuconfig`. Now, I want to compare the new kernel configuration with the previous, but I can't find kernel 3.0.7 configuration file. Any ideas?


Install-on-Demand Wrapper Function for Executables

How do I make the following function work correctly               # Install git on demand     function git()     {         if ! type git &> /dev/null; then sudo $APT install git; fi         git $*;     }      by making `git $*` call `/usr/bin/git` instead of the function `git()`?


How to more easily specify tasks for batch, using command prefix tool?

The tool `batch` that comes with the `atd` daemon is pretty useful in principle, running commands only when the system utilisation falls below a certain level (by default, 1.5). However, using it (and also `at`) is pretty ugly by modern standards: you either have to feed a script which can be run by `/bin/sh`, or type commands interactively into a basic prompt with no completion, color-coding, etc. What would be really nice is a command prefix tool, more like `nice`, that one can put in front of any command to add it to the batch queue (and a similar utility for `at` would be handy, although that's not the main point of my question). For example, it might work like this: `my-batchifying-command python some_longrunning_computational_script.py` Does such a thing exist? If not, how might it be created? I use `zsh` for my main shell, but a `bash` answer would be equally OK and might have wider applicability.


How do I configure mailutils pop3d to not set the flags on the mailspool?

How do I configure mailutils pop3d to not set the flags on the mail spool to read? I could not find a setting for this in the documentation. I am using an android (stock) MUA and this does not seem to have an option for this setting. The user functionality I am seeking is that the mail must remain as _unread_ on the server so that when I use my _official_ application, then I see mails as _unread_ even though I may have read them _on the go_ as it were. Thanks for any suggestions.


How to set default file permissions for all folders/files in a directory?

I want to set a folder such that anything created within it (directories, files) inherit default permissions and group. Lets call the group "media". And also, the folders/files created within the directory should have g+rw automatically.


Pre-defined umask under a given path

> **Possible Duplicate:**   >  How to set default file permissions for all folders/files in a directory? Say I have default umask, `umask1`. I would like all files/folders that I create/modify under a specific path               /path/to/foo      to have a different umask, `umask2`, and keep using `umask1` for everything else. Is there a way to have the shell do this automatically for me? If so, how? Is there a way to do this for everyone else who belongs to the groupID of `/path/to/foo`?


Uncommenting multiple lines of code, specified by line numbers, using vi or vim

I have learned from this Stack Overflow question that it is possible to use `vi`/`vim` to comment out a specified range of line numbers. For example, suppose I have the following bash script:               #!/bin/bash          This     is     my     very     very     great     script      Now suppose that I want to comment out line numbers 6 through 8 (which contain the words `very`, `very`, and `great`) using the `#` comment character. In `vi`/`vim`, I can simply type `:6,8s/^/#` to obtain the following:               #!/bin/bash          This     is     my     #very     #very     #great     script      which comments out lines 6 through 8. My question is, is it possible to type a similar one liner that will **_remove_** the `#` comment character from lines 6 through 8 (but not any other commented lines in the file)? Having said this, I realize that there is some debate about whether I am actually using `vi` or `vim`. In practice, I open a file `script.sh` with the command `vi script.sh`. Also, when I type the command `which vi`, I obtain `/usr/bin/vi`. Nevertheless, when I simply type `vi` and press `Enter`, I obtain this:               ~                              VIM - Vi IMproved     ~     ~                               version 7.2.330     ~                           by Bram Moolenaar et al.     ~                 Vim is open source and freely distributable     ~     ~                           Sponsor Vim development!     ~                type  :help sponsor<Enter>    for information     ~     ~                type  :q<Enter>               to exit     ~                type  :help<Enter>  or  <F1>  for on-line help     ~                type  :help version7<Enter>   for version info      which seems to suggest that I'm actually using `vim`. I am accessing a remote Ubuntu Linux cluster using SSH from my PC. I am not using a Ubuntu Linux GUI.


Why wasn't `creat` called `create`?

Was it just to save typing one letter? I don't think C function names were limited to five characters at the time, as `strcmp` and `unlink` are probably just as old. I'm hoping someone who was involved said something on the record about this, but I haven't been able to find it. This is not the same as asking 'What did Ken Thompson mean when he said, “I'd spell create with an 'e'.' because it is a different question with a different answer.


where can i find the good man pages?

I have read the man pages that have come along with the red hat os.But it takes too long to understand the documentation. I want to know about the good sites which provide more clear man pages.


vim colors not automatically loaded (probable Vundle conflict)

I've been trying to port my Windows .vimrc to Linux, to use on the command line (on gnome-terminal). Everything works fine, except for the colorscheme. It looks like it's loaded (`:colorscheme` returns `solarized`; `:set t_Co` returns `t_Co=256` and `:set background` returns `background=light`), but it looks ugly on my terminal. If I run any of those commands again manually (either setting `colorscheme`, `t_Co` or `background`), then the theme displays normally. This is the .vimrc.bundle that's sourced on my .vimrc GVim also behaves normally. I tried other terminals (xterm, urxvt, screen), but none worked. **Edit:** Looks like there's some sort of conflict with a plugin loaded by Vundle. If I comment out the `source ~/.vimrc.bundle`, the colorscheme is loaded properly.


Simulate x-screen?

I'm working in a koding terminal running ubuntu 13.04, and I'm trying to run an application that requires an x-screen (even to run in terminal mode). I am unable to connect with x11 forwarding, and I'm wondering if there is a workaround that will allow me to run this application (lmms).               $ lmms -v     lmms: cannot connect to X server      $ uname -a     Linux vm-2.masd.koding.kd.io 3.9.0-0-generic #4userns5 SMP Mon May 13 06:15:34 PDT 2013 x86_64 x86_64 x86_64 GNU/Linux     $ lsb_release -a     No LSB modules are available.     Distributor ID: Ubuntu     Description:    Ubuntu 13.04     Release:        13.04     Codename:       raring      Thanks in advance!


clone create date

I would like to clone only the create date and the filenames in source and destination are different. The name part of it is the same, it's the extension that isn't. AVI videos in one directory, MP4 in another. So I wanted to use `touch --reference=file1 file2`. works great on one file but I have about 100. Was hoping to script this but I am clueless. any help is appreciated. I do have a text file containing all the source filenames. Oh and lots of them have spaces and apostrophes in them too.


Shall I expect faster boot when I boot my system with run level 1

I understand that when I set runlevel as 1, my system will boot with very basic set of commands. Does that mean the system will boot faster as compared to run level 5 or 3?


Fastest way of find and replace in large file with replacing filed present in another file

I have two files. File1 is a csv with 60 fields:               111,Check1|^/h1/h2/h3,22062014184500,20,0.....     111,Check2|^/h43/h40/h9,22062014184500,4,.....     111,Check3|^/h1/h3/h4,22062014184500,0,0,.....      File2 is a mapping file:               OPUM04181,Check1|^/h1/h2/h3     OPUM04040235,Check3|^/h1/h3/h4     OPUM04051898,Check2|^/h43/h40/h9       Now what I have to do is in field 2 of file 1 I have to replace the field with the field 1 of file 1 of matching field 2. Example: In file1:               111,Check1|^/h1/h2/h3,22062014184500,20,0.....      will be               111,OPUM04181,22062014184500,20,0.....       where OPUM04181 and Check1|^/h1/h2/h3 is mapped in file2. My constraint is that File1 and file2 don't have the same set of values, their count is different. Also the line count is 3 million for both the files. This is what I was trying: I ran a loop taking field2 in file 1 I was checking if that field is present in file2. If present I took the field1 in file2. I was replacing the field2 in file1 using sed s///g. But this is taking enormous time. Also I can not sort File1. What is a faster method?


How to implement conditional update of deb package

I am creating a deb package of a product which is part open source and part proprietary. In order to reuse the built in functionality of some distributions like Ubuntu to monitor a list of repositories and update the package when a new version comes available I will probably create such a repository. The problem is that the proprietary part of the package depends on licenses which are valid for a limited interval versions (valid for all the versions in a course of a year). Which means that at some point of time when a new version is available it will be nice to at least warn the user that his license will not be valid for the new version. Is there a way to do that check and interact with the user? I see that there are scripts in the deb package itself that can be executed before installation, but I have no idea if they can interact with the user and abort the package installation. Any suggestions on how such a functionality can be created are appreciated.


Are commands executed through SSH transparent to a remote host's administrator?

Can administrators know what commands I execute **non-interactively** through SSH? For example: does `echo hello` get logged somewhere at `remote` if I run this?               $ ssh me@remote "echo hello"      Can remote commands be otherwise monitored?


awk - gensub function

I need to insert contents of variable to parameter function `gensub` in `awk`, specifically instead of regular expression's parameter. Can you help me with it? I have:               gawk '      BEGIN {        a = "abc15d56ef";        b = gensub(/.*([0-9][0-9])d([0-9][0-9]).*/, "\\2 \\1", "g", a);        print b;      }'      ### output               output:56 15      I need it to be in this form, but it doesn't work:               gawk '      BEGIN {        a = "abc15d56ef";        c="/.*([0-9][0-9])d([0-9][0-9]).*/";        b = gensub(c, "\\2 \\1", "g", a);        print b;      }'      ### output               output:56 15


Processing control characters

I have a log file which contains a bunch of non visible control characters such as hex \u0003. I would like to replace this using something like SED, but can't get the first part of the regex to match: > /s/^E/some_string I am creating the ^E by pressing CTRL-V CTRL-0 CTRL-3 to create the special character, as read from the 'man ascii' page: > 003 3 03 ETX However, nothing matches this control character. Any help appreciated!


What does the commands sudo, apt-get, install, and fakeroot stand for?

I am a newbie to Linux and I am trying to build a custom kernel on ubuntu and I saw this document and it said I needed to install the packages https://help.ubuntu.com/community/Kernel/Compile               To start, you will need to install a few packages. The exact commands to install those packages depends on which release you are using:          Hardy (8.04):           sudo apt-get install linux-kernel-devel fakeroot kernel-wedge build-essential     Note: The package makedumpfile is not available in Hardy.          Lucid (10.04):                sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge     sudo apt-get build-dep linux     sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev     sudo apt-get install linux-kernel-devel fakeroot kernel-wedge build-essential      > **sudo** = permits users to execute command as super user   >  **apt-get** = Get a package from the Advance Packing Tool ( something like > extract a package from a library kind of I believe)   >  **Install** - Operation to do   >  **linux-kernel-devel - ??????????????( what does this mean)**   >  **fakeroot** - Lets user do file manupulations as a fake user.   >  **kernel-wedge build-essential - ??????????????( what does this mean)** How and where can I see the meaning or function for every command in a document? Thanks in advance


Script to login to ssh twice

I need to login through `ssh` twice with a script and can't get it to work. This is what I have in my script file:               #!/usr/bin/expect          set login "user"     set addr "address1"     set addr2 "address2"     set pw "password"          spawn ssh $login@$addr     expect "$login@$addr\'s password:"     send "$pw\r"     expect "$login@host:"     spawn ssh $addr2     expect "$login@$addr\'s password:"     send "$pw\r"     interact      but this fails with the error:               user@host:~$ ssh: Could not resolve hostname address2: Name or service not known     send: spawn id exp7 not open         while executing     "send "$pw\r""      If I change the line `spawn ssh $addr2` with `exec ssh $addr2` it fails with the error:               user@host:~$ ssh: Could not resolve hostname address2: Name or service not known         while executing     "exec ssh $addr2"      What do I need to change in order to make this work?


Is there a robust command line tool for processing csv files?

I work with CSV files and sometimes need to quickly check the contents of a row or column from the command line. In many cases `cut`, `head`, `tail`, and friends will do the job; however, cut cannot easily deal with situations such as               "this, is the first entry", this is the second, 34.5      Here, the first comma is part of the first field, but `cut -d, -f1` disagrees. Before I write a solution myself, I was wondering if anyone knew of a good tool that already exists for this job. It would have to, at the very least, be able to handle the example above and return a column from a CSV formatted file. Other desirable features include the ability to select columns based on the column names given in the first row, support for other quoting styles and support for tab-separated files. If you don't know of such a tool but have suggestions regarding implementing such a program in Bash, Perl, or Python, or other common scripting languages, I wouldn't mind such suggestions.


Extract given column from comma-separated values with inner commas and quotation marks

I have a file in which the fields are separated by comma. Some example input:               col1,"1,2",col3     col1,"1,2,3",col3     col1,"1  2,3",col3     col1,"1 "2,3"",col3      Now, I have to fetch the second column, so that I get:               "1,2"     "1,2,3"     "1  2,3"     "1 "2,3""      `cut -d, -f2 file` doesn't do what I want. So, how can I retrieve column 2 from the above input?


Handling comma in string values in a CSV file

I have a comma-separated file which has numeric and string columns. String columns are quoted and can have comma in between the quotes. How do I identify the columns with `FS =","`? Sample records               "prabhat,kumar",19,2000,"bangalore,India"      In AWK it should be               $1 = "prabhat,kumar"     $2 = 19     $3 = "2000"     $4 = "bangalore,india"      Setting `FS=","` is creating the problem. Input is:               "prabhat,kumar",19,2000,"bangalore,India","ABC,DEF","GHI",123,"KLM","NOP,QRS"     "prabhat,kumar",19,2000,"bangalore,India","ABC,DEF","GHI",123,"KLM","NOP,QRS"      Output should be:               "prabhat,kumar"|19|2000|"bangalore,India"|"ABC,DEF"|"GHI"|123|"KLM"|"NOP,QRS"     "prabhat,kumar"|19|2000|"bangalore,India"|"ABC,DEF"|"GHI"|123|"KLM"|"NOP,QRS"      Code I am trying:               awk -F"," '{for(i=1;i<=NF;i++){if(i%NF==0){ORS="\n"} {if($i ~ /^\"/ || $i ~ /\"$/) {a=a OFS $i;j++;{if(j%2==0){sub(/^\,/,X,a); print a;j=0;a=""}}} else {print $i}}} {ORS="|"}}' ORS="|" OFS=, p.txt


Parse csv using awk

> **Possible Duplicate:**   >  Is there a robust command line tool for processing csv files? I am trying to parse the second line in a file (which contains commas within double quotes) > "100 Watt A19 10,000 Hour - Clear Light Bulb",American-Light-Bulb- > Mfg,552,Indoor Living>Home Furnishings>Lighting>Light Bulbs,"Product Code: > H20821 Energy Used: 100 Watts Rated Life: 10,000 Hours Volts: 130 Base: E26 > - Medium Screw (standard household base) Length: 4.45 Inches Diameter: 2.375 > Inches Bulb Type: > A19",1.75,Yes,http://www.buylighting.com/ProductDetails.asp?ProductCode=H20821&click=104182,http://www.buylighting.com/v/vspfiles/photos/H20821-2T.jpg,,New,,,0.1,H20821,,,,,,,,,,,,,,,,.25,Absolute,,,,,,,               head -2 file.csv | tail -1 | awk -F',' '{print $1}'      But it outputs:               "100 Watt A19 10      How can I use `awk` to get `"100 Watt A19 10,000 Hour - Clear Light Bulb"` as the value of `$1`? Also how can I use `awk` to get `"Product Code: H20821 Energy Used: 100 Watts Rated Life: 10,000 Hours Volts: 130 Base: E26 - Medium Screw (standard household base) Length: 4.45 Inches Diameter: 2.375 Inches Bulb Type: A19"` as the value of $5?


executing multiple greps in a single find command

I want to use find command to find some files containing multiple patterns at the same time. I tried something like this:               find . -name "*.xml" -exec grep -iH keyword1 + && grep -iH "keyword2" {} \;      But the above command doesn't work. Is it possible to do it in bash?


Unable to transfer files via SFTP when using a normal user account

I'm unable to transfer files via `WINSCP>sftp` to a GNU/Linux server. When transferring a file using root account, there's no problem. However, when I transfer using another account, the file being transferred shows 0 bytes and nothing happens when opening it. The folder I transfer files is `/home/avex` and the account I'm using to transfer is _avex_. I've verified that the folder has read and write permission and the owner of `avex` folder is _avex_ user. What would be the cause for such output here? and How do I transfer the file under _avex_ user ?


Cron log on debian systems

On Redhat systems cron logs into `/var/log/cron` file. What is the equivalent of that file on Debian systems?


Perform Cisco's DNS Doctoring on FreeBSD

How to perform a change in the DNS response from a DNS server to be a different IP address than the DNS server actually answered for a given name? http://www.cisco.com/en/US/products/hw/vpndevc/ps2030/products_tech_note09186a0080094aee.shtml Currently using PF (Packet Filter) on FreeBSD 9.0-RELEASE. Please help.


Backup & restore from Linux to Windows while Linux is running

I have a lab with some Linux machines, some are Red Hat 5.1 machines installed on HPDL580 HW, and some are Linux installed on BLADE IBM machines. Also I have laptop computer with Windows XP. My question: I want to backup the Linux machine as an image on my Win laptop, and then I need to restore the image to another HW, while the Linux machine I am restoring from must be up during backup process (I mean I can't shutdown the Linux machine). Please advice which free tool/application I can run on my Win XP laptop in order to backup the Linux machine and then restore to a second Linux machine from the imgae located on my Windows XP laptop. What is the best free tool for that?


Can I read and write to the same file in Linux without overwriting it?

> **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output? I frequently connect to amazon ec2 using their public DNS names   (`ec2-12-34-56-78.compute-1.amazonaws.com`) and because of this my `known_hosts` file gets overwhelmed with a lot of `ec2` entries I will never use again. I know I could probably use `sed -i` to edit in place but I wanted to use `grep` and so I did this:               grep -v ec2 ~/.ssh/known_hosts > ~/.ssh/known_hosts      That leaves `known_hosts` as an empty file. If I do:               grep -v ec2 ~/.ssh/known_hosts > ~/.ssh/tmp     mv ~/.ssh/tmp ~/.ssh/known_hosts      then things are fine, but I am confused why reading and writing to the same file leaves it blank, and if there is any way around this when using `grep`, `cat`, etc.


Redirecting tr stdout to a file

> **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output?   >  Can I read and write to the same file in Linux without overwriting it?               $ cat test.txt      This is a test file.     $ tr 'a' 'z' < test.txt      This is z test file.     $ tr 'a' 'z' < test.txt > test.txt     $ cat test.txt     $       Why does tr seem to output nothing to test.txt? I found this thread, but I don't really understand what is going on, and how to fix the problem. (Also, the reason I'm not using sed is because I want to replace newlines with another character, and I don't think sed can operate on a non-line-by-line basis?)


Redirecting head output for update hosts file

> **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output? I'm writing a script to change the content of my `hosts` file but I got stuck on the `head` output redirection. If I do `head -n -1 hosts >hosts` my `hosts` file will result empty and yes, it has more than 1 line.


How can I make iconv replace the input file with the converted output?

I have a bash script which enumerates through every *.php file in a directory and applies `iconv` to it. This gets output in STDOUT. Since adding the `-o` parameter ( in my experience ) actually writes a blank file probably before the conversion takes place, how can I adjust my script so it does the conversion, then overwrites the input file?               for file in *.php     do         iconv -f cp1251 -t utf8 "$file"     done


Command line 'buffer'

I wanted to `tail` the last 100 lines of a file to the same file, but the command `tail -n 100 file > file` doesn't work, I assume because the stdout gets written to the file 'live', before everything was read from the original file. Is there some way to pipe the output to _something_ , that then keeps it until all 100 lines are there, and then outputs it to the file? Or just another way to shorten the file in this way?


Personal health records software

Does anybody know personal health records software for Linux? I want to record blood pressure, pulse, temperature, feel to analyze later. I will write information manually, as my measuring instruments doesn't have connection to PC. Of course I can just write data to simple plain text file and then plot them with `gnuplot` or `matplotlib` as a true *nix user. But I think that this problem was solved and someone created more comprehensive tool, which for example can store blood analysis results, electrocardiograms, ..., can remind to measure blood pressure and pulse and so on. I've tried to google it, I've looked on this list but found only huge web- based systems for hospitals (like GNU Health, GNUmed, etc.).


How to correctly configure Debian watchdog daemon for BIOS Watch Dog?

Supermicro main boards contain a BIOS feature named "Watch Dog Function". Having Debian 6.0.6 with kernel "Linux debian 2.6.32-5-amd64 #1 SMP" we did:   1. Change BIOS "Watch Dog Function" from Disabled to Enabled.   2. Install the package watchdog (`# apt-get install watchdog`) Expected: that would be all for the watchdog function to be correctly installed. Result: system reboots every (roughly) 5 minutes. Change **BIOS** " **Watch Dog Function** " from Enabled to Disabled fixes the undesired reboots. The boot process seems to correctly enable the watchdog daemon. At least console displays (when BIOS Watch Dog is disabled):               Starting watchdog keepalive daemon: wd_keepalive.     Stopping watchdog keepalive daemon....     Starting watchdog daemon....      And on reboot this output is generated:               INIT: SUsing makefile-style concurrent boot in runlevel 6.     Stopping watchdog daemon....     Starting watchdog keepalive daemon....      What else need to be done to configure the BIOS watch dog function and Linux OS watchdog daemon to work together correctly?


Will grep go faster with line breaks?

I have some big files that I have changed into "standardized form", removing line breaks. I want to speed up greps on those files. I know that you can optimize grep by doing `grep 'partofpattern' | grep -E 'partofpattern [[:digit:]]+'` -- that is, have grep search for lines that contain a more simple part of a pattern and then have grep run a second time on the few lines that contain part of the pattern. That makes me think that grep somehow works line-by-line. So will adding line breaks to big files with no line breaks speed up grep?


Download tool needed -- with custom headers, resume, retry, custom filename output, and dynamic redirection

Simple problem -- I need a download manager, console, GUI, does not matter. The catch is in the features:   * custom header -- I have to pass a cookie in order to download (authorization)   * resume -- so if download stops for any reason, I could continue from 50% (for example), not from start   * retry -- so the program could automatically try establish connection and downloading again   * custom filename output -- so I could give specific filename, where the data go   * and dynamic redirection -- so if I ask server for file `X`, and server answers "OK, here is `X?token=767`" downloader will accept this with original name -- `X` (i.e. it will think it is the same I asked for) Since I prefer console, so far I tried wget, curl, aria2c. All of them fail. wget does not handle custom filename output (it is just a dump to a file) and it is "fooled" by redirection -- i.e. as with above example it will store the data in file `X?token=767` which in effect ruins both resume and retry, because with each reconnection the token changes. aria2c and curl do not even start downloading. My guess is, they don't accept redirection at all, aria2c retries again and again with 0 bytes download and no success, curl downloads the response from server the file was moved to `X?token=767`. For the record, below my commands for downloading: **wget**               wget -rc --no-cookies --header "Cookie: COOKIEKEY=COOKIEVALUE" \          "https://www.foo.bar/file.gz"      **aria2c**               aria2c -o f.gz --check-certificate=false -c -m0 \            --header="Cookie: COOKIEKEY=COOKIEVALUE" \            "https://www.foo.bar/file.gz"      **curl**               curl -o f.gz -C - --retry 1000 \          -H "Cookie: COOKIEKEY=COOKIEVALUE" \          "https://www.foo.bar/file.gz"


Missing separate debuginfo for - GDB

I have mentioned `-g` option along with `-Wall` in the `Makefile`. When I run `gdb onlineSunday`, I get:               Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_dds.so     Try: zypper install -C "debuginfo(build-id)=a84a1969b9a69361b10f26814c0958717c48d671"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_eps.so     Try: zypper install -C "debuginfo(build-id)=81e00b39aa9b3f7af23bad9d5bcef9f7cfe6333e"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_exr.so     Try: zypper install -C "debuginfo(build-id)=0101355f5aa48dca9cf2723c94d1a4b7eb21e2ec"     Missing separate debuginfo for /usr/lib64/libIlmImf.so.6     Try: zypper install -C "debuginfo(build-id)=f26997841c2902a0db04726d4018640cf367101e"     Missing separate debuginfo for /usr/lib64/libIex.so.6     Try: zypper install -C "debuginfo(build-id)=2af205c15500875184d2b8519dbe01404bdfb3ae"     Missing separate debuginfo for /usr/lib64/libHalf.so.6     Try: zypper install -C "debuginfo(build-id)=5134d1c2dc3c6ea90b5eeabd518eb746c853b87c"     Missing separate debuginfo for /usr/lib64/libIlmThread.so.6     Try: zypper install -C "debuginfo(build-id)=ebb1d12661df5bbf0dd39c7c717cd197ada35d98"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_jp2.so     Try: zypper install -C "debuginfo(build-id)=c1c25e24a14a9ec9163d623c699b6b53b7a1aabc"     Missing separate debuginfo for /usr/lib64/libjasper.so.1     Try: zypper install -C "debuginfo(build-id)=d521bb2892ccef13f28afaa82c0ef48433e46ca5"     Missing separate debuginfo for /usr/lib64/libjpeg.so.62     Try: zypper install -C "debuginfo(build-id)=c3638afbf013f8e33beaa3dc12f4d2dbdb3f8602"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_pcx.so     Try: zypper install -C "debuginfo(build-id)=d1b443e7a29dd71a2519d852057c814bcfc9c30b"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_pic.so     Try: zypper install -C "debuginfo(build-id)=4d533a04cab4426beaf2ae3c89eb2e026e5e1f81"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_psd.so     Try: zypper install -C "debuginfo(build-id)=39ff79c31ae413ebac40eb8baef54ac524886e57"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_ras.so     Try: zypper install -C "debuginfo(build-id)=7ecf3f8738c8cfacb14b6e54b53526346513dc8b"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_rgb.so     Try: zypper install -C "debuginfo(build-id)=fc5d771438bc73014a4d551eb3b996043729c625"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_tga.so     Try: zypper install -C "debuginfo(build-id)=9dd675ab0b9906bb234a90f8f4e9e65b7b6fbf63"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_xcf.so     Try: zypper install -C "debuginfo(build-id)=2bfe0932ffdf6473010f792e1bde388881fdaff0"     Missing separate debuginfo for /usr/lib64/kde4/plugins/imageformats/kimg_xview.so     Try: zypper install -C "debuginfo(build-id)=6ba5f69301b600fe14553d99ef495df1d08ba379"     "ReferenceError: Can't find variable: displayMapAndClick on line:1 Source:undefined"      Missing separate debuginfo for /lib64/libnss_files.so.2      **GDB version:**               anisha@linux-trra:~> gdb -version     GNU gdb (GDB) SUSE (7.2-3.3)          anisha@linux-trra:~>      **The package:**               linux-trra:~ # cnf debuginfo-install          Program 'debuginfo-install' is present in package 'yum-utils', which is installed on your system.          Absolute path to 'debuginfo-install' is '/usr/bin/debuginfo-install'. Please check your $PATH variable to see whether it contains the mentioned path.          linux-trra:~ #      **The system:**               linux-trra:~ # cat /etc/issue && uname -a     Welcome to openSUSE 11.4 "Celadon" - Kernel \r (\l).          Linux linux-trra 2.6.37.1-1.2-desktop #1 SMP PREEMPT 2011-02-21 10:34:10 +0100 x86_64 x86_64 x86_64 GNU/Linux          linux-trra:~ #      **This is what I did:**               linux-trra: # zypper install -C "debuginfo(build-id)=a84a1969b9a69361b10f26814c0958717c48d671"     Retrieving repository 'Updates for openSUSE 11.4 11.4-0' metadata [done]     Building repository 'Updates for openSUSE 11.4 11.4-0' cache [done]     Retrieving repository 'devel:languages:R:patched' metadata [done]     Building repository 'devel:languages:R:patched' cache [done]     Loading repository data...     Reading installed packages...     No provider of 'debuginfo(build-id) = a84a1969b9a69361b10f26814c0958717c48d671' found.     Resolving package dependencies...          Nothing to do.          linux-trra: #      **What to do now?** * * *               linux-trra: # zypper ar -f -n "openSUSE-11.4-Debug" http://download.opensuse.org/debug/distribution/11.4/repo/oss/ repo-debug     Adding repository 'openSUSE-11.4-Debug' [done]     Repository named 'repo-debug' already exists. Please use another alias.          linux-trra: # zypper ar -f -n "openSUSE-11.4-Debug" http://download.opensuse.org/debug/distribution/11.4/repo/oss/ repo-debug-update     Adding repository 'openSUSE-11.4-Debug' [done]     Repository named 'repo-debug-update' already exists. Please use another alias.          linux-trra: #


Power saving enables touchpad

I've installed power saving packages (bumblebee, laptop-mode-tools, and cpufreq) to my laptop with Debian Wheezy. Thanks to that I decrease power usage from 32W to 10W. But now I faced the issue that I can't disable touchpad. I wrote simple script that inverts state of touch-pad:               #!/bin/sh     synclient TouchpadOff=`synclient | grep TouchpadOff | awk '{print !$3}'`      When I launch this script, it inverts state of touch-pad as expected, but in 5 seconds TouchpadOff is rewritten with value "2", and touch-pad becomes active again. I suppose that it's laptop-mode-tools who modifies TouchpadOff variable. I tried to find related settings in laptop-mode-tools, but didn't find anything. Any ideas how to determine who modifies TouchpadOff variable and how to disable such a modification?


Why does e2fsck fail during boot, but not later?

When booting my Debian server, I'm presented with the following error concerning my external hard drive:               /dev/disk/by-label/elements:     The superblock could not be read or does not describe a correct ext2 filesystem.     ....     ....     fsck died with exit status 8.     ...     ...          A maintenance shell will now be started. CONTROL-D will terminate this shell and     resume system boot.      The thing is that if I type `Ctrl-d` or enter the maintenance shell the disk is correctly mounted and calls to `e2fsck /dev/disk/by-label/elements` report no errors. This is very annoying since I need to type `ctrl-d` every time the server is rebooted and I would rather not have a keyboard attached to the server at all.


Opensolaris snmp broadcast

A network sensor I'm evaluating is showing that my Opensolaris server is broadcasting on the snmp port 161, and I'm getting alerts about every 2 minutes. How can I turn off the snmp broadcast (i.e. traps?) on the Opensolaris machine? We have snmp enabled on the Opensolaris machine for Cacti, so it should really just be acting like a client in regards to snmp. Is there a configuration setting somewhere? I'm not familiar with snmp, but somehow got it up and running for Cacti. I see that /usr/sbin/snmpd is running. Any thoughts? Thanks.


How to archive POP3 mailbox?

What programs are available to archive a mailbox (to mbox or maildir format) that I can only access via POP3? I'd like to be able to browse the mailbox locally afterwards, probably using mutt or the like. I'm on Debian stable, no problem to compile from source if needed, commandline preferred.


How to have find only search for files in changed directories?

Currently I'm repeatedly doing a 'find' that's too slow. I'm searching for non-hidden executable files within "$root", excluding "$root/bin":               find "$root" -type f -perm -o+x -not -path "$root/bin/*" \( ! -regex '.*/\..*' \)      I'd like to restrict find to only look in directories with mtimes older than a certain time. I still want it to recurse into old directories' subdirectories, but I don't want it to check the regular files inside unless the directory passes my mtime check. Is it possible to do this with GNU find or do I need two invocations, one to find the directories and another to check the files inside?


Custom action to open an program instance for each selected folder?

In Thunar, I want to be able to open folders with Ex Falso. I created a custom action with the command `/usr/bin/exfalso %f`. This works when I select a single folder. When I select several folders, I want Thunar to open an Ex Falso instance for each selected folder. I tried the parameters `%F` and `%N`, but then Ex Falso gets opened for the first folder only.


How do I print the process name next to the process ID number in a file?

I'm redirecting results for something into a file and I also need to find the process name and ID number and redirect it to the file as well. I'm guessing the process name is the command in which I'm directing the results to. As in if the command is `pgrep sshd` and I redirect the results to the file, `pgrep sshd` would be the process name. I'm just curious though how exactly I find the process ID number and what would be the simplest way to redirect it to a file if there is a command to find it. Here is the original objective I was given, I'm sorry if I seem really new at this, I am a student. > Man pages usually have a helpful section near the end called "SEE ALSO" that > you can use to find a list of commands and topics related to the command > that the current man page is about. Use this feature to locate a command > related to "ps" that will search for processes based on some criteria. Use > this command to locate all processes called sshd, directing the output to a > file named `processes.txt` in `~/sysadmin1`, making sure that the command > also prints out the process name next to the process ID number. You will > have to specify a flag with the command that you find in the man page for > the command in order to do this. When you have finished add the full command > used to the top of the `processes.txt` file.


openSUSE not starting up after failed update

More than failed it was a partial update, when I was updating there was a power failure and my laptop shutdown (battery is broken). Now when I try switching my system on, it shows the chameleon and then it just shows a small cursor at the top left of the screen and stays there forever. Any help to recover?


How to route specific adresses through a tunnel?

There are certain websites/services which I can only access from the subnet on which my server is located (think of the typical intranet scenario). Is there a way to transparently route traffic that go to these addresses through an SSH tunnel? Consider the following setup: My laptop is connected on the home network. It cannot access services on ips X and Y directly. I have an SSH tunnel to a server which is on a subnet that can actually access these services. Can I somehow automatically encapsulate all the traffic to the subnets of X and Y to go through this tunnel, without having to run the entire VPN solution that would send all my traffic through the server? In other words: all traffic that goes to any other subnet should still go directly from the laptop, without passing through the server (using the tunnel).


Batch File Rename Using Mapping File

I have a large collection of image files, for example:               a.png, b.png, c.png, etc      If I have a file with mappings of filenames to numbers, like so (ignore the format, it could be anything):               a=>1     b=>2     c=>3     ...      Is there any easy way to batch rename all the files using the mapping file to:               1.png, 2.png, 3.png, etc      I'm looking for unix/linux commands. I know I can write a very simple script, but just curious if there is any other technique. Thanks


Backing Up to a Compressed Archive on Linux

How would you go about backing up just some files and subdirectories of a given directory to a compressed archive so that the tree structure could then easily be recreated from that archive. Basically, rsync, with a little bit of scripting around (to select the files and folders I need) does the job, except I don't want to just copy. I need an additional layer that compresses the files being rsynced into some kind of compressed archive (which could then be restored with the paths being recreated). Rsync doesn't necessarily have to be part of the solution. E.g., can I mount an archive on so that everything that goes to that mount point gets compressed?


Pretty output in GHCI: no colours shown

Using this method to get a pretty GHCI colours, I am not getting any colours whatsoever. However, my terminal is a urxvt with 256 colours enabled and TERM is `xterm-256color`. Any idea what I could have missed? My ~/.ghci reads:               import qualified IPPrint     import qualified Language.Haskell.HsColour as HsColour     import qualified Language.Haskell.HsColour.Colourise as HsColour     import qualified Language.Haskell.HsColour.Output as HsColour          let myColourPrefs = HsColour.defaultColourPrefs { HsColour.conid = [HsColour.Foreground HsColour.Yellow, HsColour.Bold], HsColour.conop = [HsColour.Foreground HsColour.Yellow], HsColour.string = [HsColour.Foreground HsColour.Green], HsColour.char = [HsColour.Foreground HsColour.Cyan], HsColour.number = [HsColour.Foreground HsColour.Red, HsColour.Bold], HsColour.layout = [HsColour.Foreground HsColour.White], HsColour.keyglyph = [HsColour.Foreground HsColour.White] }          let myPrint = putStrLn . HsColour.hscolour (HsColour.TTYg HsColour.XTerm256Compatible) myColourPrefs False False "" False . IPPrint.pshow          :set -interactive-print=myPrint     :set -XNoMonomorphismRestriction     :set prompt "λ "      The prompt should look like this: ![haskell ghci colour prompt](http://i.stack.imgur.com/8ZAZu.png)


How to associate device to sata port disk

I have 2 hard disks connected to 2 sata ports. The disks are associated to /dev/sda and /dev/sdb. These hard disks are in software raid so it happens that the system can go for some time with only one disk and then the second disk is added again to the array. I need to be able somehow to display the information:               /dev/sda -> is sata port 0 or 1     /dev/sdb -> is sata port 0 or 1      but I cannot understand how to do it, can anybody help me out? I'm running ubuntu server 12.04.2.


Installing from source - do I need to keep the extracted tarball directory

If I'm installing from source, do I need to keep the extracted tarball directory? So if I download the git tarball. I then do:               tar -xvzf git.tar.gz      This will create a `git.x.x`. directory, into which I `cd`, then run `./configure` etc. Once I'm done with this process, and `git`, or whatever is installed, do I need to keep the original `git.x.x` extracted directory, or is that just used for compiling the program? I'm somewhat confused by all the directories, and folders used for programs.


Cleaning after installation

Is it safe to remove the downloaded tar once the program is installed (once I run ./configure, make, make install)?


telinit 1 and run a command there

I need to do some maintenance on a bunch of Debian (Wheezy) systems, and it has to happen at run level 1. But not all machines have a keyboard and a screen; some are even located somewhere else. So I can't just go there and type in the root password to trigger the job. So my question is how can I tell Debian to run a command right before the "Type root password or ^D" prompt? I've tried to make a init script that only runs on run level 1, but still it was triggered before all processes where killed. Is there a way to do this?


What is the problem with the output of plink?

On my Windows7 machine, I'm traversing to the installed path of PuTTy Application and running:               plink <hostname>      to connect to my remote Linux host. I see some unrecognized characters in the output as:               -bash-3.2$ ls -lrt     ←[00mtotal 96     drwx------ 5 lg262728 lg262728  4096 Jun 10 15:32 ←[00;34mmyScripts←[00m     drwx------ 2 lg262728 lg262728  4096 Jun 12 13:19 ←[00;34mmyLangs←[00m     drwxr-xr-x 4 lg262728 lg262728  4096 Jul  1 07:43 ←[00;34mmyWorkSpace←[00m     ←[m-bash-3.2$      What is wrong here? Is it something about encoding?


`mount -o loop` changes mounted ISO image file

It looks like `mount -o loop` changes the mounted image file. I downloaded the ISO image file and checked its SHA-1 checksum. Then I mounted that ISO file and the checksum changed. Here are the exact steps I made, a copy-paste from my console, CentOS 7 x64 (note, that ISO file is read-only):               [mbartnicki@89-78-33-81 Downloads]$ ls -lh     total 3.1G     -r--r--r--. 1 mbartnicki mbartnicki 3.1G Mar 31 18:28 X17-58997.iso     [mbartnicki@89-78-33-81 Downloads]$ sha1sum X17-58997.iso      6c9058389c1e2e5122b7c933275f963edf1c07b9  X17-58997.iso     [mbartnicki@89-78-33-81 Downloads]$ sudo mount -o loop X17-58997.iso /mnt/iso/     mount: /dev/loop0 is write-protected, mounting read-only     [mbartnicki@89-78-33-81 Downloads]$ sha1sum X17-58997.iso      994944df320e9e03c032263d7b9e36157a0a587c  X17-58997.iso      I was so surprised, that I repeated above steps on another machine (Ubuntu 14.04 x64), just to get the same result: file checksum changed after `mount -o loop`. Unmounting ISO image doesn't return its checksum to original value; file change is persistent. Moreover, next mount change the checksum again to some new value. How can it be explained? **PS** Mounting explicitly read-only by adding `ro` mount option prevents file from being changed, so that if I use: `sudo mount -o ro,loop X17-58997.iso /mnt/iso` then everything is OK, and ISO image file lasts unchanged after mount. The wrong behaviour occurs only when `ro` option is not specified, even if the ISO image file is read-only on the file system level. I tried on three different ISO images: Windows 7 installation DVD (official), SystemRescueCD (small rescue Linux) and hand-made ISO created by `genisoimage` tool. I checked all that ISO files with `file` utility, and `file` said that all of them are _ISO 9660 CD-ROM filesystem data_. Files inside ISO images are not changed - I also checked it - it looks like the faulty mount scenario adds some meta-data or just garbage.


install and run new version of R

an old version of R is already installed on the server I am working with, but it is not really useful for my work. I have tried to install R 3.1.1 on my own directory (/local/data/project/behi) on the server using this command : $ wget http://cran.rstudio.com/src/base/R-3/R-3.1.1.tar.gz $ tar xvf R-3.1.1.tar.gz $ cd R-3.1.1 $ ./configure --prefix=$HOME/R $ make && make install when I tried to run R (by just typing R in my directory) again it showed me the old version of R. would somebody please let me know what the problem is and how I can **install** and **run** the new version of R? thanks in advance, Behi


Java location from /usr/bin/java

I'm trying to find my java location within my Linux system and got this               [980@b449 ~]$ which java     /usr/bin/java               [980@b449 ~]$ readlink -f $(which java)     /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java      what is the difference between the 2 commands?


Running Plasmoid under NOTKDE (e.g. Fluxbox) - Plasma/DeviceNotifier

Is there way to run Plasma/DeviceNotifier under another WM to KWin/KDE (e.g. Fluxbox). To be more specific, I have currently configured KDE, but I work remotely thorough SSH -Y + X-forwarding. So running `plasma-desktop` might run all other Plasmoids/Widgets. I'd like to run only one : DeviceNotifier. As I see it runs thought libs, no standalone executable there:               ~$ pacman -Ql | grep devicenoti     kdebase-workspace /usr/lib/kde4/plasma_applet_devicenotifier.so     kdebase-workspace /usr/lib/kde4/plasma_engine_devicenotifications.so     kdebase-workspace /usr/share/kde4/services/plasma-applet-devicenotifier.desktop     kdebase-workspace /usr/share/kde4/services/plasma-dataengine-devicenotifications.desktop     kdebindings-python /usr/share/sip/PyKDE4/solid/devicenotifier.sip     kde-l10n-pl /usr/share/locale/pl/LC_MESSAGES/plasma_applet_devicenotifier.mo     kdelibs /usr/include/solid/devicenotifier.h      So... how to run it ? ## Update: Running `plasma-desktop` **does not work**. I run on my laptop:               laptop$ xinit;     laptop$ ssh -Y desktop;     desktop$ fluxbox #X forwarding      So I run fluxbox on remote machine ("Desktop"). When I run in such situation `plasma-desktop` I end-up with whole screen messed up with all widgets I normally use on remote machine when I work on it locally. There are few problems there : (1) On desktop I have six times more screen space, (2) when I work remotely I do not need most of stuff I need when I work locally (3) I'm afraid of running another instance remotely of all those widgets and stuff, when it's already running on desktop. That's why I am asking about running only one widget. It can be `plasma-desktop`, but running only one widget, but not whole stuff I have setup and running on desktop locally.


How does one remove items from the menu plugin on LXPanel?

How does one remove items from the menu plugin on the panel? I am using lubuntu 11.10, LXPanel 0.5.8.


How to prevent ssh-agent from starting in CentOS?

How do I stop ssh-agent from starting when logging into CentOS via openssh? There are no references to ssh-agent in my bash startup scripts (.bashrc) or /etc/bashrc.


Xresources color settings

I'm using Gentoo with XMonad and set all the colors in `.Xresources` file. The problem is that for some apps setting `*.background` and `*.foreground` is not enough since they override the settings for some fields. Here's an example of what's wrong: ![enter image description here](http://i.stack.imgur.com/djDDE.png) The background should be similar to the dark window elements, but it's white and gray instead. What are some other xresources variables that set dialog window colors and what is the correct way to overcome this problem? My current `.Xresources` file:               ! Solarized colorscheme for Xresources     ! ====================================                         ! To choose between light/dark bakground:     ! - Define the choice in ``.Xresources`` by hardcoding     !   #define SOLARIZED_LIGHT     !   or     !   #define SOLARIZED_DARK     ! - Define the symbol when loading ``.Xresources`` with ``xrdb``:     !   $ xrdb -DSOLARIZED_LIGHT -merge ~/.Xresources                         #if !defined(SOLARIZED_LIGHT) && !defined(SOLARIZED_DARK)     #define SOLARIZED_DARK     #elif defined(SOLARIZED_LIGHT) && defined(SOLARIZED_DARK)     #undef SOLARIZED_LIGHT     #endif                         ! Define Solarized colors     ! -----------------------     #define S_base03    #002b36     #define S_base02    #073642     #define S_base01    #586e75     #define S_base00    #657b83     #define S_base0     #839496     #define S_base1     #93a1a1     #define S_base2     #eee8d5     #define S_base3     #fdf6e3                         #define S_yellow    #b58900     #define S_orange    #cb4b16     #define S_red       #dc322f     #define S_magenta   #d33682     #define S_violet    #6c71c4     #define S_blue      #268bd2     #define S_cyan      #2aa198     #define S_green     #859900                         #ifdef SOLARIZED_LIGHT     #define S_emph      S_base01     #define S_primary   S_base00     #define S_secondary S_base1     #define S_bgrnd_hi  S_base2     #define S_bgrnd     S_base3     #endif     #ifdef SOLARIZED_DARK     #define S_emph      S_base1     #define S_primary   S_base0     #define S_secondary S_base01     #define S_bgrnd_hi  S_base02     #define S_bgrnd     S_base03     #endif                         ! black dark/light     *color0:                S_base02     *color8:                S_base03     ! red dark/light     *color1:                S_red     *color9:                S_orange     ! green dark/light     *color2:                S_green     *color10:               S_base01     ! yellow dark/light     *color3:                S_yellow     *color11:               S_base00     ! blue dark/light     *color4:                S_blue     *color12:               S_base0     ! magenta dark/light     *color5:                S_magenta     *color13:               S_violet     ! cyan dark/light     *color6:                S_cyan     *color14:               S_base1     ! white dark/light     *color7:                S_base2     *color15:               S_base3                                             ! General Xresource settings     ! ==========================     !     #define FONT_REGULAR xft:Liberation Mono:style=Regular:pixelsize=14      #define FONT_BOLD xft:Liberation Mono:style=Bold:pixelsize=14      #define FONT_ITALIC xft:Liberation Mono:style=Italic:pixelsize=14      Xft*antialias: true                         *foreground:                S_primary     *background:                S_bgrnd     *Foreground:                S_primary     *Background:                S_bgrnd     *cursorColor:               S_emph     *pointerColorForeground:    S_emph     *pointerColorBackground:    S_secondary     *fading:                    40     *fadeColor:                 S_bgrnd                                             ! Xscreensaver     ! ============     xscreensaver.captureStderr: false     !font settings     xscreensaver.Dialog.headingFont: FONT_REGULAR     xscreensaver.Dialog.bodyFont:    FONT_REGULAR      xscreensaver.Dialog.labelFont:   FONT_REGULAR      xscreensaver.Dialog.unameFont:   FONT_REGULAR      xscreensaver.Dialog.buttonFont:  FONT_REGULAR      xscreensaver.Dialog.dateFont:    FONT_REGULAR      xscreensaver.passwd.passwdFont:  FONT_REGULAR      !general dialog box (affects main hostname, username, password text)     xscreensaver.Dialog.foreground: S_primary     xscreensaver.Dialog.background: S_bgrnd     xscreensaver.Dialog.topShadowColor: S_bgrnd     xscreensaver.Dialog.bottomShadowColor: S_bgrnd     xscreensaver.Dialog.Button.foreground: S_primary     xscreensaver.Dialog.Button.background: S_bgrnd_hi     !username/password input box and date text colour     xscreensaver.Dialog.text.foreground: S_primary     xscreensaver.Dialog.text.background: S_bgrnd_hi     xscreensaver.Dialog.internalBorderWidth: 24     xscreensaver.Dialog.borderWidth: 0     xscreensaver.Dialog.shadowThickness: 1     xscreensaver*logo.width: 1     xscreensaver*logo.height: 1     !timeout bar (background is actually determined by Dialog.text.background)     xscreensaver.passwd.thermometer.foreground: S_red     xscreensaver.passwd.thermometer.background: S_blue     xscreensaver.passwd.thermometer.width: 4                               ! rxvt-unicode terminal     ! =====================     !     URxvt*background: S_bgrnd     URxvt*foreground: S_primary     URxvt*font: FONT_REGULAR     URxvt*boldFont: FONT_BOLD     URxvt*italicFont: FONT_ITALIC     URxvt.colorIT: S_magenta     URxvt.colorBD: S_green     URxvt.colorUL: S_blue     URXVT.borderColor: S_bgrnd_hi     URxvt.highlightColor: S_bgrnd_hi     URxvt.scrollBar: false     URxvt.saveLines: 1000     URxvt.cursorBlink: true     URxvt.pointerBlank: true     URxvt.modifier: alt


How to create initrd.img from initrd.lz

I need to create `initrd.img` file from `initrd.lz` file. How may I do this?


Why should /var /opt /tmp /home /boot directories be on different partitions?

As the title says, why should I split these directories across multiple partitions? Performance? Security maybe?


How enable watchdog?

I'm struggling with the watchdog timer (wdt) for a while. I can't get it working. My microcontroller is a AriaG25, based on the AT91SAM925. I have used this tutorial to compile the kernel. The kernel settings related to the wdt looks like this:               CONFIG_WATCHDOG=y            CONFIG_AT91SAM9X_WATCHDOG=y         The kernel has been compiled without problem and boots succesfully. I've installed the watchdog deamon software via `apt-get`. And now I'm stuck. How do I get the watchdog working? I read a lot about `/dev/watchdog`. I don't have that file. Do I have to put the driver for my hardware there? Is this a driver?


How to make wget download recursive combining --accept with --exclude-directories?

I'm trying to download some directories from an Apache server, but I need to ignore some directories that have huge files I don't care about The dir structure in the server is somewhat like this (simplified):               somedir/     ├── atxt.txt     ├── big_file.pdf     ├── image.jpg     └── tmp         └── tempfile.txt      So, I want to get all the `.txt` and `.jpg` files, but I DON'T want the `.pdf` files nor anything that is in a `tmp` directory. I've tried using `\--exclude-directories` together with `\--accept` and then with `\--reject`, but in both attempts it keeps downloading the `tmp` dir and its contents. These are the commands I've tried:               # with --reject     wget -nH --cut-dirs=2 -r --reject=pdf --exclude-directories=tmp \              --no-parent  http://<host>/pub/somedir/          # with --accept     wget -nH --cut-dirs=2 -r --accept=txt,jpg --exclude-directories=tmp \              --no-parent  http://<host>/pub/somedir/      Is there a way to do this? How exactly is `\--exclude-directories` supposed to work?


How to add an audio file to a shell script

How can I add an audio file (OGG vorbis) into a shell script making the script as small as possible and at the same time being able to execute it on as most systems as possible? I want the audio file be played. I don’t want it to be `uuencode`d, because sharutils are not installed on many systems. base64 is nice, but makes the file/script bigger, which I don’t want. Should I use `mplayer` or the `play` command from the sox package? Is it more common on Linux/BSD systems? Or is there another media player mostly installed? Should I convert the audio file to another format/codec (if that doesn’t make the file much bigger) to have more possible players to play the file back or is OGG vorbis a good choice?


How to correctly add a path to PATH?

I'm wondering where a new path has to be added to `PATH` environment variable. I know this is accomplished editing `.bash_rc` (for example), but it's not clear how to do this. This way:               export PATH=~/opt/bin:$PATH      or this?               export PATH=$PATH:~/opt/bin      Question 2 (related). What's a workable way to append more paths on different lines? Initially I thought this could do the trick:               export PATH=$PATH:~/opt/bin     export PATH=$PATH:~/opt/node/bin      but it doesn't because the second assignment doesn't only append `~/opt/node/bin`, but also the whole `PATH` previously assigned. This is a possible workaround:               export PATH=$PATH:~/opt/bin:~/opt/node/bin      but for readability I'd prefer to have one assignment for one path.


Setting PATH vs. exporting PATH in ~/.bash_profile

What's the difference and which is better to use when customizing my bash profile? Documentation on the `export` command is scarce, as it's a builtin cmd. Excerpt from version 1 of my ~/.bash_profile:               #PATH     export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$HOME/bin          #add Homebrew’s sbin to PATH     export PATH=/usr/local/sbin:$PATH      Output from: `echo $PATH` `/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/njboot/bin` Excerpt from version 2:               #PATH     PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$HOME/bin          #add Homebrew’s sbin to PATH     export PATH=/usr/local/sbin:$PATH      Output from `echo $PATH` is the same as in version 1. `env` is the same as well. So:   * 1) What's the benefit of using `export` vs. setting PATH explicitly?   * 2) Is there any functional difference between version 1 and version 2 when applied?   * 3) Which should I use and why?


Path is there, but cannot call one program without specifying path

> **Possible Duplicate:**   >  How to correctly add a path to PATH? I installed "perf" on Linux. But I can only use it by specifying the path: `~/bin/perf` I checked path by using `echo` and I found `/bin` is there. What else should I do?


How to create an unprivileged user in CentOS?

I want to create an unprivileged user to run my RhodeCode server and Celery daemon on a CentOS instance. I think the accepted definition of this is no home directory, login disabled, and no shell access? Looking over the man page for adduser I just don't see an intuitive method for doing this. Any suggestions are appreciated. Thanks.


Rename Multiple files and add date before the files

I have a folder contains one or more tar.gz files. I want to add current date before each files when the script run. For example: Two file name(those files will be created each day, but the name will remain the same):               file1.tar.gz      file2.tar.gz      In first day(2011-10-07), those two files will be renamed to:               2011-10-07_file1.tar.gz     2011-10-07_file2.tar.gz      In next day(2011-10-08), they are changed to:               2011-10-08_file1.tar.gz     2011-10-08_file2.tar.gz      Finally, the folder contains the following files:               2011-10-07_file1.tar.gz     2011-10-07_file2.tar.gz     2011-10-08_file1.tar.gz     2011-10-08_file2.tar.gz      How to achieve this using one line? I tried to use "rename" command, but I can only add the date after the file, not before. ## My code               cdate=`date +"%Y-%m-%d"`; rename .gz .gz.$cdate *.gz


File not found: Beautiful Soup

I am trying to run a program that I downloaded in Ubuntu latest version, but I continue getting an error everytime I try to run the program. It says:               File Not Found: BeautifulSoup      So in order to attempt to fix this, I've downloaded the bs4 beautiful soup package through the command line. I've tried running `python`, and then importing it by doing, `from bs4 import BeautifulSoup`. I have tried many different variations of this and downloading and redownloading it. I've tried running the `from bs4 import BeautifulSoup` directly from the terminal, but that did not work and returned an error. Does anyone know anyway to fix this issue or what I need to do?


conditional expression and expansion

I don't seem to understand how to "test" the conditional operators [[ and [. I tried using various form such as               echo [[a=a]]          [[a=a]]     echo $?      and some other things I want to see what they return, to test some comparisons. How do you expand them, or execute them?


is setting a 0 permission on a directory an effective way to protect its contents?

Let's say that permissions for `user` and `group` are set up correctly on a directory. Would a 0 permission for `other` on that directory provide effective access control for the directory's files and subdirectories? Are there gotchas to consider? When you create files that are `rw` to other people (like with Unix Domain Sockets) people think of it as a security issue, since there's a race condition that a malicious user can exploit before proper permissions are applied to a file. That's why I'm looking for an "atomic" way of doing basic permissioning.


Resume input from user after file is read

I have a program that reads user input—moves, it's a boardgame—from the user. Like so:               $ game     enter your move:      # etcetera      The first _N_ moves I need to repeat each time, so I put them in a text file, one line each. That works:               $ game < moves.txt      This works, but after these _N_ moves, how do I return to input from the command line? I realize this is probably a duplicate question, but I couldn't find it.


How can I get to a terminal or virtual console when Ctrl-Alt-F2 fails?

When X and GNOME are working normally, I can just hit `Ctrl`-`Alt`-`F2` to leave GNOME and use the terminal on the second virtual console. To switch back to GNOME, I can just hit `Alt`-`F1`. Today, X or GNOME stopped working normally for me and I was unable to get to a virtual console. I was still able to move my mouse cursor around but I wasn't able to click anything. As far as I could tell, my keyboard was unresponsive, but maybe the right keyboard shortcut would have helped. I ended up pressing the power button on the computer to gracefully shut it down, but what could I have done to avoid this? I'm using CentOS 6.0 and GNOME 2.28.


Pasting the content of xclip onto gedit

> **Possible Duplicate:**   >  Copy file to xclip and paste to Firefox I would use the following command to copy the output of `uptime` to the clipboard:               uptime | xclip      Then I can paste the copied uptime to the console by clicking the middle button of mouse. But when I go to an application like "gedit", there is no _Paste_ option available there. How can I copy a text into clipboard so that it could be pasted onto something like "gedit"?


Automating web requests using curl?

I have some "corporative" systems I have to use at work. Some of them are terrible, with frames, pop-ups and such. I was thinking about automating some stuff using curl or something like that. I need login, click on hyperlinks, set some data, and them do some post. Is it possible to use curl? Or am I'm going to be better using something like Selenium?


What command line tools are available for testing Web Service?

> **Possible Duplicate:**   >  Does anybody here have experience in automating some tasks in web > applications using curl? There are a number of GUI based tools to test Web Service (e.g. soapUI) Is there any our command line driven tool that can be used to test a Webservice. Not just the connectivity, but also capture and compare the result returned by a web service


Add a path in $PATH globally for every user

Do we have anyway to add a path globally so that each user gets it in $PATH. I want to add path of ANT so that each user doesn't need to add it in his $PATH variable.


Gigabit network connection in Ubuntu issue with new hardware

Probably its typical issue, but I couldn’t found the answer. Sometime ago I had mini-ITX server worked on ZOTAC IONITX-G-E. It was managed by Ubuntu 10.10. I setuped Gigabit network with this server. I installed one additional network card (Planet ENW-9700. It's PCI-E x1 card) because it did some routing, that's why I need two network cards. I used DGS-1005D as Gigabit switch. It worked fine, Planet network card had Gigabit network connection. When I used it, network speed was ~40-50Mb\s. After that a month ago I decided to do upgrade, because that system wasn't enough for me. I bought new Asus P8H77-I motherboard with Intel i3-3225. I installed it in the same box instead of Zotac motherboard and installed Ubuntu Desktop 12.10. But somehow network card doesn't work as Gigabit connection. Distance between server and switch is 6-7 meters. I googled for it, and found some similar topics for Realtek NIC(this motherboard uses Realtek 8111F). So, based on some manuals I download latest Realtek drivers from this page, compiled them and installed. I disabled previous one RTL8169 driver that used before. But after that there is no Gigabit connection. I tried to force it by               sudo ethtool -s eth0 speed 1000 duplex full autoneg on      but it didn't do anything. Connection speed remained 100Mb\s. Here is ethtool eth0 output                Settings for eth0:         Supported ports: [ TP ]         Supported link modes:   10baseT/Half 10baseT/Full                                 100baseT/Half 100baseT/Full                                 1000baseT/Full         Supported pause frame use: No         Supports auto-negotiation: Yes         Advertised link modes:  10baseT/Half 10baseT/Full                                 100baseT/Half 100baseT/Full                                 1000baseT/Full         Advertised pause frame use: Symmetric Receive-only         Advertised auto-negotiation: Yes         Speed: 100Mb/s         Duplex: Full         Port: Twisted Pair         PHYAD: 0         Transceiver: internal         Auto-negotiation: on         MDI-X: Unknown         Supports Wake-on: pumbg         Wake-on: g         Current message level: 0x00000033 (51)                                drv probe ifdown ifup         Link detected: yes      Could you please suggest anything? I have the last option to install Planet NIC PCI-E x1 into PCI-E x16 slot and use it as before, but I don't want to occupy the only one PCI-E slot


How to download all images whose size>100kb in a webpage?

I want to download images contained in some web pages, but only those that are larger than 100 KB. So far I've been downloading all the images and then deleting the small ones, but it's not very efficient. Is there some way to ignore the small ones when downloading?


How do I echo a command and include line returns?

I am writing a bash script, and on a condition I'd like to output `ps aux --sort -rss` However, when I write :               echo `ps aux --sort -rss`      everything is on one huge line. How do I run it so it outputs like it normally does in a terminal?


How to separate numerical values from identifiers

I'm currently writing a shell script that seperate values from their identifiers (retrieved from grep). For example, if I grep a certain file I will retrieve the following information:               value1 = 1     value2 = 74     value3 = 27      I'm wondering what UNIX command I can use to take in the information and convert it to this format:               1 74 27      Appreciate any help


Test if telnet port is active within a shell script

I am trying to create a script to test whether it is possible to login via telnet. I do not want to really log in; therefore, expect is not needed. I just want to see if I am able to get a login prompt. This is being done from a Linux system so I have been trying to use `nc`:               nc 192.168.10.5 23 -w 1 | grep -q login      if [ $? -eq 1 ]     then         echo "console is down"     fi      The problem is that this is causing my console to lock up. It seems like the `-w` is not really dropping the connection. I also tried using telnet but I am not able to break the connection from within the script. Trying               \echo "\035" | telnet 192.168.10.5      breaks before I get a login prompt.


Installing OpenGL in fedora 14

I am trying to install OpenGL on my Fedora. But first I am confused with some concepts. I am using ATI Radeon 5470 card and I downloaded the driver from the official website. Here is the link I want to ask **Q1:** is this equivalent to OpenGL? **Q2:** How to uninstall the driver I have installed. PS: I used `sh ati-driver-installer-11-11-x86.x86_64.run` in the command line. A GUI pops up and after several clicks. The driver is installed, which is quite simple. **Answer Q2 by myself:** For the second question: There is a script installed on my system               sudo sh /usr/share/ati/fglrx-uninstall.sh


Where is boost installed on Debian?

I currently don't have a lot of internet quota so I didn't want to install the latest boost libraries. Instead I installed Boost 1.49 using the Synaptic Package Manager and my Debian DVDs. Now that boost (seems to be) installed, how I can I include the headers and link to the binaries when I compile my code? Do I still have to compile boost or is it already compiled for my machine? I can run `bjam`, which produces this: > warning: No toolsets are configured. warning: Configuring default toolset > "gcc". warning: If the default is wrong, your build may not work correctly. > warning: Use the "toolset=xxxxx" option to override our guess. warning: For > more configuration options, please consult warning: http://boost.org/boost- > build2/doc/html/bbv2/advanced/configuration.html > > error: error: no Jamfile in current directory found, and no target > references specified. Not surprisingly, it doesn't find what it's looking for. The link given takes me to a configuration page that doesn't seem to contain what I'm looking for. In Windows, I would unzip the files to `C:/Program Files/Common Files` and then run `bootstrap` followed by `b2 ...` to compile boost for my PC. These instructions seem to assume that we already know **where** boost actually is...


set verbose prints unrelated extra lines

Using `set -x` causes my shell to print unrelated stuff. For example:               $ set -x     ++ printf $'%157s\r'     $ echo 'hello'     + echo hello     hello     ++ printf $'%157s\r'      The lines starting with '++' are extra. How can I remove those extra lines?


terminal text editor with Windows like hotkeys

As a Windows user (please forgive me) interacting with GNU\Linux through SSH I am looking for a terminal-based text editor that has similar hot keys to most Windows text editors which I have grown extremely used to (the same hotkeys I use when editing this text in any browser on Windows). (Or I suppose a way to customise an existing editor).   * Cut: `Ctrl`+`X`   * Copy: `Ctrl`+`C`   * Paste: `Ctrl`+`V`   * Undo: `Ctrl`+`Z`   * Redo: `Ctrl`+`Y`   * Save: `Ctrl`+`S`   * Select all: `Ctrl`+`A`   * Jump one word right: `Ctrl`+`→`   * Jump one word left: `Ctrl`+`←`   * Select right: `Shift`+`→`   * Select left: `Shift`+`←`   * Select word right: `Ctrl`+`Shift`+`→`   * Select word left: `Ctrl`+`Shift`+`←`   * Select line up: `Shift`+`↑`   * Select line down: `Shift`+`↓`   * Jump to start of line:`Home`   * Jump to end of line: `End` And for kicker:   * Delete line: `Shift`+`Del`   * Copy and paste line: `Ctrl`+`C`+`V`


find command in cygwin giving parameter format not correct

I am using cygwin in my windows machine. I am trying to do a find and it is giving parameter format not correct. Why is that?               $ ls     bootstrap.jar     catalina-tasks.xml     catalina.bat     catalina.sh     commons-daemon-native.tar.gz     commons-daemon.jar     cpappend.bat     digest.bat     digest.sh     setclasspath.bat     setclasspath.sh     shutdown.bat     shutdown.sh     startup.bat     startup.sh     tomcat-juli.jar     tomcat-native.tar.gz     tool-wrapper.bat     tool-wrapper.sh     version.bat     version.sh          $ find . -name "version.sh"     FIND: Parameter format not correct        * Should I install anything while installing cygwin or am I doing something wrong?


similar content Project access from a single file

I create three different project which are access different three different database. Except that all project files are same. so, I want that in a project folder all project files and in other two only database connection file. In previous I listen it's possible. How I do this?


How do I delete a file in a read-only directory?

I've got a directory and a file in it, with the directory marked as read-only:               $ mkdir directoryname     $ touch directoryname/filename     $ chmod a-w directoryname      I cannot delete the file, even if pass the `-f` flag to `rm`:               $ rm -f directoryname/filename     rm: cannot remove `directoryname/filename': Permission denied      Is there a way to force `rm` to delete this file? Obviously, I could temporarily give `directoryname` write permissions, but I'm looking for a more convenient way. I believe the underlying `unlink` syscall fails in the same way. Is there a way to get around that?


Install grub on LV container for VM

I'm having difficult time installing grub in LVM LV container for a VM. This is the partition table:               # parted /dev/mgtvg/linux2os print     Model: Linux device-mapper (linear) (dm)     Disk /dev/dm-7: 129GB       Sector size (logical/physical): 512B/512B     Partition Table: msdos           Number  Start   End     Size    Type      File system  Flags      1      1049kB  6469MB  6468MB  primary   ext3         boot      2      6469MB  11.8GB  5369MB  primary   xfs      3      11.8GB  17.2GB  5369MB  primary   xfs      4      17.2GB  129GB   112GB   extended               lba      5      17.2GB  22.6GB  5369MB  logical   xfs      Partition one contains the root file system (there is no /boot). Attempting to install grub:               # grub --device-map=/dev/null                   GNU GRUB  version 0.97  (640K lower / 3072K upper memory)           [ Minimal BASH-like line editing is supported.  For the first word, TAB        lists possible command completions.  Anywhere else TAB lists the possible        completions of a device/filename.]     grub> device (hd0) /dev/mgtvg/linux2os     device (hd0) /dev/mgtvg/linux2os     grub> root (hd0,0)     root (hd0,0)      Filesystem type is ext2fs, partition type 0x83     grub> setup     setup          Error 1: Unrecognized device string     grub>       This is the `grub.conf` file from the LV containing the VM:               default=0     timeout=5     splashimage=(hd0,0)/grub/splash.xpm.gz     hiddenmenu     serial --unit=1 --speeed=19200     terminal --timeout=8 console serial     title CentOS (2.6.32-279.22.1.el6.x86_64)             root (hd0,0)                kernel /vmlinuz-2.6.32-279.22.1.el6.x86_64 ro root=/dev/sda1             initrd /initramfs-2.6.32-279.22.1.el6.x86_64.img     title CentOS (2.6.32-279.el6.x86_64)             root (hd0,0)                kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/sda1             initrd /initramfs-2.6.32-279.el6.x86_64.img      What else do I need?


Comparing text files using Bash and AWK

I have two text files, and I want to compare their corresponding values according to their rows and columns. By comparing, I mean to check if the values are equal and echo if the values are the same or not. Here are the files: `file1.txt`               Name  Col1  Col2  Col3       -----------------------     row1  1     4     7             row2  2     5     8              row3  3     6     9         `file2.txt`               Name  Col1  Col2  Col3       -----------------------     row2  1     4     11             row1  2     5     12      Here are the constraints:   * compare only the rows that exist (that is, since row3 exists in file1.txt, but not in file2.txt, no comparison is needed)   * Must use AWK   * The rows may be out of order in the files   * No double arrays since my version of AWK doesn't support it I am thinking of something like this:               awk 'NR>2 {next}     {         for (i=2;i<NR;i++)              #For each row of file1.txt         {                  for(j=1;i<NF;j++)           #For each column of file1.txt             {                  // Check if row and column of file1.txt is equal to row and column of file2.txt.             }          }     }     ' file1.txt file2.txt      How do you compare values of two different text files? Let me know if more explanation is needed. All I'm asking for is a general structure using AWK. Hopefully I can figure out the rest.


Processes lose attachment to shell when started via bash -x

Normally, if I run `emacs &` and then close the shell, emacs will exit. However, if I run `bash -x foo.foo` (where `foo.foo` is a script that runs `emacs &`), then emacs will remain open even when I exit the shell. Is there a way to make all processes close when the shell exits, even when the processes were started via a call to `bash -x`?


How to configure SSL in apache?

I have installed apache in RHEL 6. Everything is working fine. What all changes and configurations should be done to use https://localhost:443/. If I change the "Listen 80" to 443 it is throwing an SSL connection error "Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error."


Restoring default ip rule

I accidentally issued `ip rule flush`, now the default ip rule are all gone, which is,               32766:  from all lookup main      32767:  from all lookup default      Anyone know how to add them back?


read only access to all files in a specific sub-folder

I have got a specific folder located in "/home/.../reboot/". I have a series of users that require read-only access to the ever changing files within. My problem is that the same users are not authorized to view any of the parent directory files. Right now, the only thing I have in place is that their starting folder is at "/home/.../reboot/" by changing the etc/passwd file; and I need to block all access to other folders. How could I only give them access to this directory?


Permission issues when doing system backup using rsync

I'm trying to backup my linux system (arch linux on a laptop) to a remote computer on the same network using ssh (or NFS). I use rsync extensively to backup my /home directory to the remote computer over ssh and NFS with no issues whatsoever. What I want to do is run the rsync command on the laptop within a script and copy all of the contents of / (excluding some directories of course, that I already have figured out) to the remote computer. The issue I'm having is about permissions. I have disabled root login on the ssh server (openssh, running on an ubuntu server 12.04 computer) and I disabled password authentication and enable rsa key login so I can run the backup scripts automatically using cron on the laptop. Now, for me to able to copy all of the system's files under /* (on the laptop) I need to run rsync as root. Doing that introduces a problem since I'm not able to access the ssh server as root. If I try to do it over NFS i get another permision problem since the root user isn't allowed to access the NFS mount, as my regular user is. I'm writting here so I can get suggestion on how to solve this problem. I would prefer to do it over ssh since it usually works a lot faster for me, but I'm willing to use NFS or even samba (haven't tried that one) if no other thing works.