Is there a line-by-line bash pipe?

I remember reading somewhere (then I forgot where) about a rarely used type of bash pipe that could redirect output line-by-line. In other words, rather than redirecting the output once at the end, the output would be redirected for every newline, and run the receiving process multiple times. I've looked in all the bash docs I can get my hands on, but I can't figure out if this 'pipe' really exists. Is there such a thing as a line-by-line pipe? Of course the task could easily be accomplished other ways, but I'm curious if there is a more elegant way.


Where to obtain Broadcom DW1530 wireless-n wlan half-mini driver?

I am running Fedora 15 x86_64 on Dell Latitude E5420 which is using Broadcom DW1530 wlan card, have been looking around the web but couldn't find a driver, anyone can help?


Is there a linux distro that uses Jack audio server all the time?

By this I mean a distro that does not use pulse audio at all. So when you are runing programs like `miro` or `mumbles` you do not lose audio playback becuase Jack took over the audio stack.


How can I write to the second line of a file from the command line?

I have an external program that produces an output file (largish, 20K lines possible). I need to insert a new line between the existing line 1 and line 2. I've been looking at awk and sed - I use one liners in each fairly regularly - but I haven't been able to come up with the right switches to do this.


How to auto-start my bash_profile?

When I open a new terminal, it doesn't execute auto-start my bash_profile. I need to do "source .bash_profile". When I use Screen, it happens again.


Why is it a security problem to have /usr/sbin owned by bin?

The Sendmail Installation and Operation Guide (§1.3.1) asserts: > For security reasons, /, /usr, and /usr/sbin should be owned by root, mode > 07552   > [...]   >  2Some vendors ship them owned by bin; this creates a security hole that is > not actually related to _sendmail_. [...] Why is this a security hole? Are there systems that run processes as user bin?


Set up a portable development environment

**My Goal** Have a USB drive (4GB) live boot to DSL (for size) with some extra software (git, hg, .vimrc + plugins, etc...) and also reserve a portion of the drive as writable (maybe symlink my home folder, etc...) Ultimately have a portable development environment. Ideas / Suggestions on how to accomplish this?


OpenBox autostart in OpenSUSE?

How can I use autostart with OpenBox (in OpenSUSE)? Previously xfce was installed to run in the first place. I have added               xfce4-panel &       to `autostart` in `/etc/xdg/openbox/` and `autostart` `~/.config/openbox/` to no avail. `xfce4-panel &` from terminal works. My autostart looks like this:                  #        # These things are run when an Openbox X Session is started.        # You may place a similar script in $HOME/.config/openbox/autostart        # to run user-specific things.        #             # If you want to use GNOME config tools...        #        #if test -x /usr/lib/gnome-settings-daemon >/dev/null; then        #  /usr/lib/gnome-settings-daemon &        #elif which gnome-settings-daemon >/dev/null; then        #  gnome-settings-daemon &        #fi              # If you want to use XFCE config tools...        #        #xfce-mcs-manager &        xfce4-panel &


Is it possible to list open SysV queues on certain files?

I have a suite of applications that communicate with each other using SysV queues. However, when I stop the application there are sometimes queues left open, which in turn causes problems next time I start the application. To resolve this I want to delete the queues left open, but to know which queues to delete I would like to be able to list which queues are associated with a specific file. Is this possible to do? The queue is created using the following (simplified) code:                   key_t key;         int q_id;              key = ftok("/some/file/name", 42);         q_id = msgget(key, 0666 | IPC_CREAT);      So by associated with a file a mean the path used in the `ftok` call.


Export a m3u playlist to a directory in order they appear in the playlist

There is a way to rsync a m3u playlist into a destination directory. How can I process the list and number the output so it orders the files to match the playlist order? For example the m3u:               /music/song-yellow.mp3     /music/song-red.mp3     /music/song-blue.mp3      would copy/rsync the playlist contents, renaming the files to:               /dest-path/01-song-yellow.mp3     /dest-path/02-song-red.mp3     /dest-path/03-song-blue.mp3      _This is so I can build mixtape playlists and copy them for people._ Any advice appreciated.


SSH client side problem: hanging and timing out on some hosts

From my laptop I'm trying to connect to HOST1 and I get:               $ ssh -vvv user@HOST1     OpenSSH_6.0p1 Debian-3ubuntu1, OpenSSL 1.0.1c 10 May 2012     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: /etc/ssh/ssh_config line 19: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to HOST1 [x.x.x.x] port 22.     ssh: connect to host HOST1 port 22: Connection timed out      The ssh daemon on the server is working fine as I'm able to connect to it from other machine.   For instance from my laptop I'm able to ssh into HOST2 and from there I'm able to ssh into HOST1 but it's annoying. HOST1 is some host I have control of, but it's happening also with github and bitbucket. This lead me to believe the problem is client side only, but I ran out of ideas. Any suggestion?


Why need drivers for both x server and the linux kernel?

Can someone explain why two sets of drivers are needed, one in the Linux kernel and one in X? I understand that the device drivers are in the kernel, but what is the role of those in the xserver? Does wayland require such drivers to run?


why do background jobs hang depending on the size of the output?

I had some stress-testing scripts that were running in parallel and they would hang after finishing and would wait for a RETURN keystroke to exit. After investigating I discovered that it is not peculiar to my scripts but to all sorts of scripts ran on bash and that it depends on the size of the output produced (at least in my system: Ubuntu precise) For instance the following:               find . &      hangs and waits for a RETURN keystroke if sufficient output is produced (try .. or ../.. to get more output), otherwise (i.e. if "little" output is produced) exits without hanging. Since I find this kind of feature annoying in my particular case is there a way around it?


Start an installed Debian Package from Konsole

i have installed teamviewer from dpkg and when i list it:                   dpkg-query -l      it shows up, but how can i run it? Its not under "Applications" thanks!


Linux : See CPU usage by a process for the last second

vmstat 1      Above will print virtual memory statistics each seconds. It will also show the CPU utilization for last second. I have a web server at hand which runs httpd and MySQL. I need to find how much CPU httpd consumed in last second. Like vmstat particularly for httpd. I tried this :               ps -e -o %mem,%cpu,cmd | grep mysql | awk '{memory+=$1;cpu+=$2} END {print memory,cpu}'      But it will show me the ratio of CPU used since the start of the process. So, with above, if my process caused a spike and then went to sleep for long time, I wont know it. Its like windows process manager, which shows which process is using how much CPU. I hope I am making my question understandable. I will clarify if anything is missing.


Can I use a Logitech M505 wireless mouse with Fedora?

It's a nice mouse, but Fedora 15 doesn't recognize it. In /proc/bus/input/devices, I see a "PS/2 Generic Mouse". I've tried booting into Fedora with the USB device still plugged in, and it hangs. I found instructions that might work for Ubuntu, but they involve editing a file I just don't have in Fedora (/etc/X11/xorg.conf).


libX11.so.6 Not found

I tried to `make && make install package`, but I get an error: > libX11.so.6 not found Where can i get this lib?


Understanding Linux executable formats and software distribution packages

This kind of question might've already been beaten to death. If so, I'm sorry for beating it some more. I am having trouble understanding Linux executable formats and software distribution packages. There are so many different distributions of Linux itself, and it seems like every software package has been compiled separately for each distro. Why is this? I understand that some "packages" are made to install on different distros, but is the executable format for the software different? Also, why do many Linux users prefer the command prompt versions of applications vs GUI versions? I can understand the need for small footprints, but even GUI apps can have small footprints if they're coded right. These might be moot observations, but they get on my nerves.


How can I split a large text file into chunks of 500 words or so?

I know there's the command `split` which can split a file into several chunks based on file size, and then there's the command `wc` which can count words. I just don't know how to use the two together.


core dump help-- linux

I'm trying to understand the core dump generation. Is the core dump generated separately for a user space application process crash and the kernel level crash? Is the `ulimit -c` for both kinds? Can you please clarify?


sun.jdbc.odbc.JdbcOdbcDriver not found

I'm configuring a Business Intelligence tool `Yellowfin BI` on my Debian Linux server and I get this error:               Error Message:     java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver      I cannot figure out why the `JDBC-ODBC` driver is not found. These are the software versions:               java version "1.6.0_31"     OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1~deb7u1)     OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)      Server: Linux biserver 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux How do I troubleshoot this problem and where do I need to look for `sun.jdbc.odbc.JdbcOdbcDriver`?


How do I select all the hidden files in the console?

How do I select all hidden files in a directory? `ls .*` selects the current folder - `.`, as well as it's parent `..`. I just want the hidden files


Changing the defult directory structure

If I start a new distro (e.g. LFS):   1. How can I change the directory structure?   2. What should I expect after it's ready? (probably can't install most of the packages without modification, right? But, before you down vote: I've been asked to make a new distro for a specific project which they need (actually, want) a new directory structure with a few changes, for example remove the `var` and `bin` directories, but without halting the system. The application of this distro is so limited, so i think it shouldn't be a big deal as they need just a few packages to be installed.


routing wget --recursive to stdout (as in -O -) rather than a file

I want to "scan" a website content, recursively, and pipe it to another program. When I run:               wget -r -O - $SITE      I get               WARNING: combining -O with -r or -p will mean that all downloaded content     will be placed in the single file you specified.      Then, "download" process starts, but hangs after the first page is done. By "hangs" I mean, nothing seems to be going on, nor do I get back the command prompt until I hit `Ctrl+C`. I would prefer avoiding the option outputting `wget` to a temporary folder and scan file by file, as well as writing my own scrapper which seems to be the most redundant act one can think of at the end of 2012.


Delta rpms and presto with yum

When you use delta rpm's with presto or without even, do they rely on you having the original rpm on hand, or do they download both the original and the difference between the original and then construct it? (specifically with yum) Does presto or any other system need to be keeping a cache of all installed rpm's for delta rpms to work? Do delta rpms work without presto, or are the integrated? Thanks in advance :-)


Device node LVM

There is mention of a device node, when I was reading about LVM. I can't find anything useful as to what it is or functions as. Any help or suggestion of where to look would be appreciated.


Giving SSH users read-only access to a directory

I'm running Fedora 17 and I want to give several users access to files on my secondary hard drives on /run/media/haukur/. This is what I initially did:               chmod -R 755 /run/media/      But every time I turn the computer off these permissions are reset to:               ls -l /run/media/     drwxr-x---+ 4 root root 80 Jul  5 17:42 haukur      The same applies to /run/media/haukur/. I made a symbolic link in every user's home directory pointing to /run/media/haukur/ but they stop working (permission errors) all the time. What can I do to make these changes permanent? Edit: I solved the problem by adding the devices to `/etc/fstab`:               /dev/sdc1   /media/a                               ext4    defaults        0 0     /dev/sdb1   /media/b                               ext4    defaults        0 0


How to setup trap in bash functions?

I can setup `trap` in bash scripts but not bash functions. For example, `source` the code below and run `f`, now try `Ctrl`+`C`, it's not been trapped! How to setup `trap` in bash functions?                 4 trap ctrl_c INT       5        6 ctrl_c () {       7  echo "** Trapped CTRL-C"       8 }       9       10       11 f () {      12   for i in `seq 1 100`; do      13     sleep 1      14     echo -n "."      15   done      16 }


NFS File Sync on Mount

