How can you change the format command used by man?

I'd like to define a new command that prints man pages to PostScript, but using a page size different than the default. For example, on Mac OS X you can run               man -t ls | open -f -a Skim      to open the man page for `ls` as a PDF, which is almost exactly what I'd like. In fact, the only change I want to make is to print to a different page size. Since I'm never actually going to print these out on real paper, it would be nice to have the PDF sized to fit more neatly on my monitor. But I haven't been able to figure out how to do this in a simple way. The man page for `man` says that the `-t` switch will > Use `/usr/bin/groff -Tps -mandoc -c` to format the manual page, passing the > output to `stdout`. To get a different page size it would appear that you need to change the arguments to `groff` to something like `groff -Tps -P-pa4`, so it looks like the straightforward way to do this is to give `man` a different command to use for formatting the man page. But there doesn't seem to be a command line switch or an environment variable that allows you to do this. Is there a way to invoke `man` so that it uses a command that I specify to format the man page? (I would prefer to avoid doing something like               groff -Tps -P-pa4 -mandoc -c `man -w ls`      because sometimes the man pages are compressed as `.gz` files and sometimes they aren't, and presumably `man` could be making some other decisions about how to preprocess man pages.)


Routing packets between networks with iptables

I'm trying to create a proxy of sorts using just iptables. The linux computer (my proxy) has two ports:   * p2p1 is connected to the Internet.   * em1 is connected to a local network. There are two devices on the local network (not including the linux machine). To connect to these, we should type (from any computer on the Internet):   * xx.xx.xx.xx:10001   * xx.xx.xx.xx:10002 where xx.xx.xx.xx is the public IP (and is dynamic). These devices can be accessed from the linux machine on the em1 port by accessing the following IPs:   * 192.168.3.100:80   * 192.168.3.101:80 So, all traffic that gets routed into xx.xx.xx.xx:10001 on p2p1 should be redestined for 192.168.3.100 on em1. I also need to retain the source IP, or something to that effect, so the packets can find their way back. Here's what I'm using in my IP tables script.               iptables -t nat -F  # Clear out any old rules.          MyIP=10.27.155.200     MyPort=10001     DestIP=192.168.3.100     DestPort=80          iptables -t nat -A PREROUTING --dst $MyIP -p tcp --dport $MyPort -j DNAT --to-destination $DestIP:$DestPort     iptables -t nat -A POSTROUTING -p tcp --dst $DestIP --dport $DestPort -j SNAT --to-source $MyIP     iptables -t nat -A OUTPUT --dst $MyIP -p tcp--dport $MyPort -j DNAT --to-destination $DestIP:$DestPort      Obviously there are some problems because my IP is dynamic, yet I'm hard coding it in every time. Furthermore, the packets, once they return to the computer, don't know how to get to their original source. I don't know where to go from here.


Linux: Difference between /dev/console , /dev/tty and /dev/tty0

On a Linux system, what is the difference between /dev/console , /dev/tty and /dev/tty0 ? What is their respective use? How do they compare?


How does SELinux / SEAndroid prevent or allow pseudo terminal allocation?

I'm trying to resolve an SSH connection issue on an Android phone running `SELinux` in "Enforcing" mode. The problem is that any SSH connection that tries to allocate a pseudo-terminal (`/dev/pts` etc) is denied permission, leaving my connection without a controlling tty. Practically this means that I loose the ability to use normal terminal control for editing, command history, CTRL characters etc. Presumably this means that SELinux is preventing the SSH daemon from opening `/dev/ptmx`. I have no idea how to remedy this highly annoying situation, from within SSH server device (phone). I'm running SSHelper on a non-priviledged port 2222 on a _Samsung S4_ using an _SELinux Enforcing AOS 4.2.2_ version. The weirdest thing is that I have root access using _su_ under "Enforcing", but when I disable "Enforcing" and go to "Permissive", everything works in terminal, but I can no longer use su to gain root! (Simply no reaction and no error message.) **So there must be a way to control this under SELinux, but where and how?** Or is this a triviality and that I have only missed something? * * * For SSH connection in _Enforcing_ mode, I use:               $ ssh -2 dummy@192.168.1.10 -p 2222     SSHelper Version 6.3 Copyright 2014, P. Lutus     dummy@192.168.1.10's password:     PTY allocation request failed on channel 0     Linux 3.4.0-2340422 armv7l      This gets me a non tty shell with no prompt, severely limiting any editing possibilities. PS. I have already tried with `ssh -t ...`, no go.


Using CtrlP isn't giving very good results - am I using it wrong?

I was hoping that I could just type "job.php" and be directed to the `job.php` in my `/lib/model/` folder, but I've mostly just get many other files returned:               [No name]          > batch/dataFixes/jobProspectsSubscriptionId.php     > batch/dataFixes/jobProspectsRankDistance.php     > batch/dataFixes/hiredJobDistanceRankFeedback.php     > batch/sendWeeklyJobOwnersUpdateEmail.php     > batch/dataFixes/backdateJobClosureDailyStats.php     > batch/dataFixes/jobExpectedRevenue.php     > batch/dataFixes/updateJobStats.php     > batch/updateEndedJobState.php     > batch/findUnresponsiveJobPosters.php     > batch/_job_criteria.php           prt  file  <mru>={ files }=<buf> <->      /Users/shane/Documents/sites/zinc      >d> job.php_      Switching to 'find in path' mode, and typing `lib/model/job.php` brings up tonnes of other classes in that folder which have 'job' in the filename, but not `job.php`. Job is a pretty common word in our project, but I was hoping that an exact match for the filename would get ranked pretty highly in the results. Am I using CtrlP wrong, or is the project not really suited to it?


What are possible issues with installing a package from the developer instead of the distro-repositories

It might sound like a trivial question to some but even though I have been using Linux for quite a few years I haven't really figured out this question. Little background info; I recently upgraded my system from Mint12 to Mint14 and as I started my eclipse installation I realized that I need to install SVN again. It turns out the latest version is 1.7.8 (as of now) while the version I get from the repos is 1.7.5. Now one might argue whether or not it's a big deal, but I personally like to stay in-sync with the current version to avoid downstream issues. I was wondering what kind of problems might arise from skipping the repos and installing from the developers homepage (subversion.apache in this case).


Shell programming, avoiding tempfiles

I often write KSH shell scripts that follow the same pattern:   * (1) retrieve output from one or more command   * (2) format it using grep|cut|awk|sed and print it to the screen or to a file In order to do that, I often store the output of (1) in a tempfile, and then do the formatting in (2) on that file. Take that code for instance:               TMPFILE=file.tmp          # If tmpfile exists rm it.     [ -f $TMPFILE ] && rm -f $TMPFILE          for SERVICE in $(myfunc); do         getInfo $SERVICE > $TMPFILE # Store raw output in the TMPFILE              # I retrieve the relevant data from the TMPFILE         SERV_NAME=$(head -1 $TMPFILE | sed -e 's/ $//')         SERV_HOSTNAME=$(grep HOSTNAME $TMPFILE | cut -d "=" -f2)         SERV_ARGS=$(grep Arguments $TMPFILE | cut -d ":" -f2)              print $SERV_NAME $SEP $SERV_HOSTNAME $SEP $SERV_ARGS         rm -f $TMPFILE #rm the TMPFILE in vue of next iteration     done      Is there a way, using pipes, redirections and whatnots, to avoid writing a file to disk each time? If it helps, I'm using ksh Version M-11/16/88i


Fedora17 record screencast doesn't work

I can't start **embedded GNOME screencast recorder** in **F17**. I tried to start it using `Shift`+`Ctrl`+`Alt`+`R` but nothing happened (I can't see any red icon and there isn't any file in my video folder). Could you help me how can I fix it?


Does `Segmentation fault` message come under STDERR?

I ran an executable in `bash`               ./code > log      It shows occasional error messages on terminal whereas all printf statements go into log file. I re-run it like below               ./code >& log      Now, the occasional error messages also go into log. But if there is a segmentation fault, it is still shown on terminal. Why? How to make the message `Segmentation fault (core dumped)` go into the log file? * * * user$ bash --version GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)


Unable to create logical partition with Parted

I was fiddling around with `parted` command on a loopback disk and tried to create some partitions using gpt part table but I keep getting `Error: Unable to satisfy all constraints on the partition.` when trying to create a logical partition               $ sudo parted /dev/loop0     (parted) mktable gpt     (parted) mkpart primary 1MiB 201MiB     (parted) mkpart extended 201MiB -0MiB     (parted) unit MiB print     Model: Loopback device (loop)     Disk /dev/loop0: 102400MiB     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start    End        Size       File system  Name      Flags      1      1.00MiB  201MiB     200MiB                  primary      2      201MiB   102400MiB  102199MiB               extended          (parted) mkpart logical 202MiB 1024MiB     Error: Unable to satisfy all constraints on the partition.      Recreating the same partitions using msdos part table doesn't give such error, though. So any idea what's wrong?               % sudo parted /dev/loop0     GNU Parted 2.3     Using /dev/loop0     Welcome to GNU Parted! Type 'help' to view a list of commands.     (parted) mktable msdos                                                         (parted) mkpart primary 1MiB 201MiB     (parted) mkpart extended 201MiB -0MiB                                        (parted) mkpart logical 202MiB 1024MiB                                      (parted) unit MiB print                                                        Model: Loopback device (loop)     Disk /dev/loop0: 102400MiB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start    End        Size       Type      File system  Flags      1      1.00MiB  201MiB     200MiB     primary      2      201MiB   102400MiB  102199MiB  extended               lba      5      202MiB   1024MiB    822MiB     logical


CUPS error log contains "No such interface `org.freedesktop.ColorManager'"

