Permissions: What's the right way to give Apache more user permissions?

Context: I am making an in-browser control panel that gives me one button access to a library of scripts (.sh and .php) that I've written to process various kinds of data for a project. It's a "one stop shop" for managing data for this project. I've made good progress. I have apache, PHP and MySQL running, and I have my front end up at http://localhost. Good so far! Now the problem I'm having: I have an index.php which works fine, except the default apache user (which on my machine is called "_www") seemingly doesn't have permissions to run some of my scripts. So when I do:               <?php         echo `ls`;         echo `whoami`;         echo `/Path/To/Custom/Script.sh`;     ?>      I get the output of `ls` and `whoami`, but I get nothing back from the custom script. If I run the custom script as me (in an interactive shell), of course it works. Finally, my question: What's the _right_ way to configure this. Have the webserver run as me? Or change permissions so that _www can run my custom scripts? Thanks in advance for any help. I'm not an advanced Unix user, so sorry if this is a dumb question!


Why do I have GRUB and GRUB2 in my boot directory?

I'm running F17 and my boot directory has grub and grub2. Why do I need both of these? I thought only one grub was required to boot. Does each one have specific properties?


Grub error 15 (file not found)

I'm trying to fix a problem with a new installation. I'm running this existing distro (Ubuntu) from `/dev/sdb` with a new OS, Gentoo, installed on `/dev/sda`. I'm glad I took the trouble of setting these up on different disks because I can't boot into the new OS. All I get is grub error 15 "File not found". It also gives the UUID which I have verified is correct:               sudo blkid     /dev/sda1: LABEL="boot" UUID="b891774a-0b2d-4ab4-bcfa-23a11a97cae5" TYPE="ext2"      /dev/sda2: UUID="fc34999a-e85d-4c7b-8775-30510eb4c396" TYPE="swap"      /dev/sda3: LABEL="main" UUID="65a90a0d-a651-4215-8552-0c1859ab61dd" TYPE="ext4"      The menu.lst (on `/dev/sdb`) for the new OS is               title Gentoo Linux 3.10.7-r1     uuid b891774a-0b2d-4ab4-bcfa-23a11a97cae5     #root (hd0,0)     kernel /kernel-3.10.7-gentoo root=UUID=65a90a0d-a651-4215-8552-0c1859ab61dd      I also tried               kernel /boot/kernel-3.10.7-gentoo root=UUID=65a90a0d-a651-4215-8552-0c1859ab61dd      but since the UUID goes directly to the boot partition I think this is wrong. The kernel should be correct; if I mount `dev/sda1` and `ls` I see               grub  kernel-3.10.7-gentoo      Any ideas what I'm doing wrong? It might be very basic; I've only been using Linux for a few years and never Gentoo except for a few days in a `chroot`. * * * I should mention I also have grub2 installed on `dev/sda1` though I don't get as far there: it just shows the grub 'command line'.


Why can't I navigate into my Documents directory?

I'm in bash and running F17 as su. My `pwd` is               /home/user      and when I `ls` I see               Desktop Documents Downloads Music Pictures Public Templates Videos      However, I'm unable to `cd` into any of these. My error is               bash: cd: Desktop: No such file or directory      How come?


mailx and HP-UX to RedHat migration

We are migrating some servers from HP-UX to Linux RedHat, and we have to migrate about 100 shell scripts that are referencing /usr/bin/mailx (instead of /bin/mailx on Linux). We'd like to change all the 100 scripts (from /usr/bin/mailx to /bin/mailx) only if this is the last option. Are there better ways of doing this? P.S.: our system administrators don't want to create a symbolic lynk "/usr/bin/mailx" pointing to /bin/mailx (I didn't understand why, actually). Thanks in advance.


Transparent encryption of bash history?

I'm not sure if anyone has done such things before. I want bash history to be fully encrypted, prompt for password when in interactive session. Is that possible?


Changed background on Kali Linux and now desktop is buggy

I have been running the latest version of Kali Linux for about a month now. I got tired of seeing the default Kali Linux login screen, so I looked up how to change it. The answer I found said: > Go to `/roor/usr/share/images` and then delete the image file labeled > `login-desktop.png` and replace it with a png image of your choice. > > After which change the replacement image name to `login-desktop.png` and > reboot. I did exactly as recommended, but when I rebooted the desktop environment was odd. There was no toolbar on the top or bottom, and windows were missing the default bar on them with Minimize, Maximize, and Close buttons. What happened?


Archbang look on Archlinux

I installed archlinux but I want to get the look and feel of Archbang. Is there a way to find the config files or scripts for Archbang? http://bbs.archbang.org/viewtopic.php?id=2501 gives a list of packages but I also want the resources and quick ref of key bindings in the background, menus, default application and other things I don't know about. The reason I don't want to install Archbang is because I want to follow the Arch Way. the reason I want Archbang config files is because people already thought about usability and solved that problem for me. I like their solution.


Why a sleep 300 (5 minutes) can last several hours some time?

I have a MiniMac with the OSX system. My script is:               while true       do echo "Sleep 300 seconds = 5 minutes"       date       sleep 300       echo "end of sleep"       date     done      I want it to repeat every 5 minutes; but some time it is suspending for several hours when it does this "sleep 300", here is the result:               Sleep 300 seconds = 5 minutes     Fri Nov  8 15:52:49 CET 2013     end of sleep     Fri Nov  8 15:57:49 CET 2013     Sleep 300 seconds = 5 minutes     Fri Nov  8 15:57:49 CET 2013     end of sleep     Fri Nov  8 16:02:49 CET 2013     Sleep 300 seconds = 5 minutes     Fri Nov  8 16:02:49 CET 2013     end of sleep     Fri Nov  8 16:20:59 CET 2013     Sleep 300 seconds = 5 minutes     Fri Nov  8 16:20:59 CET 2013     Sleep 300 seconds = 5 minutes     Fri Nov  8 15:52:49 CET 2013     end of sleep


Can the kernel be moved to a different mtd while the system is running?

I am attempting to do a full update on a mobile `Linux Arm` device. I have successfully pivoted my file system root and have been able to flash a new file system to that mtd. What I would like to accomplish now is something similar for the kernel. I am wondering if it is possible to perhaps pivot the kernel to another mtd or even perhaps the RAM. Or maybe there is some other method I am overlooking? Any insight to avenues I could use would be greatly appreciated!


virtual box debian guest with nat & host-only adapters: 'No route to host' when trying to access host from guest

I have just set up a Debian guest inside VirtualBox, on a Fedora host. I use two adapters: NAT (internet for the guest, which works fine) and host-only (`ssh` from host to guest, `nfs`, etc.). I am able to `ssh` from host to guest, but not the other way around. Actually, except `ping` and `traceroute`, which both give results, all other network related tools give the error: 'No route to host'. Some information: The host IP is 192.168.29.1.               axirma@dev:~$ ip addr            1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN       link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00       inet 127.0.0.1/8 scope host lo       inet6 ::1/128 scope host       valid_lft forever preferred_lft forever       2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000       link/ether 08:00:27:25:1f:71 brd ff:ff:ff:ff:ff:ff       inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0       inet6 fe80::a00:27ff:fe25:1f71/64 scope link       valid_lft forever preferred_lft forever       3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000       link/ether 08:00:27:6d:16:e6 brd ff:ff:ff:ff:ff:ff       inet 192.168.29.2/24 brd 192.168.29.255 scope global eth1       inet6 fe80::a00:27ff:fe6d:16e6/64 scope link       valid_lft forever preferred_lft forever       axirma@dev:~$ ip route       default via 10.0.2.2 dev eth0       10.0.2.0/24 dev eth0  proto kernel  scope link  src 10.0.2.15       192.168.29.0/24 dev eth1  proto kernel  scope link  src 192.168.29.2            axirma@dev:~$ ip route get 192.168.29.1       192.168.29.1 dev eth1  src 192.168.29.2           cache  ipid 0x1910 rtt 7ms rttvar 7ms cwnd 10            axirma@dev:~$ arp       Address                  HWtype  HWaddress           Flags Mask            Iface       10.0.2.2                 ether   52:54:00:12:35:02   C                     eth0       host                     ether   0a:00:27:00:00:00   C                     eth1            axirma@dev:~$ ping -c 4 192.168.29.1       PING 192.168.29.1 (192.168.29.1) 56(84) bytes of data.       64 bytes from 192.168.29.1: icmp_req=1 ttl=64 time=0.247 ms       64 bytes from 192.168.29.1: icmp_req=2 ttl=64 time=0.403 ms       64 bytes from 192.168.29.1: icmp_req=3 ttl=64 time=0.446 ms       64 bytes from 192.168.29.1: icmp_req=4 ttl=64 time=0.636 ms            --- 192.168.29.1 ping statistics ---       4 packets transmitted, 4 received, 0% packet loss, time 3003ms       rtt min/avg/max/mdev = 0.247/0.433/0.636/0.138 ms            axirma@dev:~$ traceroute 192.169.29.1       traceroute to 192.168.29.1 (192.168.29.1), 30 hops max, 60 byte packets        1  host (192.168.29.1)  0.152 ms !X  0.141 ms !X  0.143 ms !X            axirma@dev:~$ nc -vz 192.168.29.1 22       host [192.168.29.1] 22 (ssh) : No route to host            axirma@dev:~$ ssh alexandru@192.168.29.1       ssh: connect to host 192.168.29.1 port 22: No route to host        Please let me know if I can provide additional information.


Hang during 'touch' operation on NFS mount

I have two NFS clients mounted to an openfiler 2.99 NFS share at 192.0.2.3:   * 192.0.2.1 mounts `192.0.2.3:/mnt/nfs01/volnfs01/share01` with `rw,noatime,nodiratime,hard,rsize=32768,wsize=32768,noacl,nocto,tcp,nfsvers=3`   * 192.0.2.1 mounts `192.0.2.3:/mnt/nfs01/volnfs01/share02` with `rw,noatime,nodiratime,hard,rsize=32768,wsize=32768,nfsvers=3,tcp,noacl,nocto`   * 192.0.2.2 mounts `192.0.2.3:/mnt/nfs01/volnfs01/share02` with `rw,noatime,nodiratime,hard,rsize=32768,wsize=32768,nfsvers=3,tcp,noacl,nocto` ### `touch` broken My problem is with 192.0.2.2's NFS mount. When I touch a file in on that mount, the process hangs indefinitely... I used `strace touch /mnt/share02/this` and got this far...               rt_sigaction(SIGRTMIN, {0x3b71c05ae0, [], SA_RESTORER|SA_SIGINFO, 0x3b71c0f500}, NULL, 8) = 0     rt_sigaction(SIGRT_1, {0x3b71c05b70, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x3b71c0f500}, NULL, 8) = 0     rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0     getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0     brk(0)                                  = 0xafb000     brk(0xb1c000)                           = 0xb1c000     open("/usr/lib/locale/locale-archive", O_RDONLY) = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=99158576, ...}) = 0     mmap(NULL, 99158576, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fce244c0000     close(3)                                = 0     open("/mnt/share02/this", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666                                                                         ^^^ stops touching                                                                          |                                                                          |      When I check `ps -elf` from another terminal, I see the process in "D" state...               [mpenning@host192_0_2_2 ~]$ ps -elf | awk '$2=="D"'     0 D mpenning  8157  8032  0  80   0 - 26293 rpc_wa 09:59 pts/2    00:00:00 touch /mnt/share02/this     [mpenning@host192_0_2_2 ~]$      `showmount` isn't finding a problem though....               [mpenning@host192_0_2_2 ~]$ showmount -e 192.0.2.3     Export list for 192.0.2.3:     /mnt/nfs01/volnfs01/share01 192.0.2.2/255.255.255.255,192.0.2.1/255.255.255.255     /mnt/nfs01/volnfs01/share02 192.0.2.2/255.255.255.255,192.0.2.1/255.255.255.255     [mpenning@host192_0_2_2 ~]$      Various status of NFS services...               [mpenning@host192_0_2_2 ~]$ service nfs status     rpc.svcgssd is stopped     rpc.mountd (pid 9168) is running...     nfsd (pid 9232 9231 9230 9229 9228 9227 9226 9225) is running...     rpc.rquotad (pid 9164) is running...     [mpenning@host192_0_2_2 ~]$ service rpcbind status     rpcbind (pid  9088) is running...     [mpenning@host192_0_2_2 ~]$ service nfslock status     rpc.statd (pid  9256) is running...     [mpenning@host192_0_2_2 ~]$      Network configuration (default gw isn't required since this is a dedicated layer2 NFS vlan):               [mpenning@host192_0_2_2 ~]$ sudo cat /etc/sysconfig/network-scripts/ifcfg-eth1     DEVICE=eth1     NM_CONTROLLED=no     ONBOOT=yes     BOOTPROTO=none     IPADDR=192.0.2.2     NETMASK=255.255.255.0     DNS2=none     TYPE=Ethernet     GATEWAY=     DNS1=none     IPV6INIT=no     USERCTL=no     MTU=9000     [mpenning@host192_0_2_2 ~]$      This looks pretty nasty. I have done the following on 192.0.2.2:   * Restarted all NFS   * `init 6` the machine   * `ping 192.0.2.3` to make sure it still has connectivity to the server   * Checked dmesg   * Checked `showmount -e 192.0.2.3` This feels like a permissions problem, but I don't know where to go from here... How can I fix this problem so I can read / write to any file on 192.0.2.2's mount of `192.0.2.3:/mnt/nfs01/volnfs01/share02`? * * * ### `touch` works If I execute the same `touch` command from 192.0.2.1, everything is fine...               rt_sigaction(SIGRTMIN, {0xb096e0, [], SA_SIGINFO}, NULL, 8) = 0     rt_sigaction(SIGRT_1, {0xb09b80, [], SA_RESTART|SA_SIGINFO}, NULL, 8) = 0     rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0     getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0     uname({sys="Linux", node="host192_0_2_1.localdomain.local", ...}) = 0     brk(0)                                  = 0x8d4d000     brk(0x8d6e000)                          = 0x8d6e000     open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3     fstat64(3, {st_mode=S_IFREG|0644, st_size=99158544, ...}) = 0     mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7574000     close(3)                                = 0     open("/mnt/share02/this", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_LARGEFILE, 0666) = 3     dup2(3, 0)                              = 0     close(3)                                = 0     utimensat(0, NULL, NULL, 0)             = 0     close(0)                                = 0     close(1)                                = 0     close(2)                                = 0     exit_group(0)                           = ?      ### `/etc/exports` from 192.0.2.3               [root@T1-Netfile01 backups]# head /etc/exports          # PLEASE DO NOT MODIFY THIS CONFIGURATION FILE!     #       This configuration file was autogenerated     #       by Openfiler. Any manual changes will be overwritten     #       Generated at: Fri Nov 8 9:35:39 CST 2013          /mnt/nfs01/volnfs01/share02 192.0.2.1/255.255.255.255(rw,anonuid=96,anongid=96,secure,root_squash,wdelay,sync)  192.0.2.2/255.255.255.255(rw,anonuid=96,anongid=96,secure,root_squash,wdelay,sync)          /mnt/nfs01/volnfs01/share01 192.0.2.1/255.255.255.255(rw,anonuid=96,anongid=96,secure,root_squash,wdelay,sync)  192.0.2.2/255.255.255.255(rw,anonuid=96,anongid=96,secure,root_squash,wdelay,sync)          [root@T1-Netfile01 backups]#


bind backslash to a non-standard keyboard key

I am using a swiss apple keyboard at the moment. This keyboard requires some unreasonable finger acrobatics to type a backslash (shift+right alt+7). I'd like to bind the backslash to another key combination, specifically shift+4, which right now produces a "ç" which I never need. Has anybody done something like that? I don't have any idea how to do that and I have not found any help yet. I use Linux mint xcfe. Thanks in advance for your help.


Automounting in KDE-3.5.10 without HAL

community! I have Gentoo(amd64) installed with KDE-3.5.10 desktop from kde- sunset overlay. Recently I have upgraded xorg-server from 1.7 to 1.9 and now want to extinguish hal completly. The only reason that stops me is the device detection. I don't know how to get automounting working in KDE-3.5.10 without HAL. Oh, and K3B too. Installed version is 1.0.5. The only packages which uses "hal" USE flag are:               # equery h hal     [ Searching for USE flag hal in all categories among: ]      * installed packages     [I--] [  ] kde-base/kdebase-kioslaves-3.5.10-r1 (3.5)     [I--] [  ] app-cdr/k3b-1.0.5-r6 (3.5)      and they certainly can be compiled without "hal" flag. But then automounting stops working and when I insert USB flash drive there is no pop-up window. Of course I can still mount it manually, but it feels uncomfortable. Didn't check if K3B can find recording device when compiled without "hal" USE flag, though. But suspect there could be difficulties too.


Failed to start slapd in CentOS

I was trying to setup an LDAP server for my development. For this purpose, I have chose CentOS 6.3 install it in VirtualBox host in Fedora 17. I'm following this tutorial to guide me on this setup, anyhow when I start the service using this command `service slapd start`, I got this error:               Checking configuration files for slapd:   [FAILED]     /etc/openldap/slapd.conf: line 9: bad config line.     slaptest: bad configuration file!      I'm sure I have this file `/etc/openldap/slapd.conf` to the owner of ldap. May I know any idea to rectified this problem? **UPDATE** I have extract the first few lines of text from `slapd.conf`, looking at `line 9`, that is an empty line.               #     # See slapd.conf(5) for details on configuration options.     # This file should NOT be world readable.     #     include     /etc/openldap/schema/core.schema     include     /etc/openldap/schema/cosine.schema     include     /etc/openldap/schema/inetorgperson.schema     include     /etc/openldap/schema/nis.schema          # Added for policy     include /etc/openldap/schema/ppolicy.schema          # Allow LDAPv2 client connections.  This is NOT the default.     allow bind_v2          # Do not enable referrals until AFTER you have a working directory     # service AND an understanding of referrals.     #referral   ldap://root.openldap.org          pidfile     /var/run/openldap/slapd.pid     argsfile    /var/run/openldap/slapd.args


stty: : Invalid argument

I am telnet-ing into a Solaris machine and I'm getting the above error with my scripts. I realize this is a common problem, and the solution is to check for the line 'stty erase ^H' within my profile, but I can't find it. .profile doesn't have any references to stty, and I don't have a .cshrc anywhere. I performed a grep in my home directory, but I came up with nothing. Is there another source of this problem? All the solutions online refer to either .profile or .cshrc. Thanks.


How to take incremental backup in tape drive

I am having 1 tape drive and I want to take incremental backup of 5 folder to the tape drive on every Friday. But the location of the five folders are on one server and the LTO mounted on a different machine. How can I make the backups.


Are certain parts of startup scripts necessary or just good practice?

I'm currently exploring creating a startup script in the form of a system process located in the /etc/init.d/ on my Fedora 14 Linux installation. It sounds like the following two lines are bare minimum requirements?               #!/bin/bash     # chkconfig: 345 85 15 (however on this one I've seen different combos)      What's the purpose of these lines? Is there a good resource that would help me understand how to better create these and other header lines for such a file?