I have an ext4 hard drive mounted and working correctly except, if I add a file/folder to the mount on the server side, I can't see the changes on the client side unless I reboot the client. i.e. The client doesn't know/see the changes to the mount. `fstab`:               server:/mnt/hdd     /home/jesse/mnt/hdd nfs4    _netdev,auto    0   0      `etc/exports`:               /mnt/hdd 1.2.3.4(rw,sync,no_subtree_check)      Files permission are good as I can r&w without any problems. Any ideas?


Display Issues in KDE on laptop at startup (it happens when I plug and unplug the AC adapter)

I have a display problem in KDE, sometimes at startup everything goes black except the mouse. It only happens in the Login screen or in the boot screen. Lilo displays correctly and once I have loaded KDE there is no problem. I think it happens because Linux detects something else as a secondary monitor. Also I have noticed that this happens only when I Shutdown the computer with the AC adapter unplugged and I turn on with the adapter plugged. My Laptop is Toshiba and my Os is Linux Slackware 14. Any hint is helpful, for example how can I diagnose by myself the exact problem. Thanks


Installing Linux on an Android netbook

Is it possible to boot Puppy Linux using an USB stick on a netbook running Android, specifically this one: http://amzn.to/VSEJTf? Is the right kind of BIOS in place that it can boot from USB?


Squid cache problem

If I put in my `test_site acl` (deny access policy) a site (i.e, www.aaabbbccc.com) which nobody ever accessed and do a `squid -k reconfigure`, Squid then appears to correctly log the site. I then comment out the www.aaabbbccc.com URL in the test_site acl and run `squid -k reconfigure` again. So Squid allows the access to the site, correctly, doing a cache. But, here's the problem. If I remove the comment in the test_site acl, run again `squid -k reconfigure`, and I'm still able to access the URL www.aaabbbccc.com (I clean my machine cache already). My conclusion is that squid can deny a site which is stored in the squid cache. But it doesn't make any sense. Am I right? Here´s my `squid.conf`               *#####################################################################################     ie_refresh on     #####################################################################################     acl all src 0.0.0.0/0.0.0.0     acl manager proto cache_object     acl localhost src 127.0.0.1/255.255.255.255     acl to_localhost dst 127.0.0.0/8     acl SSL_ports   port    443     acl Safe_ports  port    21     acl Safe_ports  port    443     acl Safe_ports  port    1025-65535          ####################################################################################     acl NOCACHE url_regex "/etc/squid/regras/nocachesites"     ####################################################################################     acl liberar_mac_x                arp "/etc/squid/regras/liberar_mac_x"     ####################################################################################     # Regras de Controle     ####################################################################################     acl test_site               url_regex -i "/etc/squid/regras/teste_lucas"     acl redelocal   src     192.168.0.0/255.255.255.0     acl purge method PURGE     acl CONNECT method CONNECT          ####################################################################################     no_cache deny NOCACHE          http_access allow liberar_mac_x     http_access deny teste_lucas     http_access allow redelocal          http_access allow manager localhost     http_access deny manager     http_access allow purge localhost     http_access deny purge     http_access deny !Safe_ports     http_access deny CONNECT !SSL_ports     http_access allow localhost     http_access deny all          icp_access allow all     ####################################################################################     http_port       3128    transparent     ####################################################################################     cache_mem       256     MB     ####################################################################################     #cache_dir      ufs     /var/spool/squid 2000 32 512     cache_dir       ufs     /home/squid 5000 32 256     ####################################################################################     access_log      /var/log/squid/access.log squid     log_fqdn        on     ####################################################################################     acl QUERY urlpath_regex cgi-bin \?     cache deny QUERY     refresh_pattern ^ftp:           1440    20%     10080     refresh_pattern ^gopher:        1440    0%      1440     refresh_pattern .               0       20%     4320     ####################################################################################     acl apache rep_header Server ^Apache     broken_vary_encoding allow apache          ####################################################################################     cache_effective_user    proxy     cache_effective_group   proxy     visible_hostname        Servidor_de_Proxy     ####################################################################################     error_directory /usr/share/squid/errors/Portuguese     ####################################################################################     ignore_expect_100 on     ####################################################################################     always_direct allow all     ####################################################################################     *


shell script to append ID for newusers command

I am in the process of creating 60 users locally in a linux machine. I wanted to do it automatically and so I found I can use the newusers command to add the users in batch. I have the users and password list a text file. Currently, I have the text file in the below format.               user1:password1     user2:password2     user3:password3      However, for the newusers command, I need to have the file in the following format.               user1:password1:1011:1000:user1:/home/user1:/bin/bash      I need to modify the text file to append the UID, group ID and the user home path and the user shell. Is there an easier way than this?


Postponing ntpd

I am currently trying to cut boot time for an embedded Linux system. One way we figured we could do that is by postponing the ntp init.d script. The daemon tried to synchronize with the server via the ethernet connection. But we don't always have that connection up and it takes a long time to boot while it tries to synchronize. In our system, ntp is not crucial, so it can be started in a later time. What I wanted to do was to make the ntpd init.d script to wait for like 5 minutes but without blocking the rest of the boot operation. This is the S49 in the init.d folder I'm using:                   #! /bin/sh         #         # System-V init script for the openntp daemon         #              PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin         DESC="network time protocol daemon"         NAME=ntpd         DAEMON=/usr/sbin/$NAME         NTPDATE_BIN=/usr/bin/ntpdate              # Gracefully exit if the package has been removed.         test -x $DAEMON || exit 0              # Read config file if it is present.         if [ -r /etc/default/$NAME ]         then             . /etc/default/$NAME         fi              case "$1" in         start)             if [ -x $NTPDATE_BIN ] ; then                 echo -n "Getting initial time via ntp"                 $NTPDATE_BIN $NTPDATE_OPTS $NTPSERVERS > /dev/null 2>&1                 echo "."             fi                  echo -n "Starting $DESC: $NAME"             start-stop-daemon -S -q -x $DAEMON             echo "."             ;;         stop) echo -n "Stopping $DESC: $NAME"             start-stop-daemon -K -q -n $NAME             echo "."             ;;         reload|force-reload) echo -n "Reloading $DESC configuration..."             start-stop-daemon -K -q -n $NAME -s 1             echo "done."                 ;;         restart) echo "Restarting $DESC: $NAME"             $0 stop             sleep 1             $0 start             ;;         *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2             exit 1             ;;         esac              exit 0


Replace output occurrences

Let's say I have this output:               0001     0002     0003     0004     0005      and I want to replace the first two zeros (`00`) with (`01`). What is the simplest way to achieve this?


Why are the grsecurity patches not included in the Vanilla Kernel?

What are the reasons that `grsecurity` patches (or the security features it brings) are not included in the kernel by default. When looking at the benefits for security it seems the vanilla kernel is quite insecure as it is. If this is a trade-off (some applications where you want to avoid the security measures), it seems that `grsecurity` could be an option to enable in the vanilla kernel. With so many things in the mainstream vanilla kernel, I have a hard time understanding the reasons why the community does not want to include `grsecurity`.


Installing IPSEC on FreeBSD

how to install IPSEC on two FreeBSD 9.0 machines to can send an encrypted packets between them , and let them read the encrypted packets .


How does one indent code blocks in `ed`?

I like using `ed` for small edits. Currently I just press the spacebar manually to indent blocks of code in `ed`. Is this how the authors of UNIX indented their code in `ed`? Or is there some shortcut they used I don't know about?


USB Ports stopped working

After I locked my screen with `Ctrl``Alt``L` (KDE keyboard shortcut that locks the screen) and went away for 5 minutes all the USB devices stopped working (mouse, keyboard & headset). The devices are still disabled after reboot and I now get a load of error messages in my syslog:               Jun 13 09:30:04 robin-debian kernel: [  338.288104] hub 7-0:1.0: unable to enumerate USB device on port 1     Jun 13 09:30:04 robin-debian kernel: [  338.560074] hub 8-0:1.0: unable to enumerate USB device on port 4     Jun 13 09:30:05 robin-debian kernel: [  383.832047] usb 7-1: new full-speed USB device number 100 using uhci_hcd     Jun 13 09:30:05 robin-debian kernel: [  383.956034] usb 7-1: device descriptor read/64, error -71      These error messages keep popping up when my system is running. I've googled and searched on here and there weren't any working solutions in the results. I'm running Debian Wheezy and using KDE.


How can I tweak the kernel for total swap out?

