How to pass string (not file) to openssl?

I want to encrypt a bunch of strings using openssl. How do I pass plaintext in console to openssl (instead of specifying input file which has plaintext). openssl man page has only these two options related to input/output:               -in <file>     input file     -out <file>    output file      Here is what I have tried so far: This works fine,               openssl aes-256-cbc -a -K 00000000000000000000000000000000 -iv 00000000000000000000000000000000 -in plain.txt -out encrypted.txt      If I omit the -out parameter I get encrypted string in console,               openssl aes-256-cbc -a -K 00000000000000000000000000000000 -iv 00000000000000000000000000000000 -in plain.txt      But If I omit both -in and -out, I get an error - unknown option 'Encrypt ME',               openssl aes-256-cbc -a -K 00000000000000000000000000000000 -iv 00000000000000000000000000000000 "Encrypt ME"


How to log out of su and another user

So when I am logged in as a standard user in an ssh session and then su to root, how can I log out of both accounts with a single command? Rather than:               root@host:/exit     user@host:/exit      something like:               root@host:/magicallyLogEveryoneOut -bladow


What is Linux for SET FILE/ERASE_ON_DELETE?

In VMS one may tell the file system to write junk over the existing contents of a file when it is deleted. Here is the DCL command to identify the file for this kind of treatment:                $ SET FILE/ERASE_ON_DELETE SAMPLE.TXT      This allows the policy to be set at one point in time then later users of the file do not have to handle that detail of security. A standard delete which takes the file name out of the directory and frees the space for another file to use will also modify the existing contents to prevent the next user from reading it. The normal delete:               $ DELETE SAMPLE.TXT.*      What is Linux for this?


Why is ntpd listening on most of 192.168.1.X/192.168.2.X

I'm using the `ntp` package in debian squeeze and the ntpd process is listening on hundreds of rfc1918 addresses that are not configured on the server. Check this out: > Mar 26 10:07:24 server ntpd[14701]: ntpd 4.2.6p2@1.2194-o Sun Oct 17 > 13:45:13 UTC 2010 (1)   >  Mar 26 10:07:24 server ntpd[14702]: proto: precision = 0.986 usec   >  Mar 26 10:07:24 server ntpd[14702]: Listen and drop on 0 v4wildcard 0.0.0.0 > UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen and drop on 1 v6wildcard :: UDP > 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 2 lo 127.0.0.1 UDP > 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 3 eth0 > 66.xxx.xxx.xxx UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 4 eth0 192.168.1.1 > UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 5 eth0 192.168.1.2 > UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 6 eth0 192.168.1.3 > UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 7 eth0 192.168.1.4 > UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 8 eth0 192.168.1.5 > UDP 123   >  ...   >  ...   >  ...   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 499 eth0 > 192.168.2.240 UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 500 eth0 > 192.168.2.241 UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 501 eth0 > 192.168.2.242 UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 502 eth0 > 192.168.2.243 UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 503 eth0 > 192.168.2.244 UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 504 tun0 10.13.37.1 > UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 505 tun1 10.13.42.2 > UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 506 lo ::1 UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 507 eth0 > 2600:xxxx::xxxx UDP 123   >  Mar 26 10:07:24 server ntpd[14702]: Listen normally on 508 eth0 fe80::xxxx > UDP 123 My configuration file: > driftfile /var/lib/ntp/ntp.drift   >  statistics loopstats peerstats clockstats   >  filegen loopstats file loopstats type day enable   >  filegen peerstats file peerstats type day enable   >  filegen clockstats file clockstats type day enable   >  server 0.debian.pool.ntp.org iburst   >  server 1.debian.pool.ntp.org iburst   >  server 2.debian.pool.ntp.org iburst   >  server 3.debian.pool.ntp.org iburst   >  restrict -4 default kod notrap nomodify nopeer noquery   >  restrict -6 default kod notrap nomodify nopeer noquery   >  restrict 127.0.0.1   >  restrict ::1 `ifconfig eth0`: > eth0 Link encap:Ethernet HWaddr f2:xx:xx:xx:xx:xx   >  inet addr:66.xxx.xxx.xxx Bcast:66.xxx.xxx.xxx Mask:255.255.255.0   >  inet6 addr: 2600:xxxx::xxxx/64 Scope:Global   >  inet6 addr: fe80::xxxx/64 Scope:Link   >  UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1   >  RX packets:69898198 errors:0 dropped:0 overruns:0 frame:0   >  TX packets:55539406 errors:0 dropped:0 overruns:0 carrier:0   >  collisions:0 txqueuelen:1000   >  RX bytes:25263193357 (23.5 GiB) TX bytes:41787470527 (38.9 GiB)   >  Interrupt:76 Any ideas why?


Configure MC and aptitude color schemes

I'm using Ubuntu, and I'm having trouble reading text in MC and Aptitude because of the color scheme. Is there any way to change it?


How to check will my computer is going to reboot(or shutting down)?

When I send a reboot command(or shutdown) command to a Linux machine does it keeps that messages at somewhere and can I query it. I.e. I will send a reboot command and after that I will run another command to check will my computer at reboot(or shutdown) mode(because it will not reboot immediately it will take some time to reboot and I will check it)? **EDIT** Server sends one of that commands to client(my server and client coded at Java ) If I ping after I send i.e. shutdown command, maybe machine will shutdown but still alive(it will shutdown maybe after 2 seconds later.) If I can query my client did it received a shutdown(or reboot) command even it is still alive I will accept that OK it will shutdown(or reboot) If I can not get an answer to my query to client it means that it is not alive, so I will accept that it is shutted(or rebooting). How can I query my machine like that?


What prevents a machine from responding to pings?

I have a `CentOS release 5.4` linux box on Amazon EC2 that I'm trying to set up to be monitored via Nagios. The machine is in the same security group as the nagios server, but it seems to be unresponsive to pings or NRPE checks, although apparently port 22 is open. The CentOS box can ping itself using it's internal IP address, and it can ping the Nagios server, but the server can not ping the CentOS box. I know the CentOS box is using `iptables`, here are the contents of the `/etc/sysconfig/iptables` file (some ips changed for security):               # Generated by iptables-save v1.3.5 on May 16 11:28:45 2012     *filter     :INPUT DROP [0:0]     :FORWARD DROP [0:0]     :OUTPUT ACCEPT [56:6601]     -A INPUT -s 149.15.0.0/255.255.0.0 -p tcp -m tcp --dport 22 -j ACCEPT     -A INPUT -s 72.14.1.153 -p tcp -m tcp --dport 22 -j ACCEPT     -A INPUT -i lo -j ACCEPT     -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT     -A INPUT -s 184.119.28.174 -p tcp -m tcp --dport 5666 -j ACCEPT     COMMIT     # Completed on May 16 11:28:45 2012      The part that really gets me is that even after I do `/etc/init.d/iptables stop`:               Flushing firewall rules:                                   [  OK  ]     Setting chains to policy ACCEPT: filter                    [  OK  ]     Unloading iptables modules:                                [  OK  ]      I am still unable to ping the box or do NRPE checks on it. What else could be preventing `ping` or other connections? I'm not sure what else to try. Here is a list of processes found with `sudo ps -A`:               aio/0     atd     bash     cqueue/0     crond     dbus-daemon     dhclient     events/0     hald     hald-runner     init     kauditd     kblockd/0     khelper     khubd     kjournald     kmirrord     kmpathd/0     kpsmoused     kseriod     ksoftirqd/0     kswapd0     kthread     master     migration/0     mingetty     nscd     pdflush     pickup     qmgr     sshd     su     syslog-ng     udevd     watchdog/0     xenbus     xenwatch     xinetd


Linux editor with VMS EDT like direction mode

VMS editor EDT allows one to use the keypad to control most of ones editing commands. One of the rather nice features is that the direction of operation can be set to "up" or "down". This then effects commands like "move to next character" and "move to start of line". Another feature is that there are "character", "word" and "line" buffers that one can cut, copy and paste to/from. I am looking for a Linux editor that has these features? This is not a request for an EDT editor for Linux. I am "willing" to learn a new editor if it has these features.


Automate checking user submitted files

Since last few days, I'm facing some problem. It's about response to 100 users. Situation goes like this. On one end there are 100 user, each user has unique ID. User is supposed to submit one file to server/mail. At receivers end, someone has to check whether submitted file is in particular format or not. I want to automate to this process, starting from server/mailbox where some script should download submitted file, check it and store result in some output file. Can we setup some server on unix machine?can we use some mailbox to which people can send files in the form of an email? Please suggest some solution.


SOCKS proxy configuration on KDE 4.4.5 / Debian 6.0.5

I've been trying to use a SOCKS Proxy which I have been using with success from an Ubuntu 11.4 box with GNOME on my Debian box with KDE.The socks server is bound to the local port 1080 through the following ssh command:               ssh -p222 -D 1080 <my_username>@socks_server_domain_name      Following the advice I found here: http://emilsedgh.info/blog/index.php?/archives/14-SOCKS-proxy-on-KDE.html I edited my ~/.kde/share/config/kioslaverc file and now it looks like this:               jason@debian-laptop:~$ cat ~/.kde/share/config/kioslaverc     PersistentProxyConnection=true          [$Version]     socksProxy=socks://localhost:1080     update_info=kioslave.upd:kde2.2/r1,kioslave.upd:kde2.2/r2,kioslave.upd:kde2.2/r3      However, once I use System Settings->Network Settings->Proxy, I click on "Manually specify the proxy settings", but the dialog won't let me hit "apply" without prompting me to fill in information in the "setup" dialog: ![screenshot](http://i.stack.imgur.com/sOepv.png) which is not helpful at all, because there is no "SOCKS" protocol option in the "setup" dialog. I'd also like to add that, when switching to GNOME in the same box, I am able to run the SOCKS proxy by specifying "localhost" and "1080" in System->Preferences->Network Proxy, in exact the same way I did it in my Ubuntu box.


Locate postion then make a change using sed

This script uses sed to change all "" to "new stuff". How would one change just the "" after the yyy: using sed or anything else?               cat >sample.txt <<EOF     xxx:     ""     yyy:     ""     }     EOF     sed --expression='s/""/"new stuff"/' sample.txt


Migration from loop-aes to cryptsetup

I've upgraded my linux installation to kernel 2.6.38-2 (Debian testing). With the new kernel, loop-aes does not compile, so I cannot mount my encrypted volumes. I heared that it is possible to use some compatibility mode of cryptsetup to mount encrypted volumes of loop-aes, so my question is: How can I do that? I have been searching for hours with Google and couldn't find anything that worked. With loop-aes, I was mounting partitions with the following entry in /etc/fstab: /dev/sdb2 /mount/data ext4 user,noauto,loop,encryption=aes256 0 0 How would the cryptsetup command line look like? I would prefer an fstab entry, if possible, but a command line would do as well. I'm fairly desperate! Cheers, Thomas.