mkdir -p for files

`mkdir -p` will create a directory; it will also make parent directories as needed. Does a similar command exist for files, that will create a file and parent directories as needed?


Need to get the latest file with date timestamp for each month

I am just starting with Unix programming and I have a requirement. I have four files which are placed in my landing zone and I need the scheduler to pick up the latest file of that month and year. For example:               FILE_NR_WEEKLY_01_20130528_CHARGE          FILE_NR_WEEKLY_01_20130530_CHARGE--> This needs to be picked 1st for may month          FILE_NR_WEEKLY_01_20130601_CHARGE          FILE_NR_WEEKLY_01_20130604_CHARGE -->This needs to be picked up for June month In the above case for that year, month and date combination, I need to get the latest file.


Can swap be encrypted per user?

The problem arises for a multiuser computer with encrypted swap, as to how to allow each user to hibernate and resume from hibernation without compromising the security of the other users. I'm looking for a way in which each user's swap usage is encrypted specifically for them, such that when they want to resume from hibernation they can do so by entering only _their_ password/passphrase. They should not be able to decrypt other users' swap; all users' processes must be stopped until the respective user can provide their passphrase to decrypt their swap and continue their processes. Users may wish for some or all of their processes to be unencrypted so that they can continue regardless of who resumes the computer. As long as no personal data is stored in system processes and the system doesn't let users' keys hit swap, then the system's swap doesn't need to be encrypted, and that means that any user can resume the system without compromising other users. Note that this could be complemented by encrypting the system with a key stored in BIOS firmware such as Coreboot or LibreBoot to make tampering very difficult, but this is a fundamentally different approach based on the apparent difficulty of tampering with the hardware involved rather than a complete cryptographic approach to preventing people from reading personal data of others assuming tampering is not an issue. For optimal security, these two mechanisms could be used together, but in this question, I'm asking for the fully cryptographic approach. In theory it makes sense, but in practice it may not be implemented. I hope that this is possible in Linux.


Can I install a distro to one partition while using a distro installed on another?

I currently have two partitions with Linux distros installed on them. I am currently using one with Mint 14, and you could call the other deprecated. I just found out about the release of Mint 15, and I want to install it over the deprecated distro so I can try it out. Since I don't want to go through the trouble of writing it to a disk and installing it normally, I was wondering if there was a way I could install it by using tools in my running distro while I do something else. EDIT: the reason I don't want to try it live is because that won't give me a good impression of what it will be like to use it on a regular basis. Running it from a CD is orders of magnitude slower, doesn't allow full configuration, and gets wiped when you're done. I would rather avoid installing normally because it's tedious and it locks up my entire computer while it's happening. I realize that I might have to, but that's why I'm asking this: to find out. As for clarifying my question, I don't know how much more explicit I can get without actually knowing the answer. I want to download the disc image, then start a process in my current system that will transfer the files to a different partition so that the result is similar to running the installer. Like (taking this from Wikipedia) Wubi + LVPM, but with Mint.


/proc/pid/maps addresses (and converting them)