I would like to deploy the following swapping policy:   * By default all pages in memory should also be in swap space.   * When a page in memory is changed (i.e. dirty), the page should be written out as soon as possible, but with lower priority than other processes.   * if a certain configurable watermark is reached, (let's say 80% of pages are dirty), the priority will be equal as other processes. Is this kind of swapping policy possible with the linux kernel? If so, how do I set the kernel settings to achieve this? **Edit:** Obviously the reason for this is to reduce the number of pages that need to be swapped out. Only dirty pages need to be written to disk, and this happens in the background over time. Therefore when page misses occur (i.e. the page is not in memory), there is no need to write any pages from memory to disk, but only from disk to memory. Therefore it reduced the probability of i/o bottlenecks because both swapping in and swapping out try to access the disk simultaneously.


What is the state of the Linux Standard Base?

In learning some assembly programming I have found the documents of the Linux Standard Base very useful. It seems they tell me how things are supposed to be (on standard based systems), not just how they are in the implementation I have in front of me. On the wikipedia article there are two 2005 articles linked that suggest there is contention around this standard. 2005 is a long time ago, what is the current view? (Note: just this year the linux foundation certified many distributions for LSB 4.0, so they are still in the game working with some distributions. Their press release of course does not mention any possible contention around it.)


How does one capture traffic on virtual interfaces?

I would like to capture traffic on Linux virtual interfaces, for debugging purposes. I have been experimenting with `veth`, `tun` and `dummy` interface types; on all three, I am having trouble getting `tcpdump` to show anything. Here is how I set up the dummy interface:               ip link add dummy10 type dummy     ip addr add 99.99.99.1 dev dummy10     ip link set dummy10 up      In one terminal, watch it with `tcpdump`:               tcpdump -i dummy10      In a second, listen on it with `nc`:               nc -l 99.99.99.1 2048      In a third, make an HTTP request with `curl`:               curl http://99.99.99.1:2048/      Although in terminal 2 we can see the data from the `curl` request, nothing shows up from `tcpdump`. A Tun/Tap tutorial clarifies some situations where the kernel may not actually send any packets when one is operating on a local interface: > Looking at the output of tshark, we see...nothing. There is no traffic going > through the interface. This is correct: since we're pinging the interface's > IP address, the operating system correctly decides that no packet needs to > be sent "on the wire", and the kernel itself is replying to these pings. If > you think about it, it's exactly what would happen if you pinged another > interface's IP address (for example eth0): no packets would be sent out. > This might sound obvious, but could be a source of confusion at first (it > was for me). However, it is hard to see how this could apply to TCP data packets. Maybe `tcpdump` should be bound to the interface a different way?


How do I set the password of a new user after the account has already been created?

I used the 'useradd' command to create a new account, but I did so without specifying the password. Now, when the user tries to log in, it asks him for a password. If I didn't set it up initially, how do I set the password now?


htop: Using Ctrl + n & Ctrl + p to move between processes

I'm running the latest version of `htop` through Homebrew on the latest OSX. `htop` seems to work well on my terminal (either Terminal or iTerm), but: I'm unable to use `Ctrl`+`n` and `Ctrl`+`p` to move up and down between processes.


gVim opening a tab pushes status line out of window

When opening a new tab in gVim (with `:tabe`), the status line at the bottom of the screen disappears. If I press `:` and start typing a command I can no longer see the command on the status line. When the gVim window is maximized, opening a tab pushes the status line below the screen. When the gVim window is not maximized, the window will increase in height. This problem happens in Gnome and in Xmonad. I'm looking for a way to get around this issue. Is there a way to force the window to redraw such that the status line fits inside the window?


Preventing use of `cd ..` in bash?

I have set up an alias in my .bashrc as follows: `alias u='cd ..'` All is well in my world... until I type `cd ..` and cringe that I did not use my incredible new alias. In fact, with this particular thing, it's very ingrained. Hard to change my behavior - I need serious intervention. So, I naturally tried to set up another alias to keep me from using `cd ..`: `alias 'cd ..'='echo "Use your alias!"'` But that apparently doesn't work. My thought is that this also might somehow conflict with the `u` alias, in some sort of infinite loop of aliasing. Any ideas?


rm -rf failing if deleting in parallel

`rm -rf` will fail if something tries to delete the same file tree (I think because `rm` enumerates the files first, then deletes). A simple test:               # Terminal 1     for i in `seq 1 1000`; do mkdir -p /tmp/dirtest/$i; done          # Now at teh same time in terminal 1 and 2     rm -rf /tmp/dirtest      There will be some output into stderr, e.g.:               ...     rm: cannot remove directory `/tmp/dirtest/294': No such file or directory     rm: cannot remove directory `/tmp/dirtest/297': No such file or directory     rm: cannot remove directory `/tmp/dirtest/304': No such file or directory      I can ignore all the stderr output by redirecting it to `/dev/null`, but removing of `/tmp/dirtest` actually fails! After both commands are finished, `/tmp/dirtest` is still there. How can I make `rm` delete the directory tree properly and really ignore all the errors?


Root password not working to log in to Gnome with gdm

I have a weird issue going on. I have a user account and I can login to Gnome normally. From a terminal there I can use `su root` and switch to root with my root password. However, when I try to login to Gnome as root, the same password does not work. I'm using Fedora 13 on a Dell Inspiron 6400


How to find out the content of a XML file using Unix Sed/Awk?

I have a XML file(MyXML.xml) like this :               <?xml version="1.0" encoding="UTF-8"?>     <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">         <S:Body>             <ns3:GetAllInfoFromRest xmlns:ns2="http://com.lanuk.cfe/b2_7/service/objects" xmlns:ns3="http://com.lanuk.cfe/b2_7/service/operations">                 1111,GH43567,Hamburger,GET,278598655,\n000001,                    ,Kunal,Bhyuo,Ramond,856 K. 98 Rd,                                        ,                                        ,Tripura,AGT,INDIA,856987,                    ,S,S,S,8956,\666666             </ns3:GetAllInfoFromRest>         </S:Body>     </S:Envelope>      Now i need to strip out the SOAP content and all the tag attributes from this xml and get only the string response `1111,GH43567,Hamburger,GET,278598655,\n000001, ,Kunal,Bhyuo,Ramond,856 K. 98 Rd, , ,Tripura,AGT,INDIA,856987, ,S,S,S,8956,\666666`. How can i do it with `awk` or `sed` ? I tried it in this way :               $ xgawk -lxml 'XMLATTR["xmlns:ns3"]=="http://com.lanuk.cfe/b2_7/service/operations"{print $2}' MyXML.xml      But obviously I am making some mistake due to which it is not working. Can some one suggest any other way around this ?


Building 32-Bit on a 64-Bit system

I'm trying to build the PHP memcache extension (v2.2.6) for i386 (32bit) on my x86_64 Ubuntu 11.04. `./configure` uses config.guess by default (which outputs `x86_64-unknown- linux-gnu` on my system) but I want to override that. How would I have to proceed?


Problems with a Read-Only Root Filesystem

I was creating a read-only root filesystem for use in an embedded system. I successfully got the system to boot after setting it to read-only initially, but then I needed write access to another file (/etc/hostname). I tried creating a symbolic link, like I did with /etc/fstab and /etc/resolv.conf, but the system fails to boot all the way - I have to boot into recovery mode and undo the change. Does anyone know an alternative to a symbolic link or why the link causes these problems? Edit: When I boot into recovery mode, I can see two errors right at the end before it allows me to use the command-line:               startpar: service(s) returned failure: hostname.sh udev-mtab ... failed!     sulogin: root account is locked, starting shell      I tried editing /etc/init.d/hostname.sh to read hostname from /var/network/hostname (new location of the actual file), and now it boots to a login screen. This is running CrunchBang Linux, if that makes a difference. Does this help at all?


Mount a file collection in a linux environment

I am presently working as a summer intern. My first objective is, given a collection of files, recover and identify the file types present in it. To download sample pseudo-forensics data I have been using: Digital Corpora for pseudo corpus. I am trying to mount the disk images provided in this site, they are of type E01 ,E02 etc. I have tried using the **_mount_** command in linux. I have not been successful so far. Please provide methods to mount such pseudo corpus in a linux environment.


What are the differences between the major Linux distributions?

Newbies to Linux like me often find it puzzling when there are so many different distributions like Debian, Fedora or Ubuntu. I've tried to Google some documents describing the differences between these distributions but failed to grasp the key ideas. So I'd like to know:   1. What are the major differences between these distributions?   2. Are there a specific target for each distribution? For example, which distribution would you recommend to a novice for learning the basics of Linux? Which one would you recommend to someone who really wants to learn the essences of Linux? I'm not sure whether there are duplicates of my question but I haven't found one based on a cursory Google search.


How does kernel swapping / INT 13h interrupts work?

I'm looking for a way to learn about and understand this technique. Here's what I'm talking about:   * Slax boots, {does stuff, like copy itself to RAM}, then `transitions control to the kernel/file system it just made`   * SYSLINUX boots off a FAT32/NTFS system, {does stuff}, then `boots into a kernel`   * ISOLINUX boots off a CD/DVD, {does stuff} then `boots into a kernel` Is there a name for this? Is it similar in GRUB when using chainloading?   * GRUB boots, loads selection menu, does selection. If it's a chainloading selection, it `passes control to something else`. I'm looking for how I can use one kernel to extract an .iso (from a FAT32/NTFS partition) into RAM, then boot off the RAM drive as if it had been there at startup. For more details as to why I want to do this, see this question. Here, however, I'm just asking for details about how a kernel "transitions" to another. Is there a name for this? I've heard of `INT13h` which I believe is used in GRUB/chainloading. Is this a technique to 'reboot into a different kernel'? If not, how is this done?


How to plot the output of a command

How can I plot the output of this command line with GNUPlot? What should the diagram script look like? I want a histogram.               wget -O - -o /dev/null http://www.stackoverflow.com/ |     cat | cat | sed "s/</\n</g" |     grep '<\/\{0,1\}[a-zA-Z][a-zA-Z\:\._\-]\{0,\}' |     cut -f 2 -d"<" | cut -f 1 -d">" | cut -f 1 -d" " |     sed "s/\//\\n/g" |     sort | uniq -c |     tail -n +2 |     cut -c5-


mke2fs/fsck has left mounted NTFS(hda1) drive with only a lost+found folder

I had a messed up win XP (NTFS) HD on laptop due to some registry settings being deleted. So I thought I would just boot in a live Linux CD and move repair/system to config/system. Try DSL, hda1 mounted but only with 'ro' permissions, tried loads of things but couldn't get 'rw' perms. Then tried sliax, hda1 would not mount, so googled (bad superblocks)error and found mke2fs -n or fsck (can't remember which). I ran mke2fs -n. So it ran through some procedure but I could mount hda1 in sliax but now all I can see if I mount hda1 is a lost+found folder. Have I lost all the info on the laptops HD? When I mount in DSL it's also a lost+found folder, before in DSL I could see all the contents?


How to execute a shellscript when I plug-in a USB-device

I want to execute a script when I plug in a device in my Linux machine. For example, run `xinput` on mouse or a backupscript on a certain drive. I have seen a lot of articles on this, most recently here and here. But I just can't get it to work. Here's some simple examples trying to get at least some kind of response. **/etc/udev/rules.d/test.rules**               #KERNEL=="sd*", ATTRS{vendor}=="*", ATTRS{model}=="*", ATTRS{serial}=="*", RUN+="/usr/local/bin/test.sh"     #KERNEL=="sd*", ACTION=="add", "SUBSYSTEM=="usb", ATTRS{model}=="My Book 1140    ", ATTRS{serial}=="0841752394756103457194857249", RUN+="/usr/local/bin/test.sh"     #ACTION=="add", "SUBSYSTEM=="usb", RUN+="/usr/local/bin/test.sh"     #KERNEL=="sd*", ACTION=={add}, RUN+="/usr/local/bin/test.sh"     KERNEL=="sd*", RUN+="/usr/local/bin/test.sh"     KERNEL=="*", RUN+="/usr/local/bin/test.sh"      **/usr/local/bin/test.sh**               #!/usr/bin/env bash     echo touched >> /var/log/test.log          if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]     then         echo ${DEVICE} >> /var/log/test.log     fi      The rules folder is watched by `inotify` and should be active immediately. I keep replugging my keyboard, mouse, tablet, memorystick and usb-drive, but nothing. No log file touched. Now, what would be the most simple way to at least know something is working? It's easier to work from something that's working than from something that's not.


Linux user security

When a user is created in Linux, their username can be seen publicly in the `passwd` file. Is there a hash set for that?


Chrooted sftp gives "Permission denied" error

I have configured sshd_conf on my centos box as below:               Match group pilots     ChrootDirectory /home/pilots     ForceCommand internal-sftp     X11Forwarding no     AllowTcpForwarding no      and the directory /home/pilots like this:               # ls -al /home/pilots     total 12     drwxr-x---. 3 root pilots 4096 Mar 10 14:20 .     drwxr-xr-x. 7 root root     4096 Mar 10 14:10 ..     drwxrwxr-x. 2 root pilots 4096 Mar 10 15:21 data     -rwxrwxrwx. 1 root root        0 Mar 10 14:20 topLevel     #       If I sftp in as a user in the pilots group WITHOUT the ChrootDirectory Directive enabled, I can cd to the /home/pilots folder (or a subdirectory thereof) and do a ls or get without difficulty. However, if I enable the ChrootDirectory directive, while I can still sftp in, and can cd to data, I can not do a ls or get in either directory. Trying ls, for example, gives a `remote readdir("/"): Permission denied` error, and trying to get topLevel gives `File "/topLevel" not found`. I was thinking maybe I wasn't in the directory I was expecting, but the ability to cd data would appear to indicate the chroot did work as intended. What might I be doing wrong? Couple of potentially important notes:   * The users in question exist on a remote LDAP server, accessed via sssd   * Access control must be by group, as many users will need read access to this same folder. Thus the ownership remaining root. Edit: I just noticed this in the messages log:               type=1400 audit(1394494944.504:50): avc:  denied  { read } for  pid=22758 comm="sshd" name="pilots" dev=dm-0 ino=400504 scontext=unconfined_u:system_r:chroot_user_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:home_root_t:s0 tclass=dir      So there's a record of the denial. Still doesn't tell me why though.


