Can't edit /proc/sys/net/core/wmem_max

Recently my wireless network has being stopping to transfer data from some irregular time intervals that vary from 30 seconds to 20 minutes, and every time I need to plug off and then on the wireless adapter. Using ping (`ping 8.8.8.8`) to see what happens, and when data transfer stops I receive this message: > ping: sendmsg: No buffer space available So I found out that a solution for this is to increase buffer size with this command:               sudo echo 83886080 > /proc/sys/net/core/wmem_max      Although I can't execute this command, when I hit enter I get this: > bash: /proc/sys/net/core/wmem_max: Permission denied Trying the command without `sudo` or with `gksu` returns the same message. Through GEdit I can open `/proc/sys/net/core/wmem_max` file, and opening as administrator it enables me to click the 'Save' button, although after changing the value and hitting the button it returns me this message: > Could not create a temporary backup file while saving > /proc/sys/net/core/wmem_max > > gedit could not backup the old copy of the file before saving the new one. > You can ignore this warning and save the file anyway, but if an error occurs > while saving, you could lose the old copy of the file. Save anyway? And even clicking in the 'Save anyway' button it returns the very same message.


Why do I get "Permission denied" when redirecting the output of sudo echo "xyz" to a file?

Why do I get               -bash: test: Permission denied      when I run               sudo echo "xyz" > test      The directory permissions are:               drwxr-xr-x 3 root root 4096 2014-08-05 16:26       I have no problem creating a file in the directory using `sudo`. But why can't I sudo echo into it?


Why can I copy files to, but not create files in, this directory?

> **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on I'm trying to create an `md5sum` for an ISO image created with the Ubuntu Customization Kit tools. The ISO is created by the tools, which have to be run with `sudo`, in               ~/tmp/remaster-new-files/       which has permissions:               drwxr-xr-x 2 root root remaster-new-files      So I `cd` to that directory and run               sudo md5sum my.iso > my.iso.md5      and I get the following error:               bash: my.iso.md5: Permission denied      I can create the md5 sum somewhere else and use `sudo mv` to move it into place, exactly where it would be if the `sudo md5sum` command succeeded. Also, if I change user to `root` with `sudo su root`, I can run the `md5sum` command successfully. Why can't I use `sudo` to create files in this directory, given that I can use `sudo` to move files to it?


How do I append text to a write protected file

> **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on I am trying to append a line of text to a write protected file. I tried to accomplish this with `sudo echo "New line to write" >> file.txt` but I get a permission denied error -- presumably because it is trying to sudo the string, not the act of appending it to a file. If I run `sudo vi file.txt` and authenticate I can happily write away. Any help would be greatly appreciated.


Script with root permission

> **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on I am creating a script to change the brightness of my laptop. I discovered that I can do this using               echo 1000  > /sys/class/backlight/intel_backlight/brightness      for example. But I must to do this as root, not with `sudo` command. Well, I created the file `/usr/bin/brilho` containing               echo "$1"  > /sys/class/backlight/intel_backlight/brightness      and now I can execute it with `brilho 1000`. But the problem is the permission. This does not work with `sudo brilho 1000` neither `brilho 100`. Again I have to change to root. So, I would like to know how to improve this to facilitate my job. Regards and thanks.


How do I use redirection with sudo

> **Possible Duplicate:**   >  Redirecting stdout to a file you don't have write permission on Yeah I could (and probably will) just escalate to root, but I'd like to know why this doesn't work?               sudo cat .mplayer/config >> /home/griff/.mplayer/config     zsh: permission denied: /home/griff/.mplayer/config      `sudo` is configured to be able to run any command, I've placed no restrictions on it.


How do you process an entire command as sudo that involves redirecting or piping?

I am trying to follow what I assume is best practises of using sudo instead of root account. I am running a simple concat file operation such as:               sudo echo 'clock_hctosys="YES"' >> /etc/conf.d/hwclock      This fails as to the right of the ">>" it is running as the normal user. Adding extra sudos also fails (expected behaviour since piping to the sudo command and not to the file). Example is just that but it has been verified and tested under the root account.


Can't add swap file on solaris

I'm trying to add a swap file on Solaris 10. I have already created a 2GB file `swap.file`. Then, I add a swap file with the command:               swap -a /swap.file      which shows an error: > /swap.file: size is invalid What am I doing wrong?


Non-ASCII characters handled incorrectly on command line

I have a problem with non-ASCII characters in the Terminal on Mac. If I write:               echo ÆØÅ      Then press Enter, Arrow Up, Arrow Left, so the cursor is between the Ø and the Å, then write X, then the Å is converted to ?, and if I press Enter, the following is echoed:               ÆØ?X?      Pressing `Ctrl`+`A` and `Ctrl`+`E` with non-ASCII characters entered also causes a mess. My settings are as follows:               ~/.profile:     export LC_ALL="nb_NO.UTF-8"          ~/.inputrc:     set input-meta on     set output-meta on     set convert-meta off          Terminal > Settings > Advanced > Declare terminal as: xterm      Unsetting `LC_ALL` has no effect. Changing the `.inputrc` settings just seems to make things worse. I really hope someone has the answer to this.


Ubuntu 13.04 on Acer x64 PC, only boots after starting recovery

I have this strange problem with my Acer E1 421. First of all it's important to say that **I've upgraded this laptop's memory to 8gb RAM instead of 2**. I decided to remove Windows 7 x64, and install Ubuntu, because I just hate Windows. The problem is, the install went all fine, but when I try to boot my laptop, this happens in order:   * Boot laptop   * Gets past BIOS Diagnostics   * I see the purple Ubuntu thing   * Screen goes black and stays that way until I press the Power off button   * Boot laptop again   * Gets past BIOS Diagnostics   * I get an Ubuntu screen where I can choose Boot Normal/Recovery/...   * I press Recovery   * I don't do anything, simply click "Continue to Normal boot"   * It works Why do I always have to boot it up once, go through the whole recovery without actually doing anything, to get it booted? I'm using the GRUB bootloader.


Guest Additions in VirtualBox

I'm setting up a development server with VirtualBox. I've installed Ubuntu 10.10 Server. I want to use filesharing to setup the files that I need to develop on but it seems that the CD drive is not mounting to install the Virtualbox guest additions. How can I configure this to setup the file sharing.


Execute a file in an application based on the file's extension in bash

After reading this answer about a zsh feature: > If a given extension has a suffix alias, you can execute a file with that > extention directly, and ZSH will launch the given program and pass the > filename as an argument. Is there something similar to bash? That is, if a given file has an extension, how to directly execute that file, automatically launching a program just by calling the file's name? So doing > program /path/to/foo.ext > > /path/to/foo.ext would equivalent to the same zsh feature? Is this feature available in newer versions of bash?


What would cause "crossover" between two USB2 webcams when using motion?