When looking at the memory maps in /proc/pid/maps, we can see different length addresses               00400000-0042e000 r-xp 00000000 fb:01 268953                             /bin/nano     0062e000-0062f000 r--p 0002e000 fb:01 268953                             /bin/nano     0062f000-00630000 rw-p 0002f000 fb:01 268953                             /bin/nano     0081e000-00906000 rw-p 00000000 00:00 0                                  [heap]     7f8313e5c000-7f8314109000 rw-p 00000000 fb:01 2399989                    /usr/share/misc/magic.mgc     7f8314109000-7f83142ce000 r--p 00000000 fb:01 2759354                    /usr/lib64/locale/locale-archive     7f83142ce000-7f83142d1000 r-xp 00000000 fb:01 1457046                    /lib64/libdl-2.17.so     7f83142d1000-7f83144d0000 ---p 00003000 fb:01 1457046                    /lib64/libdl-2.17.so      We have addresses with 8 digits length like:   * 00400000-0042e000 And ones with 12 digits length (last 3 digits are always 0):   * 7f8313e5c000-7f8314109000 My question is, why are those addresses formated this way, and can i convert them to 8 digits length?


How to search XTerm console history?

Is there some way to search XTerm's console history interactively, like `Ctrl`+`Shift`+`f` in GNOME Terminal and Terminator? I could run `script` in my `.bashrc` or possibly even patch XTerm, but it would be nice to know if there is already some shortcut or configuration setting to do this _without_ heavily modifying my runtime environment. A way to save the entire scrollback buffer in a single operation (that is, without copying every page of it with a mouse) would be an OK fallback.


Apache, svn at the root of domain with one exception

I want to setup SVN in such a way that svn.domain.com/ directly lists SVN repositories. To be able to make the web view nicer I am using an SVNIndexXSLT. But I have to serve this file somehow to the end-user. So I want to setup a location (`/repos-web` for example) that will serve files, instead of svn. I currently have the following configuration:               <VirtualHost *:80>             ServerName svn.domain.com             DocumentRoot /home/user/svn/svnweb             ErrorLog ${APACHE_LOG_DIR}/error.log             <Location />                     AuthType Basic                     AuthName "Authentication required"                     AuthUserFile "myauthfile"                     Require valid-user                     order allow,deny                     allow from all                          DAV svn                     SVNParentPath /home/user/svn/repositories                     SVNListParentPath on                     SVNIndexXSLT "/repos-web/view/repos.xsl"             </Location>             <Location /repos-web>                     DAV off             </Location>     </VirtualHost>      But http://svn.domain.com/repos-web simply returns: > Could not open the requested SVN filesystem I tried changing the `<Location />` in `<LocationMatch "^/(?!repos-web)">` but this did not help at all. Of course one solution would be to serve the xslt file over another domain/subdomain, but this is more a workaround than solution.


LUKS - changing passphrase with /dev/mapper/fedora-root

I would like to change my passphrase in LUKS, so I started with typing `mount | grep 'on / '`. The result was `/dev/mapper/fedora-root on / type ext4 (rw,relatime,seclabel,data=ordered)`. So next as usual I typed `sudo cryptsetup status fedora-root` to get info about partition. But unfortunately I got no result and operation returned 1. `sudo cryptsetup --verbose status fedora-root` says `Command failed with code 22: Invalid argument`. Why the behaviour is so strange? What is the way to change LUKS password in that case?


Virtualbox user home directory

I have a tiny problem. I want to avoid VirtualBox from creating `/home/$USER/.VirtualBox` directory and create another directory like `/home/$USER/DIR` instead to put the log files etc there. I tried to export `$VBOX_USER_HOME` variable in my `.bashrc` so it is set in my shell and also used the `vboxmanage setproperty machinefolder /home/amin/DIR` command but VirtualBox still creates `.VirtualBox` directory under `/home/$USER`. Is there any other way to achive this or am I doing something wrong here?


Sniffing packets through router