How to tape a video running on the screen? (screen capture)

I am trying to capture video and audio from the screen, loudspeakers and microphone. I would like to do that with a command-line command. So far, `ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg` records video, and `ffmpeg -f alsa -ac 2 -i pulse -acodec libmp3lame -ab 128k ~/Videos/outpulse.mp3` records the audio of the microphone. Both commands can be combined in: `ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 -f alsa -ac 2 -i pulse -acodec libmp3lame -ab 128k /tmp/outputFile.mpg` which records the screen and the microphone in the same file. This can be useful for tutorials. How can I adapt the command above to record from the loudspeakers? Or to record microphone + loudspeaker at the same time? For example for a VoIP session. Obviously, the audio from the loudspeakers gets taped by the microphone, but that results in a very poor sound quality. `avconv` options are also welcome, but I don't want any tool that's not standard in Linux, GUI based, or not in the repositories.


Setting up a cron for every 30 hours in Debian

*/30 */30 * * * python /root/get_top.py      I'm trying to run a script every 30 hours and 30 minutes. Is the syntax above proper for that? I've had multiple people tell me that */30 is not a valid value for the hour column, since it's greater than 24. If that's true, how do I make a cron for a job that should run every 30 hours?


Have to run partprobe at every boot

I created an LVM logical volume. I partitioned it manually. I ran `partprobe`. I found the new device in `/dev/mapper`, then I mounted it where I needed it. Everything works. ...except on reboot, obviously, the mount point is gone since I didn't update /etc/fstab. On the other hand, however, I can't just do that because the device files do not show up under /dev until I actually run `partprobe` again. How can I fix this?


Why is there a mix of symlinks and hardlinks in /bin?

