Installing Pencil on openSUSE

I have installed openSUSE 11.4 today and I am trying to install Pencil on it. I downloaded the ArchLinux tarball from the site, and after extracting it, the _pencil.sh_ file didn't install, giving a bash error (permission denied). I also tried searching for it on YaST, but didn't find it there. I need some help.


difficalty to save traceroute output in shell variable?

I need to filter and store `traceroute` output in shell variable (array). But I am getting some unusual output. As I try to explain in following lines. My present directory is `temp`, having some files:               /temp$ ls      ask.html  data_dump (2)  DB-Assignemnt .sql          When I run `traceroute` on command line its output is correct as I desired.               /temp$ traceroute -m 5 www.google.com  | awk '{print  $2 , $3}'     to www.google.com     172.22.0.1 (172.22.0.1)     ABTS-North-Static-085.3.160.122.airtelbroadband.in (122.160.3.85)     * *     203.101.83.197 (203.101.83.197)     182.79.254.249 (182.79.254.249      If I save output in a variable `a` `/temp$ a=$(traceroute -m 5 www.google.com | awk '{print $2 , $3}')` When I `echo $a` The output is not understood to me. > ~/temp$ echo $a   >  to www.google.com 172.22.0.1 (172.22.0.1) ABTS-North-Static-   >  085.3.160.122.airtelbroadband.in (122.160.3.85) ask.html data_dump (2) DB- > Assignemnt .sql **ask.html data_dump (2) DB-Assignemnt .sql ask.html > data_dump (2) DB-Assignemnt .sql ask.html data_dump (2) DB-Assignemnt .sql**   >  203.101.100.186 (203.101.100.186) Why `ls` executed itself and input is save in variable `a`.


Directory permissions vs file permssions

If I have two users called `john` and `sally`. Both are part of the `users` group. `john` creates a directory with permissions `775`. `sally` then puts a file there with `644` permissions. Even though the file obviously has no group write privileges. Can `john` then modify/delete that file in the directory he owns but the file he does not own?


What is the difference between ps and top command?

What is the difference between `ps` and `top` command ? I see that both can display information about running processes . Which one should be used when ?


How does systemd survive a kill -9?

Between the recent "Why does 'kill -9 0' end my console session" and "How to get a kernel panic" questions, I got a bur under my saddle and tried `kill -9 1` on a mostly up-to-date Arch linux laptop. I did it as user ID "root". I fully expected some kind of crash or panic or shutdown, but nothing happened. I did `kill -9 1` again, to no effect. Arch linux machines run `systemd` these days, so: how does `systemd` survive a kill -9? I expect there's special case code in the Linux 3.7 kernel, but maybe some other reason exists that I haven't thought of. What about other things that run with PID 1? Slackware still uses `init` I believe, but I'm scared to try it on my production Slackware server. DD-WRT on my wireless router runs /sbin/init of some sort.


which DE to use for setting up defaults

I'll use awesomewm as my main DE but without installing any actual DE(like KDE, GNOME, XFCE etc) I have to setup too many basic stuff like mouse cursor themes, gtk/qt theme engines and themes, clipboard manager, sound manager, screen manager(like lxrandr, arandr etc.), auto-mounter ... Now I was thinking if it's possible to just install a DE and get it's settings for those, and then move to awesomewm with all those settings are set up. Is it possible, and if so, which DE do you recommend for that purpose ?


Is Debian 6 EOL or not?

I read that support for Debian 6 ended this month. And here I read that there is LTS until 2016. https://www.debian.org/News/2014/20140424 Is this for paying customers only? Or can we safely keep using Debian 6?


python-pam not working... How to dig for the error?

I have a django application where users should be able to login according to the system's shadow database. I found this login backend which uses python- pam, as far as I can tell. While installing the former makes the login work on my local machine (Arch linux) it doesn't on the server where I want the application to run (Debian Squeeze). The thing is, I don't know how to dig for the error. The authentication just returns false and I cannot find any log files for the PAM library on the system. Where would you start to dig? Update: I found that /var/log/auth.log is used by pam. The following appears when trying to login. (oli is my username):               Jan  4 15:09:13 pc13620 python: pam_tally(login:auth): unknown option: pam_faildelay.so     Jan  4 15:09:13 pc13620 python: pam_tally(login:auth): unknown option: delay=3000000     Jan  4 15:09:13 pc13620 python: pam_tally(login:auth): Error opening /var/log/faillog for update     Jan  4 15:09:13 pc13620 unix_chkpwd[8070]: check pass; user unknown     Jan  4 15:09:13 pc13620 unix_chkpwd[8070]: password check failed for user (oli)     Jan  4 15:09:13 pc13620 python: pam_unix(login:auth): authentication failure; logname=  uid=33 euid=33 tty= ruser= rhost=  user=oli     Jan  4 15:09:13 pc13620 unix_chkpwd[8071]: check pass; user unknown     Jan  4 15:09:13 pc13620 unix_chkpwd[8071]: password check failed for user (oli)


How do I extract with tar to a different directory?

This doesn't work:               tar xf /tmp/foo.tar.gz foo/bar     tar: foo/bar: Not found in archive      It's not obvious to me what would do this beyond extracting it in place and moving the files over.


How to edit authorized_keys?

What is the best method for editing the `/root/.ssh/authorized_keys` file? I mean if I need to append a new key to my `authorized_keys` file, than what are the best methods to do that?


How to start an application on a different workspace?

I need to start a GUI application [Lotus Symphony] on a workspace different from the currently used one. [ex.: there are 4 workspaces on a GNOME desktop.] Q: How do I do this? p.s.: It's needed because Lotus Symphony's first start after a reboot is very, very slow, but after it's been used once, it starts very quickly. I think it caches itself. That's why I want to start it at every boot on a different workspace, so it will be fast later if I need to use it.


Delete backward until met a char, like alt + bksp

Say my current line was: `/tmp/path/to/file:123` Now I'm at the end of this line, now I want to delete `:123` by pressing some key combination, was that possible? (colon was merely mentioned as an example, it could be other chars, just wondering if I could bind keys to do that) It's similar to what `alt` + `Backspace` does, but more specific on the word separator. Bash or zsh are all welcomed.


Partitioning a 2tb drive

Im new to linux Im planning to install Squeeze on a 2tb hard drive a follows:   * / - 10gb   * swap   * remaining space will contain /home, around 1.9tb i hope, i will try to use as lvm to add my old 1tb drive later My question is: do i have to use GPT? or MBR will be just fine if GPT needed this scheme is good?   * /boot - 150mb   * / - 10gb   * swap   * /home (lvm with remaining space) motherboard is an ASRock G41 btw wich i think doesnt support EFI


What does `*` mean using hexdump -C?

I've been doing an exersice in attempt to understanding some of what's going on under the hood of a program. I wrote a small C program, and compiled it on i386 Linux (Ubuntu 12.04) using `gcc`. I then did a `hexdump -C` on the output to text file. I noticed that there were some gaps on the offset with an `*`:               00000670  00 3f 1a 3b 2a 32 24 22  1c 00 00 00 40 00 00 00  |.?.;*2$"....@...|     00000680  94 fd ff ff 05 01 00 00  00 41 0e 08 85 02 42 0d  |.........A....B.|     00000690  05 03 01 01 c5 0c 04 04  38 00 00 00 60 00 00 00  |........8...`...|     000006a0  80 fe ff ff 61 00 00 00  00 41 0e 08 85 02 41 0e  |....a....A....A.|     000006b0  0c 87 03 41 0e 10 86 04  41 0e 14 83 05 4e 0e 30  |...A....A....N.0|     000006c0  02 4a 0e 14 41 0e 10 c3  41 0e 0c c6 41 0e 08 c7  |.J..A...A...A...|     000006d0  41 0e 04 c5 10 00 00 00  9c 00 00 00 b4 fe ff ff  |A...............|     000006e0  02 00 00 00 00 00 00 00  10 00 00 00 b0 00 00 00  |................|     000006f0  a2 fe ff ff 04 00 00 00  00 00 00 00 00 00 00 00  |................|     00000700  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|     *     00000f10  00 00 00 00 ff ff ff ff  00 00 00 00 ff ff ff ff  |................|     00000f20  00 00 00 00 00 00 00 00  01 00 00 00 10 00 00 00  |................|     00000f30  0c 00 00 00 d4 82 04 08  0d 00 00 00 cc 85 04 08  |................|     00000f40  f5 fe ff 6f ac 81 04 08  05 00 00 00 2c 82 04 08  |...o........,...|     00000f50  06 00 00 00 cc 81 04 08  0a 00 00 00 54 00 00 00  |............T...|     00000f60  0b 00 00 00 10 00 00 00  15 00 00 00 00 00 00 00  |................|     00000f70  03 00 00 00 f4 9f 04 08  02 00 00 00 20 00 00 00  |............ ...|     00000f80  14 00 00 00 11 00 00 00  17 00 00 00 b4 82 04 08  |................|     00000f90  11 00 00 00 ac 82 04 08  12 00 00 00 08 00 00 00  |................|     00000fa0  13 00 00 00 08 00 00 00  fe ff ff 6f 8c 82 04 08  |...........o....|     00000fb0  ff ff ff 6f 01 00 00 00  f0 ff ff 6f 80 82 04 08  |...o.......o....|     00000fc0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|     *     00000ff0  00 00 00 00 28 9f 04 08  00 00 00 00 00 00 00 00  |....(...........|     00001000  26 83 04 08 36 83 04 08  46 83 04 08 56 83 04 08  |&...6...F...V...|     00001010  00 00 00 00 00 00 00 00  47 43 43 3a 20 28 55 62  |........GCC: (Ub|     00001020  75 6e 74 75 2f 4c 69 6e  61 72 6f 20 34 2e 36 2e  |untu/Linaro 4.6.|     00001030  33 2d 31 75 62 75 6e 74  75 35 29 20 34 2e 36 2e  |3-1ubuntu5) 4.6.|     00001040  33 00 00 2e 73 79 6d 74  61 62 00 2e 73 74 72 74  |3...symtab..strt|     00001050  61 62 00 2e 73 68 73 74  72 74 61 62 00 2e 69 6e  |ab..shstrtab..in|     00001060  74 65 72 70 00 2e 6e 6f  74 65 2e 41 42 49 2d 74  |terp..note.ABI-t|     00001070  61 67 00 2e 6e 6f 74 65  2e 67 6e 75 2e 62 75 69  |ag..note.gnu.bui|     00001080  6c 64 2d 69 64 00 2e 67  6e 75 2e 68 61 73 68 00  |ld-id..gnu.hash.|     00001090  2e 64 79 6e 73 79 6d 00  2e 64 79 6e 73 74 72 00  |.dynsym..dynstr.|      My question is, how should I interpret the `*`? I assume it means there's a gap in the file, but then the question turns to why does a gap exist? Is this part of the standard format of an ELF file?


Cannot connect to belkin router through linux mint

I recently installed Linux Mint 13 alongside windows 7. I have a Realtek RTL8191SEvB Wireless Card. This work's fine with any router. However when I try to connect to a Belkin G Wireless Router it constantly says the passwords or encryption type are incorrect. They are not. I can connect to the Belkin router when I start my laptop (a toshiba satelite) with windows. Any ideas?


How can I be sure that access to my home server from my home network is not done via Internet?

As advised in this question: Network file-sharing between Linux and Android, I have decided to use ownCloud to store files on my home cloud server. However, my needs have changed a bit. I want to be able to access my cloud from the Internet, not just my home network. For that, I need dynamic DNS software. I have that taken care of (domain name and everything) - I will be using DynDNS. However, when I'm at home, is it possible to configure the server/client so that when I try to access my files it is done through my home network (192.168. _._ ) and not via Internet (querying DynDNS and what not), without having to keep the system thinking that there are two different servers?


Xen/KVM/LXC for testing packages

On Debian Stable, I would like to be able to create a new instance of the OS, use apt-get to install some Unstable packages with dependencies, then cleanly delete the whole thing when I'm done. VirtualBox or QEMU would work, but Xen/KVM/LXC seem to be lighter and faster. How do they compare for this use? Edit: To clarify, in this case, I want to set up to be able to install-use- remove dangerous things without messing up the base system. Looking for what would be most lightweight/fast.


What priorities can be used in cgroups net_prio module?

Cgroups has a module called `net_prio`, and by using this module I can set the priority of network traffic generated by various applications. As you can read here, this can be achieved by setting something similar to the following:               echo "eth0 5" > /sys/fs/cgroups/net_prio/iscsi/net_prio.ifpriomap      But there's no info as to what range of priorities I can use. Let's say there's a program in my system that should have the lowest network priority. What should I use in the pace of 5 ? Are the priorities similar to `nice` priorities?


How to run a script from another path, and know the script's path?

I need to run a script that access a file in the same path it is located. For example: I have the script in `/home/me/folder/script.sh`, and this script will access the file `/home/me/folder/myfile`. As the file is in the same path of the script, I just use the name `myfile`, not the full path. But if I run it from `/tmp/`, like:               /tmp$ /home/me/folder/script.sh      it gives me:               myfile: No such file or directory      So, how can I say in the script that the file is in the same path as the script itself?


VIM Executing a key command in a function

I have a function, and I want to execute a key command, but I get the error Trailing characters:               function! MyFunction()       if condition         <C-W><C-W>       else         :some_other_command       endif     endfunction      It doesn't like the <C-W><C-W> What can I use instead?


Deleting lots of files

I accidentally created 8 million files and every time I'm trying to delete them the server almost dies because of the rm process eating all disk IO (the server is remote without console). Should something like this work i.e. invoking ionice?               sudo find /var/lib/php5/ -type f -exec ionice -c3 rm -f {} \;


How do I stop PuTTY becoming unresponsive to input when displaying large amounts of text?

I use a windows 7 machine to `ssh` into a remote Linux machine using `PuTTY 0.62`. When I accidentally forget to stream the output to a file and run a program that prints a lot of data to the screen I find that putty becomes unresponsive to `Ctrl`+`C` and I just have to wait 5 minutes before my keystroke to be registered. Is there any way to limit the incoming data rate so I can still send keystrokes to the remote machine in the event that I get myself in this situation again? I should add that it's not really `PuTTY` _per se_ becoming unresponsive, but it's just not sending keystrokes, presumably because network throughput is being gobbled up by millions of lines of text being displayed on the screen. I am using `tmux`, and the session is equally slow to respond to `Ctrl`+`b` as to any other command.


pulseaudio sink always suspended

I am on Debian Pulseaudio 2.0-6.1. Up to now never had any issues with sound. I made some experiments with remote sinks and now it seems pulse it totally messed up. I have only one sink. When I restart pulseaudio pactl shows the sink as IDLE. As soon as an application tries to output sound the state changes to SUSPENDED and stays that way. "pactl suspend-sink 0 0" does not change the state. I can only get it to IDLE by restarting pulse and the cycle starts again. After a reboot the problem persists.


Disable xscreensaver when program is running?

I find it very annoying that xscreensaver sometimes helpfully starts while I'm playing Urban Terror, and was wondering if there is a better way to solve this than making some script to run Urban Terror which kills xscreensaver first. My system is Arch Linux, with xscreensaver 5.22.


Double-Ended USB Unrecognized Alfa AWUS036NHR

I have a wonderful little wireless adapter that works perfectly well on Windows, but drops the connection regularly in Arch. As far as I can tell, it's not getting enough power to function properly. It has a USB cable that has two male ends, in order to double power input, but for whichever reason, Arch refuses to recognize that anything is in the other USB slot. This is the output from lsusb:               Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 003: ID 0bda:817f Realtek Semiconductor Corp. RTL8188RU 802.11n WLAN Adapter     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 002 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub      The adapter is at Bus 001. Any thoughts?


How to install 64 Bit snort on 64 Bit openSUSE 13.1?

My question is simple: I would like to install 64 Bit snort on my 64 Bit openSUSE 13.1. There is an unstable package available here:http://software.opensuse.org/package/snort I got everything but where can I get libpcre.so.0(64bit) that is missing on my system? The same question was on official openSUSE forum, but without any answer. It would be useful if someone can help me.


Put the XFCE extended dektop on the right-side monitor

Is it possible to make an aoutput showing extended desktop to the left of the primary? I'm using xfce.               $ xrandr --output VGA1 --primary --right-of LVDS1      The above command makes VGA1 as extended desktop to the right of LVDS1 but the primary part of the desktop (the part showing the apps menu button, the desktops, apps instances, applets, time and date ...) is on LVDS1. I want it on VGA1.


Apache Virtual Host pointing to wrong DocumentRoot

I operate a VPS on Digital Ocean running Ubuntu 12.04.3, with virtual hosts. I was able to set things up following this tutorial here: https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual- hosts-on-ubuntu-12-04-lts However, after a few days I navigated to my main domain (noelforte.com) to check and see if everything was running smoothly, but instead of seeing the landing page that I had temporarily set up, I instead was greeted with a directory listing. Oddly enough, the subdomain I had configured with VHosts was still pointed to the right directory, however my main domain reverted to pointing at the default document root of `/var/www`. Deleting the config files in `/etc/apache2/sites-available` and setting everything up again yielded the same results: any subdomain will point to the right location, however the root TLD remains stuck pointing to `/var/www`. What might cause a situation like this, and why then did it initially work properly?


how to get user's last login including the year in C

I'm trying to write a program that can get the user's last login time. Then i want to do something with the data. eg. check which user havent login for 90 days. So I tried using `last` command. This works great. Just that it doesnt display the year. So if I would do the checking on January 2014, how would I know the last login is actually would be on Dec 2013 or Dec 2012? This is an example of the code:               FILE *file1;     extern FILE *popen();     char command[1024];     char *username;     char result[1024];     char buff[1024];          username = "fikrie";     sprintf(command,"last %s",username);     file1 = popen(command, "r");     while(fgets(result, sizeof(result), file1)!=NULL){        sprintf(buff,"%s",result);     }     pclose(file1);      After some googling, I found out there's a -F flag to display the year. Unfortunately, it doesn't work on HP-UX or Solaris. These platform doesn't recognize that flag. I've also tested to used utmp based from this link here .The problem is this code will fail on Solaris and HP-UX. Seems like ut_tv doesn't exist in utmp struct.               #include <stdio.h>     #include <utmp.h>     #include <string.h>     #include <time.h>          int main(void) {         struct utmp *line;         time_t timestamp;         utmpname("/var/log/wtmp");         setutent();         while( (line = getutent()) != NULL) {                 if (line->ut_type == USER_PROCESS ) {                         timestamp = line->ut_tv.tv_sec;                         printf("%s %s", line->ut_user, asctime(localtime(&timestamp)));                 }         }         endutent();         return 0;     }      So, is there a way to do a C code that can generally get the last login for all the Unix platform. (Solaris, Redhat/Linux/CentOS, AIX, HP-UX, Ubuntu). Seems like when I manage to get it on 1 platform, then it fails on the others.


Identifying kernel modules

How do I get more information about a kernel module, like a long description? For example, I can see kernel modules like `lp` or `hid`, but those short codes do not mean anything useful to me.


IOMMU causing freezes, disabling causes USB to not work

I'm somewhat new to linux, but I'm running a Xubuntu machine that I recently built. Since I started it up, I had noticed frequent freezes, where both the screen (if plugged in) and any SSH session would become unresponsive. After some searching around, I was told to check kern.log for any errors. Every time the computer because unresponsive, there would be a long line of                   AMDvi: completion-wait loop timed out      entries. At the top of them, some string of errors, starting with a reference to a problem in .../drivers/AMD-iommu. After some more googling around, I was able to edit the grub config to force iommu=off at boot time, which I believed would solve my problems. Now I'm not getting any response from any IO on my motherboard, except for the PS/2 port. I've also checked my BIOS (It's the MSI Touch BIOS II), and have no options regarding disabling/modifying iommu settings. Any advice?


How to generate SELinux policies based on logs?

Afaik there is a solution/software that can automatically generate SELinux policies based on logfiles. I just don't know the name of the software/method that can do this..


On ssh connection the auth.log shows as source IP the external IP of the server instead of the IP of the client

I have a very odd situation with my ssh connection. Every time I connect to my server, whatever is my external ip, the connection have as source the server's external ip. Example                     Server S.O.:  PCLinuxOS         Client ip:    [C.C.C.C]         Server ip:    [S.S.S.S]      After ssh successful connection, I execute the "last" command and I get this:               username pts/0        [S.S.S.S]   Wed Jan 29 19:29   still logged in      This is the result of netstat searching for port 22:               $ netstat -atn | egrep '(:22)'     tcp        0     96 192.168.1.34:22            [S.S.S.S]:31685        ESTABLISHED      **I can't find the client ip [C.C.C.C] anywhere.** I wouldn't have any particular issue on this, but now comes the best part. I found an attack on my server inside the auth.log:               Jan 27 12:55:42 localhost sshd[2295]: Invalid user a from [S.S.S.S]     Jan 27 12:55:42 localhost sshd[2295]: input_userauth_request: invalid user a [preauth]     Jan 27 12:55:42 localhost sshd[2299]: Invalid user a from [S.S.S.S]     Jan 27 12:55:42 localhost sshd[2299]: input_userauth_request: invalid user a [preauth]     Jan 27 13:49:58 localhost sshd[17917]: Invalid user jack from [S.S.S.S]     Jan 27 13:49:58 localhost sshd[17917]: input_userauth_request: invalid user jack [preauth]     Jan 27 13:50:07 localhost sshd[17923]: Invalid user ibsadmin from [S.S.S.S]     Jan 27 13:50:07 localhost sshd[17923]: input_userauth_request: invalid user ibsadmin [preauth]      After this attack the result is that my fail2ban daemon will insert the server IP [S.S.S.S] on the banned list and I can't connect to my server anymore. The server is behind a router with a NAT port forwarding on ssh port. The issue is not present when I connect to the server from inside my LAN, the correct IP is showed in this case. This is my sshd_config file:               AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES     AcceptEnv LC_IDENTIFICATION LC_ALL     AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT     AuthorizedKeysFile      .ssh/authorized_keys     ChallengeResponseAuthentication no     ClientAliveInterval 60     HostKey /etc/ssh/ssh_host_dsa_key     HostKey /etc/ssh/ssh_host_key     HostKey /etc/ssh/ssh_host_rsa_key     IgnoreRhosts yes     KeyRegenerationInterval 1h     LoginGraceTime 30     MaxAuthTries 2     MaxSessions 4     MaxStartups 10:30:60     PasswordAuthentication no     PermitEmptyPasswords no     PermitRootLogin no     Port 22     PubkeyAuthentication yes     RSAAuthentication yes     StrictModes yes     Subsystem       sftp    /usr/lib64/ssh/sftp-server     TCPKeepAlive yes     UseDNS  no     UsePAM no     UsePrivilegeSeparation yes     X11Forwarding yes      I know for sure that I didn't had this issue one month ago, but I can't figure out what is changed. EDIT: This is the result of iptables -L command:               $ iptables -L     Chain INPUT (policy ACCEPT)     target     prot opt source               destination     fail2ban-SSH  tcp  --  anywhere             anywhere             tcp dpt:ssh          Chain FORWARD (policy ACCEPT)     target     prot opt source               destination          Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination          Chain fail2ban-SSH (1 references)     target     prot opt source               destination     RETURN     all  --  anywhere             anywhere


Learning to Use Virtual Manager in opensuse 12.2

Ok just installed virt-manager, and then install opensuse 12.2, installed correctly, but when do zypper up had no network, then turn off the virtual machine and change the network card to a vlan in the configuation files. Another thing I did as I was was to rename the vm. When I reboot I got the following error: ![enter image description here](http://i.stack.imgur.com/Tn8OZ.png) I'm totally a noob with kvm and virt-manager. So any thing that you can tell me about this and adding some extra info. would be great, thanks!


Changing systemd dependencies during boot

I am looking for a way to instruct systemd to recalculate service dependencies while the system is booting. Specifically, I need one service to be able to enable another service, and have the second service start up later in the same boot sequence. This is part of my automatic deployment process; very early in the boot process, the first time the system starts up, it automatically configures itself. One of the steps that it may need to take is enabling other services. Unfortunately, any changes it makes at that step do not seem to take effect until the following reboot. Rebooting the machine after initial deployment is not an option. Here's a generalized idea of what I'm trying to achieve /etc/systemd/system/firstboot.service:               [Unit]     Description=Enable MyService     DefaultDependencies=no     After=sysinit.target     Before=basic.target          [Service]     Type=oneshot     ExecStart=/bin/systemctl enable myservice.service     ExecStartPost=/bin/systemctl disable firstboot.service          [Install]     RequiredBy=basic.target      /etc/systemd/system/myservice.service:               [Unit]     Description=MyService          [Service]     Type=simple     ExecStart=/usr/local/bin/myservice          [Install]     WantedBy=multi-user.target      Unfortunately, this doesn't work as I expected; the service is enabled, but is not started before `multi-user.target`:               $ systemctl status myservice     myservice.service - MyService        Loaded: loaded (/etc/systemd/system/myservice.service; enabled)        Active: inactive (dead)      I can force it to start with `systemctl isolate multi-user.target` or by rebooting the machine. I have tried adding `systemctl daemon-reload` and/or `systemctl daemon-reexec` to `ExecStart`/`ExecStartPost` of `firstboot.service`, but neither seem to have any effect. Is there any way I can tell systemd to recalculate the boot path and include the changes that were made while it was still booting? Or will I need to do something later in the boot process to force my service to start?


The equivalent of start-stop-daemon for RedHat 6

I have an upstart script to create a service in RedHat 6:               env PLAY_BINARY=/usr/bin/play     env HOME=/opt/warda     env USER=root     env GROUP=root          [...]          script         exec start-stop-daemon --start --exec $PLAY_BINARY --chuid $USER:$GROUP --chdir $HOME --start $HOME     end script      In Ubuntu everything goes right. However in RedHat, when I launch `sudo initctl start play`, I get a successful feedback `play start/running`, but `play` doesn't run. I think that the problem is that `start-stop-daemon` doesn't exist in RedHat. How can I replace the `exec start-stop-daemon...` command?


Why does wc -l tell me that this non-empty file has 0 lines?

`xclip`/`xsel` are utilities that allow you to pipe clipboard output to the shell on Ubuntu. Unfortunately, they seem to fail in combination with the `wc` command. Try this. Open a new file and type:               this is a line      **without hitting the enter key at the end of the line**. Now, copy this text and try the following:               $ xsel -o | wc -l     0      The output is 0, when in fact it should be 1. Save the file (call it `myfile.txt`). Now try:               $ cat myfile.txt | wc -l     1      The output is 1, as expected. Why is the output 0 in the first case?


Why SAMP is not listening to the port

I have forwarded 38474 port to internal port 7778. Then I launched San Andreas Multiplayer on my CentOS server. When I'm typing `netstat -npl` I see this:               Proto: tcp     Recv-Q: 0     Send-Q: 0     Local Address: 0.0.0.0:7778     Foreign Address: 0.0.0.0:*     State:     PID/Program name: 1343/./samp03svr      So why `state` field is empty. When I'm looking to my server through SAMP client, it shows that server is available and shows ping to this server.


Uptime showing in tmux status bar

I want to show the uptime in the tmux status bar in this format `DD:HH:MM` without any of the other cruft that the `uptime` command shows. I've tried               #set -g status-left '#[fg=green]#H #[fg=black]•#[fg=green,bright]#(uptime|awk '{split(substr($0, index($0, "load")),a, ":"); print a[2]})'#[default]'     set -g status-right '#[fg=red,bg=default]#(uptime) #[fg=blue]%a%d-%m-%Y %H:%M:%S'      Neither of these work as I want, and What I'm looking for is just a straight uptime of `DD:HH:MM`, which will be updated every 30 seconds with the normal statusbar update.


manpages for my kindle?

I'd like to read unix manpages on my kindle. I know I can just redirect the man output to a file and give it a .txt extension. But is there a convenient way to convert them _en masse_ to a format with proper cross-references? Edit: An apology for my behavior in this question. I told pat that I would accept the comment if submitted as an answer, and then better answers came and I did not keep my promise (Sorry). I enthusiastically accepted Caleb's answer that produces html versions of the manpages; and then some time later when I actually tried transferring the files to the kindle, I discovered that the kindle would not display html files; and I switched acceptance without explanation (Sorry). The kindle appears to require .txt or .pdf (or one of the various _real_ eBook formats). I hope I have explained myself. Also, I didn't have a realistic understanding of how many, many manpages there are with a Debian Linux distribution, and so Caleb's comment about selecting a "Best Of" collection appears to be the best idea. But I don't really have the inclination to try to do this myself (which is a prerequisite for asking questions on StackExchange sites), so I'm not comfortable asking how to select the "Best Of", even though it really is necessary practically in order to do this.


ProvisioningError installing Samba

I'm trying to install samba, but it fails:               kavinlu@kavinlu-IT:/etc/init.d$ sudo apt-get -f install samba4     Reading package lists... Done     Building dependency tree            Reading state information... Done     The following extra packages will be installed:       libdcerpc-server0 libdcerpc0 libgensec0 libregistry0 libsamba-policy0 python-samba samba4-common-bin     Suggested packages:       bind9 phpldapadmin samba-gtk swat2     Recommended packages:       samba4-dsdb-modules     The following NEW packages will be installed:       libdcerpc-server0 libdcerpc0 libgensec0 libregistry0 libsamba-policy0 python-samba samba4 samba4-common-bin     0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.     Need to get 0 B/4,143 kB of archives.     After this operation, 23.2 MB of additional disk space will be used.     Do you want to continue [Y/n]? y     Preconfiguring packages ...     Selecting previously deselected package libgensec0.     (Reading database ... 207432 files and directories currently installed.)     Unpacking libgensec0 (from .../libgensec0_4.0.0~alpha17~git20110807.dfsg1-1ubuntu1_amd64.deb) ...     Selecting previously deselected package libdcerpc0.     Unpacking libdcerpc0 (from .../libdcerpc0_4.0.0~alpha17~git20110807.dfsg1-1ubuntu1_amd64.deb) ...     Selecting previously deselected package libregistry0.     Unpacking libregistry0 (from .../libregistry0_4.0.0~alpha17~git20110807.dfsg1-1ubuntu1_amd64.deb) ...     Selecting previously deselected package libdcerpc-server0.     Unpacking libdcerpc-server0 (from .../libdcerpc-server0_4.0.0~alpha17~git20110807.dfsg1-1ubuntu1_amd64.deb) ...     Selecting previously deselected package libsamba-policy0.     Unpacking libsamba-policy0 (from .../libsamba-policy0_4.0.0~alpha17~git20110807.dfsg1-1ubuntu1_amd64.deb) ...     Selecting previously deselected package python-samba.     Unpacking python-samba (from .../python-samba_4.0.0~alpha17~git20110807.dfsg1-1ubuntu1_amd64.deb) ...     Selecting previously deselected package samba4-common-bin.     Unpacking samba4-common-bin (from .../samba4-common-bin_4.0.0~alpha17~git20110807.dfsg1-1ubuntu1_amd64.deb) ...     Selecting previously deselected package samba4.     Unpacking samba4 (from .../samba4_4.0.0~alpha17~git20110807.dfsg1-1ubuntu1_amd64.deb) ...     Processing triggers for man-db ...     Processing triggers for ureadahead ...     Setting up libgensec0 (4.0.0~alpha17~git20110807.dfsg1-1ubuntu1) ...     Setting up libdcerpc0 (4.0.0~alpha17~git20110807.dfsg1-1ubuntu1) ...     Setting up libregistry0 (4.0.0~alpha17~git20110807.dfsg1-1ubuntu1) ...     Setting up libdcerpc-server0 (4.0.0~alpha17~git20110807.dfsg1-1ubuntu1) ...     Setting up libsamba-policy0 (4.0.0~alpha17~git20110807.dfsg1-1ubuntu1) ...     Setting up python-samba (4.0.0~alpha17~git20110807.dfsg1-1ubuntu1) ...     Setting up samba4-common-bin (4.0.0~alpha17~git20110807.dfsg1-1ubuntu1) ...     Setting up samba4 (4.0.0~alpha17~git20110807.dfsg1-1ubuntu1) ...     Administrator password will be set randomly!     Unknown parameter encountered: "max log size"     Ignoring unknown parameter "max log size"     Unknown parameter encountered: "syslog"     Ignoring unknown parameter "syslog"     Unknown parameter encountered: "passdb backend"     Ignoring unknown parameter "passdb backend"     Unknown parameter encountered: "unix password sync"     Ignoring unknown parameter "unix password sync"     Unknown parameter encountered: "passwd program"     Ignoring unknown parameter "passwd program"     Unknown parameter encountered: "pam password change"     Ignoring unknown parameter "pam password change"     Unknown parameter encountered: "map to guest"     Ignoring unknown parameter "map to guest"     Unknown parameter encountered: "usershare allow guests"     Ignoring unknown parameter "usershare allow guests"     Unknown parameter encountered: "guest ok"     Ignoring unknown parameter "guest ok"     Unknown parameter encountered: "guest ok"     Ignoring unknown parameter "guest ok"     Unknown parameter encountered: "max log size"     Ignoring unknown parameter "max log size"     Unknown parameter encountered: "syslog"     Ignoring unknown parameter "syslog"     Unknown parameter encountered: "passdb backend"     Ignoring unknown parameter "passdb backend"     Unknown parameter encountered: "unix password sync"     Ignoring unknown parameter "unix password sync"     Unknown parameter encountered: "passwd program"     Ignoring unknown parameter "passwd program"     Unknown parameter encountered: "pam password change"     Ignoring unknown parameter "pam password change"     Unknown parameter encountered: "map to guest"     Ignoring unknown parameter "map to guest"     Unknown parameter encountered: "usershare allow guests"     Ignoring unknown parameter "usershare allow guests"     Unknown parameter encountered: "guest ok"     Ignoring unknown parameter "guest ok"     Unknown parameter encountered: "guest ok"     Ignoring unknown parameter "guest ok"     ProvisioningError: guess_names: 'realm =' was not specified in supplied /etc/samba/smb.conf.  Please remove the smb.conf file and let provision generate it     dpkg: error processing samba4 (--configure):      subprocess installed post-installation script returned error exit status 1     Processing triggers for libc-bin ...     ldconfig deferred processing now taking place     Processing triggers for python-support ...     Errors were encountered while processing:      samba4     E: Sub-process /usr/bin/dpkg returned an error code (1)      What's going wrong? How do I fix it?


API Monitoring and Hooking

I am currently reading the "Malware Analyst's Cookbook and DVD". There is a chapter "Dynamic Analysis" and there are also some recipes about hooking and monitoring API calls of process but it is for Windows. I want to do the same thing like recipe 9-10 explains but for Linux. 9-10 is called "Capturing process, Thread, and Image Load Events". In this receipe it is showed "how to implement a driver that alerts you when any events occure on the system while your malware samlpe executes". It uses the API functions of the Windows Driver Kit (WDK) to call a user-defined callback function. It uses the callback functions:   * Process creation callback function called PsSetCreateProcessNotifyRoutine(...)   * Thread creation callback function called PsSetCreateThreadNotifyRoutine(...)   * Image load callback function called PsSetLoadImageNotifyRoutine(...).  And when any events occur it will display them as a debug message which can then be viewed in e.g. DebugView. It seems well documented for Windows and it is easy to find information for this, but I have a bit of a problem in finding information for Linux. I've found some general introduction to drivers and a one for hooking, but I still haven't found any that are not so general or at least are a bit more focused on malware analysis. I would be happy for tips for further readings or recommended tutorials on this topic.


How can I fill the free space with zeroes in Ubuntu 12.04 (ext4)?

I use windows server 2008r2 with role Hyper-V. The guest system is Ubuntu 12.04 LTC. It is situated on the dynamic virtual hard disk (2TB). The size of this vhd is 360 GB. But the real size is about 50 GB. I want to reduce the size of this vhd using standard Hyper-V tools. But I can not do this, because the Ubuntu file system is not NTFS. How can I reset the free space on the disk .vhd? _**The answer is:_** Use SystemRescueCD. http://serverfault.com/questions/551053/how-can-i-compact- the-vhd-file-with-ubuntu/551603?noredirect=1#comment641558_551603


Why do we need to specify partition type in fdisk and later again in mkfs?

I'm a little confused about **fdisk** and **mkfs**. So - here is typical USB flash drive partitioning and formatting:               umount /dev/sdb     fdisk fdisk /dev/sdb          Command (m for help): d     Selected partition 1          Command (m for help): n     Command action     e   extended     p   primary partition (1-4)     p     Partition number (1-4): 1     First cylinder (1-960, default 1): ↵     Using default value 1     Last cylinder or +size or +sizeM or +sizeK (1-960, default 960): ↵     Using default value 960           Command (m for help): t     Selected partition 1     Hex code (type L to list codes): 6     Changed system type of partition 1 to 6 (FAT16)          Command (m for help): a     Partition number (1-4): 1          Command (m for help): w     The partition table has been altered!          Calling ioctl() to re-read partition table.          WARNING: If you have created or modified any DOS 6.x      partitions, please see the fdisk manual page for additional     information.          mkfs -t vfat /dev/sdb1      My question is: Why do we even have to use **t** option to specify partition type while doing **fdisk** step? How does it affect everything? Does it create some mark on usb drive meaning that there only supposed to be vfat partition? Or is it safe to skip **t** step altogether? AFAIK - partitioning is only splitting disk into areas - is it not? Just trying to understand why it works the way it works:)


How to feed the results of date command into grep to filter results of another command

I need to use the result of a formatted date command (date +"%m/%d") as the grep filter to filter the results of another command that will display alerts on a system so that I only see alerts from the given day. Lets say alertcommand gives the alert readout in the console. I know I can do `alertcommand | grep 8/10` to get the logs from today, but I want to be able to feed `date +"%m/%d"`into that so that I don't have to specify the date each time I run it, but I can't figure out how to link it into one single command (preferably without having to create temp files or anything as this will be run on customer hardware). I looked at this question that was similar, but couldn't figure out how to make it work the same way.


Meaning of PF_VCPU and PF_WQ_WORKER

do you know what the constants meaning is defined in `linux/sched.h`:                 #define PF_VCPU       0x00000010  /* I'm a virtual CPU */       #define PF_WQ_WORKER  0x00000020  /* I'm a workqueue worker */      What does it mean when a process have both flags set (the ninth parameter in `/proc/[pid]/stat` is `0x30` or decimal `48`) I only found that short comments after the define's but i can not imagine any sense.


Using many monitors (4+) in linux

I want to be able to run more than 4 monitors (maybe 6) and it's extremely confusing what's compatible now with the Displayport cards coming out. Right now I have an ATI card that only has 2 HDMI outputs. The problem I've seen is that the ATI driver says it doesn't support more than 4 monitors. So it seems that their eyefinity cards would probably be more hassle than it's worth. I prefer nvidia anyway, they always seem to have really good linux drivers. But I don't see that they offer a card with more than 4 ports. Most of the higher end cards that I've seen have 2 hdmi, 1 dvi, and 1 displayport. Am I mistaken that those cards are limited to 4 monitors? And what about drivers? If I get dual nvidia cards and hook up say 2 HDMI ports + the DVI port on each card, will xorg/nvidia drivers play nice? Will I be able to set up monitors with different resolutions? (I have 2 1920x1080 and 1920x1200 screens right now)? How about x windows? Can you set up xinerama for 6 screens? Or make it able to drag x windows? **Update** : It seems that ati drivers have come a long way recently and that there is official eyefinity support for linux. I think I'm goin gto pick up an ATI 5870 and just see where I can get messing with it. **Update2** :   I ordered a 5870, I'll let you guys know how it goes. I only have a couple monitors I can play with at the moment though.


How can I set up a job to copy a directory, not overwriting existing files?

How can I create a job that copies the Directory /media/hdd/docs to the Windows share \192.168.1.3\Docs each night at 23:00, not overwriting existing files. The Windows share is shared to "Everyone" With read/Write on a Win2k12 server box


Root complete history commands

Where can I get root's history except besides `.sh_history`? I've gotten some information but only from `.sh_history` and the `history` command.


less command runs out of memory

When searching for string (no regex etc.) in large file `less filename` and `less -b 1 filename` quits or prints it cannot allocate memory. `top` shows less using roughly about 5% of memory before it dies (1 sec interval). What other tool can I use that supports large files? The file has only 100 mb of logs.               $ less -V     less 458 (GNU regular expressions)     Copyright (C) 1984-2012 Mark Nudelman      OS details:               $ ulimit -a     -t: cpu time (seconds)              unlimited     -f: file size (blocks)              unlimited     -d: data seg size (kbytes)          unlimited     -s: stack size (kbytes)             8192     -c: core file size (blocks)         0     -m: resident set size (kbytes)      unlimited     -u: processes                       15988     -n: file descriptors                1024     -l: locked-in-memory size (kbytes)  64     -v: address space (kbytes)          2048000     -x: file locks                      unlimited     -i: pending signals                 15988     -q: bytes in POSIX msg queues       819200     -e: max nice                        0     -r: max rt priority                 0     -N 15:                              unlimited     $ cat /etc/*rele*     DISTRIB_ID=Ubuntu     DISTRIB_RELEASE=13.10


Trouble getting help in vim

I have just finished the `vimtutor` and everything went fine except for the last part (Lesson 7.1: Getting Help). I type `:help` and the help manual is shown as it is supposed to. But then I try (as suggested) the commands `:help w`, `:help c_CTRL-D`, `:help insert-index` and `:help user-manual` and the following appears at the bottom left of the screen:               E434: Can't find tag pattern     Press Enter or type command to continue      I press enter and a bunch of nonsensical characters appear on the screen, but I don't get any help. Why could this be happening and how can I fix it? **Note:** I'm running Fedora 20 and have the following packages installed: `vim-common`, `vim-minimal`, `vim-enhanced`, `vim-filesystem`. * * * Okay so I tried running `vim --version` and this is what I get:               $ vim --version     VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 11 2013 12:26:40)     Included patches: 1-27     Modified by <bugzilla@redhat.com>     Compiled by <bugzilla@redhat.com>     Huge version without GUI.  Features included (+) or not (-):     +acl             +farsi           +mouse_netterm   +syntax     +arabic          +file_in_path    +mouse_sgr       +tag_binary     +autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static     -balloon_eval    +float           +mouse_urxvt     -tag_any_white     -browse          +folding         +mouse_xterm     -tcl     ++builtin_terms  -footer          +multi_byte      +terminfo     +byte_offset     +fork()          +multi_lang      +termresponse     +cindent         +gettext         -mzscheme        +textobjects     -clientserver    -hangul_input    +netbeans_intg   +title     -clipboard       +iconv           +path_extra      -toolbar     +cmdline_compl   +insert_expand   +perl            +user_commands     +cmdline_hist    +jumplist        +persistent_undo +vertsplit     +cmdline_info    +keymap          +postscript      +virtualedit     +comments        +langmap         +printer         +visual     +conceal         +libcall         +profile         +visualextra     +cryptv          +linebreak       +python/dyn      +viminfo     +cscope          +lispindent      -python3         +vreplace     +cursorbind      +listcmds        +quickfix        +wildignore     +cursorshape     +localmap        +reltime         +wildmenu     +dialog_con      -lua             +rightleft       +windows     +diff            +menu            +ruby/dyn        +writebackup     +digraphs        +mksession       +scrollbind      -X11     -dnd             +modify_fname    +signs           -xfontset     -ebcdic          +mouse           +smartindent     -xim     +emacs_tags      -mouseshape      -sniff           -xsmp     +eval            +mouse_dec       +startuptime     -xterm_clipboard     +ex_extra        +mouse_gpm       +statusline      -xterm_save     +extra_search    -mouse_jsbterm   -sun_workshop    -xpm        system vimrc file: "/etc/vimrc"          user vimrc file: "$HOME/.vimrc"      2nd user vimrc file: "~/.vim/vimrc"           user exrc file: "$HOME/.exrc"       fall-back for $VIM: "/etc"      f-b for $VIMRUNTIME: "/usr/share/vim/vim74"     Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -I/usr/local/include  -O2 -g -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1           Linking: gcc   -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags  -Wl,-z,relro  -L/usr/local/lib -Wl,--as-needed -o vim        -lm -lnsl  -lselinux  -lncurses -lacl -lattr -lgpm -ldl   -Wl,--enable-new-dtags  -fstack-protector -L/usr/local/lib  -L/usr/lib/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc             I think it's quite the same you have. Where else could the problemm be?


Insert selected filename while copying in Midnight Commander

Is it possible to paste the selected filename into the copy popup, so when I hit `F5` this filename will be in the 'to' section, so I can adjust it? For example: I want to copy `/home/piotr/testFile.log` to `/home/piotr/testFile2.log`.   I open both panels in the same directory and hit F5, but the 'to' value is: `/home/piotr` and I would like it to be `/home/piotr/testFile.log`, so I can simply adjust the name instead of typing it from the scratch.


Windows shared network printer keeps using rear tray as source

I am trying to set up network printing on my Linux Mint 15 (64 bit) system (dualboot with Windows 7). The printer is a Canon PIXMA MG5100 and is connected (via USB) to a computer running Windows XP. It was shared through the printer properties menu (Control Panel > Printers and Faxes) I was able to print to this printer from my computer in Windows 7. Using `system-config-printer`, I've found the printer (by entering the internal IP of the XP computer as the 'host' when adding using the "Find Network Printer" option). I've tried to print a blank page to test it, but the printer simply tries to take paper from the rear tray (of which there isn't any). I want it to use paper from the cassette, but the printer won't do that. I've tried setting all paper source related settings (in LibreOffice and the actual printer itself) to 'Cassette'. I've also tried re-adding the printer via the CUPS web interface (not sure if that's the right name for it) at `http://localhost:631`. I've done it using both smb and lpd in both interfaces. In the web interface, my printer isn't automatically detected, so I have to manually add it. The driver is "Canon PIXMA MG5100 - CUPS+Gutenprint v5.2.9" Since I am able to get the printer to start printing, and since I got it working perfectly in Windows, I believe this _could_ be related to Linux in some way. I just want the printer to use the cassette as the paper source. Edit: Also, on the Windows XP computer, when it tries to use rear tray paper, a message appears that tells me to load paper into the rear tray. It also mentions that when paper that is not A4 or some other standard size will be taken from the rear tray. This _shouldn't_ be anything that could affect me since I'm printing in A4. It's not mentioned clearly, but it's possible that the printer might somehow be "thinking" that I'm not printing in A4.


Use scp to transfer a file from local directory X to remote directory Y

I took a look around at other questions here and at various "scp usage" tutorials on Internet, but I can't sort out what's wrong. I'm using Linux Mint and I'm trying to figure out how **scp** works. I've a file **file.ext** (on my computer) in directory **/home/name/dir/** I connect to a remote machine using **ssh** , like:               ssh -p 2222 username@domain      it asks me the password and the shell displays:               username@domain ~ $      now, If I issue the command (before I ran ssh I was in the local directory **/home/name/dir** ):               scp -r -P 2222 file.ext username@domain       output is:               cp: cannot stat ‘file.ext’: No such file or directory      Same result if instead of file.ext I write the complete path               scp -r -P 2222 /home/name/dir/file.ext username@domain       Also, the server admin told me that I shall upload the file to my remote home directory (instead of root), like:               scp -r -P 2222 file.ext username@domain:~/      but when I do it and press "Enter" nothing happens, as If the shell was waiting for further input. Summary of my problems:   * cp: no such file or directory   * shell "stuck" on ~/ Any suggestions?


Kill backgrounded SSH when shell exits

I'm trying to spawn an SSH from my bash profile script that runs in the background for connection sharing (via its control socket). The problem I'm running into is a reliable way to ensure the SSH doesn't stay running once the TTY is closed (or more directly; once the parent bash shell has exited). I know the shell can run commands (to terminate SSH) when it exits gracefully, but I'm trying to handle all possible scenarios where the shell doesn't get a chance to shut things down. Is there a clever way I can do this? The best idea I've had is               ssh -o PermitLocalCommand=yes -o LocalCommand='cat >/dev/null; kill $PPID' $HOST &      But this won't work because I need the command to only background once it has successfully started. Alternatively, I can't use `-fN` instead of the shell's `&` because the SSH `-f` only backgrounds after the `LocalCommand` has completed. Also I'm trying to avoid running any command on the remote host. Otherwise I could probably do something like `ssh -fN $HOST 'cat >/dev/null'`


Run a command that is shadowed by an alias

Let's say i have the following alias in bash - `alias ls='ls --color=auto'` - and i want to call ordinary `ls` without options. Is the only way to do that is to unalias, do the command and then alias again? Or there is some nifty trick or workaround?


What is the most complete MS Word alternative?

I need to edit `*.doc` and `*.docx` files on Linux. What should I use?   * Emulation + MS Office   * OpenOffice   * OpenOffice variants   * Alternatives?


yum installs an old version of cmake

For some reason when I run `yum` to get cmake it will install an older version. Could it be because my repo list is not complete? I'm on CentOS 6 using a minimal desktop install from the non-net install CD. Could anyone give me a repo link or something? Same thing happens on Scientific Linux. I would take compiling it myself as a last resort because I'm trying to ma `yum install cmake` work in a bash script.


Can I `ls` all files in a directory from "1", "2",...,"9", "10", "11", ..., "20", "21", ...?

I have a directory with files named "1", "2",...,"9", "10", "11", ..., "20", "21", ... inside. Can I list them in the order of "1", "2",...,"9", "10", "11", ..., "20", "21", ...? I have tried `ls -ls`. It doesn't list the files that way, but instead "1", "10", "11", ..., "19", "2", "20", "21", .... I guess a feature like that will be helpful sometimes.


How to change which program is executed by default

Surely this is an easy question, that I just don't know how to search for, but if I have two identically named executable files, one in _/usr_ and one in _/usr/local_ (for example), how can I change which one is executed by default without specifying the path, as in _/usr/local/file_ , if `$ which` returns _/usr_? Centos6.4 btw.


Why I cannot download pdf files?

I use Debian (Linux) and since some day I cannot download any `.pdf` file. I don't know if it's because of the web browser (I'm using Epiphany and the other ones do not work). I don't know how to use the terminal properly, so any simple answer would be welcome.


The -F option for ls

For command `ls`                  -F, --classify               append indicator (one of */=>@|) to entries      Wikipedia says `*` represents executable and `/` dir. Regular files are not followed by any of the above symbols. But `*` follows text file and pdf file too. Are they executables? Do the `-F` indicators always mean same as the first field in `-rwxrwx---`? It seems like there is no difference between hardlinks and the files in either the `-F` indicators or the first field in `-rwxrwx---`. How do you distinguish them? Thanks.


Using port 587 with sendmail

I have been using sendmail to send out mails using internally available mail server. But currently port 25 is blocked for security reasons. I would like to know if there is a way to specify port number in the sendmail utility. I am trying to make use of the secure SMTP-MSA port 587 as an alternative assuming I could get that port opened up. I was not able to find anything in the man pages for sendmail. Is there any alternate utility that could do this?


how to make getopts just read the first character post `-`

I have a shell script `testShell.sh` which uses `getopts` as below:               #!/bin/bash     while getopts ":j:e:" option; do         case "$option" in             j) MYHOSTNAME=$OPTARG ;;             e) SCRIPT_PATH=$OPTARG ;;             *) ;;         esac     done          echo "j=$MYHOSTNAME"     echo "e=$SCRIPT_PATH"     shift $((OPTIND - 1))     echo "remaining=$@"      When I test run it like following:               $ testShell.sh  -jvalue1 -evalue4 -Djvalue3  -pvalue2      The output which I get is following:               j=value3     e=2     remaining=      But I would like the output as:               j=value1     e=value4     remaining=-Djvalue3 -pvalue2      **Is it possible to make sure that** `getopts` **only looks at first character post** `-` **symbol?** so that it doesn't interpret `-Djvalue3` as `-jvalue3` and `-pvalue2` as `-e2`.


Debian Wheezy problem with packages and architectures

I recently installed Debian wheezy on my desktop PC. Here is the `uname -a` command:               Linux devnet 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux      Once the installation finished, I started installing some packages (chromium and JAVA7), but I've come across a problem and I don't know how to solve it. When trying to install chromium, I get the following error:               caled@devnet:~$ sudo apt-get install chromium      Then asks for password and lists packages to be installed, everything fine. But then I get:               /bin/sh: 1: /usr/sbin/dpkg-preconfigure: not found     dpkg: error processing /var/cache/apt/archives/libc-bin_2.13-38_amd64.deb (--unpack):      package architecture (amd64) does not match system (i386)     Errors were encountered while processing:      /var/cache/apt/archives/libc-bin_2.13-38_amd64.deb     E: Sub-process /usr/bin/dpkg returned an error code (1)      Ok, from that I get that it is having a problem installing the libc-bin package for the amd64 architecture, but that is the correct architecture for my PC, uname -a says so. I've tried multiple approaches: allowing i386 packages               sudo dpkg --add-architecture i386      Also installing dependencies:               sudo apt-get -f install      I also thought that it might be a trouble with my locales, but I generated my locales as root:               locale-gen      Finally, I gave it a shot by installing just the `libc-bin` package using synaptic, but still nothing has worked. Any ideas what I could be missing? Any help will be greatly appreciated, stating to feel frustrated...


Linux iptables DNAT 53306 to 127.0.0.1 3306

mysql real port is `3306`。 I want public network using `53306` to visit mysql, and `3306` is not allowed access from public network. How to write the iptables rules `DNAT 53306 to 127.0.0.1 3306`?


Should apache still be making error_log files?

I have a VirtualHost set up like this               <VirtualHost my.ip.address.here:80>        DocumentRoot /home/todieama/public_html/dev/hop/public_html/        ServerName dev.example.com        ServerAlias dev.example.com        ErrorLog /home/todieama/public_html/dev/hop/public_html/application/logs/apache.log        ServerAdmin some@example.com        UserDir enabled todieama        <IfModule mod_suphp.c>          suPHP_UserGroup todieama todieama        </IfModule>     </VirtualHost>      When a PHP error is caught, it gets logged in the apache.log file defined above, and also in error_log in dev/hop/public_html. Should it still be logging here? I'd like to stop if it's possible.


Make RPM Satisfy Dependency Requirements of Other Installed Packages

So, I am installing a java app that I wrote which uses jnetpcap. This requires libpcap of at least v1.0.0. My CentOS 5.8 only has libpcap 0.9.4, which is required by other installed packages. I've got the RPM for libpcap 1.4.0 built but when I try to install it, I get the following:               # rpm -Uvh /root/rpmbuild/RPMS/i386/libpcap-1.4.0-1.i386.rpm     error: Failed dependencies:             libpcap.so.0.9.4 is needed by (installed) ppp-2.4.4-2.el5.i386             libpcap.so.0.9.4 is needed by (installed) isdn4k-utils-3.2-56.el5.i386             libpcap >= 14:0.8.3-6 is needed by (installed) ppp-2.4.4-2.el5.i386      and checking the dependencies of one of those:               # rpm -qR ppp-2.4.4-2.el5.i386     ...     libpcap >= 14:0.8.3-6     libpcap.so.0.9.4      Updating the OS is a non-starter, plus, it's a closed system, never net connected, so it matters little. Now, I _may_ be able to remove the packages which are stalling things, but, assuming I cannot, how can I force the install of this package, such that it will satisfy the older dependency requirements? ie: have it "provide" libpcap 0.9.4 soas to satisfy the requirements of already installed software.


Keep xscreensaver running

Every now and then, xscreensaver dies. When it does, my session unlocks and won't lock until I restart it. Is there a way to automatically detect that xscreensaver has died, restart it, and lock the session?


performance monitoring

Is there some performace monitoring tool which would run in background gathering info about all system activity? Somethimes my system (Arch linux, 32 bit) slows down terribly and the `top` utility doesn't show anything. I imagine some daemon which would gather info and log it, so when the slowdown pass away I would be able to find what was the problem.


Do I need pata_atiixp or ata_generic kernel modules on a SATA only system?

I don't have any IDE drives and my only SATA hard drive is running in AHCI mode, but my initrd image loads the pata_atiixp module. Is it safe to disable this module? And what about the ata_generic onde?


zpool import - cannot import: one or more devices is currently unavailable

I have moved a ZFS pool from one SunFire server running some pre-release of Solaris 11 to another server running latest Solaris 10 and now can't import it. It was properly `zfs export` from the old one. At the same time I migrated one another zpool (`extpool2`) and it imported just fine. Here is what I get on the new server:               root@kria ~ # zpool import       pool: extpool         id: 8401594403030600070      state: ONLINE     status: The pool is formatted using an older on-disk version.     action: The pool can be imported using its name or numeric identifier, though             some features will not be available without an explicit 'zpool upgrade'.     config:                  extpool      ONLINE               raidz1-0   ONLINE                 c2t8d0   ONLINE                 c2t10d0  ONLINE                 c2t12d0  ONLINE                 c2t14d0  ONLINE          root@kria ~ # zpool import -f extpool     cannot import 'extpool': one or more devices is currently unavailable      But they _are_ available - all 4 are online, /dev/ entries are there and they show up in `format` device list. The `extpool` zfs version is 31 (I checked that before moving it) and the host supports at least ver 32 (checked its rpool version). I also did `zdb -l` and got this failure:               root@kria ~ # zdb -l /dev/dsk/c2t8d0     ------------------------------------------     LABEL 0     ------------------------------------------     ------------------------------------------     LABEL 1     ------------------------------------------     failed to unpack label 1     ------------------------------------------     LABEL 2     ------------------------------------------     ------------------------------------------     LABEL 3 - CONFIG MATCHES LABEL 2     ------------------------------------------      Any idea what to do?


How to burn an iso while downloading it

I'm in a real hurry so I thought there is a way to do that but I don't know how. I thought about piping `wget -c cdimage.ubuntu.com/daily- live/current/utopic-desktop-amd64.iso | BurningApp` but I don't know how either. I usually use Unetbootin to "burn" it to a USB Flash Storage Device.Currently I'm running Lubuntu 14.04/10. Please note I want to burn it to a USB Flash Storage Device.


Count result in a find/exec statement

I have some Perl files which I have to modify through a simple `sed` call. Basically, I have to remove the first line of all of them. Currently, I managed to do this :               find <PATH> -type f -name "*.pl" -exec sed -i '1d' {} \;      However, I am using this line in a script and I would it to be a bit more... talkative. Thus, I decided to echo a counter (in real time), that would show how many files have been processed so far. I know the count of Perl files can be retrieved through               PERL_FILE_COUNT=$(find <PATH> -name "*.pl" | wc -l)      Currently, I have this               remove_first_line()     {         count=0         echo -ne "Removing first line of Perl files ..."         find <PATH> -type f -name "*.pl" -exec sed -i '1d' {} \; >/dev/null 2>&1              if [ $? -eq 0 ]             then echo "OK"             then echo "FAILED"         fi     }      Now, what I would like as an output, would be something like this:               "Removing first line of Perl files ... 1/209209"      And the value should be automatically updated. But I don't see how to increment the `count` variable with my find/exec statement. Basically, each time `sed` finished working a file, it should increment the `count` variable.


How to remove the (1) from filenames using the find command

I recently converted all of my FLAC files to a lower sampling rate of 44.1 kHz and bit depth of 24 bits (because iPhone/iPod don't support anything above that) using XLD on my Mac OS 10.7 (Lion). Although I told XLD to overwrote all previous files, XLD appended a `(1)` at the end of very file like from               some_song.m4a      to               some_song(1).m4a      So now I want to remove that `(1)` from all the FLAC files I converted. I know I could have probably used some program or even an AppleScript to rename the files, but I wanted to learn using the old school way of command line. I know that `find . -name *\\(1\\).m4a` will grab all the converted FLAC file. Next I know I have to do something with `-exec` and `mv` to rename all the found files. But what I can't figure out is how to keep the original filename and only remove the `(1)`. Maybe I need to do some group regex capturing to store the part of the filename that I don't want to modify? Or maybe it's not possible to do everything in one line and I should create a shell script (which I'm not that comfortable doing, but I'm willing to give it a try). Any tips or suggestions are welcomed! Thanks!


How to best encrypt and decrypt a directory via the command line or script?

I have a directory of text files under bazaar version control and keep a copy (a branch, actually) on each of my machines. I want to encrypt and unencrypt the directory via the command line. Ideally, I would also be able to have a script run at logout to check if the directory is encrypted and encrypt it if not, all without user intervention. I do not, however, want the dir to be decrypted on login. (I want the script as a guard against forgetting to encrypt manually. This is especially important for the netbook.) I'm running ubuntu 10.04.1 and two versions of crunchbang linux, one a derivative of ubuntu 9.04, the either of a late June snapshot of the Debian Squeeze repos. What is the best way to do this? (I tried to tag with `encryption` and `directories`, but lack the rep to create a tag.)


scp (v4) copy from remote to multiple local filenames

I did a bunch of googling and I think what I am trying to do is not possible with openssh/scp v4.x but wanted to ask here in case someone has a creative workaround. I want to copy multiple files from a remote host (I don't want the whole dir but I know the filenames and they are static names) to a local dir but I want each file to have a new name - I want the machine name pre-pended to the filename. Also, the reason why I am trying to do it this way is to only have 1 login (no ssh keys) for each remote host (don't want to type password for each file). here's what I have:               machine="server1.nyc.ny"     logdir="/var/log/jboss"     logs="garbage.log splunk.log jboss.log"          for BOX in ${machine[@]};do     scp $BOX:$logdir/\{"${logs[0]}","${logs[1]}","${logs[2]}"\} ./     done      this works for getting all the files with 1 login to the remote host but ultimately, I'll have multiple remote hosts so I want to pre-pend the machine name to the log file name - ie: _server1.nyc.ny-garbage.log_ the same syntax for getting the files doesn't work for destination. my ssh/scp is v4 so I can't use ControlPersist options. any creative solutions? much thanks! ps: the array of log filenames is not necessary here but I use it because some users have ssh keys so a nested loop using these arrays works great for them. I need a solution for users who don't have ssh keys and therefore minimize the amount of password typing.


Prevent a USB external hard drive from sleeping

Does anyone know if there is an elegant way to tell an external usb drive not to spin down after a period of inactivity? I've seen cron based solutions that write a file every minute, but nothing that smells of nice unixey elegance. There must be a hdparm, or scsi command that I can issue (usb drives are accessed via the sd driver in OpenBSD) to the drive to tell it to not sleep. I'm afraid that this is probably a _feature_ built into the controller in the enclosure, and as such not much can change it aside from ripping the drive out of it's enclosure and plopping it directly in the machine, but I figured I would ask, on the off chance. Ideally, I'm looking for an OpenBSD solution, but I know there are others out there w/the same problem so any solutions will be considered for the answer.


What's wrong with my AD/LDAP integration?

I upgraded a system from openSuSE 12.3 to 13.1 earlier this week. The upgrade trashed the networking and LDAP. The networking I was able to fix by deleting the bad adapter that the upgrade added, then restoring the right values to the good adapter. LDAP settings were also trashed, but putting them back has not helped. Along the way I also noticed that the winbind startup scripts got removed. I've added them back in, but still no success. Local logins work, but LDAP logins fail, and the domain user directories are showing numbers for IDs instead of user names. Permissions on those directories appear to be appropriate. Current notes:   * `winbind` fails during startup. However, when run manually it comes up fine.   * `wbinfo -t` succeeds.   * `wbinfo -a user` results in "Could not authenticate user with plaintext password"   * Attempts to login via ssh throw: > "pam_winbind(sshd:auth): request wbcLogonUser failed: WBC_ERR_AUTH_ERROR, > PAM error: PAM_SYSTEM_ERR (4), NTSTATUS: NT_STATUS_CONNECTION_DISCONNECTED, > Error message was: NT_STATUS_CONNECTION_DISCONNECTED" errors   * I also see periodic apparmor errors like this:  > "kernel: [86545.268317] type=1400 audit(1389282065.400:102): > apparmor="DENIED" operation="open" parent=2133 profile="/usr/sbin/winbindd" > name="/var/lib/samba/smb_krb5/krb5.conf.DOMAIN" pid=16744 comm="winbindd" > requested_mask="r" denied_mask="r" fsuid=0 ouid=0" I'm guessing that I'm missing some config setting somewhere, but I've wiped out and rebuilt it through yast without any success. Ideas?


Extract Values from HTML via HTML parser

I initially asked about a way to use `grep`/`awk` directly from an HTML file. I got some feedback but I see that people did not have the whole HTML and so the solutions suggested failed. Some have mentioned that HTML parsing would be a much better option. As I have no idea I kindly would like to ask the experts here how this would work and if easily possible provided some input. I work on Raspberry Pi with standard Linux/Debian Wheezy. The HTML mentioned is found here, simple HTML...but I guess it's important to see the whole file to be able to help: https://www.dropbox.com/s/9jdgzen2hwjxhjp/main.htm So what is required is to:   * Extract the two values, Pplus and Pminus (18.0000 and 0.00000) and provide them, plus providing the SUM.    * Both values come from a smart meter (energy meter) that provides the energy generated P- and energy/power taken from the network P+.   * P- in case of sun and solar plant working, so 18W is at night, 0.0000 means no generation as no sun, just to give you some background information. I tried to update and ask for support in the original thread but seems that nobody's seen it again since there hasn't been any new feedback the last few days. This is my attempt now to bring this back to the experts here.


how to ssh -Y and then su - <another user> and still forward X applications to your local machine

it is easy enough to 'fetch' (ie draw locally) a remotely running linux application: If I `ssh -Y` to the remote machine and run an application, that application will surely enough pop up in my local desktop. If , however, while I am ssh'ed in the remote machine, and I `su` to a different user though, I can not forward the X application but to my local machine. It is `wrong authentication`. I am not sure how to tackle this case. The `echo $DISPLAY` is still correct (set by the initial `ssh -Y` logon), but the session cookie is probably only set for the initial user that logged on ssh. How can I overcome this difficult and forward other X applications that are run from different users? The reason I am not ssh'ing directly is because I don't want that user to be accessible through ssh (it is the "virtualbox" user, which is obviously an easy target for bots trying to ssh to that server)...


How to install Touchégg on Fedora 20

How do I install Touchégg on Fedora 20? https://code.google.com/p/touchegg/wiki/CompileSourceCode seems to be written for Ubuntu (Debian) systems, which makes me confused; > 1 - Download and unzip the source code: No problems. Just do what it says. > 2 - Install Touchégg dependencies. In Ubuntu 11.10 Oneiric Ocelot and recent > open a terminal and type: > > `$ sudo apt-get build-dep touchegg` How do I do this in Fedora? Or, if necessary, how do I do the alternative version "`sudo apt-get install build-essential libqt4-dev utouch libgeis-dev libx11-6 libxtst-dev`" in Fedora? > 3 - Compile and install Touchégg:   >  $ qmake   >  $ make   >  $ sudo make install I didn't get this far, but can I do exactly as it says? Do `qmake`, `make` and `make install` exist in Fedora and work as in Ubuntu/Debian?


Automatized kernel upgrade

I am writing a BASH script that automatically configures, builds and installs the most recent kernel image. The generated kernel should include the grsecurity patchset. It would use the previous configuration from `/proc/config.gz`, which I created manually when compiling the first custom kernel on the machine. Is it safe to fully automatize the process? It would look like this:   1. Check the most recent kernel that `grsecurity` is available for   2. Download the `grsecurity` patchset and the matching kernel source tree   3. Patch the kernel   4. Copy the previous kernel configuration file into the kernel source directory   5. Run `make olddefconfig` to configure the kernel based on the previous configuration   6. Compile the kernel with `fakeroot make deb-pkg`   7. Install the resulting packages and change bootloader priority   8. Send me a mail indicating that a reboot is required The main question: is it likely that a kernel compiled with `olddefconfig` will contain errors that prevent the system from booting if the previous configuration is working correctly? It is very important because it is a remote server accessed via SSH and a manual rescue would take a lot of effort.


Check some property for every line of a file

I have several (427 to be precise) text files with a million lines each containing 31 numbers separated be spaces (possible double spaces). However there might be some data corruption and there may be lines containing junk. I now want to check if every line satisfies the property of containing 31 items separated by spaces (I assume that those items are numbers. A method which checks that too would be better). My current way is               while read line;     do        if [ $(echo "$line" | sed 's/ /\n/g' | grep -v "^$" | wc -l) -ne 31 ]        then           echo "$file bad";        fi     done < $file      This replaces all spaces of a line by newlines, filters empty lines, counts the number of lines and compares it to 31. This approach is slow and there's probably a much better way involving some fancy regular expression. What would be a faster way?


calling system("command") from signal handler

In a signal handler, I saw `system()` used to invoke some shell commands, like               void     sig_handler(int signum) {        system("command1");        system("command2");        system("command3");        signal(signum, SIG_DFL);     }      Is it safe to make calls in this way, in a signal handler (bound to `SIGSEGV`, `SIGABRT`, `SIGBUS` ...), and then invoke the default handler ? or does it depend on the _commands_ being invoked ?


Sharing /boot between two Ubuntu 12.04 Server installations?

This question may seem trivial at first sight, but it has certain implications and I'm wondering what is the recommended path to take here. Assume the following scenario: a server system. The default boot gets kicked off from a partition on the first hard drive which hosts the `/boot` volume and the GRUB2 code. The `/` volume is on an `md` device (RAID1, in case it matters) and GRUB2 is aware of that. Everything works fine and is nice and dandy. Now: another system is to be set up in parallel for rescue purposes, in case something happens to the `md`. The rescue shell isn't exactly too helpful, but having a full-fledged Ubuntu installation gives you a lot more power, I reckon. So the idea would be to clone the configuration - largely - which is kept under version control using `etckeeper` from the default system to the rescue system in a cron job and cherry pick some pieces such as the `sshd` host keys and `/etc/network/interfaces` to make sure the rescue system would end up booting into a remotely accessible state resembling that of the default system (possibly locked down to only allow root logins instead - but I think I know how to take care of those parts). How can these two installations share the same `/boot` volume? It makes sense to do it, because the existing one is on the first hard disk and so will the rescue system be. However, assuming updates and eventually pruning kernels from the default system, this would leave the rescue system in an unbootable state. How can I prevent this and recycle the `/boot` volume for both installations?


Is xfs_fsr safe to interrupt?

Is it safe to interrupt (`Ctrl`-`C`) a long running `xfs_fsr` job? I'm attempting to defragment a very large XFS volume.


Conky max height?

I need to set a maximum height in conky. I'm just wonder why I can set the maximum width but not the maximum height? I just trying to put a little box next to my tint2 panel but it is so hard when I can't set the height of the box.


What is the meaning of if [ -n "$(which voltdb 2> /dev/null)" ];?

I have very basic linux skills and now am trying to parse some shell scripts. I see this line in one of the scripts:               if [ -n "$(which voltdb 2> /dev/null)" ];      I know that /dev/null is the bit bucket and that which prints out the path that would have been executed had I run voltdb at the command line. Also, the whole line is obviously an if statement. But I am confused about many other things here.   1. Why is 2 being compared to /dev/null? These seem like incompatible types.    2. What does the switch -n do? I am used to using switches like rm -r filename but the -n does not seem to pair with any command   3. What do the brackets do? They seem to mean something else here than in this expression What is the meaning of this test expression []? Basically, what does this line do? There are too many unknowns in this for me -- so it's a little bit like hearing a sentence in a foreign language and missing so many words that you can't catch the basic structure.


Advantage to using Linux over Windows?

I want to get into using Linux more, all my programming and development has all been done under Windows. But I am wondering what is the core advantages to using Linux over Windows? What can I do in Linux that I can't do in Windows?


mousekeys is too slow in gnome3 fedora

Today I had to use mousekeys feature and tried it but it was very slow and unsusable, can I incerase the speed of my cursor while using mousekeys?


Command substitution: cat with executable content

I have a file called `test` and the contents are:               ubuntu@regina:~$ cat test     ** test **      catting this file via command line works fine, but if I use command substitution I get an understandable but undesirable result.               ubuntu@regina:~$ A=$(cat test)     ubuntu@regina:~$ echo $A     deployment detect.sh htpasswd.py logs test uwsgi-1.0.4 uwsgi-1.0.4.tar.gz test deployment        detect.sh htpasswd.py logs test uwsgi-1.0.4 uwsgi-1.0.4.tar.gz      Because of the asterisks that exist in the file `test` it basically executes an `echo *` and lists the directory contents along with the file contents. Is there a parameter I can pass to the command substitution syntax that will not provide this result, or is there another idiom that should be used for this?


Why does F10 in gnome-terminal open the right-click menu?

I am running Fedora 17 gnome (shell) 3 and gnome terminal 3.4.1.1. I am a user of both gnome-terminal and midnight commander. As default gnome- terminal has always used F10 (which I need while using mc), to opening the top menu. So was this time. I was able to disable that behaviour in the settings, as always. Which is new to me, is that after I disabled the setting, it started opening the "right-click menu" at the mouse cursor when I press F10. The key goes to mc too, but it is annoying to have to always close the menu. I assume it is caused by gnome terminal, as it does not happen in other apps. Is this a "feature" or bug, has anyone else encountered the same problem and how to fix it?


What is "Print to File" and can it be used from command line?

When you select "Print to File" in a Gnome print dialog (not cups-pdf): ![print-to-file](http://i.stack.imgur.com/K8PVs.png) ... what is the actual command that gets executed? (I'm interested in the postscript variant, as on the image) On the other hand - maybe there isn't a command call; maybe it is `gtk_print_operation_set_export_filename` from The new Gtk+ Printing API? In any case - is there a way for me to utilize this particular code from the command line (not `pdf2ps` and the like)? Say, by using `lpr` to "print to file" to a postscript file - as if I was using the dialog above?


using GPG key in Gajim without passphrase

I would like to use gpg key with Gajim (jabber client) without a passphrase. I have generated my gpg key without a passphrase (or with an empty passphrase, I don't know which - I just just pressed enter) I have configured gajim to use my gpg keys, but now when Gajim starts, it asks me for my passphrase, and I need just to press enter. I am wondering, is there a way to completely get rid of this passphrase dialog? Can I either generate the gpg key without a passphrase entirely, or can I tell gajim not to ask for the empty passphrase (or remember it) ?


How to commit a modified file if it wasn't locked by RCS beforehand (and I'm using Emacs VC mode)?

Sometimes, a file under the control of RCS gets modified while it is not locked (= checked out for modification by me). (In these cases, it was actually set read-only by RCS to prevent such modifications; but it might have been a configuration file under /etc/ which was modified because I was upgrading packages.) And then usually I want to nevertheless commit the new modifications, as if the last revision has been checked out before the modification. How is it best to proceed then? I usually use Emacs VC, and do `C-x v v` to check out and in. But if the file hasn't been checked out beforehand, this fails. Is there a way to proceed specifically from within Emacs? But answers with shell commands are also welcome.


JACK issues on Lubuntu, any thoughts? "Driver is not running"

I am trying to set up JACK and Wine to run FL Studio on Lubuntu. Upon running qjackctl and attempting to start JACK, I get the following error. Any thoughts? I disabled JACK D-Bus and got fewer errors.               13:34:12.958 Patchbay deactivated.     13:34:12.958 Statistics reset.     13:34:12.962 ALSA connection change.     Cannot connect to server socket err = Connection refused     Cannot connect to server request channel     jack server is not running or cannot be started     13:34:12.969 ALSA connection graph change.     13:34:14.262 JACK is starting...     13:34:14.263 /usr/bin/jackd -dalsa -dhw:I82801AAICH -r44100 -p1024 -n2     Cannot connect to server socket err = Connection refused     Cannot connect to server request channel     jack server is not running or cannot be started     13:34:14.292 JACK was started with PID=1809.     no message buffer overruns     no message buffer overruns     no message buffer overruns     jackdmp 1.9.10     Copyright 2001-2005 Paul Davis and others.     Copyright 2004-2014 Grame.     jackdmp comes with ABSOLUTELY NO WARRANTY     This is free software, and you are welcome to redistribute it     under certain conditions; see the file COPYING for details     JACK server starting in realtime mode with priority 10     self-connect-mode is "Don't restrict self connect requests"     audio_reservation_init     Acquire audio card Audio0     creating alsa driver ... hw:I82801AAICH|hw:I82801AAICH|1024|2|44100|0|0|nomon|swmeter|-|32bit     Using ALSA driver ICH running on card 0 - Intel 82801AA-ICH with STAC9700,83,84 at irq 21     configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods     ALSA: final selected sample format for capture: 16bit little-endian     ALSA: use 2 periods for capture     ALSA: final selected sample format for playback: 16bit little-endian     ALSA: use 2 periods for playback     13:34:21.390 Could not connect to JACK server as client. - Overall operation failed. - Server communication error. Please check the messages window for more info.     JackPosixProcessSync::LockedTimedWait error usec = 5000000 err = Connection timed out     Driver is not running     Cannot create new client     Cannot open qjackctl client     Unknown request 4294967295     CheckSize error size = 0 Size() = 12     CheckRead error     Gtk-Message: (for origin information, set GTK_DEBUG): failed to retrieve property `GtkRange::activate-slider' of type `gboolean' from rc file value "((GString*) 0xf52b40)" of type `GString'     Gtk-Message: (for origin information, set GTK_DEBUG): failed to retrieve property `GtkRange::activate-slider' of type `gboolean' from rc file value "((GString*) 0xf13880)" of type `GString'     13:34:35.841 JACK is stopping...     Jack main caught signal 15


Feed all traffic through OpenVPN for a specific network namespace only

I am trying to set up a VPN (using OpenVPN) such that all of the traffic, and _only_ the traffic, to/from specific processes goes through the VPN; other processes should continue to use the physical device directly. It is my understanding that the way to do this in Linux is with network namespaces. If I use OpenVPN normally (i.e. funnelling _all_ traffic from the client through the VPN), it works fine. Specifically, I start OpenVPN like this:               # openvpn --config destination.ovpn --auth-user-pass credentials.txt      (A redacted version of destination.ovpn is at the end of this question.) I'm stuck on the next step, writing scripts that restrict the tunnel device to namespaces. I have tried:   1. Putting the tunnel device directly in the namespace with              # ip netns add tns0     # ip link set dev tun0 netns tns0     # ip netns exec tns0 ( ... commands to bring up tun0 as usual ... )      These commands execute successfully, but traffic generated inside the namespace (e.g. with `ip netns exec tns0 traceroute -n 8.8.8.8`) falls into a black hole.   2. On the assumption that "you can [still] only assign virtual Ethernet (veth) interfaces to a network namespace" (which, if true, takes this year's award for most ridiculously unnecessary API restriction), creating a veth pair and a bridge, and putting one end of the veth pair in the namespace. This doesn't even get as far as dropping traffic on the floor: it won't let me put the tunnel into the bridge! [EDIT: This appears to be because only _tap_ devices can be put into bridges. Unlike the inability to put arbitrary devices into a network namespace, that actually makes sense, what with bridges being an Ethernet-layer concept; unfortunately, my VPN provider does not support OpenVPN in tap mode, so I need a workaround.]              # ip addr add dev tun0 local 0.0.0.0/0 scope link     # ip link set tun0 up     # ip link add name teo0 type veth peer name tei0     # ip link set teo0 up     # brctl addbr tbr0     # brctl addif tbr0 teo0     # brctl addif tbr0 tun0     can't add tun0 to bridge tbr0: Invalid argument      The scripts at the end of this question are for the veth approach. The scripts for the direct approach may be found in the edit history. Variables in the scripts that appear to be used without setting them first are set in the environment by the `openvpn` program -- yes, it's sloppy and uses lowercase names. Please offer specific advice on how to get this to work. I'm painfully aware that I'm programming by cargo cult here -- has _anyone_ written comprehensive documentation for this stuff? I can't find any -- so general code review of the scripts is also appreciated. In case it matters:               # uname -srvm     Linux 3.14.5-x86_64-linode42 #1 SMP Thu Jun 5 15:22:13 EDT 2014 x86_64     # openvpn --version | head -1     OpenVPN 2.3.2 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [eurephia] [MH] [IPv6] built on Mar 17 2014     # ip -V     ip utility, iproute2-ss140804     # brctl --version     bridge-utils, 1.5      The kernel was built by my virtual hosting provider (Linode) and, although compiled with `CONFIG_MODULES=y`, has no actual modules -- the only `CONFIG_*` variable set to `m` according to `/proc/config.gz` was `CONFIG_XEN_TMEM`, and I do not actually _have_ that module (the kernel is stored outside my filesystem; `/lib/modules` is empty, and `/proc/modules` indicates that it was not magically loaded somehow). Excerpts from `/proc/config.gz` provided on request, but I don't want to paste the entire thing here. ### netns-up.sh               #! /bin/sh          mask2cidr () {         local nbits dec         nbits=0         for dec in $(echo $1 | sed 's/\./ /g') ; do             case "$dec" in                 (255) nbits=$(($nbits + 8)) ;;                 (254) nbits=$(($nbits + 7)) ;;                 (252) nbits=$(($nbits + 6)) ;;                 (248) nbits=$(($nbits + 5)) ;;                 (240) nbits=$(($nbits + 4)) ;;                 (224) nbits=$(($nbits + 3)) ;;                 (192) nbits=$(($nbits + 2)) ;;                 (128) nbits=$(($nbits + 1)) ;;                 (0)   ;;                 (*) echo "Error: $dec is not a valid netmask component" >&2                     exit 1                     ;;             esac         done         echo "$nbits"     }          mask2network () {         local host mask h m result         host="$1."         mask="$2."         result=""         while [ -n "$host" ]; do             h="${host%%.*}"             m="${mask%%.*}"             host="${host#*.}"             mask="${mask#*.}"             result="$result.$(($h & $m))"         done         echo "${result#.}"     }          maybe_config_dns () {         local n option servers         n=1         servers=""         while [ $n -lt 100 ]; do            eval option="\$foreign_option_$n"            [ -n "$option" ] || break            case "$option" in                (*DNS*)                    set -- $option                    servers="$servers     nameserver $3"                    ;;                (*) ;;            esac            n=$(($n + 1))         done         if [ -n "$servers" ]; then             cat > /etc/netns/$tun_netns/resolv.conf <<EOF     # name servers for $tun_netns     $servers     EOF         fi     }          config_inside_netns () {         local ifconfig_cidr ifconfig_network              ifconfig_cidr=$(mask2cidr $ifconfig_netmask)         ifconfig_network=$(mask2network $ifconfig_local $ifconfig_netmask)              ip link set dev lo up              ip addr add dev $tun_vethI \             local $ifconfig_local/$ifconfig_cidr \             broadcast $ifconfig_broadcast \             scope link         ip route add default via $route_vpn_gateway dev $tun_vethI         ip link set dev $tun_vethI mtu $tun_mtu up     }          PATH=/sbin:/bin:/usr/sbin:/usr/bin     export PATH          set -ex          # For no good reason, we can't just put the tunnel device in the     # subsidiary namespace; we have to create a "virtual Ethernet"     # device pair, put one of its ends in the subsidiary namespace,     # and put the other end in a "bridge" with the tunnel device.          tun_tundv=$dev     tun_netns=tns${dev#tun}     tun_bridg=tbr${dev#tun}     tun_vethI=tei${dev#tun}     tun_vethO=teo${dev#tun}          case "$tun_netns" in          (tns[0-9] | tns[0-9][0-9] | tns[0-9][0-9][0-9]) ;;          (*) exit 1;;     esac          if [ $# -eq 1 ] && [ $1 = "INSIDE_NETNS" ]; then         [ $(ip netns identify $$) = $tun_netns ] || exit 1         config_inside_netns     else              trap "rm -rf /etc/netns/$tun_netns ||:               ip netns del $tun_netns      ||:               ip link del $tun_vethO       ||:               ip link set $tun_tundv down  ||:               brctl delbr $tun_bridg       ||:              " 0              mkdir /etc/netns/$tun_netns         maybe_config_dns              ip addr add dev $tun_tundv local 0.0.0.0/0 scope link         ip link set $tun_tundv mtu $tun_mtu up              ip link add name $tun_vethO type veth peer name $tun_vethI         ip link set $tun_vethO mtu $tun_mtu up              brctl addbr $tun_bridg         brctl setfd $tun_bridg 0         #brctl sethello $tun_bridg 0         brctl stp $tun_bridg off              brctl addif $tun_bridg $tun_vethO         brctl addif $tun_bridg $tun_tundv         ip link set $tun_bridg up              ip netns add $tun_netns         ip link set dev $tun_vethI netns $tun_netns         ip netns exec $tun_netns $0 INSIDE_NETNS              trap "" 0     fi      ### netns-down.sh               #! /bin/sh          PATH=/sbin:/bin:/usr/sbin:/usr/bin     export PATH          set -ex          tun_netns=tns${dev#tun}     tun_bridg=tbr${dev#tun}          case "$tun_netns" in          (tns[0-9] | tns[0-9][0-9] | tns[0-9][0-9][0-9]) ;;          (*) exit 1;;     esac          [ -d /etc/netns/$tun_netns ] || exit 1          pids=$(ip netns pids $tun_netns)     if [ -n "$pids" ]; then         kill $pids         sleep 5         pids=$(ip netns pids $tun_netns)         if [ -n "$pids" ]; then             kill -9 $pids         fi     fi          # this automatically cleans up the the routes and the veth device pair     ip netns delete "$tun_netns"     rm -rf /etc/netns/$tun_netns          # the bridge and the tunnel device must be torn down separately     ip link set $dev down     brctl delbr $tun_bridg      ### destination.ovpn               client     auth-user-pass     ping 5     dev tun     resolv-retry infinite     nobind     persist-key     persist-tun     ns-cert-type server     verb 3     route-metric 1     proto tcp     ping-exit 90     remote [REDACTED]     <ca>     [REDACTED]     </ca>     <cert>     [REDACTED]     </cert>     <key>     [REDACTED]     </key>


How do I recursively grep through compressed archives?

I'm trying to find out what modules `use Test::Version` in cpan. So I've used `minicpan` to mirror it. My problem is that I need to iterate through the archives that are downloaded, and grep the files that are in the archives. Can anyone tell me how I might do this? preferably in a way that tells me which file in the archive and what line it's on. _(note: they aren't all tarballs some are zip files)_


Boot into chroot directory leaves the root partition read-only

I am trying to make grub boot into a chroot directory /slack containing a Slackware Linux installation. This directory was created by issuing the following command:                 installpkg --root /slack a/*.t?z      where a/ directory contains the basic a/ instalation packages from slackware. I sucessfully chrooted into /slack and created the initrd image, by executing mkinitcpio command. Finally, I created the following entry in /boot/grub/menu.lst:               title  Slackware Linux     root   (hd0,2)     kernel /slack/boot/vmlinuz root=/dev/sda3 rw init=/slack/boot/chrootinit      initrd /slack/boot/initrd.gz     boot      where /slack/boot/chrootinit is a script that chroots into /slack:               exec /usr/sbin/chroot /slack /sbin/init      The system boots sucessfully but even with the "rw" option, the root partition is mounted as readonly. Several warning messages about this problem are displayed and the system finally hangs. Any solutions? (REF: http://forum.soft32.com/linux2/Booting-chrooted-directory- ftopict51395.html)