On my Ubuntu 13.04 laptop, CUPS writes this message into `/var/log/cups/error_log` for each printer on restart:               W [25/Jun/2013:10:00:26 +0100] AddProfile failed: org.freedesktop.DBus.Error.UnknownMethod:No such interface `org.freedesktop.ColorManager' on object at path /org/freedesktop/ColorManager/devices/cups_Brother_HL_2150N_series      I'm not having any problems printing, but I'd like to know why the message appears and what I can do about it. Ideally I'd like to fix the problem without blindly installing drivers and packages; I want to understand precisely why the message appears.


Connecting a wireless webcam and wireless dongle

I must create a wireless connection between a USB wireless dongle (DLink wireless-N USB Mini Adapter DWA-140) and a wireless webcam (DLink DCS-932L). I.e. point to point connection without Internet. I have to use Linux without a GUI (only commands). What do I need to do, to get this to work?


How to copy rows of different files and paste column-wise?

I want to create a new file by copying rows of each file and pasting columnwise according to their file name orders. Here is the sample input and required output files below. file1.txt               1234     5678     9201140      file2.txt               abcged     ghigk     lmn      required output file out.tx               1234     abcged     5678     ghigk     9201140     lmn


Measure hard-disk read(), write() speed without caching in QNX 6.5

I am working on QNX 6.5 Operating system. QNX 6.5 supports POSIX APIs. I am trying to build an application which is used to evaluate performance of hard- disks. My application will read/write/read after write a user defined data buffer of size in kB or MB continuously to the hard-disk from start sector to end sector. The operation performed (read, write, read after write) depends on the user choice. Each time, an operation is performed, application will keep track of the time using `ClockCycles()` and also calculate the speed of each sector read/write operation. I am using `open()` call to open the device file like `/dev/hd0`. I am using `read()`, `write()` APIs to perform read/write operations. My problem is: I am not getting the correct speed of actual disk read/write. Actually the application is returning the speed of data read/write to cache often. The issue is more clear when I am trying to perform an immediate read after write operation. The speed of read operation just after a write operation is very high of the order of 1000-1200 MB/S; whereas a normal read is taking 50-60 MB/S. I am using open flags like `O_SYNC` and `O_RDWR`. I have also tried to change the flags to `O_DSYNC` and `O_RSYNC`. But I found the flags have no effect in the output of the application. There is no flag equivalent of `O_DIRECT` like in Linux. I have also tried to disable cache in hard-disk driver during bootup. Then I got read/write speed accuracy for data sizes of the order of MBs. But even then, when lower data sizes are read after an immediate write, the read speed is again very high. I have also seen some macros like `CACHE_FLUSH`, `CACHE_INVALIDATE` for use in drivers which needs DMA transfer. But I don't know how to use these macros in an application. Can anyone please help me how to bypass caching and get the speed of read/write operation to hard-disk? My hard-disk can be either formatted or unformatted. I have tested with both cases.


iCloud stuff stops working while connected to OpenVPN

I have a fairly simple OpenVPN setup on an OpenVZ VPS with Ubuntu 11.10. Client is the Viscosity client on Mac OS X 10.8.2, and after some testing, we can rule out the client as being part of the problem. Everything has been working fine except for Apple's iCloud stuff. Web surfing, email, FTP, NNTP, and Skype are all working as expected. It's ONLY the iCloud services that cease to function. If I connect to the VPN, iCloud stuff stops working. I no longer get anything in Messages, Calendar items don't get updated, and Notifications stop working. If I disconnect, the iCloud stuff all starts working. Connect again, iCloud stops working. Here's the server.conf:               status openvpn-status.log     log /var/log/openvpn.log     verb 4     port 1194     proto udp      dev tun     ca /etc/openvpn/ca.crt     cert /etc/openvpn/server.crt     key /etc/openvpn/server.key     dh /etc/openvpn/dh1024.pem     server 10.9.8.0 255.255.255.0     ifconfig-pool-persist ipp.txt     push "redirect-gateway def1"     push “dhcp-option DNS 10.9.8.1″     keepalive 10 120     duplicate-cn     cipher BF-CBC     comp-lzo     user nobody     group nogroup     persist-key     persist-tun     tun-mtu  1500     mssfix 1400      I'm using iptables in a script, and it's also fairly simplistic.               iptables -F     iptables -t nat -F     iptables -t mangle -F     iptables -A FORWARD -i tun0 -o venet0 -j ACCEPT     iptables -A FORWARD -i venet0 -o tun0 -j ACCEPT     iptables -A INPUT -p tcp --dport 22 -j ACCEPT     iptables -A INPUT -p tcp --dport 1194 -j ACCEPT     iptables -A INPUT -p udp --dport 1194 -j ACCEPT     iptables -t nat -A POSTROUTING -s 10.9.8.0/24 -j SNAT --to-source <server's public ip>     echo 1 > /proc/sys/net/ipv4/ip_forward      I tried forwarding ports as well, with no success.               iptables -A FORWARD -p tcp -d 10.9.8.0/24 --dport 5222:5230 -j ACCEPT     iptables -t nat -A PREROUTING -p tcp --dport 5222:5230 -j DNAT --to-destination 10.9.8.6      I am also sometimes behind a double-NAT situation that I have no control over.               Client -> work VPN -> my OpenVPN box -> Internet.          Client -> Airport Express -> ISP (which is doing NAT) -> my OpenVPN box -> Internet.      Those two situations are just the fact of life where I am, and I cannot change them. I do have full control over my client and the OpenVPN server. I am completely out of ideas. I have posted a similar query at the OpenVPN forums, but it hasn't posted yet and seems to be in their moderation queue still. Tried on freenode irc channels, but nobody is awake, so here I am. I have Googled _extensively_ for this, and can find nothing that is related. Help me get iCloud stuff working again! (Note: Sort of cross posted. I posted it here because of the Linux crowd that might be able to help with the particulars of iptables) EDIT: I hate to admit it, but it might possibly be the client after all. The issue does _NOT_ occur with Tunnelblick. I'm opening a dialogue with the developer on this. They've been very helpful so far, so maybe we'll find out what's going on.


Which "Processor family" to choose under "Processor type and features"?

I have recently compiled a minimal kernel for my **Intel(R) Pentium(R) Dual CPU T3400 @ 2.16GHz** , and chose **CONFIG_MCORE2 (Core 2/newer Xeon)** under "Processor type and features > Processor family" I don't know if this is related, but my laptop has **2GB** of RAM, and the resulting kernel, when compiled, limited my RAM to only **800MB**. Searching google for my CPU doesn't bring anything useful!               processor   : 0     vendor_id   : GenuineIntel     cpu family  : 6     model       : 15     model name  : Intel(R) Pentium(R) Dual  CPU  T3400  @ 2.16GHz     stepping    : 13     microcode   : 0xa3     cpu MHz     : 2166.000     cache size  : 1024 KB     physical id : 0     siblings    : 2     core id     : 0     cpu cores   : 2     apicid      : 0     initial apicid  : 0     fdiv_bug    : no     hlt_bug     : no     f00f_bug    : no     coma_bug    : no     fpu     : yes     fpu_exception   : yes     cpuid level : 10     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm dtherm     bogomips    : 4322.39     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:          processor   : 1     vendor_id   : GenuineIntel     cpu family  : 6     model       : 15     model name  : Intel(R) Pentium(R) Dual  CPU  T3400  @ 2.16GHz     stepping    : 13     microcode   : 0xa3     cpu MHz     : 2166.000     cache size  : 1024 KB     physical id : 0     siblings    : 2     core id     : 1     cpu cores   : 2     apicid      : 1     initial apicid  : 1     fdiv_bug    : no     hlt_bug     : no     f00f_bug    : no     coma_bug    : no     fpu     : yes     fpu_exception   : yes     cpuid level : 10     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm dtherm     bogomips    : 4322.39     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:


Space Problems?

I just got a new SD card for my pi. Trying to install node.js, I ran out of space (I've also recently installed a LAMP server system). But, when I plug it into my main (Windows-Ubuntu dual-boot) computer, windows says it's only half full. What's going on here?


Version of OpenVPN for Linux kernel 2.4.21 & having iOS client

I have the following requirements:   1. Have OpenVPN version that works with iOS client   2. The OpenVPN version should also be able to be compiled with and work on Linux kernel 2.4.21 (due to business reasons I am not allowed to upgrade). I have looked through the help and documentation but can't find any input on this. Will older OpenVPN versions that work on Linux kernel 2.4.21 (CentOS 3) be compatible with the iOS client?


How to disable all animations?

I'm using LXDE with Openbox.I hate that animations slow down work. How to disable all animations completely?


How to link different (incompatible) libraries at runtime depending on program?

I have a number of legacy codes that need to be compiled with specific (and often conflicting) libraries. To be specific I have a program which can only be compiled with `g77` and another program which can only be compiled with `gfortran`. Let's call the first program makee and the second program UVES_popler. When compiling (and running) they both need to be linked to the version of pgplot that is compiled with the respective compiler. So, compiling makee with g77 needs to run with pgplot that has been compiled by `g77` as well. And the same, respectively for UVES_popler and `gfortran`. Let's assume that I can compile pgplot with both g77 and gfortran -- what is the best practice for organizing my bashrc? Should I create a bash function for each program and have the proper links and `LD_LIBRARY_PATH`s? Something like:               runmakee() {       export LD_LIBRARY_PATH=/path/to/g77-pgplot/       makee     }      And (probably relatedly) is there a way of setting flags in Makefiles so that the proper libraries are called when compiling these programs respectively?


Why cannot a user change group ownership of his own files?

Why cannot a user change the group permissions of files which he owns. Let's suppose I have user `martin`:               $ ls -lAd /home/martin/     drwx------ 8 martin martin 4096 Apr 20 01:06 /home/martin/      For some reason, I want user `paul` to be able to access my home.               $ chgrp paul /home/martin/     chgrp: changing group of `/home/martin/': Operation not permitted      Is there a security reason why a user cannot change the group ownership of his own files? I am using Debian 7 (wheezy).


Another package being selected instead of what I am trying

I am trying to install dhcp3-server,but it is instead selecting isc-dhcp- server and its not working as per my expectations. Please help.                Reading package lists... Done      Building dependency tree             Reading state information... Done      Note, selecting 'isc-dhcp-server' instead of 'dhcp3-server'      I am following How To Set Up A DHCP Server For Your LAN on the HowtoForge site. There is nothing like dhcp3 in /etc/init.d


Bluetooth (A2DP) Audio input device

I use my Ubuntu (13.10) laptop as an A2DP (Bluetooth audio) sink for my Android phones. The music I play on my phones is sent to the laptop and is heard through laptop speakers. Now I'm trying to setup my laptop as a streaming server. I installed Icecast2 and Darkice. In the Darkice conf file, I configured audio input device as: default, pulse, hw:0,0, plughw:0,0 etc. In all cases, Darkice streams laptop microphone audio only and it does not stream Bluetooth PCM audio. When I muted the microphone in the Unity sound applet, Darkice streams only silence. To stream Bluetooth audio what device I should put in the Darkice conf file?


SimpleScreenRecorder, Two Inputs

I need to be able to allow SimpleScreenRecorder to record two sections of my screen/external sources without much post-production editing. Is that possible?


In the usage string of my custom shell script, shall I also display --help and --version?

I'm currently developing a shell script, called `up`, which shows a usage string on the commandline when called with `\--help`. The output looks like this:               $ up --help     usage: up [-n levels][--help][--versions][basename]...      This looks okay but I'm wondering if I actually need to show the `\--help` and `\--version` options because they are a widely accepted standard and only seem to add noise to the usage string.


KVM guest as default gateway for bridged network