I understand the technical difference between symlinks and hardlinks, this is a question about their use in practice, particularly I'm curious to know why both are used in seemingly similar conditions: the `/bin` directory. Here's a fragment its listing on my system:               ~$ ls -lai /bin     total 10508     32770 drwxr-xr-x  2 root root    4096 Jun 14 11:47 .         2 drwxr-xr-x 28 root root    4096 Sep  6 13:15 ..       119 -rwxr-xr-x  1 root root  959120 Mar 28 22:02 bash        2820 -rwxr-xr-x  3 root root   31112 Dec 15  2011 bunzip2       127 -rwxr-xr-x  1 root root 1832016 Nov 16  2012 busybox        2820 -rwxr-xr-x  3 root root   31112 Dec 15  2011 bzcat      6191 lrwxrwxrwx  1 root root       6 Dec 15  2011 bzcmp -> bzdiff      5640 -rwxr-xr-x  1 root root    2140 Dec 15  2011 bzdiff      5872 lrwxrwxrwx  1 root root       6 Dec 15  2011 bzegrep -> bzgrep      3520 -rwxr-xr-x  1 root root    4877 Dec 15  2011 bzexe      6184 lrwxrwxrwx  1 root root       6 Dec 15  2011 bzfgrep -> bzgrep      5397 -rwxr-xr-x  1 root root    3642 Dec 15  2011 bzgrep        2820 -rwxr-xr-x  3 root root   31112 Dec 15  2011 bzip2      2851 -rwxr-xr-x  1 root root   10336 Dec 15  2011 bzip2recover      6189 lrwxrwxrwx  1 root root       6 Dec 15  2011 bzless -> bzmore      5606 -rwxr-xr-x  1 root root    1297 Dec 15  2011 bzmore      I indented the hardlinks to the same inode for better visibility. So are symlinks used in case of `bzcmp`, `bzegrep`, `bzfgrep`, `bzless` and hardlinks in case of `bzip2`, `bzcat`, `bunzip2`? They are all regular files (not directories), reside inside one filesystem, are system utilities and are even made for working with the same thing: bzip archives. Are the reasons for use of hardlinks/symlinks in this particular case purely historical or am I missing something? **Clarification of my question:** I'm **not** asking about:   * The technical differences between symlinks and hardlinks   * The theoretical advantages and disadvantages each of them These questions have been addressed in other threads on SO. I'm trying to understand why different decisions were made in a specific case: for a group of related system utilities. Technically, they all could've been symlinks or they all could've been hardlinks, both options would work (and in both cases a program can still figure out how it's been invoked via `argv[0]`). I want to understand the intent here if there is any. **Related:**   * Why do hard links exist?


Location of Xorg headers on FreeBSD 10

I'm running FreeBSD 10 and I'd like to build dwm. I've installed Xorg using `pkg install`. Where are the headers located? Maybe I'm just old fashioned but I first looked in `/usr/X11R6` ... not there. Anyone has any idea where Xorg will install its headers files in FreeBSD?


Invalid signatures and packages authentication issue

I'm using LMDE 201303 and i have two issues which i need to resolve as soon as possible. I need to install certain libraries: libopus0 libopus0 The apt-get install yells the following message:               WARNING: The following packages cannot be authenticated!     libopus0 libopus0      Second issue is that once i want to do apt-get update i get the following message:               W: GPG error: http://packages.linuxmint.com debian Release: The following signatures were invalid: BADSIG 3EE67F3D0FF405B2 Clement Lefebvre (Linux Mint Package Repository v1) <root@linuxmint.com>       this is my source list:               deb http://packages.linuxmint.com/ debian main upstream import     deb http://debian.linuxmint.com/latest testing main contrib non-free     deb http://debian.linuxmint.com/latest/security testing/updates main contrib non-free     deb http://debian.linuxmint.com/latest/multimedia testing main non-freee      could anyone help a poor soul?


Linux Mint Debian quits on boot

I just upgraded Linux Mint Debian Edition with the up7 package. The update manager failed initially (can't remember where...) so I ran `sudo apt update`, `sudo apt dist-upgrade`, `sudo apt upgrade` and `sudo dpkg --configure -a`. Situation now: when I reboot and select the new kernel (3.10-2-amd64) from the grub menu, the following happens:   * This: `early console in decompress_kernel` `Decompressing kernel... Parsing ELF ... done.` `Booting the kernel.` `[<...> Could not configure common clock.`   * Linux Mint splash screen appears.   * The NVIDIA Screen appears.   * I get this error message: `FAIL: startpar: service(s) returned failure: plymouth ... failed!`   * The system quits. Sometimes the first message will be shown twice with a login prompt in between, after which the system will quit. Any ideas? I will be happy to boot into the old kernel and provide any output!


XFCE hangs with hand cursor

I am using Xubuntu 12.04 in a remote environment. Off late, I am observing that sometimes the cursor turns into a hand and stops responding. I cannot do anything to fix it. The only solution seems to be to terminate the XFCE session and re-login. I am observing this when using a remote connection. Anyone seen this or know a solution or workaround ? I am just frustrated with this problem coming up every so often. ------------- EDIT ---------------- The LD_PRELOAD method doesnt seem to work for me. Is there a command line way to generate `AllowDeactivateHold` ? ------------- EDIT ---------------- Can we use `xinput` to create the effect of `AllowDeactivateHold` ?


How to pkill from a script?

How can I write a script that basically just runs `pkill -HUP inetd`? I want to restart `inetd` via a script so I can schedule it to run at a particular time. I tried to write it myself, but I'm getting a "Hangup" error.


wubi pros and cons

Do you have experience using Wubi and if so, what are the major pros and cons ? I am of course particularly interested in potential problems.


How do you hide "Generic USB SD Reader" in nemo file manager when a card is not present?

I'm running Linux Mint 16. I have a external card reader that has CF, MS, SD, and SM readers in it as well as 3 USB ports. Is there a way to hide the card reader ports from nemo's my computer when there's no cards inserted? I know it's easy to do in windows but i don't know if it's possible in mint.


Can I mount NTFS flash drive on linux

Hi I'm using RHEL 6 an WIN 7. I have a flash drive of 16GB. To copy the files which are above 4GB size I changed it to NTFS(FAT32 is allowing only file size below 4GB). But now I am not able to use in my Linux machine. Can I mount it with out loosing data on it.


How to find which files contain mentions of a wildcard image name?

What I am trying to do is do a search on my server to find which files contain mentions of images with a certain keyword in the filename but all I can figure out is how to find the filenams (not image specific), and not the files that contain references to them. What I have tried is:               find -name *nasa*      but that's so far off what I'm looking for, any ideas?


Find largest files recursively

There seem to be a lot of entries about how to use `du` to recursively find the largest dir and files at the same time, but none on how to only recursively find the largest files in a set of directories. Basically, I am looking for a command to find the largest .mp3 files in my music library, not the directory containing the most amount of data. I'm using bash on an OSX 10.8 system.


Run ssh login command without modifying remote .bashrc

We have a bunch of servers set up with `set -o vi` in their `~/.bashrc`. It would be nice to be able to ssh into these boxes and automagically run `set -o emacs` as a timesave. I've seen a solution indicating that such additions should be made on the remote host `~/.bashrc` but we cannot modify these for various reasons. Another solution suggests using: `spawn ssh -t user@host "set -o emacs; /bin/bash -i"` ..but I understand this requires running the `expect` shell instead of plain `bash`. Is there a simple way to achieve this goal? Any suggestions would be very much appreciated.


UDEV assign ATTRS{variable} to ENV{variable}

I am writing my first udev rule. I read many how tos but can't find a way to assign `ATTRS{variable}` to `ENV{variable}` in order to have access to that variable from RUN like `RUN+="/bin/mkdir/%E{variable}"` because with `RUN+="/bin/mkdir/ATTRS{variable}"` it doesn't work. I tried to use `$ATTRS{variable}`, `%ATTRS{variable}`, `ATTR{serial}`, `$ATTR{serial}`, `%ATTR{serial}` with no success. The variable itself exists 100% thank you...


Make that only members of a group can access a specific disk

All members of group `vip` should be allowed to read,write,execute to a specific disk. Currently, only the logged in user is allowed to access such disk. What is the correct way to allow members of group `vip` to read,write,execute to a specific disk?


How to exclude given lines in syslog-ng?

I need to exclude a given line in the messages file:               Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.4 DST=192.168.202.255 LEN=238 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32776 DPT=705 LEN=218      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.6 DST=192.168.202.255 LEN=183 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32770 DPT=700 LEN=163      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.8 DST=192.168.202.255 LEN=176 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32768 DPT=714 LEN=156      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.10 DST=192.168.202.255 LEN=175 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=33628 DPT=715 LEN=155      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.30 DST=192.168.202.255 LEN=185 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32770 DPT=713 LEN=165      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.34 DST=192.168.202.255 LEN=237 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32781 DPT=704 LEN=217       they are afaik heartbeat udp messages, but they aren't needed in the logs.               # rpm -qa | grep -i syslog-ng     Security.syslog-ng-1.6.8.0-1     # uname -a     Linux SERVERNAME 2.6.5-7.325-bigsmp #1 SMP Tue Jan 18 23:36:49 UTC 2011 i686 i686 i386 GNU/Linux     # cat /etc/SuSE-release      SUSE LINUX Enterprise Server 9 (i586)     VERSION = 9     PATCHLEVEL = 4      **Q:** How can I exclude these kind of messages from the /var/log/messages?


regex find and replace 0x0D, 0x0A characters

I have a text file of a database dump with some line break characters (`0x0A0x0D`) in the middle of lines. I want to replace them with commas, but I can't do it simply, because those characters are the actual line break characters where I _do_ want line breaks! But I noticed that the line break sequences I want to keep are surrouned by space characters ( `0x20`), so I was thinking a regex to find and replace any `0x0A0x0D` sequence without a leading or trailing space. How can I do this?


Find common elements in a given column from two files and output the column values from each file

I have two files with tab-seperated values that look like this: file1:               A    1     B    3     C    1     D    4      file2:               E    1     B    3     C    2     A    9      I would like to find rows between files 1 and 2 where the string in column 1 is the same, then get the corresponding values. The desired ouput is a single file that looks like this:               B    3    3     C    1    2     A    1    9      Can this be done with a Unix one-liner?


Route HTTP traffic thorugh different interface

I have my normal `eth0` interface and an setup `ppp0` interface, the problem I have is that I want to exclusively route all HTTP/HTTPS traffic through the `ppp0` interface and everything else through the default `eth0`. I tried adding a route rule `route add default dev ppp0` but of course this will route everything through the `ppp0` interface, I might need iptables but I have no idea how.


Getting Samba on suse to work with NTFS drives

For a server with samba. I've just added (to the server, just shoved it in) an ntfs drive with some stuff and I want to access it through win7 (home edition). After a small struggle I've managed to access the server files from win7 but not the aforementioned ntfs drive. It works with but I can't log with any of the samba users. When I try to change from `%S` to a specific user or force one it just doesn't connect. Any ideas?                [NTFS drive]     comment = Samba server's NTFS disk     path = /media/sdc1     valid users = %S     read only = No     create mask = 0775     directory mask = 0775     guest ok = No


Why is '.' a hard link in Unix?

I've seen many explanations for why the link count for an empty directory in Unix based OSes is 2 instead of 1. They all say that it's because of the '.' directory, which every directory has pointing back to itself. I understand why having some concept of '.' is useful for specifying relative paths, but what is gained by implementing it at the filesystem level? Why not just have shells or the system calls that take paths know how to interpret it? That '..' is a real link makes much more sense to me -- the filesystem needs to store a pointer back to the parent directory in order to navigate to it. But I don't see why '.' being a real link is necessary. It also seems like it leads to an ugly special case in the implementation -- you would think you could only free the space used by inodes that have a link count less than 1, but if they're directories, you actually need to check for a link count less than 2. Why the inconsistency?


How to copy two files in expect script?

please advice why               spawn  scp  $FILE1   $FILE2  $LOGIN@$IP:/tmp      in my expect script copy only FILE1 and not copy FILE2 ? I try to to transfer both files by scp as                scp file1.csv file2.crt 192.8.200.1:/tmp       without expect and they transferred successfully to /tmp so why VIA expect the only file that copied is **FILE1** ?? what wrong in my syntax ? example of my expect script:                #!/usr/bin/expect -f      set FILE1  file1.csv      set FILE2  file2.crt      set multiPrompt {[#>$]}      spawn  scp  $FILE1   $FILE2  $LOGIN@$IP:/tmp                expect {                          ")?"   { send "yes\r"  ; exp_continue  }                              word:  {send $PASS\r}                        }      I also try this:               spawn  scp  "$FILE1   $FILE2"   $LOGIN@$IP:/tmp      OR               spawn  scp  '$FILE1   $FILE2'   $LOGIN@$IP:/tmp      but I get the same problem


Can I pass files between commands?

I am looking for a way to send the resulting file from one comamnd to another, So I dont have to save a copy on disk inbetween. For example, if I have `rar`ed files on disk and want to open them I would like to be able to run something like:               unrar x file.rar | kplayer          unrar x file.rar | gpg -c          gpg file.gpg | kplayer       I am sure you see what I am looking for. I have tried to get `unrar` to send to standard output with `-p` but it will just send it to screen even when I think it should be connected with a `|` to kplayer. I suppose that is because kplayer can't get it's data from stdin. But is there a way to pass files without saving them on disk? Is the best I can get to create a filesystem in memory and use that, I don't like the idea to reserve that much memory though.


How do I share stdout between multiple processes?

I want to receive live TCP stream, and make it readable by another processes at the same time, without saving it. For example, 111.222.233.244:1234 streams actual time. Server supports only one connection. TTY1:               $ nc 111.222.233.244 1234 | (do something here) /tmp/tcpstream &     $ sleep 5 # stream is received even if there is no process that reads it     $ cat /tmp/tcpstream # it can also be like `(some command) | cat -`     17:00:06     17:00:07     17:00:08     17:00:09     17:00:10     17:00:11      TTY2 (second `cat` executed 9 seconds after executing `nc`):               $ cat /tmp/tcpstream     17:00:09     17:00:10     17:00:11


Previous login notification

I am using CentOS 6. How can I configure it so the system notifies the user, upon successful login, of the date and time of the last login? Is that possible?


getting "bad init string" when dialing with wvdial

I'm trying to dial-up with my Huawei modem EM680 using wvdial. My modem is found properly on `/dev/ttyUSB1` but when I execute wvdial I get this:               # wvdial     --> WvDial: Internet dialer version 1.61     --> Cannot get information for serial port.     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 +FCLASS=0     ATQ0 V1 E1 +FCLASS=0     OK     --> Sending: AT+CGDCONT=1,"IP","m2mstatic.apn"     AT+CGDCONT=1,"IP","m2mstatic.apn"     ERROR     --> Bad init string.     --> Cannot get information for serial port.     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 +FCLASS=0     ATQ0 V1 E1 +FCLASS=0     OK     --> Sending: AT+CGDCONT=1,"IP","m2mstatic.apn"     AT+CGDCONT=1,"IP","m2mstatic.apn"     ERROR     --> Bad init string.     --> Cannot get information for serial port.     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 +FCLASS=0     ATQ0 V1 E1 +FCLASS=0     OK     --> Sending: AT+CGDCONT=1,"IP","m2mstatic.apn"     AT+CGDCONT=1,"IP","m2mstatic.apn"     ERROR     --> Bad init string.     #       Why does it say `bad init string.`? My `/etc/wvdial.conf` looks like this:               [Dialer Defaults]     Init1 = ATZ     Init2 = ATQ0 V1 E1 +FCLASS=0     Init3 = AT+CGDCONT=1,"IP","m2mstatic.apn"     Stupid Mode = yes     Modem Type = Analog Modem     ISDN = 0     New PPPD = yes     Phone = *99#     Modem = /dev/ttyUSB1     Username = ;     Password = ;     Baud = 9600


How do I correct a directory incorrectly copied into itself?

Given the following situation...               <path>/mydir1/mydir2      ...where mydir2 _should have_ overwritten mydir1, but was instead placed inside, and both directories actually have the same filename. How is that fixed? Attempting to do `mv <path>/mydir/mydir/* <path>/mydir/` or `mv <path>/mydir <path>/` results in:               mv: cannot move `<path>/mydir/mydir` to a subdirectory of itself, `<path>/mydir`      This seems stupidly simple, but it's late here and I can't figure it out. There are seventeen such directories to fix (path differs for each, but same mydir name).    To confirm, the error message can be caused with this:               # cd /path/to/directory     # mv mydir/mydir ./     mv: cannot move `mydir/mydir' to a subdirectory of itself, `./mydir'      Also tried:               # mv mydir/mydir/* mydir/     mv: cannot move `mydir/mydir/otherdir1' to a subdirectory of itself, `mydir/otherdir1'     mv: cannot move `mydir/mydir/otherdir2' to a subdirectory of itself, `mydir/otherdir2'      and...               # mv /path/to/directory/mydir/mydir/otherdir1 /path/to/directory/mydir/     mv: cannot move `/path/to/directory/mydir/mydir/otherdir1' to a subdirectory of itself, `/path/to/directory/mydir/otherdir1'      and using a temporary directory:               # mv mydir/mydir ./mydir-temp     # mv mydir-temp/* mydir/     mv: cannot move `mydir-temp/otherdir1' to a subdirectory of itself, `mydir/otherdir1'     mv: cannot move `mydir-temp/otherdir2' to a subdirectory of itself, `mydir/otherdir2'         I found a similar question "How to recursively move all files (including hidden) in a subfolder into a parent folder in *nix?" which suggested that `mv bar/{,.}* .` would do this. But this also gives the same errors, as well as confusingly picking up `.` and `..` from somewhere.               # cd mydir     # mv mydir/{,.}* .     mv: cannot move `mydir/otherdir1' to a subdirectory of itself, `./otherdir1'     mv: cannot move `mydir/otherdir2' to a subdirectory of itself, `./otherdir2'     mv: cannot move `mydir/.' to `./.': Device or resource busy     mv: cannot move `mydir/..' to `./..': Device or resource busy     mv: overwrite `./.file'? y         Another similar question "linux mv command weirdness" suggests that `mv` doesn't overwrite and a copy is required.               # cd mydir     # cp -rf ./mydir/* ./     cp: overwrite `./otherdir1/file1'? y     cp: overwrite `./otherdir1/file2'? y     cp: overwrite `./otherdir1/file3'?      This appears to be working... except there's a lot of files (and dirs) - I don't want to confirm every one! Isn't the `f` there supposed to prevent this? Ok, so `cp` was aliased to `cp -i` (which I found out with `type cp`), and bypassed by using `\cp -rf ./mydir/* ./` which seems to have worked. **Although I've solved the problem of getting dirs/files from one place to another, I'm still curious as to what's going on with the`mv` stuff - is this really a deliberate feature as suggested by Warner?**


How to delete line with echo?

I know that I could delete the last three chars with:               echo -ne '\b\b\b'      But how can I delete a full line? I mean I dont want to use:               echo -ne '\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b'      ...etc... to delete a long line..


How to create reverse-lookup file for BIND that points to some networks?

I am try to create a reverse-lookup file in BIND, but I need it to point to many networks not just one. I have three networks that connected to the same bind server, `192.168.3` and `192.168.4` and `192.168.1`. I would like that in one reverse-lookup file I could refer to all of the clients at the three networks. Currently I have no idea on how to write that zone file, what I have is:               168.192.in-addr.arpa. SOA dns1.mynetwork.unix admin.mynetwork.unix     1.4.168.192 IN PTR  dns1.mynetwork.unix      11.3  IN PTR client.mynetwork.unix      When I start the bind server, it gives me an error message on the log file at `/var/log/messeges/` that says: `loading from master file named.168.192 faild: not a valid number` I have omitted the other unrelated (IMO) stuff from the configuration file. To sum it up, i would concise the question to be, is it possible to create a reverse dns file (in bind) that can point to a different networks ? if yes what do i need to change in the example above ?


Creating Menu list and Executing the Task

I was given the the Task to create a menu in Linux but it appears it's not coming out great. When I select something I want to be able to perform that task then go back to the main menu when I finish.               #!/bin/bash          PS3='What do you want to do day: '     options=("Create Group" "Delete Group" "Create User 3" "Delete User" "Quit")     select opt in "${options[@]}"     do         case $opt in             "Create Group")                 echo "You chose Create Group 1"                 ;;             "Delete Group")                 echo "You chose to Delete Group"                 ;;             "Create User")                 echo "You chose to Create User"                 ;;             "Delete User")                 echo "You choose to Delete User"                 ;;             "Quit")                 break                 ;;             *) echo invalid option;;         esac     done


python == python2 OR python == python3 ? How to package, distribute python py2k scripts?

Depending on system, `python`==`python2` or `python`==`python3`. Executable Python scripts, starts with:               #!/usr/bin/env python     #!/usr/bin/env python2     #!/usr/bin/env python3...      For python py3k it is provided in documentation I should/can use it with version number, so I do this:               #!/usr/bin/env python3      But I've found a problem with py2k scripts. While in py2k documentation it is written to use : `#! /usr/bin/env python` , on some *nix-es python py3k is default, so python==python3. (For example ArchLinux python package , here python package files). **How to package (configure,make) and/or prepare python scripts for distribution to handle that ?** _I ask about making software packages that can be run easily by users (without modyfing their environment)_ Can I do the same trick for python py2k scripts as for python py3k scripts and set it as : `#!/usr/bin/env python2` ? Can I be sure that each python py2k distribution contains `python2` file, so `#!/usr/bin/env python2` will work ? If yes, why it is not proposed as standard, for example in python py2k documentation ?


Creating UDF image in Linux

It's embarrassing to imagine that there are no intelligent tools on Linux to create UDF images, similar to `makeisofs`, but I have yet to find any. The tool `genisoimage` does work for creating video disk images, but there is no equivalent for general data. Is the Linux toolset really so deficient when it comes to optical disc tools? I've already seen this and the accepted answer simply isn't sufficient.


Why mkdir -p /Local/Foo/Bar/Wah not work but cd /Local and mkdir -p Foo/Bar/Wah works?

I am trying to create a local folder in my local development machine, on Mac OS X Mountain Lion, so I did:               sudo mkdir /Local     sudo chmod 777 /Local     mkdir -p /Local/Foo/Bar/Wah      (note that last line has no `sudo`) but the last line gives an error:               $ mkdir –p /Local/Foo/Bar/Wah     mkdir: –p: File exists     mkdir: /Local/Foo/Bar: No such file or directory      Is it some sort of bug? I could instead do:               cd /Local     mkdir -p Foo/Bar/Wah      and it works. Why? And if it is for the reason that it tried to `mkdir /Local` first but can't because the superuser already did it, then won't this be a bug? (that it should just accept the fact that `/Local` is there and start mkdir from `Foo` and go down to `Bar` and `Wah`).


How to debug ~/.forward

How can I debug `~/.forward` file or see errors logged by mail agent on it **without root privileges**? I'm trying to process my mail with procmail. When I invoke procmail manually with               procmail < testMailFile      it works as expected (my procmail rule logs input to a file). When no ~/.forward file is present all mail goes to my default mailbox /var/mail/$USER and ~/.procmailrc **is not processed**. When I create ~/.forward with:               "|exec /usr/bin/procmail || exit 75"      mail stops coming but `.procmailrc` **is still not processed**.               $ lsb_release -a|grep Desc     Description:    CentOS release 5.10 (Final)     $ rpm -q exim     exim-4.63-10.el5


Bash autocompletion for an environment variable holding a directory name

I'm using, among other things, bash 4.2.37 on Linux Mint 14. When I autocomplete the name of an environment variable by typing `Tab`, it expands to the name of the variable followed by a space. If the value of the variable happens to be a directory name, I want it to expand to the name of the variable followed by `/`. For example, if I type:               $ ls $HOM<tab>      it expands to:               $ ls $HOME _      where `_` marks the location of the cursor. The problem is that I then usually want to continue typing the name of some file or directory under my home directory, which means I have to type `backspace` and then `/`. So I _want_ the above to expand to:               $ ls $HOME/_      The same thing happens when I've typed the entire variable name; after `ls $HOME`, `tab` adds a space, and I want it to add a `/`. (And of course I don't want it to add a `/` if the variable's value is not a directory name.) Is there some way I can tell bash to behave the way I want, either via bash commands or by updating my `$HOME/.inputrc`? Note: I'm specifically looking for a way to make `tab` behave the way I want. Ways to achieve the same behavior with different keystrokes would be interesting, but would not answer my question. (I've disabled `/etc/profile.d/bash_completion.sh` on my system because it interacts poorly with `set -o nounset`. A quick experiment indicates that this is probably not relevant to my question.) Incidentally, tcsh does this: given an environment variable `$FOOBAR`, typing `$FOOBA<tab>` expands to `$FOOBAR/` if it refers to a directory, `$FOOBAR` (with a space) if it doesn't. No, that's not enough to persuade me to go back to tcsh. zsh does this as well.


why do I need to patch linux kernel to use pandaboard's spi?

I believe this question is a bit more general but here is how it goes : I have read this article about using pandaboard's SPI, especially the part "Configuring and patching the kernel". It says that you have to edit the driver to use the SPI, by telling the driver what bus you want to use, and I don't really understand why we would need to do so. If we are compiling the kernel, we specify the `arch` (`omap...`) and so I guess that since the toolchain knows what is the target processor, it knows what are the pin numbers of the SPI (clock, miso, mosi, ...). So what am I missing here ? Why do we need extra configuration ?


How do I set dhclient debug info on?

On a FreeBSD computer Is there a DHCP client log that I could use to debug a DHCP issue? Can I set a debug param to get more information from the dhclient? UPDATE 1: I found a lead on this article handy tools for debugging DHCP on linux but that's on Linux (dhcping, dhcpdump), and I don't have these on my FreeBSD, I won't be able to install them. UPDATE 2: tcpdump -lenx -i eth0 -s 1500 port bootps


Need to remove lines till a pattern is matched

My C code needs to decode some application data that were received over a socket by another application. I used the Wireshark to export the packets(many) into a C array. But the array carries all bytes comprising IP address/Port. I just need the application data. The C array is:               static const unsigned char pkt64[393] = {     0x00, 0x04, 0x00, 0x01, 0x00, 0x06, 0xd8, 0x9d, /* ........ */     0x67, 0x16, 0x55, 0xc0, 0x00, 0x00, 0x08, 0x00, /* g.U..... */     0x45, 0x00, 0x01, 0x79, 0xf1, 0x09, 0x40, 0x00, /* E..y..@. */     0x40, 0x06, 0xc1, 0xee, 0x0a, 0x17, 0x6f, 0x35, /* @.....o5 */     0x0a, 0xd7, 0x02, 0x64, 0xe3, 0xa4, 0x18, 0x54, /* ...d...T */     0x8c, 0xa2, 0xd6, 0xb1, 0xe9, 0xa5, 0x0c, 0xd2, /* ........ */     0x80, 0x18, 0x14, 0x12, 0x87, 0xf2, 0x00, 0x00, /* ........ */     0x01, 0x01, 0x08, 0x0a, 0x4a, 0x0c, 0x9a, 0x21, /* ....J..! */     0x94, 0x8d, 0xb2, 0x23, 0x01, 0x43, **0x60, 0x00,** /* ...#.C`. */     **0x06, 0x00** , 0x58, 0x6f, 0x12, 0x00, 0x30, 0x30, /* ..Xo..00 */     0x47, 0x00, 0x20, 0xe2, 0x82, 0x19, 0x00, 0x10, /* G. ..... */     0x10, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x95, /* ........ */     0x42, 0x38, 0x14, 0x04, 0x24, 0x11, 0x57, 0x14, /* B8..$.W. */     0x58, 0x12, 0x30, 0x30, 0x11, 0x00, 0x40, 0x00, /* X.00..@. */     [...]     0x39, 0x38, 0x35, 0x2d, 0x31, 0x31, 0x37, 0x00, /* 985-117. */     0x03, 0x14, 0x10, 0x00, 0x00, 0x03, 0x28, 0x00, /* ......(. */     0x01, 0x19, 0x95, 0xe2, 0xcf, 0x53, 0x13, 0xa2, /* .....S.. */     0xd5                                            /* . */     };      My application data starts with the bytes `0x60, 0x00, 0x06, 0x00`. So I need to delete all lines and bytes up to the the application data of interest. Since I have many packets to be decoded, how do I use grep/sed to achieve my requirement?


Job started by procmail does not appear in ps-output and cannot be stopped, even not after reboot

For testing purposes I called procmail by my .forward file `|/usr/bin/procmail` and by the rules in .procmailrc it started a job named "start", which was simply an infinite loop               while true     do      date>>logfile      sleep 300     done      To my surprise this job (or anything else related to procmail or .forward) does not appear as a separate process in the output of ps -ef (not as my own process and not as that of anybody else), so I cannot kill it and it writes one timestamp each 5 minutes into the log. Even deleting the shell script does not work, obviously it is already in memory and does not need to be read again. Now I thought, at least the job will terminate after a reboot, but it didn't. The only thing I can do for stopping the output is making the logfile unwritable to all, but even then the job continues to run (I see it when I make the file readable again). Now my question is: How can I kill this script as non-root user? Or if not at all: What did I do wrong? How do I have to call a script by procmail to show up in the ps-output and (more important) to make it killable for me? I have no root access to the machine, but I have physical access, so I can restart it. The OS seems to be x86_64-suse-linux, uname -a shows Linux 3.11.10-7-default #1 SMP. My shell is bash. @Anthon: mailq shows an empty mail queue. Renaming start, .procmailrc and .forward does not change anything. @EightBitTony:               nameofpc:~ > ps -ef     UID        PID  PPID  C STIME TTY          TIME CMD     root         1     0  0 Apr24 ?        00:00:13 /sbin/init showopts     root         2     0  0 Apr24 ?        00:00:00 [kthreadd]     root         3     2  0 Apr24 ?        00:00:00 [ksoftirqd/0]     root         5     2  0 Apr24 ?        00:00:00 [kworker/0:0H]     root         7     2  0 Apr24 ?        00:00:00 [migration/0]     root         8     2  0 Apr24 ?        00:00:00 [rcu_bh]     root         9     2  0 Apr24 ?        00:00:00 [rcuob/0]     root        10     2  0 Apr24 ?        00:00:00 [rcuob/1]     root        11     2  0 Apr24 ?        00:00:00 [rcuob/2]     root        12     2  0 Apr24 ?        00:00:00 [rcuob/3]     root        13     2  0 Apr24 ?        00:00:11 [rcu_sched]     root        14     2  0 Apr24 ?        00:00:07 [rcuos/0]     root        15     2  0 Apr24 ?        00:00:04 [rcuos/1]     root        16     2  0 Apr24 ?        00:00:04 [rcuos/2]     root        17     2  0 Apr24 ?        00:00:03 [rcuos/3]     root        18     2  0 Apr24 ?        00:00:01 [watchdog/0]     root        19     2  0 Apr24 ?        00:00:01 [watchdog/1]     root        20     2  0 Apr24 ?        00:00:00 [migration/1]     root        21     2  0 Apr24 ?        00:00:00 [ksoftirqd/1]     root        23     2  0 Apr24 ?        00:00:00 [kworker/1:0H]     root        24     2  0 Apr24 ?        00:00:01 [watchdog/2]     root        25     2  0 Apr24 ?        00:00:00 [migration/2]     root        26     2  0 Apr24 ?        00:00:00 [ksoftirqd/2]     root        28     2  0 Apr24 ?        00:00:00 [kworker/2:0H]     root        29     2  0 Apr24 ?        00:00:01 [watchdog/3]     root        30     2  0 Apr24 ?        00:00:00 [migration/3]     root        31     2  0 Apr24 ?        00:00:00 [ksoftirqd/3]     root        33     2  0 Apr24 ?        00:00:00 [kworker/3:0H]     root        34     2  0 Apr24 ?        00:00:00 [khelper]     root        35     2  0 Apr24 ?        00:00:00 [kdevtmpfs]     root        36     2  0 Apr24 ?        00:00:00 [netns]     root        37     2  0 Apr24 ?        00:00:00 [writeback]     root        38     2  0 Apr24 ?        00:00:00 [kintegrityd]     root        39     2  0 Apr24 ?        00:00:00 [bioset]     root        40     2  0 Apr24 ?        00:00:00 [kblockd]     root        41     2  0 Apr24 ?        00:00:00 [ata_sff]     root        42     2  0 Apr24 ?        00:00:00 [md]     root        44     2  0 Apr24 ?        00:00:00 [khungtaskd]     root        45     2  0 Apr24 ?        00:00:00 [kswapd0]     root        46     2  0 Apr24 ?        00:00:00 [ksmd]     root        47     2  0 Apr24 ?        00:00:01 [khugepaged]     root        48     2  0 Apr24 ?        00:00:00 [fsnotify_mark]     root        49     2  0 Apr24 ?        00:00:00 [crypto]     root        54     2  0 Apr24 ?        00:00:00 [kthrotld]     root        55     2  0 Apr24 ?        00:00:00 [scsi_eh_0]     root        56     2  0 Apr24 ?        00:00:00 [scsi_eh_1]     root        57     2  0 Apr24 ?        00:00:00 [scsi_eh_2]     root        58     2  0 Apr24 ?        00:00:00 [scsi_eh_3]     root        59     2  0 Apr24 ?        00:00:00 [scsi_eh_4]     root        60     2  0 Apr24 ?        00:00:00 [scsi_eh_5]     root        68     2  0 Apr24 ?        00:00:00 [kpsmoused]     root        72     2  0 Apr24 ?        00:00:01 [kworker/0:1H]     root        73     2  0 Apr24 ?        00:00:00 [deferwq]     root       114     2  0 Apr24 ?        00:00:00 [kmpath_rdacd]     root       141     2  0 Apr24 ?        00:00:00 [khubd]     root       151     2  0 Apr24 ?        00:00:00 [kworker/1:1H]     root       152     2  0 Apr24 ?        00:00:00 [kworker/2:1H]     root       154     2  0 Apr24 ?        00:00:00 [kworker/3:1H]     root       220     2  0 Apr24 ?        00:00:00 [jbd2/sda5-8]     root       221     2  0 Apr24 ?        00:00:00 [ext4-rsv-conver]     root       222     2  0 Apr24 ?        00:00:00 [ext4-unrsv-conv]     root       260     1  0 Apr24 ?        00:00:11 /usr/lib/systemd/systemd-journald     root       261     2  0 Apr24 ?        00:00:00 [kauditd]     root       296     1  0 Apr24 ?        00:00:00 /usr/lib/systemd/systemd-udevd     root       381     2  0 Apr24 ?        00:00:00 [irq/46-mei_me]     root       382     2  0 Apr24 ?        00:00:00 [hd-audio0]     root       387     2  0 Apr24 ?        00:00:00 [kvm-irqfd-clean]     root       426     2  0 Apr24 ?        00:00:00 [jbd2/sda7-8]     root       427     2  0 Apr24 ?        00:00:00 [ext4-rsv-conver]     root       428     2  0 Apr24 ?        00:00:00 [ext4-unrsv-conv]     root       430     2  0 Apr24 ?        00:00:00 [jbd2/sda9-8]     root       431     2  0 Apr24 ?        00:00:00 [ext4-rsv-conver]     root       432     2  0 Apr24 ?        00:00:00 [ext4-unrsv-conv]     root       438     2  0 Apr24 ?        00:00:01 [jbd2/sda6-8]     root       439     2  0 Apr24 ?        00:00:00 [ext4-rsv-conver]     root       440     2  0 Apr24 ?        00:00:00 [ext4-unrsv-conv]     avahi      624     1  0 Apr24 ?        00:01:38 avahi-daemon: running [fphct03.local]     root       625     1  0 Apr24 ?        00:00:00 /sbin/rpcbind -w -f     nscd       628     1  0 Apr24 ?        00:00:07 /usr/sbin/nscd --foreground     message+   631     1  0 Apr24 ?        00:00:10 /bin/dbus-daemon --system --address=systemd: --     root       642     1  0 Apr24 ?        00:00:04 /usr/lib/systemd/systemd-logind     root       644     1  0 Apr24 ?        00:00:07 /usr/local/natinst/nisvcloc/bin/nisvcloc -D     root       647     1  0 Apr24 ?        00:00:03 /usr/sbin/rsyslogd -n     root      1233     1  0 Apr24 ?        00:00:00 /usr/sbin/sshd -D     root      1241     1  0 Apr24 ?        00:00:01 /usr/sbin/ypbind -n -no-dbus     root      1246     2  0 Apr24 ?        00:00:00 [rpciod]     root      1247     2  0 Apr24 ?        00:00:00 [nfsiod]     root      1255     1  0 Apr24 ?        00:00:00 /usr/sbin/rpc.gssd -D -p /var/lib/nfs/rpc_pipef     root      1261     1  0 Apr24 ?        00:00:00 /usr/sbin/rpc.idmapd -p /var/lib/nfs/rpc_pipefs     root      1264     2  0 Apr25 ?        00:00:00 [kworker/u8:2]     root      1276     2  0 Apr24 ?        00:00:00 [nfsv4.0-svc]     root      1298     1  0 Apr24 tty1     00:00:00 /sbin/agetty --noclear tty1 linux     ntp       1319     1  0 Apr24 ?        00:00:11 /usr/sbin/ntpd -p /var/run/ntp/ntpd.pid -g -u n     root      1351     1  0 Apr24 ?        00:00:00 /usr/bin/kdm     root      1395     1  0 Apr24 ?        00:00:29 /usr/bin/python /usr/sbin/denyhosts --daemon --     root      1437     1  0 Apr24 ?        00:00:00 /usr/lib/postfix/master     root      1450     1  0 Apr24 ?        00:00:00 /usr/sbin/cron -n     postfix   1460  1437  0 Apr24 ?        00:00:00 qmgr -l -t fifo -u     root      1633     1  0 Apr24 ?        00:00:02 /usr/lib/upower/upowerd     polkitd   1638     1  0 Apr24 ?        00:00:09 /usr/lib/polkit-1/polkitd --no-debug     root      1678     1  0 Apr24 ?        00:00:41 /usr/lib/udisks2/udisksd --no-debug     rtkit     1748     1  0 Apr24 ?        00:00:02 /usr/lib/rtkit/rtkit-daemon     root      1777     1  0 Apr24 ?        00:00:00 /usr/lib/bluetooth/bluetoothd     root      1789     1  0 Apr24 ?        00:00:00 /usr/lib/systemd/systemd-hostnamed     root      1979  1351  0 Apr25 tty7     00:00:48 /usr/bin/Xorg -br :0 vt7 -nolisten tcp -auth /v     root      1987  1351  0 Apr25 ?        00:00:00 -:0     kdm       1988  1987  0 Apr25 ?        00:02:09 /usr/lib64/kde4/libexec/kdm_greet     root     17533     2  0 Apr26 ?        00:00:00 [kworker/u8:1]     root     21461     2  0 08:20 ?        00:00:00 [kworker/2:1]     root     22873     2  0 12:10 ?        00:00:00 [kworker/1:1]     postfix  23129  1437  0 12:47 ?        00:00:00 pickup -l -t fifo -u     root     23171     2  0 12:50 ?        00:00:00 [kworker/2:2]     root     23266     2  0 13:05 ?        00:00:00 [kworker/3:1]     root     23300     2  0 13:11 ?        00:00:00 [kworker/0:2]     root     23393     2  0 13:20 ?        00:00:00 [kworker/3:2]     root     23407     2  0 13:22 ?        00:00:00 [kworker/0:0]     root     23428     2  0 13:26 ?        00:00:00 [kworker/1:0]     root     23481  1233  0 13:34 ?        00:00:00 sshd: myuserid [priv]     myuserid    23484     1  0 13:34 ?        00:00:00 /usr/lib/systemd/systemd --user     myuserid    23485 23484  0 13:34 ?        00:00:00 (sd-pam)     myuserid    23486 23481  0 13:34 ?        00:00:00 sshd: myuserid@pts/2     myuserid    23487 23486  0 13:34 pts/2    00:00:00 -bash     root     23547     2  0 13:35 ?        00:00:00 [kworker/2:0]     root     23561     2  0 13:35 ?        00:00:00 [kworker/0:1]     myuserid    23595 23487  0 13:37 pts/2    00:00:00 ps -ef     nameofpc:~ >      @tripleee: .procmailrc (yes, I know that there is some garbage in) was something like               # .procmailrc     # routes incoming mail to appropriate mailboxes     PATH=/usr/local/bin:/usr/bin:/bin     MAILDIR=$HOME/.mailspool   # all mailboxes are in .mailspool/     #DEFAULT=$HOME/.mailspool/mbox     DEFAULT=/var/spool/mail/myuserid     LOGFILE=/dev/null     SHELL=/bin/bash     {     :0     * ^From myemail@myexternalfreemailprovider\.com     {      :0      | /home/myuserid/start >/dev/null     }     }      If you ask why I need this: I want to make sure each time I get mail at my external freemail account, that a job (let's call it payload.sh) on the host (which has no `cron` and no `at`) is run once every 6 hours. So I forward the mail from my external mail account to the host, where procmail starts my script "start" each time a new mail arrives. And in "start" I would check if an earlier "start" script is still running. If yes, then exit the new, second "start", if not (probably due to a shut down of the host), then "start" will call payload.sh every 6 hours. If you know a simpler solution for this problem then feel free to write it here.