I would like to create a system like this. ![enter image description here](http://gyazo.com/45210b1932d7140cdc160b3a672173c6.png) The user would connect through a wifi network which would reroute all http requests and responses through the network card on a computer thus allowing that computer to sniff the packets. I have debian running on the computer. How would i go about doing this?


Why are 64-bit distros often called 'amd64'?

I am downloading an ISO image of Lubuntu; they have two versions: 32 and 64. But why do they call the 64 version **amd64** since they say that it works for Intel also?


changing the partition of a linux

I have a ubuntu system as a virtual system on Virtual Box. It uses VHD as its hard disk. I manged to change the size of VHD using VHD resizer, now I want to expand the partition on vhd so it uses the expanded size. How can I do this?


Manipulating a file with sed

I have a file called `students.txt` and it contains the following data in the format `Surname, Forename: day.month.year: Degree`:               Smith, John: 15.01.1986: MSc IT      Taylor, Susan: 04.05.1987: MSc IT      Thomas, Steve: 19.04.1986: MSc MIT      Sennick, Joseph: 01.12.1987: MSc IT       I'm trying to return all lines in the format `Forename,Surname: day.month.year`, but without the `MSc` degree being studied. So far I have:               sed -e 's/\(.*\),(.*\)/\2/\1/' students.txt      What's wrong with that?


How to upgrade Fedora Core 3?

I want to upgrade from fedora core 3 to latest release without using a cd. I have internet connection. Is it possible to use `yum` to upgrade the OS entirely to the latest version? At present there are no `.repo` files in my `/etc/yum.repos.d/` directory. So I could not use the `yum` command. How to get the necessary repository and to upgrade the OS?


How do I know if my SSD is SLC or MLC?

I have 3 SSDs on my server. How can I tell if they are SLC or MLC?


Bandwidth, CPU & Memory stats returned in single line from terminal

I'm trying to create a simple monitoring system that will show a graph of sales that is linked entirely to data of bandwidth, CPU and Memory stats as they relate to sales. So if I sale 1 widget per 5 seconds, that will be contingent upon my bandwidth etc being above a certain threshold. So I've formulated a way to do the graph but I'm just having a time getting the stats. I can use any of a number of monitoring systems but I just need 1 line for bandwidth, CPU Usage, and Memory Usage once per second. I made a python script that gets all the IP information from all interfaces. But for if I had a script I could run from terminal that simply output a single line I could just pipe that to a file and then access the file to run my real time graph. So for network I can use:               $ ifconfig      I pipe it into a json file for easy reference. I can use:               $ free -m      for memory which I suppose I can pipe into a file as well Then I could use:               $ cat /proc/loadavg      for CPU and again pipe that. Is there an easier way to do this? So that I receive a single line for each command and can easily (more importantly quickly) send that information via Javascript or HTML5 FileReader to the graphing solution?


How should I partition my hard drive?

* Xubuntu 12.10   * XFCE with Greybird theme Hello, this is my GParted screenshot: ![enter image description here](http://i.stack.imgur.com/6RquT.png) Could anyone please give my any advice on how to make changes to have more space available for use in Linux? Let's say I manage to take 10 GB out of the `/dev/sda3` partition which is currently formatted in ntfs, how would I proceed then?


Cannot load font true and no console access in Fedora

When I boot Fedora 17 this error appears:               Cannot open font file True      I found this question Cannot open font file True, but the person who faced the problem in that question can access the console. In my case I can't access anything! Can I use external live system like live Ubuntu to fix this problem? If "yes" what should I do exactly?


set VM IP address to be the same every time from DHCP on CentOS 5.6

I have an issue where, each time I start my CentOS 5.6 VM, DHCP (I believe) is allocating my VM a different IP. I have the VM mapped as a Samba share in Windows 7 and this changes between 192.168.0.8, 192.168.0.9 and 192.168.0.10 each time meaning I have to mount a new drive in Windows each time. This is also frustrating as I have to update my hosts file to point to a different IP each time and any projects I have pointing to the Samba share in my IDE are also gone. Is there a way that I can set the IP to be the same each time in the Devernet Configuration under the `setup` tool in CentOS?               [root@dev ~]# ip a     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue         link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo     2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000         link/ether 08:00:27:f2:9f:d6 brd ff:ff:ff:ff:ff:ff         inet 192.168.0.8/24 brd 192.168.0.255 scope global eth0      Here is a screenshot of the Devernet Configuration under the `setup` utility in CentOS. I had Use DHCP _on_ , but I have turned it off in this screenshot. ![enter image description here](http://i.stack.imgur.com/TeOQ0.gif)


Is it possible to store ssh connection in bash script instead of $(ssh user@ip command) every time?

I think that the code that I already have is not very efficient as it has to connect each time to the same machine and execute a command. Code:               tmp=$(ssh -nq $USER@$IP "$COMMAND" 2>> $LOG)     tmp1=$(ssh -nq $USER@$IP "$COMMAND1" 2>> $LOG)     tmp2=$(ssh -nq $USER@$IP "$COMMAND2" 2>> $LOG)     tmp3=$(ssh -nq $USER@$IP "$COMMAND3" 2>> $LOG)      Where `$COMMAND` in most of the cases is some kind of `grep`. Can I somehow store the ssh connection or refactor the code so it won't connect each time to the machine ?


Route VPN gateway traffic via tun0 instead of normal gateway

On my Linux box, I have a tun0 interface by IPIP tunnel like:               tun0      Link encap:IPIP Tunnel  HWaddr                  inet addr:10.10.10.2  P-t-P:10.10.10.1  Mask:255.255.255.255      and I running an IPsec VPN server (ipsec-tools) on this box. How can I route all VPN traffic through the tun0 interface on the server (like Openswan's leftnexthop )?


How to properly start and stop shell script in linux, busybox?

I am trying to write a small shell script that would send some commands to my tv set from my set top box that has busybox on it. The problem is that it generates huge amount of zombie processes, and when I try to killall, I kill also some audio processes, that should not be killed... Here are my scripts: tvstart.sh                #!/bin/sh      echo "ka 1 01" > /dev/ttyUSB0      read -t 5 response < /dev/ttyUSB0      echo "xb 1 70" > /dev/ttyUSB0      read -t 2 response < /dev/ttyUSB0      echo "kf 1 32" > /dev/ttyUSB0      read -t 2 response < /dev/ttyUSB0      echo "km 1 01" > /dev/ttyUSB0      #killall sh      tvstop.sh                #!/bin/sh      echo "ka 1 00" > /dev/ttyUSB0      #killall sh      And I call them like this(part of the script):               case "$1" in       led-on)         echo 3 > /sys/class/leds/mag-front-led/mode         nohup sh /home/default/tvstop.sh &       ;;       led-off)         echo 2 > /sys/class/leds/mag-front-led/mode         nohup sh /home/default/tvstart.sh &       ;;      So, how do I terminate them properly? this is how zombies looks like:                3637 root            Z   [sh]      3660 root            Z   [sh]      3696 root            Z   [sh]      3719 root            Z   [sh]      3751 root            Z   [sh]      3766 root            Z   [sh]      3798 root            Z   [sh]      3829 root            Z   [sh]      3913 root            Z   [sh]      3984 root            Z   [sh]      4489 root       6960 S   sshd: root@pts/0      4533 root       2704 S   -sh     10478 root            Z   [sh]     10516 root            Z   [sh]     10574 root            Z   [sh]     10597 root            Z   [sh]     10630 root            Z   [sh]     10737 root            Z   [sh]     11072 root            Z   [sh]     11103 root            Z   [sh]     11413 root            Z   [sh]     11436 root            Z   [sh]     11457 root            DW  [STVID.InjecterT]     11458 root            SW  [STVID[0].MPEG2P]     11459 root            DW  [tfm_89287480]     11460 root            SW  [STVID[0].Produc]     11461 root            SW  [STVID[0].Displa]     11462 root            SW  [STVID[0].ErrorR]     11477 root            Z   [sh]     11500 root            Z   [sh]     11525 root            Z   [sh]     11548 root            Z   [sh]     11581 root            Z   [sh]     11605 root            Z   [sh]     11638 root            Z   [sh]     11661 root            Z   [sh]     11688 root            Z   [sh]     19185 root       2704 R   ps


"Couldn't resolve host" when downloading Fedora 16 packages

I'm using `yum` to install `make`, I am getting the following error. I tried all solutions from similar questions but the issue remains.               http://download.fedoraproject.org/pub/fedora/linux/releases/16/Everything/i386/os/repodata/repomd.xml: [Errno 14] curl#6 - "Couldn't resolve host"     Trying other mirror


How do I send email from a terminal?

I have been trying to use the unix `mail` command to send emails, but haven't been having much success. I wasn't getting any errors though so I checked my `var/mail` file and found a lot of these messages: > Mailing to remote domains not supported That makes sense, because I haven't given it an SMTP server, but how do I do this? I read through the `man mail` page and didn't see anything that would help, and googling took me to this page which left me feeling confused and rather unintelligent. Is there a guide for setting up smtp settings which is not too much harder than it should be?


Can I prevent "Disable touchpad while typing" from affecting mouse movements?

When I click my name in the upper right, then click "System Settings", then "Mouse and Touchpad", and then "Disable touchpad while typing" it affects my mouse movements. I have to wait two seconds before I can move the pointer with the touchpad. I like the "Disable touchpad while typing" feature in general, as it prevents me from accidentally raising another window instead of the one I'm typing into, but can I have the feature only affect taps of the touchpad and not my attempts to move the mouse around? I'm using GNOME 3.2.1 on Fedora 16


Prevent a unix account from being able to SSH

> **Possible Duplicate:**   >  Disable direct login for normal users (like oracle) in linux but allow scp > and sftp? I want to prevent a unix account from being able to be SSH'ed with, but it should still be usable for SCP / SFTP. Is that possible? The rational is that a unix server uses a generic account for the application and people have been logging on to the box while using that generic account rather than their personal accounts. We want them to SSH to the box using their personal account for audit reasons.


Refresh/reload active browser tab from command line?

I'm trying to set up a custom toolchain where the browser (Firefox or, preferrably, Chrome) is often/frequently/constantly forced to refresh from the commandline. (The idea is to instantly see the visual changes in the html/webapp I'm editing in an adjacent Emacs frame - without having to constantly tab to the browser to do a manual refresh.) The closest I've come so far is to run `google-chrome FILE_PATH`. However this opens a new tab every time. Are there other approaches?


Is chmod behavior wrong for symlinks?

Recently we had a problem on a Red Hat Linux box with many users: the `/usr/bin/sudo` binary has lost its sticky bit. Work was blocked until root user fix it (we need `sudo` for deploying and testing). The reason of this breakdown was... symlink `$HOME/bin/s` pointing to `/usr/bin/sudo`. I thought that having one more bash alias is not good and symlink is a simpler solution that will work with any shell, so I have created symlink `$HOME/bin/s` pointing to `/usr/bin/sudo`. Then a guy copied my `$HOME/bin` to his `$HOME` and "just in case" called `sudo chmod 755 $HOME/bin/*`. As result `/usr/bin/sudo` have got 0755 permissions instead of needed 4111. Now it's fixed, root has logged in and restored permissions for sudo. `man chmod` (Red Hat, Ubuntu):                 chmod never changes the permissions of symbolic links; the chmod system       call  cannot change their permissions.  This is not a problem since the       permissions of symbolic links are never used.  However, for  each  sym-       bolic link listed on the command line, chmod changes the permissions of       the pointed-to file.      My question is: was it my fault because I should never create symlinks pointing to binaries OR is `chmod` behavior wrong and it shouldn't change permissions of files pointed by symlinks? Why is this the behavior of `chmod`? Does it make any sense?


What is "blocking" in reference to file I/O?

My textbook mentions it but doesn't specifically define it. From the context it's used in (in this example, pipes), I take it to mean that if one end of the pipe _blocks_ , it's temporarily "disabled", if you will, and data is queued? That's the part I'm a bit confused about. When it "blocks", does (whatever it is) wait until it's unblocked and then continue with whatever was sent while it was blocked? This seems to be what they're hinting at because they say when it's "non-blocking" it immediately returns an error (if I remember correctly). Any clarification or nudges in the right direction appreciated. Thanks! (Not sure which tags to use)


VirtualBox Hangs when installing freebsd 9.0

When installing Freebsd 9.0 as virtualbox guest, it hangs. Freezes the guest OS, other VirtualBox windows works fine. Logs attached, hardware is pentium D, 4 GB ram, Asus p5ld2 deluxe mainboard, OS - Ubuntu linux. When I select minimum configuration as possible, freebsd was installed in this minimal configuration. Then I tried to install KDE from ftp, and after downloading some packages, it hangs again on downloading ghostscript. How fix this? I asked this on virtualbox forum too


Sorting file by second column

How can I manipulate a two columns tab-separated text file by sorting by the first element of the second column (only if the first column element is the same)? Exemple: Input File 1               A   1-2     A   6-8     A   3-4     B   7-10     B   5-9      Expected output: File 2               A   1-2     A   3-4     A   6-8     B   5-9     B   7-10


Arch Linux OpenVPN DNS-Problem

I can´t successfully connect with OpenVPN or maybe I´ll connect successfully and something is wrong with my network-settings... this is the Output of OpenVPN while connecting:               Thu Feb 13 23:21:13 2014 OpenVPN 2.3.2 x86_64-unknown-linux-gnu [SSL     (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6] built on Nov 13 2013     Thu Feb 13 23:21:13 2014 WARNING: file     '/home/mak/openvpn-config/mkirchweger.p12' is group or others     accessible Thu Feb 13 23:21:13 2014 Attempting to establish TCP     connection with [AF_INET]83.164.xxx.xx:xxxx [nonblock] Thu Feb 13     23:21:14 2014 TCP connection established with     [AF_INET]83.164.xxx.xx:xxxx Thu Feb 13 23:21:14 2014 TCPv4_CLIENT link     local: [undef] Thu Feb 13 23:21:14 2014 TCPv4_CLIENT link remote:     [AF_INET]83.164.xxx.xx:xxxx Thu Feb 13 23:21:14 2014     [bricks.softpoint.at] Peer Connection Initiated with     [AF_INET]83.164.xxx.xx:xxxx Thu Feb 13 23:21:17 2014 TUN/TAP device     tun0 opened Thu Feb 13 23:21:17 2014 do_ifconfig, tt->ipv6=0,     tt->did_ifconfig_ipv6_setup=0 Thu Feb 13 23:21:17 2014 /usr/bin/ip     link set dev tun0 up mtu 1500 Thu Feb 13 23:21:17 2014 /usr/bin/ip     addr add dev tun0 local 10.10.x.xx peer 10.10.x.xx Thu Feb 13 23:21:19     2014 Initialization Sequence Completed **UPDATE:** I´m pretty sure it as an DNS-Issue, ping via IP works but Hostnames can´t be resolved...


Can vmlinux be used instead of uImage?

I want to use an uncompressed kernel image and boot the BeagleBoard. Generally I use uImage to boot the kernel which is in compressed format. How do I use an uncompressed kernel image?


Is there a shutdown/restart command for x11VNC? - Linux (Debian)

I am running Linux (Debian). I recently installed the x11VNC server on my computer. I found the command to start the server is:               x11vnc -display :0      I have been searching but did not find any information on how to restart and shutdown the x11VNC server. Is there a command(s) to do this?


Can you perform system calls from OSX Terminal?

So I get system calls in the context of a C program, but my textbook doesn't really address making system calls in Terminal (on Mac OSX). Can you do these on the command line like with "commands", or is it a totally different concept? Sorry, I'm sure this is very elementary, just can't find an answer.


FileZilla will not start on Slackware

I think it was because I tried to install. Slackware txz 13 and mine is 14.1 64 bit, but I do not know where baicho package for Slack 14.1 can someone help me?


Allowing user access to mailman python files from root?

I just got my first managed VPS, and am taking a crash course in administering users. I normally do most things on my local computer as root. It is running centos-5-x86_64. What I'm trying to do is give one of my user accounts access to command line for cPanel-based mailman install. Namely I want to give him access to all the python scripts in /usr/local/cpanel/3rdparty/mailman/ How would I go about doing this? ACL? Or just add them to the mailman group? I'm completely unsure about what to do for this.


Unkillable apache2 processes

After upgrading from debian lenny to squeeze (apache2 2.2.16-6+squeeze4 and php 5.3.10-1~dotdeb.1), my apache processes started to exit with segmentation fault. It happens every 5-30 minutes (for 1 process), so it does not do any impact right now. Problem is that sometimes instead of exiting with `SIGSEGV`, they just go crazy and loop with 100% system cpu usage in `SIGBUS` error:               # strace -p27635     Process 27635 attached - interrupt to quit     --- SIGBUS (Bus error) @ 0 (0) ---     --- SIGBUS (Bus error) @ 0 (0) ---     --- SIGBUS (Bus error) @ 0 (0) ---     --- SIGBUS (Bus error) @ 0 (0) ---     --- SIGBUS (Bus error) @ 0 (0) ---     --- SIGBUS (Bus error) @ 0 (0) ---      They don't respond to `kill -9`. But when I run strace on the process after killing it, it just repeats the `SIGBUS` twice and then exits.               # strace -p27635     Process 27635 attached - interrupt to quit     --- SIGBUS (Bus error) @ 0 (0) ---     --- SIGBUS (Bus error) @ 0 (0) ---     +++ killed by SIGKILL +++      Why is the process unkillable without strace? How does running strace influence the process that it can exit? (I know that there is probably something wrong with my setup of apache/php modules, but in this question I'm interested in the strange behaviour of the unkillable processes. I will ask another question if I am unable to fix apache/php.)


javac takes over 200% CPU on RHEL6?

> **Possible Duplicate:**   >  top output: cpu usage > 100% I don't think I understand what `top` is telling me. I have a `javac` process that says that it's taking over 200% of CPU. That's in the process line. But at the top, I see:               Cpu(s):  5.2%us, 19.3%sy,  0.0%ni, 74.0%id,  0.1%wa,  0.0%hi,  1.5%si,  0.0%st      which is acceptable. What is that CPU % that's being reported to me in the process lines. It always freaks me out when I see it, then I look at the top and I feel a little bit better.


Understanding %CPU while running top command

I am trying to understand what does `%CPU` means when I run `top`. I am seeing `%CPU` for my application as `400` or `500` most of the times. Does anyone knows what does this mean? What number is a high number? > 19080 david 20 0 27.9g 24g 12m S 400 19.7 382:31.81 paper_client `lscpu` gives me below output:               Architecture:          x86_64     CPU op-mode(s):        32-bit, 64-bit     Byte Order:            Little Endian     CPU(s):                32     On-line CPU(s) list:   0-31     Thread(s) per core:    2     Core(s) per socket:    8     Socket(s):             2     NUMA node(s):          2     Vendor ID:             GenuineIntel     CPU family:            6     Model:                 45     Stepping:              7     CPU MHz:               2599.928     BogoMIPS:              5199.94     Virtualization:        VT-x     L1d cache:             32K     L1i cache:             32K     L2 cache:              256K     L3 cache:              20480K     NUMA node0 CPU(s):     0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30     NUMA node1 CPU(s):     1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31


Change default applications used by gnome-open, exo-open, xdg-open, gvfs-open and kde-open

How to change the applications associated with certain file-types for `gnome- open`, `exo-open`, `xdg-open`, `gvfs-open` and `kde-open`?   1. Is there a way by editing config files or by a command-line command?   2. Is there a way to do this using a GUI? For both questions: How to do it per user basis, how to do it system-wide?


How to fix bash or auto run /bin/bash on SSH login

When logging in as `root` at my server everything works fine, but when I log in as `myusername` the bash is not working correctly. The line starts with:               $       instead of               myusername@myserver:~$      and all specials keys like the arrow keys, tab keys, etc. won't work. When I type `bin/bash` it works again, but I'd like to fix the problem or auto run `bin/bash` on login. How can I fix this?


Flash drive not working on a particular RHEL machine

I have a 32 Gib flash drive. The first time I copied files to it, it failed with a write error and the drive was no longer recognized by the server. I ran a scan on it using Windows chkdsk, which fixed an error, but the server is still not recognizing it even though it works with Windows and other servers (and `fsck` on another server shows no problems). When plugged in, `fdisk -l` does not show it, /proc/scsi/scsi does show it, but also shows the other device entries from when I have tried the flash drive in different USB sockets:               Host: scsi5 Channel: 00 Id: 00 Lun: 00       Vendor: SanDisk  Model: Ultra Backup     Rev: 1.20       Type:   Direct-Access                    ANSI SCSI revision: 02     Host: scsi6 Channel: 00 Id: 00 Lun: 00       Vendor: SanDisk  Model: Ultra Backup     Rev: 1.20       Type:   Direct-Access                    ANSI SCSI revision: 02     Host: scsi8 Channel: 00 Id: 00 Lun: 00       Vendor: SanDisk  Model: Ultra Backup     Rev: 1.20       Type:   Direct-Access                    ANSI SCSI revision: 02      Every time I connect the drive, `dmesg` seems also to be running through a list of devices that are not currently connected:               sdd : READ CAPACITY failed.     sdd : status = 1, message = 00, host = 0, driver = 08     Info fld=0xa00 (nonstd), Current sd00:00: sense key Not Ready     sdd : block size assumed to be 512 bytes, disk size 1GB.     sdd: test WP failed, assume Write Enabled      sdd: I/O error: dev 08:30, sector 0      I/O error: dev 08:30, sector 0      unable to read partition table      I/O error: dev 08:30, sector 0     sdf : READ CAPACITY failed.     sdf : status = 1, message = 00, host = 0, driver = 08     Info fld=0xa00 (nonstd), Current sd00:00: sense key Not Ready     sdf : block size assumed to be 512 bytes, disk size 1GB.     sdf: test WP failed, assume Write Enabled      sdf: I/O error: dev 08:50, sector 0      I/O error: dev 08:50, sector 0      unable to read partition table      Can anyone suggest a way to fix the drive? As I said, it works with other Red Hat servers. I am also worried that `/proc/scsi/scsi` is showing devices that are not connected -- why would that be?


Print odd-numbered lines, print even-numbered lines

I want to print the odd-numbered and even-numbered lines from files. I found this shell script which makes use of echo.               #!/bin/bash     # Write a shell script that, given a file name as the argument will write     # the even numbered line to a file with name evenfile and odd numbered lines     # in a text file called oddfile.     # -------------------------------------------------------------------------     # Copyright (c) 2001 nixCraft project <http://cyberciti.biz/fb/>     # This script is licensed under GNU GPL version 2.0 or above     # -------------------------------------------------------------------------     # This script is part of nixCraft shell script collection (NSSC)     # Visit http://bash.cyberciti.biz/ for more information.     # -------------------------------------------------------------------------          file=$1     counter=0          eout="evenfile.$$" # even file name     oout="oddfile.$$" # odd file name          if [ $# -eq 0 ]     then         echo "$(basename $0) file"         exit 1     fi          if [ ! -f $file ]     then         echo "$file not a file"         exit 2     fi          while read line     do         # find out odd or even line number         isEvenNo=$( expr $counter % 2 )              if [ $isEvenNo -ne 0 ]         then             # even match             echo $line >> $eout         else             # odd match             echo $line >> $oout         fi         # increase counter by 1         (( counter ++ ))     done < $file     echo "Even file - $eout"     echo "Odd file - $oout"      But isn't there a way to do it in one line? _Yes, use awk,_ I read. Even-numbered lines:               awk 'NR % 2' filename      odd-numbered lines:               awk 'NR % 2 == 1' filename      But it doesn't work for me. Both produce the same output, according to diff. When compared to the original file, they are both indeed half as long, and they both contain the odd-numbered lines. Am I doing something wrong?


autocomplete filenames using compgen

As part of a larger autocomplete function I'm writing, I want to use compgen to generate a list of files. I read the bash manual entries for `compgen` and `complete`, and from there I assumed that the option `-G "*"` would be the solution. I could not get it to work, though: The list of files in the current directory was shown, regardless of my input, i.e.:               $ cmd <Tab>     aa bb cc     $ cmd a<Tab>     aa bb cc     $ cmd aa<Tab>     aa bb cc      Therefore, I tried to debug this by using `complete`, which supports the same options as compgen, but I got the same result:               $ complete -G "*" cmd     $ cmd a<Tab>     aa bb cc      I also tried `complete -o filenames`, but this doesn't work either..


Prepending a timestamp to each line of output from a command

I wish to prepend a timestamp to each line of output from a command. For example:               foo     bar     baz      would become               [2011-12-13 12:20:38] foo     [2011-12-13 12:21:32] bar     [2011-12-13 12:22:20] baz      ...where the time being prefixed is the time at which the line was printed. How can I achieve this?


Unlock Gnome shell takes a long time

I lock my GNOME Shell 3.6.3.1 by `Ctrl`+`Alt`+`L` as usual but when I try to unlock it takes up to a minute before I get my desktop back. While waiting I get a black background and a mouse pointer. Any ideas what takes so long?


X commands do not start from my at job

I'm learning about Linux scheduling commands including `at`, `cron`, `sleep` etc. I'm trying to launch `gedit` after x minutes via the `at` command. This is what I have:               kedar@i5 ~ $ at now + 1 minute     at now + 1 minute     warning: commands will be executed using /bin/sh     at> ./s.sh     at> <EOT>     job 18 at Fri Aug 15 13:21:00 2014      The contents of **s.sh** (-rwxr--r--):               #!/bin/sh     #set $DISPLAY=:0     echo "Created on" `date` >t.txt     gedit #(also tried /usr/bin/gedit and `gedit` and systen(/usr/bin/gedit))      After 1 minute, t.txt is created with the expected contents. However, `gedit` is not launched. For that matter, none of my programs(`firefox`,`xcalc`,`xfce4-terminal` etc) can be launched this way via `at`. Strange thing is, when I run `./s.sh` in bash, `gedit` opens up fine. Also I tried running `at` (from a file - if this is at all correct) as:               kedar@i5 ~ $ at now + 1 minute -f ./s.sh      I guess there's something wrong with the way I'm using `at` with the shell script. Also can't I use `at` without a shell script? Thanks.


Remove all Vim undo files in all but one directory

I just realized that I have tons of Vim undo (`.un~`) files sprinkled around my file system. I'd like to delete all of these files except in one directory—`~/.tmp`. My first problem is that I can't seem to find a Unix command to delete these things. For example, I have a file name that looks like this: `.myfile.txt.un~` I've tried, `rm -f *.un`, `rm -f *.un\~`, `rm -f *.un*`, etc. and I can't seem to find any command that can delete these files. How can I delete these files? Secondly, I'd like to write a command with find that can visit all my directories and delete these files, with the exception of the `~/.tmp` directory. I'm quite afraid of executing this command incase it's wrong. Can anyone help be construct a find command to do this? Thanks in advance for the help!


Search plugin for wrapping words with text in Gedit v3

I've been searching out for a plugin that could possibly wraps words with specified text. For example I double click this word to highlight it :               word      and using a particular shortcut, it becomes as :               <b>word</b> or myFunction(word); or ...whatever depending what user defines.      I'm currently using Gedit v3. It would be really helpful if someone know a place where I can get this type of plugin.


recvfrom() doesn't get any request from any remote client

I have written a udp server which receives client requests using a `recvfrom()` socket system call, this call receives requests from localhost only, no remote host requests are seen by the `recvfrom()` call. I tried capturing packets on the receivng port and I can see the packets coming from remote server, but the request don't reach `recvfrom()`, what could be the matter?


How to cd into the named directory if command not found?

When I type something which is neither a zsh builtin and no such executable is found from $PATH, zsh just reports an error. Instead, I would like zsh to check if a named directory exists with that name and cd into it. I tried defining command_not_found_handler() function but it didn't work as it forks a sub-shell to execute that function and hence directory change is not reflected in the actual shell. Is it something that is already possible with some settings or a new (useful?) feature?


Is there a parallel file archiver (like tar)?

Is there something out there for parallel archiving of files? Tar is great, but I don't use tape archives, and it's more important to me that the archiving happens quickly (with compression like bzip2) since I have smp.


Bash vi mode configuration to default to command mode

Is it possible to configure bash vi mode so that initially it is in **command** mode instead on **insert** mode? I find that I have to press `Esc` far too much. It seems that there is possibility to specify this in zsh, but I have not found a way to do this in bash/readline.


Thunderbird: deleted emails are still in local IMAP folder

I am using Thunderbird + IMAP. Thunderbird caches messages locally in:               .icedove/asdfgh.default/ImapMail/mail.example.com/      For each IMAP folder, there are files `Folder` and `Folder.msf`. I have noticed, when I delete an email with large attachment, and then delete it from Trash also, than the trash file `.icedove/asdfgh.default/ImapMail/mail.example.com/Trash` still contains the email (and the attachment). Thus, even though from within Thunderbird it looks as if the message has been deleted (or expunged from trash, or what ever the term is), the message data is still in the trash file (I can see it when I open the Trash file with my text editor) Can anybody please explain what is happening here? How can I **really** delete an email? **And I should add** that the email has been successfully deleted on the IMAP server. So, Thunderbird has deleted the email on the server, but for some reason still keeps the data in the file.


How do I convert an epoch timestamp to a human readable format on the cli? I think there's a way to do it with date but the syntax eludes me (other ways welcome).


Getting a delimiter issue while executing the script

I am creating a `test.sh` file and i am running it as `./test.sh`:               string="hello"     ed << EOF     e any_file     1i     ${string}     EOF      can anybody help me what it does? I am getting some delimiter issue. Can anybody tell me how to do this?


why xfce4 always replace a new files in .config/xfce4/panel/?

I started inotify tools to see which files are changing during my work process. And i found that xfce4 always update their config files. Anyone know it do that ?


Why can't I echo the password to fetchmail?

I'm trying to configure a fetchmail. Before I deal with the syntax of fetchmailrc ( I discovered that the level of bugginess of a problem is synergistic with the number of different aspects of the problem that I do not understand, so one new thing at a time ), I decided to pass all the options via commandline. I got tired of entering the password for each test so I wanted to pass it in the script. I couldn't find something like --pass as a commandline option for fetchmail so I thought maybe echo the password to fetchmail ala:               echo "dohadeer"| fetchmail  --all -p pop3 -k pop.gmail.com --ssl -d0   --user FakeName@gmail.com      I dismissed it and googled "fetchmail password commandline" and got several hits which claimed the above technique worked! But when I tried it I get the error:               fetchmail: can't find a password for FakeName@gmail.com@pop.gmail.com.      I can figure out workarounds for the original problem, but I can't figure out why this approach doesn't work. Obviously there is something I don't understand about Linux and want to figure out.


Why no shebang in .bashrc/.bash_profile?

Simple inquiry: I have just realized that I have never seen a shebang on top of a `.bashrc` script, which leads me to think the system uses the default shell to source it upon login (`${SHELL}`). I am pondering over reasons why that is the case, i.e. is it considered a bad habit to use something other than the default shell to run the login script.


Trim last chars from a line

I have a `csv` file and the lines have different length. But all of them ends with a number surrounded by a pair of braces. For example,               ........{5}     ........{16}      I'd like to remove the number and the braces or maybe replace them for double quotes, for example. The result could be               ........     ........      or               ........"     ........"      I only found solution for lines with fixed length or with the same string at the end of line. Any idea?


/proc/net/wireless does not show values unless run as root

`cat /proc/net/wireless` does not show statistics for wireless devices unless it is run as root, even though the permissions on the file are 444. The same seems to apply when accessing statistics via `iwlib`. Is there a way to `cat` this file and see the values without requiring the command be run as root?


How to switch directly to a pane in Tmux?

I'd like to switch directly to a pane in Tmux, by pane #. How can I do this? I know how to cycle between panes, and move to panes that are beside the current pane. I'd like to be able to run the `display-panes` command, which shows the "pane #" on each pane, then later on jump directly to a pane using the pane #'s that were displayed by `display-panes`. Is this possible? NOTE: And just to be clear, I don't mean window, I mean pane. Thanks!


Why do we need to fork to create new processes?

In Unix whenever we want to create a new process, we fork the current process, creating a new child process which is exactly the same as the parent process; then we do an exec system call to replace all the data from the parent process with that for the new process. Why do we create a copy of the parent process in the first place and not create a new process directly? I am new to Unix, so please explain in layman's terms.


How can I update this sed oneliner?

INPUT:                $ echo -e 'AAAART5530408XXXX\nAAAAZE6530408XXXX\nAAAART12345678XXXX'     AAAART5530408XXXX     AAAAZE6530408XXXX     AAAART12345678XXXX     $      OUTPUT:                $ echo -e 'AAAART5530408XXXX\nAAAAZE6530408XXXX\nAAAART12345678XXXX' | sed -e 's/\(AAAA[A-Z]\{2\}[0-9]\{7\}\)XXXX/\n\1/g'          AAAART5530408          AAAAZE6530408     AAAART12345678XXXX     $         How can I extend the:               sed -e 's/\(AAAA[A-Z]\{2\}[0-9]\{7\}\)XXXX/\n\1/g'      sed oneliner, so that it would optionally accept               sed -e 's/\(AAAA[A-Z]\{2\}[0-9]\{8\}\)XXXX/\n\1/g'      8 numbers too? (not just 7) Is it possible with only 1 sed?


Making two drives show as one on debian?

I rented a server from a provider and they won't install RAID0 without an additional fee. So I'm trying to figure out how to link these two drives so that my programs that are installed on the hard disk will see the space from the second drive. This is how it's setup: `df -h`:               Filesystem                                    Size  Used Avail Use% Mounted on     rootfs                                        139G   93G   39G  71% /     udev                                           10M     0   10M   0% /dev     tmpfs                                         599M  208K  599M   1% /run     /dev/disk/by-uuid/e7a9cc0e-9caa-4d33-b60f-... 139G   93G   39G  71% /     tmpfs                                         5.0M     0  5.0M   0% /run/lock     tmpfs                                         2.7G     0  2.7G   0% /run/shm     /dev/sda1                                     961M   36M  877M   4% /boot     /dev/sda5                                     139G   93G   39G  71% /media/hd      `fdisk -l`:               Disk /dev/sda: 160.0 GB, 160000000000 bytes     255 heads, 63 sectors/track, 19452 cylinders, total 312500000 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00066abb             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048     2000895      999424   83  Linux     /dev/sda2         2002942   312498175   155247617    5  Extended     /dev/sda5         2002944   296499199   147248128   83  Linux     /dev/sda6       296501248   312498175     7998464   82  Linux swap / Solaris          Disk /dev/sdb: 160.0 GB, 160000000000 bytes     58 heads, 29 sectors/track, 185790 cylinders, total 312500000 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00088a99             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1            2048   312499999   156248976   83  Linux      I did my best with my n00bness to mount the 2nd drive. Does anyone know what I need to do to make the drives show up as one?


How to set System Variable for mySQL in RHEL 6.2?

I am currently working on mySQL 5.6.10 server and RHEL 6.2. I need to set the system variable PATH for mySQL on RHEL 6.2 Terminal. How do I set it? I also want to run a `.sql` file on Linux. I am using the following command:               mySQL DBname -uusername -ppassword <"path to the .sql file"      Please help me with the correct command to run the sql script file on Linux. If there are any prerequisites or configurations required to run the `.sql` file?


syslog-ng ignores MSSQL database name

`syslog-ng` ignores the database defined in `syslog-ng.conf` and instead uses the default database of the user when logging to MSSQL destination.               destination d_mssql {     sql(type(mssql)             host("myhost") username("myuser") password("mypass")             database("syslogng")             table("msgs_${R_YEAR}${R_MONTH}${R_DAY}")columns(                     "seqnum bigint",                     "datetime varchar(16)", "host varchar(32)",                     "program varchar(32)", "pid varchar(8)", "priority varchar(10)", "facility varchar(10)", "pri int",                     "message varchar(max)")             values("$SEQNUM", "$R_DATE", "$HOST", "$PROGRAM", "$PID", "$PRIORITY", "$FACILITY", "$PRI", "$MSGONLY")             indexes("datetime", "host", "program", "pid"));     };      As you can see I want to use "syslogng" as my database but what happens is that `syslog-ng` uses the default database ("master") configured for "myuser" in MS SQL Server. If I change the default database for "myuser" in SQL server to "syslogng", then it will write to "syslogng" database. But this is not what I want. I want to be able to configure the database in `syslog-ng.conf`. Any ideas why this is happening? Same question on BalaBit community website.


Is it possible to execute a sub-command from a Gnome Shell launcher?

I've got an alias set up to launch my text editor in a way that keeps it local to the specific desktop I'm working on in Gnome Shell:               alias geany="geany --socket-file=/tmp/geany-sock-$(xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}') ${1+"$@"}"      I'd like to emulate this with the actual Gnome Shell launcher. As it stands, I have the launcher command set to:               geany --socket-file=/tmp/geany-sock-$(xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}') %F      Which will point to the open Geany session in the current window if one is already open, but it won't launch a new session. I'll get a spinner, and then it just quits rather than launching the app. Is there any way to do this?


Using symbolic links and git to manage build versions

In general I follow the following workflow when I build any program (e.g. `emacs`, `tmux`, etc.)               /home/opt/[name of the program]/builds/[version]/          bin     lib     share      For example for a program like `tmux` I have the following:               /my_local_opt/tmux/builds/1.7.-227/          bin     lib     share      I then create sym links in `/home/bin/` pointing to the the specific builds that I have, and I never have to touch my `PATH` variable, since I fix it to include `/home/bin`. E.g. For the example above, I would   * Create a sym link: from: `/home/bin/tmux` to: `/my_local_opt/tmux/builds/1.7.-227/bin/tmux`   * Have `PATH` only include `/home/bin` However, I am not sure I can follow a similar approach for the `man` (`MANPATH`) and `lib` (`LD_LIBRARY_PATH`) paths.   1. For example, after I build `tmux` I notice that it creates: > `.. /share/man/man1/tmux.1` so I tried creating a symlink to this file from a place like `/home/share` and then fixing `MANPATH` to include this path. But when I typed `man tmux` it didn't work (it said "`No manual entry for tmux`"). Why?   2. How about `lib`? I thought I could perhaps fix `LD_LIBRARY_PATH` to a specific directory for each program, and then use sym links to control which version gets included. Would this be a good idea? More generally, is it a good idea to manage versions in a system using sym links? In the long run I am hoping to leave the sym links in a git repository to keep track of multiple configurations. In case it helps, I don't have admin privileges in the machine where I build software, so I am hoping to use this as a way easily organize and manage my builds (without having to constantly edit my environment variables holding paths)


What is the alternative of Wingdings 2 with wine?

There are wine-wingdings-fonts available via EPEL for linux. These seems to be compatible with Wingdings (used in Microsoft Windows). Is there any wine-fonts available which is exact mapping of Wingdings 2? I'm assuming wine-wingdings-fonts is not compatible to Wingdings. Thanks in advance.


Wheezy and touchscreen issues

I've just bought an ASUS N550JV notebook and wanted to install Debian Wheezy. Right now, my worst concern is the touchscreen. I don't really care whether it works or not but it is really messing with the OS. I installed Debian stable which comes with the 3.2.57 kernel. The touchscreen didn't work at all and I didn't really care until I run `dmesg`. Each 2 seconds I get spammed with the following text added to the dmesg output:               [   31.901696] xhci_queue_intr_tx: 74 callbacks suppressed     [   33.826890] usb 1-10: USB disconnect, device number 12     [   34.098270] usb 1-10: new full-speed USB device number 13 using xhci_hcd     [   34.116166] usb 1-10: New USB device found, idVendor=04f3, idProduct=010c     [   34.116176] usb 1-10: New USB device strings: Mfr=4, Product=14, SerialNumber=0     [   34.116181] usb 1-10: Product: Touchscreen     [   34.116185] usb 1-10: Manufacturer: ELAN     [   34.116485] usb 1-10: ep 0x2 - rounding interval to 64 microframes, ep desc says 80 microframes     [   36.187570] usb 1-10: USB disconnect, device number 13     [   36.458741] usb 1-10: new full-speed USB device number 14 using xhci_hcd     [   36.476680] usb 1-10: New USB device found, idVendor=04f3, idProduct=010c     [   36.476689] usb 1-10: New USB device strings: Mfr=4, Product=14, SerialNumber=0     [   36.476695] usb 1-10: Product: Touchscreen     [   36.476698] usb 1-10: Manufacturer: ELAN     [   36.477006] usb 1-10: ep 0x2 - rounding interval to 64 microframes, ep desc says 80 microframes     [   37.013838] xhci_queue_intr_tx: 78 callbacks suppressed      I will run out of disk space if I just leave the computer on because the log files will get huge. I went for a `rmmod xhci_hcd` and that stopped the output but also the mouse, so it is not an option. So I thought the kernel must have been just old. So I added the wheezy backports and gave the 3.14 kernel a try. Not only did it stop the output but also made the touchscreen work (or at least be able to receive single touches). However, after I added the system monitor applet I noticed something was wrong. I always want to monitor the CPU usage (in blue) and the CPU IOWait (in red). ![screenshot](http://i.stack.imgur.com/PlrMB.png) Now it seems to intermittently perform some action that results in an IOWait (see the red dots next to the clock). I don't know what it is or what to blame but the monitor is just telling what it sees. The funny thing is that with the 3.2 kernel, with the constant log writes, I just don't see a single dot in the monitor (nor CPU, nor any IOWait) when doing nothing, so I guess whatever action the newer kernel is performing is requiring more resources than appending to a file every 2 seconds. That was as far as I can get. After using Debian for 5 years, falling back to Windows seems to be the only option right now. Any help will be appreciated.               $ lspci -nn     00:00.0 Host bridge [0600]: Intel Corporation Haswell DRAM Controller [8086:0c04] (rev 06)     00:01.0 PCI bridge [0604]: Intel Corporation Haswell PCI Express x16 Controller [8086:0c01] (rev 06)     00:02.0 VGA compatible controller [0300]: Intel Corporation Haswell Integrated Graphics Controller [8086:0416] (rev 06)     00:03.0 Audio device [0403]: Intel Corporation Haswell HD Audio Controller [8086:0c0c] (rev 06)     00:14.0 USB controller [0c03]: Intel Corporation Lynx Point USB xHCI Host Controller [8086:8c31] (rev 05)     00:16.0 Communication controller [0780]: Intel Corporation Lynx Point MEI Controller #1 [8086:8c3a] (rev 04)     00:1a.0 USB controller [0c03]: Intel Corporation Lynx Point USB Enhanced Host Controller #2 [8086:8c2d] (rev 05)     00:1b.0 Audio device [0403]: Intel Corporation Lynx Point High Definition Audio Controller [8086:8c20] (rev 05)     00:1c.0 PCI bridge [0604]: Intel Corporation Lynx Point PCI Express Root Port #1 [8086:8c10] (rev d5)     00:1c.1 PCI bridge [0604]: Intel Corporation Lynx Point PCI Express Root Port #2 [8086:8c12] (rev d5)     00:1c.2 PCI bridge [0604]: Intel Corporation Lynx Point PCI Express Root Port #3 [8086:8c14] (rev d5)     00:1c.3 PCI bridge [0604]: Intel Corporation Lynx Point PCI Express Root Port #4 [8086:8c16] (rev d5)     00:1d.0 USB controller [0c03]: Intel Corporation Lynx Point USB Enhanced Host Controller #1 [8086:8c26] (rev 05)     00:1f.0 ISA bridge [0601]: Intel Corporation Lynx Point LPC Controller [8086:8c49] (rev 05)     00:1f.2 SATA controller [0106]: Intel Corporation Lynx Point 6-port SATA Controller 1 [AHCI mode] [8086:8c03] (rev 05)     00:1f.3 SMBus [0c05]: Intel Corporation Lynx Point SMBus Controller [8086:8c22] (rev 05)     01:00.0 3D controller [0302]: NVIDIA Corporation Device [10de:0fe4] (rev ff)     04:00.0 Network controller [0280]: Atheros Communications Inc. AR9485 Wireless Network Adapter [168c:0032] (rev 01)     05:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller [10ec:8168] (rev 0c)


how to get tornado 211g (ACX111) working in mint 13 xfce?

I have mint 13 xfce installed on my thinkpad r31. For this laptop, I have a Tornado 211g pcmcia wireless adapter. This is not installed automatically in Mint and I am searching for a way to get this card working. How Can I achieve this? I have the windows XP drivers and have added these using ndiswrapper but so far, nothing has happened. in terminal, I have typed _lspci_ which returned my wireless adapter as an ACX111 chipset.


Is Mac OS X really SUS compliant?

Internet says that Mac OS X 10.8 _has achieved certification to The Open Group UNIX® 03 standard_ and that it _is a compliant system_. But a simple test with `echo` seems to indicate otherwise: **a)** The Base Specification states   > Implementations **shall not** support any options. and > IEEE Std 1003.1-2001/Cor 1-2002, item XCU/TC1/D6/21 is applied, so that the > echo utility can accommodate historical BSD behavior.    **b)** The man page says states > **SYNOPSIS**   >  echo [-n] [string ...] and > **STANDARDS**   >  The echo utility conforms to IEEE Std 1003.1-2001 (``POSIX.1'') as amended > by Cor. 1-2002.    **c)** The reality is that it supports options. At least `e`                 (user@avitus tmp)$ uname -a     Darwin avitus.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan  6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64     (user@avitus tmp)$ echo -e "test \tAm I SUS compliant?"     test    Am I SUS compliant?     (user@avitus tmp)$ echo "test \tAm I SUS compliant?"     test \tAm I SUS compliant?            So, the questions are:   **1. Does this break compliance?**   **2. Is Mac OS X 10.8 really SUS compliant?**   **3. Does the part** _item XCU/TC1/D6/21 is applied, so that the echo utility can accommodate historical BSD behavior._ **have something to do? If so, where is that item explained? The** Technical Corrigendum Number 1 for the Austin Group Specifications **doesn't say much.**   **4. Am I missing something?**