I currently have two vm's both on kvm (virt-manager), both running on separate virtual interfaces (`virbr0` and `virbr1`). The IP of `virbr0` is 192.168.122.0; the IP of `virbr1` is 192.168.123.0. Both VMs can talk to each other. I am trying to make all traffic go through the VM on `virbr0` (122.0) before going to `virbr1` (123.0) from the host machine. Deleting the routing table for 123.0 and adding a new entry with the 122.0 VM as a gateway does not work, and the VMs lose connection after the route is deleted. Any ideas how the traffic can be forwarded to 122.0 before hitting 123.0?


Extract bookmarks from a pdf and add them to another in gs?

I have two pdf files, one with bookmarks, and the other without. I would like the second pdf file to have the same bookmarks as the first. I wonder how to do that using `gs`? Ideally, it will be nice to first extract the bookmarks from the first pdf file into a text file (which is editable if I can learn its format), and then add the text file as bookmarks to the second pdf file. Thanks! p.s.: I know how to add bookmarks in `pdfmarks` format to a pdf file by `gs`, from http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/               gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in-*.pdf pdfmarks      But I don't know how to extract bookmarks from a pdf directly into `pdfmarks` format. p.s.: In case you may wonder what bookmarks are, they are table of contents which can be shown in a side panel of a pdf reader (such as Evince (note: in Evince bookmarks are called index)), and when you click one bookmark, it will take you to the page.


impossible to make fsck

I'm trying to make a fsck to a pendrive and it says me:               e2fsck 1.42.8 (20-Jun-2013)     Pass 1: Checking inodes, blocks, and sizes     Error reading block 40402759450689 (Invalid argument).  Ignore error? yes          Force rewrite? yes          Error writing block 40402759450689 (Invalid argument) while getting next inode from scan.  Ignore error? yes          Error storing directory block information (inode=16489, block=0, num=62814697): Memory allocation failed     e2fsck: aborted      Could you help me please to fix the pendrive. Is very important for me. Thanks


how to setarch for each bash session

I am using bash as my default shell. I don't have root access. But I would like to customize my bash by setarch. So the question is how to do this automatically? Currently, I have to manually run "setarch ... /bin/bash" when I want to use thecustomized bash. Is there a way that this setarch is always automatically done for all my bash sessions?


How do I Nohup an interactive shell-script?

My Script is having 2 command-line arguments and then just couple of questions, after these questions the script will run for itself, I'm able to pass the command-line argument by just doing,               -bash-3.2$ nohup ./Script.sh 21 7     nohup: appending output to `nohup.out'          -bash-3.2$      Anyway to add the answers of these to-be-asked-questions with nohup?


where does lspci gather its information from?