Automatically run rfkill unblock on startup

I'm running Elementary OS on an old(er) HP Pavilion dm1. Unfortunately, on startup my wireless is hard disabled, and I need to run `sudo rfkill unblock all` to get it up and running. Works fine once I do though. Is there any way to either: 1) Automatically run this line with startup 2) Not need to do this anymore? When I use rfkill to view any blocks, there's a hard block on the wireless, and the wireless button's light is orange. Pressing the button does nothing. After running the line, I can switch wireless on and off at will. Please help!


SSH to machines in new subnet - connection timeout

I'm using RHEL4 and RHEL5. A new group of Linux machines are setup recently using 172.16.32.0/24. The existing RHEL machines are running on 172.16.1.0/22 and 172.16.4.0/22. When I try to ssh from 172.16.4.39 to 172.16.1.1, there's no problem.               > traceroute 172.16.1.156     traceroute to 172.16.1.156 (172.16.1.156), 30 hops max, 46 byte packets      1  swt0 (172.16.4.240)  1.396 ms  1.380 ms  1.758 ms      2  172.16.1.156 (172.16.1.156)  579.076 ms  573.315 ms  574.878 ms      If I ssh to any one of the new machine, I get ssh timeout, although I can traceroute to it.               > traceroute 172.16.32.11     traceroute to 172.16.32.11 (172.16.32.11), 30 hops max, 46 byte packets      1  swt0 (172.16.4.240)  5.968 ms  1.641 ms  1.476 ms      2  * * *     <----- could be misconfiguration, not sure how to troubleshoot this.      3  172.16.32.11 (172.16.32.11)  273.330 ms  271.820 ms  274.223 ms          > ssh -v -v -v 172.16.32.11     OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to 172.16.32.11 [172.16.32.11] port 22.     debug1: connect to address 172.16.32.11 port 22: Connection timed out     ssh: connect to host 172.16.32.11 port 22: Connection timed out      I added a similar route on both the switch (swt0) and firewall to point 172.16.32.0/24 to the same gateway 172.16.5.253. Also added a new line in hosts.allow file on 172.16.4.39 (the machine where I try to ssh from).               > cat /etc/hosts.allow     ALL: 127.0.     ALL: 172.16.0.0/255.255.252.0     ALL: 172.16.4.0/255.255.252.0     ALL: 172.16.24.0/255.255.252.0     ALL: 172.16.32.0/255.255.255.0      Any advice what other files I should check/change to make ssh work between 172.16.4.0/22 172.16.32.0/24? Output of ping and `route -n`:               > route -n     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     172.16.4.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0     0.0.0.0         172.16.4.240    0.0.0.0         UG    0      0        0 eth0          > ping 172.16.32.11     PING 172.16.32.11 (172.16.32.11) 56(84) bytes of data.     64 bytes from 172.16.32.11: icmp_seq=0 ttl=62 time=269 ms     64 bytes from 172.16.32.11: icmp_seq=1 ttl=62 time=259 ms     64 bytes from 172.16.32.11: icmp_seq=2 ttl=62 time=269 ms     64 bytes from 172.16.32.11: icmp_seq=3 ttl=62 time=268 ms          --- 172.16.32.11 ping statistics ---     4 packets transmitted, 4 received, 0% packet loss, time 3005ms     rtt min/avg/max/mdev = 259.331/266.884/269.777/4.408 ms, pipe 2


