What's the quickest way to add text to a file from the command line?

Occasionally I have a thought that I want to write into a file while I am at the terminal. I would want these notes all in the same file, just listed one after the other. I would also like a date / time tag on each one. Is it possible to do this without having to open the file each time? Can I just enter it into the terminal and have it appended to the file each time with a command or script? I am using GNU BASH.


How do I get "top" command to wrap its output?

The "command" column gets truncated by the width of the screen and I am unable to see the last part of it. I have tried to reduce the font size so I can see a longer part of the command line but it still won't do.


Alias a command to run in the background

I'd like a keyboard shortcut to work as so:               > e foo.txt      to expand as               > emacs foo.txt &      It's simple to use `alias e=emacs`, but how do I insert the `&` after the filename? I realize it may not be possible using just `alias`, so I'll accept any bash solution. If a shell script is needed please explain how it works.


Change Password of a user in /etc/shadow

I would like to change the password of a user in the `/etc/shadow`. I **can't** use password changing programs like `passwd`. It must be done by editing the `/etc/shadow`. The `/etc/shadow` is on a mounted hard drive and chroot is not working. For example:               root:$asdf.1AH.MJ3sivd4$YFoFnasdf4cZW9H6G6cbT4.1VBmasdfmv.a0wCU/i3zEFasdfasdf4W.:15843:0:99999:7:::     otheruser:$asdf.1AH.MJ3sivd4$YFoFnasdf4cZW9H6G6cbT4.1VBmasdfmv.a0wCU/i3zEFasdfasdf4W.:15843:0:99999:7:::      Can anybody provide me a shell script to change the password of root with `sed` or `awk` or something like that?


Can I make the O/S drive READ ONLY and prevent metadata write back?