In kernel.org's documentation on `proc` I found "[ _The latest version of this documentis available online_". There I says: "… `lspci` _is a synonym for_ `cat /proc/pci`". Which isn't the case here, on a Crunchbang 10 system (Debian based). No such directory. I do get the basic idea and, as far as I know, the content of `proc` is (mainly) created during runtime. (Wrong?). This made me curious: **Question** : Where does `lspci` gather it's information from? And where is this documented? (Where did I miss something?)    Another difference I found: In kernel.org's documentation, under " _Table 1-5: Kernel info in_ `/proc`" > `pci`     Deprecated info of PCI bus (new way -> `/proc/bus/pci/`, decoupled > by `lspci)


Linux recommendation for old laptop

I want to install Linux on my old laptop from 2006 February. Primarily I want to use it for lightweight coding and browsing the internet. Software needed: **python**   **some web design tools** (i have some in mind)   **dropbox** It's specs are: **Notebook:** Acer Aspire 5003WLMi   **RAM:** 1GB   **Processor:** AMD Turion 64 ML-32   **Graphics Adapter:** SIS Mirage 2 M760 128 MB   **Display:** 15.4 inch, 16:10, 1280x800 pixels I just took the Linux Distribution Chooser quiz and its recommendations are OpenSuse and Fedora. Linux Mint was in the additional recommendation. I was hoping that Lubuntu / ArchLinux would show up as I read that these are minimal distributions; please correct me if I am wrong about this. One thing I definitely want is to install whatever software as and when I need and not get a lot of software preinstalled. Please suggest your recommendations.


BackTrack5 R2 video driver works, but presents disturbing error message

I've installed backtrack 5 R2 on my computer and everything works fine but the video driver. The solution described here does work, but whenever I start the graphics mode, a message saying that the graphics card doesn't support the configuration that is loaded. I don't know why this is happening. It doesn't change the performance of my computer, but I'd like to know why the message is arising, and what I can do to stop it. Alternatively, where can I find the configuration file that would help me understand what's going on?


Linux in a mostly Windows dev environment

A little background: our shop has traditionally run a Microsoft software stack but now we're planning to use embedded Linux and I find myself in the role of Columbus: conquer the new world. I mention this because it means I lack the context to interpret what you may think is a simple answer. If you can explain things with comparison to how Windows works this will greatly aid comprehension. If I've understood the idea of X-Windows correctly, an application is an X client and the windowing APIs send/receive UI messages to an X-server via a TCP socket (sends window drawing commands to the X-server and receives mouse and keyboard activity messages from it). As I understand it, use of sockets means that the app code can run on one Unix box while the UI runs on an X-server executing on (eg) any of   * the same computer   * another Unix box running X-server on the same network   * a Windows box 'W' running X-server on the same network   * any box running an X-server anywhere on the internet provided firewalls and routing are appropriately configured to allow the required sockets. On my desk I have a Linux Mint13 host using the Cinnamon desktop and named _ForwardUntoDawn_. It is connected to my 192.168.174 network as 35, and my Win7 is on the same network as 11. They can ping each other, and SAMBA allows file sharing between them. I have installed telnetd and sshd on ForwardUntoDawn and I can establish from Win7 telnet and ssh sessions, and authenticate to obtain a command line. On my Win7 system I have Xming installed with Xming and Xlaunch desktop icons. Running Xlaunch I answer the prompts thus:   * Multiple Windows / display 0   * Start program: gimp Using SSH (C:\Cygwin\bin\SSH.exe)   * Clipboard yes, no font server or params This momentarily results in a black command window but it vanishes before I can read the message. Can anyone guide me on next steps, or more appropriate responses to the needs of Xming? (I chose gimp only because I know it's installed and working.) Note that to use the answer below also read the comments and NOTE you must start your the cygwin xserver using cygwin\bin\startxwin.exe in order to get it to work, I imagine this initialises a few environment variables. * * * I didn't end up using Xming. After I got the ssh settings set right on the Linux box and succeeded in using the Cygwin tools, I had another go using Xming. Applications launched using Xlaunch would start but then abruptly disappear. The problem did not occur using strictly Cygwin tools.


How do I reinstall the bioperl modules on Ubuntu?

I am trying to learn bioinformatics the hard way. I have no background in Linux, Ubuntu, bash, Perl, Python, etc. I'm trying to use several programs, mostly the bioperl modules, that have been installed and used on this machine before. It seems that older versions function but the newer ones don't. Specifically, it's the NCBI standalone blast group of programs. I can use `blastall`, but not `blastn`, `fastacmd`, or `blastdbcmd` even though those modules are present and show up as executable. The error I get is `no such file or dir`. How do I uninstall this group of modules and then reinstall them? Or is there some other reason why they would not be found? I did try to run them from within the directory where they are located.


Why setsebool for httpd not working with -P parameter?

I'm trying to disable SELinux for httpd, but when I use the the `setsebool` command with -P parameter, it doesn't work:               setsebool -P http_can_network_connect 1      **Nothing happens** _when I do that ie, the command is apparently running, but returns nothing, and bash is freeze. I'll wait for 10~30 minutes, and nothing happens._ Why?


Where can I find hplip debug documentation?

I need to monitor HP printer state (ink, paper, etc). Hplip has hp-info tool with debug-mode and very verbose output. But I can't find any documentation with explanation of its data. For example:               hp-info[31896]: debug: printer_status=1     hp-info[31896]: debug: device_status=2     hp-info[31896]: debug: cover_status=4     hp-info[31896]: debug: detected_error_state=64 (0x40)     hp-info[31896]: debug: Printer status=1000


Why does the "which" command give duplicate results?

`which -a ruby` gives me               /usr/ruby     /usr/ruby     /usr/ruby      It gives the same path three times. Why does this happen?


Linux via Buildroot doesn't include alsa-utils

After following these instructions from here and from here, my booted Linux does not include ALSA-Utils like "aplay". But I have set all ALSA options. Any idea what's wrong? I also found this but I can't imagine that code refactoring will suddenly include these ALSA-Utils.


Batch Convert .mp4 to .avi with ffmpeg

Running Ubuntu 13.10 with a fully compiled `ffmpeg`. I know the code for the actual conversion is `ffmpeg -i video.mp4 -codec copy video.avi` I just need a plain and simple Bash script to do that for, say, forty or fifty of the `.mp4` files.


How to insert a 'string+ file name' in the file text in commnad line bash shell?

I am working on a problem, As part of that I have got some 30,000 files with some content in it. What I want is that I want `name:filename` inside the file text, but since I have got so many files, it is not practical for me to go through each file and do it manually. Is there any way I can do it using shell?               $ cat file1     text1,text2      What I want is this:               $ cat file1     text1,text2     name:file1      I have written this code,               for i in `ls`; do echo $i >> $i; done;      What this is doing is that it is adding the file name as a string at the end, Is there any way I can add `name:filename`, instead of just `filename`.


How to start a GUI program with PHP from website

My firm has some Ubuntu 12.04 running where there is no display attached and that are behind different firewalls. The visitor on local websites on that servers should be able to start a GUI program like `Teamviewer` there to give graphical access to me (or other support admins). I guess I have to give the PHP user www-data somehow sudo access to start the Teamviewer GUI in a virtual X-Session via `gksu`. How would I have to configure `sudoers` to achieve this? And how could I call that from within a PHP-script, that is running on that server? Sure, I for myself could easily login via ssh or pipe the X-session to my machine, but I need such a Teamviewer-login because this is the easiest way to get past that differing firewalls on all servers.


What's the correct value to base the maximum number of CPU's to sched_setaffinity to?

I have some confusion as to what's the correct value to use for the number of CPU's I can use to make a `CPU_SET` for a `sched_setaffinity` call on my system. My `/proc/cpuinfo` file:               processor   : 0     vendor_id   : GenuineIntel     cpu family  : 6     model       : 37     model name  : Intel(R) Core(TM) i5 CPU       M 460  @ 2.53GHz     stepping    : 5     microcode   : 0x2     cpu MHz     : 1199.000     cache size  : 3072 KB     physical id : 0     siblings    : 4     core id     : 0     cpu cores   : 2     apicid      : 0     initial apicid  : 0     fdiv_bug    : no     f00f_bug    : no     coma_bug    : no     fpu     : yes     fpu_exception   : yes     cpuid level : 11     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt lahf_lm ida arat dtherm tpr_shadow vnmi flexpriority ept vpid     bogomips    : 5056.34     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:          processor   : 1     vendor_id   : GenuineIntel     cpu family  : 6     model       : 37     model name  : Intel(R) Core(TM) i5 CPU       M 460  @ 2.53GHz     stepping    : 5     microcode   : 0x2     cpu MHz     : 1199.000     cache size  : 3072 KB     physical id : 0     siblings    : 4     core id     : 0     cpu cores   : 2     apicid      : 1     initial apicid  : 1     fdiv_bug    : no     f00f_bug    : no     coma_bug    : no     fpu     : yes     fpu_exception   : yes     cpuid level : 11     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt lahf_lm ida arat dtherm tpr_shadow vnmi flexpriority ept vpid     bogomips    : 5056.34     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:          processor   : 2     vendor_id   : GenuineIntel     cpu family  : 6     model       : 37     model name  : Intel(R) Core(TM) i5 CPU       M 460  @ 2.53GHz     stepping    : 5     microcode   : 0x2     cpu MHz     : 1199.000     cache size  : 3072 KB     physical id : 0     siblings    : 4     core id     : 2     cpu cores   : 2     apicid      : 4     initial apicid  : 4     fdiv_bug    : no     f00f_bug    : no     coma_bug    : no     fpu     : yes     fpu_exception   : yes     cpuid level : 11     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt lahf_lm ida arat dtherm tpr_shadow vnmi flexpriority ept vpid     bogomips    : 5056.34     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:          processor   : 3     vendor_id   : GenuineIntel     cpu family  : 6     model       : 37     model name  : Intel(R) Core(TM) i5 CPU       M 460  @ 2.53GHz     stepping    : 5     microcode   : 0x2     cpu MHz     : 1199.000     cache size  : 3072 KB     physical id : 0     siblings    : 4     core id     : 2     cpu cores   : 2     apicid      : 5     initial apicid  : 5     fdiv_bug    : no     f00f_bug    : no     coma_bug    : no     fpu     : yes     fpu_exception   : yes     cpuid level : 11     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt lahf_lm ida arat dtherm tpr_shadow vnmi flexpriority ept vpid     bogomips    : 5056.34     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:      In this file there are `processor` lines numbered 0-3, for "physical" processors (4 processors total). I can get this value from `sysconf(_SC_NPROCESSORS_ONLN)` but, there is also a line for `cpu cores` and each processor has 2. I believe this represents the "logical" processors or hyperthreading that is accounted for. Should I be using only the "physical" value or can I use the "logical" count? I'm not clear on this because if I go to `/proc/PID/status` theres the line `Cpus_allowed_list` and that can range from 0-7 (8 processors total) but, I also wrote a script to call `taskset -c -p PID` for every "PID" running and this shows every process of having an affinity list of 0-3 max.


EOF blocks my script?

I have this script (it is actually a snippet from a bigger script).               #!/bin/sh           if [ $actualsize -ge $MAXSIZE ]; then       read dummy FILEPOINT <<EOF       `dd if=myfile skip=8001 count=1 bs=1|od -x`       EOF      fi      When I run it, I get               ./bugged.sh: 9: Syntax error: end of file unexpected (expecting "fi")      Apparently, the problem is the "EOF". Why does this happen and how can I achieve the same result (reading from myfile)?


Systemd: keep forked process alive when service is stopped

I have a systemd service which forks some child processes. In one scenario I start a shell script which is supposed to stop the service which actually started the script. When I call `systemd stop xxx.service`, systemd will kill all processes in the service's cgroup, which also includes the shell script. Is there any way to stop systemd from doing so? I need the script to survive systemd's stopping attempts.


Do spellcheckers exist that are aware of Markdown?

I would like to run a spellchecker over my articles before I publish them. I think `aspell` is ok, but it should not try to check code blocks:               asdfasdfa adsfa sdfa text to check adsfasd f          ```     a wild code block appeared!     thisHas quiteOften() some strings.that should NOT get changed     ```          and also `inlined code` should not get checked      **Do command line based spellcheckers exist for Linux that are aware of Markdown and hence ignore code blocks?** I need to be able to run this in batch mode for multiple files. (Bonus points if you know one that really understands LaTeX - no, `aspell -t` does not completely work)


fg a bg process because you forgot to redirect output to /dev/null

I did `Ctrl`+`Z` `bg` with the intention of disowning next, but I forgot to redirect, now I cant get to my terminal because the scrolling of the output (tarballed a huge directory with verbose set). How do I get a prompt when `STDOUT` from `tar` is filling the screen and I already sent it to the background? I am using Bash 4.


How can I print only certain commands from a bash script as they are run?

I have a bash script with various if statements based on command line arguments I pass in when calling it. Having some kind of output as to what commands are being run is helpful to confirm the flow through all those if statements, but my current solution is giving me _too much_ information. Using `set -v` in the script was somewhat helpful to see commands printed to the screen as they were run in the script, however I get _too_ many commands. It's almost like an entire copy of the script. I want output that shows what commands are being run, but I don't want to see comments, new lines, expressions in if statements, etc. Is there a way I can pass all possible output generated by the -v option through a regex first before being printed? Or some other solution to get bash to only output commands of a certain "type" (e.g. that are using executables and not just bash specific statements, comments etc.?) [1] http://stackoverflow.com/questions/257616/sudo-changes-path-why was quite helpful on this and is where I got the suggestion for the `set -v` usage. **Edit** : A similar (but not identical) script to the one I'm running:               #!/bin/bash          #get verbose command output     set -v          env=$1          if [ "$env" == "dev" ]; then         python ascript.py     fi          if [ "$env" == "prod" ]; then              #launching in prod will most likely fail if not run as root. Warn user if not running as root.         if [ $EUID -ne 0 ]; then             echo "It doesn't look like you're running me as root. This probably won't work. Press any key to continue." > /dev/stderr             read input         fi              #"stop" any existing nginx processes         pkill -f nginx              nginx -c `pwd`/conf/artfndr_nginx.conf          fi      I want only 2 possible sets of output lines from this script. The first:               python ascript.py      The second:               pkill -f nginx     nginx -c /some/current/directory/conf/artfndr_nginx.conf


How to get the Job ID?

As we know, the shell enables the user to run background processes using `&` at the command line's end. Each background process is identified by a job ID and, of course, by it's PID. When I'm executing a new job, the output is something like `[1] 1234` (the second number is the process ID). Trying to invoke commands like `stop 1` and `stop %1` causes a failure message: `stop: Unknown job: 1` Understanding that the `stop` command causes a job to be suspended, I was wondering **how to get the job ID** and do it right. If the only way to kill a job is by it's process ID, **what is the purpose of the job ID**?


CentOS VPS - Pointing my Domain name to the VPS static IP

I am a Linux Newbie. I have a VPS with CentOS installed at my ISP and I am managing it remotely. Up to this point, I have had **shared webhosting** on a Linux machine at my ISP where I had CPANEL installed to manage my mail, ftp, mysql etc.. Now I want to move everything to my VPS: So how do I do the following:   * Install CPANEL on my VPS and access it remotely from my Web Browser?   * **Point my Domain name to my VPN static IP address?**   * Mail server to point to my static IP? Do I need to setup a new Mail server on the VPS or is that managed by CPANEL?   * **Do I need to install a DNS server on my VPS or how does it work? (relates to point nr 2)**


How to change extension of all files in a directory?

There are some extensionless files in current directory (there are not dot in their names). I want to rename like so:               filename -> filename.md      I tried doing `mv * *.md` but that didn't help. I am interested in a function that takes an argument for the extension and renames accordingly, and the another one for the files to perform operation on.


Multiple source directories in duply

Is it possible to specify multiple source directories in a `duply` configuration file? If not is there any simple workaround?


I am having trouble with a problem my buddy game me

SCRIPTING PROBLEM: Command Output Parser Write a script/program to parse the output of the command 'cat test_file.txt' (see linked file) The program should: Create a new file for every server. The file should be named with the server id which is the second field in the "INSTANCE" line. The first line of the file should be the state of the server, identified as the 6th field of the "INSTANCE" line. E.G., running/stopped/etc The remaining lines of the file should be the block device ids, identified by an id of the form qqa-, and the device name. An example line looks like: "qqa-3748959 /dev/sda" The device lines should be sorted in order of the device name (/dev/sda, etc) Bonus: Place the resulting files in directories named for the server type. The type is identified by the last field of the "TAG" line of "Type". In all cases: fields should be selected by column number rather than the id. For example, rather than searching for patterns that match "pj-" you should select the 2nd field of the line that starts with "INSTANCE" Example result based on the first 9 lines of the test file: File name: random_type/pj-10005128 Contents: running qqa-10014158 /dev/sda1 qqa-10002120 /dev/sdj1 qqa-10017806 /dev/sdj2 I honestly have no idea where to start.... any help would be greatly appreciated Here is the contents of the test file RESERVATION lk-10010440 440052211244 security_group,web_security_group INSTANCE pj-10005128 ike-10018425 29-148-165-208.cloud.com 80-224-178-164.cloud.com running random_value 0 random_string 2012-01-01T20:19:08+0000 random_string wie10031896 random_string 109.216.210.228 108.41.193.144 random_string paravirtual xen wq-10021186, wq-10027543, wq-10008697 security_group BLOCKDEVICE /dev/sda1 qqa-10014158 2012-01-01T20:19:43.000Z   BLOCKDEVICE /dev/sdj2 qqa-10017806 2012-01-01T20:19:43.000Z   BLOCKDEVICE /dev/sdj1 qqa-10002120 2012-02-11T18:35:15.000Z   TAG instance pj-10005128 Hostname random_string TAG instance pj-10005128 Name random_name_1 TAG instance pj-10005128 Group random_group TAG instance pj-10005128 Type random_type RESERVATION lk-10006589 440052211244 security_group,db_security_group INSTANCE pj-10007400 ike-10011775 202-248-49-29.cloud.com 201-12-133-81.cloud.com stopped 0 random_string 2013-01-25T05:59:43+0000 random_string wie10031896 random_string 231.253.4.61 231.253.4.61 random_string paravirtual xen wq-10009238, wq-10030026 security_group BLOCKDEVICE /dev/sda1 qqa-10020213 2013-01-25T05:59:53.000Z   BLOCKDEVICE /dev/sdj1 qqa-10011314 2013-01-25T05:59:53.000Z   BLOCKDEVICE /dev/sdj4 qqa-10020951 2013-01-25T05:59:53.000Z   BLOCKDEVICE /dev/sdj5 qqa-10004943 2013-01-25T05:59:53.000Z   BLOCKDEVICE /dev/sdj2 qqa-10018777 2013-01-25T05:59:53.000Z   BLOCKDEVICE /dev/sdj6 qqa-10000981 2013-01-25T05:59:53.000Z   BLOCKDEVICE /dev/sdj3 qqa-10028084 2013-01-25T05:59:53.000Z   TAG instance pj-10007400 Type database TAG instance pj-10007400 Name random_name_2 TAG instance pj-10007400 Group random_group RESERVATION lk-10014417 440052211244 security_group,db_security_group INSTANCE pj-10003176 ike-10011775 8-1-1-240.cloud.com 18-34-199-53.cloud.com running 0 random_string 2013-01-25T06:00:02+0000 random_string wie10031896 random_string 140.17.3.221 32.70.176.162 random_string paravirtual xen wq-10009238, wq-10030026 security_group BLOCKDEVICE /dev/sda1 qqa-10001321 2013-01-25T06:00:10.000Z   BLOCKDEVICE /dev/sdj1 qqa-10025849 2013-01-25T06:00:10.000Z   BLOCKDEVICE /dev/sdj4 qqa-10017095 2013-01-25T06:00:10.000Z   BLOCKDEVICE /dev/sdj2 qqa-10009948 2013-01-25T06:00:10.000Z   BLOCKDEVICE /dev/sdj6 qqa-10024491 2013-01-25T06:00:10.000Z   BLOCKDEVICE /dev/sdj3 qqa-10000218 2013-01-25T06:00:10.000Z   BLOCKDEVICE /dev/sdj5 qqa-10020627 2013-01-25T06:00:10.000Z   TAG instance pj-10003176 Name random_name_3 TAG instance pj-10003176 Type database TAG instance pj-10003176 Group random_group RESERVATION lk-10032059 440052211244 security_group,db_security_group INSTANCE pj-10020884 ike-10011775 141-49-20-42.cloud.com 110-204-10-172.cloud.com running 0 random_string 2013-01-25T06:00:20+0000 random_string wie10031896 random_string 149.114.49.142 85.142.179.141 random_string paravirtual xen wq-10009238, wq-10030026 security_group BLOCKDEVICE /dev/sda1 qqa-10002751 2013-01-25T06:00:29.000Z   BLOCKDEVICE /dev/sdj6 qqa-10009034 2013-01-25T06:00:29.000Z   BLOCKDEVICE /dev/sdj4 qqa-10030713 2013-01-25T06:00:29.000Z   BLOCKDEVICE /dev/sdj2 qqa-10018148 2013-01-25T06:00:29.000Z   BLOCKDEVICE /dev/sdj1 qqa-10003453 2013-01-25T06:00:29.000Z   TAG instance pj-10020884 Group random_group TAG instance pj-10020884 Name random_name_4 TAG instance pj-10020884 Type database RESERVATION lk-10020585 440052211244 security_group,web_security_group INSTANCE pj-10021471 ike-10005313 8-252-63-249.cloud.com 147-48-132-111.cloud.com pending 0 random_string 2013-02-16T04:56:40+0000 random_string wie10031896 random_string 230.91.172.39 238.209.51.80 random_string paravirtual xen 2572f0d9-fb51-4dcf-9576-482c928a8088_random_string_1 wq-10009238, wq-10028180 security_group BLOCKDEVICE /dev/sda1 qqa-10023749 2013-02-16T04:56:44.000Z   BLOCKDEVICE /dev/sdg qqa-10023749 2013-02-16T04:56:44.000Z   TAG instance pj-10021471 as autoscale TAG instance pj-10021471 Type app TAG instance pj-10021471 Group random_group TAG instance pj-10021471 Name random_name_A RESERVATION lk-10028120 440052211244 security_group,web_security_group INSTANCE pj-10013308 ike-10005313 142-69-27-121.cloud.com 216-130-112-163.cloud.com running 0 random_string 2013-02-16T04:56:40+0000 random_string wie10031896 random_string 0.245.135.206 241.13.160.138 random_string paravirtual xen 2572f0d9-fb51-4dcf-9576-482c928a8088_random_string_1 wq-10009238, wq-10008340 security_group BLOCKDEVICE /dev/sda1 qqa-10013748 2013-02-16T04:56:44.000Z   BLOCKDEVICE /dev/sdg qqa-10015384 2013-02-16T04:56:44.000Z   TAG instance pj-10013308 Name random_name_A TAG instance pj-10013308 Type app TAG instance pj-10013308 as autoscale TAG instance pj-10013308 Group random_group RESERVATION lk-10032084 440052211244 security_group,web_security_group INSTANCE pj-10011525 ike-10005313 49-63-205-3.cloud.com 214-182-99-155.cloud.com running 0 random_string 2013-02-16T04:56:41+0000 random_string wie10031896 random_string 108.204.74.51 108.204.74.51 random_string paravirtual xen 2572f0d9-fb51-4dcf-9576-482c928a8088_random_string_1 wq-10009238, wq-10008340 security_group BLOCKDEVICE /dev/sda1 qqa-10027627 2013-02-16T04:56:45.000Z   BLOCKDEVICE /dev/sdg qqa-10027627 2013-02-16T04:56:45.000Z   TAG instance pj-10011525 Group random_group TAG instance pj-10011525 as autoscale TAG instance pj-10011525 Type app TAG instance pj-10011525 Name random_name_A RESERVATION lk-10028680 440052211244 security_group,web_security_group INSTANCE pj-10026620 ike-10005313 39-55-202-95.cloud.com 14-132-191-42.cloud.com running 0 random_string 2013-02-16T05:25:50+0000 random_string wie10031896 random_string 64.121.47.214 9.102.77.198 random_string paravirtual xen cc24eea7-68fc-4aa8-b20e-2d15aed83291_random_string_1 wq-10009238, wq-10008340 security_group BLOCKDEVICE /dev/sda1 qqa-10009950 2013-02-16T05:25:57.000Z   BLOCKDEVICE /dev/sdg qqa-10009950 2013-02-16T05:25:57.000Z   TAG instance pj-10026620 as autoscale TAG instance pj-10026620 Name random_name_A TAG instance pj-10026620 Group random_group TAG instance pj-10026620 Type app


How to open multiple LUKS volumes with key entered in initramfs?

I have a Debian 7.4 (stable) based server configured to use an encrypted (RAID1 + LVM) root partition (/boot is un-encrypted regular partition) to which I installed dropbear SSH server so I can remotely enter the LUKS encryption passphrase. In addition to the root partition/volume I have other RAID1+cryptsetup+LVM volumes that I would like to be able to open with the same passphrase. I googled and found out I can use the script /lib/cryptsetup/scripts/decrypt_keyctl to cache passphrases and open multiple volumes with the same passphrase. But how do I use this script with the passphrase entered in initramfs stage?


Behavior of rsyslog writing to a pipe

I configure `rsyslog` with an additional entry, like this:               *.* |/var/log/logpipes/pipe1      and have my own evaluation program for the messages received. This works so far, but I am unsure, how `rsyslog` behaves if my pipe reader crashes. Would this block all other logging activities as well? I have logfiles too and plan to use `rsyslog-pgsql` and I cannot see, if `rsyslog` works with multiple threads, so, if one of them hangs [pipe reader hangs], if these other logging threads will continue.


Kernel module parameters vs /sys/class/... explanation

I was making (my first) kernel module to play with the gpio pins of my pandaboard and interrupts. Already "built-in", I noticed you can do (briefly)               cd /sys/class/gpio     echo 138 > export  # a file gpio138 appears         echo out > gpio138/direction     echo 1 > gpio138/value      to turn some voltage high or low on connector pins. Similarly on a kernel module you have module parameters and you can do `echo 3 > /sys/module/my_module/parameters/delay_seconds` for instance My questions :   1. What handles /sys/class/gpio ? A kernel module ? a driver ?   2. Whatever 1. is, is it possible to have more complicated module parameters in a kernel module, with some directory structure ? Like a 'delays' directory containing the params for delays, ... `/sys/module/my_module/parameters/delays/delay_led1_seconds`   3. Can you have the parameters somewhere else than in the path /sys/module/my_module/parameters/... ? (/sys/class/a_name/... for instance)   4. How does the gpio thing creates new/deletes files in /sys/class/gpio when you write to `[un]export` ?


Solaris/OpenIndiana: Password for roles?

I've been gently experimenting with `roles` in Solaris, and wonder a bit about setting a `password` for it. I want the role I've created to be used by several users, so setting password to the same as one user (as is done for the root-role) is not an option. Having several users "sharing" (knowing) a single password, I've heard is a bad idea - that is after all the rational behind `sudo`. So for now, I've set a blank password (just "Enter"). I did this not by leaving the field in `/etc/shadow` blank nor by setting it to "NP"... I did it by using `passwd` to set it to nothing (pressed "Enter" twice) - and the resulting encrypted entry was surprisingly long and garbeled. **So my first question; is it safe to leave a`role` with blank ("Enter") as password?** After all, only logged-in users with that role can assume it... **A few more questions:** Is there some way in the role-specification to specify that a user should authenticate with his own password - rather than the role's - to switch to the role (without changing the role's password to that of the user, as I assume is done with the root-role)? If not, are there other ways (eg. by using `sudo` - maybe in combination with `su`? If so, how?) to accomplish this? How is the `root`-role bound to the password of the "first user"? Is it some field in the role-specification that makes it happen automatically? What happens behind the scenes to make it happen?


ipset not executing from crontab

I have this txt files that contains IPs, one per line of file, that I want to block using ipset. I have this bash script that essentially reads from the plain txt file and constructs an array. Then it iterates the array elements and add each one to the ipset I have created for that purpose. The problem is this: if I execute the script manually from the terminal, it works perfectly, but when I add the script to run periodically using crontab, the script runs but the IPs are not added to the ipset. This is the relevant part of the script.               index=0     while true; do       ipset -quiet -A myIpset $[arrayOfIPS[$index]}       index=$[$index + 1]       if [ "$index" -gt "$lastIndexOfArray" ];       then break       fi      done      This works perfectly from terminal but not running from a crontab task. why?


Terminate every background process

I have a few `Stopped` background processes. `kill $(jobs -p)` and `kill `jobs -p`` have no effect `kill %1`, `kill %2`, etc. successfully terminate individual processes How can I kill every background process with one command? Also, why do the first two commands not work for me? I'm running Linux Mint 15, 64 bit


Using if statement with or to validate arguments for shell script

I'm working on a bash script to restart multiple apache instances in different environments. It's working fine except I'd like to add some logic to ensure only correct arguments are entered. I've tried the below statement in multiple ways, but I'm not having any luck. Any suggestions?               if [[ $ENVT != qa || $ENVT != qa2 || $ENVT != stageqa || $ENVT != stage ]];       then         usage     fi      It's when I use the stage environment it's evaluating the first option and invoking the function instead of iterating through as seen with set -x turned on. Full script can be seen at pastebin.               + ENVT=stage     + ACTION=stop     + USER=www     + '[' 2 -ne 2 ']'     + [[ stage != qa ]]     + usage


How can I use global variable arrays in aliases or functions

I am attempting to simplify repetitive work procedures. In doing so, I am trying to write a .bashrc script which will set global path variables that aliases can refer to. Disclaimer: I'm new to linux and scripting in general so I don't know if the approach I've taken to this point is correct. Here is what I've written so far.               SET_DIR=/var/www/          #Set the current site's root directory     function sroot (){         SET_DIR=/var/www/$1         setaliases         echo $SET_DIR     }          #Reinitialize aliases with new sroot     function setaliases(){         alias chk="echo $SET_DIR"         alias rt="cd $SET_DIR"         alias thm="cd $SET_DIR/sites/all/themes/"         alias mod="cd $SET_DIR/sites/all/modules"     }          setaliases      What I would like to do is expand this Idea to define sites in an array or a file. Then use a function that will check the value passed to the sroot function. This will in turn set variables in other functions.               #myfile or array     site=example1.com     theme=alpha     shortcut=x1           site=example2.com     theme=beta     shortcut=x2      So for example "sroot x1" would affect               SET_DIR=/var/www/$site     # and     alias thm="cd $SET_DIR/sites/all/themes/$theme"      How do I configure the function to check for a value in an array then use it's variables?


Deciding on a font, and determining the proper notation

I have an X11 program that allows you to set a font. It apparently accepts the 'standard' X Logical Font Description. This notation is fairly obscure, and while the document I linked to mentions it, it doesn't actually describe the syntax. Is there some kind of font picking tool that will provide a list of valid fonts, and allow me to picket a font from the list, and specify the sizes and such, then print out this notation? > X Logical Font Description X11 core font instances are usually specified > using a notation known as the X Logical Font Description (XLFD). An XLFD > starts with a dash `-', and consists of fourteen fields separated by dashes, > for example: > > -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1


Problem when connect to pptp vnc build on opensuse13.1

I have built a pptpd vnc server under opensuse13.1, everything looks fine when I running the pptp service. but there is problems when I connect from both android & winxp client:   1. by winxp at first i can connect to vpn but canot ping any site, it shows time out. I tried to google and uncheck 'use default gateway on remote network' which in vpn network tcp/ip properties advanced page. now the vpn network works fine.   2. by android well, android can connect but canot browser any url. and unfortunatwly i canot find similar settings as winxp. i am pretty sure that vpn server not works fine. can anyone help me here? thanks a lot.


Run script as root under Busybox?

I have written a shell script that has to be run as root under Busybox. My first thought was to add the script to /etc/busybox.conf like this:               /sbin/my_script.sh = ssx root.root      But this only works with the Busybox apps. How can I allow the script to be run with root permissions when executed by a normal user?


How does Ubuntu 14.04 achieve persistent eth* interfaces?

Trying to upgrade `udev` to 197+ on my LFS system, I've come across a problem that old persistent network interface names scheme is no longer supported. Before trying to go on with the new suggested scheme I wondered how it's done in Ubuntu, and launched its LiveCD in QEMU with two NICs. I've discovered that the interfaces are still `eth0` and `eth1`, not anything like `enp3s0` which would be under new scheme. Looking further, I noticed that there's still `/etc/udev/rules.d/70-persistent-net.rules` file which seems to be the same as for pre-197 `udev`. What does this mean? Does Ubuntu somehow work around the issue and still implement renaming inside eth-namespace? Or does it hack the `udev` to regain support for this? Or have I misunderstood something?


How to calculate average requests per seconds using awk or sed on Apache logs

I am trying to calculate the average requests per seconds for a specific period of time of my Apache logs. I have been able to narrow the results down to the period I am interested in, as well as calculating the requests per second, but I am not able to calculate the average. Here is what I have so far: `paste "/var/log/apache2/access.log" "/var/log/apache2/access.log.1" | awk ' $4>"[10/Feb/2013:16:48:00" && $4<"[10/Feb/2013:17:15:00" {gsub(/\\[/,"");print $4} ' | sort | uniq -c` Could anyone steer me in the right direction? I have mentioned sed or awk but I am happy to use something else. Cheers


Delete all 'nohup.out' within a directory recursively

How can I delete all 'nohup.out' files within a directory recursively from my terminal? I'm using CentOS.


TT-Connect CT2-4650 CI doesn't initialize (Timeout?)

I've tried to get a Techno Trend TT-connect CT2-4650 CI running under a Kali Linux, where I suppose the kernel is about the same as on a current Debian. The compilation ran just fine. The kernel module got loaded with no problems, but when I connect the device to my virtualbox I get the following messages in dmesg:               [  223.081774] usb 1-1: New USB device found, idVendor=0b48, idProduct=3012     [  223.081780] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3     [  223.081785] usb 1-1: Product: TechnoTrend USB2.0     [  223.081789] usb 1-1: Manufacturer: CityCom GmbH     [  223.081792] usb 1-1: SerialNumber: 20130422     [  223.335895] WARNING: You are using an experimental version of the media stack.     [  223.335895]  As the driver is backported to an older kernel, it doesn't offer     [  223.335895]  enough quality for its usage in production.     [  223.335895]  Use it with care.     [  223.335895] Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):     [  223.335895]  a32f7d1ad3744914273c6907204c2ab3b5d496a0 Merge branch 'v4l_for_linus' into staging/for_v3.9     [  223.335895]  6b9e50c463efc5c361496ae6a895cc966ff8025b [media] stv090x: On STV0903 do not set registers of the second path     [  223.335895]  f67102c49a123b32a4469b28407feb52b37144f5 [media] mb86a20s: remove global BER/PER counters if per-layer counters vanish     [  223.354451] WARNING: You are using an experimental version of the media stack.     [  223.354451]  As the driver is backported to an older kernel, it doesn't offer     [  223.354451]  enough quality for its usage in production.     [  223.354451]  Use it with care.     [  223.354451] Latest git patches (needed if you report a bug to linux-media@vger.kernel.org):     [  223.354451]  a32f7d1ad3744914273c6907204c2ab3b5d496a0 Merge branch 'v4l_for_linus' into staging/for_v3.9     [  223.354451]  6b9e50c463efc5c361496ae6a895cc966ff8025b [media] stv090x: On STV0903 do not set registers of the second path     [  223.354451]  f67102c49a123b32a4469b28407feb52b37144f5 [media] mb86a20s: remove global BER/PER counters if per-layer counters vanish     [  223.395840] usbcore: registered new interface driver dvb_usb_ttv2     [  223.396104] usb 1-1: dvb_usb_v2: found a 'TT-connect CT2-4650 CI' in warm state     [  223.396137] usb 1-1: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer     [  223.396158] DVB: registering new adapter (TT-connect CT2-4650 CI)     [  223.428521] tt_usb MAC address=bc:ea:2b:65:02:d4     [  223.428529] usb 1-1: dvb_usb_v2: MAC address: bc:ea:2b:65:02:d4     [  223.430036] tt_usb: tt_4650_attach, build on Jan 14 2014 09:46:32()     [  223.653935] usb 1-1: DVB: registering adapter 0 frontend 0 (Sit2 DVB-T2/C)...     [  225.716341] usb 1-1: dvb_usb_v2: 2nd usb_bulk_msg() failed=-110     [  227.836363] usb 1-1: dvb_usb_v2: 2nd usb_bulk_msg() failed=-110     [  227.892198] tt_usb: tt_ci_init()     [  229.908294] usb 1-1: dvb_usb_v2: 2nd usb_bulk_msg() failed=-110     [  229.908318] tt_usb: tt_ci_write_i2c: error, Reg=[0x00], Status=-110     [  231.908252] usb 1-1: dvb_usb_v2: usb_bulk_msg() failed=-110     [  231.908260] tt_usb: tt_ci_write_i2c: error, Reg=[0x1f], Status=-110     [  233.908325] usb 1-1: dvb_usb_v2: usb_bulk_msg() failed=-110     [  233.908332] tt_usb: tt_ci_write_i2c: error, Reg=[0x18], Status=-110     [  233.908337] usb 1-1: dvb_usb_v2: 'TT-connect CT2-4650 CI' error while loading driver (-1)     [  233.909530] usb 1-1: dvb_usb_v2: 'TT-connect CT2-4650 CI' successfully deinitialized and disconnected      110 seems to be a Timeout issue, I can't quite see why though. Any ideas are greatly appreciated.