How to get proccesses currently running semaphores by /proc?

I wonder how to get processes currently running semaphores by `/proc` ? I guess it's possible by SysVIPC subdirectory.But I don't know how to use this commands. Ubuntu 12.10


CPU usage of KVM

I have a linux host with 4 KVM linux guests. All the guest are pretty much idle, having a load of <0.1 inside the guest. Now, if I do a `top` on the host, each KVM process is using something about 30% of the CPU. Is this a normal behavior? I would expect the host to need much less CPU just to host a idle guest. If it is normal, what is the reason for this? If it is not normal, what might be the problem?


apply bash function to parent scope

I can to define function in bash and use it:               foo() { echo $1; }     foo test      But if I want to collect my functions in one bash script all its unavailable: init.bash               #!/bin/bash     foo() { echo $1; }       export -f foo # This not helps      Using:               ./init.bash && foo test # error here      Is there any way to export script's functions to parent scope?   Without writing to `.bashrc`, it's too global   Same as `.bashrc` but for current bash instance only...


How to enable passwordless auth to remote server as a different user?

This may seem quite trivial but what I've done doesn't seem to solve the problem. I'm connecting to a remote server as `tom` who (obviously) exists on the remote server but not the local server. I copied the `id_rsa.pub` key generated for local user `bob` onto tom's `authorized_keys` file on the remote server. However, I'm still being prompted for the password.               [bob@localserver ~]$ ssh tom@remoteserver      I suspect I'm doing something wrong. Can someone assist? Thanks. **EDIT 1** Just for completeness I also regenerated the the key and copying it to the remote server.               ssh-keygen -t rsa     ssh-copy-id -i tom@REMOTESERVER      See debug output here: ssh debug details I noticed the following in the debug output. This is present for every line (base64 block?) in my `id_rsa` private key file:               debug3: key_read: missing whitespace      **EDIT 2:** Remote server's permissions:               drwx------ 2 tom tom 4096 Aug 15 10:59 .     drwx------ 5 tom tom 4096 Aug 15 11:54 ..     -rw-rw-r-- 1 tom tom  810 Aug 15 10:59 authorized_keys     -rwx------ 1 tom tom  109 Aug 14 09:43 config     -rw------- 1 tom tom 1675 Aug  8 14:58 id_rsa     -rw-r--r-- 1 tom tom  404 Aug  8 14:58 id_rsa.pub     -rw-r--r-- 1 tom tom 1217 Aug 10 09:32 known_hosts      Local server's permissions:               drwx------ 2 bob bob 4096 Aug 15 11:32 .     drwx------ 7 bob bob 4096 Aug 15 11:32 ..     -rw------- 1 bob bob 1613 Aug 15 11:09 id_rsa     -rw------- 1 bob bob 1675 Aug 15 11:08 id_rsa.bkp     -rw-r--r-- 1 bob bob  405 Aug 15 10:58 id_rsa.pub     -rw-r--r-- 1 bob bob  410 Aug 15 10:59 known_hosts