I am using the Motion package for linux to act as a security system with two Microsoft LifeCam HD-5000 webcams. In general it's working very well but I'm experiencing a weird issue. Every now and then the feed from one cam will exhibit "crosstalk" or "crossover" from the other cam, in sweeping bars, best described in this image (highlighted in red): ![WTF?](http://i.stack.imgur.com/yBnHJ.png) As you can see, the image is a mixed mess of the inside and the outside camera feeds. I believe this article from Motion's wiki is describing the same issue, however there is no solution there besides: > If you need more than 1 USB camera add extra USB PCI cards to your computer However that is talking about USB 1.1, and these are USB 2.0 cameras. Also, I do believe this system has two UCB cards and that the cameras are connected to two different USB busses:               root@chef:~# lsusb -t     /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M         |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/8p, 480M             |__ Port 2: Dev 3, If 0, Class=stor., Driver=usbfs, 480M             |__ Port 3: Dev 4, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M             |__ Port 3: Dev 4, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M             |__ Port 3: Dev 4, If 2, Class=audio, Driver=snd-usb-audio, 480M             |__ Port 3: Dev 4, If 3, Class=audio, Driver=snd-usb-audio, 480M     /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M         |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M             |__ Port 2: Dev 3, If 0, Class=HID, Driver=usbhid, 12M             |__ Port 3: Dev 4, If 0, Class=HID, Driver=usbhid, 1.5M             |__ Port 4: Dev 5, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M             |__ Port 4: Dev 5, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M             |__ Port 4: Dev 5, If 2, Class=audio, Driver=snd-usb-audio, 480M             |__ Port 4: Dev 5, If 3, Class=audio, Driver=snd-usb-audio, 480M     root@chef:~# lspci     00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 12)     00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 12)     00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)     00:1a.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)     00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)     00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06)     00:1c.5 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 6 (rev 06)     00:1d.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)     00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a6)     00:1f.0 ISA bridge: Intel Corporation 5 Series Chipset LPC Interface Controller (rev 06)     00:1f.2 IDE interface: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA IDE Controller (rev 06)     00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 06)     01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)     02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57788 Gigabit Ethernet PCIe (rev 01)      So my questions are:   1. Does anyone know what could cause crossover like this?   2. Any other troubleshooting suggestions?   3. I am guessing I will need to ask the developers of Motion for support, so before I do, can anyone confirm that I do have the cameras connected to two different PCI cards as they suggested?


Can someone diagnose this JACK error message?

OK. I start JACK without starting the JACK server. I get:               23:09:22.730 Patchbay deactivated.     23:09:22.765 Statistics reset.     Cannot connect to server socket err = No such file or directory     Cannot connect to server socket     jack server is not running or cannot be started     23:09:23.059 ALSA connection graph change.     23:09:23.250 ALSA connection change.      Then I press the 'play' button. I get:               23:10:07.865 Startup script...     23:10:07.866 artsshell -q terminate     Cannot connect to server socket err = No such file or directory     Cannot connect to server socket     jack server is not running or cannot be started     sh: artsshell: not found     23:10:08.268 Startup script terminated with exit status=32512.     23:10:08.268 JACK is starting...     23:10:08.269 /usr/bin/jackd -dalsa -dhw:0 -r44100 -p1024 -n2     23:10:08.275 JACK was started with PID=1764.     Cannot create thread 1 Operation not permitted     Cannot create thread 1 Operation not permitted     jackdmp 1.9.6     Copyright 2001-2005 Paul Davis and others.     Copyright 2004-2010 Grame.     jackdmp comes with ABSOLUTELY NO WARRANTY     This is free software, and you are welcome to redistribute it     under certain conditions; see the file COPYING for details     JACK server starting in realtime mode with priority 10     Cannot lock down memory area (Cannot allocate memory)     audio_reservation_init     Acquire audio card Audio0     creating alsa driver ... hw:0|hw:0|1024|2|44100|0|0|nomon|swmeter|-|32bit     Using ALSA driver HDA-Intel running on card 0 - HDA Intel at 0xdfebc000 irq 42     configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods     ALSA: final selected sample format for capture: 32bit integer little-endian     ALSA: use 2 periods for capture     ALSA: final selected sample format for playback: 32bit integer little-endian     ALSA: use 2 periods for playback     Cannot use real-time scheduling (RR/10)(1: Operation not permitted)     AcquireSelfRealTime error     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     alsa_driver_xrun_recovery     JackAudioDriver::ProcessAsync: read error, skip cycle     23:10:15.341 Could not connect to JACK server as client. - Overall operation failed. - Server communication error.       If I press nothing, the above read error message repeats infinitely. I installed JACK from repositories and this is what I got.


Why aren't crontabs stored in user home directories?

I'm curious to know: why are crontabs stored in /var rather than in the user's home directories? It makes it a total pain to isolate these files for upgrades but I suspect that there is a logical reason...


Virtualbox installation

I'm trying to install virtualbox. But when I run dpkg -i {dpkg package} I get following error:               sudo dpkg -i virtualbox-4.1_4.1.18-78361~Ubuntu~precise_amd64.deb      Selecting previously unselected package virtualbox-4.1.     (Reading database ... 245018 files and directories currently installed.)     Unpacking virtualbox-4.1 (from virtualbox-4.1_4.1.18-78361~Ubuntu~precise_amd64.deb) ...     Setting up virtualbox-4.1 (4.1.18-78361~Ubuntu~precise) ...     Adding group `vboxusers' (GID 124) ...     Done.      * Stopping VirtualBox kernel modules                                                                                [ OK ]       * Uninstalling old VirtualBox DKMS kernel modules                                                                                [ OK ]       * Trying to register the VirtualBox kernel modules using DKMS                                                                                Error! Bad return status for module build on kernel: 3.11.0-12-generic (x86_64)     Consult /var/lib/dkms/vboxhost/4.1.18/build/make.log for more information.           * Failed, trying without DKMS      * Recompiling VirtualBox kernel modules                                                                                * Look at /var/log/vbox-install.log to find out what went wrong      In vbox-installation.log I have this:               CC [M]  /var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.o     /var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjNativeMapUser’:     /var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:1451:38: error: ‘VM_RESERVED’ undeclared (first use in this function)                      vma->vm_flags |= VM_RESERVED; /* This flag helps making 100% sure some bad stuff wont happen (swap, core, ++). */                                       ^     /var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:1451:38: note: each undeclared identifier is reported only once for each function it appears in     make[2]: *** [/var/lib/dkms/vboxhost/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.o] Error 1     make[1]: *** [/var/lib/dkms/vboxhost/4.1.18/build/vboxdrv] Error 2     make: *** [_module_/var/lib/dkms/vboxhost/4.1.18/build] Error 2     make: Leaving directory `/usr/src/linux-headers-3.11.0-12-generic'      I did sudo apt-get install build-essential linux-headers-`uname -r` but the problem still exist. Thanks for all answers


Are dropbear and OpenSSH host keys compatible?

The title basically says it all. But mind: **host key** , not the login key. And if they're not compatible out of the box, is there a way to convert between them - and what would be the steps in that case? Rationale: it would be nice to be able to bring up a dropbear instance in the scope of the initrd, if boot fails, but do so by incorporating the host keys (via initramfs-tools hooks) from OpenSSH that is normally installed on the host.


How do I recover from the Heartbleed bug in OpenSSL?

CVE-2014-0160 a.k.a. Heartbleed is a vulnerability in OpenSSL. It looks scary. How do I determine whether I am affected? If I'm affected, what do I need to do? Apparently upgrading isn't enough.


How to put value of echo pipe netcat commands into variable

I have this command succession:               echo -ne "/dev/shm/test.sh" | netcat 89.196.167.2 4567      and let's say it return a string like, for example "Hello...bla". (on the 89.196.167.2 i have made a server that takes ssh comands and executes them and returns the result to the client, and it is running ok, it return what i need, so this is not the problem) I want to put this returned value, "Hello...bla", into a variable and use it. If i try this:               var=echo -ne "/dev/shm/test.sh" | netcat 89.196.167.2 4567;echo "$var"      it doesn't work... Bash returns this:               -bash: -ne: command not found      Can you please help me with a solution?


Linux: How to check whether a process is slowed down by other running processes

I have one process running on a RHEL 6.3 machine. Somehow this is taking a longer processing time than the same process running on another machine. How is it possible to know why this process is running slow or if any other parallel running process is slowing down this process?


Arch Linux RPI: How accurate is the time on the RPi in Linux?

Currently I'm working on a application on my RPi which will be monitoring a set of GPIOs in real-time where the exact time when the GPIO turns HIGH is crucial for my application. And I need to know how the time is being dealt with on the RPi with the Arch Linux OS, is it synchronized towards a UDP NTP Time Server? If that's the case is it being updated continuously in a background thread/deamon like other Linux stuff? Or is perhaps updated each time a call to get the time is made? Because two events might occur on two (or more) GPIOs simultaneously I need to implement the fastest solution possible to get the real-time functionality. The actual date is not important when the specific event happen, instead the exact time relative to the other events is. ( **i.e** the data recorded will be shown in a graph where the spacing between the events should be as exact as possible.) So the question could be broken down to: How is time handled on the RPi with Arch Linux, and how accurate is it in a multi-thread environment? Thanks in advance.


Convert mysql count(*) to int in bash?

I'd like to execute this and check if count is 0, 1 or > 1 in bash.               mysql -e "select count(*) from mydb.mydb;"      The output is:               +----------+     | count(*) |     +----------+     |        0 |     +----------+      I don't know how to parse this. Also this will be used in a cron job, so I can't have any output.


How to view files hidden by a mount on Debian 6

I have been trying for a while to view files, hidden by a mount on my device sporting Debian 6, to no avail, and being new to Linux, I am compelled to ask the question: How do you view files hidden by a mount on Debian 6? I have gone over the many duplicates I came across as I was drafting this question the first 1 or 10 times and the following answers did not help in my case:   1. Answer to "Access to original contents of mount point"   2. Answer to "Where do the files go if you mount a drive to a folder that already contains files?"   3. Answer to "What happened to the old files if we mount a drive to the directory? [duplicate]" I also found this, but it was a little intimidating to try that with my limited knowledge of what I am even doing. I also asked Linux users around me, who all (both) say that it's impossible to see my files without `umount`ing. So just to make things clear, this is what I am working with:               /tmp # mkdir FOO     /tmp # cd FOO/     /tmp/FOO # touch abc     /tmp/FOO # cd     ~ # mount /dev/sda1 /tmp/FOO/     ~ # ls /tmp/FOO/     bbb     ~ # cd /tmp/     /tmp # mkdir BAR     /tmp # cd     ~ # mount --bind / /tmp/BAR     ~ # cd /tmp/BAR/     /tmp/BAR # ls     bin      etc      lib      media    proc     sbin     sys      usr     dev      home     linuxrc  mnt      root     selinux  tmp      var     /tmp/BAR # cd tmp/     /tmp/BAR/tmp # ls     /tmp/BAR/tmp #      @John1024:               ~ # mount | grep /tmp/     /dev/sda1 on /tmp/FOO type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp932,iocharset=cp932,errors=remount-ro)     /dev/root on /tmp/BAR type jffs2 (ro,relatime)      What and to where should I `mount --bind` to see the files that were in `/tmp/somefolder`? Could the functionality of the solutions linked above be related to what build of Debian I am using? Edit: For clarification, these are some of the commands I tried:               ~ # mount --bind /tmp/somefolder /tmp/anotherfolder     ~ # mount --bind / /tmp/anotherfolder     ~ # mount --bind /dev/sda1 /tmp/anotherfolder


Do I require a file system when I do not want to store any data

I asked a question here Is it mandatory to have a file system One of the comments is : > how a system without file system would work on linux as even a printer or > ethernet card is considered as a file ? What is your goal here ? ...Kiwy Feb > 24 at 14:18 Now here is a log message when booting linux without a file system (which is hanging at the end):                   [Tue Apr 08 20:07:18.298 2014]      [Tue Apr 08 20:07:18.298 2014]      [Tue Apr 08 20:07:18.298 2014] U-Boot 2013.07 (Apr 08 2014 - 14:27:03)     [Tue Apr 08 20:07:18.298 2014]      [Tue Apr 08 20:07:18.298 2014] Memory: ECC disabled     [Tue Apr 08 20:07:18.298 2014] DRAM:  1 GiB     [Tue Apr 08 20:07:18.308 2014] SF: Detected N25Q128A with page size 64 KiB, total 16 MiB     [Tue Apr 08 20:07:18.341 2014] *** Warning - bad CRC, using default environment     [Tue Apr 08 20:07:18.341 2014]      [Tue Apr 08 20:07:18.341 2014] In:    serial     [Tue Apr 08 20:07:18.341 2014] Out:   serial     [Tue Apr 08 20:07:18.341 2014] Err:   serial     [Tue Apr 08 20:07:18.341 2014] U-BOOT for Xilinx-ZC702-14.7     [Tue Apr 08 20:07:18.341 2014]      [Tue Apr 08 20:07:18.341 2014]      [Tue Apr 08 20:07:18.341 2014] SF: Detected N25Q128A with page size 64 KiB, total 16 MiB     [Tue Apr 08 20:07:18.697 2014] Linux     [Tue Apr 08 20:07:18.697 2014]      Load Address: 0x00008000     [Tue Apr 08 20:07:18.697 2014]      Entry Point:  0x00008000     [Tue Apr 08 20:07:18.697 2014]    Verifying Hash Integrity ... OK     [Tue Apr 08 20:07:18.697 2014] ## Loading fdt from FIT Image at 01000000 ...     [Tue Apr 08 20:07:18.697 2014]    Using 'conf@1' configuration     [Tue Apr 08 20:07:18.697 2014]    Trying 'fdt@1' fdt subimage     [Tue Apr 08 20:07:18.697 2014]      Description:  Flattened Device Tree blob     [Tue Apr 08 20:07:18.697 2014]      Type:         Flat Device Tree     [Tue Apr 08 20:07:18.697 2014]      Compression:  uncompressed     [Tue Apr 08 20:07:18.697 2014]      Data Start:   0x0111d344     [Tue Apr 08 20:07:18.697 2014]      Data Size:    11179 Bytes = 10.9 KiB     [Tue Apr 08 20:07:18.697 2014]      Architecture: ARM     [Tue Apr 08 20:07:18.697 2014]      Hash algo:    crc32     [Tue Apr 08 20:07:18.697 2014]      Hash value:   a7a92b47     [Tue Apr 08 20:07:18.697 2014]      Hash algo:    sha1sha1+ OK     [Tue Apr 08 20:07:18.702 2014]    Booting using the fdt blob at 0x111d344     [Tue Apr 08 20:07:18.702 2014]    UncomprOK     [Tue Apr 08 20:07:18.702 2014]    Loading Device Tree to 07ffa000, end 07fffbaa ... OK     [Tue Apr 08 20:07:18.702 2014]      [Tue Apr 08 20:07:18.702 2014] Starting kernel ...     [Tue Apr 08 20:07:18.702 2014]      [Tue Apr 08 20:07:19.453 2014] u @c0a7b000 s5568 r8192 d14912 u32768     [Tue Apr 08 20:07:19.453 2014] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096     [Tue Apr 08 20:07:19.453 2014] Kernel command line: root=mtd:jffs2 rw rootfstype=jffs2 console=ttyPS0,115200     [Tue Apr 08 20:07:19.453 2014] PID hash table entries: 4096 (order: 2, 16384 bytes)     [Tue Apr 08 20:07:19.453 2014] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)     [Tue Apr 08 20:07:19.453 2014] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)     [Tue Apr 08 20:07:19.453 2014] __ex_table already sorted, skipping sort     [Tue Apr 08 20:07:19.453 2014] Memory: 1024MB = 1024MB total     [Tue Apr 08 20:07:19.453 2014] Memory: 1036960k/1036960k available, 11616k reserved, 270339 16                         [Tue Apr 08 20:07:19.625 2014] I reach build/linux/kernel/xlnx-3.8/source/net/socket.c:                              [Tue Apr 08 20:07:19.625 2014] DMA: preallocated 256 KiB pool for atomic coherent allocations     [Tue Apr 08 20:07:19.625 2014] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xf004e000     [Tue Apr 08 20:07:19.625 2014] GPIO IRQ not connected     [Tue Apr 08 20:07:19.625 2014] XGpio: /amba@0/gpio@41220000: registered, base is 255     [Tue Apr 08 20:07:19.625 2014] GPIO IRQ not connected     [Tue Apr 08 20:07:19.625 2014] XGpio: /amba@0/gpio@41200000: registered, base is 251     [Tue Apr 08 20:07:19.625 2014] usbcore: registered new interface driver usbfs     [Tue Apr 08 20:07:19.625 2014] usbcore: registered new interface driver hub     [Tue Apr 08 20:07:19.625 2014] usbcore: registered new device driver usb     [Tue Apr 08 20:07:19.625 2014] Switching to clocksoutyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps     [Tue Apr 08 20:07:19.629 2014] console [ttyPSxusbps-ehci xusbps-ehci.0: irq 53, io mem 0x00000000     [Tue Apr 08 20:07:19.670 2014] xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 1.00     [Tue Apr 08 20:07:19.675 2014] hub 1-0:1.0: USB hub found     [Tue Apr 08 20:07:19.675 2014] hub 1-0:1.0: 1 port detected     [Tue Apr 08 20:07:19.681 2014] xi2cps e0004000.ps7-i2c: 400 kHz mmio e0004000 irq 57     [Tue Apr 08 20:07:19.686 2014] xadcps f8007100.ps7-xadc: enabled:   yes reference:  external     [Tue Apr 08 20:07:19.709 2014] xwdtps f8005000.ps7-wdt: Xilinx Watchdog Timer at f00ea000 with timeout 10s     [Tue Apr 08 20:07:19.709 2014] sdhci: Secure Digital Host Controller Interface driver     [Tue Apr 08 20:07:19.709 2014] sdhci: Copyright(c) Pierre Ossman     [Tue Apr 08 20:07:19.709 2014] sdhci-pltfm: SDHCI platform and OF driver helper     [Tue Apr 08 20:07:19.729 2014] usbcore: registered new interface driver usbhid     [Tue Apr 08 20:07:19.729 2014] usbhid: USB HID core driver               [Tue Apr 08 20:07:19.729 2014]  I am at build/linux/kernel/xlnx-3.8/source/drivers/hid/usbhid/hid-core.c                    [Tue Apr 08 20:07:19.729 2014] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4     [Tue Apr 08 20:07:19.781 2014] MTD: MTD device with name "jffs2" not found.     [Tue Apr 08 20:07:19.781 2014] List of all partitions:     [Tue Apr 08 20:07:19.781 2014] No filesystem could mount root, tried:  jffs2     [Tue Apr 08 20:07:19.781 2014] Kernel panic - not syncing: VFS: Unable to mount root fs on mtd:jffs2     [Tue Apr 08 20:07:19.781 2014] CPU1: stopping     [Tue Apr 08 20:07:19.781 2014] Backtrace:      [Tue Apr 08 20:07:19.781 2014] Function entered at [<c0011094>] from [<c01c6408>]     [Tue Apr 08 20:07:19.781 2014]  r6:c0246418 r5:00000000 r4:00000001 r3:60000193     [Tue Apr 08 20:07:19.781 2014] Function entered at [<c01c63f0>] from [<c0011fbc>]     [Tue Apr 08 20:07:19.781 2014] Function entered at [<c0011f78>] from [<c0012270>]     [Tue Apr 08 20:07:19.781 2014]  r4:c0247ef4 r3:c0011f78     [Tue Apr 08 20:07:19.781 2014] Function entered at [<c001220c>] from [<c00084e4>]     [Tue Apr 08 20:07:19.781 2014]  r5:ef07bf68 r4:f8f00100     [Tue Apr 08 20:07:19.824 2014] Function entered at [<c0008484>] from [<c000da00>]     [Tue Apr 08 20:07:19.824 2014] Exception stack(0xef07bf68 to 0xef07bfb0)     [Tue Apr 08 20:07:19.824 2014] bf60:                   c0a838d0 00000000 00000003 00000000 ef07a000 c01cd528     [Tue Apr 08 20:07:19.824 2014] bf80: ef07a000 c025c418 0000406a 413fc090 00000000 ef07bfbc ef07bfc0 ef07bfb0     [Tue Apr 08 20:07:19.824 2014] bfa0: c000e94c c000e950 60000113 ffffffff     [Tue Apr 08 20:07:19.824 2014]  r6:ffffffff r5:60000113 r4:c000e950 r3:c000e94c     [Tue Apr 08 20:07:19.824 2014] Function entered at [<c000e924>] from [<c000eacc>]     [Tue Apr 08 20:07:19.824 2014] Function entered at [<c000ea40>] from [<c01c4208>]     [Tue Apr 08 20:07:19.824 2014]  r5:00000001 r4:c024cf68     [Tue Apr 08 20:07:19.824 2014] Function entered at [<c01c4118>] from [<001c37c8>]     [Tue Apr 08 20:07:19.844 2014]  r6:10c03c7d r5:00000015 r4:2f06406a r3:c01c37b0     [Tue Apr 08 20:07:19.844 2014] MTD: MTD device with name "jffs2" not found.     [Tue Apr 08 20:07:19.844 2014] List of all partitions:     [Tue Apr 08 20:07:19.844 2014] No filesystem could mount root, tried:  jffs2     [Tue Apr 08 20:07:19.844 2014] Kernel panic - not syncing: VFS: Unable to mount root fs on mtd:      I am booting from flash. Now from the log it is very clear that many of the drivers are already loaded even though file system loading is failed (because I intentionally did not put the file system rootfs.jffs2 in flash ). Now referring to the comment above, if everything is file in linux, how come drivers are successfully loaded? You can see USB,GPIO, SD everything is coming before it asks for file system (and failed). So is it technically correct to say that > linux MUST have a file system **Some background** What I am trying to achieve is to have linux running on a system where a control application will be running. The application just captures some data and send it to some slaves. There is not question of storing data AT ALL. So would like to completely get rid of file system. As per my understanding file system is required for storing data and since I willnot storing any data so why have file system and increase the resource usage ? **Update** _Although I have mentioned this in **background** , but to be specific the sending of the data would take place using USB or Ethernet, so it is natural to have corresponding drivers._


What does "tail -f " do?

I don't understand the function of the option `-f` added to the `tail` command. I know that `tail` views the "last" part of a file. The manual says that > `-f` outputs appended data as the file grows But I don't really understand what that means. I know the meaning of each word in the previous quotation, but I don't understand the meaning of the whole sentence.


Extract name of file without extension in shell script

> **Possible Duplicate:**   >  Best way to remove file extension from a string?   >  How to rename multiple files by removing the extension? I have a metric boatload of .txt files I'd like to load into a database. The tables have the same name as the .txt files, but without the extension. So I'd like to execute the command               for f in *.txt; do mysql -u root -p -e "LOAD DATA LOCAL INFILE '$f' INTO TABLE $f" -D rn4; done      However, the last `$f` is giving me headaches as I want it to only use the name, not the extension. So for the file `piRNA.txt` the command would look like               mysql -u root -p -e "LOAD DATA LOCAL INFILE 'piRNA.txt' INTO TABLE piRNA" -D rn4      How do I do this? To make the answer useful for others, please do not just give me the command, but please write a line or two about how to extract the name in the general case.


getting file name from the input path to the file in shell scripts

> **Possible Duplicate:**   >  Best way to remove file extension from a string? Say that I have a script called `script.sh` In the shell I type               script.sh ../folder/file.py      and in that file I know `echo $1` will output `../folder/file.py` But is there anyway of getting just the filename without the extension... `file` only?


How to rename multiple files by removing the extension?

I have a number of tiff files named:               sw.001.tif     sw.002.tif     ...      and I want to remove the `.tif` at the end of each of the files. How can I use the `rename` command to do this?


Which to choose - BSD or Unix-style commands where available?

Commands like `ps` come with a lot of parameters, especially because they give the use an option to choose between Unix and BSD style flags. I hope you get my point here. So, when there's such an option available, which should I choose for maximum compatibility across all linux systems? (max. compatibility is one of the priorities for instance) I know that Unix style is quite obvious, but BSD commands for some reason include more readable information (column titles for example, CPU column etc). Of course, please correct me if I am wrong, but that's what I felt.


Reinstall Debian

I have a Debian based server but I don't have physical access to it and it doesn't have a DVD-drive or similar. I only have root access. Is it possible to format and reinstall Debian just by using the root account? I was thinking of solutions like installing to a separate partition and after install format the current partition or perhaps using VMWare and always run it as a VM although this would impede performance. This is because my Debian server is currently in my home country(at my parents) while I moved to another country. Do you think perhaps I should dump the server altogether and go for a hosted solution? I normally would prefer to keep my server because hosted solutions normally cost you more than having your own server and paying only for electricity.


How to have tail -f show colored output with vim?

In this question, Gilles answered > Yet another possibility is to run `tail -f` in an **Emacs** shell buffer and > use Emacs's syntax coloring abilities. Because I'm a vim user, I'd like to do this with _vim_ , not _emacs_.   Does _vim_ have this feature?


Can not install wine on debian amd64:

Can not install wine on debian amd64: > sudo aptitude install wine-bin Note: selecting "wine-bin:i386" instead of > the virtual package "wine-bin" The following NEW packages will be installed: > gcc-4.8-base:i386{ab} libasound2:i386{a} libc6:i386{a} libc6-i686:i386{a} > libdbus-1-3:i386{a} libdrm-intel1:i386{a} libdrm-nouveau2:i386{a} libdrm- > radeon1:i386{a} libdrm2:i386{a} libexpat1:i386{a} libffi6:i386{a} > libfontconfig1:i386{a} libfreetype6:i386{a} libgcc1:i386{ab} > libgcrypt11:i386{a} libgl1-mesa-dri:i386{a} libgl1-mesa-glx:i386{a}   >  libglapi-mesa:i386{a} libglu1-mesa:i386{a} libgnutls26:i386{a}   >  libgpg-error0:i386{a} libgpm2:i386{a} libgsm1:i386{a} libice6:i386{a} > libjbig0:i386 libjpeg8:i386{a} libllvm3.2:i386{a} libltdl7:i386{a}   >  liblzma5:i386{a} libmpg123-0:i386{a} libncurses5:i386{a} libodbc1:i386{a} > libp11-kit0:i386{a} libpciaccess0:i386{a} libpng12-0:i386{a} libsm6:i386{a} > libssl1.0.0:i386{a} libstdc++6:i386{ab} libtasn1-3:i386{a} libtiff4:i386{a} > libtinfo5:i386{a} libtxc-dxtn-s2tc0:i386{a} libuuid1:i386{a} > libv4l-0:i386{a} libv4lconvert0:i386{a} libwine:i386{a}   >  libwine-alsa:i386{a} libwine-bin:i386{a} libwine-gecko-1.4{a}   >  libwine-gl:i386{a} libx11-6:i386{a} libx11-xcb1:i386{a} libxau6:i386{a} > libxcb-dri2-0:i386{a} libxcb-glx0:i386{a} libxcb1:i386{a} > libxcomposite1:i386{a} libxcursor1:i386{a} libxdamage1:i386{a} > libxdmcp6:i386{a} libxext6:i386{a} libxfixes3:i386{a} libxi6:i386{a} > libxinerama1:i386{a} libxml2:i386{a} libxrandr2:i386{a} libxrender1:i386{a} > libxslt1.1:i386{a} libxxf86vm1:i386{a} wine-bin:i386{b} zlib1g:i386{a} 0 > packages upgraded, 71 newly installed, 0 to remove and 0 not upgraded. Need > to get 84.1 MB of archives. After unpacking 253 MB will be used. The > following packages have unmet dependencies: gcc-4.8-base : Breaks: > gcc-4.8-base:i386 (!= 4.8.1-7) but 4.8.1-6 is to be installed. > gcc-4.8-base:i386 : Breaks: gcc-4.8-base (!= 4.8.1-6) but 4.8.1-7 is > installed. libgcc1 : Breaks: libgcc1:i386 (!= 1:4.8.1-7) but 1:4.8.1-6 is to > be installed. libgcc1:i386 : Breaks: libgcc1 (!= 1:4.8.1-6) but 1:4.8.1-7 is > installed. libstdc++6 : Breaks: libstdc++6:i386 (!= 4.8.1-7) but 4.8.1-6 is > to be installed. libstdc++6:i386 : Breaks: libstdc++6 (!= 4.8.1-6) but > 4.8.1-7 is installed. wine-bin:i386 : Conflicts: wine64-bin but 1.5.30-2 is > installed. The following actions will resolve these dependencies: >   >   >       Keep the following packages at their current version:           1) > gcc-4.8-base:i386 [Not Installed]   >   > > 2) libasound2:i386 [Not Installed]   >  3) libc6:i386 [Not Installed]   >  4) libc6-i686:i386 [Not Installed]   >  5) libdbus-1-3:i386 [Not Installed]   >  6) libdrm-intel1:i386 [Not Installed]   >  7) libdrm-nouveau2:i386 [Not Installed]   >  8) libdrm-radeon1:i386 [Not Installed]   >  9) libdrm2:i386 [Not Installed]   >  10) libexpat1:i386 [Not Installed]   >  11) libffi6:i386 [Not Installed]   >  12) libfontconfig1:i386 [Not Installed]   >  13) libfreetype6:i386 [Not Installed]   >  14) libgcc1:i386 [Not Installed]   >  15) libgcrypt11:i386 [Not Installed]   >  16) libgl1-mesa-dri:i386 [Not Installed]   >  17) libgl1-mesa-glx:i386 [Not Installed]   >  18) libglapi-mesa:i386 [Not Installed]   >  19) libglu1-mesa:i386 [Not Installed]   >  20) libgnutls26:i386 [Not Installed]   >  21) libgpg-error0:i386 [Not Installed]   >  22) libgpm2:i386 [Not Installed]   >  23) libgsm1:i386 [Not Installed]   >  24) libice6:i386 [Not Installed]   >  25) libjbig0:i386 [Not Installed]   >  26) libjpeg8:i386 [Not Installed]   >  27) libllvm3.2:i386 [Not Installed]   >  28) libltdl7:i386 [Not Installed]   >  29) liblzma5:i386 [Not Installed]   >  30) libmpg123-0:i386 [Not Installed]   >  31) libncurses5:i386 [Not Installed]   >  32) libodbc1:i386 [Not Installed]   >  33) libp11-kit0:i386 [Not Installed]   >  34) libpciaccess0:i386 [Not Installed]   >  35) libpng12-0:i386 [Not Installed]   >  36) libsm6:i386 [Not Installed]   >  37) libssl1.0.0:i386 [Not Installed]   >  38) libstdc++6:i386 [Not Installed]   >  39) libtasn1-3:i386 [Not Installed]   >  40) libtiff4:i386 [Not Installed]   >  41) libtinfo5:i386 [Not Installed]   >  42) libtxc-dxtn-s2tc0:i386 [Not Installed]   >  43) libuuid1:i386 [Not Installed]   >  44) libv4l-0:i386 [Not Installed]   >  45) libv4lconvert0:i386 [Not Installed]   >  46) libwine:i386 [Not Installed]   >  47) libwine-alsa:i386 [Not Installed]   >  48) libwine-bin:i386 [Not Installed]   >  49) libwine-gl:i386 [Not Installed]   >  50) libx11-6:i386 [Not Installed]   >  51) libx11-xcb1:i386 [Not Installed]   >  52) libxau6:i386 [Not Installed]   >  53) libxcb-dri2-0:i386 [Not Installed]   >  54) libxcb-glx0:i386 [Not Installed]   >  55) libxcb1:i386 [Not Installed]   >  56) libxcomposite1:i386 [Not Installed]   >  57) libxcursor1:i386 [Not Installed]   >  58) libxdamage1:i386 [Not Installed]   >  59) libxdmcp6:i386 [Not Installed]   >  60) libxext6:i386 [Not Installed]   >  61) libxfixes3:i386 [Not Installed]   >  62) libxi6:i386 [Not Installed]   >  63) libxinerama1:i386 [Not Installed]   >  64) libxml2:i386 [Not Installed]   >  65) libxrandr2:i386 [Not Installed]   >  66) libxrender1:i386 [Not Installed]   >  67) libxslt1.1:i386 [Not Installed]   >  68) libxxf86vm1:i386 [Not Installed]   >  69) wine-bin:i386 [Not Installed]   >  70) zlib1g:i386 [Not Installed] >   >   >       Leave the following dependencies unresolved:                    71) > libgl1-mesa-glx:i386 recommends libgl1-mesa-dri:i386 (>= 7.2) >   > > 72) libncurses5:i386 recommends libgpm2:i386   >  73) libwine:i386 recommends libgsm1:i386 (>= 1.0.13)   >  74) libwine:i386 recommends libv4l-0:i386 (>= 0.5.0)


apt-mirror clean script isn't deleting anything

I am using `apt-mirror` to create a local Ubuntu mirror. It does succeed in downloading files from another mirror (there's about a couple gigabytes each week), but never removing anything or indicates files that can be deleted. I might run out of free space, eventually. The output of `apt-mirror` always include > 0.0 bytes in 0 files and 0 directories can be freed. > > Run /var/spool/apt-mirror/var/clean.sh for this purpose. The `clean.sh` is ran every time `apt-mirror` executes, because the content of `/var/spool/apt-mirror/var/postmirror.sh` is just               /var/spool/apt-mirror/var/clean.sh      Running `clean.sh` produces this output: > Removing 0 unnecessary files [0 bytes]... done. > > Removing 0 unnecessary directories... done. Here's my `mirror.list` file:               ############# config ##################     #     # set base_path    /var/spool/apt-mirror     #     # set mirror_path  $base_path/mirror     # set skel_path    $base_path/skel     # set var_path     $base_path/var     # set cleanscript $var_path/clean.sh     # set defaultarch  <running host architecture>     # set postmirror_script $var_path/postmirror.sh     # set run_postmirror 0     set nthreads     20     set _tilde 0     #     ############# end config ##############          deb-i386 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty main restricted universe multiverse      deb-i386 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-updates main restricted universe multiverse      deb-i386 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-backports main restricted universe multiverse      deb-i386 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-security main restricted universe multiverse           deb-amd64 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty main restricted universe multiverse      deb-amd64 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-updates main restricted universe multiverse      deb-amd64 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-backports main restricted universe multiverse      deb-amd64 http://ubuntu.c3sl.ufpr.br/ubuntu/ trusty-security main restricted universe multiverse           clean http://archive.ubuntu.com/ubuntu


What is the point of CTRL-s?

`CTRL`+`s` stops all output to the terminal which can be restarted with `CTRL`+`q`. But, why does `CTRL`+`s` exist in the first place? What problem was trying to be solved by putting that control sequence in place?


Why is my bash prompt getting bugged when I browse the history?

Often when I start looking at history of commands some of the characters from a command displayed aren't erased, for example: What's happening:               prompt$ some_command     prompt$ some_commanother_command      What should have happened:               prompt$ some_command     prompt$ another_command      I can't erase those characters and bash ignores them when executing the command. They also disappear when a new prompt is being displayed (after pressing `Enter` for example). I asked other people who work on Linux at my workplace and they said that they have that problem sometimes too, but they didn't have an idea on how solve that issue. I have Ubuntu 11.10 and I'm using guake. Here is my `PS1`:               \e[0;31m\u \A ${PWD##*/}\e[0;32m$(parse_git_branch)\e[0;31m$\e[m      where `parse_git_branch` is               parse_git_branch () {         git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (\1)#'     }      As far as I know my colleagues have that problem even with less "fancy" PS1.


why bash history overlap the prompt when scroll up in the history?

I customized my bash prompt, PS1 value. `~/.bashrc`:               Color_Off='\e[0m'       # Text Reset     BGreen='\e[1;32m'       # Green     BPurple='\e[1;35m'      # Purple     BWhite='\e[1;37m'       # White     BIBlue='\e[1;94m'       # Blue     PS1="[\[$BGreen\w\]\[$Color_Off\]]\n[\[$BPurple\u\]\[$BWhite\]@\[$BIBlue\h\]\[$Color_Off\]]\$ "      When I scroll up in the history with up arrow from the keyboard, after a lot of command I can see these:               [/etc]     [bicocca@bicoccag]$ vi     [/etc]     [bicocca@bicoccag]$ vim     [/etc]     [bicoclear      The command overlaps the prompt. How I can resolve the issue? I tried to search in Google but I did not found anything. I am using RHEL6.4.


Why does this PS1 value cause unexpected behaviour?

> **Possible Duplicate:**   >  Why is my bash prompt getting bugged when I browse the history? I have set my `PS1` variable in `.bashrc` to be the following: `PS1='\e[35m[\W]:\e[0m '` It achieved what it was intended to (change the color of the prompt which displays `cwd` inside `[]` and before `:`), but when I search through my command history, sometimes parts of commands that I cycle over become attached to the prompt. For example:               [~]: echo "something"     something     [~]: date     Sun Nov 18 17:07:54 PST 2012     [~]: sudo apt-get install vim     ...      Now, say I want to return to my `echo "something"` command, I press up and get               [~]: sudo apt-get install vim      I press up again and this happens               [~]: sudo apt-date      up again               [~]: sudo apt-echo "something"      and if I delete everything on the command line by pressing backspace, it deletes all the way back to               [~]: sudo apt-      It has no affect on the command. For example, the line `[~]: sudo apt-date` will still print the output of `date` etc. Why is this happening and how can I achieve the desired prompt without the side effects?


bash script that shows mysql innodb log file size

I am creating bash script that gives me size of mysql innodb log file in **MB**. Currently I am getting its output in bytes. Please check it out following script and help to get output in MB.               #! /bin/sh            a=$(mysql -uroot -proot -e  "SHOW VARIABLES" | grep innodb_log_file_size | cut -f2)       b=$(echo "$a/$10240" )           echo {"Innodb_log_file_size":"'$b'"' }


How to find files with a certain subpath?

I need to find all xml-files that are placed in folders named `config`. Also `config` must be somewhere under a folder named `trunk`. For example, I am interested in all files like below:               ~/projects/e7/trunk/a/b/c/config/foo.xml     ~/projects/d/trunk/config/bar.xml     ~/projects/trunk/config/other.xml     ~/projects/e/e/e/trunk/e/e/e/e/e/e/e/e/config/eeeee.xml      I tried the `find` command:               find ~/projects -regex "*/trunk/*/config/*.xml"      , but the output was empty. What is the correct way to find the required files?


How to send a output of unix command from one server to another server?

How to redirect the output of a unix command from one server to another server. I should be able to send the unix command's output from server-1. Then I should be able to receive the output in Server-2 and write it into a file.


Reload /etc/default/locale without reboot?

After making changes to `/etc/default/locale`, is it possible to reload/active the new settings without a reboot?


Fixing permissions on a buffalo NAS (XFS via SMB)

I have a `Buffalo dual harddrive NAS` and plugged one of the drives directly to an `SATA` port to speed up the file transfer (100 MBit is a 'bit' slow when transfering 2 TB of files). I used a live Ubuntu DVD to mount the volume. My problem now is, I can't delete or rename any of the files I copied directly via Linux to that drive. Windows 7 demands that I'm admin of this computer. I can't even see the permissions since I do not have permission to do so. Is there an easy way to fix this, preferably without hooking it back to the `SATA` port?


Reverse global and local marks in vi/vim

How can I reverse the capitalization convention of marks in vi/vim? Normally a lower-case mark like "a" means is local to the current file, but upper case marks like "A" are global to the session. Since I normally use only global marks I want the lower case to be the global marks. In other words I want to reverse the default convention.


Preventing duplicate entried in PATH (.cshrc)

I have little experience with Linux, so I will appreciate some help. I need to prepend directories to the path variable in my `.cshrc` file and I want to make sure that the entries are not repeated when compared to existing directories in the path variable. Can someone please advise suitable commands for that? The path on my machine is `:` separated, not space separated.


How to execute consecutive command from history?

Suppose I want to execute a sequence of four commands that I have executed before. If the first one is 432 in the command-history, then I could do:               $ !432; !433; !434; !435      I'm curious, is there a more efficient way to accomplish this?


Bash: repeat last N commands

In bash you can repeat the last command by entering `!!`, or the third last command `!-3` for example. Is there a quick way to repeat the last 3 commands, without having to type out `!-1; !-2; !-3` explicitly?


VNC & SSH : local (win-putty) -> hop (linux) -> remote (linux)

I'm gettin a headache trying to access a remote VLC & SSH. This is the situation : `Local` : Win box behind NAT, dynamic IP. I want to connect from here. `Hop` : Linux box, static IP server `Remote` : Linux box behind NAT, dynamic IP. I want to connect here As the `remote` has dynamic IP and is behind NAT, I make ssh reverse tunnels to the `hop` :               ssh -R 55900:localhost:5900 -R 50022:localhost:22 user@hop      This step seems to work. From the `hop`, I can ssh the `remote` connecting to localhost port 50022 :               ssh -p 50022 user@localhost      Then from the local, I make ssh tunnels to the hop, with putty : ![Making tunnels](http://i.stack.imgur.com/tWB7W.jpg) Once the second tunnel is made on `local`, when I try to reach the `remote` SSH or VNC, the connection is straight closed. For SSH (via another instance of putty), I get the error "Server unexpectedty closed the connection" For VNC (TightVNC Viewer) : "Connection has been gracefully closed" I tried to change some putty options after looking for solutions on the web, as "enable X11 forwarding", or "Allow agent forwarding", but without success. Any idea of how to solve this? Thanks


Allow www-data to perform specific commands

I need a PHP script to perform `git pull` however I am not naive enough to give it permissions on `git`. I've wrapped `git pull` in a script which `www- data` has permissions for, but I'm not sure how to give the script permissions on `git` itself:               $ sudo tail -n1 /etc/sudoers     www-data ALL=(ALL) NOPASSWD: /home/php-scripts/git-pull          $ cat /home/php-scripts/git-pull     #!/bin/bash     /usr/bin/git pull          $ ls -la /home | grep php-scripts     drwxr-xr-x  2 ubuntu ubuntu 4096 Sep  3 09:26 php-scripts          $ ls -la /home/php-scripts/git-pull     -rwxrwxr-x 1 ubuntu ubuntu 30 Sep  3 08:44 /home/php-scripts/git-pull          $ cat /var/www/public_html/git-wrapper.php     <?php          $output = array();     $value = 0;     exec("/home/php-scripts/git-pull", $output, $value);          echo "<pre>";       echo "Return Value: {$value}\n";          foreach ( $output as $o) {         echo $o."\n";     }          ?>      Note that `/var/www/public_html/` is in fact a git repository. I often perform `git pull` in that directory from the CLI. However, when I call this script in a web browser I see that the files were not updated via `git pull` and the following is output to the browser:               Return Value: 1      This is on Ubuntu Server 12.04 with Git 1.7.9.5. The remote repository is on the same server.


how to move files from one folder to other with appending time stamp to the name?

> **Possible Duplicate:**   >  Renaming a bunch of files with date modified timestamp at the end of the > filename? I want to move files from one folder to another folder with appending time stamp to file names. For example, I have two files called `file1` and `file2` in folder `f1`. I want to move these files to folder `f2` as file names `file1_22_jan_11:42` and `file2_22_jan_11:42`.


How do I recursively check permissions in reverse?

There's a command, I think it comes with apache, or is somehow related to it, that checks permissions, all the way down. So if I have `/home/foo/bar/baz` it will tell me what the permissions are for `baz`, `bar`, `foo`, and `home`. Does anyone know what this command is or another way of doing this? The command basically starts at the argument, and works it's way up to `/` letting you know what the permissions are along the way so you can see if you have a permission problem.


Open a file given by the result of a command in vim

I find myself doing the following almost every day   1. Run a find (`find -name somefile.txt`)   2. Open the result in `vim` The problem is I have to copy and paste the result of the `find` into the `vim` command. Is there any way to avoid having to do this? I have experimented a bit (`find -name somefile.txt | vim`) but haven't found anything that works. Thanks in advance


systemd failure on binfmt services

Systemd has several failed services, and I don't know how to work it out:               # systemctl --failed     UNIT                              LOAD   ACTIVE SUB    JOB DESCRIPTION     proc-sys-fs-binfmt_misc.automount loaded failed failed     Arbitrary Executable File Formats File System Automount Point     systemd-binfmt.service            loaded failed failed     Set Up Additional Binary Formats      More details:               # systemctl status systemd-binfmt.service     systemd-binfmt.service - Set Up Additional Binary Formats           Loaded: loaded (/usr/lib/systemd/system/systemd-binfmt.service; static)           Active: failed (Result: exit-code) since Tue, 2012-11-27 07:42:11 CST; 36min ago             Docs: man:systemd-binfmt.service(8)                   man:binfmt.d(5)                   https://www.kernel.org/doc/Documentation/binfmt_misc.txt          Process: 213 ExecStart=/usr/lib/systemd/systemd-binfmt (code=exited, status=1/FAILURE)           CGroup: name=systemd:/system/systemd-binfmt.service          # systemctl status proc-sys-fs-binfmt_misc.automount     proc-sys-fs-binfmt_misc.automount - Arbitrary Executable File Formats File System Automount Point           Loaded: loaded (/usr/lib/systemd/system/proc-sys-fs-binfmt_misc.automount; static)           Active: failed (Result: resources)            Where: /proc/sys/fs/binfmt_misc             Docs: https://www.kernel.org/doc/Documentation/binfmt_misc.txt      Any suggestions?


Can I use seq to go from 001 to 999?

Can I use seq to go from 001 to 999?


Processing FreeBSD's PF logs with tcpdump/sed/awk

I'm running FreeBSD and have PF firewall set up and this is command i use to display daily number of firewall hits (blocked traffic)               sudo tcpdump -n -e -tttt -r /var/log/pflog | grep $(date +%Y-%m-%d)|wc -l|sed 's/ *//' >> /home/pentago/www/pf.txt      That displays number, say 95. I want to process pf.txt file in a way that each line has the date before hit count. For example:   * 01-01-2014 - 95    * 02-01-2014 - 98    * 03-01-2014 - 113    * 04-01-2014 - 92 etc.. Simply put, I need sed/awk to prepend the date to each new line of the file. Does that sound reasonable?


How do I make use of unused space on my boot drive on FreeBSD

I have an old FreeBSD Server (running 7.3-RELEASE) that desperately needs additional storage. In fact, it has some-- the original 20G SCSI drives have been replaced by 300G SCSI drives, so in theory there is 280G available that could be used. I'd like to make use of this space. I think the best way to do this is by formatting the unused space as a new slice on the existing drive, but I'm not clear how to do this without destroying the data on the existing slice. Most of the documentation I can find about doing this refers to initial installation. I know how to set up slices and partitions during initial installation, but not how to claim unused space on the drive AFTER initial installation. (I'd also be happy to expand the slice and add additional partitions to the existing slice, but I've heard that this is riskier). I thought the easy way to do this might be to use /stand/sysinstall, but when I go into either Configure->FDisk or Configure->Label, I get this message:               No disks found!  Please verify that your disk controller is being     properly probed at boot time.  See the Hardware Guide on the     Documentation menu for clues on diagnosing this type of problem.      This is obviously untrue, since I'm actually running off of a disk when I get this message, but maybe sysinstall just doesn't like messing with the boot disk? Output of fdisk da0:               ******* Working on device /dev/da0 *******     parameters extracted from in-core disklabel are:     cylinders=2235 heads=255 sectors/track=63 (16065 blks/cyl)          Figures below won't work with BIOS for partitions not in cyl 1     parameters to be used for BIOS calculations are:     cylinders=2235 heads=255 sectors/track=63 (16065 blks/cyl)          Media sector size is 512     Warning: BIOS sector numbering starts with sector 1     Information from DOS bootblock is:     The data for partition 1 is:     sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)         start 63, size 35905212 (17531 Meg), flag 80 (active)             beg: cyl 0/ head 1/ sector 1;             end: cyl 1023/ head 254/ sector 63     The data for partition 2 is:     <UNUSED>     The data for partition 3 is:     <UNUSED>     The data for partition 4 is:     <UNUSED>      Output of bsdlabel da0s1               # /dev/da0s1:     8 partitions:     #        size   offset    fstype   [fsize bsize bps/cpg]       a:  2097152        0    4.2BSD     2048 16384    89       b:  2097152  2097152      swap       c: 35905212        0    unused        0     0         # "raw" part, don't edit       e:  2097152  4194304    4.2BSD     2048 16384    89       f: 29613756  6291456    4.2BSD     2048 16384    89      Update: I came a cross the advice to use sade for this purpose. Unfortunately, sade can't see much empty space:                        0         63         62        -     12     unused        0             63   35905212   35905274    da0s1      8    freebsd      165       35905275      10501   35915775        -     12     unused        0      This may be a dead end. Do I need to figure out drive geometry somehow? It might be relevant to mention that the drive is a RAID 1 mirror set; originally the mirrored drives were both 20G SCSI drives but they've both been swapped out with 300G drives. I'm willing to temporarily break the mirror if that will help.


What happens in each step of the Linux kernel-building process?

I've read many tutorials about how to build custom kernels and boot Ubuntu using those kernels, and successfully followed the guides and booted custom kernels, but I have no understanding about what each of the command in the guides do and what is actually happening with each command. The procedure described on Ubuntu's site does a lot of work with `fakeroot`, `dpkg`, `make-kpkg`, some initramfs, and other horrible stuff that works but simply does not help me understand what is going on.   * What is the output of `make` in a linux kernel directory?    * Does it create a "compressed kernel image"?    * What is the name of the "compressed kernel image" file and where is it placed?   * What does `make modules` do?   * Should `make modules` be done before or after `make`?   * Doesn't `make` build my modules automatically?   * What is the process (in English, not just the list of commands) of adding newly built kernels to the list of bootable kernels?   * What does `make install` do?   * Will `make install` add it to my list of bootable kernels so that I don't have to do anything more?   * Is there an equivalent `make modules_install`?


awk, sed, grep, perl... which to print out in this case?

I have this syntax in a file (http response times from analog):

seconds	reqs	%reqs	Gbytes	%bytes

0	10927	 0.47%	0.01	 0.18%

<= 0.01	1026471	44.59%	0.11	 1.81%

0.01-0.02	535390	23.26%	0.06	 0.95%

0.02-0.05	93298	 4.05%	0.27	 4.29%
      etc. What I want to be left with is the value for seconds - so 2 characters after "x" and before the first < And also the request length, so 2 characters after "R" and before the next subsequent < Probably not the best exercise to get to grips with regex but that's what I'm stuck with. Any help would be incredibly useful. Expected result:               seconds reqs      0 10927      &lt= 0.01 1026471      0.01-0.02 535390      0.02-0.05 93298


"Short read block" error trying to boot RHEL

I changed my network configurations from static IP to DHCP and removed the DNS entry, etc. Then I rebooted the computer, but am now unable to boot, I get an error message along the lines of "short read block filesystem ext3". How can I fix this?


Is there an equivalent of GNU Screen's "log" command in tmux?

I make heavy use of screen's "log" command to log the output of a session to a file, when I am making changes in a given environment. I searched through tmux's man page, but couldn't find an equivalent. Is anyone aware of a similar feature in tmux, or do I have to write my own wrapper scripts to do this? EDIT: I'm aware of 'script' and other utilities that allow me to log a session. The reason that screen's functionality is so useful is the ability to define a logfile variable which uses string escapes to uniquely identify each session. e.g. I have a shell function which, given a hostname, will SSH to that host in a new screen window and set the window title to the hostname. When I start a log of that session, it is prefixed with the window title. If this functionality doesn't exist in tmux, I'll have to create a new set of shell functions to set up 'scripts' of sessions I want to log. This isn't hugely difficult, but it may not be worth the effort given that screen does exactly what I need already.


Install vlc in CentOS 6.4 and embed on web page

I am doing the following: in `/etc/yum.repos.d/`:               $ wget http://pkgrepo.linuxtech.net/el6/release/linuxtech.repo     $ yum install vlc -y      How do I get the player on my web page, because currently with embed tag it is still saying "missing plug in". Is this the best option for playing `stream.cgi`? I am doing all this so I can play `videostream.cgi` from my outdoor wireless network cam, because otherwise I cannot see how to ftp that stream having already tried within admin of camera network, and anyway if I could find a way I still wouldn't know how to convert the rtsp stream.


What does __ prefix before some kernel api's convey?

Why do some function calls in kernel specially have this prefix `__` example: `__init initialization(void)` is `__init` a macro? What does this convey? Are these a special class of function calls inside the kernel or do they resemble any assembly function body present inside? What actually are they trying to represent?


wait does not wait

If i have a file called `myprogram` containing               sleep 200     date      Run this in the background:               $ sh myprogram &      i want to know when `myprogram` has completed by using `wait` command               $ cat >notify     wait PID     echo "Program completed"     $ sh notify &      `PID` is the process ID given from third command, my problem is that the message "program completed" printed on the terminal immediately after the last command,why wait does not wait? , i am using ubuntu 11.10


Parsing the output of date with sed

I am trying to replace the whitespaces in the output of date with '_' with no success.               $date     Fri Sep 14 14:10:04 EDT 2012          $ date | sed 's/ /_/'     Fri_Sep 14 14:10:24 EDT 2012      As you can see, the last command only replaced the first whitespace by a `_`'. Why did it skip the other whitespaces?


How to set xscreensaver to use blank mode without GUI?

After installing `xscreensaver` in Arch Linux my laptop has started displaying fancy, battery-depleting animations when nobody is looking. How do I configure this to use the `blank` mode via the command line (i.e., without `xscreensaver-demo`)?


Recovered deleted files on Mac by command line

I accidentally deleted a file by running:               rm -rf ./Desktop/myScript.sh      I think it's possible to recover the file, because the `rm` command removes temporarily. How can I recover the deleted file on Mac OSX?


I'm failing to restore a VirtualBox VM

I am trying to restore a VM but I get this error message: ![enter image description here](http://i.stack.imgur.com/SOuax.png) I think this happened because, while the VM was live, I removed one snapshot. How do I fix this, short of restoring older snapshots? **NOTE** : This problem happens when I use version **4.0.4**. Version **3.2.10** allows me to delete a snapshot of a VM, even though it's live. I guess it's a regression... watch me downgrading.


How can I block a network with lighttpd?

I already block some simple ip lighttpd but I want to block a whole network. I've problem to understand what is this network address for example 10.0.0.0/8 and/or 172.16.2.0/24 network? What is this /8 or /24 means? I use $HTTP["remoteip"] to add my ip I want to deny the access.


Which tasks/commands can't be executed with user gid=0 but not uid=0 on Linux

In a Linux server I will have an user with gid=0 but it's uid won't be 0. As there are many commands with root:root and execute permissions for group I know there will be a lot of administrative task that this user can't do because many programs checks at start if UID=0 Anyone knows what commands/tasks can't do a user with UID!=0 and GUID=0? That user could mount filesystems or change passwords...? For example, the user can't read messages as it has only read permissions for root owner. I know the question is open. Many thanks!


Best language to write linux services

I want to create a crawler that scans one single web page and sends me an email in case something is wrong on the page (the page holds some webservers' status - Up/Down). What would be the best language to write such a service in? I've considered PHP or Python, but as they are interpreted languages (+PHP has a max time limit that a script runs), I don't think they're the best fit for this. Also, C/C++ is not an option. I was thinking about Java, since it has Threading and I may need it, but I'm not sure.


Snapshot large changing files

At home I have the following backup scheme: All machines daily rsync to the servers $FULL_COPY directory. The server takes snapshots of that directory daily (also weekly/monthly), keeping at most X snapshots. Also using rsync:               rsync -ar --link-dest=$LATEST_SNAPSHOT $FULL_COPY $NEW_SNAPSHOT      This works great, files not changed since last snapshot get hard linked. The problem is large files (to be precise Thunderbird's inbox), a small change means an entire copy of the file. My snapshots are easily a couple of GB, but maybe only a few MB has changed. Is there a smarter way to do this? (my $FULL_COPY is also replicated on a remote machine, so I'm not in need of this redundancy). My only idea is a CoW filesystem supporting snapshots. But that would mean major surgery on my system which I'm not fond of.


A Chromebook-like distro based on Firefox OS?

I'm wondering if it's possible to make an operating system distro based on the same principle as Firefox OS or ChromeOS. One which is basically a Gnu/Linux kernel / core of tools combined with Mozilla's "Boot2Gecko" stack of Gonk / Gecko / Gaia (https://wiki.mozilla.org/B2G/Architecture) and which runs apps written in HTML5 / javascript. I want this as something I can boot from a pendrive or install on an ordinary laptop (not for a mobile-phone). Does anyone know if there's currently a project to make this? Or, if not, what would be involved in trying to put one together? (Using B2G + http://www.linuxfromscratch.org/ etc.)


How to disable SMTP auth plain for Citadel 8.20 on Slackware 14.0?

How do I turn off SMTP AUTH PLAIN for Citadel 8.20 on Slackware 14.0? If I set up postfix to handle SMTP would this allow me to not have SMTP auth plain enabled


Can I configure my shell to print STDERR and STDOUT in different colors?

I want to set my terminal up so `stderr` is printed in a different color than `stdout`; maybe red. This would make it easier to tell the two apart. Is there a way to configure this in `.bashrc`? If not, is this even possible? * * * **Note** : This question was merged with another that asked for `stderr`, `stdout` _and the user input echo_ to be output in _3 different colours_. Answers may be addressing either question.


How to recover a crashed Linux md RAID5 array?

Some time ago I had a RAID5 system at home. One of the 4 disks failed but after removing and putting it back it seemed to be OK so I started a resync. When it finished I realized, to my horror, that 3 out of 4 disks failed. However I don't belive that's possible. There are multiple partitions on the disks each part of a different RAID array.   * md0 is a RAID1 array comprised of sda1, sdb1, sdc1 and sdd1.   * md1 is a RAID5 array comprised of sda2, sdb2, sdc2 and sdd2.   * md2 is a RAID0 array comprised of sda3, sdb3, sdc3 and sdd3. md0 and md2 reports all disks up while md1 reports 3 failed (sdb2, sdc2, sdd2). It's my uderstanding that when hard drives fail all the partitions should be lost not just the middle ones. At that point I turned the computer off and unplugged the drives. Since then I was using that computer with a smaller new disk. Is there any hope of recovering the data? Can I somehow convince mdadm that my disks are in fact working? The only disk that may really have a problem is sdc but that one too is reported up by the other arrays. **Update** I finally got a chance to connect the old disks and boot this machine from SystemRescueCd. Everything above was written from memory. Now I have some hard data. Here is the output of `mdadm --examine /dev/sd*2`               /dev/sda2:               Magic : a92b4efc             Version : 0.90.00                UUID : 53eb7711:5b290125:db4a62ac:7770c5ea       Creation Time : Sun May 30 21:48:55 2010          Raid Level : raid5       Used Dev Size : 625064960 (596.11 GiB 640.07 GB)          Array Size : 1875194880 (1788.33 GiB 1920.20 GB)        Raid Devices : 4       Total Devices : 4     Preferred Minor : 1              Update Time : Mon Aug 23 11:40:48 2010               State : clean      Active Devices : 3     Working Devices : 4      Failed Devices : 1       Spare Devices : 1            Checksum : 68b48835 - correct              Events : 53204                   Layout : left-symmetric          Chunk Size : 64K                Number   Major   Minor   RaidDevice State     this     0       8        2        0      active sync   /dev/sda2             0     0       8        2        0      active sync   /dev/sda2        1     1       8       18        1      active sync   /dev/sdb2        2     2       8       34        2      active sync   /dev/sdc2        3     3       0        0        3      faulty removed        4     4       8       50        4      spare   /dev/sdd2     /dev/sdb2:               Magic : a92b4efc             Version : 0.90.00                UUID : 53eb7711:5b290125:db4a62ac:7770c5ea       Creation Time : Sun May 30 21:48:55 2010          Raid Level : raid5       Used Dev Size : 625064960 (596.11 GiB 640.07 GB)          Array Size : 1875194880 (1788.33 GiB 1920.20 GB)        Raid Devices : 4       Total Devices : 4     Preferred Minor : 1              Update Time : Mon Aug 23 11:44:54 2010               State : clean      Active Devices : 2     Working Devices : 3      Failed Devices : 1       Spare Devices : 1            Checksum : 68b4894a - correct              Events : 53205                   Layout : left-symmetric          Chunk Size : 64K                Number   Major   Minor   RaidDevice State     this     1       8       18        1      active sync   /dev/sdb2             0     0       0        0        0      removed        1     1       8       18        1      active sync   /dev/sdb2        2     2       8       34        2      active sync   /dev/sdc2        3     3       0        0        3      faulty removed        4     4       8       50        4      spare   /dev/sdd2     /dev/sdc2:               Magic : a92b4efc             Version : 0.90.00                UUID : 53eb7711:5b290125:db4a62ac:7770c5ea       Creation Time : Sun May 30 21:48:55 2010          Raid Level : raid5       Used Dev Size : 625064960 (596.11 GiB 640.07 GB)          Array Size : 1875194880 (1788.33 GiB 1920.20 GB)        Raid Devices : 4       Total Devices : 4     Preferred Minor : 1              Update Time : Mon Aug 23 11:44:54 2010               State : clean      Active Devices : 1     Working Devices : 2      Failed Devices : 2       Spare Devices : 1            Checksum : 68b48975 - correct              Events : 53210                   Layout : left-symmetric          Chunk Size : 64K                Number   Major   Minor   RaidDevice State     this     2       8       34        2      active sync   /dev/sdc2             0     0       0        0        0      removed        1     1       0        0        1      faulty removed        2     2       8       34        2      active sync   /dev/sdc2        3     3       0        0        3      faulty removed        4     4       8       50        4      spare   /dev/sdd2     /dev/sdd2:               Magic : a92b4efc             Version : 0.90.00                UUID : 53eb7711:5b290125:db4a62ac:7770c5ea       Creation Time : Sun May 30 21:48:55 2010          Raid Level : raid5       Used Dev Size : 625064960 (596.11 GiB 640.07 GB)          Array Size : 1875194880 (1788.33 GiB 1920.20 GB)        Raid Devices : 4       Total Devices : 4     Preferred Minor : 1              Update Time : Mon Aug 23 11:44:54 2010               State : clean      Active Devices : 1     Working Devices : 2      Failed Devices : 2       Spare Devices : 1            Checksum : 68b48983 - correct              Events : 53210                   Layout : left-symmetric          Chunk Size : 64K                Number   Major   Minor   RaidDevice State     this     4       8       50        4      spare   /dev/sdd2             0     0       0        0        0      removed        1     1       0        0        1      faulty removed        2     2       8       34        2      active sync   /dev/sdc2        3     3       0        0        3      faulty removed        4     4       8       50        4      spare   /dev/sdd2      It appears that things have changed since the last boot. If I'm reading this correctly sda2, sdb2 and sdc2 are working and contain synchronized data and sdd2 is spare. I distinctly remember seeing 3 failed disks but this is good news. Yet the array still isn't working:               Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]      md125 : inactive sda2[0](S) sdb2[1](S) sdc2[2](S)           1875194880 blocks          md126 : inactive sdd2[4](S)           625064960 blocks          md127 : active raid1 sda1[0] sdd1[3] sdc1[2] sdb1[1]           64128 blocks [4/4] [UUUU]          unused devices: <none>      md0 appears to be renamed to md127. md125 and md126 are very strange. They should be one array not two. That used to be called md1. md2 is completely gone but that was my swap so I don't care. I can understand the different names and it doesn't really matter. But why is an array with 3 "active sync" disks unreadable? And what's up with sdd2 being in a separate array? **Update** I tried the following after backing up the superblocks:               root@sysresccd /root % mdadm --stop /dev/md125     mdadm: stopped /dev/md125     root@sysresccd /root % mdadm --stop /dev/md126     mdadm: stopped /dev/md126      So far so good. Since sdd2 is spare I don't want to add it yet.               root@sysresccd /root % mdadm --assemble /dev/md1 /dev/sd{a,b,c}2 missing      mdadm: cannot open device missing: No such file or directory     mdadm: missing has no superblock - assembly aborted      Apparently I can't do that.               root@sysresccd /root % mdadm --assemble /dev/md1 /dev/sd{a,b,c}2             mdadm: /dev/md1 assembled from 1 drive - not enough to start the array.     root@sysresccd /root % cat /proc/mdstat      Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]      md1 : inactive sdc2[2](S) sdb2[1](S) sda2[0](S)           1875194880 blocks          md127 : active raid1 sda1[0] sdd1[3] sdc1[2] sdb1[1]           64128 blocks [4/4] [UUUU]          unused devices: <none>      That didn't work either. Let's try with all the disks.               mdadm --stop /dev/md1     mdadm: stopped /dev/md1     root@sysresccd /root % mdadm --assemble /dev/md1 /dev/sd{a,b,c,d}2     mdadm: /dev/md1 assembled from 1 drive and 1 spare - not enough to start the array.     root@sysresccd /root % cat /proc/mdstat                                Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]      md1 : inactive sdc2[2](S) sdd2[4](S) sdb2[1](S) sda2[0](S)           2500259840 blocks          md127 : active raid1 sda1[0] sdd1[3] sdc1[2] sdb1[1]           64128 blocks [4/4] [UUUU]          unused devices: <none>      No luck. Based on this answer I'm planning to try:               mdadm --create /dev/md1 --assume-clean --metadata=0.90 --bitmap=/root/bitmapfile --level=5 --raid-devices=4 /dev/sd{a,b,c}2 missing     mdadm --add /dev/md1 /dev/sdd2      Is it safe? **Update** I publish the superblock parser script I used to make that table in the my comment. Maybe someone will find it useful. Thanks for all your help.


Can't make a copy of /var/lib/mysql/ibdata1

I have a RedHat Linux server and I'm trying to make a copy of `/var/lib/mysql/ibdata1`, but I'm receiving an error saying permission denied and the file cannot be opened. I'm logged in as root user and tried to use `sudo cp`... Any idea of what I'm doing wrong? Sorry for my ignorance, but I don't know much about Unix systems. I was trying `sudo su mysql` to make the copy, then it asks for a password that should be the one I have, but it is saying it's wrong!


How can I find all files that do NOT contain a text string?

What **concise** command can I use to find all files that do NOT contain a text string? I tried this (using -v to invert grep's parameters) with no luck:               find . -exec grep -v -l shared.php {} \;      Someone said this would work:               find . ! -exec grep -l shared.php {} \;      But it does not seem to work for me. This page has this example:               find ./logs -size +1c  > t._tmp     while read filename     do          grep -q "Process Complete" $filename          if [ $? -ne 0 ] ; then                  echo $filename          fi     done < t._tmp     rm -f t_tmp      But that's cumbersome and not at all concise. ps: I know that `grep -L *` will do this, but how can I use the find command in combination with grep to excluded files is what i really want to know. pss: Also I'm not sure how to have grep include subdirectories with the `grep -L *` syntax, but I still want to know how to use it with `find` :)


z in bash script returns zero

#[ -z "" ]           #echo $?      returns 0               #[ -a "" ]           #echo $?      returns 1 except z all other alphabets throw 1 What might be the reason?


Redirecting output when I execute "bash -c ..." from a C program

Say I have a C program and in it I want to execute a shell command and redirect its output to file, by using the stdlib system function.               system("bash -c \"echo $HOME\" > a.txt");      Now this is for illustration, it actually doesn't work. How do I make the output redirection work? Because I'm calling bash from a function I need the process itself to do the redirecting.


Copy files based on date/time from subset of directories

I'm teaching a class where (~80) students are submitting assignments that I can access via webdav, organized by student in directories named by their unique identifier. The students are split into two groups that submit assignments on different days of the week. I'd like to create a bash script to automatically download files for each subset of students into a local directory. What I don't know how to do is the following:   1. Select a specific subset of folders by name to copy files from.      * Edited based on comments: The webdav server I connect to has 80 directories named by student, these 80 directories are made up of two groups of students.     * I would like to select files from directories in each group, i.e., Group1 contains directories `StudentA/ StudentC/ StudentD/`. Group 2 would contain the directories `StudentB/ StudentE/ StudentF/`.   2. Specify the beginning date/time of files to be copied. End date/time would be useful to since I take deductions for late assignments. Any help on either of these would be appreciated.


YUM: How to prevent EPEL from upgrading packages installed from other repos?

I would like to leave EPEL enabled and configure it to allow updating only the packages that were installed from EPEL itself in the first place (packages which were manually installed from EPEL because of specific needs). **Is there a yum conf directive to allow this?**   * CentOS 6.4   * Yum 3.2.29


gtar fails to perform incremental backup

The following script fails to perform incremental backup, but creates full backup instead. On another FreeBSD server exactly same script works just fine (creating incremental backups). Servers are identical, same FreeBSD 10.0-RELEASE on both machines. Script it exactly the same. Version of gtar is identical. File system is identical. Not sure what's going on. Searched for days! Please help.               #!/bin/sh          sourcedir="/home"     targetdir="/backup/home"          now=$(date +"%Y%m%d%H%M")          cd $sourcedir     for dir in */     do       base=$(basename "$dir")       gtar -cz -g "$targetdir/.gtar-incremental" -f "$targetdir/${base}-$now.tar.gz" "/home/$dir"       chmod 600 "$targetdir/${base}-$now.tar.gz"     done


diskio/diskiograph in Conky only understands physical device names?

In case this is so, it can be a huge downer in modern Linux distros, since the device names are very often assigned arbitrarily. So if you have no more than two HDDs in your system, but two USB flash drives sticking in their ports, things might look like this after bootup:               /dev/sda .. HDD #1     /dev/sdb .. USB flash drive #1     /dev/sdc .. USB flash drive #2     /dev/sdd .. HDD #2      I have searched high and low and tried various hacks for my `.conkyrc` to no avail. It just does not seem to work. I even thought about "creating" the format required for conky by executing a system command, but even this failed. In `bash`, this can be achieved by               $ basename $(readlink /dev/disk/by-label/mydisklabel)      Though conky DOES allow execution of system commands, it seems that in {diskio}/{diskiograph} options, this is not possible.   So the following will NOT work:               ${diskio /dev/${execp basename $(readlink /dev/disk/by-label/mydisklabel)}}      Neither would the variant with the UUID work (not shown here).   Has anyone of you guys ever managed to "teach" this to conky? It's so insanely versatile, but it's almost unbelievable that (compared to the good old days) `udev` and friends will no longer keep drives in a certain order, but scramble them again on each bootup sequence, while tools (GKrellM is none the better!) stubbornly insist on physical drive/device names.


pattern search and display the last occuring pattern?

I have a log file containing **startup** and **shutdown** times for everday. I want to see the last pattern pattern for startup and shutdown(which is located at the end of the file being updated everyday). Also I dont want all the lines between the startup and shutdown.I want only few(say 3) lines after the last startup and few(say 3 lines) after the last shutdown. Any suggestions for a one liner.


Create swap partition after install

I already have parititon contain data under lvm enviroment with centos 5.8 output of fdisk -l root@server [~]# fdisk -l               Disk /dev/sda: 1000.2 GB, 1000204886016 bytes     255 heads, 63 sectors/track, 121601 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1          25      200781   83  Linux     /dev/sda2              26      121601   976559220   8e  Linux LVM      output of lvdisplay               # lvdisplay       --- Logical volume ---       LV Name                /dev/sysvg/ROOT       VG Name                sysvg       LV UUID                6oy3Rj-ka3K-mL9s-vjjG-1Iqw-dniq-UbWzvJ       LV Write Access        read/write       LV Status              available       # open                 1       LV Size                919.44 GB       Current LE             29422       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           253:0            --- Logical volume ---       LV Name                /dev/sysvg/TMP       VG Name                sysvg       LV UUID                jTKLBt-eNz0-KxmV-E5Nk-jjC0-FlRb-qny62p       LV Write Access        read/write       LV Status              available       # open                 1       LV Size                9.88 GB       Current LE             316       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           253:1            --- Logical volume ---       LV Name                /dev/sysvg/SHM       VG Name                sysvg       LV UUID                NpKjhl-tzzn-Dk3G-A6dl-4QJB-QCc2-IkbDH5       LV Write Access        read/write       LV Status              available       # open                 1       LV Size                2.00 GB       Current LE             64       Segments               1       Allocation             inherit       Read ahead sectors     auto       - currently set to     256       Block device           253:2      output of df -h               root@server [~]# df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/mapper/sysvg-ROOT                           891G  125G  721G  15% /     /dev/mapper/sysvg-TMP                           9.6G  153M  9.0G   2% /tmp     /dev/mapper/sysvg-SHM                           8.0G  8.0K  8.0G   1% /dev/shm     /dev/sda1             190M   19M  162M  11% /boot     tmpfs                 8.0G  8.0K  8.0G   1% /dev/shm      output for /etc/fstab               root@server [~]# cat /etc/fstab     /dev/sysvg/ROOT /       ext3    usrjquota=quota.user,jqfmt=vfsv0        1       1     /dev/sysvg/TMP          /tmp                    ext3    defaults        1 2     /dev/sysvg/SHM  /dev/shm        ext3    defaults,usrquota       1       2     LABEL=/boot             /boot                   ext3    defaults        1 2     tmpfs                   /dev/shm                tmpfs   defaults        0 0     devpts                  /dev/pts                devpts  gid=5,mode=620  0 0     sysfs                   /sys                    sysfs   defaults        0 0     proc                    /proc                   proc    defaults        0 0     /tmp             /var/tmp                    ext3    defaults,bind,noauto        0 0      I don't have any idea how to create swap partition , and i worried about creating cause any DATA LOSS


Tell ffserver which track to use

I want to stream videos via ffserver. My videos are in container formats like mkv and avi and sometimes have multiple audio/video tracks. How can I tell ffserver which track to use? It seems to always take the first one.


Unable to access website hosted on virtual machine

I'm on a mac (osx 10.9.3) running CentOS7 in virtualbox. I would like to access the website hosted on the virtual machine. Browsing to the Guest IP returns webpage not available. I'm able to `ping` and `ssh` to the VM.   I've set bridged adapter for the network settings in the VM.   I've given `/etc/httpd/conf/httpd.conf` Listen 80 and host IP address. `telnet` and `curl` to Guest IP returns connection refused. I'm guessing it's a firewall / iptables configuration problem where I need to allow the host. How do I configure CentOS firewall / iptables to allow host?


How to reach only an application in QEMU emulation without X?

I run an OpenBSD guest on an OpenBSD host (Desktop) with QEMU. Because I want to run a webbrowser in a separated environment. I can reach the QEMU machine via ssh -X so I can see the webbrowser. But that's not really safe (because AFAIK X wasn't designed by security in mind). **Q:** How can I reach the webbrowser (xxxterm) from the host OpenBSD machine safely and with good performance? ps.: question is based on this


Compiling libqwplot3d on armhf

This started as an attempt to compile GNURadio on armhf (Pandaboard & Beagleboard). Thanks to the answer by Mike Larsen. I tried to compile libqwplot3d.               apt-get build-dep qwtplot3d     apt-get source qwtplot3d     cd qwtplot3d-*/     dpkg-buildpackage      And get the following result in the last step:               user@lord-xm:~/qwtplot3d-0.2.7+svn191$ dpkg-buildpackage     dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security     dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): -D_FORTIFY_SOURCE=2     dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security     dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2     dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions -Wl,-z,relro     dpkg-buildpackage: source package qwtplot3d     dpkg-buildpackage: source version 0.2.7+svn191-5ubuntu2     dpkg-buildpackage: source changed by Scott Kitterman <scott@kitterman.com>     dpkg-buildpackage: host architecture armhf      dpkg-source --before-build qwtplot3d-0.2.7+svn191      fakeroot debian/rules clean     dh_testdir     dh_testroot     rm -f build-stamp     rm -rf build     dh_clean      dpkg-source -b qwtplot3d-0.2.7+svn191     dpkg-source: info: using source format `3.0 (quilt)'     dpkg-source: info: building qwtplot3d using existing ./qwtplot3d_0.2.7+svn191.orig.tar.gz     dpkg-source: info: building qwtplot3d in qwtplot3d_0.2.7+svn191-5ubuntu2.debian.tar.gz     dpkg-source: info: building qwtplot3d in qwtplot3d_0.2.7+svn191-5ubuntu2.dsc      debian/rules build     dh_testdir     mkdir -p build/qt4     cp -Rl `ls . |grep -v build|grep -v debian` build/qt4     cd build/qt4 && qmake-qt4 qwtplot3d.pro && /usr/bin/make     WARNING: doc.path is not defined: install target not created          make[1]: Entering directory `/home/user/qwtplot3d-0.2.7+svn191/build/qt4'     g++ -c -pipe -g -D_REENTRANT -Wall -W -fPIC -DQT_WEBKIT -DGL2PS_HAVE_ZLIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -Iinclude -I/usr/X11R6/include -Itmp -o tmp/qwt3d_axis.o src/qwt3d_axis.cpp     In file included from /usr/include/GL/glu.h:38:0,                      from include/qwt3d_openglhelper.h:11,                      from include/qwt3d_types.h:26,                      from include/qwt3d_drawable.h:7,                      from include/qwt3d_label.h:10,                      from include/qwt3d_axis.h:5,                      from src/qwt3d_axis.cpp:1:     /usr/include/GL/gl.h:162:17: error: conflicting declaration âtypedef double GLdoubleâ     /usr/include/qt4/QtOpenGL/qgl.h:85:17: error: âGLdoubleâ has a previous declaration as âtypedef GLfloat GLdoubleâ     In file included from /usr/include/GL/gl.h:2085:0,                      from /usr/include/GL/glu.h:38,                      from include/qwt3d_openglhelper.h:11,                      from include/qwt3d_types.h:26,                      from include/qwt3d_drawable.h:7,                      from include/qwt3d_label.h:10,                      from include/qwt3d_axis.h:5,                      from src/qwt3d_axis.cpp:1:     /usr/include/GL/glext.h:5327:19: error: conflicting declaration âtypedef ptrdiff_t GLintptrâ     /usr/include/GLES2/gl2.h:38:26: error: âGLintptrâ has a previous declaration as âtypedef khronos_intptr_t GLintptrâ     /usr/include/GL/glext.h:5328:19: error: conflicting declaration âtypedef ptrdiff_t GLsizeiptrâ     /usr/include/GLES2/gl2.h:39:26: error: âGLsizeiptrâ has a previous declaration as âtypedef khronos_ssize_t GLsizeiptrâ     In file included from include/qwt3d_types.h:26:0,                      from include/qwt3d_drawable.h:7,                      from include/qwt3d_label.h:10,                      from include/qwt3d_axis.h:5,                      from src/qwt3d_axis.cpp:1:     include/qwt3d_openglhelper.h: In function âbool Qwt3D::ViewPort2World(double&, double&, double&, double, double, double)â:     include/qwt3d_openglhelper.h:106:97: error: cannot convert âdouble*â to âGLdouble* {aka float*}â for argument â7â to âGLint gluUnProject(GLdouble, GLdouble, GLdouble, const GLdouble*, const GLdouble*, const GLint*, GLdouble*, GLdouble*, GLdouble*)â     include/qwt3d_openglhelper.h: In function âbool Qwt3D::World2ViewPort(double&, double&, double&, double, double, double)â:     include/qwt3d_openglhelper.h:122:95: error: cannot convert âdouble*â to âGLdouble* {aka float*}â for argument â7â to âGLint gluProject(GLdouble, GLdouble, GLdouble, const GLdouble*, const GLdouble*, const GLint*, GLdouble*, GLdouble*, GLdouble*)â     make[1]: *** [tmp/qwt3d_axis.o] Error 1     make[1]: Leaving directory `/home/user/qwtplot3d-0.2.7+svn191/build/qt4'     make: *** [build-stamp] Error 2     dpkg-buildpackage: error: debian/rules build gave error exit status 2     user@lord-xm:~/qwtplot3d-0.2.7+svn191$      How do fix this and proceed? I am using the Ubuntu 12.04 image for OMAP


Accent error on OpenWrt 12.09?

[user@localhost ~] ssh -x -a root@192.168.1.1     BusyBox v1.19.4 (2013-03-14 11:28:31 UTC) built-in shell (ash)      -----------------------------------------------------      ATTITUDE ADJUSTMENT (12.09, r36088)      -----------------------------------------------------     root@ROUTER:~# touch 'árvíztűrő tükörfúrógép'     root@ROUTER:~# ls -la     drwxr-xr-x    1 root     root             0 Aug 31 11:26 .     drwxr-xr-x    1 root     root             0 Jan  1  1970 ..     drwx------    2 root     root             0 Aug 15 16:09 .ssh     -rw-r--r--    1 root     root             0 Aug 31 11:26 ????rv??zt??r?? t??k??rf??r??g??p     root@ROUTER:~# ls -la áárvíztűrő\ tükörfúrógép      -rw-r--r--    1 root     root             0 Aug 31 11:26 ????rv??zt??r?? t??k??rf??r??g??p     root@ROUTER:~# rm áárvíztűrő\ tükörfúrógép       **Q:** Why? The accent handling was ok a few versions before.. What am I doing wrong? UPDATE: the same problem occurs if I put this in cron.


Alias for directory listing sorted by time modified in reverse order

When I need to find my recently used files, this command: `ls -lt` lists in ascending order (by time), when there are lots files, I need to scroll to the top to see needed files, because wont fit in terminal screen. After finding out that `tac` inverses the output, I use: `ls -lt dir/ | tac` Is there more fun way of doing it, without using external scripts/utils?


Uninstall JDK rpm to reinstall

Where do I find the JDK install to uninstall? @terdon had explained using an `rpm` type download so it would be easier to uninstall, but I cannot find it.


Block Particular Command in Linux for Specific user

How to block command, let say `mkdir` for specific user ? What I did just created read-only function and store in users profile `~/.bashrc`               /bin/mkdir() {             echo "mkdir command not allow for you"          }          mkdir() {             echo "mkdir command not allow for you"          }     ./mkdir() {                  echo "mkdir command not allow for you"     }          readonly -f /bin/mkdir     readonly -f mkdir     readonly -f ./mkdir      **Test:**               rahul@ubuntu:~$ cd /bin/     rahul@ubuntu:/bin$ ./mkdir /home/rahul/ggg     mkdir command not allow for you     rahul@ubuntu:/bin$ cd     rahul@ubuntu:~$ mkdir testing     mkdir command not allow for you     rahul@ubuntu:~$ /bin/mkdir testing     mkdir command not allow for you      So my question is What should be the way of achieving this ? is there any tool for this ? Update 1 # But if user is smart , he could copy mkdir binary and rename it and use it . So how to achieve this ?