Can't start vsftpd on Fedora

I have installed vsftpd on my new Eee pc with Fedora 18:               sudo yum install vsftpd      How is it? :               systemctl is-active vsftpd.service      and got               failed      Then               systemctl status vsftpd.service      got               Failed to start Vsftpd demon     Unit vsftpd.service entered failed state      What is the best way to start repairing vsftpd?


Is Firefox for Linux generally unstable?

Started using Firefox in the early days and have used it as main browser for a long time. Under Windows, where I used it a lot until approximately 2011, I generally seldom had problems with it. Crashes was far and long apart. Perhaps once every 6-7 months. Now, – under Linux, where I have been more active the last years it has steadily been extremely unstable. It is by far the most unstable software, size (as in market etc.) and impact pulling up a lot, I have ever used. It has not been on only one computer, but 3 - 4. I have also done extensive memory and HDD tests over the years on all machines. * * * _**My question:_** Is this the normal for Linux? (I have mainly been on Debian and derivatives.) Is there a common cause for the problems causing crashes (thinking codebase and design) – or is it all over the place? Are the changes, over the years, in website design (a lot more scripts and content mashups) a factor? * * * As an example here are some of the times of crashes over the last months:               06/16/2013 09:50 PM     06/12/2013 04:31 AM     06/10/2013 09:28 AM     06/08/2013 06:02 AM     06/06/2013 02:28 AM     06/02/2013 11:51 AM          05/31/2013 04:42 PM     05/22/2013 08:16 PM     05/18/2013 12:39 PM     05/14/2013 03:40 AM     05/12/2013 03:14 AM     05/04/2013 03:50 PM     05/02/2013 09:14 PM     05/01/2013 04:17 PM          04/30/2013 03:44 AM     04/29/2013 08:56 AM     04/26/2013 07:23 PM     04/26/2013 07:56 AM     04/23/2013 07:34 PM     04/18/2013 11:12 PM     04/08/2013 10:06 PM     04/03/2013 11:23 PM      * * * Edit: This is native FF. (Not Iceweasel). I also keeps add-ons, plugins and tweaks to a minimum. Mainly dictionaries. Used to use Web Developer Toolbar and Firebug, but with the now built-in tools I have no need. I instead uses some custom profiles with plugins on demand like tampering with requests etc.