Why doesn't "ping -vrf" works when ping works?

0:root@SERVER:/root # ping IPADDRESS     PING IPADDRESS (IPADDRESS): 56 data bytes     64 bytes from IPADDRESS: icmp_seq=0 ttl=254 time=0 ms     64 bytes from IPADDRESS: icmp_seq=1 ttl=254 time=0 ms     64 bytes from IPADDRESS: icmp_seq=2 ttl=254 time=0 ms     ^C     --- IPADDRESS ping statistics ---     3 packets transmitted, 3 packets received, 0% packet loss     round-trip min/avg/max = 0/0/0 ms     0:root@SERVER:/root # ping -vrf IPADDRESS     PING IPADDRESS (IPADDRESS): 56 data bytes     ping: sendto: Network is unreachable     ping: wrote IPADDRESS 64 chars, ret=-1     .ping: sendto: Network is unreachable     ping: wrote IPADDRESS 64 chars, ret=-1     .ping: sendto: Network is unreachable     ping: wrote IPADDRESS 64 chars, ret=-1     .ping: sendto: Network is unreachable     ping: wrote IPADDRESS 64 chars, ret=-1     .ping: sendto: Network is unreachable     ping: wrote IPADDRESS 64 chars, ret=-1     .ping: sendto: Network is unreachable     ping: wrote IPADDRESS 64 chars, ret=-1     .ping: sendto: Network is unreachable      **QUESTION** : If I can ping the IPADDRESS then why can't I "ping -vrf" the IPADDRESS?


Gnome: Make system text copyable

Here I use "system text" to refer to the text displayed in the GTK widgets (labels, menus, dialogs etc.) I would like to be able to highlight and copy any system text. I am using a locale with a non-roman script that I am not fluent in, and I would like to be able to copy menu items, and paste them into a dictionary. Has anyone ever heard of something that can add that functionality to the GTK libs?


Httpd : no space left on device

I am using Fedora 17 and over the last few days I am having an issue with my system. Whenever I try to start `httpd` it shows me: `Error: No space left on device` When I execute `systemctl status httpd.service`, I receive the following output:               httpd.service - The Apache HTTP Server (prefork MPM)               Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)               Active: inactive (dead) since Tue, 19 Feb 2013 11:18:57 +0530; 2s ago              Process: 4563 ExecStart=/usr/sbin/httpd $OPTIONS -k start (code=exited, status=0/SUCCESS)               CGroup: name=systemd:/system/httpd.service      I tried to Google this error and all links point to clearing the semaphores. I don't think this is the issue as I tried to clear the semaphores but that didn't work. **Edit 1** here is the output of `df -g`               [root@localhost ~]# df -h     Filesystem              Size  Used Avail Use% Mounted on     rootfs                   50G   16G   32G  34% /     devtmpfs                910M     0  910M   0% /dev     tmpfs                   920M  136K  920M   1% /dev/shm     tmpfs                   920M  1.2M  919M   1% /run     /dev/mapper/vg-lv_root   50G   16G   32G  34% /     tmpfs                   920M     0  920M   0% /sys/fs/cgroup     tmpfs                   920M     0  920M   0% /media     /dev/sda1               497M   59M  424M  13% /boot     /dev/mapper/vg-lv_home  412G  6.3G  385G   2% /home      Here is the deatail of httpd error log               [root@localhost ~]# tail -f /var/log/httpd/error_log     [Tue Feb 19 11:45:53 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)     [Tue Feb 19 11:45:53 2013] [notice] Digest: generating secret for digest authentication ...     [Tue Feb 19 11:45:53 2013] [notice] Digest: done     [Tue Feb 19 11:45:54 2013] [notice] Apache/2.2.23 (Unix) DAV/2 PHP/5.4.11 configured -- resuming normal operations     [Tue Feb 19 11:47:23 2013] [notice] caught SIGTERM, shutting down     [Tue Feb 19 11:48:00 2013] [notice] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0     [Tue Feb 19 11:48:00 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)     [Tue Feb 19 11:48:00 2013] [notice] Digest: generating secret for digest authentication ...     [Tue Feb 19 11:48:00 2013] [notice] Digest: done     [Tue Feb 19 11:48:00 2013] [notice] Apache/2.2.23 (Unix) DAV/2 PHP/5.4.11 configured -- resuming normal operations     tail: inotify resources exhausted     tail: inotify cannot be used, reverting to polling      **Edit 2** here is the output of `df-i`               [root@localhost ~]# df -i     Filesystem               Inodes  IUsed    IFree IUse% Mounted on     rootfs                  3276800 337174  2939626   11% /     devtmpfs                 232864    406   232458    1% /dev     tmpfs                    235306      3   235303    1% /dev/shm     tmpfs                    235306    438   234868    1% /run     /dev/mapper/vg-lv_root  3276800 337174  2939626   11% /     tmpfs                    235306     12   235294    1% /sys/fs/cgroup     tmpfs                    235306      1   235305    1% /media     /dev/sda1                128016    339   127677    1% /boot     /dev/mapper/vg-lv_home 26984448    216 26984232    1% /home      Thanks


Window contents disappear after maximizing

Window contents usually disappear after Maximizing them! Especially Firefox. I'm running Ubuntu 12.10 on a Vaio Z56 laptop (graphics card: nVidia GeForce 9300M GS). I've read this question before and do everything that was said in the answer but they didn't work for me. (Something worse happen!!!My toolbar is disappeared!I have a terminal on Desktop and it's the only thing I can use.I can't access administration panel!)


OpenBSD AnonCVS find out which "tree" I am using

I am pretty much of a newb when it comes to OpenBSD. And I know the FAQ suggests to prefer the pkg_tools over using the ports tree if you are not so experienced with the package system. But anyhow, I just wanted to know if there is a way to find out which source tree I have cloned over AnonCVS, because its been a while since I have installed my ports tree and I read that it is important to know before you upgrade them sources.


How to achieve portability with sed -i (in-place editing)?

I'm writing shell scripts for my server, which is a shared hosting running FreeBSD. I also want to be able to test them locally, on my PC running Linux. Hence, I'm trying to write them in a portable way, but with `sed` I see no way to do that. Part of my website uses generated static html files, and this sed line inserts correct DOCTYPE after each regeneration:               sed -i '1s/^/<!DOCTYPE html> \n/' ${file_name.html}      It works with `GNU sed` on Linux, but FreeBSD `sed` expects the first argument after -i flag to be extension for backup copy. This is how it would look like:               sed -i '' '1s/^/<!DOCTYPE html> \n/' ${file_name.html}      However, `GNU sed` in turn expects the expression to follow immediately after -i. (It also reqires fixes with newline handling, but that's already answered in here) Of course I can include this change in my server copy of the script, but that would mess i.e. my use of VCS for versioning. Is there a way to achieve this with sed in a fully portable way?