Searching for packages using apt-get

I'd like to search for repository packages using package name or package description. For example   * Search for Zend   * Search for Ze*d


How to add a path to system $PATH for all users's non-login shell and login shell on debian

I installed some programs in /opt/my-program/bin, I wanted to add /opt/my- program/bin to system $PATH for all users's non-login shell and login shell. What should I do? Changing /etc/environment is OK for non-login shell, but it does not work for login shell because Debian's /etc/profile (which will be sourced by login shell) will override the $PATH specified in /etc/environment.


Is there a way to view the console output instead of boot logo, while my RHEL 6.2 machine boots up?

My company provided laptop has RHEL6.2, with lot of programs to start up automatically, which makes the boot up process slow. While the machine boots up, there is the boring RHEL logo on the screen for a long time. Instead is there way to view the console, while my machine boots up? The console log would at least keep scrolling and won't be as monotonous! :) **Edit:** My laptop has LUKS disk encryption. So after grub screen, LUKS asks for the disk password and then the RHEL logo keeps rotating for a long time!


Piped input to nano

Why does `ls | nano -` open the editor in Ubuntu but close the editor and save a file to `-.save` in CentOS? How can I get nano in CentOS to remain open when reading stdin?


Need advice on using Wireshark + aircrack-ng

I am making acquiantance with wireless security and attacks and was told to run some tests with aircrack-ng and wireshark. So I installed both of them and ran airmon to switch wi-fi card to monitor mode: `sudo airmon-ng start ra0` (this is my DWA-140 usb wi-fi adapter) The wi-fi adapter seems to have restarted after that. Gues that's ok. Still it gave some warnings on processes that might interfere with normal work like `network manager, dhclient` and a few more. I tried to stop them, but they seem to restart all the time. After that I ran wireshark as a superuser, chose the ra0 adapter and tried to sniff the test open network. I have my PC connected to it (via dwa-140) and an HTC phone and some stranger PCs. Wireshark runs on my PC. The problem is that when I login to `%sitename%` with a PC browser, I can see the cookies sent to it in Wireshark. But when I do the same thing with an Opera Mobile browser on my HTC (`Turbo` option disabled), there is nothing detected. I know that stranger PCs are also sending data to `%sitename%`, but I see nothing from them as well. Actually I see a lot of packets from stranger PCs, but not the ones I need. I'd like to know what I'm doing wrong. Will be thankful for any advice. P.S. This runs on Ubuntu 12.04.1