Creating partition from a start point till the end of the disk using parted

This is my partition table :               Model: ATA Hitachi HTS54757 (scsi)     Disk /dev/sda: 750GB     Sector size (logical/physical): 512B/4096B     Partition Table: gpt     Disk Flags:           Number  Start   End     Size    File system  Name                  Flags      1      17.4kB  134MB   134MB                Mi                    msftres      2      135MB   86.2GB  86.1GB  ntfs         Ba      3      86.2GB  86.5GB  315MB   ntfs         Ba                    hidden      4      86.5GB  86.6GB  105MB   fat16        EFI System Partition  boot      5      86.6GB  86.8GB  210MB   fat16      9      86.8GB  129GB   42.6GB                                     lvm      6      129GB   236GB   107GB   ntfs      7      236GB   343GB   107GB   ntfs      I want to create a last partition till the end of the disk to be like this :               8      343GB   750GB   407GB   ntfs      How to achieve this in case if i didn't know where to stop, i want to till parted that i want to make a partition from `343GB` till the end of the disk, how to do so ? I'm using parted 3.1


Apache throws 403 Forbidden after moving DocumentRoot (CentOS 6.4)

I installed Apache via yum on CentOS 6.4. I changed the `DocumentRoot` in `/etc/httpd/conf/httpd.conf` to point to `/home/djc/www`:               DocumentRoot "/home/djc/www"     <Directory "/home/djc/www">         Options Indexes FollowSymLinks         AllowOverride None         Order allow,deny         Allow from all     </Directory>      FS permissions:               djc@vm ~ $ ls -l     drwxrwxr-x.  3 djc djc   4096 Jan 14 11:17 www      No SELinux:               djc@vm ~ $ sestatus     SELinux status:                 disabled      What am I missing?