Why does `bash -c somecommand` sometimes not leave a bash process?

On an Ubuntu 12.04, with GNU bash, version 4.2.25(1)-release (x86_64-pc-linux- gnu), I tried the following command:               $ bash -c 'pstree -s $$'     init───sshd───sshd───sshd───bash───pstree     $ bash -c 'pstree -s $$;echo'     init───sshd───sshd───sshd───bash───bash───pstree      I think the second one is as my expectation: the first `bash` is where I executed these commands; the second `bash` is what I started with `bash -c ...`; and then the second bash will start a subprocess called `pstree`. However, I'm wondering what happened with the first one. Why the second `bash` disappeared and the `pstree` became a subprocess of the original `bash`? And why the answer for the previous question doesn't apply to the second `bash -c ...`?


How to change the target directory for tab completion?

I found a short script to enable note-taking on onethingwell, which includes this:               function n { nano ~/n/$1.txt }      I'd like to extend it to do tab completion, so that if I want to edit the pre- existing note 'foobar' (~/n/foobar.txt) I can type `foo[TAB]` and have it automatically complete to `foobar`, rather than having to type in 'foobar' every time. The problem is that bash's built-in tab completion seems to be centered around the current directory, so if I'm in a folder that isn't ~/n, then my tab completion fails -- or, worse, completes to the wrong thing, since perhaps I have a file named 'footastic' in ~/snafu/ (meaning I type `$ n foo[TAB]`, and instead of seeing `$ n foobar`, I look at my input and see: `$ n footastic`. So, after all that preamble, here's the question: if it's possible, how can I tell bash that after I type 'n', for _just this once_ I want it to assume that we're completing using the files in ~/n for completion, rather than using the files in the current directory? If you understood all that e-mumbling, congratulations, and if you can _answer_ that, thank you very much!


shebang and path

Why does a shebang need a path? **Wrong**               #!ruby      **Correct**               #!/usr/local/bin/ruby          #!/usr/bin/env ruby      The operating system should have the information regarding the path for a registered command, and why does it still expect it to be given?


Bash: Convert Multi-line output to Single line

I am getting a multi-line output as follows: Actual Output:               GenuineIntel,Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz,CPU0,64,EM64T Family 6 Model 45 Stepping 7,(null),3093,0     GenuineIntel,Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz,CPU1,64,EM64T Family 6 Model 45 Stepping 7,(null),3093,0      In Bash script, I need to convert above output to a single line, with values in one column delimited by `#` symbol, and two columns separated by a comma. Expected Output:               GenuineIntel#GenuineIntel,Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz#Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz,CPU0#CPU1 and so on.      How to do that?


How to give Root privileges for User in Centos 6.2 minimal

I installed Centos 6.2 minimal x86_64 server in Virtual Machine Manager. After installed I created Username in the server. And I added the User into a wheel group.                   # useradd testuser         # passwd testuser              # usermod -aG wheel testuser      Now my problem is, I want to give the root privileges to the User which I created. Some websites given that edit the sudoers file. But sudoers file is not under the /etc folder. Where is the Sudoers file in Centos 6.2 & How to give the Root privileges to the User.


What audit log files are created in linux to track a users activities?

One of the machines on our networks was consuming a large amount of Internet bandwidth. However no user was using the system. When I connected to the server using SSH and ran `who` it showed that a user is logged in from the an IP that I didn't recognize. I didn't create this user on the system. And in `/etc/sudoers` the user had unlimited root access:               test11   ALL = NOPASSWD: ALL      I terminated the session and changed the root password. I also deleted the user. Now I'm probably safe but need to analyze why this happened and also what activities were done by user. How do I find out more information about what was done by this user? What system log files could help me get more info about IP, duration, commands run, internet sites accessed, etc? Note: this is a default install of a CentOS 6 system. I have not installed any security or auditing software. Nor did I change any system configuration. I need to know what I can extract out of a default install.


Buildroot ignoring configuration files - building wrong kernel

I'm using Buildroot to create a Linux system for the NXP LPC3250 microcontroller. There are patches to the vanilla kernel to make it compatible with the LPC3250 controller: http://git.lpclinux.com/ I would like to build Kernel 2.6.39.2, but my Buildroot system always makes a 2.6.34 kernel! I have set the GIT repository to point to 2.6.39.2: ![enter image description here](http://i.stack.imgur.com/wgZPZ.png) You can see that I've specified a Defconfig for the system I'm building for: `ea3250` I've edited my ea3250 defconfig as well: ![enter image description here](http://i.stack.imgur.com/w7n0d.png) After doing a `make clean all` to clean everything and rebuild the system, looking inside the output kernel image shows it is still building 2.6.34: ![enter image description here](http://i.stack.imgur.com/dCsGY.png) What am I doing wrong? Is there another menu I need to configure to get it to build 2.6.39.2?


Find X.org pointer grab owner

I have an application that seems to have grabbed the mouse (I can move it but can't click anywhere), is there a way to find which app owns the X.org mouse grab? The shortcut given here to release the mouse didn't seem to work, so I'm interested in something that could give me more information.


Can the UNIX command tree display only directories matching a pattern?

I'm trying to figure out if there is a way to get the UNIX command `tree` to display only directories that match a specific pattern.               % tree -d tstdir -P '*qm*' -L 1     tstdir     |-- d1     |-- d2     |-- qm1     |-- qm2     `-- qm3          5 directories      The **man page** shows this bit about the switch. > -P pattern List only those files that match the wild-card pattern. Note: you > must use the -a option to also consider those files beginning with a dot `.' > for matching. Valid wildcard operators are`*' (any zero or more characters), > `?' (any single character),`[...]' (any single character listed between > brackets (optional - (dash) for character range may be used: ex: [A-Z]), and > `[^...]' (any single character not listed in brackets) and`|' sepa‐ rates > alternate patterns. I'm assuming that the bit about **...List only those files...** is the issue. Am I correct in my interpretation that this switch will only pattern match on files and **NOT** directories?


How do I write a sed one-liner to add a character after every third character?

So, I have a string that looks like this:               AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA      And I want to split the string into 3-character chunks delimited by a '+' sign.               AUG+GCC+AUG+GCG+CCC+AGA+ACU+GAG+AUC+AAU+AGU+ACC+CGU+AUU+AAC+GGG+UGA      And I want to do that with my good friend `sed`. I tried               cat codons | sed -r 's/([A-Z]\{3\})/\1\+/g'      ...with no success. What `sed` command can I use?


Compare three file and print the highest value

I have three files. All of them having only one column.               File1      M     0     M     A          File2      A     0     M     A          File3     M     0     A     A      compare each row in the three files, i.e, for first row (M,A,M) hence the maximum occurrence is M. The in the output file should contain M in the first row. likewise for other rows in the three files               Output file     M     0     M     A      can anybody tell the awk script for this....


Need help interpreting sendmail maillog response

I'm new using sendmail. I have sendmail set up to only transfer mail sent to "mydomain.com" to each user's personal email though none of the users are actual users of the system. I get a lot of traffic attempts showing up in /var/log/maillog from things like "309f451f1@mydomain.com" where mydomain.com is my domain. I believe that's 'backscatter'. Since there is no user by that name, it gets flagged as "User unknown" and is silently dropped and nothing happens, as far as I know. However, what bothers me the most, is every so often I get this:               Apr 11 04:21:15 www sm-mta[79055]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=     TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128     Apr 11 04:21:15 www sm-mta[79055]: STARTTLS=client, relay=alt1.gmail-smtp-in.l.google.com., ver     sion=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128     Apr 11 04:21:17 www sm-mta[79055]: STARTTLS=client, relay=alt2.gmail-smtp-in.l.google.com., ver     sion=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128     Apr 11 04:21:19 www sm-mta[79055]: STARTTLS=client, relay=alt3.gmail-smtp-in.l.google.com., ver     sion=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128     Apr 11 04:21:20 www sm-mta[79055]: STARTTLS=client, relay=alt4.gmail-smtp-in.l.google.com., ver     sion=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128     Apr 11 04:21:21 www sm-mta[79055]: s3B8TxnY078957: to=<patrick@mydomain.com>, delay=00:51     :20, xdelay=00:00:06, mailer=esmtp, pri=211323, relay=alt4.gmail-smtp-in.l.google.com. [173.194     .70.27], dsn=4.0.0, stat=Deferred: 421-4.7.0 [107.XXX.XX.XXX 15] Our system has detected a     n unusual rate of      Where patrick@mydomain.com is a real user but Patrick never gets any mail with that message in it either in his mailbox or spam mail and that last system message gets cut off like that but with our IP address of 107.etc. Googling around, that message is usually an indicator that Google is complaining about either a high rate of mail or receiving a lot of spam and, possibly, they are blocking that mail box. I once saw one message saying it would be "rate limited" but that was a week ago. However, he is receiving all his mail without issue so I'm at a loss as to what is actually happening. Perhaps I'm misinterpreting that and the message is actually being returned to the sender? I'm very concerned about getting his email address, or the site IP, blocked or blacklisted.


Get log from kernel while loading

There is a arm/omap2-based device without ethernet, UART ports. It has usb connection with host, numeric keyaboard, LCD display. There is working U-Boot and kernel images for this. I'm trying to made some little changes in linux kernel and deploy but there is some problem while kernel is loading and I can't receive any information while kernel is loading. May somebody suggest, what steps are needed to receive this information.


what does the dash `-` before `bash` on 'command not found' errors mean?

When you enter an invalid command at a bash prompt you get the message               -bash: {command}: command not found      What does the `-` at the very beginning signify?


The libblkid library: what is the 'blkid_superblocks_get_name' function for?

I'm trying to use the `libblkid` library to analyze various filesystems on a block device from a C/C++ program, and it works well. However I'm confused with the **blkid_superblocks_get_name** function from this library. The function assigns some `name`, but name of what? Also, what is the meaning of the first (input) argument `idx`? That kind of functions used to have the first argument of type `blkid_probe`.


Enabling IP forwarding at kernel compile time

I am compiling a kernel for a router. I know a way to enable IP forwarding in an existing Linux system. At compile time, `CONFIG_IP_FORWARD` is said to do the same task. I am configuring version 3.12.14 of the vanilla kernel using the GTK-based kernel configuration tool (`gconfig`). However, I can't see this option anywhere. Is there an alternate configuration option in recent kernels or am I missing something?


sed query for pattern matching

My file looks like `cat new`:               ALL          ALLOFTHEM    ALL1     OPS     BE2A    OPS1           ABE    ABE     ABE1      sed query below gives me the result as 1st line `sed -n '/\\([A-Z]\\{1,\\}\\)\1/p' new`:               ALL          ALLOFTHEM    ALL1      I guessed that 2nd line would also match as OPS is also a character length more than 1. Any ideas?


Compare two file and return a true or false value

I have two files with one column. If the first rows in the two files are same the print 1 otherwise print 0. `file1`:               M     A     A     M      `file2`:               M     M     A     A      `output`:               1     0     1     0      Can anybody tell me the awk script?


Commands inside bash not being interpreted?

I'm trying to execute a command inside a bash script, **$(pwd)** is not being interpreted at all, and not even using eval. This do not work:               cat apache-vhost.conf | sed 's/{path}/$(pwd)/g'      Neither does this:               eval cat apache-vhost.conf | sed 's/{path}/$(pwd)/g'      How can this be solved?


link count of deleted files

I am reading in `man lsof` that               +L enables the listing of file link counts. A specification of     the form "+L1" will select open files that have been unlinked.      I don't understand why deleted files should have count `1`. Should not the count for deleted files be `0` ?


How to inject data at the beginning of a child process's stdin?

TL;DR How can I fix this command line template, which fails when cat (on the client side) contends with ssh prompting for a password?               { echo some stuff; cat; } | ssh SERVER cat     { echo some stuff; cat; } | ssh SERVER ls      I'm not asking about creating public/private keys. I don't want to consume stdin in advance, since the remote command might be something which ignores its stdin (in which case, forcing the user to type ^D is a pain). I don't want the user to have to specify an option to the template to indicate whether or not the remote command will read its stdin. I want the template to work regardless of whether or not the remote command reads its stdin. * * * Details: I want to write client- and server-side wrappers for a command being run remotely via ssh. The command in question can be any command of the user's choosing. The purpose of the wrappers is to set up the environment of the command. The client-side wrapper needs to send a small amount of data to the server-side wrapper, but I don't want to send that data on the command line (I want to send it on stdin). Here's an example of how this might be called:               $ wrapper1 HOST wrapper2 sh -c "cat >file"     This data is sent to the remote side     ^D      Wrapper1 computes some data, passes it to wrapper2, which sets up the environment before execing sh. Cat reads from stdin and writes into file on the remote side. To accomplish this, I want the client-side wrapper to inject some data at the beginning of the stdin stream that is sent to the server-side wrapper. That extra data will be consumed from stdin by the server-side wrapper before the real command is run. After the injected data has been sent and consumed, I want the stdin pipeline to the remote command to be as it would have been without this data injection. The remote command may or may not bother to read anything from its stdin -- that depends on the particular command being run. Since the command being run is not known in advance, and it's not known in advance if it needs to read anything from stdin, I don't want the client-side to consume its entire stdin before calling the remote command. Here are even more details of what I'm trying to do: I want to write wrapper1 around "ssh HOST wrapper2 CMD", where CMD is not known in advance (assume it does not require a tty, but it may or may not read stdin). Wrapper1 will send some extra data to the remote side to be read by wrapper2 before wrapper2 execs CMD. I want wrapper1 to be more or less transparent; it should work just like ssh works, except for sending the extra data and running wrapper2 as the remote command to read the extra data before execing CMD. If the remote CMD reads stdin, I want it to get the contents of wrapper1's stdin, just as if "ssh HOST CMD" were run. I have coded this by having wrapper1 create a child process which writes the extra data to stdout followed by execing cat to copy stdin to stdout. Wrapper1 pipes the output of the child process into the stdin of the ssh command. However, this approach fails when ssh prompts for a password, since both cat and ssh are contending for input from the keyboard (when CMD is running interactively). If I insert a sleep before the child's cat, it will work, but obviously that is not optimal. Because I don't know if CMD reads stdin at all, I cannot consume all of stdin before execing ssh in order to avoid the conflict. In any case, it is suboptimal to read all of stdin under many scenarios (such as when it is very large, or it needs to be consumed incrementally). Is there any way of doing what I want? Right now all that I can think of is an option to wrapper1 which gives the choice of either:   1. Consume your entire stdin and send it to the remote side, or   2. Redirect stdin from /dev/null. But, it would be better to avoid making the user choose one of the two options and allow the data from stdin to be read incrementally as it normally would be without the wrappers.


Intelligently switch between multiple BASH processes

Say you're in a directory and you want to check something in another directory, so you type `bash` to spawn a new shell so you can `cd` and check that thing and then type `exit` to get out and go back to the original shell still in that old directory. Is there any way to keep both bashes running and switch between the two, sort of like Ctrl+Z + `fg`/`bg`?


how to use rsync (using password-less ssh), with sudo just on the local side?

This command works fine for me with password-less ssh:               rsync -aqve ssh ${user}@${remote_host}:/etc/bind /tmp/etc/bind      Since I would like to rsync directly to my own local /etc/bind with root permissions, I tried:               sudo rsync -aqve ssh ${user}@${remote_host}:/etc/bind /etc/bind      But now, I get a password prompt (this is bad). **How do I fix this line to copy directly to my local /etc/bind without a password prompt?**


Connecting one network interface to the Internet disconnects the other interface

We have got an HP-UX server, but whenever I got connected to that machine using the ethernet cable I got disconnected from internet although my laptop has 2 nw interfaces. One wired one wireless. Why? How can I solve this?


Calling speaker-test from usermode-helper API

I needed to call come audio-producing applications from kernel in a toy module. In order to test that, I thought of calling `speaker-test` from a simpler module, but no sound would ever come from it. I am using the usermode- helper API. Any ideas? Here is my code:               static int test( void )     {        char *argv[] = { "/usr/bin/speaker-test", NULL };        static char *envp[] = {        "HOME=/",        "TERM=xterm",        "PATH=/sbin:/bin:/usr/sbin:/usr/bin", NULL };             return call_usermodehelper( argv[0], argv, envp, UMH_WAIT_PROC );     }          int init_module(void)     {        printk(KERN_INFO "module test init call\n");             test();             return 0;     }          void cleanup_module(void)     {        printk(KERN_INFO "module test end call\n");     }


Paravirtualized disk for Xen using libvirt?

I'm trying to use libvirt to create a paravirtualized xen domain. Here's the xml file that I'm passing to `virsh --connect xen:/// define`:               <domain type='xen'>       <name>xenguest</name>       <uuid>f51a3d97-3e35-335f-7853-de59610bddba</uuid>       <memory unit='KiB'>8286208</memory>       <currentMemory unit='KiB'>8286208</currentMemory>       <vcpu placement='static'>4</vcpu>       <bootloader>/usr/lib/xen-4.2/bin/pygrub</bootloader>       <os>         <type>linux</type>         <kernel>/vz/xen/kernels/vmlinuz-3.2.0-38-virtual</kernel>         <initrd>/vz/xen/kernels/initrd.img-3.2.0-38-virtual</initrd>         <cmdline>root=LABEL=cloudimg-rootfs ro   console=ttyS0</cmdline>       </os>       <clock offset='utc' adjustment='reset'/>       <on_poweroff>destroy</on_poweroff>       <on_reboot>restart</on_reboot>       <on_crash>destroy</on_crash>       <devices>         <disk type='file' device='disk'>           <driver name='file'/>           <source file='/vz/disks/xenguest'/>           <target dev='sda1' bus='scsi'/>         </disk>         <interface type='bridge'>           <mac address='52:54:1a:8b:be:bc'/>           <source bridge='virbr0'/>         </interface>         <console type='pty' tty='/dev/pts/2'>           <source path='/dev/pts/2'/>           <target type='xen' port='0'/>         </console>         <input type='mouse' bus='xen'/>         <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0' keymap='en-us'>           <listen type='address' address='0.0.0.0'/>         </graphics>       </devices>     </domain>      However, after I add the guest, this line:               <emulator>/usr/lib/xen-4.2/bin/qemu-dm</emulator>      gets automatically added to the disk section. I even tried changing `<target dev='sda1' bus='scsi'/>` to `<target dev='xvda1' bus='xen'/>` and it automatically adds the "emulator" line. However, when I use the `bus='xen'` setting and boot the domain I can see that it is using the xenblk major number, so **my main question is: it using paravirtualized driver? Is there another way to check?**               root@xenhost:~# lsblk      NAME  MAJ:MIN RM SIZE RO TYPE MOUNTPOINT     xvda1 202:1    0  28G  0 disk /      Here is some more system information:               zje@host:~$ lsb_release -a     No LSB modules are available.     Distributor ID: Ubuntu     Description:    Ubuntu 13.04     Release:        13.04     Codename:       raring     zje@host:~$ uname -a     Linux host 3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:24:59 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


Movie player for "acps" format .mov video in Linux?

I have been send and asked to review a number of video clips that came with the .mov extension. The video clips open fine in Apple's Quicktime 7 and Quicktime X movie player. However, when I tried to open the files with VLC, I get the following error: > No suitable decoder module: VLC does not support the audio or video format > "acps". Unfortunately there is no way for you to fix this The VLC log says (among lots of other output): > main error: no suitable decoder module for fourcc `apcs'. VLC probably does > not support this sound or video format. For numerous reasons using only Quicktime is not a viable option for me. Is there an alternative player that can play this format? Thank you.


REHL 6.4 and OpenSSL 1.0.1 - Dependency missing.. but it isn't?

I am trying to install phpMyAdmin, however I am getting an error about openssl libraries being missing. However, I have installed them using the ius repo;               Error: Package: php-cli-5.4.26-1.el6.remi.x86_64 (remi)                Requires: libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit)     Error: Package: php-5.4.26-1.el6.remi.x86_64 (remi)                Requires: libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit)     Error: Package: php-recode-5.4.26-1.el6.remi.x86_64 (remi)                Requires: librecode.so.0()(64bit)      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest      Version check for openssl;               [root@fts003lhr yum.repos.d]# openssl version -a     OpenSSL 1.0.1e 11 Feb 2013     built on: Wed Oct 16 16:35:53 EDT 2013     platform: linux-x86_64     options:  bn(64,64) md2(int) rc4(8x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)     compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DKRB5_MIT -m64 -DL_ENDIAN -DTERMIO -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wa,--noexecstack -DPURIFY -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM     OPENSSLDIR: "/etc/pki/tls"     engines:  rsax dynamic      I'm on RHEL 6.4 Santiago. EDIT: After running `whatprovides`               [root@fts003lhr yum.repos.d]# yum whatprovides */libcrypto.so.10     Loaded plugins: product-id, replace, rhnplugin, security, subscription-manager     This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.     This system is receiving updates from RHN Classic or RHN Satellite.     openssl-1.0.0-20.el6_2.5.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-4.el6.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-20.el6_2.1.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-20.el6_2.2.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-20.el6_2.2.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-27.el6_4.2.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-20.el6_2.4.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-10.el6_1.5.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-10.el6_1.5.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-10.el6_1.4.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-25.el6_3.1.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-4.el6.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-25.el6_3.1.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-4.el6_0.1.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-10.el6.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-4.el6_0.2.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-4.el6_0.2.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-20.el6_2.4.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-10.el6.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-20.el6.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-20.el6.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-4.el6_0.1.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-20.el6_2.5.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-27.el6_4.2.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-20.el6_2.1.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-10.el6_1.4.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-27.el6.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-20.el6_2.3.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl-1.0.0-20.el6_2.3.i686 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib/libcrypto.so.10                    openssl-1.0.0-27.el6.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : rhel-x86_64-server-6-6.4.1     Matched from:     Filename    : /usr/lib64/libcrypto.so.10                    openssl10-libs-1.0.1e-2.ius.el6.x86_64 : A general purpose cryptography library with TLS implementation     Repo        : installed     Matched from:     Filename    : /usr/lib64/libcrypto.so.10


Transaction check error in installing vim?

I recently updated my fedora to 20 and wanted to install vim.but running `sudo yum install vim` returned this error:               Transaction check error:       file /usr/share/man/man1/vim.1.gz from install of vim-common-2:7.4.179-1.fc20.x86_64 conflicts with file from package vim-minimal-2:7.4.027-2.fc20.x86_64          Error Summary     -------------      How to fix this problem?


How to sort these lines?

I have this text:               menu.overlap.x: -7     menu.overlap.y: 0          !! Menu settings          menu.title.bg: Solid Flat     menu.title.bg.color: #fce855     menu.title.bg.colorTo: #daa30b     menu.title.bg.border.color: black     menu.title.text.color: #000000     menu.title.text.justify: left     menu.title.bg.interlace.color: #f5db14          !! General window settings     window.label.text.justify: center          !! focused window settings     window.active.client.color: #909498      If I paste it into LibreOffice Calc and use _Data_ > _Sort_ with the option of _Range contains column labels_ unticked, I get this output:               !! focused window settings     !! General window settings     !! Menu settings     menu.overlap.x: -7     menu.overlap.y: 0     menu.title.bg: Solid Flat     menu.title.bg.border.color: black     menu.title.bg.color: #fce855     menu.title.bg.colorTo: #daa30b     menu.title.bg.interlace.color: #f5db14     menu.title.text.color: #000000     menu.title.text.justify: left     window.active.client.color: #909498     window.label.text.justify: center      I've tried `sort` with various options but I get this:               !! focused window settings     !! General window settings     menu.overlap.x: -7     menu.overlap.y: 0     !! Menu settings     menu.title.bg.border.color: black     menu.title.bg.color: #fce855     menu.title.bg.colorTo: #daa30b     menu.title.bg.interlace.color: #f5db14     menu.title.bg: Solid Flat     menu.title.text.color: #000000     menu.title.text.justify: left     window.active.client.color: #909498     window.label.text.justify: center      Which Linux command lets me sort the sample content in the same way as LibreOffice Calc does? (Blank lines are not important.)


How to list files without directories, and filter by name (ls options)

I have a directory called `uploads`. It contains a bunch of files, plus a few subdirectories which in turn contain files. Is there a way I can (in one step) do the following:   1. List ONLY the files in the root uploads directory -- I do not want to see the subfolder names or their contents; **and**   2. Do NOT list any files that start with `t_` I know about the `-d` flag, but it doesn't get me quite what I want.


How to set keyboard layout used to enter password on an encrypted filesystem?

After my upgrade to Debian 6 (Squeeze), the keyboard layout used to enter the password of encrypted filesystem has been changed. How can I revert it back to previous one? My understanding is that, before the encrypted filesystem gets unlocked, the only active partition is `/boot`, therefore such a setting should be there somewhere. However, after extensive Internet searching and grepping `/boot`, I've not been able to find it. I've also tried to reconfigure the keyboard layout used by the console, running:               dpkg-reconfigure keyboard-configuration      ...and:               dpkg-reconfigure console-data      ...with no effect.


Wifi on Fedora trouble

My university's WiFi is particularly unfriendly to Linux, and the only way to make WiFi work is to repeatedly "forget" the network settings for the student network, re-enter all the data about the network, and hope it will connect. I am using Fedora 19 64-bit on my laptop, but this is not the only distro that has WiFi connectivity problems. Android devices are generally incapable of WiFi access, and when I ran Ubuntu, CentOS, and Mint, they all had similar problems. My question is, how would I go about creating a script that would automate the "forget network, re-enter network info" hack that I've been using to get WiFi? As a side note, I am open to more investigative, less hackish solutions that might require more looking at system logs. I am no stranger to bash but logs and more hands on diagnostics are a bit of a mystery to me. Also, my WiFi works fine on my home network, and every other network I've used it with except my university WiFi. Additional info edit: using wpa_supplicant My university runs WPA2-enterprise with AES, and PEAP using MSCHAPv2


solaris.grant and granting/delegating rights?

I have a couple of question regarding Solaris 11... First off, as far as I can tell, Solaris has dropped the auth solaris.grant in Solaris 11... Why was it removed? Is it no longer needed? Did it get a new name? Is there alternatives - eg. using several other auths to gain the same result? Can it be reintroduced by editing a file like /etc/security/auths_attr (or what it's called, the file that lists auths)? Second, how exactly _does_ a user with the authority to grant or delegate rights (profiles, roles, auths) to other users? Which commands are involved? Can rights be granted both permanently and transiently?


Restart all services without reboot

I do some group permission changes on the CentOS server, And then need restart all services. How can I restart all services safely without rebooting?


If MBR is broken, how to fix on RAID + LUKS encryption?

Problem: After HDD failure in a Software-Raid Mirror Debian does not boot. Only black screen with blinking _ Debian Setup:   Within the raid I have a complete system encryption with luks. I am not 100% sure if the MBR is broken or missing or what causes the problem. Usually before the disk failure the PC did boot and I had to enter the passphrase for the encryption and the pc would boot. Current status:   I mounted the raid/luks manually and copied all data. So the data is secure. What I want to do: (#1 prefered) I would like to find the problem (repair MBR ?). Boot the pc. Add the new HDD to my raid and finish. (or #2 if #1 does not work) Since data is secure setting up a new system.


What is the source of help?

`help` displays information about builtin commands. What is the source of help? Does it maintain a database for builtin commands, or does it read some files of each builtin commands (similar to the manpage of each utilities)? Sometimes I find its information seems to expand that by `\--help`               $ cd --help     bash: cd: --: invalid option     cd: usage: cd [-L|[-P [-e]]] [dir]          $ help cd     cd: cd [-L|[-P [-e]]] [dir]         Change the shell working directory.              Change the current directory to DIR.  The default DIR is the value of the         HOME shell variable.              The variable CDPATH defines the search path for the directory containing         DIR.  Alternative directory names in CDPATH are separated by a colon (:).         A null directory name is the same as the current directory.  If DIR begins         with a slash (/), then CDPATH is not used.              If the directory is not found, and the shell option `cdable_vars' is set,         the word is assumed to be  a variable name.  If that variable has a value,         its value is used for DIR.              Options:             -L  force symbolic links to be followed             -P  use the physical directory structure without following symbolic             links             -e  if the -P option is supplied, and the current working directory             cannot be determined successfully, exit with a non-zero status              The default is to follow symbolic links, as if `-L' were specified.              Exit Status:         Returns 0 if the directory is changed, and if $PWD is set successfully when         -P is used; non-zero otherwise.      I thought `help` extract the help part of the executable, but for a python script pdf-merge.py, it isn't               $ help ./pdf-merge.py     bash: help: no help topics match `./pdf-merge.py'.  Try `help help' or `man -k ./pdf-merge.py' or `info ./pdf-merge.py'.          $ ./pdf-merge.py --help     usage: pdf-merge.py [-h] [-v] [--ask] [--output OUTPUT] [--title TITLE]                         [--author AUTHOR] [--keyword KEYWORD] [--pdftk PDFTK]                         [--gs GS] [--pdfmarks PDFMARKS] [--unicode]                         PDF [PDF ...]          Merge PDFs preserving bookmarks. Thanks to Larry Cai for suggesting that     Unicode be supported and for discussion about the `--pdfmarks` option.          positional arguments:       PDF                  an input PDF to merge          optional arguments:       -h, --help           show this help message and exit       -v, --version        show program's version number and exit       --ask                pause for manual pdfmark tweaking       --output OUTPUT      name of the output PDF       --title TITLE        title of output PDF       --author AUTHOR      author of output PDF       --keyword KEYWORD    keywords for the output PDF       --pdftk PDFTK        path to the pdftk executable       --gs GS              path to the gs (Ghostscript) executable       --pdfmarks PDFMARKS  path to pdfmarks file. If not given, a temporary file                            is used. If given and the file is missing, execution                            will stop after the file is created (before the                            Ghostscript run). If given and the file exists, no                            attempt will be make to use pdftk to generate the mark                            file (I assume your input file is what you want).       --unicode            instead of merging PDFs, convert PDF-formatted unicode                            strings. For example `--unicode '<FEFF03B103B203B3>'                            \u03b1\u03b2\u03b3`


Incoming Spam Mail in exim mail server

My domain getting lot of spam mail like xxx@mydomain.com, yyy@mydomain.com. We don't have such user's but we getting mails like that.Also getting lot of bounce mails, How to control spam like this in exim mail server.


Can I see images and watch movies inside the terminal emulator? In case of virtual console I can do it via framebuffer, but what about terminal emulators?


Debian 64-bit sees less than 4GB of RAM

I have a Debian wheezy (7.4) amd64 virtual machine running under VirtualBox 4.3.10 on a Win7 x64 host with AMD A10-5700 processor. The virtual machine is configured with 16GB of memory (the host has 32GB physical RAM, all of which appears to be recognized correctly). No other VMs are running. Nevertheless, the Debian VM sees far less RAM than allocated.               $ uname -a     Linux debian3 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux          $ free                  total       used       free     shared    buffers     cached     Mem:       3610656     958788    2651868          0     181072     379744     -/+ buffers/cache:     397972    3212684     Swap:      3668988          0    3668988          $ dmesg | grep BIOS-e820     [    0.000000]  BIOS-e820: 0000000000000000 - 00000000000a0000 (usable)     [    0.000000]  BIOS-e820: 0000000000100000 - 00000000de9df000 (usable)     [    0.000000]  BIOS-e820: 00000000de9df000 - 00000000de9ec000 (reserved)     [    0.000000]  BIOS-e820: 00000000de9ec000 - 00000000dfb6c000 (usable)     [    0.000000]  BIOS-e820: 00000000dfb6c000 - 00000000dfbc4000 (reserved)     [    0.000000]  BIOS-e820: 00000000dfbc4000 - 00000000dfbcc000 (ACPI data)     [    0.000000]  BIOS-e820: 00000000dfbcc000 - 00000000dfbd0000 (ACPI NVS)     [    0.000000]  BIOS-e820: 00000000dfbd0000 - 00000000dffd0000 (usable)     [    0.000000]  BIOS-e820: 00000000dffd0000 - 00000000dfff0000 (reserved)      I do have VirtualBox set up to use EFI with this VM, so here are some possibly-relevant messages:               $ dmesg | grep EFI     [    0.000000] EFI v2.31 by EDK II     [    0.000000] Kernel-defined memdesc doesn't match the one from EFI!     [    0.000000] EFI: mem00: type=7, attr=0xf, range=[0x0000000000000000-0x00000000000a0000) (0MB)     [    0.000000] EFI: mem01: type=2, attr=0xf, range=[0x0000000000100000-0x00000000003b1000) (2MB)     [    0.000000] EFI: mem02: type=7, attr=0xf, range=[0x00000000003b1000-0x0000000002000000) (28MB)     [    0.000000] EFI: mem03: type=4, attr=0xf, range=[0x0000000002000000-0x0000000002600000) (6MB)     [    0.000000] EFI: mem04: type=7, attr=0xf, range=[0x0000000002600000-0x0000000036bf8000) (837MB)     [    0.000000] EFI: mem05: type=2, attr=0xf, range=[0x0000000036bf8000-0x00000000375f4000) (9MB)     [    0.000000] EFI: mem06: type=7, attr=0xf, range=[0x00000000375f4000-0x00000000a49a4000) (1747MB)     [    0.000000] EFI: mem07: type=2, attr=0xf, range=[0x00000000a49a4000-0x00000000dc000000) (886MB)     [    0.000000] EFI: mem08: type=4, attr=0xf, range=[0x00000000dc000000-0x00000000dc020000) (0MB)     [    0.000000] EFI: mem09: type=7, attr=0xf, range=[0x00000000dc020000-0x00000000dddc3000) (29MB)     [    0.000000] EFI: mem10: type=4, attr=0xf, range=[0x00000000dddc3000-0x00000000de1a6000) (3MB)     [    0.000000] EFI: mem11: type=7, attr=0xf, range=[0x00000000de1a6000-0x00000000de440000) (2MB)     [    0.000000] EFI: mem12: type=1, attr=0xf, range=[0x00000000de440000-0x00000000de45d000) (0MB)     [    0.000000] EFI: mem13: type=4, attr=0xf, range=[0x00000000de45d000-0x00000000de9df000) (5MB)     [    0.000000] EFI: mem14: type=5, attr=0x800000000000000f, range=[0x00000000de9df000-0x00000000de9ec000) (0MB)     [    0.000000] EFI: mem15: type=4, attr=0xf, range=[0x00000000de9ec000-0x00000000deaec000) (1MB)     [    0.000000] EFI: mem16: type=7, attr=0xf, range=[0x00000000deaec000-0x00000000deb1f000) (0MB)     [    0.000000] EFI: mem17: type=2, attr=0xf, range=[0x00000000deb1f000-0x00000000deb25000) (0MB)     [    0.000000] EFI: mem18: type=4, attr=0xf, range=[0x00000000deb25000-0x00000000df9ec000) (14MB)     [    0.000000] EFI: mem19: type=7, attr=0xf, range=[0x00000000df9ec000-0x00000000df9ef000) (0MB)     [    0.000000] EFI: mem20: type=3, attr=0xf, range=[0x00000000df9ef000-0x00000000dfb6c000) (1MB)     [    0.000000] EFI: mem21: type=5, attr=0x800000000000000f, range=[0x00000000dfb6c000-0x00000000dfb9c000) (0MB)     [    0.000000] EFI: mem22: type=6, attr=0x800000000000000f, range=[0x00000000dfb9c000-0x00000000dfbc0000) (0MB)     [    0.000000] EFI: mem23: type=0, attr=0xf, range=[0x00000000dfbc0000-0x00000000dfbc4000) (0MB)     [    0.000000] EFI: mem24: type=9, attr=0xf, range=[0x00000000dfbc4000-0x00000000dfbcc000) (0MB)     [    0.000000] EFI: mem25: type=10, attr=0xf, range=[0x00000000dfbcc000-0x00000000dfbd0000) (0MB)     [    0.000000] EFI: mem26: type=4, attr=0xf, range=[0x00000000dfbd0000-0x00000000dffd0000) (4MB)     [    0.000000] EFI: mem27: type=6, attr=0x800000000000000f, range=[0x00000000dffd0000-0x00000000dfff0000) (0MB)     [    1.204229] fb0: EFI VGA frame buffer device     [    6.734371] EFI Variables Facility v0.08 2004-May-17      And one other message (iommu-related) I'm pretty sure shouldn't be here:               $ dmesg | grep Calgary     [    0.000000] Calgary: detecting Calgary via BIOS EBDA area     [    0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing!      The bootloader is `grub-efi-amd64`. All the above output was from booting with this configuration from `/boot/grub/grub.cfg`:               menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-amd64' --class debian --class gnu-linux --class gnu --class os {             load_video             insmod gzio             insmod part_gpt             insmod ext2             set root='(hd0,gpt2)'             search --no-floppy --fs-uuid --set=root 7d58d543-5c40-4e8d-bbfa-f3773dc7ca15             echo    'Loading Linux 3.2.0-4-amd64 ...'             linux   /boot/vmlinuz-3.2.0-4-amd64 root=UUID=7d58d543-5c40-4e8d-bbfa-f3773dc7ca15 ro quiet             echo    'Loading initial ramdisk ...'             initrd  /boot/initrd.img-3.2.0-4-amd64     }      I have looked at various parts of the kernel source and documentation, the VirtualBox documentation, and elsewhere for answers. I have tried adding and removing various combinations of `mem=16G`, `iommu=soft`, `swiotlb=force`, `allowdac`, `noefi`, and `add_efi_memmap` without any real effect. The `iommu=soft` parameter does eliminate the "Calgary"-related messages, as expected, but there is no effect on the reported memory. Just for fun, I tried reducing the configured memory to 8GB, but that had no apparent effect either. If it matters, I am running the stock kernel. What else might work? **Edit:** Here is the output of `dmidecode`:               # dmidecode 2.11     # SMBIOS entry point at 0xdfbce000     SMBIOS 2.5 present.     10 structures occupying 449 bytes.     Table at 0xDFBCE020.          Handle 0x0000, DMI type 0, 20 bytes     BIOS Information         Vendor: innotek GmbH         Version: VirtualBox         Release Date: 12/01/2006         Address: 0xE0000         Runtime Size: 128 kB         ROM Size: 128 kB         Characteristics:             ISA is supported             PCI is supported             Boot from CD is supported             Selectable boot is supported             8042 keyboard services are supported (int 9h)             CGA/mono video services are supported (int 10h)             ACPI is supported          Handle 0x0001, DMI type 1, 27 bytes     System Information         Manufacturer: innotek GmbH         Product Name: VirtualBox         Version: 1.2         Serial Number: 0         UUID: 0B1BEC54-20D1-4809-A92D-22EE66339AA8         Wake-up Type: Power Switch         SKU Number: Not Specified         Family: Virtual Machine          Handle 0x0008, DMI type 2, 15 bytes     Base Board Information         Manufacturer: Oracle Corporation         Product Name: VirtualBox         Version: 1.2         Serial Number: 0         Asset Tag: Not Specified         Features:             Board is a hosting board         Location In Chassis: Not Specified         Chassis Handle: 0x0003         Type: Motherboard         Contained Object Handles: 0          Handle 0x0003, DMI type 3, 13 bytes     Chassis Information         Manufacturer: Oracle Corporation         Type: Other         Lock: Not Present         Version: Not Specified         Serial Number: Not Specified         Asset Tag: Not Specified         Boot-up State: Safe         Power Supply State: Safe         Thermal State: Safe         Security Status: None          Handle 0x0007, DMI type 126, 42 bytes     Inactive          Handle 0x0005, DMI type 126, 15 bytes     Inactive          Handle 0x0006, DMI type 126, 28 bytes     Inactive          Handle 0x0002, DMI type 11, 7 bytes     OEM Strings         String 1: vboxVer_4.3.10         String 2: vboxRev_93012          Handle 0x0008, DMI type 128, 8 bytes     OEM-specific Type         Header and Data:             80 08 08 00 35 C7 31 00          Handle 0xFEFF, DMI type 127, 4 bytes     End Of Table


Fedora 20 Elantech Touchpad not working

I just purchased a _Toshiba Satellite E45t-A4100_ laptop, installed _Fedora 20_ , and cannot get the touchpad to work.   Here's my environment:               Toshiba Satellite E45t-A4100     ETPS/2 Elantech Touchpad      * * *               uname -r     3.13.8-200.fc20.x86_64      * * *               dmesg | grep mouse     [    0.687578] mousedev: PS/2 mouse device common for all mice     [    1.491139] psmouse serio1: elantech: assuming hardware version 4 (with firmware version 0x381f01)     [    1.518222] psmouse serio1: elantech: Synaptics capabilities query result 0x00, 0x14, 0x0c.      * * *               xinput --list | grep Touchpad     ⎜   ↳ ETPS/2 Elantech Touchpad                  id=13   [slave  pointer  (2)]      * * *               cat /var/log/Xorg.0.log | grep syna     [    25.548] (II) LoadModule: "synaptics"     [    25.548] (II) Loading /usr/lib64/xorg/modules/input/synaptics_drv.so     [    25.548] (II) Module synaptics: vendor="X.Org Foundation"     [    25.548] (II) Using input driver 'synaptics' for 'ETPS/2 Elantech Touchpad'     [    25.570] (II) synaptics: ETPS/2 Elantech Touchpad: found clickpad property     [    25.570] (--) synaptics: ETPS/2 Elantech Touchpad: x-axis range 0 - 3097 (res 31)     [    25.570] (--) synaptics: ETPS/2 Elantech Touchpad: y-axis range 0 - 1793 (res 31)     [    25.570] (--) synaptics: ETPS/2 Elantech Touchpad: pressure range 0 - 255     [    25.570] (--) synaptics: ETPS/2 Elantech Touchpad: finger width range 0 - 15     [    25.570] (--) synaptics: ETPS/2 Elantech Touchpad: buttons: left double triple     [    25.570] (--) synaptics: ETPS/2 Elantech Touchpad: Vendor 0x2 Product 0xe     [    25.570] (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found     [    25.580] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) MinSpeed is now constant deceleration 2.5     [    25.580] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) MaxSpeed is now 1.75     [    25.580] (**) synaptics: ETPS/2 Elantech Touchpad: (accel) AccelFactor is now 0.056     [    25.580] (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found      * * *               cat /usr/share/X11/xorg.conf.d/50-synaptics.conf     Section "InputClass"             Identifier "touchpad catchall"             Driver "synaptics"             MatchIsTouchpad "on"             MatchDevicePath "/dev/input/event*"     EndSection          # This option enables the bottom right corner to be a right button on     # non-synaptics clickpads.     # This option is only interpreted by clickpads.     Section "InputClass"             Identifier "Default clickpad buttons"             MatchDriver "synaptics"             Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"     EndSection     ...


Floating panel over fullscreen windows in tile WM

I want to create kiosk using GNU/Linux. I need to show GUI one application full screen. I've found that `ratpoison` suits my needs. But I also want to allow user to see and change keyboard layout and display digital clock on a panel. It's clear that I don't need all 1280 horizontal pixels to display this information. My fullscreen application has main menu and it would be great to use empty space on the right to overlay it with the panel. ![enter image description here](http://i.stack.imgur.com/4TbKQ.png) I've achieved that with those lines in `tint2` config: ``` panel_position = top right horizontal panel_size = 150 24 strut_policy = none panel_layer = top ``` It works well with a "normal" WM (like `kwin`), but I cannot get the same result with a tile WM (I suppose it's easier to strengthen simple tile WM than a "normal" one). I've already tried `ratpoison`, `awesome` and `i3`. How can I achieve my goal? I can easily change WM or panel to a different one.


Write a script file 'account.awk' that from a file 'orders' creates the formated printout of account

Write a script file `account.awk` that from a file `orders` creates the formatted printout of account. The file `orders` is as follows: http://pastebin.com/kPF5B0c0 Beside the column `Cost` the account displays the column `Total`. To the total cost the measure `EUR` should be added. The last row is summary and includes the total number of pieces and the total cost.


Is making /var/log directory read only on debian linux safe?

I am installing a really small server which got a 512mb CF cars as HD. Not only I haven't plenty of space, but I would like to minimize the writes to disk. I would like to completely clear the /var/log directory and to make it read only (write protected). Will the system hang if I do so?


Postgres: authenticate as postgres user in non-interactive script

I am writing a non-interactive script that needs to execute postgres commands. The script will only be run by `root` or a user with `sudo` permissions, and the postgres commands need to be executed as the `postgres` user in postgresql. The trouble is that postgresql always (as far as I can tell) prompts for a password interactively (i.e. `pqsl -U postgres -W`) or does not accept a password at all (i.e. `psql -U postgres -w`). I would like to pass a password on the command line, similar to how mysql allows `mysql -u user -p password`. How can I do this with postgres?


Systemd: cause a script to execute *after* networking has started?

I am relatively new to systemd and am learning its architecture. Right now, I'm trying to figure out how to cause a custom shell script to run. This script needs to run _after_ the networking layer has started up. I'm running Arch, using systemd as well as netctl. To test, I wrote a simple script that simply executes `ip addr list > /tmp/ip.txt`. I created the following service file for this script.               (/etc/systemd/system/test.service)     [Unit]     Description=test service          [Service]     ExecStart=/root/test.script          [Install]     WantedBy=multi-user.target      I then enabled the script with,               systemctl enable test      Upon restarting, the script does indeed run, but it runs prior to the network being started. In other words, the output in `ip.txt` displays no IPv4 address assigned to the primary interface. By the time I login, the IPv4 address has indeed been assigned and networking is up. I'm guessing I could alter the point at which the script runs by messing with the `WantedBy` parameter, but I'm not sure how to do that. Could someone point me in the right direction?


alternative to nslookup in rhel7?

`nslookup` does not come preinstalled in RHEL 7 Beta. I noticed even `dig` and `host` was not pre installed. I read couple of links which mentions `nslookup` is dead/deprecated, so is there an alternative for `nslookup` introduced in RHEL7 which comes preinstalled?


Is there a way to prevent a non-terminal-attached process from executing 'who' inside my .envfile?

I made some modifications to the `/home/user/.envfile` so the `PS1` prompt would show date/time as well as the `pwd` etc. The modification is:               # `who am i` is used to obtain the name of the original user     case `who am i | awk '{print $1}'` in         'someuser')             #set the prompt to include the date and time             set -o allexport             unset _Y _M _D _h _m _s             eval $(date "+_Y=%Y;_M=%m;_D=%d;_h=%H;_m=%M;_s=%S")             ((SECONDS = 3600*${_h#0}+60*${_m#0}+${_s#0}))             typeset -Z2 _h _m _s             _tsub="(_m=(SECONDS/60%60)) == (_h=(SECONDS/3600%24)) + (_s=(SECONDS%60))"             _timehm='${_x[_tsub]}$_h:${_m}'             _timehms='${_x[_tsub]}$_h:$_m:${_s}'             _timedhms=$_Y'/'$_M'/'$_D" "'${_x[_tsub]}$_h:$_m:${_s}'             _hn=`hostname`             typeset -u _hn             # `whoami` is used here to display the name of the 'su' user             _un=`whoami | awk '{print $1}'`             typeset -u _un             export PS1="$_timedhms     "'['$_un']'$_hn':${PWD#$HOME/} $ '             set +o allexport         ;;         *)         ;;     esac      The prompt should look like:               2014/08/07 11:08:24     [su'd username]hostname:/home/username $      As you can see, this makes use of `whoami` to display the name of the current user in the prompt. Certain processes we run through this account are complaining:               who: 0551-012 The process is not attached to a terminal.             Do not run who am i as a background process.     Usage: who [-AabdHilmpqrsTtuwX?] [am {i,I}] [utmp_like_file]      Is there any way to prevent that modification from affecting this other process? Possibly by detecting when the process is not attached to a terminal?


HP Wifi printing problem

I have an HP PhotoSmart, under Debian 7.5. I'm trying to use my Wifi connection to print documents. It seems to work, but finally only prints the beginning of the pages I send. Any hints? With `hplip`, the printer is recognised (network/internet/wireless network), but `hplip` indicates "device communication error".


Kernels of different distributions of Unix and of Linux

I have heard that different distributions of Linux have the same Linux kernel up to that the Linux kernels may be in different versions. Do different distributions of Unix also share the same kernel up to different versions? What are some examples of various distributions of Unix? I've only heard of BSD.


configure error when trying to build OpenSSL on CentOS

I have a Centos 5.7 operating system box and I have installed OpenSSL 1.0.1h successfully. but when I am upgrading OpenSSH I am getting the below error message while running ./configure. Kindly help me on this and let me know if you have any questions.               checking whether snprintf correctly terminates long strings... yes     checking whether snprintf can declare const char *fmt... yes     checking whether system supports SO_PEERCRED getsockopt... yes     checking for (overly) strict mkstemp... yes     checking if openpty correctly handles controlling tty... yes     checking whether getpgrp requires zero arguments... yes     checking OpenSSL header version... 1000108f (OpenSSL 1.0.1h 5 Jun 2014)     checking OpenSSL library version... 90802f (OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008)     checking whether OpenSSL's headers match the library... no     configure: error: Your OpenSSL headers do not match your     library. Check config.log for details.     If you are sure your installation is consistent, you can disable the check     by running "./configure --without-openssl-header-check".     Also see contrib/findssl.sh for help identifying header/library mismatches.


How to automatically add my program to gnome panel

I wrote a program like dropbox seen in pic. I want to add the icon as that of dropbox. How could I do that? How to automatically do that? ![enter image description here](http://i.stack.imgur.com/E7pSg.png)


How To Install The GNOME 2 Fork 'Mate' Desktop (or similar)  On Fedora linux?

I am running Fedora 16 and keep wanting to do something about the awkward Desktop. I tried several shell extensions but wasn't satisfied with the results, then I heard about MATE, is there a tutorial on how to install it?


Extract IP address from a string

The Linux `host` command returns:               hostA.domain.com has address xx.xxx.xxx.xx      How do I get just the IP address and put it in the `$ipaddr` variable?               open(FILE, "hostlist.txt") or die("Unable to open file");     @hostnames = <FILE>;     close(FILE);     foreach $hostname (@hostnames)     {         $lookup = qx(host $hostname);         $ipaddr = grep ip_address $lookup;  <---- need help here         print $ipaddr;     }


What's the default boot parameter for CentOS 6.2?

I forgot to install a boot loader during LiveCD installation , since i've got other distribution resides in my system , i could add another entry into grub2 , but what's the default parameter for CentOS ?                 linux /vmlinuz-2.6.32-220.el6.x86_64 root=//dev/XX ??       initrd /initramfs-2.6.32-220.el6.x86_64.img      Thanks !


Why don't all Mint 12 applications show up in my cairo-dock menu?

I'm running Mint12 with four monitors. Needless to say, the standard Gnome doesn't work well but it does when using Cairo-Dock instead of the default toolbars and menus. The problem is that my application menu for cairo-dock is not the same as the default menu for mint and some programs are not showing up. The add-on mint menu doesn't work, probably due to issues with compiz. Compiz does not play nice when using two different cards with xinerama. How can I load the get it to show the same applications? Thanks.


Is it worth using vdmfec for backups to external SATA/IDE hard drives?

I have some SATA/IDE hard drive enclosures that I use for backups. The drives for formatted with VFAT, since I need to be able to share them with Windows and OS/X machines. The backup scripts pipe the output through vdmfec to provide error correction for the files. (I started doing this when I found that some old backup files were damaged.) The example on the manpage refers to 1.44MB "floppy" discs. So my question is: is it worth using vdmfec for hard drives (as I've heard that newer ones have built-in error correction)? And if so, should I be using different settings than the defaults? Also: are there better tools for Linux than vdmfec for error correction?


how to use secured port using ssh

We have a process that is using a working secured port using this scp command like so: `/usr/bin/scp -P 1234 -i /path/key_rsa /home/path/filename.txt user@remotehost:/tmp` I'm working on a schell script, that will use `ssh`, but not sure how to use that same port of `1234`. I tried `/usr/bin/ssh -D 1234 remotehost '. ~/my_profile; mkdir /test'` and its asking for the user pw. I know the keys are already established since the scp works fine for that user. What am I doing wrong? Thanks.


programmatically creating a remote directory using ssh

Using a shell script, how can I create a directory remotely from serverA -> serverB using ssh? Can I pass the create directory command with the ssh command? How? I'm basically looking to create a directory remotely based on date (ex. 20110304), if it doesn't already exist.


Trying to install Vsphere ESX 4.0 on x86

I am trying to install Vsphere ESX 4.0 on my x86 machine. It is asking for Custom Drivers to install ESX. When installed on VMware workstation it takes the current installed Ethernet interface drivers but when installed on the machine for proper set up. It is asking for the Custom Driver. Any link where I can get the driver for ESX 4.0?


AWS EMR Bootstrap

I need to write a bootstrap action file for my AWS EMR that runs during provisioning and performs:   1. Install latest R version from: http://cran.us.r-project.org   2. Install ‘lme4’ package (and all of its depended packages). This is an R package that you should be able to find from the site above.   3. Create a file somewhere on the master and slave nodes that contains the instance_id and the type (master, core or task). Any suggestions?


How can I cut a large file in place?

I have a very big text file, about 80GB, and I need to cut a part form it that lies between two given lines. The part I need is not big, and I have not enough space left on the hard drive to do things like:               head -n 10000000 filename > auxiliary_part     tail -n 1000 auxiliary_part > needed_part      How do I do that?


Script that keep reading a stream

Sometimes I `cat` a stream like `/dev/input/event0`. I want to write a script that does something every time there is more output. The definition of more output might be every time it reads a byte. How can that be done? is there some command that does it?


barcode scanner input when running xorg and evdev

When I scan a barcode in a text console (CTRL+ALT+F1 or not running X) I get the correct input, but when I try with an application running on X, I don't get the correct barcode. The scanner is configured to return the barcode followed by an 'n'. Under X I only get the 'n', not the preceding barcode. I ran xev to see what is going on. Here is an excerpt of the output:               > KeyPress event, serial 35, synthetic NO, window 0x6800001,     >     state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,     > KeyRelease event, serial 35, synthetic NO, window 0x6800001,     >     state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,     > KeyPress event, serial 35, synthetic NO, window 0x6800001,     >     state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,     > KeyRelease event, serial 35, synthetic NO, window 0x6800001,     >     state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,      There is one KeyPress/KeyRelease event pair for every digit in the barcode, but no events happening between the KeyPress and KeyRelease event for Alt_L? Should I look at compose keys for a solution, or how can I match the behavior of a normal console? ps. I am using a Welch Allyn ST3400 barcode scanner. EDIT: I ran showkey on the command line and scanned in a barcode. This is the output I got:               keycode  28 release     keycode  56 press     keycode  82 press     keycode  76 press     keycode  80 press     keycode  56 release     keycode  56 press     keycode  82 press     keycode  75 press     keycode  73 press     keycode  56 release      It seems that the barcode scanner is using Left-Alt+#+#+# to get the correct characters. It also seems like the barcode scanner never sends a release event for the numpad keys that it used together with Left-Alt? I read something similar on a different forum - without a solution though. If I manually use Left-Alt+#+#+# with showkey, I get press and release for each key. The question now becomes, why is there no KeyPress event when I am running Xorg?


Convenient way to name files in Linux

I'm a beginner in Linux and want to learn to do things properly in this environment. Since the beginning I've noticed that a lot of people involved in Linux (like tutorials and guides) tend to name files omitting spaces and replacing them with the character "_" and I would like to know if there's a reason to do so. Also I want to know what other characters should be avoided when naming files. What about capital letters? I've seen a preference for lowercase letters. As a last query, what would be the best way to name my songs in Linux. For example, I got a lot of files in the format: `track. artist name - song name.mp3`, like `01\. Crystal Castles - Untrust Us.mp3`. Should I change the format to something like `track._artist_name_-_song_name.mp3` as in `01._Crystal_Castles_-_Untrust_Us.mp3`; it looks a little overloaded for my newbie eyes. I would like to know your opinion on this matter. Thanks.


how to access with Linux to the real block size info of a filesystem when it is mounted on nfs?

I have a Centos 6.5 and Solaris 5 machines. I'm trying to get the information about block size of a filesystem in the member f_frsize of statvfs. I tried first from Centos but when the filesystem is mounted in nfs, i got a value like 32768 or 65536. I think this value is the nfs data block size and not the block size. And when i try to get the block size info of the same nfs filesystem but from Sun Solaris, i get a value like 1024. So why did i get a different block size (f_frsize) when calling statvfs from Solaris and from Linux ? Is there a way to get the f_frsize info of the nfs filesystem and not this nfs data block size ? i don't know if what i want is possible, but i would like more informations about this. Thanks


Linux fails on boot in strange way

I have restarted my machine after trying to install Skype, i have reverted changes made to               etc/dbus-1/system.conf      but after starting my machine i receive almost instantly stream of 99 and sometimes 80 and that's all. Nothing is being logged to aby log as it fails even before loading kernel,literally in Second or two after pressing Power. I don't know if my change to above file is relevant,maybe that's just coincidence, where I should start looking for some clue? I even don't know what to Google now, or is it software or hardware (ssd?) failure. Sorry for lack of formatting, I'm writing from my phone.


How to check which specific processes (Python scripts) are running?

Using the command 'top' I can see 2 python scripts are running. However, how do I check their names or directory/location? I want to identify them so I can see what is running properly and what isn't.


Perl alternative for screen/tmux for the UNIX world?

What happens when a screen/tmux-like solution is needed (to leave a process running for a long time, but not with `nohup` because interaction could be needed) - but screen/tmux is not available on the given machine, and installing screen/compiling it isn't a solution? **Q: Are there any "short" perl scripts that can be generally (or not generally) used to achieve this goal (on Linux/AIX/etc.)?** only this is needed:   1. start the perl script   2. start the given thing that takes long time   3. de-attach from the terminal, ex.: because working notebook needs to be shut down   4. **re-attach to the console** to see/control the started long running process, just like in screen Does anybody has a perl script like this?


How do I prepare Windows NTFS drives on Linux

I'm upgrading my windows desktop hardware and doing a clean OS install. I'm using SystemRescueCD to prepare my old drives for the upgrade. Long story short, a bit of an emergency, I coudln't do this in windows before I upgraded the hardware (failed motherboard) and windows doesn't boot with the new hardware. I'm familiar with unix/linux but not so much when it comes to doing things with windows and have some questions. I have 3 drives. 2 old drives that were the system (c:, /dev/sda) and data (d: /dev/sdc) drives before I upgrade the hardware. I have one new drive (/dev/sdb) which I think I might have used briefly in a USB dock because it's formatted as FAT16. I'm currently waiting for /dev/sdb to finish formatting. I used mkntfs /dev/sdb1 to make it an NTFS partition. Is that going to be good enough? I want to copy the contents of /dev/sda1 and /dev/sdc1 into directores on /dev/sdb1 as backups (already have files backed up to other device but faster if on same system). What's the best way to do the copy so that I can easily see the files in windows and not have to worry about hidden files or special permissions? It's also about 0.4TB of data so something that will work fast would be nice. I don't want to move the partition, just copy the contents of those 2 partitions to directories in the new drives partition. Do I need to do anything about assigning drive letters? When I install windows I plan on formatting my c: drive (/dev/sda) as my new system drive/partition. I want the new drive (/dev/sdb) to have a d: drive letter in windows but don't want to reformat it since it will contain the data from my old system drive. My old d: drive (/dev/sdc) I don't want to reformat yet but would like it to be my e: drive.


How do I change the Old Directory path to New Directory path using SED command

I have the old path it contains the some files.                /home/ubuntu/Desktop/test-dir      Now I want to change the test-dir to new-test-dir directory.                /home/ubuntu/Desktop/new-test-dir       How do I change this


apt-file vs apt-cache

I've known about `apt-cache` for quite some time, but only yesterday stumbled on `apt-file`. My question is, given this kind of output from the two...               ttsiod@avalon ~     $ apt-cache search setxkb     x11-xkb-utils - X11 XKB utilities     xfce4-xkb-plugin - xkb layout switch plugin for the Xfce4 panel          ttsiod@avalon ~     $ apt-file find setxkb     fish: /usr/share/fish/completions/setxkbmap.fish     fish: /usr/share/fish/functions/__fish_complete_setxkbmap.fish     x11-xkb-utils: /usr/bin/setxkbmap     x11-xkb-utils: /usr/share/man/man1/setxkbmap.1.gz     xmanpages-ja: /usr/share/man/ja/man1/setxkbmap.1.gz     zsh: /usr/share/zsh/functions/Completion/X/_setxkbmap     zsh-beta: /usr/share/zsh-beta/functions/Completion/X/_setxkbmap     zsh-common: /usr/share/zsh/functions/Completion/X/_setxkbmap      ...why would one bother with apt-cache? Isn't apt-file superior in every way? I am probably missing something. **EDIT** : The reason I am asking is because apt-file reported MORE packages than apt-cache. I only use apt-cache for the use case _"I need tool/manpage/whatever named foo - which packages contain foo?"_ and it seems that apt-file seems to do everything apt-cache does, but better - it reports more packages (apt-cache MISSES some), and it also shows the filenames involved.


exiting infinte loop

This code gets into an infinite loop. How can in troubleshoot it?               PGM=ot_run_hourly     PID=$$     TIMESTAMP=`date +%Y%m%d%H%M%S`     MASTER_DATE_STAMP_BEGIN=`date +%D`     MASTER_TIME_STAMP_BEGIN=`date +%T`     DIR=/var/opt/gogd/ship/na/log          #logfiles /var/opt/gogd/ship/na/log/ot_run_hourly*.log          LOG_FILE=${DIR}/${PGM}_${TIMESTAMP}_${PID}.log     COUNTER=1          date +"Info: %m/%d/%Y %T : Step 1 : Start" | tee -a ${LOG_FILE}          while [ $COUNTER -le 5 ]     do                  date +"Info: %m/%d/%Y %T : Step 2 : Counter $COUNTER" | tee -a ${LOG_FILE}                            COUNTER =`expr $COUNTER + 1`                  sleep 60          done          date +"Info: %m/%d/%Y %T : Step 3 : Complete" | tee -a ${LOG_FILE}/var/opt/gogd/ship/scripts


"system is going down for reboot now"

I am connected to a beagleboard via tty and I suddenly see this message :               Broadcast message from root@arm             (unknown) at 11:40 ...          The system is going down for reboot NOW!     [  143.036193] Restarting system.      The system is Ubuntu 12.10. Is there a place where I can find why the system decided to go down ? UPDATE: More info   * This actually happens all the time, the board reboots every 1 to 5 minutes.   * I made sure no program or daemon runs at startup.   * I can't find `Restarting` anywhere in any file in `/var/log`   * In `syslog` before a reboot there is consistently a `Feb 10 09:20:00 arm rsyslogd: [origin software="rsyslogd" swVersion="5.8.6" x-pid="317" x-info="http://www.rsyslog.com"] exiting on signal 15.`


Graph is too large for cairo-renderer bitmaps Error

Im trying to use pyreverse to generate images of UML diagrams for a project source code. When I run the pyreverse command and specify to generate `.png` images, it runs and then after a while, it shows:               dot: graph is too large for cairo-renderer bitmaps. Scaling by 0.271394 to fit     dot: graph is too large for cairo-renderer bitmaps. Scaling by 0.333083 to fit      Then if I open either image, the text is unreadable because it got scaled. Is there a way to just not scale, and let the image be large size?


arecord to record what is playing on speakers

The command `arecord foo.wav` records from microphone and saves to file foo.wav. Is there a way I can have arecord record what is coming out of speakers instead of recording from microphone? Or perhaps there are other command line tools that can do this? I would rather avoid bloaty graphical tools like Audacity. I am on Arch if it makes any difference.


NetworkManager cannot remember my WiFi password

My system is Gentoo 64bit, with KDE4. I just updated my Gentoo system. And after reboot, it asks me for my WiFi password. But the next I log in, it asks the password again. I checked the settings, and the _password_ field is empty. And even I type in the password into those fields, it cannot be saved. I checked my system log, and the only line that looks like an error is this one.               Aug 26 12:52:48 dell NetworkManager[251]: get_secret_flags: assertion 'is_secret_prop (setting, secret_name, error)' failed      P.S. I am not using KWallet. I guess this is not required?


kernel log in /var/log/messages: task xxx blocked blocked for more than 120 seconds . System frozen

Monit sent out emails in the morning that my java app on the server was not responding to HTTP calls made on the 127.0.0.1 interface. App log shows nothing out of the ordinary, nginx log shows no signs of an attack, system log indiacted something was causing the kernel to block the process. I suspect it could be due to lack of resources? I am on a VPS that has only 2Ghz processors (KVM). The app itself is still running but the OS freezes, cant even ssh into the box. here is the stack trace from /var/log/messages (same seen in dmesg)               Aug  1 09:20:13 myserver kernel: INFO: task jbd2/vda1-8:265 blocked for more than 120 seconds.     Aug  1 09:20:13 myserver kernel: Clocksource tsc unstable (delta = -51538573103 ns)     Aug  1 09:20:13 myserver kernel:      Not tainted 2.6.32-431.1.2.0.1.el6.x86_64 #1     Aug  1 09:20:13 myserver kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.     Aug  1 09:20:13 myserver kernel: jbd2/vda1-8   D 0000000000000001     0   265      2 0x00000000     Aug  1 09:20:13 myserver kernel: ffff880217b63c20 0000000000000046 0000000000000000 000000011954e14a     Aug  1 09:20:13 myserver kernel: ffff880217b63b90 ffff88021c49e670 0000000013117898 ffffffffac2e3bb9     Aug  1 09:20:13 myserver kernel: ffff88021826faf8 ffff880217b63fd8 000000000000fbc8 ffff88021826faf8     Aug  1 09:20:13 myserver kernel: Call Trace:     Aug  1 09:20:13 myserver kernel: [<ffffffff811bf130>] ? sync_buffer+0x0/0x50     Aug  1 09:20:13 myserver kernel: [<ffffffff815280b3>] io_schedule+0x73/0xc0     Aug  1 09:20:13 myserver kernel: [<ffffffff811bf170>] sync_buffer+0x40/0x50     Aug  1 09:20:13 myserver kernel: [<ffffffff81528b7f>] __wait_on_bit+0x5f/0x90     Aug  1 09:20:13 myserver kernel: [<ffffffff811bf130>] ? sync_buffer+0x0/0x50     Aug  1 09:20:13 myserver kernel: [<ffffffff81528c28>] out_of_line_wait_on_bit+0x78/0x90     Aug  1 09:20:13 myserver kernel: [<ffffffff8109b330>] ? wake_bit_function+0x0/0x50     Aug  1 09:20:13 myserver kernel: [<ffffffff811bf126>] __wait_on_buffer+0x26/0x30     Aug  1 09:20:13 myserver kernel: [<ffffffffa00637f1>] jbd2_journal_commit_transaction+0x1181/0x1500 [jbd2]     Aug  1 09:20:13 myserver kernel: [<ffffffff810096f0>] ? __switch_to+0xd0/0x320     Aug  1 09:20:13 myserver kernel: [<ffffffff81084d2b>] ? try_to_del_timer_sync+0x7b/0xe0     Aug  1 09:20:13 myserver kernel: [<ffffffffa0068a48>] kjournald2+0xb8/0x220 [jbd2]     Aug  1 09:20:13 myserver kernel: [<ffffffff8109b2b0>] ? autoremove_wake_function+0x0/0x40     Aug  1 09:20:13 myserver kernel: [<ffffffffa0068990>] ? kjournald2+0x0/0x220 [jbd2]     Aug  1 09:20:13 myserver kernel: [<ffffffff8109af06>] kthread+0x96/0xa0     Aug  1 09:20:13 myserver kernel: [<ffffffff8100c20a>] child_rip+0xa/0x20     Aug  1 09:20:13 myserver kernel: [<ffffffff8109ae70>] ? kthread+0x0/0xa0     Aug  1 09:20:13 myserver kernel: [<ffffffff8100c200>] ? child_rip+0x0/0x20          Aug  1 09:20:13 myserver kernel: INFO: task java:12282 blocked for more than 120 seconds.     Aug  1 09:20:13 myserver kernel:      Not tainted 2.6.32-431.1.2.0.1.el6.x86_64 #1     Aug  1 09:20:13 myserver kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.     Aug  1 09:20:13 myserver kernel: java          D 0000000000000001     0 12282      1 0x00000080     Aug  1 09:20:13 myserver kernel: ffff88021893d7c8 0000000000000086 0000000000000000 000000011954e14a     Aug  1 09:20:13 myserver kernel: ffff88021893d808 ffff880219800de0 0000000013116f06 ffffffffac2e3bb9     Aug  1 09:20:13 myserver kernel: ffff88021aba7058 ffff88021893dfd8 000000000000fbc8 ffff88021aba7058     Aug  1 09:20:13 myserver kernel: Call Trace:     Aug  1 09:20:13 myserver kernel: [<ffffffff811bf130>] ? sync_buffer+0x0/0x50     Aug  1 09:20:13 myserver kernel: [<ffffffff815280b3>] io_schedule+0x73/0xc0     Aug  1 09:20:13 myserver kernel: [<ffffffff811bf170>] sync_buffer+0x40/0x50     Aug  1 09:20:13 myserver kernel: [<ffffffff8152894a>] __wait_on_bit_lock+0x5a/0xc0     Aug  1 09:20:13 myserver kernel: [<ffffffff811bf130>] ? sync_buffer+0x0/0x50     Aug  1 09:20:13 myserver kernel: [<ffffffff81528a28>] out_of_line_wait_on_bit_lock+0x78/0x90     Aug  1 09:20:13 myserver kernel: [<ffffffff8109b330>] ? wake_bit_function+0x0/0x50     Aug  1 09:20:13 myserver kernel: [<ffffffff811be6c9>] ? __find_get_block+0xa9/0x200     Aug  1 09:20:13 myserver kernel: [<ffffffff811bf316>] __lock_buffer+0x36/0x40     Aug  1 09:20:13 myserver kernel: [<ffffffffa0062293>] do_get_write_access+0x493/0x520 [jbd2]     Aug  1 09:20:13 myserver kernel: [<ffffffff8100bb8e>] ? apic_timer_interrupt+0xe/0x20     Aug  1 09:20:13 myserver kernel: [<ffffffffa006a778>] ? jbd2_journal_add_journal_head+0xd8/0x170 [jbd2]     Aug  1 09:20:13 myserver kernel: [<ffffffffa0062471>] jbd2_journal_get_write_access+0x31/0x50 [jbd2]     Aug  1 09:20:13 myserver kernel: [<ffffffffa00afd98>] __ext4_journal_get_write_access+0x38/0x80 [ext4]     Aug  1 09:20:13 myserver kernel: [<ffffffffa0089bd3>] ext4_reserve_inode_write+0x73/0xa0 [ext4]     Aug  1 09:20:13 myserver kernel: [<ffffffffa0089c4c>] ext4_mark_inode_dirty+0x4c/0x1d0 [ext4]     Aug  1 09:20:13 myserver kernel: [<ffffffffa0061495>] ? jbd2_journal_start+0xb5/0x100 [jbd2]     Aug  1 09:20:13 myserver kernel: [<ffffffffa0089f40>] ext4_dirty_inode+0x40/0x60 [ext4]     Aug  1 09:20:13 myserver kernel: [<ffffffff811b490b>] __mark_inode_dirty+0x3b/0x160     Aug  1 09:20:13 myserver kernel: [<ffffffff811a5012>] file_update_time+0xf2/0x170     Aug  1 09:20:13 myserver kernel: [<ffffffff8118aee0>] ? __sb_start_write+0x80/0x120     Aug  1 09:20:13 myserver kernel: [<ffffffffa008adc0>] ? ext4_da_get_block_prep+0x0/0x3c0 [ext4]     Aug  1 09:20:13 myserver kernel: [<ffffffff811c11eb>] __block_page_mkwrite+0x3b/0x140     Aug  1 09:20:13 myserver kernel: [<ffffffffa008d0b1>] ext4_page_mkwrite+0x121/0x360 [ext4]     Aug  1 09:20:13 myserver kernel: [<ffffffff81149d60>] do_wp_page+0x640/0x920     Aug  1 09:20:13 myserver kernel: [<ffffffff810a0552>] ? hrtimer_cancel+0x22/0x30     Aug  1 09:20:13 myserver kernel: [<ffffffff8114a83d>] handle_pte_fault+0x2cd/0xb00     Aug  1 09:20:13 myserver kernel: [<ffffffff810af1de>] ? futex_wake+0x10e/0x120     Aug  1 09:20:13 myserver kernel: [<ffffffff8114b29a>] handle_mm_fault+0x22a/0x300     Aug  1 09:20:13 myserver kernel: [<ffffffff8104a8d8>] __do_page_fault+0x138/0x480     Aug  1 09:20:13 myserver kernel: [<ffffffff8100bb8e>] ? apic_timer_interrupt+0xe/0x20     Aug  1 09:20:13 myserver kernel: [<ffffffff8100bb8e>] ? apic_timer_interrupt+0xe/0x20     Aug  1 09:20:13 myserver kernel: [<ffffffff8103f9d8>] ? pvclock_clocksource_read+0x58/0xd0     Aug  1 09:20:13 myserver kernel: [<ffffffff8103f9d8>] ? pvclock_clocksource_read+0x58/0xd0     Aug  1 09:20:13 myserver kernel: [<ffffffff8103ea6c>] ? kvm_clock_read+0x1c/0x20     Aug  1 09:20:13 myserver kernel: [<ffffffff8152d46e>] do_page_fault+0x3e/0xa0     Aug  1 09:20:13 myserver kernel: [<ffffffff8152a825>] page_fault+0x25/0x30      I tried to see what other process was hogging the CPU at the same time but no luck. I really suspect it could be the CPU being utilised at 100%.               [root@myserver log]# uname -a     Linux myserver 2.6.32-431.1.2.0.1.el6.x86_64 #1 SMP Fri Dec 13 13:06:13 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux      Any thoughts?