Why is the default shell in Debian 7 bash?

As per documentation, `dash` should be the default shell in Debian Wheezy, however when I open up a terminal and check the `SHELL` variable, it points to `/bin/bash`. Since this is a fresh install, and I have not made any changes, why is this not pointing to `/bin/dash`? Or is the default shell stored or pointed to by some other variable?


Reformatting a large number of XML files

I'm manipulating a large number of XML files scattered throughout a nested directory structure. I tried the following (which almost works):               $ find . -name "*.xml" -type f | xargs -- xmllint --format      The problem is this generates the formatted XML output on the screen, but doesn't change the file. How can I change this command so that the actual file contents are changed? Thanks!


Is it possible to have malware software in Linux without executing untrusted applications?

I'm linux user and I'm thinking about it's vulnerabilities to malware. Can I get any malware if I run only trusted applications from distro's repository?


Why does mapping <esc> cause arrow keys to fail in vim?

When I do               inoremap <Esc> <Esc>`^      in vim, the next time I switch to insert mode (after using `Esc`) the arrow keys fail to move the cursor (they insert letters instead). Why does that happen? * * * **Edit** : It is possible to remap `Esc` and still retain working arrow keys?


Among "ps" command output fields, %CPU isn't the actual CPU usage of the process?

For example, one of the output fields of this BSD style command, `ps aux`, is "%CPU". The alternative command, `ps -efl` outputs the "C" (or CP) field. As per the `ps` man page:   * **%CPU** is the cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage.   * **C** is essentially %CPU expressed as an integer That is how the `ps` man page details %CPU or C. But most books and websites on the internet simply say, `%CPU or C is CPU usage of a process`. One would think that it means % of the CPU's processing power used by a process out of the total available processing power from the CPU. Or is it only me? (PS: I am a beginner)


Can't insert rt2800usb module: Invalid argument

I just got an ASUS N13 USB wireless dongle, and unfortunately it's not detected and I can't load it with modprobe:               $ sudo modprobe rt2800usb     WARNING: All config files need .conf: /etc/modprobe.d/blacklist, it will be ignored in a future release.     WARNING: Error inserting rt2x00usb (/lib/modules/3.0.0-14-generic/kernel/drivers/net/wireless/rt2x00/rt2x00usb.ko): Invalid argument     WARNING: Error inserting crc_ccitt (/lib/modules/3.0.0-14-generic/kernel/lib/crc-ccitt.ko): Invalid argument     WARNING: Error inserting rt2800lib (/lib/modules/3.0.0-14-generic/kernel/drivers/net/wireless/rt2x00/rt2800lib.ko): Invalid argument     FATAL: Error inserting rt2800usb (/lib/modules/3.0.0-14-generic/kernel/drivers/net/wireless/rt2x00/rt2800usb.ko): Invalid argument      What's the problem here? I read that this works usually out of the box with Ubuntu 11.10? What can I do to fix this? Is there a package I can reinstall to try and fix things?


What iptables command do I need to allow web server traffic?

I have a hard time understanding `iptables` rules. I am running a centos 6.5 VM on my laptop (vmware hypervisor) and it looks like it comes with this setup for `iptables`:               # iptables -L     Chain INPUT (policy ACCEPT)     target     prot opt source               destination              ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED      ACCEPT     icmp --  anywhere             anywhere                 ACCEPT     all  --  anywhere             anywhere                 ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh      REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited           Chain FORWARD (policy ACCEPT)     target     prot opt source               destination              REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited           Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination               I just install apache on it, but I was not able to access the web server even though `httpd` is running. This is the error I get, if I attempt to access the web server from the localhost:               [root@mig-dev-006 conf]# wget http://mig-dev-006.example.com     --2014-07-09 08:46:00--  http://mig-dev-006.example.com/     Resolving mig-dev-006.example.com... 192.168.203.129     Connecting to mig-dev-006.example.com|192.168.203.129|:80... connected.     HTTP request sent, awaiting response... 403 Forbidden     2014-07-09 08:46:00 ERROR 403: Forbidden.      From my Windows7 laptop (using `cygwin`) I get this error:               $ wget http://mig-dev-006.example.com     --08:45:47--  http://mig-dev-006.example.com/                => `index.html'     Resolving mig-dev-006.cisco.com... 192.168.203.129     Connecting to mig-dev-006.example.com|192.168.203.129|:80... failed: Connection timed out.      I know that I can simply flush the `iptables` rules with `iptables --flush`, but I'd prefer to understand what is going on and be able to add a rule that would allow `http` and `https` traffic. * * * Here is my `httpd.conf`:               $ grep -v "#" /etc/httpd/conf/httpd.conf  | grep -v "^$"     ServerTokens OS     ServerRoot "/etc/httpd"     PidFile run/httpd.pid     Timeout 60     KeepAlive Off     MaxKeepAliveRequests 100     KeepAliveTimeout 15     <IfModule prefork.c>     StartServers       8     MinSpareServers    5     MaxSpareServers   20     ServerLimit      256     MaxClients       256     MaxRequestsPerChild  4000     </IfModule>     <IfModule worker.c>     StartServers         4     MaxClients         300     MinSpareThreads     25     MaxSpareThreads     75      ThreadsPerChild     25     MaxRequestsPerChild  0     </IfModule>     Listen 80     LoadModule auth_basic_module modules/mod_auth_basic.so     LoadModule auth_digest_module modules/mod_auth_digest.so     LoadModule authn_file_module modules/mod_authn_file.so     LoadModule authn_alias_module modules/mod_authn_alias.so     LoadModule authn_anon_module modules/mod_authn_anon.so     LoadModule authn_dbm_module modules/mod_authn_dbm.so     LoadModule authn_default_module modules/mod_authn_default.so     LoadModule authz_host_module modules/mod_authz_host.so     LoadModule authz_user_module modules/mod_authz_user.so     LoadModule authz_owner_module modules/mod_authz_owner.so     LoadModule authz_groupfile_module modules/mod_authz_groupfile.so     LoadModule authz_dbm_module modules/mod_authz_dbm.so     LoadModule authz_default_module modules/mod_authz_default.so     LoadModule ldap_module modules/mod_ldap.so     LoadModule authnz_ldap_module modules/mod_authnz_ldap.so     LoadModule include_module modules/mod_include.so     LoadModule log_config_module modules/mod_log_config.so     LoadModule logio_module modules/mod_logio.so     LoadModule env_module modules/mod_env.so     LoadModule ext_filter_module modules/mod_ext_filter.so     LoadModule mime_magic_module modules/mod_mime_magic.so     LoadModule expires_module modules/mod_expires.so     LoadModule deflate_module modules/mod_deflate.so     LoadModule headers_module modules/mod_headers.so     LoadModule usertrack_module modules/mod_usertrack.so     LoadModule setenvif_module modules/mod_setenvif.so     LoadModule mime_module modules/mod_mime.so     LoadModule dav_module modules/mod_dav.so     LoadModule status_module modules/mod_status.so     LoadModule autoindex_module modules/mod_autoindex.so     LoadModule info_module modules/mod_info.so     LoadModule dav_fs_module modules/mod_dav_fs.so     LoadModule vhost_alias_module modules/mod_vhost_alias.so     LoadModule negotiation_module modules/mod_negotiation.so     LoadModule dir_module modules/mod_dir.so     LoadModule actions_module modules/mod_actions.so     LoadModule speling_module modules/mod_speling.so     LoadModule userdir_module modules/mod_userdir.so     LoadModule alias_module modules/mod_alias.so     LoadModule substitute_module modules/mod_substitute.so     LoadModule rewrite_module modules/mod_rewrite.so     LoadModule proxy_module modules/mod_proxy.so     LoadModule proxy_balancer_module modules/mod_proxy_balancer.so     LoadModule proxy_ftp_module modules/mod_proxy_ftp.so     LoadModule proxy_http_module modules/mod_proxy_http.so     LoadModule proxy_ajp_module modules/mod_proxy_ajp.so     LoadModule proxy_connect_module modules/mod_proxy_connect.so     LoadModule cache_module modules/mod_cache.so     LoadModule suexec_module modules/mod_suexec.so     LoadModule disk_cache_module modules/mod_disk_cache.so     LoadModule cgi_module modules/mod_cgi.so     LoadModule version_module modules/mod_version.so     Include conf.d/*.conf     User apache     Group apache     ServerAdmin root@localhost     ServerName mig-dev-006.example.com     UseCanonicalName Off     DocumentRoot "/var/www/html"     <Directory />         Options FollowSymLinks         AllowOverride None     </Directory>     <Directory "/var/www/html">         Options Indexes FollowSymLinks         AllowOverride None         Order allow,deny         Allow from all     </Directory>     <IfModule mod_userdir.c>         UserDir disabled     </IfModule>     DirectoryIndex index.html index.html.var     AccessFileName .htaccess     <Files ~ "^\.ht">         Order allow,deny         Deny from all         Satisfy All     </Files>     TypesConfig /etc/mime.types     DefaultType text/plain     <IfModule mod_mime_magic.c>         MIMEMagicFile conf/magic     </IfModule>     HostnameLookups Off     ErrorLog logs/error_log     LogLevel warn     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined     LogFormat "%h %l %u %t \"%r\" %>s %b" common     LogFormat "%{Referer}i -> %U" referer     LogFormat "%{User-agent}i" agent     CustomLog logs/access_log combined     ServerSignature On     Alias /icons/ "/var/www/icons/"     <Directory "/var/www/icons">         Options Indexes MultiViews FollowSymLinks         AllowOverride None         Order allow,deny         Allow from all     </Directory>     <IfModule mod_dav_fs.c>         DAVLockDB /var/lib/dav/lockdb     </IfModule>     ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"     <Directory "/var/www/cgi-bin">         AllowOverride None         Options None         Order allow,deny         Allow from all     </Directory>     IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8     AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip     AddIconByType (TXT,/icons/text.gif) text/*     AddIconByType (IMG,/icons/image2.gif) image/*     AddIconByType (SND,/icons/sound2.gif) audio/*     AddIconByType (VID,/icons/movie.gif) video/*     AddIcon /icons/binary.gif .bin .exe     AddIcon /icons/binhex.gif .hqx     AddIcon /icons/tar.gif .tar     AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv     AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip     AddIcon /icons/a.gif .ps .ai .eps     AddIcon /icons/layout.gif .html .shtml .htm .pdf     AddIcon /icons/text.gif .txt     AddIcon /icons/c.gif .c     AddIcon /icons/p.gif .pl .py     AddIcon /icons/f.gif .for     AddIcon /icons/dvi.gif .dvi     AddIcon /icons/uuencoded.gif .uu     AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl     AddIcon /icons/tex.gif .tex     AddIcon /icons/bomb.gif core     AddIcon /icons/back.gif ..     AddIcon /icons/hand.right.gif README     AddIcon /icons/folder.gif ^^DIRECTORY^^     AddIcon /icons/blank.gif ^^BLANKICON^^     DefaultIcon /icons/unknown.gif     ReadmeName README.html     HeaderName HEADER.html     AddLanguage ca .ca     AddLanguage cs .cz .cs     AddLanguage da .dk     AddLanguage de .de     AddLanguage el .el     AddLanguage en .en     AddLanguage eo .eo     AddLanguage es .es     AddLanguage et .et     AddLanguage fr .fr     AddLanguage he .he     AddLanguage hr .hr     AddLanguage it .it     AddLanguage ja .ja     AddLanguage ko .ko     AddLanguage ltz .ltz     AddLanguage nl .nl     AddLanguage nn .nn     AddLanguage no .no     AddLanguage pl .po     AddLanguage pt .pt     AddLanguage pt-BR .pt-br     AddLanguage ru .ru     AddLanguage sv .sv     AddLanguage zh-CN .zh-cn     AddLanguage zh-TW .zh-tw     LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW     ForceLanguagePriority Prefer Fallback     AddDefaultCharset UTF-8     AddType application/x-compress .Z     AddType application/x-gzip .gz .tgz     AddType application/x-x509-ca-cert .crt     AddType application/x-pkcs7-crl    .crl     AddHandler type-map var     AddType text/html .shtml     AddOutputFilter INCLUDES .shtml     Alias /error/ "/var/www/error/"     <IfModule mod_negotiation.c>     <IfModule mod_include.c>         <Directory "/var/www/error">             AllowOverride None             Options IncludesNoExec             AddOutputFilter Includes html             AddHandler type-map var             Order allow,deny             Allow from all             LanguagePriority en es de fr             ForceLanguagePriority Prefer Fallback         </Directory>     </IfModule>     </IfModule>     BrowserMatch "Mozilla/2" nokeepalive     BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0     BrowserMatch "RealPlayer 4\.0" force-response-1.0     BrowserMatch "Java/1\.0" force-response-1.0     BrowserMatch "JDK/1\.0" force-response-1.0     BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully     BrowserMatch "MS FrontPage" redirect-carefully     BrowserMatch "^WebDrive" redirect-carefully     BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully     BrowserMatch "^gnome-vfs/1.0" redirect-carefully     BrowserMatch "^XML Spy" redirect-carefully     BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully      The only change I made was to add the `ServerName`.


slow samba seek performance

I am using FreeBSD 9.0 RC3 (PCBSD distro) with samba 3.4.14. I am trying to access portions of several large (4 - 10 GB) files over samba using seek commands, and I am seeing that calls to the front of the file are returning very quickly, but calls to near the end of the file are taking 15+ seconds to respond. It is as if the OS has to read the entire file up to the position I am seeking to. The file system is ZFS v28 on a 5 drive Z2 configuration. Are there any parameters governing seek? When I host these files on a Windows Server 2008 R2 box, I am not seeing any of these issues. ![Disk Mark Performance](http://i.stack.imgur.com/9Uf0f.png) I've attached my results from crystaldiskmark over the network as well.


Checking the order of items in a shell environment variable

I am wanting to check that a certain directories always appear after other directories in an environment variable. List items are separated by a colon, as with the PATH variable. This is not simply for bash, but for a few different shells. The problem is, I'm not sure how to check the order of items in a list using standard unix utilities. What would be a starting point? edit: An example would be               $LIST=/test:/bin/test:/etc/test:/nan/:/var      I would want to test for example that any directory path that had the word test in it was prior in the list to a directory that did not. What I want to do is small enough that I can hardcode the directories, so a dynamic solution is not necessary.


Is there a way to convert IE favourites to bookmark.htm format?

After switching from Windows to Linux, I am left with a favourite directory containing subfolders and `.url` files, each file containing a few lines of text that look like this:               [DEFAULT]     BASEURL=http://www.example.com/faq.html     [InternetShortcut]     URL=http://www.example.com/faq.html     Modified=70E5E788C3B9C9010A      Since I do not have internet explorer installed on my Linux system, it is not possible for me to import the bookmarks directly to my current Firefox browser. I was wondering if there is a quick way to extract the URL from all the `.url` files, together with the filenames to generate a `.htm` file which I can import to any modern browser.


Laptop camera. How to get detailed information about it?

My Samsung laptop has a built-in camera. The camera works fine. I want to get detailed information on it, at the very least model and communication bus. The output of `lsusb`, `lspci`, `lshw`, `ls /dev` do not show anything interesting ... or do they? Maybe I do not know what to look for!