Is there a way to renice the network stack?

I have an ARM Linux board that is a router to 16 other boards. When all these download their updates via the router, the network routing effort starves the user space so that a software watchdog (and later on the hardware watchdog) triggers at the router. Is there a way to renice routing efforts without packet drops? I am aware that I could run the application with 'above normal' priority but that would have other unwanted side effects. I also have tried traffic shaping with both ingress and token bucket filters but I don't succeed even if I throttle bandwidth usage to 1-2 mbps. If I reduce the node count to five, I can serve up to 15mbps on average, 20 peak. The hardware is too slow to reach more than 30mbps on a fast ethernet link. _Topology:_   * `eth0`: common network at every board   * `eth1`: toward FTP-gateway, only at router   * no bridging, just IP-forwarding


Configure bash to execute command with last argument when no argument was provided

I would like to configure bash so that when I execute command (preferably from a list of commands, not any command) without an argument, it takes the argument of previous command. So, for example I type `emacs ~/.bashrc`, then when I enter `source`, bash executes `source ~/.bashrc`. I know it's possible but I don't know where to look for such options.


Capturing Screenshot of terminal application via shell script?

## Problem Run `iftop` for 5 seconds, capture the screenshot and save it to a file. `iftop` is a beautiful program for visualizing network traffic, but it doesn't have a batch mode where I can run it for few seconds and capture the output to a file. ## So my idea is   * use commands like `screen` to create a virtual display and run `iftop` in it.   * look for any tools (`screendump`) to take a screen shot of the `screen`. Any idea on how do I go with this?


In Bash how does one determining the length of filename?

I'm doing a little script to rename some files. Actually a lot of files. The problem and the cool thing is, that I actually just need to change the files that have a filename length of 5 characters. I did a `$(filename:0:5)` and look if there is some leftover, but I guess that's dirty and I would appreciate to know the real or scholastic way of doing this. Something like that:               if [$(filename).length() == 5]; then       reaname_file     fi


Extract only the key(s) from GPG exported keypair

I have exported public and private keys to file with `gpg --export` and `\--export-secret-keys`. When I examine them with `gpg --list-packets`. I can see that the file contains:   * the actual key   * the user ID   * a signature packet How can I extract only the actual key from the file? I would like end up with a PKCS8 private key file and a _PublicKeyInfo_ (?) file that I can use programmatically.


How to log all udp packets from port N in readable format?

How to log into file all udp packets (in and out) from port `N` in readable format (capture packet type (time stamp, name of error if one happens or message type, data size, data))?


kernel 3.1x and optimus support

I have encountered a negative observation regarding bumblebee. Namely, using optirun the performance of the GPU seems to be an order of magnitude lower than it should be. To be more specific: I have a laptop with GTX660M, I have (or had, up until yesterday) a bumblebee installation with kernel 3.7.16 running (OS: openSUSE 12.3) where bumblebee was working fine. But after comparing the runtime of my code on the laptop (GTX660M) with an older card (GTX 560) in my desktop PC I have determined the runtime difference to be about 10x - very bad! After reading up, that the linux kernel 3.12+ comes with support for optimus Graphics I thought of changing to it and did just that. That wrecked pretty much everything. Threads like this do not really help. (especially b/c I'm having trouble applying Arch info to opensuse) So here's the core question: Does GPU switching work with kernel 3.12+ and which packets are required? Furthermore, does GPGPU work then and what is the performance?


What is the easiest way to clone an embedded linux SD Card?

I have a 8 GB SD Card (card 1) installed with embedded linux for Power PC, libraries and some applications. I want to prepare another 8GB SD Card (card 2) exactly like card 1. What is the easiest way to do this? I tried copying all the files from card 1 to a linux laptop and then from the laptop to card 2 but I am getting some permission denied errors in spite to doing this in root. Is my approach correct? Please suggest any other techniques.


Why does boot from SD card with my custom kernel result in "VFS: Cannot open root device"?

I'm using an embedded board ARM9 SAM9G25. I want to boot from SD card. When I build a linux kernel with a built-in rootfs (initramfs) then it boots. I want to separate the kernel from rootfs and I generated a rootfs.squashfs. The kernel command line is:               console=ttyAT0,115200 root=/dev/mmcblk0 ro rootfstype=squashfs      When I then boot my system the following kernel panic occurs: > VFS: Cannot open root device "mmcblk0" or unknown-block(0,0) Please append a > correct "root=" boot option; here are the available partitions: Kernel panic > - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ### Regression I believe that partitioning doesn't lead to the solution, since booting with the same settings but with an initramfs is possible. When booting with the initramfs image `$ ls /dev` doesn't list `mmcblk` or `sdb`.               $ dmesg     mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 timing 0     atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots      mmc_host mmc0: card is not present      mmc1: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 timing 0      atmel_mci atmel_mci.1: Atmel MCI controller at 0xf000c000 irq 26, 1 slots     mmc_host mmc1: card is not present      (Yes the card is in the slot ;) So what I think happens now is, that U-Boot can read the SD device but the kernel doesn't. Since an initramfs is bootable, a single kernel can be loaded too but the rootfs, opened from kernel, cannot be found. In `make linux menuconfig` I already enabled > Device Drivers > >   * <*> MMC/SD/SDIO card support > >   *     * <*> MMC block device driver >   *     * <*> MMC host test driver >   *     * <*> Atmel SD/MMC Driver (Atmel Multimedia Card Interface support) >   *     * [ * ] Atmel MCI DMA support (Exp.) >   *     * Secure Digital Host Controller Interface support > but still with this setting it seems that he's not able to use the SD device. I'm a bit clueless at this point, can someone give me a hint?


Equivalent of the Solaris "df -t" command on Linux?

The `df -t` command on Linux does not display the number of files like it does on Solaris. Is there any equivalent command on Linux? My script is like this               for i in /opt/aa /opt/aa/data /opt/aa/bb; do echo -n "$i "; df -t $i | awk ' { if ( NR==1) F=$(NF-1) ; if ( NR==2) print $(NF-1) - F }'; done      Output :               /opt/aa 397375     /opt/aa/data 24134317     /opt/aa/bb/oracle 529      I can see number of files in respective file systems I would need similar command for linux, this above command is working fine with solaris ?


print command not found

From the korn shell, I keep getting print command not found. When I run print from the shell, it says the same thing. How would I go about fixing this? printf works fine, but for some reason print is not. This is redhat 5.5 and the ksh is 3.2.25-release. Thanks


What's the difference between these two dd commands?

What's the difference between two `dd` commands that have different `bs` and `count` values, as long as they multiply to the same? For example:   1. `dd if=/dev/random of=aa bs=1G count=2`   2. `dd if=/dev/random of=aa bs=2G count=1`


How can I communicate with a Unix domain socket via the shell on Debian Squeeze?

I’m running a Debian Squeeze web server. I’ve installed memcached on it, and configured memcached to listen on a Unix domain socket (at `/tmp/memcached.sock`), as it only needs to receive messages from the website, which lives on the same server. It seems to be working fine, but I’d also like to communicate with memcached via the shell, to check that it’s doing what I think it’s doing. memcached accepts messages via a simple ASCII protocol (if I understand correctly). If it was listening on TCP/IP, I could send messages to it via e.g. `nc`:               $ echo "stats settings" | nc localhost 11211      But I can’t figure out how to send that text to the domain socket instead. On my laptop (which runs OS X Lion), both `nc` and `telnet` have options (`-U` and `-u` respectively) to use domain sockets. However, on my Debian Squeeze web server, these options aren’t present.


What are the main differences between Unix and Linux kernels today?

I know that many of the same programs run flawlessly on top of both kernels. I know that historically, the two kernels came from different origins. I know philosophically too that they stood for different things. My question is, today, in 2011, what makes a Unix kernel different from a Linux one, and vice versa?


GRUB splashimage

I am using leagcy GRUB (0.97) on a system running linux kernel 2.6.31. I am using a GRUB splash image from /boot/grub/menu.lst. I see that the splashimage goes away once the GRUB menu selection is made and the INIT process starts. Is there a way that I can continue to display this image when INIT begins to run? EDIT: I cant use fbsplash or plymouth since these dont compile with legacy kernels. Appreciate any help and thanks in advance


Sort images by aspect ratio

I am trying to select a few art images to fit some new frames. I would like to be able to sort these images by proximity to a particular aspect ratio and then view them in decreasing order of proximity through something like feh. Is there some glorious one-line Unix expression? Otherwise a few dozen lines of Python should clear this up.


Using a laptop as a bridge between Internet and LAN for SSH connections.

We have a lan and a server running HPUX that isn't connected to the Internet. I have a server and a laptop on the same network. When I plug in the laptop via ethernet cable, its Internet connection drops, despite already being connected via wifi to a network with Internet access. From the laptop, I can only SSH to the server using its internal IP address.( 192.168...) What I wonder is, can I connect to the server from somewhere else in the world via the laptop? How can I make the laptop act as a bridge between the Internet and the LAN? How would I then access the server?


MIT Shared Memory Extension or MIT-SHM over ssh

I successfully created a `privileged lxc archlinux container` on an archlinux host with lxc. I set up a static ip via dnsmasq and ssh into it and I use `xauth` to forward `X11`. I then call programs like `mupdf` or plot functions from programming languages such as `R` or `Matlab`. While this all works fine I constantly see error messages printed to the console when I open a `*.pdf` file with `mupdf`:                    ximage: disabling shared memory extension: BadAccess (attempt to access private resource denied)      Two short questions about this:   1. What exactly does this error message mean?   2. How can this error be solved (or is it safe to ignore)?


Collapse line vertically so that every word is on a new line

Given a string like: `"Hello World, how are you today?"` Is there a way in Vim to collapse this line vertically such that every word appears on a new line, i.e.:                   "Hello         World,         how         are         you         today?"      I had something similar in mind like executing `Ctrl`-`V` + `Ctrl`-`g``q` which wraps lines relative to a fixed width which can be set in `.vimrc`.


Is shebang always the same as the interpreter's installation directory?

Must the shebang header always match the interpreter's installation directory? If so, then why do both `#!/usr/bin/python` and `#!/usr/local/bin/python` work for me?


set umask (permissions) similarly as setgid on a directory

I know how to use `setgid` on directories, to enforce that whole directory structure has uniform `user:group` ownership. Is there a similar way to set the `umask` for a directory, so that the whole directory structure "inherits" specific permissions (i.e. `750/640`)?


Pausing rsync via bash script?

Is there a way to pause rsync via command line, if it transfers data for over X minutes? I'm working on using it as a backup and would like it to pause every once in a while to prevent the hard disks from overheating or network throttling. I am currently using a Windows batch file to start a Linux bash script via cygwin to do this.


Difference between .tar.gz.asc, git.tar.bz2 and .tar.bz2

I have a Mac running OSX 10.9.1 and I want to install Gerris and its dependencies. In the last lines of the page I have to install ffmpeg. But there are lots of releases of ffmpeg. Which one I should choose?


How to find files that contain newline in filename?

I am trying to find files that have a newline in the filename. But I can't figure out what pattern to use. The following works, but is not very useful if I want to use it in indented code.               find . -name '*     *'      I tried these two and they only succeeded in finding filenames that contained the letter _n_ :               find . -name '*\n*'     find . -name "*\n*"      Then I found how to write backslash escape sequences and tried this:               find . -name "*$'\n'*"      But that doesn't find anything. How should I write the pattern?


ssh script asks for password

a little ssh issue here. I set up some keys in ssh between 2 machines and I can login via ssh without password in terminal. I am trying to write a shell script that sends commands to the remote server through ssh. When i run the script it always asks for the ssh password before performing the commands. How can I make it so the ssh login in the script is passwordless like it is through terminal? in the script it's like ssh user@remoteMachine 'do some stuff' the same command in terminal works perfectly fine. (edit) verbose flag differences script:               debug1: Next authentication method: publickey     debug1: Offering RSA public key: /home/remote/.ssh/id_rsa     debug1: Authentications that can continue: publickey,password     debug1: Trying private key: /home/remote/.ssh/id_dsa     debug1: Trying private key: /home/remote/.ssh/id_ecdsa     debug1: Next authentication method: password     user@192.168.1.4's password:       terminal               debug1: Next authentication method: publickey     debug1: Offering RSA public key: /home/remote/.ssh/id_rsa     debug1: Server accepts key: pkalg ssh-rsa blen 279     debug1: read PEM private key done: type RSA     debug1: Authentication succeeded (publickey).     Authenticated to 192.168.1.4 ([192.168.1.4]:22).     debug1: channel 0: new [client-session]     debug1: Requesting no-more-sessions@openssh.com     debug1: Entering interactive session.     debug1: Sending environment.     debug1: Sending env LANG = en_GB.UTF-8     Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic i686)      the script is just               #/usr/bin/bash          ssh user@192.168.1.4 'touch ~/test'      I am making the script executable and calling it with               ./script