Sorry to ask a (probably) stupid question. I am a hardware designer struggling with provision of safe shutdown power to an embedded system. I am aware the Linux normally makes a heavy use of the filesytem and makes metadata updates whenever a file is read -i.e. there is a consequential write for every file access. I believe it is possible to delay this write. I am wondering what happens if this is an indefinate delay (i.e. it never occurs). Some background: For operational reasons it is preferable not to use battery backup to provide power during system shutdown- which means I am looking at a 1 to 5 second power down hold-up. This doesn't seem long enough for the O/S to shut down form our S/W engineers' testing. We are all "new" to Linux having been using conventional embedded RTOS up to this point. We will boot from a FLASH drive and run in RAM in the machine so if we have zero FLASH writes then it wouldn't normally be corrupted on a power fail. We will store system NV data in FLASH that is controlled by a small micro that guarentees a write success in 10ms so that's fine - however I am struggling to understand what, if anything, Linux has to write back to the drive it booted from - and if we prevent it doing so what consequence would there be? Unfortunately we're running from a uSDHC card at the moment so I can't simply write protect it in hardware to find out :-( Can anyone help me or point me at where to learn this information.


How to make Compose work in GTK and Qt apps?

I used Gnome for a long time, but preferred vanilla X input method (`xim`) over the default GTK behaviour. I just set `GTK_IM_MODULE` and `QT_IM_MODULE` enviroment variables to `xim`, and didn't have any problem with multiple- layout config, `Compose` key, custom `~/.XCompose` and `misc:typo` typography extensions. Recent Gnome 3.6 completely screwed keyboard input by shipping a half-baked and buggy `ibus` and forcing it upon the users. I just couldn't get the keyboard working as well as before (even with `ibus` disabled), and had to abandon Gnome completely. Now I use a simple window manager, and configure my keyboard with `setxkbmap`. While the keyboard works well again, I couldn't get get Compose key working everywhere. Compose works in plain X11 apps (`xterm`), but it doesn't work in neither GTK2, nor GTK3, nor Qt apps. I use current Archlinux versions:               xorg-xinput 1.6.0     xorg-server 1.13.1     xf86-input-keyboard 1.6.2     gtk2 2.24.14     gtk3 3.6.4     qt 4.8.4      and enable `Compose` key like this:               setxkbmap ... -option 'compose:menu'      and export `GTK_IM_MODULE`, `QT_IM_MODULE` variables:               $ echo $GTK_IM_MODULE $QT_IM_MODULE      xim xim      `Compose` key is propoperly recognized by X11:               $ xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'     135 Multi_key      It works properly in `xterm`, sequences from my `~/.XCompose` included. It doesn't work in neither GTK nor Qt apps. Let say, if I enter `Compose` `'`, then apps echo `'` immediately, without waiting for the third key in the sequence. Now I suppose something has changed in either Xorg (because `Compose` doesn't work in Qt apps either), or in GTK _and_ Qt. `*_IM_MODULE` variables are not enough now. What else is required to make modern GTK and Qt recognise `xim` and its Compose sequences? P.S. There is a similar (and unanswered) question about Compose key not working in GTK. Unlike the asker, I don't have `ibus` installed.


How to remove the prefix from an e-mail in a table?

this is the INPUT:               $ echo -e '
XXX	XXX	XXX	XXX	XXX	XXX	XXX	XXX	someone.something@example.com
\n
YYY	YYY	YYY	YYY	YYY	YYY	YYY	YYY	foo.bar@example2.com
'
XXX	XXX	XXX	XXX	XXX	XXX	XXX	XXX	someone.something@example.com

YYY	YYY	YYY	YYY	YYY	YYY	YYY	YYY	foo.bar@example2.com
      this is the OUTPUT with SOME MAGIC!               $ echo -e '
XXX	XXX	XXX	XXX	XXX	XXX	XXX	XXX	someone.something@example.com
\n
YYY	YYY	YYY	YYY	YYY	YYY	YYY	YYY	foo.bar@example2.com
' | SOMEMAGIC
XXX	XXX	XXX	XXX	XXX	XXX	XXX	XXX	example.com

YYY	YYY	YYY	YYY	YYY	YYY	YYY	YYY	example2.com
      **My question:** how can "SOMEMAGIC" remove the prefixes before "@" and the "@" itself? The unique delimiter is the               "	"      XXX and YYY could be anything, so it could be ex.: "someone.something@example.com" too :\ p.s.: So the question is, how can someone remove the prefix from: someone.something@example.com so it will be: example.com in this table?


Metaphor for the concept of shell?

I'm finding myself helping out some classmates in my computer science class, because I have prior development experience, and I'm having a hard time explaining certain things like the shell. What's a good metaphor for the shell in the context of the Terminal on Mac, contrasted with a remote shell via SSH?


Bash syntax highlighting of subshells

Considering the large amount of questions which turn out to be related to subshells in Bash ("Why doesn't my variable increment in this piped `while read` loop?"), I just thought it would be very nice to refer to some editor or service where code which will be executed in subshells is formatted differently from the code executed in the parent shell. It might be useful as an educational device (see the difference between `code | code` and `code < <(code)` instantly). Does this exist? Bonus points if anyone implements it for jEdit or VIm. Obviously it doesn't have to be perfect (no syntax highlighting is, in my experience), but I suspect things like `(foo=bar; echo $foo;)` and `command | while read ...` shouldn't be too difficult for a start.


rlwrap-like tool with command autocompletion

I am often using `rlwrap sqlite database.sqlite` to browse an SQLite table. It works great but I would like to have a tool that would create an index tables (and possible its columns as well) and let me autocomplete them using `<TAB>`. Is there any such tool or should I create it by my own? Should I then write extension for `rlwrap`?


How to get GNOME volume applet back?

I'm running GNOME 2.30 (Squeeze) and have lost my Volume Control applet. I can't find it in my **Add to Panel** window. ![alt text](http://i.stack.imgur.com/RtlDV.png)    [ **update** ] Note that the Volume Control applet appears again in the window, and I have no idea what fixed the issue.


grep works fine in command line but returns nothing in script

I'm trying to write a small script to get me list of files that match certain criteria into a file.               #!/bin/sh     cd /var/www_data/patch/     grep --include=\*.{php,ini,conf,sh} -ril -P "'([\d\w\-\_\.]+)(@domain.com)'" "/var/www_data/something/" 2>&1 > mails      The `grep` line works perfectly in command line but if I launch it via script, resulting file will have size of 0 bytes. Any ideas why this is happening?


Using update-rc.d

As per this question, I'd like to start a `/etc/init.d` script on boot. I have the following script comments:               # Startup script for Wowza Media Server     #     # chkconfig: - 80 20     # description: Wowza Media Server is a media server     #     #### BEGIN INIT INFO     # Provides:          WowzaMediaServer     # Required-Start:    $syslog $time $local_fs $remote_fs     # Required-Stop:     $syslog $time $local_fs $remote_fs     # Default-Start:     3 4 5     # Default-Stop:      S 0 1 2 6     # Short-Description: Wowza Media Server 3 Init Script     # Description:       Wowza Media Server 3 Init Script     ### END INIT INFO      I understand that for Debian and Ubuntu systems, rather than using `chkconfig`, I need to use `update-rc.d`. I've done this in the past, but it seems that `update-rc.d` just links the script to all runlevels. Is this really the case? I need this script to only run when starting after networking is up; I'm running a script that needs to `curl` a URL in order to determine the public DNS name of the host (EC2). How can I add this script to auto-start using `update-rc.d` in the way I'm looking to do it?


virsh, how to list autostart domains?

In `virsh` how do I see which domains are marked as autostart? `virsh list` does not show which domains are marked as autostart.


Linux Radeon HD 7730M driver

![enter image description here](http://i.stack.imgur.com/dcg4E.png)I can not find drivers for this product, and recently I have been having an error when resuming from sleep..."UVD not responding, trying to restart the VCPU!" Is there a solution to this error?


6.7 Linux headers `make mrproper` fails in lfs 7.5

I'm building lfs-7.5. When I run `make mrproper` in chapter **6.7** , it says: > make: gcc: command not found and on running `bash /tools/bin/gcc`, it says: > bash: /tools/bin/gcc: no such file or directory This is the same problem as here. Even the information given by the person who asked the question in the comments is same as mine. He says that he did " **third pass** " of `gcc` in **chapter 5**. If this was the case then the author of LFS would have clearly indicated to us to perform 3 passes. I'm guessing that I'm making a subtle mistake somewhere, but I can't seem to find out where. According to the support provided by LFS authors, they ask us to redo the whole thing from the beginning. I agree with them, but without knowing where the mistake might have happened we are bound to make the same mistake again (as I did). The output provided by the person who asked the question in the LFS support question matches mine. This is the link. Another question about the same topic here did not yield any answers. Please help. BTW, when I found out that `gcc` was not linked to the libraries in `/tools/lib` of LFS, I manually created a simlink from `libc.so.6` to `/lib` and `/lib64` under `/mnt/lfs` where I mounted the LFS partition. But when I was executing `make headers_check` in **6.7** (after `make mrproper`), it complained that it didn't find `libz.so` and when I searched in `/tools/lib`, I couldn't find it.


How to preserve .d files after kernel compilation?

I'm compiling third-party kernel modules. Their build system goes to `/usr/src/linux-headers-[version]` (of a custom kernel chroot) and runs `make` from there. I want to find out, which files - sources and headers - have been used for the compilation, and which have not. Standard `scripts/Makefile.build` creates `*.d` files for each compiled source, and I'd like to use that... but these files are **deleted** after short processing. (That is `rule_cc_o_c` definition in `Makefile.build`.) What could be a way to collect these files with minimal modifications to the standard build system?


Swap Utilization Increase with Oracle Coherence

We are using Oracle Coherence on linux servers. However, we noticed that because of Coherence processes running, often our swap utilization % increases too much, sometimes becoming more than 98%, even touched 100% a few times. Once we kill all the coherence related processes, then it becomes normal. Is there any way we can make coherence processes to only use a particular size of Swap space ? Currently increasing swap space is not in our scope. Please suggest.


User authentication over Dante proxy server

Below is my Dante SOCKS Proxy server configuration that I connect to without any authentication:               internal: eth0 port = 53200     internal: 127.0.0.1 port = 53200     external: eth0          clientmethod: none     method: none     user.privileged: root          client pass {     from: 0.0.0.0/0 to: 0.0.0.0/0     log: error # connect disconnect     }     pass {     from: 0.0.0.0/0 to: 0.0.0.0/0     protocol: tcp udp     log: error # connect disconnect     }      I have set up a user group in linux with many members. I want members of this group to be able to connect to the proxy server using authentication (via proxifier). How can I enforce user authentication with Dante ?


Install CentOS from hard drive - kernel panic

I want to dual-boot CentOS and Windows XP. The computer has two partitions (C: and D:) and I want to install CentOS 6.2 on the D: drive. So I downloaded the i386 ISO package, used UNetbootin to deploy that ISO on the hard drive and booted to UNetbootin. After I select the Install CentOS option, I get the following               Kernel Panic - not syncing: Attempted to kill init!     panic occured, switching back to text console      and nothing else. Any advice? Please note that I don't have a CD Drive, and also I do not have any USB storage at hand.


Set process exclusivity in Linux

I am trying to measure the performance of a process. I have widely ranging performance measurements on small bit of single-threaded deterministic code that should perform the same every time. I would like to set exclusive use of a processor for the process in order to test if the performance fluctuation is due to scheduling of other processes, context switches, etc. I don't care about affinity because I don't care which core it runs on. What I do care about is that my single-threaded process has exclusive access to the core it runs on, whichever core that is. Is this possible? I don't think 'nice' does what I want because that just lets me set a priority. Some other task with the same priority may share processor time with my process. I also don't care if my process has to wait in a queue. I just want to ensure that once it starts running, it is not interrupted. Thanks


What is the worst scenario, if the hard disk or motherboard don't support the `hddparm -s`?

I have a desktop PC, that dubs as a RAID-6 server. When I don't need the RAID- related stuff, I'd like to spin off all the hard drives involved in RAID (I hate the noise). Unfortunately, even if everything is stopped, the system probes the drives from time to time causing the hard drives to spin up. From the `hdaparm` man page one can read, that issuing commands like `hddparm -s /dev/sdc` can prevent the disk from ever spinning up again... unless the motherboard supports it:                  -s     Enable/disable  the power-on in standby feature, if supported by               the drive.  VERY DANGEROUS.  Do not use  unless  you  are  abso‐               lutely  certain  that both the system BIOS (or firmware) and the               operating system kernel (Linux >= 2.6.22)  support  probing  for               drives  that  use this feature.  When enabled, the drive is pow‐               ered-up in the standby mode to allow the controller to  sequence               the  spin-up of devices, reducing the instantaneous current draw               burden when many drives share a power supply.  Primarily for use               in  large RAID setups.  This feature is usually disabled and the               drive is powered-up in the active mode  (see  -C  above).   Note               that  a  drive may also allow enabling this feature by a jumper.               Some SATA drives support the control of this feature by  pin  11               of the SATA power connector. In these cases, this command may be               unsupported or may have no effect.      I still don't understand, what is the worst scenario if the hard drive or motherboard don't support it. Does it mean, that the hard drive will be bricked? Or will it be enough to take the hard drive to a friend, who happens to have compatible motherboard which would map the spinned-down hard drives, to re- enable it? * * * **Another question** : What exactly features should my hard drive support? My hard drive seems to support `Power-Up In Standby feature set`, which may not be the same as _power-on in standby feature_ mentioned by the man. How can I check necessary features it in for motherboard? What name does this feature have? The `hdparm -I /dev/sdc`:               Enabled Supported:        *    SMART feature set             Security Mode feature set        *    Power Management feature set        *    Write cache        *    Look-ahead        *    Host Protected Area feature set        *    WRITE_BUFFER command        *    READ_BUFFER command        *    NOP cmd        *    DOWNLOAD_MICROCODE             Power-Up In Standby feature set        *    SET_FEATURES required to spinup after power up             SET_MAX security extension        *    48-bit Address feature set        *    Device Configuration Overlay feature set        *    Mandatory FLUSH_CACHE        *    FLUSH_CACHE_EXT        *    SMART error logging        *    SMART self-test        *    General Purpose Logging feature set        *    64-bit World wide name        *    {READ,WRITE}_DMA_EXT_GPL commands        *    Segmented DOWNLOAD_MICROCODE        *    Gen1 signaling speed (1.5Gb/s)        *    Gen2 signaling speed (3.0Gb/s)        *    Gen3 signaling speed (6.0Gb/s)        *    Native Command Queueing (NCQ)        *    Host-initiated interface power management        *    Phy event counters        *    NCQ priority information        *    DMA Setup Auto-Activate optimization        *    Software settings preservation        *    SMART Command Transport (SCT) feature set        *    SCT Write Same (AC2)        *    SCT Features Control (AC4)        *    SCT Data Tables (AC5)             unknown 206[12] (vendor specific)             unknown 206[13] (vendor specific)


Matching string with a fixed number of characters using grep

I am trying to find all `6` letter words using `grep`. I currently have this:               grep "^.\{6\}$" myfile.txt       However, I am finding that I am also getting results such as: `étuis`, `étude`. I suspect it has something do with the symbols above the `e` in the above words. Is there something I can do to ensure that this does not happen? Thanks for your help!


Help on editing a script using grep and sed

First I'm new to unix so excuse my simple question, also be aware that I work on AIX. I have a lot of sql files that contains the following string:               ${DB_USERNAME}.${TABLE_NAME}      Can anyone please tell me how could I change it in each file so that it remains only               ${TABLE_NAME}      I have tried following pattern of sed.               sed 's/^[^\.]\+\.//'      But it returns only ".". Can someone help me with this `sed` expression ? I need to change files directly. As I think we should pipe output of grep to sed. remember I am on AIX


How can I set quotas (space limitation) for samba users?

I configured samba server in CentOS 6. It will be working fine. The windows users share the files through samba. I want to set space limitation for samba users.


Ubuntu 14.04 hard drive partitioning help wanted

I'm in need of some assistance with manual partitioning from the Ubuntu 14.04 install GUI. I'm trying to do a fresh install of Ubuntu 14.04 desktop. I have a 60GB SSD as that I want all my OS files on (root, home, etc.), and then I have 3 2TB HDDs that I want to partition so I can later configure them into a raid5 array using MDADM. I want my 60GB drive to be encrypted as well as my 3-drive raid array. What would be the easiest way of doing this? Should I use the default encryption for the SSD and encrypt my raid drives later on once I have the raid array configured? Do I encrypt the raid array or the 3 individual drives? I'm new to the Ubuntu manual partitioning and don't quite understand how to assign mount points and how to size swap partitions. I've also had trouble with disk alignment in the past regarding the raid array disks. Any support at all would be greatly appreciated. If anyone could link some tutorials or give me a quick walk-through on partitioning with multiple drives it would be much appreciated. Overview of request (for clarity): Drive1 (SSD 60GB): Encrypted, Boot Drive (/, /home, etc.) Drive2 (HDD 2TB): Disk1 Raid Array Drive3 (HDD 2TB): Disk2 Raid Array Drive4 (HDD 2TB): Disk3 Raid Array Raid Array: Encrypted


XFCE keyboard layout switcher broke .Xmodmap Caps Lock remapping

I have successfully remapped Caps Lock to Enter, using ~/.Xmodmap:               clear Lock     keycode 66 = Return      Remapping scancode for Caps Lock But after switching to XFCE and installing keyboard switching plugin, the remapping is broken. So I have to manually run every time after I login:               xmodmap ~/.Xmodmap      How can I fix it?


Which runlevel is best for a Linux (Debian) server (DBMS/SCM)?

I currently try to harden the system and the security of a Debian server running a database and a source code management. I just want networking and me (one user) to be able to login. Which runlevel is best for this? I found out that my current runlevel is **2** , but maybe **1** or **3** would be better. If so, how can I achieve this?


How does a Linux terminal work?

If you fire up a terminal and call an executable (assuming one thats line oriented for simplicity) you get a reply to the command from the executable. How does this get printed to you (the user) does the terminal do something like `pexpect`? (poll waiting for output ) or what? How does it get notified of output to be printed out? And how does a terminal start a program? (is it something akin to python's os.fork()? ) I'm puzzled how a terminal works, I've been playing with some terminal emulator and I still don't get how all this magic works. I'm looking at the source of konsole (kde) and yakuake (possibly uses konsole) an I can't get where all that magic happens.


Keyboard layout switch (Ctrl+Shift) in a new xorg

I've been using similar config for years:               Section "InputClass"         Identifier "keyboard-all"         MatchIsKeyboard "on"         Driver "evdev"         Option "XkbLayout" "us,ru,de"         Option "XkbVariant" ",winkeys,"         Option "XkbOptions" "terminate:ctrl_alt_bksp,grp:ctrl_shift_toggle"     EndSection      After updating to a newer version of my distro both right `Ctrl`+`Shift` and left `Ctrl`+`Shift` switch keyboard layout only in one direction us -> ru -> de. It used to work like this before:   * Right `Ctrl`+`Shift`: us -> ru -> de   * Left `Ctrl`+`Shift`: us -> de -> ru (reverse order) Is there any way to restore the old behavior?


Trying to open a browser on startup on my Raspberry Pi

I have Raspbian running on my Raspberry Pi, and I want to have a browser appear when it starts up. I am able to open a Midori window to the right page on start up, but my problem is that I receive a "cannot resolve host name" error, such like I would get if I was not connected to the internet. I followed the instructions listed on http://www.niteoweb.com/blog/raspberry-pi- boot-to-browser which were to enter in the command line:               $ sudo nano /etc/xdg/lxsession/LXDE/autostart      Comment everything and add the following lines:               @xset s off     @xset -dpms     @xset s noblank     @midori -e Fullscreen -a http://google.com      This process does open a Midori window on startup, but with the error mentioned above. If the page is refreshed then it works, but I want to be able to bring up a url without having a mouse or keyboard. I read that at the beginning of startup, internet may not be connected yet, so I created a bash script that delayed the process by twenty seconds before opening the Midori window. This did no work either, the same error persisted. I have also tried the process with chromium, to no avail as well.


Viewing system console messages in GUI

Under Linux, is it possible to view error messages that show up on the text mode terminal while in GUI mode, instead of having to press `Ctrl`+`Alt`+`F1` or `Ctrl`+`Alt`+`F2` to view the messages every time and then switching back to GUI mode by pressing `Ctrl`+`Alt`+`F7`? Thank you.


how do I add newlines between lines printed on the command line?

Mail logs are incredibly difficult to read... how could I ouput a blank line between each line printed on the command line. For example say, i'm grep-ing the log. That way multiple wrapped lines aren't being confused.


What does "warning: override: VZ_FAIRSCHED changes choice state" mean?

I am building a Linux kernel, via the Debian linux-2.6 source package. Now there's CONFIG_VZ_FAIRSCHED=y in a sub-config, which gets merged into the final .config, where apparently also "y" gets used:               # grep FAIRSCHED debian/config/**/*     debian/config/featureset-openvz/config:CONFIG_VZ_FAIRSCHED=y      The .config used during build:               # grep FAIRSCHED debian/build/build_amd64_openvz_amd64/.config     CONFIG_VZ_FAIRSCHED=y      I could understand the warning, if now "n" would be used, but nothing appears to have been changed?! This is the output during the `make -f debian/rules.gen binary- arch_amd64_openvz_amd64 binary-indep` call:               make[2]: Entering directory `/var/lib/vz/private/linux.nobackup/linux-2.6/debian/build/source_amd64_openvz'       HOSTCC  scripts/basic/fixdep       HOSTCC  scripts/basic/docproc       HOSTCC  scripts/basic/hash       GEN     /var/lib/vz/private/linux.nobackup/linux-2.6/debian/build/build_amd64_openvz_amd64/Makefile       HOSTCC  scripts/kconfig/conf.o       HOSTCC  scripts/kconfig/kxgettext.o       SHIPPED scripts/kconfig/zconf.tab.c       SHIPPED scripts/kconfig/lex.zconf.c       SHIPPED scripts/kconfig/zconf.hash.c       HOSTCC  scripts/kconfig/zconf.tab.o       HOSTLD  scripts/kconfig/conf     scripts/kconfig/conf -R arch/x86/Kconfig     .config:3518:warning: override: VZ_FAIRSCHED changes choice state      What is this warning referring to?


How to rename /dev/sdax(partitions) in Linux

I made a partition like `/part` on my machine with some important data... But I can't stand the name of it... I want a clear solution to resolve it and change the name of it to for example `/test`... As you see this is my `/etc/fstab` information:               # /etc/fstab: static file system information.     #     # Use 'blkid' to print the universally unique identifier for a     # device; this may be used with UUID= as a more robust way to name devices     # that works even if disks are added and removed. See fstab(5).     #     # <file system> <mount point>   <type>  <options>       <dump>  <pass>     proc            /proc           proc    nodev,noexec,nosuid 0       0     # / was on /dev/sda5 during installation     UUID=a21a99c4-e5b4-4197-ac5e-80d0fab1f30c /               ext4    errors=remount-ro 0       1     # /home was on /dev/sda6 during installation     UUID=2e37d833-ca34-4fa7-a5d8-a4423a5af9bc /home           ext4    defaults          0       2     # /part was on /dev/sda7 during installation     UUID=47e6e0b1-0e57-4184-a378-375b9ce315c5 /part           ext4    defaults          0       2     # swap was on /dev/sda1 during installation     UUID=485e9f78-4dce-4404-af4e-f43985525264 none            swap    sw                0       0      The point is: My information are important and I scare to manipulate it without being sure... I want a safe solution... How is it possible?


reverse order of paragraphs in file

I have a file containing text in paragraphs (lines with text separated by one or more empty lines). I would like to reverse the order of paragraphs (i.e. last paragraph will become the first, ...), preferably by using sed. I am looking for a sed command which would do to a file of paragraphs, what `tac` would do to a files of lines.


How can I override the kernel default options for mount?

I'm struggling with a program that creates a file system in a file and mounts it as a loopback device. The purpose of the program is to create a clone of the root file system and it thinks it's being all smart by also copying over the UUID of the block device. However because I'm using XFS, the loopback mount fails because of the duplicated UUID value. I can manually mount using `mount -o nouuid`, but the program re-creates the device and tries to mount it itself. Because it's not using fstab, I can't set the default mount options there. Is there a way I can tell the kernel what the default options are when running mount and set the `nouuid` option so that even a `mount` command called without specifically specifying that option will use it?


After restoring a backup my permissions seem to be borked

I made a complete backup of the system with "rsync -aAXv", and set up my encryption. After restoring everything, and booting up and trying to login, openbox didn't want to start, and "startx" didn't work either. After a bit of testing I noticed that I didn't have the permissions to create the necessary temporary files and therefore x and openbox didn't start. I just ran "ls -l" on /home/john/.Xresources -rw------- 1 john john 54 Sep 6 11:10 /home/john/.Xauthority" When I try to run openbox, I get this: "Openbox-Message: Unable to make directory '/home/john/.cache/openbox': Permission denied Openbox-Message: Unable to make directory "/home/john/.cache/openbox/sessions": Permission denied Openbox-Message: Failed to open the display from the DISPLAY environment variable. Where does the problem come from? Can using pcmanfm to copy files (ctrl-c + ctrl-v) cause this? I first had to copy the backup from my external harddrive (ext4) to my laptop (btrfs) and then back before I restored the files on my desktop pc.


Virtual Host only works when SELinux is set to permissive - why?

Wondering why my virtual hosts will only work when SELinux is set to "permissive". When SELinux is set to "enforce" my virtual hosts are ignored and default host is shown. **Apache/2.2.15 (Unix)** **Here is my httpd.comf:** http://pastebin.com/2LRzLZ8Z **Virtual files contains:**               <VirtualHost *>         DocumentRoot "/srv/vhosts/foo.com/htdocs"         ServerName mysite.com         <Directory "/srv/vhosts/foo.com/htdocs">             allow from all             Options +Indexes         </Directory>     </VirtualHost>      **Works:**               SELinux status:                 enabled     SELinuxfs mount:                /selinux     Current mode:                   permissive     Mode from config file:          enforcing     Policy version:                 24     Policy from config file:        targeted      **Doesn't work:**               SELinux status:                 enabled     SELinuxfs mount:                /selinux     Current mode:                   enforcing     Mode from config file:          enforcing     Policy version:                 24     Policy from config file:        targeted


Run root script or command as root in startup application in linux mint

I have a wireless adapter that used to work in Linux mint 16 (dwa 171) after installing drivers for it. Now it won't work the same way anymore since I upgraded to linux mint 17. I've found the only way to make it work properly is to run the command `sudo service network-manager restart` I already tried putting this command in rc.local, rc2.local and rc3.local with no real luck. I want this command to run automatically right after login in with startup application program. Please tell me how to.


Get ip of running interface

Is there a way to get to the ip of whatever interface (e.g. enp0s25, wlp3s0) I am using to connect to the internet? And in a low-resource way I can build into conky? Is it time for me to learn sed and awk, or is there a tool for it? CLEAR QUESTION: How do I find the ip used by the interface connected to the LAN?


Can't execute server messages outputed when printing to laser 3 on openSUSE

This is my 1st post and I have a sporadic printing issue I'm needing some help with. I have 3 laser printers setup on my secure network; all ping on different IP addresses; 2 of which are printing without problems. The third on the other hand is outputting an error to the cli and various logs "Can't execute server." when a print job is sent to it either via application or manually using the "lpr –Plaser3 filename" command. I've tried restarting servers for cups and spooler; I've also checked user and groups permissions on the */spooler & */epsonserv directories all of which look ok and no change in the problem. The printer is setup identical to the others in /etc/cups/printers.conf and locally in the device's submenus. The print job is being created and save to /user/spooler but does not make it to the networked device. Has anyone seen this type of error as it relates to printing?


Combine fdisk and df in the same output

`sudo fdisk -l` gives :               255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xdb20e840             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048   104859647    52428800    7  HPFS/NTFS/exFAT     /dev/sda2       104859648   310630399   102885376    7  HPFS/NTFS/exFAT     /dev/sda3       310632840   372065399    30716280   83  Linux     /dev/sda4       372072446   838281215   233104385    5  Extended     /dev/sda5       372072448   392552447    10240000   83  Linux     /dev/sda6       392554496   453994495    30720000   83  Linux     /dev/sda7       453996544   515436543    30720000   83  Linux     /dev/sda8       515438592   515456169        8789   82  Linux swap / Solaris     /dev/sda9       515457024   552321023    18432000   83  Linux     /dev/sda10      552323072   585091071    16384000   83  Linux     /dev/sda11      585093120   617861119    16384000   83  Linux     /dev/sda12      617876028   822656519   102390246    7  HPFS/NTFS/exFAT     /dev/sda13      822657024   838281215     7812096   82  Linux swap / Solaris      While `df -h` gives :               Filesystem      Size  Used Avail Use% Mounted on     /cow            1.9G   30M  1.9G   2% /     udev            1.9G  4.0K  1.9G   1% /dev     tmpfs           385M  1.1M  384M   1% /run     /dev/sr0        913M  913M     0 100% /cdrom     /dev/loop0      874M  874M     0 100% /rofs     none            4.0K     0  4.0K   0% /sys/fs/cgroup     tmpfs           1.9G  8.0K  1.9G   1% /tmp     none            5.0M     0  5.0M   0% /run/lock     none            1.9G   80K  1.9G   1% /run/shm     none            100M   24K  100M   1% /run/user     /dev/sda9        18G  1.2G   16G   8% /media/xubuntu/b90d1c45-7805-421b-9ba7-88ab7ed04fd3     /dev/sda7        29G  4.2G   24G  16% /media/xubuntu/964f9a2f-3641-4754-8319-1decea626931     /dev/sda6        29G   20G  7.8G  72% /media/xubuntu/4f6e6be0-a703-4cb6-a425-9ae73f31eb82     /dev/sda5       9.5G   22M  9.0G   1% /media/xubuntu/3c662996-cf77-41a3-9b5d-d7520f8d534a     /dev/sda3        29G  3.4G   24G  13% /media/xubuntu/57f03636-d50f-43fe-97c0-192b761d7054     /dev/sda12       98G   18G   81G  19% /media/xubuntu/5943EBDD309DF483     /dev/sda11       16G  935M   14G   7% /media/xubuntu/a2176105-4afc-4f19-b182-c027925e249e     /dev/sda10       16G   40M   15G   1% /media/xubuntu/4397bd85-5172-4dc4-a4ce-e9690d3ac7f9     /dev/sda1        50G   32G   19G  64% /media/xubuntu/OSDisk      How can I combine these two results using `awk` or something else to have in the same command that result in the following output.               **Device  -  System_Type  -  Size   -  Use%    -    Mount_Point**


Prompt user to login as root when running a shell script

The problem I am getting is, when I enter the command,               su - root      at the beginning of my shell script file, it prompts the user to enter the password and then does **NOT** continue with the rest of the shell script. I then have to manually locate and run the shell script via terminal. I want the script to make sure that the user logs in as root and then continue with the rest of the shell script. In other words, I want to run the script as any user but as soon as the script begins to execute, the user must change to root and then continue on with the rest of the script as root until it is done. Can this be done?


remove duplicate entry from file1 if entry present in file2

I want to delete duplicate entry _e_ from `file1` if _e_ is also present in `file2`. Input `file1`:               x1  y1     x2  y2     x3  y3     x4  y4     y1  x1     x5  y5     y3  x3     x6  y6     x5  y5      Input `file2`:               y1  x1     y2  x2     y3  x3     y4  x4     x1  y1     y5  x5     x3  y3     y6  x6     x5  y5      Desired output:               x1  y1     x2  y2     x3  y3     x4  y4     x5  y5     x6  y6      I have used following shell script:               awk 'FNR==NR {             lines[NR,"col1"] = $1        lines[NR,"col2"] = $2        lines[NR,"line"] = $0        next         }            (lines[FNR,"col1"] != $1) {($1 in lines)         print lines[FNR,"line"]         next     }' file1.txt file2.txt      But it is giving following output:               x1  y1     x2  y2     x3  y3     x4  y4     y1  x1     x5  y5     y3  x3     x6  y6


background gui process in shell script

In the below script, ivfstudio commands open a gui. Even launched as a background process, I need to close it first so that the next commands are executed. **How to make it "really background" ?**               #!/bin/sh          cmd=`ivfstudio ilv/my_app.iva -execute GenerateAll `;          (     $cmd & ;     echo "toto" ;     `sleep 30` ;     PID = `ps aux | grep -i ivfs | grep my_user| grep -i generateall | awk -F " " '{print $2}' \`;  ) ) ` ;     echo  $(PID) ;     `kill $(PID)` ;     )          exit      **EDIT SOLUTION:**               #!/bin/sh          cmd="ivfstudio my_project.iva -execute GenerateAll > /dev/null 2> /dev/null"          nohup $cmd &     echo "toto"          `sleep 30`     PID=`ps aux | grep -i ivfs | grep my_user| grep -i generateall | awk -F " " '{print $2}' `          echo  $PID     `kill $PID`               exit


Random crashes on elementary OS

I've been trying different distros on my laptop because I'd really like to switch to Linux but I can't seem to make it work. I installed Fedora and elementary OS (which worked before) on my laptop and after a whole day of installing both of them crash randomly. elementary OS crashed during installation few times and the only thing I saw was a block of text from where I only understood that the process is `install.py` and it said Bad RIP value. Once I managed to install elementary OS I tried updating it and then it crashed again, this time the process was `dpkg` and again, Bad RIP value. The laptop is Acer Aspire 5741G (latest BIOS and VGA BIOS) with i5 430M, 3GB of DDR3 and HD5470 512MB.


Using Linux kernel config file from version to version

I have currently Linux Kernel 2.6, which works for my hardware. Now I want to compile Linux kernel 3.2 for the same hardware. Can I use the same `.config` of 2.6 directly for v3.2? Is there any documentation/guide about how to do migrate the `.config` file from one kernel version to the other?


chroot into a sshfs folder

I am trying to chroot into a sshfs-mounted directory:               mkdir remoteroot     sshfs remote:/ remoteroot/     sudo chroot remoteroot/      but I get `chroot: cannot change root directory to remoteroot/: Permission denied`. Am I doing something wrong or is this simply not supported? If so, are there alternatives?


Using alot MUA with nottoomuch-addresses

I try to use the MUA alot to work with the nottoomuch-addresses.sh script for autocompletion of addresses within alot like described in: http://alot.readthedocs.org/en/latest/configuration/contacts_completion.html               [[[abook]]]           type = shellcommand           command = nottoomuch-addresses.sh           regexp = \"(?P<name>.+)\"\s*<(?P<email>.*.+?@.+?)>           ignorecase = True      When I try the autocompletition within alot it gives me the error message: `completition error: abook command "nottoomuch-addresses.sh" returned with return code 2` As it is only a script and not a shell command I tried to giv the whole PATH to the script and I treid to move the script into the alot configuration folder but the problem reamins the same. So I wonder what to do


NFS mount properties (options) in FreeBSD

I am trying to determine how to examine the actual properties of an NFS mount in FreeBSD. In CentOS (6.4 tested) one can `cat /proc/mounts` or execute `nfsstat -m` to determine all of the mount properties. Specifically I am trying to determine why on a FreeBSD VM I have 3 times better performance on an NFS mount than on a CentOS VM. My `fstab` on FreeBSD is:               server:/share /mountpoint nfs rw 00      What this implies for other options. What are the default options?


Is it possible to redefine the tilde ('~', home directory)?

Is it possible to redefine the home directory? _e.g._ to `/ext1/username` instead of `/home/username`, i.e. expanding the `~` to another directory (as opposed to changing the actual home directory where users' home files are located). (This question is mostly academic, as it seems like bad practice to do so. I also have no choice in the matter of using `csh`, despite having read the Top 10.)


Make xargs pass as first parameter

I'm trying to produce this behaviour:               grep 192.168.1 *.txt      By passing a string into grep via Xargs but it is going on the end instead of as the first parameter.               echo 192.168.1 | xargs grep  *.txt      I need to tell xargs (or something similar) to put the incoming string between 'grep' and '*' instead of on the end. How do I do this?


Check recursively if directories in a path exist

I want to check recursively if directories in a given path exist; if they do not, I want to create them. So if I have the path `/dir1/dir2/dir3/dir4`, if want to check first if `dir1/` exists, and if not, create it, then do the same for `dir2/` etc.


compiling bash 4.2 with patches

I want to compile bash 4.2 from source. but http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz is more 2 years old. Should i apply all the patches from http://ftp.gnu.org/gnu/bash/bash-4.2-patches?


how to prevent reboot being stopped by nfsmount?

I can't imagine there isn't a simple strategy to solve this issue of stale nfs handles preventing a machine from shutting down normally, but I'm not sure what that would be. It's pretty annoying to have to force a reboot just because a wifi connection dropped out at some point while watching endless 'waiting for nfsmount' messages.


How to create partition in ubuntu server 12.10

I'm trying to create partition during Ubuntu Server installation(12.10).Now I have a 500GB hard disk where I need to create a partition of 200GB for root file system and another 20GB for swap space and the remaining 280GB logical partition called **backup** for storing backup files during upgradation .   I'm new to server installation,   How can I achieve the following:   1. I'm not familiar with RAID array partition and LVM partition. Which is better and how can I do partitioning using any of this.    2. Is there any link that can guide me in this partitioning.    3. How can I create a partition called **backup** and use this partition using command line.


List ports tunnelled on OpenSSH server

Is there any way to list the tunnels that SSH clients connected to my OpenSSH server have set up? I can use e.g. `lsof -i` to show connections that are being actively tunnelled, but I'd like to be able to list tunnels that the clients have set up but may not currently be in use. (It's just struck me that this may be an entirely client-side thing, i.e. the server only knows the client is set up to tunnel a port when something tries to connect through the tunnel, in which case the answer will be "you can't" - but I'll take that as an answer if so.) (Background: I'm running a MineCraft server on a machine that won't be able to do much else while it's running. If I can monitor when users have tunnels set up, I can run up the MC server on demand.)


USB keyboard won't work with usbhid driver

I have an HP thin client (model t5325) which runs Debian Linux (kernel 2.6.22.18-1-armel). We are testing some kiosk keyboards from Operator Interface Technology which are presenting themselves to Linux as HID devices, but the OS will not bind the `usbhid` driver to the device and allow them to function properly. Here is what the devices list show for the keyboard when connected:               T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 13 Spd=12  MxCh= 0     D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1     P:  Vendor=04d8 ProdID=ffd5 Rev= 1.73     S:  Manufacturer=Operator Interface Technology, Inc.     S:  Product=QVP01T     S:  SerialNumber=00003502     C:* #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=100mA     I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=01 Driver=(none)     E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=10ms     I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=(none)     E:  Ad=82(I) Atr=03(Int.) MxPS=   3 Ivl=10ms      As you can see, the "Driver" for the two interfaces on the device shows "(none)" and isn't bound to anything. I have tried to bind the device directly to the driver to no avail:               root@TC-40041:/sys/bus/usb/drivers/usbhid# echo -n "1-1.1:1.0" > bind     -bash: echo: write error: No such device      I have also tried adding the vendor/product ID to the `new_id` file for the `usbhid` driver and get the same result:               root@TC-40041:/sys/bus/usb/drivers/usbhid# echo 04d8 ffd5 > new_id     root@TC-40041:/sys/bus/usb/drivers/usbhid# echo -n "1-1.1:1.0" > bind     -bash: echo: write error: No such device      The `1-1.1:1.0` comes from the USB device list:               root@TC-40041:/proc/bus/usb# ls -l /sys/bus/usb/devices     total 0     lrwxrwxrwx 1 root root 0 Nov 30 12:08 1-0:1.0 -> ../../../devices/platform/ehci_marvell.70059/usb1/1-0:1.0     lrwxrwxrwx 1 root root 0 Nov 30 12:08 1-1 -> ../../../devices/platform/ehci_marvell.70059/usb1/1-1     lrwxrwxrwx 1 root root 0 Nov 30 14:10 1-1.1 -> ../../../devices/platform/ehci_marvell.70059/usb1/1-1/1-1.1     lrwxrwxrwx 1 root root 0 Nov 30 15:11 1-1.1:1.0 -> ../../../devices/platform/ehci_marvell.70059/usb1/1-1/1-1.1/1-1.1:1.0     lrwxrwxrwx 1 root root 0 Nov 30 15:11 1-1.1:1.1 -> ../../../devices/platform/ehci_marvell.70059/usb1/1-1/1-1.1/1-1.1:1.1     lrwxrwxrwx 1 root root 0 Nov 30 12:08 1-1:1.0 -> ../../../devices/platform/ehci_marvell.70059/usb1/1-1/1-1:1.0     lrwxrwxrwx 1 root root 0 Nov 30 12:08 usb1 -> ../../../devices/platform/ehci_marvell.70059/usb1      The keyboard works okay when plugged into a Windows 7 PC (though it did go through a discovery process and install a device driver on its own). The vendor claims the keyboards are designed as generic HID interfaces and should work on any modern operating system with USB support. We have similar keyboards from another vendor which present themselves in much the same way to the operating system and they bind to the `usbhid` driver without error and work perfectly. These do not. Have we missed anything? Are there other way we can attempt to bind the driver or have these keyboards work properly with Debian Linux?


Debian Wheezy netinstall can't configure DHCP

I am reinstalling my Debian system with the Wheezy netinstall image on a USB drive. I have a wireless router that also comes with ethernet ports, so I could either connect to my LAN via wifi OR ethernet. The installer was able to detect my wireless (wlan0) and wired (eth0) interfaces, but one of the following always happens: (1) If I try network autoconfiguration for eth0, the process would always fail at the DHCP autoconfigure step (i.e. can't get IP address?). Please note that this works on the machine, before the re-install I am attempting. (2) If I try network autoconfiguration for wlan0, it successfully authenticates with my wifi network via WPA2, and configures DHCP successfully. However, I get an error saying there is no "default route" setup. What does "default route" mean? I have tried to cancel/delete all DHCP leases and restarting my router to no avail. I also tried getting into the shell (which is ash) but there's no ifconfig etc. that I could access. Can anyone help with troubleshooting this problem? I am eager to reinstall Debian Wheezy soon. Thanks!


Track daily directory changes (and email them)

I have a Debian powered NAS server (ReadyNAS) with a deep file hierarchy. I'd like to get notified daily about what has changed in some of its directories and their subdirectories. So if someone accidentally deletes a file during the day, I'd get notified about it at night by email (which would contain summary of all changes) and restore the file from backup in the morning of the next day. At first I wanted to write a PHP CL or Python script which would recursively scan the directories, but then I thought that perhaps there is some neat unix tool that does it better. Something like dircmp :) How would you do it? Thanks


KDE; each monitor another desktop

Is it possible to configure for example 4 desktops and switch them separately for each monitor?


Ctrl-S doesn't work in rtorrent when accessed via screen. Can't start torrents

I run `rtorrent` remotely on a seedbox. When I log in with a web interface I'm able to start torrents, and when torrent files get dropped into my watched folder that works too. However, when I try to start them by SSHing in to my seedbox and `-r` resuming the `screen` session that contains my instance of `rtorrent`, I can't seem to use the `Ctrl`+`S` keyboard shortcut to start torrents. I can stop and delete them with the `Ctrl`+`D` shortcut, and as far as I can tell all the other keyboard shortcuts work. I've tried this from the Terminal app in OSX and from Cygwin on Windows. Thanks for your insight!


Cannot connect to wired ethernet after hibernate

When I am at home I use wired connection on my laptop and it works fine. Then I put it to hibernate with `sudo pm-hibernate` and start it up again when I am work. I am not able to connect to internet without a reboot of the machine. I have tried:                ifconfig eth0 down      ifconfig eth0 up      But it does not help. Also:                dhclient eth0      This took a long time to run and when finished still no success. Found this in `/var/log/syslog`:               Jul 15 08:22:38 frank dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7 (xid=0x4183b95d)     Jul 15 08:22:45 frank dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8 (xid=0x4183b95d)     Jul 15 08:22:53 frank dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 10 (xid=0x4183b95d)     Jul 15 08:23:03 frank dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 15 (xid=0x4183b95d)     Jul 15 08:23:18 frank dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11 (xid=0x4183b95d)     Jul 15 08:23:29 frank dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 16 (xid=0x4183b95d)     Jul 15 08:25:33 frank avahi-autoipd(eth0)[5647]: Callout STOP, address 167.198.2.6 on interface eth0     Jul 15 08:25:33 frank avahi-autoipd(eth0)[5648]: client: RTNETLINK answers: No such process     Jul 15 08:25:33 frank avahi-autoipd(eth0)[5648]: client: RTNETLINK answers: Cannot assign requested address     Jul 15 08:25:33 frank avahi-autoipd(eth0)[5648]: Script execution failed with return value 2     Jul 15 08:26:59 frank NetworkManager[949]: <info> (eth0): IP6 addrconf timed out or failed.     Jul 15 08:26:59 frank NetworkManager[949]: <info> Activation (eth0) Stage 4 of 5 (IPv6 Configure Timeout) scheduled...     Jul 15 08:26:59 frank NetworkManager[949]: <info> Activation (eth0) Stage 4 of 5 (IPv6 Configure Timeout) started...     Jul 15 08:26:59 frank NetworkManager[949]: <info> Activation (eth0) Stage 4 of 5 (IPv6 Configure Timeout) complete.      Exact same thing happens when I put the laptop to hibernate at work and start it up again at home. Anyone got a clue to why I have to reboot to make wired connection work after hibernate? I am using `Mint 17` with the latest updates.


Can we add ports to OVS AFTER the VM is created?

I wanted to write up a program where I can create VMs first using libvirt. Initially they would not be added to any network. Then I want them to be attached to an OVS bridge where I can specify the name of the virtual interface. I have seen that openstack does something similar. Is it possible to do so using libvirt and ovs commands?


Why TCP TIME-WAIT State is present at both ends after a connection termination?

I am reading how the TCP states work and especially the connection termination part. All of the books or online material I read, shows that for the termination procedure these states are followed from the side initiated (active) the connection termination: **ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, TIME-WAIT, CLOSED** And these from the receiving (passive) side: **ESTABLISHED, CLOSE-WAIT, LAST-ACK, CLOSED** Now here comes the question: I have modprobed the nf_conntrack_ipv4 module to both sides to check the connection states in /proc/net/ip_conntrack. To my surprise, when the connection is terminated, both the initiator (active) and the receiver (passive) goes to the TIME-WAIT state. I would expect only the initiator to go through this state, and the receiver just close the connection. Can someone explain why this is happening? UPDATE: How do I perform this test I have a virtual machine with IP 10.0.0.1 (Ubuntu 12.04) and I start two ssh connections to 10.0.0.2 (Debian 6) from it (10.0.0.2 is a VM as well). I check the ip_conntrack of both ends and this is what I get.               root@machine1:~# cat /proc/net/ip_conntrack | grep 10.0.0.1     tcp      6 431997 ESTABLISHED src=10.0.0.1 dst=10.0.0.2 sport=53925 dport=22 src=10.0.0.2 dst=10.0.0.1 sport=22 dport=53925 [ASSURED] mark=0 use=2     tcp      6 431944 ESTABLISHED src=10.0.0.1 dst=10.0.0.2 sport=53924 dport=22 src=10.0.0.2 dst=10.0.0.1 sport=22 dport=53924 [ASSURED] mark=0 use=2          root@machine2:~# cat /proc/net/ip_conntrack | grep 10.0.0.1     tcp      6 432000 ESTABLISHED src=10.0.0.1 dst=10.0.0.2 sport=53925 dport=22 packets=206 bytes=19191 src=10.0.0.2 dst=10.0.0.1 sport=22 dport=53925 packets=130 bytes=18177 [ASSURED] mark=0 secmark=0 use=2     tcp      6 431947 ESTABLISHED src=10.0.0.1 dst=10.0.0.2 sport=53924 dport=22 packets=16 bytes=4031 src=10.0.0.2 dst=10.0.0.1 sport=22 dport=53924 packets=17 bytes=3741 [ASSURED] mark=0 secmark=0 use=2      So far everything looks fine. Now I disconnect one of the ssh connections from machine2 and this is what I get:               root@machine1:~# cat /proc/net/ip_conntrack | grep 10.0.0.1     tcp      6 431989 ESTABLISHED src=10.0.0.1 dst=10.0.0.2 sport=53925 dport=22 src=10.0.0.2 dst=10.0.0.1 sport=22 dport=53925 [ASSURED] mark=0 use=2     tcp      6 117 TIME_WAIT src=10.0.0.1 dst=10.0.0.2 sport=53924 dport=22 src=10.0.0.2 dst=10.0.0.1 sport=22 dport=53924 [ASSURED] mark=0 use=2          root@machine2:~# cat /proc/net/ip_conntrack | grep 10.0.0.1     tcp      6 432000 ESTABLISHED src=10.0.0.1 dst=10.0.0.2 sport=53925 dport=22 packets=211 bytes=19547 src=10.0.0.2 dst=10.0.0.1 sport=22 dport=53925 packets=133 bytes=18925 [ASSURED] mark=0 secmark=0 use=2     tcp      6 115 TIME_WAIT src=10.0.0.1 dst=10.0.0.2 sport=53924 dport=22 packets=31 bytes=5147 src=10.0.0.2 dst=10.0.0.1 sport=22 dport=53924 packets=25 bytes=4589 [ASSURED] mark=0 secmark=0 use=2


Why do my sshd logs show many trys on invalid ports?

My ssh daemon is setup to listen on port 2221. I have also disabled root login from ssh. I don't understand why in auth.log I have attempts to log on other ports (example with 4627 here).               May 17 15:36:04 srv01 sshd[21682]: PAM service(sshd) ignoring max retries; 6 > 3     May 17 15:36:08 srv01 sshd[21706]: User root from 218.10.19.134 not allowed because none of user's groups are listed in AllowGroups     May 17 15:36:08 srv01 sshd[21706]: input_userauth_request: invalid user root [preauth]     May 17 15:36:10 srv01 sshd[21706]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=218.10.19.134  user=root     May 17 15:36:12 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2     May 17 15:36:15 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2     May 17 15:36:17 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2     May 17 15:36:19 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2     May 17 15:36:24 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2     May 17 15:36:27 srv01 sshd[21706]: Failed password for invalid user root from 218.10.19.134 port 4627 ssh2     May 17 15:36:27 srv01 sshd[21706]: Disconnecting: Too many authentication failures for root [preauth]      SSHD is supposed not to take into account these trys. Why logs say user/password is not matching whereas it shouldn't receive the request (wrong port) ? Am I missing something ?


How to enable on access scanning and the like in Debian Squeeze?

I am using Debian squeeze. I want to enable on access scanning and scanning of downloaded files and all options which are employed by a proprietary virus scanner for Windows on Linux. I am using Debain 6. How to do it? I am given clamfs dazuko (clamuko) avfs as options. But I can't find the steps to enable it.


Diagnose unplanned shutdowns

I have a problem with a server that is shutting down for some unknown reason. I check the logs each time it happens and cannot find anything of particular interest which would suggest why its going down. Can anyone suggest anything I should do to help diagnose the problem?


Send update ping to ping services in Terminal?

I want to send ping from `http://www.mysite.com/rss.xml` to `http://rpc.pingomatic.com` Is there any way using terminal to achieve this?


pptp differs between 3.7 and 3.8 linux kernel milestone with 3.2.0-4 milestone

Unfortunately, current kernel of `debian` has problem with my hardware: `3.2.0-4-686-pae` , and when i compile one of 3.7.x milestone or 3.8.1 itself , my problem is solved. **But my problem with new kernel:** I'm forced to use VPN connection for more hours. (6 7 hours) But when i connect with vpn , after a few second i disconnect. **NOTE:** i didn't have any problem with old kernel : `3.2.0-4-686-pae` **Question:** How can i solve it? **NOTE:** all of vpn driver are compiled.


How to detect particular system call called or not in a whole workflow?

**EDIT No. 1** **My task is mirroring , i.e., copying updated data from master server to all mirrors, by using rsync and rsh. But during rsync and rsh, I found some delay. My thinking is , the reason for delay is reverse DNS lookup. So I want to make log for time consumed in reverse dns lookup process, when master server connects with mirror server.** In my application I want to detect reverse DNS lookup system call called or not. So, for that which command helps ? For reverse DNS Lookup , system call is getnameinfo(),. if you any other , tell me. I just want to trace only this system call in my project. Which command can I use? I know ltrace/strace command to trace all system call called till script exits, but that makes extra overhead, because all system call trace is not of use in my project. I want to make log for time consumed in reverse dns lookup during rsync and rsh. Help me in my problem.


Extracting lines around keys from a file

I have a large file with around 15 million lines. The odd lines contains the keys (but not only the keys) and the even lines are the data. That is, the file is something like:               WRTZ Tyrosine     1287998798     ASDF Proline     9408654860     TYSR Serine     9809804090     ASDF Cytosine     4950409808      The keys here are `ASDF`, `TYSR`, and `WRTZ`. I have a list of around 100000 keys. I want to extract the data (both lines) corresponding to these keys. One approach I tried was to `grep` the lines containing the keys to get the line numbers and then extract the line and the next line using `head` and `tail` in a loop. However, this seems to take a long time to run. Is there a more efficient way to do this?


How is yum atomicity ensured?

The installers do change a lot of system files. System may become unbootable if something fails during the software updates. Yet, it is almost impossible to ensure atomicity of even simple single file write operations. How is all of that is resolved in unix installers? Are they file-system dependent?


How can I move a directory onto an existing directory?

I need to essentially merge changes on two trees, applying the changes from branch 2 to branch 1. I have trees like this:               media     ├── cd     │   ├── 0     │   │   ├── file1     │   │   ├── file2     │   │   └── file3     │   ├── 1     │   │   ├── file1     │   │   ├── file2     │   │   └── file3     │   └── 2     │       ├── file1     │       ├── file2     │       └── file3     ├── dvd     │   ├── 0     │   │   ├── file1     │   │   ├── file2     │   │   └── file3     │   ├── 1     │   │   ├── file1     │   │   ├── file2     │   │   └── file3     │   └── 2     │       ├── file1     │       ├── file2     │       └── file3     └── stuff         ├── 0         │   ├── file1         │   ├── file2         │   └── file3         ├── 1         │   ├── file1         │   ├── file2         │   └── file3         └── 2             ├── file1             ├── file2             └── file3      I've changed the files in my branch 2, and I need to apply them to branch 1. If I just try moving them over branch 1, I get the following errors:               mv: cannot move `/branch2/media/cd' to `/branch1/media/cd': Directory not empty.      Is there another command I should be using for this? `mv -f` doesn't seem to do the trick.


Check bash/shell script dependencies

Is there a method/command to check for the dependencies of a bash script? In other words, a response to this question : Which libraries should a user install to run the script? I can do this manually by reading the script and check what other libraries/commands it calls but this not evident for long scripts.


Installing GRUB in a dual-boot

I've just installed my OSes on a new HDD: Windows 7 and Debian 7. As usual I first installed Windows, then Debian. At the first attempt, GRUB seems to not have been installed properly, because my computer would just boot into Windows. I found this on debian.org, so I followed its advice: > When there is more than one disk available during installation (for example > one hard disk and one USB stick, as it is commonly the case when booting the > installer from a USB stick), grub-install may run into problems: it was > reported several times, that the GRUB bootloader was installed onto the USB > stick instead of the hard disk containing the newly-installed system. > > To avoid running into this, make sure to answer "No" when the following > question is asked during the installation process: "Install the GRUB boot > loader to the master boot record?"; it should be possible to specify the > right device at the next step: "Device for boot loader installation". After I did this, GRUB would show up on boot, but when I selected Windows, the screen would go black and immediately pop back to the GRUB menu. I installed GRUB into the first partition, as that was the one with the boot flag. My partitions are as follows:   1. 100MB System Reserved   2. 195GB Windows   3. 2GB Swap   4. 40GB Linux I managed to fix the MBR with the Windows CD afterwards, but of course, now Debian is unavailable. Should I have installed GRUB somewhere else, or is it a different problem ?


How to change the flag pictures XFCE Keyboard Layouts applet uses for its indication?

XFCE Keyboard Layouts panel applet offers to use either textual or graphical indications. But the font used for textual indication is too small and the flag icons used for graphical are too blowzy. How can I set up another flags set?


How to get information from sshd about established remote tunnels

I have a server running on which from many different places people log on via ssh and open remote ssh-tunnels to other places behind different firewalls. Now I want to try to get an overview, which LISTEN-port connects to which connected ssh-session with an opened remote tunnel. I have no access to the client ssh-computers. e.g. the LISTEN-ports on the server               $ lsof -i4 -sTCP:LISTEN     sshd     5543   usera    9u  IPv4 97603715      0t0  TCP *:8888 (LISTEN)     sshd     5543   userb   11u  IPv4 97603719      0t0  TCP *:3060 (LISTEN)     sshd     5543   userc   13u  IPv4 97603723      0t0  TCP *:8889 (LISTEN)      How can I find out, which LISTEN port connects to the established ssh- connections given by:               $ lsof -i TCP:22 -a -u root     sshd     5546 root    3u  IPv4 97603798      0t0  TCP server:ssh->client1:42896 (ESTABLISHED)     sshd    11846 root    3u  IPv4 97193507      0t0  TCP server:ssh->client2:51586 (ESTABLISHED)     sshd    11847 root    3u  IPv4 97193512      0t0  TCP server:ssh->client3:51588 (ESTABLISHED)      I know that they are related, but I can not make the mapping of ssh-connection (lower output) to LISTEN ports. The sshd-process knows this but how can I get this information from him? Any help would be appreciated. Thanks!


What does `chown root.root $file` mean?

I'm trying to install `colordiff` in a custom directory because I do not have `sudo` privileges. I did make the directories hard-coded in the Makefile as stated in the README, but I'm getting this error:               ...     chown root.root /share/edu-mei/colordiff/1.0.13/etc/colordiffrc     chown: changing ownership of `/share/edu-mei/colordiff/1.0.13/etc/colordiffrc': Operation not permitted     make: [install] Error 1 (ignored)     ...      Changing this file ownership is not really a problem (probably the reason that the author ignores this). However I'm not familiar with this usage of `chown`. The manpage from chown says that the command syntax is:               chown [OPTION]... [OWNER][:[GROUP]] FILE...     chown [OPTION]... --reference=RFILE FILE...      But the command executed is `chown root.root $file`. What does the syntax with a dot rather than a colon mean?


Why should 'Character Classes' be preferred over 'Character Ranges' In Shell (Bash)?

The Linux Command Line (Book - page count 47) says: > ... you have to be very careful with them [character ranges] because they > will not produce the expected results unless properly configured. For now, > you should avoid using them and use character classes instead. The book gives no reason, other than that. **Question - 1:** So, why exactly should _Character Classes_ (e.g. `[:alnum:]`, `[:alpha:]`, `[:digit:]`, etc) be preferred over _Character Ranges_ (e.g. `[a-z]`, `[A-Z]`, `[0-9]`, etc)? **Question - 2:** Does `[:alpha:]` stand for `[a-z]`, `[A-Z]`, and **upper and lower-case alphabets from other languages too**? And similarly, does `[:digit:]` include numerals from other languages too? If they match, that is. (Two questions, I know, but in this case, they are pretty much interrelated, IMO.)


ls shows a timestamp with no time for a file on NFS

When we create a file on Linux we notice that the timestamp is not visible and the `stat` on the file shows a time in future, the filesystem is an NFS mount, has anyone seen this before?               aa:/usr/data> touch test     aa:/usr/data> ls -al test     -rw-r----- 1 iaaadm sapsys 0 Jun 30  2014 test     aa:/usr/data>  stat test     File: `test'     Size: 0               Blocks: 0          IO Block: 32768  regular empty file     Device: 14h/20d Inode: 114999298   Links: 1     Access: (0640/-rw-r-----)  Uid: ( 1002/  aaadm)   Gid: (   86/  sys)     Access: 2014-06-30 18:35:44.000000000 -0500     Modify: 2014-06-30 18:35:44.000000000 -0500     Change: 2014-06-30 18:35:44.000000000 -0500     Birth: -


What are valid keys for tmux?

I was trying to learn how to use the `bind-key [-cnr] [-t key-table] key command [arguments]` better, but was having some trouble figuring out what "valid _keys_ " are for `bind-key` command. I tried doing `man tmux` and Google too, but I couldn't find anything useful.   * How can I figure out what the syntax for valid keys are?   * Is there a help command or a `man` page for this?   * Maybe I don't know the technical term for this valid keys, is there a term for these keys so that I can do a better google search? For example, I was trying to figure out what the following remapping of commands meant:               bind-key -n M-S-Left resize-pane -L 2     bind-key -n M-S-Right resize-pane -R 2     bind-key -n M-S-Up resize-pane -U 2     bind-key -n M-S-Down resize-pane -D 4      The `-n` was easy to find in the `man` page (doesn't need prefix). But I can't figure out what `M-S-Left` key means. I am guessing that its mapping shift and the left arrow plus whatever `M` means to the `resize-pane -L 2` command.   * How do I figure out what `M` means?   * What if I wanted control + whatever key I wanted. Is control = `C` ?   * How can I figure this out without just trying random keys on my keyboard until something works?   * Also, how do I confirm, figure out if I am not mapping it to a key set that is already used?   * Is there such a thing as "show all aliases" or something?   * As an addition to the question, are these valid keys the same as the ones for `vim`? The thing is that `vim` seems to have a different scripting for its own language since it sometimes require and stuff.


Issue with network switching

I have a desktop PC running debian that has two network cards installed. One network card is connected to a secure company network and requires a static IP. The other network card (eth1) is connected to a dlink router and then to a cable modem with DHCP addressing. I'd like to create a script to switch between the two networks. I want to make sure that the two networks aren't connected at the same time. Right now my script checks the up/down status of each interface and toggles them with ifup/ifdown. However, I'm having a number of issues trying to switch networks which I'll attempt to outline but I get the feeling that I'm just going about this the wrong way. If I configure /etc/network/interfaces to reflect the static IP settings required for the company network connection and the DHCP required for the cable connection than I get the error "RTNETLINK answers: file exists" because I have more than one gateway defined in the file. If I define the gateways via 'route add' and include metering ifup won't bring up eth0. If I leave eth0 and eth1 undefined in the interfaces file and use network manager to manage them, ifup won't bring up either interface. In both cases I get the error "Failed to bring up eth#" (replace # with either 0 or 1) with no explanation for further detail when I try to use ifup. If I replace ifup/ifdown with "ifconfig eth# up/down" than the interfaces go up and down properly but the DNS settings in resolv.conf don't update so I can't do much. Adding "resolvconf -u" doesn't seem to do the trick either. I can get everything working properly on either network if I manually edit resolv.conf after switching but I'd like to have this as automated and easy as possible. Any help you can provide is greatly appreciated. ---update--- /etc/network/interfaces               auto lo       iface lo inet loopback          auto eth0       iface eth0 inet static       address 10.0.0.152       netmask 255.255.255.0       gateway 10.0.0.1       network 10.0.0.0       broadcast 10.0.0.255       dns-search company.com       dns-nameservers 10.0.0.2 10.0.0.3 10.0.0.4       meter 100  #without this line I get RNETLINK answers: file does not exist          auto eth1       iface eth1 inet dhcp  #assigns an address in the 192.168.0.0/24 space with 192.168.0.1 as DNS       meter 200  #without this line I get RNETLINK answers: file does not exist      /etc/resolv.conf               nameserver 10.0.0.2     nameserver 10.0.0.3     nameserver 10.0.0.4     search company.com cable.provider.com      Unless I manually edit the file, my resolv.conf always has the DNS servers for the eth0 connection and both domains in the search path. In order to get the cable connection to work I have to delete the other nameserver lines and add 192.168.0.1 and in order for the company connection to work I just have to delete the cable provider search path.


Problem in writing message from one terminal to another terminal

I have a user of name `x` in tty1 and `y` in tty2. `x` wants to write some message to `y` and vice-versa. When I typed `write y tty2` in the tty1 terminal, it said:               write:you have write permission turned off     write:y has messages disabled      I then tried to enable messages:               $ mesg     is n     $ mesg y      Now I can successfully write a message from `x` to `y` or vice-versa, but the first line of error continues to appear. I have tried logging out and back in again, but the symptom doesn't change. I also looked through the file `/etc/default/devpts` and saw that `TTYMODE=620`.


diff where lines are mostly the same but out of order?

I want to diff two sets of mod_rewrite rules. The set of lines are about 90% identical, but the order is so different that diff basically says they are completely different. How can I see which lines are truly different between two files, regardless of their line number?


find . .[^.]* -type f -print0 | xargs -0 sudo chmod 664; does not work

I am using this command to set permissions for files recursively               clime@vm6879 /srv/www-php/steeltrading $ find . .[^.]* -type f -print0 | xargs -0 sudo chmod 664      But after executing that command permissions of some files (most of them) are still not changed.               clime@vm6879 /srv/www-php/steeltrading $ ll media/xmlconnect/system/ok.gif      -rwxrwxr-x. 1 www www 295 Jul  5  2012 media/xmlconnect/system/ok.gif      If I run just `find` to look if the file is in the list, I can see it:               clime@vm6879 /srv/www-php/steeltrading $ find . .[^.]* -type f | grep ok.gif     ./media/xmlconnect/custom/ok.gif     ./media/xmlconnect/original/ok.gif     ./media/xmlconnect/system/ok.gif      If I move into directory media a run the command again, the file finally gets the right permissions.               clime@vm6879 /srv/www-php/steeltrading $ cd media/     clime@vm6879 /srv/www-php/steeltrading/media $ find . .[^.]* -type f -print0 | xargs -0 sudo chmod 664     clime@vm6879 /srv/www-php/steeltrading/media $ ll xmlconnect/system/ok.gif      -rw-rw-r--. 1 www www 295 Jul  5  2012 xmlconnect/system/ok.gif      It looks like `sudo chmod 664` is not performed for some files and it seems that `xargs` is the problem but It is strange (no error messages). Any idea what might be the cause, please? EDIT: Or maybe piping lots of data might be a problem?


Piping into less and editing: "cannot edit standard input" error. Workarounds?

I recently learned that if I page my files with `less`, I can press `v` and open the buffer in Emacs. This works as long as I have the environment variable `$EDITOR` set up correctly, which in my case I have it as:               export EDITOR='env TERM=xterm-256color emacs -nw'      The above gives me the ability to load emacs within the terminal that runs `less`. However, the trick above does not work when **piping** commands to `less`. When doing this, `less` complains with the following message:               Cannot edit standard input (press RETURN)      My question is, why does this happen? But most importantly, **is there any workaround to it**?


How can the log-in screen sound of linux mint 11 be changed?

How can I customize the sound that occurs when the log-in screen pops up on linux mint 11?


How do I configure the GNOME gdm login screen?

I recently installed Arch Linux and have it mostly set up. With many other Linux distributions, there is a tool that is used to configure the look and feel of the login screen. I would like to change the wallpaper used, the date/time format from something like "Sat 6:27 PM" to "26 Feb 11 18:27", and the refresh rate of the monitor (it's fine when I'm logged in, but not at the login screen). Where can I find these configuration options or (preferably) a GNOME application to allow for me to make these configuration changes?


verify: command not found exception when trying to get value from user

**Code Explanation:** The below code is a simple script written by me to send a Installation status alert mail. It will be sent after completion of a linux software installation. In this code, If the user accept the mail notification he will be asked to enter his mail id. Then the mail will be send to him after installation completed.               #!/bin/bash          #######################################     # Independent Variables and  Properties Here     #######################################     PL_EMAIL_ALERT=""     #######################################     # User to get Email Alert     #######################################     echo "This will help user to get an email of an installation status."     verify -s "Do want to send Email"     if [ "$VerAns" = "y" ]     then         read -e -p "Enter Email ID: " PL_EMAIL_ALERT     fi     #######################################     # Sending Email Alert     #######################################     echo "Sending Mail"     if [ ${#PL_EMAIL_ALERT} -ne 0 ]     then         mail -s "software INSTALLATION MAIL ALERT" $PL_EMAIL_ALERT <<< "message1"     fi     echo ""     echo "Final step"     echo ""      **Problem:** My problem is when I try to execute the code I am getting the following error. _`verify: command not found`_ As I am very new to linux I am unable to fix this issue. Can you please help me to understand what exactly I missed.


LVM not coming up after reboot, couldn't find device with uuid

Had a VM that was, up until recently working without issue, but needed to be rebooted after some configuration changes. However after rebooting the VM didn't come back up, saying it couldn't find the root device (which was an LVM volume under /dev/mapper). Booting into recovery mode, I saw that the filesystems under /dev/mapper, and /dev/dm-* did indeed, not exist. The filesystem should be layed out with   * `/dev/sda1` as the boot partition   * `/dev/sda2` extended partition containing   * `/dev/sda5` and `/dev/sda6` as LVM partitions   * `/dev/sda{5,6}` are both PVs in a single VG   * with 2 LVs for the root FS and swap Doing an `lvm pvshow` gives me:                 Couldn't find device with uuid '8x38hf-mzd7-xTes-y6IV-xRMr-qrNP-0dNnLi'.       Couldn't find device with uuid '8x38hf-mzd7-xTes-y6IV-xRMr-qrNP-0dNnLi'.       Couldn't find device with uuid '8x38hf-mzd7-xTes-y6IV-xRMr-qrNP-0dNnLi'.       --- Physical volume ---       PV Name               unknown device       VG Name               of1-server-lucid       PV Size               19.76 GiB / not usable 2.00 MiB       Allocatable           yes (but full)       PE Size               4.00 MiB       Total PE              5058       Free PE               0       Allocated PE          5058       PV UUID               8x38hf-mzd7-xTes-y6IV-xRMr-qrNP-0dNnLi            --- Physical volume ---       PV Name               /dev/sda6       VG Name               of1-server-lucid       PV Size               100.00 GiB / not usable 2.66 MiB       Allocatable           yes (but full)       PE Size               4.00 MiB       Total PE              25599       Free PE               0       Allocated PE          25599       PV UUID               cuhP6R-QbiO-U7ye-WvXN-ZNq5-cqUs-VVZpux      So it appears as though `/dev/sda5` is not listed as a PV and is causing errors. `fdisk -l`:               Disk /dev/sda: 128.8 GB, 128849018880 bytes     255 heads, 63 sectors/track, 15665 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00044a6c             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1          32      248832   83  Linux     Partition 1 does not end on cylinder boundary.     /dev/sda2              32       15665   125579256+   5  Extended     /dev/sda5              32        2611    20722970   8e  Linux LVM     /dev/sda6            2612       15665   104856223+  8e  Linux LVM      So I can see the `/dev/sda5` device exists, but `blkid` isn't reporting anything for it:               ~ # blkid     /dev/sda1: UUID="d997d281-2909-41d3-a835-dba400e7ceec" TYPE="ext2"      /dev/sda6: UUID="cuhP6R-QbiO-U7ye-WvXN-ZNq5-cqUs-VVZpux" TYPE="LVM2_member"       After taking a snapshot of the disks, I tried recovering the PV from the archive config:               ~ # pvremove -ff /dev/sda5     Labels on physical volume "/dev/sda5" successfully wiped     ~ # pvcreate --uuid=8x38hf-mzd7-xTes-y6IV-xRMr-qrNP-0dNnLi /dev/sda5 --restorefile=/etc/lvm/archive/of1-dev-server_00000.vg     Couldn't find device with uuid '8x38hf-mzd7-xTes-y6IV-xRMr-qrNP-0dNnLi'.       Physical volume "/dev/sda5" successfully created     ~ # vgchange -a y     2 logical volume(s) in volume group "of1-dev-server" now active"      So at least now the device has a `blkid`:               /dev/sda1: UUID="d997d281-2909-41d3-a835-dba400e7ceec" TYPE="ext2"      /dev/sda6: UUID="cuhP6R-QbiO-U7ye-WvXN-ZNq5-cqUs-VVZpux" TYPE="LVM2_member"      /dev/sda5: UUID="8x38hf-mzd7-xTes-y6IV-xRMr-qrNP-0dNnLi" TYPE="LVM2_member"       Doing a `pvdisplay` now also shows the correct device:                 --- Physical volume ---       PV Name               /dev/sda5       VG Name               of1-dev-danr-lucid       PV Size               19.76 GiB / not usable 2.00 MiB       Allocatable           yes (but full)       PE Size               4.00 MiB       Total PE              5058       Free PE               0       Allocated PE          5058       PV UUID               8x38hf-mzd7-xTes-y6IV-xRMr-qrNP-0dNnLi            --- Physical volume ---       PV Name               /dev/sda6       VG Name               of1-dev-danr-lucid       PV Size               100.00 GiB / not usable 2.66 MiB       Allocatable           yes (but full)       PE Size               4.00 MiB       Total PE              25599       Free PE               0       Allocated PE          25599       PV UUID               cuhP6R-QbiO-U7ye-WvXN-ZNq5-cqUs-VVZpux      And the mapper devices exist:               crw-rw----    1 root     root      10,  59 Jul 10 10:47 control     brw-rw----    1 root     root     252,   0 Jul 10 11:21 of1--dev--server-root     brw-rw----    1 root     root     252,   1 Jul 10 11:21 of1--dev--server-swap_1      Also the LVMs seem to be listed correctly:               ~ # lvdisplay       --- Logical volume ---       LV Name                /dev/of1-dev-danr-lucid/root       VG Name                of1-dev-danr-lucid       LV UUID                pioKjE-iJEp-Uf9S-0MxQ-UR0H-cG9m-5mLJm7       LV Write Access        read/write       LV Status              available       # open                 0       LV Size                118.89 GiB       Current LE             30435       Segments               2       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           252:0            --- Logical volume ---       LV Name                /dev/of1-dev-danr-lucid/swap_1       VG Name                of1-dev-danr-lucid       LV UUID                mIq22L-RHi4-tudV-G6nP-T1e6-UQcS-B9hYUF       LV Write Access        read/write       LV Status              available       # open                 0       LV Size                888.00 MiB       Current LE             222       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           252:1      But trying to mount the root device gives me an error:               ~ # mount /dev/mapper/of1--dev--server-root /mnt2     mount: mounting /dev/mapper/of1--dev--server-root on /mnt2 failed: Invalid argument      So I tried a disk consistency check:               ~ # fsck.ext4 -f /dev/mapper/of1--dev--server-root     e2fsck: Superblock invalid, trying backup blocks...     e2fsck: Bad magic number in super-block while trying to open /dev/mapper/of1--dev--server-root     [...]      So I tried another superblock:               ~ # mke2fs -n /dev/mapper/of1--dev--server-root     Filesystem label=     OS type: Linux     Block size=4096 (log=2)     Fragment size=4096 (log=2)     Stride=0 blocks, Stripe width=0 blocks     7798784 inodes, 31165440 blocks     1558272 blocks (5.00%) reserved for the super user     First data block=0     Maximum filesystem blocks=4294967296     952 block groups     32768 blocks per group, 32768 fragments per group     8192 inodes per group     Superblock backups stored on blocks:              32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,              4096000, 7962624, 11239424, 20480000, 23887872     ~ # fsck.ext4 -y -b 23887872 /dev/mapper/of1--dev--server-root      Upon which I received ridiculous numbers of errors, the main ones I saw were:   * Superblock has an invalid journal   * One or more block group descriptor checksums are invalid.   * Truncating orphaned inode ()   * Already cleared block #0 () found in orphaned inode   * /dev/mapper/of1--dev--server-root contains a filesystem with errors, check forced   * Resize inode not valid. Recreate   * Root inode is not a directory.   * Reserved inode 3 () has invalid mode   * HTREE directory inode has invalid root node   * Inode , i_blocks is , should be 0.   * Unconnected directory inode  After a lot of messages, it says it's done. Mounting the directory as above works fine, but the directory is empty with a `lost+found` directory full of files, most just numbers, some have filenames vaguely relating to files that once existed. **So, how do I bring the VM back up?** Whenever I see disk errors, my first instinct is to snapshot so things don't get worse, so I have a snapshot from just after reboot when I first saw the error. I know the data is there somewhere, as the VM worked without issue until I rebooted. The user can't remember changing anything on the filesystem recently, but it had almost a year of uptime when I rebooted it so all sorts could have happened since then. We also, unfortunately, don't have backups as Puppet had been disabled on this node. The original OS was Ubuntu Lucid, running on VMWare.


CentOS 6.5 installation hangs on first screen

I'm trying to install CentOS 6.5 in Virtual Box. The problem is, the installation hangs on the first screen after waiting about 10 seconds. How can I pass this screen? The steps I installed: 1) Create virtual machine ![enter image description here](http://i.stack.imgur.com/TJNl6.png) 2) Start it It shows "Automatic boot in 10 seconds" and count down, then it freezes as below ![CentOS 6.5 Installation Screen](http://i.stack.imgur.com/ykq2u.png) After many times failing, I tried to press Print key. It shows multiple options, choosing any option causes hanging. The only selectable option is "Install (Text Mode)", press it, it shows `"This kernel requires an x86-64 CPU, but only detected an i686 CPU. Unable to boot - please use a kernel appropriate for your CPU"`.


I am starting my application in the background using `nohup` as mentioned below -               root@phx5qa01c:/bezook# nohup java -jar ./exhibitor-1.5.1/lib/exhibitor-1.5.1-jar-with-dependencies.jar -c file --fsconfigdir /opt/exhibitor/conf --hostname phx5qa01c.phx.qa.host.com > exhibitor.out &     [1] 30781     root@phx5qa01c:/bezook# nohup: ignoring input and redirecting stderr to stdout      But everytime I see this message -               nohup: ignoring input and redirecting stderr to stdout      Will there be any problem if I am seeing this message and what does it mean? And also how to avoid this?


Running time command with cron

So I have a crontab that have this line:               30 16 * * * (time sysbench --test=cpu --cpu-max-prime=20000 run) 2>> ~/cpu.out      I use this because time output goes by default to stderr and I want to redirect it to a file When I run the command in the terminal it does write the output I need:               real X.XXXs     user X.XXXs     sys  X.XXXs      But when I run with cron it writes this to the file:               39.69 user 0.92 system 0:40.67elapsed 99%CPU (0avgtext+0avgdata 1400maxresident)k0inputs+1outputs (0major+450minor) pagefaults 0swaps      Can someone help me? PS: In the man page there is the -o option but it is not working, if I try that I get an error


Lighttpd rewrite rule

Why does a rewrite rule like this not work:               url.rewrite-if-not-file = (         "^parameter/(.*)$" => "/somefunnyfile.php?someparameter=$1"     )      ... but a rule like this does work:               url.rewrite-if-not-file = (         "^/(.*)$" => "/somefunnyfile.php?someparameter=$1"     )      This is the mimed Apache RewriteRule               RewriteRule ^acraproxyphp/(.*)$ acraproxy.php?reportid=$1


How to install Suggests dependencies of a package

If I want to install a package and its Suggests dependencies, I run:               $ sudo apt-get --install-suggests install <package name>      However, if `<package name>` is already installed, and not all Suggests dependencies are installed, 'nothing' happens... those remaining dependencies remain uninstalled. Is there a solution for this, beyond writing code?


How to identify executable path with its PID on AIX 5 or more

## On AIX 5 or 6, `ps -ef` shows the executable full path randomly. Why and how to determine it? I find many thread through internet and also Unix & Linux and this stack overflow post about finding the path of a process and so far I don't succed in applying any method.   I keep falling into having `proftpd` shown instead of having a path. I finally read the `man ps` of AIX and find this : > CMD > > (-f, -l, and l flags) Contains the command name. Under the -f flag, ps tries > to determine the current command name and arguments both of which may be > changed asynchronously by the process. These are then displayed. Failing > this, the command name as it would appear without the option -f, is written > in square brackets. I want to be sure to understand what i means when I have the following output:                ps -ef (truncate output)     root 44900     1   0 11:49:36      -  0:00 proftpd: (accepting connections)     nobody 31986 14976   0   13 feb      -  0:00 /usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf      For the `httpd` deamon it does show the full path but doesn't show the full path for `proftpd`. First question is why does some process are shown with full path and some don't ? And the second question is fot that case : Can I assume that the path of the `proftpd` is the first I'll find typing `whereis` as `root` ? In my case :                whereis proftpd      proftpd: /etc/proftpd.conf /usr/sbin/proftpd        ~~So I assume that the running deamon is`/usr/sbin/protfpd ?` Am I correct ?~~ * * * **Edit 2** : Let me answer that part: NO I can't make such an assumption it is not relevant at all. I finally find out that the deamon was running from `/opt/proftpd` which is not even in the root path. The why `ps -ef` does work that way is still to determine, and also is there any other way to find out what is the real path knowing the PID? * * * **Edit 1** : Here's the proof that my AIX system are not supporting `exe` link in `/proc/<PID>`.   I test this against AIX versions 5.3.9.0 and 6.1.7.15:               ls -al /proc/44900/*     -rw-------    1 root     nobody            0 14 jan 09:42 /proc/44900/as     -r--------    1 root     nobody          128 14 jan 09:42 /proc/44900/cred     --w-------    1 root     nobody            0 14 jan 09:42 /proc/44900/ctl     lr-x------   53 root     nobody            0 13 jan 16:07 /proc/44900/cwd -> /     -r--------    1 root     nobody            0 14 jan 09:42 /proc/44900/map     -r--r--r--    1 root     nobody          448 14 jan 09:42 /proc/44900/psinfo     -r--------    1 root     nobody         1024 14 jan 09:42 /proc/44900/sigact     -r--------    1 root     nobody         1520 14 jan 09:42 /proc/44900/status     -r--r--r--    1 root     nobody            0 14 jan 09:42 /proc/44900/sysent          /proc/44900/fd:     total 5483376     dr-x------    1 root     nobody            0 14 jan 09:42 .     dr-xr-xr-x    1 root     nobody            0 14 jan 09:42 ..     -r--r--r--    1 root     nobody         5005 12 jul 2004  3     -r--r--r--    1 root     nobody         8655 13 nov 15:13 5     -r--r--r--    1 root     nobody         1607 13 nov 15:12 6     --w-------    1 root     nobody   2378419349 13 jan 16:06 7     --w-------    1 root     nobody    423405131 13 jan 16:06 8          /proc/44900/lwp:     total 0     dr-xr-xr-x    1 root     nobody            0 14 jan 09:42 .     dr-xr-xr-x    1 root     nobody            0 14 jan 09:42 ..     dr-xr-xr-x    1 root     nobody            0 14 jan 09:42 99075          /proc/44900/object:     total 90312     dr-x------    1 root     nobody            0 14 jan 09:42 .     dr-xr-xr-x    1 root     nobody            0 14 jan 09:42 ..     -rwxr-xr-x    1 root     system      1268973 16 okt 2012  a.out     -rwxr-xr-x    1 bin      bin           15265 12 jul 2004  jfs.10.5.12513     -r--r--r--    1 bin      bin         8587637 23 mei 2008  jfs.10.5.16405     -r-xr-xr-x    1 bin      bin         9281793 23 sep 2008  jfs.10.5.4131     -r-xr-xr-x    1 bin      bin           11019 01 okt 2007  jfs.10.5.4149     -r--r--r--    1 bin      bin          162078 19 jun 2008  jfs.10.5.4169     -r--r--r--    1 bin      bin         1161414 23 sep 2008  jfs.10.5.4171     -r--r--r--    1 bin      bin          379513 19 jun 2008  jfs.10.5.4943     -r-xr-xr-x    1 bin      bin           96495 19 jun 2008  jfs.10.5.5248     -rw-r--r--    1 root     system     17160842 05 okt 2011  jfs2.51.3.266241     -rwxr-xr-x    1 root     system       315783 11 mei 2006  jfs2.51.3.266246     -rw-r--r--    1 root     system      3237612 05 okt 2011  jfs2.51.3.266262     -rw-r--r--    1 root     system       125958 25 mrt 2008  jfs2.51.3.270769     -rwxr-xr-x    1 root     system      3140221 20 mei 2011  jfs2.51.3.282757     -rwxr-xr-x    1 root     system      1268973 16 okt 2012  jfs2.51.3.283899      No symbolic link at all.


Backporting OpenSSL-1.0.1e to Debian Lenny (armv4l)

I have an old embedded board that supports only Debian Lenny. I need to install `OpenSSL-1.0.1e` on it. If I download the source code then try to compile the source code, I get this error               ts7500:/home/openssl-1.0.1e# make     making all in crypto...     make[1]: Entering directory `/home/openssl-1.0.1e/crypto'     gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DZLIB_SHARED -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DTERMIO -O3 -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DGHASH_ASM   -c -o armcap.o armcap.c     In file included from armcap.c:8:     arm_arch.h:35:5: error: #error "unsupported ARM architecture"     make[1]: *** [armcap.o] Error 1     make[1]: Leaving directory `/home/openssl-1.0.1e/crypto'     make: *** [build_crypto] Error 1      how can I overcome that error?               Note: ts7500:/home/openssl-1.0.1e# `uname -a`     Linux ts7500 3.4.0 #83 Sun May 26 17:07:14 CEST 2013 `armv4l GNU/Linux`      ARMV4 is defined on https://github.com/joyent/node/blob/89dcf22/deps/openssl/openssl/crypto/arm_arch.h EDIT: If I add `#define __ARM_ARCH__ 4` in the beginning of the library, it suppress the problem and compiles the code without any problem. I wonder how correct what I did. I would appreciate a better solution (e.g., without modifying the library)


While trying to build the NumPy Python math module with Intel's Math Kernel Library (MKL) on OSX 10.8.3, I was running into some problems with the Accelerate and vecLib frameworks overriding the MKL. At any rate, I decided it would be a good idea to rename `/System/Library/Frameworks/Accelerate.framework` and `/System/Library/Frameworks/vecLib.framework` temporarily. Nothing happened (at least, on the command line) after moving `Accelerate.framework`. However, after entering               sudo mv vecLib.framework/ vecLib.framework.old      I got the following error:               sudo: unable to initialize PAM: No such file or directory      Oops. Unfortunately, the `mv` command worked, but now when I try to use `sudo` I get the same error, but the commands **don't** work. When I tried to rename `vecLib` through Finder, I get:               The operation can’t be completed.     An unexpected error occurred (error code -8076).      which apparently is some sort of permissions error. So, my question is how can I get `sudo` working again? App Store.app won't even run, so I can't reinstall XCode (which is apparently where `vecLib.framework` comes from) or anything else. I'm afraid to reboot because I'm worried the computer will hang, whereas (as you can tell) at least it's working for now, albeit without any elevated permissions capabilities. Any suggestions? * * * Normally I wouldn't cross-post, but I need to figure out a way to fix this ASAP.


notify-send command with -u critical and -t option

I sometimes see the command :               notify-send -u critical -t 3000 "Example"      However, with `-u critical`, it seems like the notification doesn't time out. What is the purpose of adding a timeout option then? Do you have a link which explains exactly what the `notify-send` does? The ones I found were not very detailed in their explanations. What is the purpose of the `-u` option, btw?