not able to access raspberry pi webcam server from chrome and ie9

I am trying to use my raspberry pi as a webcam server(using motion library). After tweaking I found this tutorial and implemented the same. I am able to access the webcam data using firefox. from Chrome and IE I am not getting. Can anyone tell me how to do this?


Installing vpnc on CentOS

I'm currently attempting to establish a vpn connection, but I am unable to install a vpn client. I assumed installation would be as simple as `sudo yum install vpnc`, but CentOS is unable to find the vpnc package. I browsed some more, and discovered I needed to install and enable the rpmforge repository for yum to find the package. I downloaded the rpmforge- release-0.5.2-2.el6.rf.x86_64.rpm and installed successfully. However, when I run my original yum command, I am still unable to find the package. Is there a different repository I need to add in order to locate the vpnc packages for CentOS 6.3?


How to set unbuffered IO in `screen`?

I use `screen` as a `minicom` replacement, but the only problem is I don't get all output immediately, because of buffering. Is there a way to turn off buffering for `screen`?


Copying emacs content through terminal app's clipboard copies unexpected tabs for some spaces

I'm using terminal.app on OS X, and when typing in emacs I often want to copy the text and paste it into some other program. When I do, I find that copied text has some spaces unexpectedly replaced by tabs. I assume I'm copying the text that emacs has sent to the terminal which I suppose doesn't have to match the actual document, but what's the right way to do this?


Grep_color on mac

I am trying to get my regex highlighted on mac using terminal. I have put this is my `.profile`:               export GREP_COLOR='1;30;40'      Nothing changes, so I added the same to my `bash.profile` still nothing, restarted the machine nothing. When I am:               egrep --color=auto ".*\W blah blah "      then it lights up some yellow color but I wondered if I had done something wrong in my `.profile` or `bash_profile`. Any help would be good: snow leopard, with just plain old terminal :-)


A tool that helps me to be sensible on permissions?

Is there a tool or understandable source (manual, webpage, ...) in existence that helps a moderate* user to be more sensible about user permissions? In my ideal-dream-world I'd have a CLI tool that lets you scan your system or a directory to find security loopholes and gives you a sensible, readable feedback on how one could improve one's security. I mean " _security_ " in the online generation's way: how to keep my machine (which is running arch btw) from being infiltrated by a virus, a worm, ... I'm not bothered by "my little brother will ruin my system" and tangent problems. Does this kind of tool exist? _Jeesh: I sound like a windows user here: being paranoid about security and all. I just switched from mac - where I've never had any security problems - to linux. Although I know security is pretty baked in to unix with the concept permissions, I do feel a bit exposed because I'm not quite sure how much the safety my mac offered me was part of Mac in stead of unix. There must be some exploits a malicous party can use on the linux, no?_ *a moderate user is a person that knows how to use the CLI (in fact I prefer to use the CLI) etcetera, but isn't the typ of person to compile his own version linux.


Solaris 11: How to use ILB to create HA loadbalancer across two backend servers?

I'm attempting to use Solaris 11's ILB to create a loadbalancer across two backend DNS servers. Here's my requirements: Two external IPs: .XXX.YYY, .XXX.ZZZ - these are the DNS IP's that our clients hit Two ILB boxes in a HA configuration over those two external IPs Two backend DNS servers I'd like to have the two ILB boxes (ilb1 and ilb2) each load balance across the two DNS servers (ns1 and ns2) on two different incoming IPs. I'd like ilb1 to be primary on .XXX.YYY and secondary on .XXX.ZZZ, and ilb to be the inverse of this. This way, if either of the DNS servers or the ILB servers goes down, DNS requests should continue unimpacted. However, we can't go Full NAT on this due to our requirements that the backend servers have to be able to see the actual SRC_IP of the DNS request - going full NAT makes it look to the DNS servers that all requests are coming from the ILB boxes, not the clients themselves. Going HALF-NAT will correctly maintain the SRC_IP of the DNS request, however that means that the packet now has to be routed through the ILB box that it was requested from, so that the correct IP is on the packet when it gets to the client, otherwise the client will throw it out ("response from unexpected source" and the like). Here's the sticky issue - since there are two IPs, how do I reliably route the request back through the correct ILB box? /etc/defaultrouter on the DNS boxes only lets you use 1 IP, so roughly half of our responses would be trashed. Is this setup possible? Is my description clear as mud?


PHP exec expect script with SCP then SSH

I have a PHP page which runs the following expect script to upload a file to another server on my network:               #!/usr/bin/expect -f          set password [lindex $argv 0]          spawn /usr/bin/scp /home/Dave/bin/test root@192.168.1.1:/etc/test          expect {         -re ".*yes.*no.*" {             exp_send "yes\r"             exp_continue         }         -re ".*password.*" {             exp_send "$password\r"         }     }          expect eof      Before I do this however I need to backup the existing file on the server:               cp /etc/test /etc/test.bak      And after I upload the file I need to restart the service that reads the file:               /etc/init.d/testservice restart      It seems rather silly to SSH to the server three separate times. How can I do this all at once? Is there a PHP function that will take care of some or all of this for me? Edit: Prompting the user for a password is a requirement.


Switch between runlevel with init command in bash script … init 3 to init 5

I need your help with bash script that I’m trying to build. To keep things simple I will make it short: The script starts running once it’s gets to run level 5 so i copied the script to /etc/rc.d/rc5.d/S99fix And it should look like this:               init 3          # Do some stuff…          init 5          rm –rf /etc/rc.d/rc5.d/S99fix      The problem is that when I reboot the machine and it gets to runlevel 5 it starts the script by running the init 3 command but there it ends… I’m killing my own script before its time. the Do some stuff, init 5, rm -rf doesn't run. Is there a way I can do what I want to do and still switch between runlevels without killing my script while doing so? Just to add some details to this question...   * I'm using SLES 11.2   * i'm installing and configuring nvidia drivers so doing stuff in runlevel 3 is required.   * This research started as a way to do stuff to the X server while in runlevel 3 and bring it back to runlevel 5. I presume there is an option just to stop and start the xdm service. But now I've become interested to understand if switching between runlevel 3 and 5 is possible in bash script.


What does @ mean in the hostname part of a .rhosts file in Solaris?

What does               +@foo_hosts username      mean in a user's `.rhosts` file? I presume it is defining a group of hosts in some way, but I can't figure out where to look for the definition of `@foo_hosts`. I found the name `foo_hosts` mentioned in the output of `ypcat netgroup.byhost` but not in a way that seems to associate it with any list of hosts. `uname` reports `SunOS 5.8`


Udev rule- change group

I would like to change group of `/dev/nvidia0`. I was write udev rule: `KERNEL="nvidia[0-9]", GROUP="video", MODE="0666"` But it does't change group, after reboot file is in `root`group. How do this?