parted not recognizing my current partition on external disk. How to fix without losing data?

I have an external (USB) disk, which has been working OK for some time and shows no errors whatsoever in /var/log/$relevantfiles (no errors on reading/writing, for example). Here's the thing: if I ask for sudo fdisk -l /dev/sda this returns:               Disk /dev/sda: 1000.2 GB, 1000204886016 bytes     255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x24796452          Device Boot      Start         End      Blocks   Id  System     /dev/sda1              63  1953520064   976760001   83  Linux      which is exactly how I did it. Now, I want to recover a partition in this disk to use for some other purposes, which require hfs, instead of ext{2,3,4}. So I turned myself to the old dear parted to resize the partition and create a new one. Asking parted this returns:               (parted) print                                                                 Model: ST310005 28AS (scsi)     Disk /dev/sda: 1000GB     Sector size (logical/physical): 512B/512B     Partition Table: mac          Number  Start  End    Size    File system  Name            Flags     1      512B   1535B  1024B                partition map     2      368MB  371MB  2982kB               OneClick-Ready      and if I run gparted I see all the empty space, and I cannot resize my partition, since it's not there. Any pointers how to fix this things? I've never seen anything like it. The whole thing's running on a raspberry pi, using raspbian. Thanks!


Location of crontab job created by non-privileged user

The issue I currently have is someone has created a `crontab` process to run on a RHEL 5 box, yet has not left me any privileged user information. How can I execute this `cron` job that was setup to run as user `foo` when I do not have `root` access? Also of note this is a non-standard `cron` job insofar as it is run at arbitrary times. Also where does this job get placed? I have read that I should not attempt to modify anything that resides within `/var/spool` , which is fine since as I have stated I have no root access.


Unix History: return code octal?

// EDIT: Request to move this question to unix.stackexchange.com I was thrown off guard today by gdb:               Program exited with code 0146.      gdb prints the return code in _octal_ ; looking into why I found: http://comments.gmane.org/gmane.comp.gdb.devel/30363 But that's not a particularly satisfying answer. Some quick googling did not reveal the history, so I was hoping someone on SO might know the back story. A somewhat related question, how would one even view the return code in octal? Perhaps older machines always printed the return code?               $ printf %o\\n $?      Is pretty awkward :)


awk: for-loop with break option

I am trying to use `awk` to manipulate data.I have a data file with two columns and I would like to find the row that contains an specific value. But there is more than one row that contains this value and I only would like to find the first one. I tried it with a `for`-loop and `break` but it does not work the way I expected.               {for (i=0;$2==100.0;min=$1){             i++             max=min+500             if(i==1){                 print i"\t"min"\t"max                 break                 }             }     }      After this loop there is a little bit more code which utilizes `min` and `max`. **Edit:** The data looks like this               59.45   96     59.50   96     59.60   97     59.75   98     59.90   98     59.95   98     60.00   99     60.05   99     60.20   99     60.25   100     60.40   100     60.45   100     60.50   101     60.55   101     60.60   101     60.65   101     60.70   102     60.90   102     60.95   103     61.00   103     61.05   103     61.15   103     61.20   104     61.35   104     61.40   104     61.45   105     61.50   105     61.60   105     61.65   106     61.70   100     61.85   100      I would like to find the first row that contains `100`in the second column and save the value from column one in a variable


How to show and modify user info in Ubuntu server?

If I want to put some personal information (like Full Name) to an account, how can I check it again? And how can I modify it? On Ubuntu server. With command line only.


How can I pipe input from one SSH session to another? Using fifo?

A while ago I saw an article about piping messages from one console window to another using `fifo` ? I haven't used that before and can't find my link to the article. How can I set this up? I'd like to have two consoles open for logging and have one display the log messages (real time) that are sent from the other one.


ls command - define number of columns

Is there a way to define the number of columns in `ls` output? I got this far: `ls -C` sorts in columns and `ls -1` produces one column. `--tabsize =` option to produce two columns resulted in what looks like this image here [which originates in this post]. Learning that the the command assumes that a column is eight characters wide I tried `width=` and but didn't get far. **Question** : How to define the number of rows with `ls` 'on-board tools' -> without another command, like `column`?


Use sed or awk to join lines in a certain pattern?

Not sure on how to turn this input:               A     B     C     apartner     bpartner     cpartner      into this output:               A apartner     B bpartner     c cpartner      I have this pattern in a 80 line file that needs to be 40 line. Also, how can I enclose each item, in lets say, `<il><b>A</b> <i>apartner</i></il>`?


How to make bash script ask you if you want to execute the next segment(part)?

Soon as I execute the bash script. Given that I have               set -x      I will visually observe what is happening. But at certain parts, I want it to stop and ask me if I still want to continue executing the next lines. I know about:               set -e      which simply ensures bash script exits on error, but I'd rather not use that. Rather I want to just divide my codes and make the bash script ask me every now and then if it should proceed or not.


How to right or left shift a block of text by a specific number of columns?

If I use `vim`, put the cursor on the beginning of a line, and then input                   3>> or 3<<      I can left or right shift 3 lines by 8 columns If I just want to shift 4 columns, what should I do?


How can I boot back into Windows after "installing" live CD to hard drive partition?

I wanted to boot a Mint 17 live CD, but I did not have a blank CD lying around so I "installed" the live CD on a newly created partition. Now my laptop always boots into Mint, but I want to boot back into Windows. I tried to press `C` to enter GRUB (at least that's what I think it's called) and the first option is to boot into Linux. The last option is to boot from local drive. But whatever choice I make, it keeps booting Linux keeps booting.


Debian init runlevels

It used to be that when you booted most linuxes, you would boot into runlevel 6, unless you did something during the bootloading to change the runlevel,. The process would then look in /etc/init/rcX.d (IIRC) where X was the runlevel, and execute all the scripts begining with S in dictionary sorted order (so S01xxx ran before S20yyy). When you went through the shutdown procedure the scripts beginning with K would be run and IIRC in reverse dictionary sort order. Now things have changed the rcX.d directories have been moved to /etc and an /etc/rcS.d has been added, and the default runlevel is 2. Unfortunately until now I haven't been following the changes. Can someone please describe the boot and shutdown process for runlevel 2 in present systems?


How can I substitute lsof inside a Docker (native, not LXC-based)

I'm somewhat baffled that inside a Docker container `lsof -i` doesn't yield any output. Example (all commands/output from inside the container):               [1] root@ec016481cf5f:/# lsof -i     [1] root@ec016481cf5f:/# netstat -tulpn     Active Internet connections (only servers)     Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name     tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -     tcp6       0      0 :::22                   :::*                    LISTEN      -      Please also note how no PID or program name is shown by `netstat`. `fuser` also gives somewhat confusing output and is unable to pinpoint the PIDs as well. Can anyone shed any light on this?   * How can I substitute `lsof -i` (to see the **process name** as well!)   * Why is the output of `netstat` crippled as well? **NB:** The container runs with `"ExecDriver": "native-0.1"`, that is Docker's own execution layer, not LXC. * * *               [1] root@ec016481cf5f:/# fuser -a4n tcp 22     Cannot stat file /proc/1/fd/0: Permission denied     Cannot stat file /proc/1/fd/1: Permission denied     Cannot stat file /proc/1/fd/2: Permission denied     Cannot stat file /proc/1/fd/3: Permission denied     Cannot stat file /proc/1/fd/255: Permission denied     Cannot stat file /proc/6377/fd/0: Permission denied     Cannot stat file /proc/6377/fd/1: Permission denied     Cannot stat file /proc/6377/fd/2: Permission denied     Cannot stat file /proc/6377/fd/3: Permission denied     Cannot stat file /proc/6377/fd/4: Permission denied     22/tcp:      (I am not obsessed by the `Permission denied`, because that figures. What confuses me is the empty list of PIDs after `22/tcp`.) * * *               # lsof|awk '$1 ~ /^sshd/ && $3 ~ /root/ {print}'     sshd    6377      root  cwd   unknown                        /proc/6377/cwd (readlink: Permission denied)     sshd    6377      root  rtd   unknown                        /proc/6377/root (readlink: Permission denied)     sshd    6377      root  txt   unknown                        /proc/6377/exe (readlink: Permission denied)     sshd    6377      root    0   unknown                        /proc/6377/fd/0 (readlink: Permission denied)     sshd    6377      root    1   unknown                        /proc/6377/fd/1 (readlink: Permission denied)     sshd    6377      root    2   unknown                        /proc/6377/fd/2 (readlink: Permission denied)     sshd    6377      root    3   unknown                        /proc/6377/fd/3 (readlink: Permission denied)     sshd    6377      root    4   unknown                        /proc/6377/fd/4 (readlink: Permission denied)     sshd    6442      root  cwd   unknown                        /proc/6442/cwd (readlink: Permission denied)     sshd    6442      root  rtd   unknown                        /proc/6442/root (readlink: Permission denied)     sshd    6442      root  txt   unknown                        /proc/6442/exe (readlink: Permission denied)     sshd    6442      root    0   unknown                        /proc/6442/fd/0 (readlink: Permission denied)     sshd    6442      root    1   unknown                        /proc/6442/fd/1 (readlink: Permission denied)     sshd    6442      root    2   unknown                        /proc/6442/fd/2 (readlink: Permission denied)     sshd    6442      root    3   unknown                        /proc/6442/fd/3 (readlink: Permission denied)     sshd    6442      root    4   unknown                        /proc/6442/fd/4 (readlink: Permission denied)     sshd    6442      root    5   unknown                        /proc/6442/fd/5 (readlink: Permission denied)      There is some more output for the connected user, which is correctly identified as well, but that's it. It's apparently impossible to discern of which type (`lsof -i` limits to internet sockets) a certain "object" is.


MaxStartups and MaxSessions configurations parameter for ssh connections?

I am copying the files from `machineB` and `machineC` into `machineA` as I am running my below shell script on `machineA`. If the files is not there in `machineB` then it should be there in `machineC` for sure so I will try copying the files from `machineB` first, if it is not there in `machineB` then I will try copying the same files from `machineC`. I am copying the files in parallel using GNU Parallel library and it is working fine. Currently I am copying 10 files in parallel. Below is my shell script which I have -               #!/bin/bash          export PRIMARY=/test01/primary     export SECONDARY=/test02/secondary     readonly FILERS_LOCATION=(machineB machineC)     export FILERS_LOCATION_1=${FILERS_LOCATION[0]}     export FILERS_LOCATION_2=${FILERS_LOCATION[1]}     PRIMARY_PARTITION=(550 274 2 546 278) # this will have more file numbers     SECONDARY_PARTITION=(1643 1103 1372 1096 1369 1568) # this will have more file numbers          export dir3=/testing/snapshot/20140103          find "$PRIMARY" -mindepth 1 -delete     find "$SECONDARY" -mindepth 1 -delete          do_Copy() {       el=$1       PRIMSEC=$2       scp david@$FILERS_LOCATION_1:$dir3/new_weekly_2014_"$el"_200003_5.data $PRIMSEC/. || scp david@$FILERS_LOCATION_2:$dir3/new_weekly_2014_"$el"_200003_5.data $PRIMSEC/.     }     export -f do_Copy          parallel --retries 10 -j 10 do_Copy {} $PRIMARY ::: "${PRIMARY_PARTITION[@]}" &     parallel --retries 10 -j 10 do_Copy {} $SECONDARY ::: "${SECONDARY_PARTITION[@]}" &     wait              echo "All files copied."      **Problem Statement:-** With the above script at some point (not everytime) I am getting this exception -               ssh_exchange_identification: Connection closed by remote host     ssh_exchange_identification: Connection closed by remote host     ssh_exchange_identification: Connection closed by remote host      And I guess the error is typically caused by too many ssh/scp starting at the same time. That leads me to believe /etc/ssh/sshd_config:MaxStartups and MaxSessions is set too low. But my question is on which server it is pretty low? `machineB` and `machineC` or `machineA`? And on what machines I need to increase the number? On `machineA` this is what I can find and they all are commented out -               root@machineA:/home/david# grep MaxStartups /etc/ssh/sshd_config     #MaxStartups 10:30:60          root@machineA:/home/david# grep MaxSessions /etc/ssh/sshd_config      And on `machineB` and `machineC` this is what I can find -               [root@machineB ~]$ grep MaxStartups /etc/ssh/sshd_config     #MaxStartups 10          [root@machineB ~]$ grep MaxSessions /etc/ssh/sshd_config     #MaxSessions 10


Low battery freezes laptop

I have a laptop Lenovo G575. MS Windows works without any problems on it, but with Linux, it freezes during login or up to 10 minutes after power on. I have tried Ubuntu, Fedora 15 and 16, Fedora 16 KDE spin, Fedora 16 XFCE spin, openSUSE, Pinguy and possibly some other distro as well. XFCE power manager got SIGTRAP when XFCE session started. It works without any problem on AC cord or if battery is more than about 50-60% charged. Edit: Fedora 16 KDE spin works a bit better, but it freezes unpredictably on login. Lower the battery, more often it happens.


Naming conventions / translation between dpkg and apt packages?

I've been trying to figure out package management in debian a little better. I figured out that you can list all the packages on your system by using the "apt-cache pkgnames" command:               root@t500:/etc# apt-cache pkgnames | less     aspell-ca     libglobus-rls-client5     rkhunter     libmpich-shmem1.0gf     meep     libspring-webmvc-portlet-2.5-java     libindicate-doc     libjetty-extra-java     python-decoratortools     tree-ppuzzle     darkice     cutter-testing-framework-bin     aspell-bg     libsmpeg0     libpng12-dev      However, when I try to look up additional information about the packages in dpkg, the same package names are not listed:               root@t500:/etc# dpkg-query -W meep     No packages found matching meep.          root@t500:/etc# dpkg-query -W darkice     No packages found matching darkice.      I had assumed that apt and dpkg they would at least utilize the same package names, is that not the case? Is there a way of figuring out what the dpkg name of an apt package is?


Alias Loop in csh

Why is there an Alias loop error created here:               alias df 'printf "\n"; df -hP | column -t'      But not here:               alias df 'df -hP | column -t'      I realize I could call the alias something else and still have it work, however, I'm trying to understand the underlying operation.


How to limit ftp speed

I have multiple users on a server. They upload and download their files through FTP. Sometimes some heavy transfer causes high load on the server. I am wondering, if there is any way to limit the ftp speed to avoid high load. Any help would be much appreciated.


What causes delay in my keystrokes on OSX's Terminal application?

I'm using the OSX application `Terminal` to work remotely on Amazon EC2 servers through SSH. Occasionally and seemingly randomly, my keystrokes are delayed. I've tried reconnecting, restarting `Terminal`, restarting my computers, etc... Nothing seems to solve the problem, and it comes and goes. I've tried other terminal emulators and they seem to have the same problem whenever I'm experiencing it. There is never delay in my keystrokes when I'm working locally on my own machine through `Terminal`. What are some causes of this keystroke delay? Is there anything I can do about this? I'm using `Terminal` in a location I don't usually work from, so maybe the internet connection has something to do with this. Does `Terminal` mimic the connection speed to the server as you type?


How to limit the total resources (memory) of a process and its children

There are plenty of questions and answers about constraining the resources of a single process, e.g. RLIMIT_AS can be used to constrain the maximum memory allocated by a process that can be seen as VIRT in the likes of `top`. More on the topic e.g. here Is there a way to limit the amount of memory a particular process can use in Unix? `setrlimit(2)` documentation says: > A child process created via fork(2) inherits its parent's resource limits. > Resource limits are preserved across execve(2). It should be understood in the following way: If a process has a RLIMIT_AS of e.g. 2GB, then it cannot allocate more memory than 2GB. When it spawns a child, the address space limit of 2GB will be passed on to the child, but counting starts from 0. The 2 processes together can take up to 4GB of memory. But what would be the useful way to constrain the sum total of memory allocated by a whole tree of processes?


application requires 32bit libs be installed on my 64 bit system -- having trouble installing them

I want to install SimpleScreenRecorder (SSR) from git as recommended by the developer. The binary version crashes while the git version fixes my crash problem. Unfortunately, to build the git version I have to resort to a work- around -- and now I've run into side effects from that. Main page - SimpleScreenRecorder - Maarten Baert's website The instructions are found here: https://github.com/MaartenBaert/ssr The dev says, "I don't know whether this is the right way to do it, but it works for me." It worked for me too, but it is not nice in situations such as changing video drivers (which I'm doing now). Therefore, I decided to come ask the experts here for a better solution. I'm hoping someone knows the right way to resolve this. (BTW, I asked a similar but different question and answered it myself here: http://askubuntu.com/a/347620/36661) I'm running Kubuntu 12.04 with the lts- raring hardware enablement stack. The problem is that the 64-bit portion of the build works, but the 32-bit portion fails due to some libraries missing. The proposed workaround involves manually creating symlinks to make up for the "missing" libraries. Here are my build/install steps including the workaround symlink creation:               sudo apt-get install build-essential pkg-config qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libgl1-mesa-dev libx11-dev libxext-dev libxfixes-dev g++-multilib ia32-libs     cd /workspaces/ (or any path you choose - see note below)     git clone https://github.com/MaartenBaert/ssr.git (in my case the project path is /workspaces/ssr/)     sudo mkdir /usr/lib32/fglrx/     cd /usr/lib/i386-linux-gnu/     sudo ln -s libGL.so.1 /usr/lib32/fglrx/libGL.so  # only for proprietary AMD drivers!     # SKIP: sudo ln -s fglrx/libGL.so /usr/lib32/libGL.so    # only for proprietary AMD drivers!     sudo ln -s libGLU.so.1 libGLU.so     sudo ln -s libX11.so.6 libX11.so     sudo ln -s libXext.so.6 libXext.so     sudo ln -s libXfixes.so.3 libXfixes.so     sudo ldconfig     cd /path/to/ssr (will be the ssr directory under `/workspaces/` in my example)     $ ./simple-build-and-install       So, what's the right way to solve the problem so that I don't have to create these symlinks and so that the app won't break if I change video drivers? Is there an IRC channel that is appropriate for this question?


What is the buffers column in the output from free?

These questions briefly list the format of the free command, noting that buffers is kernel memory that must be written out to disk and cache is file data that does not need to be written disk. On my system, unlike most times I have run free, buffers occupies over 10% of RAM. Usually, buffers are a small, almost token, value. My question is, what exactly is in the area called buffers? Can I look for it with `lsof`? Does it consist of open file regions that have not been flushed? Is it memory mapped file regions? What is it? The system runs well and little swap is used, so performance is fine.


How to show last command with expanding function in bash

I'm using function like this.               $ find-grep () { find . -type f -name "$1" -print0 | xargs -0 grep "$2" ; }      After I type:               $ find-grep *.c foo      I want to get expanded last command string. In this case:               find . -type f -name "*.c" -print0 | xargs -0 grep "foo"      Is there way to do it easily?


sshfs - can't unmount the point

I mounted a folder on a remote machine using `sshfs`, but didn't specify `-o allow_other` flag thus can't access the mounted directory. When I try to mount over with `-o allow_other` option `sshfs` gives me this error: > mount: according to mtab, xxx is already mounted on yyy To allow mounting over existing mount points I specified `-o nonempty` \- but with no luck - got the same error as above. When I try to unmount the mount point: > fusermount -u mountpoint I get the error: > entry for yyy not found in /etc/mtab So, what do I do to unmount the incorrectly mounted point?


Do VirtualBox or VMWare use the Intel VT-d feature?

I'm thinking about a new laptop, which has Intel VT support, but recently I discovered a feature other than `Intel® Virtualization Technology (VT-x)`, which is `Intel® Virtualization Technology for Directed I/O (VT-d)`. Is VirtualBox or VMware taking advantage of it? How much performance increase can it bring when I use VirtualBox or VMware? There's an link explaining CPU features


Can I expand one window over two virtual desktops on KDE?

My laptop's resolution is low, and some programs cannot display their content normally in a small window. Is possible to expand one window over two or multiple virtual desktops?


Raspberry PI wifi network setup: switch adhoc mode if a wired/wifi network is unavailable

I'm using raspbian (debian) and I want the system would be able to always be reachable through the network, without the user needs to manually interact with the system. I'm looking for a solution that enable a default adhoc mode as a fallback, if no wired/wifi connection is available.


Apache setting ports both in "NameVirtualHost" and "Listen"

In apache `ports.conf` I have               NameVirtualHost *:80     Listen 80      I can't understand that since in `NameVirtualHost *:80` the port is already set, why there is a separate `Listen 80`. What does it mean? What would be if they were differents?


Setting mouse speed in Gnome just like in other desktop environments

When I'm using XFCE I can set mouse pointer speed to "Acceleration: 5.0 | Sensitivity: 4 px". When I have to switch KDE I can use same settings because these are simply configuration tools for X11. Gnome has sliders with no numbers. Different between Gnome 2.x and 3.x. Checking with xset also doesn't work because it gives different outputs without any change in Gnome settings.


Aufs Whiteout removal

I'm using AUFS for merging 100+ branches for a project. At runtime, I frequently add or remove few branches. Now, If I have a branch named "firefox-21.0" and If I update/modify one of it's file then AUFS creats it's whiteout file (.wh). So far so good. But later, If I planned to update the firefox to new version then I have to delete the "firefox-21.0" branch from system. Deleting branch from AUFS is easy. But question is [how do I remove those `.wh` files created ?] If I merge `firefox-23.0` then previously created `.wh` may get preference over old `firefox-21.0`'s file


Analyzing tricky one liners & having handy list of useful ones

Have seen one liners like below & took a little time to analyse exact use & working of it - something like set the value to later one if it is not set.               export JDK_HOME=${JDK_HOME:-"/some/path/java-1.7"}      I have not seen tricky literals like ':-' when I search for something. Is there any handy list of such useful one liners documented or a specfic man page to refere?


How to attach elisp function source code in Emacs?

I could use `M-x find-function` to find the source code of some elisp functions if the function is not written in C code. But since I am using a **Debian binary package** of Emacs , some of the source code is omitted and only the byte-compiled `.elc` files preserved. So is there any way to get the source code and attach them with those elc files? Can I use `apt-get source emacs` and associate with the src ( **C code** as well) with the byte-compiled one. Or do I have to build Emacs from source code?


Resume from hibernate fails after image restoration

I've been trying to get hibernation to work, and am having problems. The system seems to go into hibernation just fine, but when I try to restore from disk, the process stops just after a message saying "Image restoration successful". This is before I'm able to switch to a new tty. `Ctrl-alt-del` works. SysRq commands seem to work, although I'm not sure what to do with them. Suspend (to RAM) works fine when I close the lid or use `s2ram` or `pm- suspend`. If I use `s2both` or `s2disk`, I see the messages about the image being written to disk; if I treat `s2both` (or `pm-suspend-hybrid`) as a suspend (eg, restore without cutting power), it works. But if I cut power and do a cold boot, after the progress indicator seems to say the image is done loading, the process just stops. Does anyone know how I can fix this? Or at least what my next debugging/troubleshooting steps should be?       I'm using (K)Ubuntu 12.04, kernel 3.2.0-38-generic. I have 2GB of RAM and 4GB of swap. This (month-old unanswered forum post) looks very similar to my situation (except for the message about user id - which he gets but I don't) http://forum.linuxmint.com/viewtopic.php?p=708058&sid=e8bd8eba8fad0b25597209e365d6edf4 -Thanks    Edit: Update So, this is now kinda 'half-solved'. Gilles' answer got me past the place where I was stuck, but I still don't know what caused the problem. I am now having further problems, so I will need to keep debugging this, in case they are related - and would very much welcome further tips on what might have caused this problem in the first place. (New problem seems to be a more severe lock-up (that 'magic SysRq' doesn't help) when I try to hibernate/s2disk with more than ~500MB of memory used. Didn't think to test w/ a high memory load, ouch ...)


Postfix: disable authentication through port 25

When using `Postfix` and `IMAP` on a mailserver, at least 3 ports are usually opened               25 smtp   : incoming emails from anybody (whole internet)     465 smtps : outgoing emails from authorized users (to the whole intenet)     993 imap  : imap for authorized users      I would like to configure postfix, so that authorized users can only send email through 465. By default this is not so. Users can also use STARTTLS over port 25. I would like to disable that. My plan is to use port 25 for the public sending me email use port 465 for my users (I can use firewall to allow specific IP ranges, or use custom port) This would prevent port 25 being exploitable from brute force attacks, where hackers try to guess user/password. Port 25 simply would not accept user/password, even if it were valid. And since port 465 is restricted by firewall, hackers cannot exploit 465 either. Is this possible in Postfix? I am using Postfix 2.9.6-2 on Debian Wheezy


u-boot spi initialisation in omap3

I was looking into spi driver in u boot , here is a small snippet from `omap_spi.c`               void spi_init(void)     {          gpMCSPIRegs = (MCSPI_REGS *)MCSPI_SPI1_IO_BASE;               unsigned long u, n;             /* initialize the multipad and interface clock */         spi_init_spi1();              /* soft reset */         CSP_BITFINS(gpMCSPIRegs->SYSCONFIG, SPI_SYSCONFIG_SOFTRESET, 1);      for (n = 0; n < 100; n++) {      u = CSP_BITFEXT(gpMCSPIRegs->SYSSTATUS,  SPI_SYSSTATUS_RESETDONE);          if (u)           break;        }           ...more code     }      here in `omap_spi.h`                #define CSP_BITFINS(var, bit, val) \         (CSP_BITFCLR(var, bit)); (var |= CSP_BITFVAL(bit, val))      my confusion here is that when they do soft reset , they call this `CSP_BITFINS` macro. inside this macro all they do is just manipulate bits and fill structures. where do they access that hardware registers to configure?


Qstat error in Eqw

can any one help to understand how to solve that problem?                365227 0.50500 towhee     jmaia        Eqw   07/19/2014 19:22:55       when I do:                 qstat -j 365228 | grep error      that appears:               error reason    1:          07/19/2014 18:23:25 [1007:1354]: execvp(/usr/sge/default/spool/node25/job_scripts/365228, "/usr/sge/      What can I do?


GCC cofigure error

When I'm trying to install GCC for SLED 11 SP3, the terminal show me this error:               configure: error: cannot compute suffix of object files: cannot compile.      Before to intall GCC, I installed the GMP (4.3.2), MPFR (2.4.2), MPC (0.8.1). This is the log message that I got: configure.log I'll appreciate any help.


ps switches to display PID, PPID, PGID, and SID collectively

I tried ps with different kinds of switches e.g. -A, aux, ef, and so forth but I cannot seem to find the right combination of switches that will tell me the Process ID (PID), Parent Process ID (PPID), Process Group ID (PGID), and the Session ID (SID) of a process in the same output.


How to make a cifs/smb mount ignore umask?

I have a cifs mount that is mounted from `/etc/fstab`. But I would quite like creation of files/dirs on that share to ignore my umask. Is that possible? It seems that cifs does not support the `umask=000` option (source: `man mount.cifs`). My current best option is to set my system-wide umask to 000, but I'd rather not do this as I'd like to keep the local machine a bit more locked down. The silly thing is that my previous NAS did this fine, so maybe it's a server-side change that's required?


azap from LinuxTV dvb-apps strange signal behavior with Hauppauge WinTV-HVR 950Q

## What I want to do I have a Hauppauge WinTV-HVR 950Q USB-TV-Stick. I want to use this stick to successively tune to and read in a certain live TV stream. ## What I do I trigger a scan and save the scan results in a file. I call it channels.conf, like the v4l documentary proposes.               scan /home/username/Documents/dvb/atsc/us-CA-SF-Bay-Area > /home/username/Documents/dvb/atsc/conf/home_channels.conf      Everything works fine, the scan returns something like this(A correct channel file):               [0003]:503000000:8VSB:49:52:3     [0005]:503000000:8VSB:81:84:5     [0006]:503000000:8VSB:97:100:6     26 San Francisco, CA:551000000:8VSB:49:52:3     26 San Francisco, CA:551000000:8VSB:65:68:4     KTSF-D3:551000000:8VSB:81:84:5     KTSF-D4:551000000:8VSB:97:100:6     KTSF-D5:551000000:8VSB:113:116:7     KTSF-D6:551000000:8VSB:129:132:8     KPIX-DT:563000000:8VSB:49:52:1     KKPX ION:635000000:8VSB:49:52:3     KKPX qubo:635000000:8VSB:65:68:4     IONLife:635000000:8VSB:81:84:5     100:635000000:8VSB:487:488:100     200:635000000:8VSB:417:418:200     201:635000000:8VSB:422:423:201     202:635000000:8VSB:427:428:202     203:635000000:8VSB:432:433:203     204:635000000:8VSB:412:413:204     300:635000000:8VSB:442:443:300     400:635000000:8VSB:457:458:400     KSTS-HD:683000000:8VSB:49:52:3     Telemundo Exitos TV:683000000:8VSB:65:68:4     CNL-SOI:683000000:8VSB:81:84:5     KQEH:689000000:8VSB:49:52:1     KQED:689000000:8VSB:65:68:2     LIFE:689000000:8VSB:81:84:3     KIDS:689000000:8VSB:97:100:4     V-me:689000000:8VSB:113:116:5      Then I tune to a channel from the scan results. KIDS for example:               azap -r -c Documents/dvb/atsc/conf/channels.conf KIDS      ## What I expect the program to do: I expect the program to be tuned and to deliver results similar to this:               username@username:~$ azap -r -c Documents/dvb/atsc/conf/channels.conf KIDS     using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'     tuning to 689000000 Hz     video pid 0x0061, audio pid 0x0064          status 1f | signal 00e6 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00e6 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00e6 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00dc | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00e6 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00e6 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     ...      ## What it does: In 2 out of 5 tries the azap just doesn't work at all.               username@username:~$ azap -r -c Documents/dvb/atsc/conf/channels.conf KIDS     using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'     tuning to 689000000 Hz     video pid 0x0061, audio pid 0x0064          status 00 | signal 0000 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 0000 | snr 00e4 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 0000 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 0000 | snr 00c2 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 0000 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     ...      The rest of the time it generally works initially, then switches the status to 00 and can not be used any more, even if there is incoming signal.               status 1f | signal 00dc | snr 00dc | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00d2 | snr 00dc | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00dc | snr 00dc | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00dc | snr 00dc | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00d2 | snr 00d2 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00c8 | snr 00d2 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 1f | signal 00d2 | snr 00d2 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00d2 | snr 00d2 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00d2 | snr 00d2 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00d2 | snr 00d2 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00dc | snr 00dc | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00e6 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00dc | snr 00dc | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00e6 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00e6 | snr 00e6 | ber 00000000 | unc 00000000 | FE_HAS_LOCK     status 00 | signal 00e6 | snr 00dc | ber 00000000 | unc 00000000 | FE_HAS_LOCK     ...      The output even shows that there is high signal to noise ratio, low or rather no block errors or uncorrected errors at all at first, then it This keeps me wondering since I see no reason for the program to switch. After double checking with a real TV I am very sure that I always have an incoming signal and that there should not be any reasons for a behavior like this. ## Question Can any of you guys see a reason for this behavior, could it be a problem with the Hardware that I'm using or rather a Software issue? Did anybody experience the same issues, how did you fix it? Any help is greatly appreciated!


Keyboard shortcut to toggle between left- and right handed mouse in Cinnamon?

I'm using Linux Mint 17 with the Cinnamon desktop environment and I want to quickly toggle between left-handed and right-handed settings for the mouse by using a keyboard shortcut.


Compiling a kernel module with some options

I have a bug in a driver (`iwlwifi`/`iwlagn`), which I have reported, and the developers are asking me to "build the driver with debug options enabled." More specifically: > Debugging output is enabled when compiling the driver with > `CONFIG_IWLWIFI_DEBUG` set to "`y`". I do have the source. How do I put that option in when compiling?


How to add arithmetic variables in a script

I want to accumulate the line size of a number of files contained in a folder. I have written the following script:               let a=0     let num=0     for i in folder/*     do             num=`cat $i | wc -l`             a=$a+$num     done     echo $a      What i am geting at the end of the script is 123+234+432+... and not the result of the arithmetic operation of addition.


File Privileges

There is one user Lets call him B and he needs access Just to Read the File MEANS READ ACCESS and that file is own by another user A . How can I grant access to user A's file to User B.


Comparing the efficiency of Network Stack of two different Operating Systems

I want to compare the efficiency of Network Stacks of two different operating systems(Linux and Solaris) by measuring the amount of resources(context switches, systemcalls etc) that are consumed in the processing of each packet. I have planned to use systemtap infrastructure to perform the same because it allows dynamic probing of both user and kernel spaces. Can somebody tell me how much feasible it is? In order to find good results, what I actually should take care of ?


Raid5 + LVM2 + grub2: final config and boot

* I have a one disk, no RAID, no LVM system based on Debian Squeeze (my old system).    * I created a RAID array (RAID 5, 4 HDDs) with `mdadm` (my new system).    * I installed LVM2 on the new system and created several LVs.    * I migrated the folders (/,/boot,/home,/var/,/tmp,/usr) of the old system in the respective LVs (lv_root,lv_boot,lv_home,lv_var,lv_tmp,lv_usr) by using `rsync`.   * Note that my `boot` is in LVM, not outside. How do I proceed for the following tasks (I didn't find any good tutorials for my level of knowledge):   * Once the RAID array is created, how can I build a `mdadm.conf` file on the new system?   * How can I create a `fstab` file on the new system   * How can I install Grub2 in `/boot` and configure the four disks in order to boot from any?  After these tasks, I should be able to shutdown my machine, remove the HDD with the old system, restart the machine and the new system should boot.


What is difference betwen gid and groups

I was wondering about the following behavior: I have three users `A`, `B` and `C`. `A` creates a folder and changes the group ownership to `C`'s group.               mkdir fold     chgrp C fold     chmod g+rw fold      Now I add `B` to the `C` user group by               usermod -a -G C B      and `id B` gives me `uid=1002(B) gid=1002(B) groups=1002(B),1003(C)`. Trying to change the content of `fold` (`mkdir fold/fold2` or `touch fold/test`) as user `B` however gives me a permission denied and only `A` and `C` can change contents of that folder. What is the reason? If I change the `gid` of `B` to `C` by `usermod -g C B`, but this can't be the proper way right?


Multiline regex blank line delimiters,

I have a program which prints out data in blocks. Each block is delimited by blank lines. I would like to discard most blocks and only keep those blocks that contain something that matches a regex. I can of course do it with a scripting language or a prgram, but that seems rather crude. Is there a better way to do it?


Why does the Linux virtual terminal support only 16 colors, by default? Is there a particular reason for this?


Multiple similar entries in ssh config

Say I want to configure my `ssh` options for 30 servers with the same setup in my `.ssh` `config` file:               host XXX          HostName XXX.YYY.com          User my_username          Compression yes          Ciphers arcfour,blowfish-cbc          Protocol 2          ControlMaster auto          ControlPath ~/.ssh/%r@%h:%p          IdentityFile ~/.ssh/YYY/id_rsa      where the only thing that changes between these 30 machines is `XXX`. Instead than repeating the above structure 30 times in my `config` file, is there another way to define a range of machines?


PC BSD Warden network interface

The documentation for PC BSD's Warden mentions that the configuration of the right network interface is crucial. However, it doesn't say what the "right" interface is. This may sound like a stupid question, but what interface can I use there? The existing physical NIC one? Should I create a virtual one and use that? The aim is to have network access in the jails, i.e. be able to access the internet as well as access services running within the jail from the internet.


Apache2 virtual host not working

I use Debian 7 and have installed a virtual host with address sub.domain.com following this tutorial: http://www.debian-administration.org/articles/412 I have enabled it, rebooted the PC but still the subdomain opens /var/www Here is the file contents of the file named "sub.domain.com", located at /etc/apache2/sites-available/ :               <VirtualHost *>         ServerName sub.domain.com         DocumentRoot /usr/share/destfolder         ServerAdmin info@domain.com         ErrorLog /var/log/apache2/sub.domain.com-error_log         CustomLog /var/log/apache2/sub.domain.com-access_log common     </VirtualHost>      By the way when I reload apache's configuration, I get: `NameVirtualHost *:80 has no VirtualHosts` Any suggestions?


Omitting extension with find?

I need to create thumbnails from multiple .png files and would like to do this using ImageMagicks `convert` utility. To recursively find all files that are not thumbnails themselves, I am using the following call (split into two lines to make it readable):               find . -type f -name "*.png" -not -name "*thumb.png*" \       -exec convert {} -thumbnail 200x200 {}.thumb.png \;`      But this would of course create a file named `a.png.thumb.png` when running it on a file called `a.png`. How could I remove the `.png` extension from the second `{}` parameter passed to convert?


External disk doesn’t appear in /dev/

I have an external (USB-2.0) hard drive. Today I couldn’t mount it after plugging to my computer. When I look in /dev/               $ ls /dev/sd*      There is no new disk, only sda and sdb with their partitions, which are two local 3.5" hard drives. However, when I took a look at dmesg, there were lines telling that disk appeared as /dev/sdc.               [542880.810341] usb 7-1.1: new high-speed USB device number 15 using ehci-pci     [542880.896004] usb 7-1.1: New USB device found, idVendor=152d, idProduct=2329     [542880.896007] usb 7-1.1: New USB device strings: Mfr=1, Product=11, SerialNumber=5     [542880.896008] usb 7-1.1: Product: StoreJet Transcend     [542880.896010] usb 7-1.1: Manufacturer: JMicron     [542880.896011] usb 7-1.1: SerialNumber: 322549CB7013     [542880.896391] usb-storage 7-1.1:1.0: USB Mass Storage device detected     [542880.896422] scsi21 : usb-storage 7-1.1:1.0     [542881.917895] scsi 21:0:0:0: Direct-Access     StoreJet Transcend        2AJ1 PQ: 0 ANSI: 2 CCS     [542881.917995] sd 21:0:0:0: Attached scsi generic sg3 type 0     [542881.918635] sd 21:0:0:0: [sdc] 1250263727 512-byte logical blocks: (640 GB/596 GiB)     [542881.919636] sd 21:0:0:0: [sdc] Write Protect is off     [542881.919639] sd 21:0:0:0: [sdc] Mode Sense: 28 00 00 00     [542881.920633] sd 21:0:0:0: [sdc] No Caching mode page found     [542881.920634] sd 21:0:0:0: [sdc] Assuming drive cache: write through     [542881.923253] sd 21:0:0:0: [sdc] No Caching mode page found     [542881.923254] sd 21:0:0:0: [sdc] Assuming drive cache: write through     [542881.966710]  sdc: sdc1 sdc2 sdc3 < sdc5 sdc6 > sdc4     [542881.970736] sd 21:0:0:0: [sdc] No Caching mode page found     [542881.970739] sd 21:0:0:0: [sdc] Assuming drive cache: write through     [542881.970742] sd 21:0:0:0: [sdc] Attached SCSI disk      It cannot be other disk or a flash card because I compared dmesg output right before plugging in external drive and after that. How can that be? My system is Gentoo amd64 with eudev. * * * cat /proc/partitions udevd --debug


When does one get the error message "jobs : not found"?

When does the `jobs` command issue the message `jobs : not found`?   Also, why does the command `man jobs` refuse to show any entry for the command `jobs`?   P.S. : I am able to successfully execute the `jobs` command on the terminal


Feed GPG with answers

I wish to do something like:               echo -e "trust\n5" | gpg --edit-key "Dor"      In order to supply GPG with answers that were made in advance. But it doesn't work. Any idea?


Problem reading mouse from /dev/input/events

I'm using Fedora 17 LXDE with kernel 3.6.10 and am trying to read raw mouse relative movements from `/dev/input/mouseX` and/or `/dev/input/eventX`. I get data showing mouse clicks (mouse up, mouse down) and `rel_*` events but all the relative movement data have identical `rel_x` and `rel_y` values. i.e., if I move the mouse left, I get `rel_x = rel_y = +1`. If I move the mouse to the right, I get `rel_x = rel_y = +1`. Same values when moving the mouse up/down. The values are not always = +1, sometimes they are +2. Any ideas?               #include <stdio.h>     #include <stdlib.h>     #include <fcntl.h>     #include <istream>     #include <unistd.h>     #include <linux/input.h>          #define MOUSEFILE "/dev/input/event2"          int main()     {     int fd;     struct input_event ie;          if((fd = open(MOUSEFILE, O_RDONLY)) == -1) {         perror("opening device");         exit(EXIT_FAILURE);     }          while(read(fd, &ie, sizeof(struct input_event))) {         unsigned char *ptr = (unsigned char*)&ie;         for(int i=0; i<sizeof(ie); i++)             printf("%02X ", *ptr++);         printf("\n");     }          return 0;     }      Typical output:               29 EB F7 50 00 00 00 00 27 6A 0C 00 00 00 00 00 02 00 01 00 01 00 00 00      29 EB F7 50 00 00 00 00 33 6A 0C 00 00 00 00 00 00 00 00 00 00 00 00 00      29 EB F7 50 00 00 00 00 F5 90 0C 00 00 00 00 00 02 00 00 00 01 00 00 00      29 EB F7 50 00 00 00 00 F6 90 0C 00 00 00 00 00 02 00 01 00 01 00 00 00      29 EB F7 50 00 00 00 00 00 91 0C 00 00 00 00 00 00 00 00 00 00 00 00 00      29 EB F7 50 00 00 00 00 BF B7 0C 00 00 00 00 00 02 00 00 00 02 00 00 00      29 EB F7 50 00 00 00 00 C0 B7 0C 00 00 00 00 00 02 00 01 00 02 00 00 00      29 EB F7 50 00 00 00 00 CA B7 0C 00 00 00 00 00 00 00 00 00 00 00 00 00      29 EB F7 50 00 00 00 00 1C D7 0C 00 00 00 00 00 02 00 00 00 01 00 00 00      29 EB F7 50 00 00 00 00 1D D7 0C 00 00 00 00 00 02 00 01 00 01 00 00 00      29 EB F7 50 00 00 00 00 24 D7 0C 00 00 00 00 00 00 00 00 00 00 00 00 00      29 EB F7 50 00 00 00 00 F0 3F 0D 00 00 00 00 00 02 00 00 00 01 00 00 00      29 EB F7 50 00 00 00 00 F1 3F 0D 00 00 00 00 00 02 00 01 00 01 00 00 00      29 EB F7 50 00 00 00 00 FA 3F 0D 00 00 00 00 00 00 00 00 00 00 00 00 00      29 EB F7 50 00 00 00 00 51 6A 0D 00 00 00 00 00 02 00 00 00 03 00 00 00      29 EB F7 50 00 00 00 00 52 6A 0D 00 00 00 00 00 02 00 01 00 03 00 00 00      29 EB F7 50 00 00 00 00 5A 6A 0D 00 00 00 00 00 00 00 00 00 00 00 00 00           and some output when clicking a button     72 EE F7 50 00 00 00 00 10 DF 00 00 00 00 00 00 01 00 10 01 01 00 00 00      72 EE F7 50 00 00 00 00 13 DF 00 00 00 00 00 00 02 00 00 00 01 00 00 00      72 EE F7 50 00 00 00 00 13 DF 00 00 00 00 00 00 02 00 01 00 01 00 00 00      72 EE F7 50 00 00 00 00 2B DF 00 00 00 00 00 00 00 00 00 00 00 00 00 00      72 EE F7 50 00 00 00 00 C0 AE 02 00 00 00 00 00 01 00 10 01 00 00 00 00      72 EE F7 50 00 00 00 00 C5 AE 02 00 00 00 00 00 02 00 00 00 01 00 00 00      72 EE F7 50 00 00 00 00 C6 AE 02 00 00 00 00 00 02 00 01 00 01 00 00 00      72 EE F7 50 00 00 00 00 E0 AE 02 00 00 00 00 00 00 00 00 00 00 00 00 00


How to make some initscript start after delay at boot?

I want to run a thing that may disrupt the system (or remote access to it) if something goes wrong (for example, misconfiguration). To reduce problems I want to have a "grace period" after the system already started, but before "dangerous" service started. Requirements:   1. Delay is applied only on automatic starting of the initscript, not when I `/etc/init.d/whatever start` manually;   2. The script is not started until its dependencies are ready (according to usual rules in initscript headers);   3. Boot process should go on, without waiting for the full timeout. How to do it more or less cleanly? Related: http://superuser.com/questions/460112/how-do-i-run-a-script-5mn- after-startup


PPTP: Allow remote clients to communicate with each other

I have a PPTP server. Clients log in to the server, but can not ping each other. The clients are at different locations. The problem is with my IPTABLES forward chain .... here is my iptables: iptables


Create bash script for wine cmd script

I have installed FIFA09 through wine & it runs great...however i have to manually go to installation directory each time & open the terminal there. Then have to write in two steps: `wine cmd` while cmd is operating in terminal `FIFA09.exe -Windowed` how can i chain these commands in a bash script which can then be invoked by a simple .desktop launcher


Can't Get Synaptics Touchpad Disabled

The touchpad comes back to life after a few seconds. The Windows driver had a disable-entirely option. I do **not** want to use the touchpad at **all** , so anything up to and including a **hardware fix** is now open for consideration. The laptop is an HP Pavilion DM1 and the Linux is a fresh install of Mint Lisa (12) with GNOME. And yes, I tried everything here with **no** effect.


How to set the bash display to not show the vim text after exit?

My question is simple, but I am finding it hard to frame/explain it easily. I log into several Unix boxes with different accounts. I see 2 different things for `user1` and `user2`, while editing text files in vim ### user1 When I type `vim filename`, vim opens and I edit the file. When I close it, the complete text from the file is gone , and I see the Teminals' command/output that was previously present. ### user2 When I type `vim filename`, vim opens and I edit the file. When I close it, the part of file that was present on the display while I was in `vim` still shows up at the display, and all the previous Terminal display get's scrolled up. Even if the file was just 1 line, after exiting vim, the display shows the first line, with rest all the `~` and I see the command prompt at the bottom of screen. ### Details               $ bash --version     GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)     Copyright (C) 2005 Free Software Foundation, Inc.     $ vim --version     VIM - Vi IMproved 7.0 (2006 May 7, compiled Jun 12 2009 07:08:36)      I compared the `vimrc` files for both users, and I am aware of all the settings, and don't find any setting/config related to this behavior. Is this behavior related to shell config ? How do I set the things, so that I get the behavior as shown in `user1` scenario? I am not able to describe this easily, also finding it hard to google, as I don't to know what keyword to look for such behavior. Let me know, If I should elaborate further.


Use iptable do redirect all the HTTP traffic to localhost

I use a Linux machine as WLAN Router with the help of `hostapd` and `udhcpd`. There's also an Apache web server installed on the same machine. Now I want to redirect all the traffic which comes through port 80 from wlan0 to the the Apache webserver.               iptables -t mangle -N internet     iptables -t mangle -A PREROUTING -i wlan0 -p tcp -m tcp --dport 80 -j internet     iptables -t mangle -A internet -j MARK --set-mark 99     iptables -t nat -A PREROUTING -i wlan0 -p tcp -m mark --mark 99 -m tcp --dport 80 -j DNAT --to-destination 192.168.0.1      This was the solution I've found. I've adjusted the IP and the interface, but it didn't work. Any ideas?


How to check if an application is running with a bash script

I have the gnome-run application in my home folder. I have now added the application to run when I press `Meta`+`R` (i added it in in ccsm). The problem is that if I have the gnome-run program open and I press the key combination I want the application to close. Is there some way to create a bash file that checks if the applications is running, if it is then close it, else launch it. I run the application like ./gnome-run in my home folder.   I can't find the application process in ps -A or anything. Thanks


Linker errors when compiling against glib...?

I'm having trouble compiling a simple, sample program against glib on Ubunutu. I get these errors. I can get it to compile but not link with the -c flag. Which I believe means I have the glib headers installed, but it's not finding the shared object code. See also the make file below.               $> make re     gcc -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include  -lglib-2.0       re.c   -o re     /tmp/ccxas1nI.o: In function `print_uppercase_words':     re.c:(.text+0x21): undefined reference to `g_regex_new'     re.c:(.text+0x41): undefined reference to `g_regex_match'     re.c:(.text+0x54): undefined reference to `g_match_info_fetch'     re.c:(.text+0x6e): undefined reference to `g_print'     re.c:(.text+0x7a): undefined reference to `g_free'     re.c:(.text+0x8b): undefined reference to `g_match_info_next'     re.c:(.text+0x97): undefined reference to `g_match_info_matches'     re.c:(.text+0xa7): undefined reference to `g_match_info_free'     re.c:(.text+0xb3): undefined reference to `g_regex_unref'     collect2: ld returned 1 exit status     make: *** [re] Error 1      Makefile used:               # Need to installed libglib2.0-dev some system specific install that will     # provide a value for pkg-config     INCLUDES=$(shell pkg-config --libs --cflags glib-2.0)     CC=gcc $(INCLUDES)     PROJECT=re          # Targets     full: clean compile          clean:         rm $(PROJECT)          compile:         $(CC) $(PROJECT).c -o $(PROJECT)      .c code being compiled:               #include <glib.h>              void print_upppercase_words(const gchar *string)     {       /* Print all uppercase-only words. */            GRegex *regex;       GMatchInfo *match_info;            regex = g_regex_new("[A-Z]+", 0, 0, NULL);       g_regex_match(regex, string, 0, &match_info);            while (g_match_info_matches(match_info))         {           gchar *word = g_match_info_fetch(match_info, 0);           g_print("Found %s\n", word);           g_free(word);           g_match_info_next(match_info, NULL);         }            g_match_info_free(match_info);       g_regex_unref(regex);     }          int main()     {       gchar *string = "My body is a cage.  My mind is THE key.";            print_uppercase_words(string);     }      Strangely, when I run `glib-config` it doesn't like that command -- though I don't know how to tell bash or make how to just use one over the other when it complains that `gdlib-config` is in these 2 packages.               $> glib-config     No command 'glib-config' found, did you mean:      Command 'gdlib-config' from package 'libgd2-xpm-dev' (main)      Command 'gdlib-config' from package 'libgd2-noxpm-dev' (main)     glib-config: command not found      Sorry for all the code -- but I've been hunting for a solution, and didn't want to have to reply with questions for more specifics.


Renaming folders based on a dictionary in form of a CSV file?

I will describe the problem quite verbose, as I have learned that only talking about a specific sub-problem I have identified leads to missed oppurtunities ... So I will put a tl;dr up front: **There is a set of folders that need to be renamed according to a mapping in a CSV file.** The folder names follow the following pattern:               [[:alpha:]]*[[:digit:]]*_[[:alnum:]]*      The digits in the middle are relevant and specify the new name the folder should have. So I could run the following sed command to extract the part of the foldername I am interested in.               sed 's/[[:alpha:]]*\([[:digit:]]*\)_[[:alnum:]]*/\1/'      So we might have a folder thats named `deptA100257_2bfde391c6af30fde3fca94b07bc8e7c` and can pull out the relevant ID `100257`. I then need to rename the folder according to the following CSV:               63;9961     63;100257      The new name is on the left, the ID of the old name on the right. So the folder from the example above should be renamed to `63`. First obvious problem: Multiple Ids may map to a single name. I would solve this by creating all "new" folders up front and copy the folder contents instead. And I could hack this up using Python or whatever, possibly even some bash loops. But something tells me that at the core, this operation (substitution according to a file) isn't exactly uncommon. So before re-inventing the wheel ... I prefer solutions using standard *NIX shells and tools (especially bash or zsh) and no "external" languages like Perl, Ruby, Python ... But in the end I am more or less looking for a "smart" approach and if there is a nice Ruby one-liner that gets the job done, I am ok with that.


Battery management - are there differences between distros?

I have heard that Linux, in general, has poor notebook battery management: the battery lifetime is reduced significantly (I have noticed it on my MacBook 2.1 with Ferdora installed) Are there any differences in power management between the distributions?


Fullscreen Flash videos on some sites do not align with the screen in Awesome WM

Using the default Awesome WM settings, Flash videos from youtube.com are fullscreened just fine*: ![youtube.com fullscreen screenshot](http://i.stack.imgur.com/HmVlB.jpg) The same type of video on store.steampowered.com is both sized and positioned wrongly: ![steampowered.com "fullscreen" screenshot](http://i.stack.imgur.com/N4bgz.png)   * Cropped at the bottom.   * Top right corner about a third of a screen width away from the right edge and about half a screen height away from the top edge. The fullscreen mode windows have virtually identical state, as shown by their `xprop` output:               $ diff -u youtube.xprop steam.xprop     --- youtube.xprop 2014-01-04 10:10:55.563866148 +0000     +++ steam.xprop   2014-01-04 10:11:07.943641993 +0000     @@ -7,10 +7,10 @@                     Client accepts input or input focus: True                     Initial state is Normal State.                     window id # of group leader: 0x1600001     -_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 23084618     +_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 23084626      _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL     -_NET_WM_USER_TIME(CARDINAL) = 76121035     -_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x1603e49     +_NET_WM_USER_TIME(CARDINAL) = 76124714     +_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x1603e51      WM_CLIENT_LEADER(WINDOW): window id # 0x1600001      _NET_WM_PID(CARDINAL) = 1634      WM_LOCALE_NAME(STRING) = "en_US.UTF-8"      * The weird shape is because I'm using a right tack layout, and I had to crop away the bits of the right part which are not actually shown on the monitor. I took the screenshot after restoring my custom settings, but the desktop looks the same (minus the tag names) as the default.


ZSH host name completion behaviour change?

I have been using ZSH to do host name completion, and want to change the default behaviour. When I have multiple hosts with similar names, the completion does stuff that I don't care for. An example is best: Let's say I have these hosts:               host01.stage.example.com     host02.stage.example.com     host01.prod.example.com     host02.prod.example.com      now, in my prompt, I will type:               $ ssh hos<tab>      zsh will show me:               $ ssh host..example.com       with the cursor right after "host" and shows me a menu with the host names in it. I like the menu showing me hostnames, I just don't want it to complete everything. Weird things happen. Most of the time I tab through and either have to delete host names or have extra stuff on the line i have to delete. A preferred way would be to not complete the rest of the hostname. something like:               $ ssh hos<tab>      zsh would hopefully show me:               $ ssh host     host01.stage.example.com  host01.prod.example.com     host02.stage.example.com  host02.prod.example.com      Any thoughts?


Editing a file without overwrite permission

Is it possible to set permissions for file to keep it editable but without permission to overwrite? I mean possibility to edit the file with text editor, but denying any attempt to replace the file by overwriting. The user is `root`. I know that it is not the common structure of unix file permission, but I am looking for a tricky approach. I have a package of files, as some of them have been edited/customized from the original version. When updating the package with a new version, I want to replaced any untouched file, but protect the customized files (not to miss edits). Currently, I must do this manually: writing which file has been edited, not to be replaced in new update.


No sound in Ubuntu 13.04 i386

I have a machine running Windows 7-ultimate 32-bit. I installed vmware workstation on it and Ubuntu 13.04 i386 on that vmware. But on Ubuntu I don't hear any sound, any start up or movie or music sound. I have installed other OSes on that vmware but no one has that sound problem.


Rearrange partitions to install a second Linux distribution

I am new to Linux and just got some foggy idea of partition tables. To be precise here it is:               Model: ATA ST3500418AS (scsi)     Disk /dev/sda: 500GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start   End     Size    Type      File system  Flags      1      1049kB  1001MB  1000MB  primary   ext4         boot      2      1001MB  3002MB  2001MB  primary      3      3002MB  18.0GB  15.0GB  primary   ext4      4      18.0GB  500GB   482GB   extended      5      18.0GB  53.0GB  35.0GB  logical   ext4      6      53.0GB  93.0GB  40.0GB  logical   ext4      7      93.0GB  500GB   407GB   logical   ext4          $ uname -r -v     3.2.0-41-generic-pae #66-Ubuntu SMP Thu Apr 25 03:50:20 UTC 2013          $ df     Filesystem          1K-blocks      Used Available Use% Mounted on     /dev/sda3            14419440   4397832   9289144  33% /     udev                  1015728         4   1015724   1% /dev     tmpfs                  410376       908    409468   1% /run     none                     5120         0      5120   0% /run/lock     none                  1025940       584   1025356   1% /run/shm     /dev/sda1              961528    161488    751196  18% /boot     /dev/sda5            33643288   2435112  29499172   8% /var     /dev/sda6            38448788    180232  36315432   1% /usr/local     /dev/sda7           391315084 365544552   5892800  99% /home     /home/arun/.Private 391315084 365544552   5892800  99% /home/arun      And now I want to install OpenSUSE 12.2 alongside it. I also want to share `/usr/local` and `/home` partition among both OSes. What changes to this partiton setup would get me going with the best usage of my hard disk space? I will be doing kernel development later and thus want to share the `/boot` partition too.


convert djvu to pdf

How to convert djvu2pdf ? My current approach is :               djvups x.djvu > x.ps     ps2pdf x.ps      Is there more efficient and better (in terms of output quality, data/metadata loss) way to handle that ?


How do I get LILO to boot on cloned hard drive?

I have a really old hard drive with DOS and Linux partitions with LILO as the boot loader. I want a clone of this hard drive that works exactly like the original. I made a clone using Knoppix and dd_rescue. When I plug in the newly cloned drive, the LILO boot loader stops at "LI" meaning LILO failed at that point. Is this because I need to actually run the LILO command on the LILO partition on the new hard drive before it will work? If so, how do I do that from a live CD? **Update:** Booted from Knoppix live CD: ![fdisk](http://i.stack.imgur.com/MMpGt.jpg) ![chroot](http://i.stack.imgur.com/8UzTm.jpg) I don't know what "open /dev/hda: Device not configured" is telling me.


how to check OS and version using Linux commmand

what is the Linux command to check the server OS and its version? Connected the server using shell.


Is there a way to increase the 20 multicast group limit per socket?

As the title says, is there a way to increase the limit of 20 multicast groups that you can join on a given socket? Is there some system setting that I am missing or is there some hard limit which cannot be exceeded?


Red Hat Error Class Code: 49 When Attempting To Install Package

I am a Unix noob. I am currently working on a virtual machine that is running Red Hat 4.1.2-41. When I attempt to install a software package, I get the following error:                up2date_client.up2dateErrors.AbuseError:       Error Message:      Abuse of Service detected for server supplierweb (1019016735)      Error Class Code: 49      Error Class Info:       You are getting this error because RHN has detected an abuse of      service from this system and account. This error is triggered when      your system makes too many connections to Red Hat Network. This      error can not be triggered under a normal use of the Red Hat Network      service as configured by default on Red Hat Linux.           The Red Hat Network services for this system will remain disabled      until you will reduce the RHN network traffic from your system to      acceptable limits.           Please log into RHN and visit https://rhn.redhat.com/help/contact.pxt      to contact technical support if you think you have received this      message in error.      OK, so it seems that I have too much traffic going through the Red Hat network. I used the top command to check my processes and got this:               top - 09:07:33 up 18:07,  3 users,  load average: 0.35, 0.33, 0.15     Tasks: 185 total,   3 running, 182 sleeping,   0 stopped,   0 zombie     Cpu(s): 50.0%us, 50.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st     Mem:   2177252k total,  1091260k used,  1085992k free,   190420k buffers     Swap:  2031608k total,        0k used,  2031608k free,   453392k cached      This is my VM that my company has set up for me, and the 3 users are me as a regular user, root (also me), and my manager, who is not using the VM and doesn't care if I reboot or whatever. To reiterate, I know next to nothing about UNIX, so please bare with me. Can I assume that 185 tasks is maybe too many running, and this is the cause of the excessive traffic to the RH network? If so, what processes can I generally close without affecting operation? Sorry if this is a silly question or if it is not very clear. Ant help is greatly appreciated.


Making a simple PHP script process text in a pipe

Last week I wanted to convert some simplified Chinese characters into traditional ones. I found a deceptively nice looking shell one-liner, which today I found out was 20% error prone. So I did some research. The mediawiki codebase contains conversion tables that take the idiosyncratic nature of simplified orthography into account, and someone already wrote a nice helper library full of dummy classes and functions, called mediawiki-zhconverter. So it appeared I could have my one- liner, which I would prefer looked something like this, stconvert being the name of the script I'm writing:               $cat simplifiedstory | stconvert > traditionalstory      However, mediawiki is entirely PHP, and I have never written any PHP, so I don't know how it deals with shell variables. As you can see below, simply putting '$argv' where a string would go does not achieve my goal.               #!/usr/bin/php     <?php          define("MEDIAWIKI_PATH", "/home/a1/mediawiki-1.13.0/");     require_once "mediawiki-zhconverter.inc.php";     echo MediaWikiZhConverter::convert($argv, "zh-tw") , ",";          ?>


Does the mail command require a mail server?

Does one need to set up a mail server before being able to use the linux `mail` command?


How to take and restore backup with an LTO tape drive in RedHat?

I can take a backup with an IBM LTO tape drive in RedHat 5 using `mt` and `tar`, but I can't restore it. I can't see previous backup content. Whenever I try to take a backup, I think that the new backup overwrites the one on tape every time. `mt` command does not work to rewind the tape. Can someone explain how I should restore and list backup contents from the tape drive?


Filter --help command?

Sometimes I want to search/filter help for particular commands for keywords.               history --help      gives list of options, sometimes it's overwhelming how much info is there. Can I filter it for keywork "clear" e.g.               history --help *clear*      Also sometimes I want all info from --help, but it's so long that some of the lines get lost and I cannot scroll up for them. How can I make it show screen by screen e.g. fill first screen then on key press fill second screen etc. Question same for file listing command.


How to install kernel on debian with no internet connection

I'm trying to install a newer kernel version on my Debian (squeeze) machine as I need it to get my wireless card working. I have Debian on one partition of my hard drive, Fedora on the other. I'm looking for SIMPLE instructions on how to do this which I cannot find anywhere on the net. Any help would be greatly appreciated! I'm even wondering if it is possible to copy the kernel across from one partition to the next?


How to display halfwidth Unicode characters in gnome-terminal etc

I'm wanting to set up vim with conceal to display the unicode characters U+2329 (`〈`) and U+232A (`〈`) in place of `<` and `>` when used to indicate type parameters. These are half-width characters that display just fine in Leafpad, Firefox, or indeed the preview area in the gnome-terminal font selector (all using BitStream Vera Sans). However when displaying these characters in the terminal, they actually take up two character cells. Any ideas?


zfs-fuse: enabling compression has no effect

I installed on Debian Wheezy zfs-fuse file system and enabled compression gzip-9 on one dataset ("storage/backup"). When I check if the compression is enabled on this dataset, it shows YES:               $: zfs get compression storage/backup     NAME         PROPERTY     VALUE     SOURCE     storage/backup  compression  gzip-9    local      However, when I check the compression rate with `du -ah` or with `sfx get compressratio` no any compression can be seen. All files, including well compressible ones (e.g. text files), take up exactly the same disk size as uncompressed ones:               $: zfs get compressratio storage/backup     NAME         PROPERTY       VALUE  SOURCE     stor/backup  compressratio  1.00x  -      Why does this situation occur? Here some info from `zfs get all` about the dataset:               compressratio         1.00x                  -     mounted               yes                    -     quota                 none                   default     reservation           none                   default     recordsize            128K                   default     mountpoint            /storage/backup        default     sharenfs              off                    default     checksum              on                     default     compression           gzip-9                 local     atime                 on                     default     devices               on                     default


What is wrong with this call to sed -i?

I have this line               find . -type f \( ! -name '*.plist' \) -and \( ! -name '*.mp4' \) -and \( ! -name '.DS*' \) -print0 | xargs -0 sed -i 's/AAA/BBB/g'      my intention is from the current directory recursively change all occurrences of AAA to BBB in all files except those with the following extensions: .plist, .mp4 and .DS* but I get the message               sed: 1: "./myDir/pro ...": invalid command code .


Display current pane's current directory in status

Is there a way to update `pwd` in tmux status, instead of showing it in PS1?               set -g status-left "#(pwd)"     set -g status-interval 1      doesn't work.


unable to format usb drive

I'm trying to read an usb drive that until a few day ago seemed to be perfectly working. Today windows started to be unable to access or modify its content. Trying to reformat it with linux (arch distribution) there are a few strange things. The output of lsblk is _(sdc is the faulty usb drive)_               NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT     sda      8:0    0 149.1G  0 disk        sda1   8:1    0 149.1G  0 part /       sda2   8:2    0  1007K  0 part      sdb      8:16   0 465.8G  0 disk        sdb1   8:17   0 465.8G  0 part /mnt/toshibaExt     sdc      8:32   1     8M  0 disk      sr0     11:0    1  1024M  0 rom      The output of lsblk -f is:               # lsblk -f     NAME   FSTYPE LABEL       UUID                                 MOUNTPOINT     sda                                                                   sda1 ext4               5711fd14-4c90-487f-a8fc-ae7923d54dc5 /       sda2                                                              sdb                                                                   sdb1 ntfs   TOSHIBA EXT 5ADEC4FBDEC4D085                     /mnt/toshibaExt     sdc                                                                 sr0       Trying to erase the content with dd results in               # dd if=/dev/zero of=/dev/sdc     dd: writing to ‘/dev/sdc’: No space left on device     16385+0 records in     16384+0 records out     8388608 bytes (8.4 MB) copied, 1.07083 s, 7.8 MB/s      Trying to create a new partition table with gparted, gparted sees in sdc a single chunk of unallocated memory of 8MiB, with               Partition=unallocated,     File System=unallocated     Size=8.00 MiB     Used=---     Unused=---     Flags=      If i try to create a new partition table from gparted, msdos type, no error is given in the gui but nothing seems to happen. In the terminal i have a "/dev/sdc: unrecognised disk label" error. Trying to create a new partition results in the error message: "no partition table found". With fdisk, i tried to create a new partition with               #fdisk /dev/sdc     n p <enter> <enter> w      It says that a new partition 1 of type 'Linux' and of size 7 MiB has been created, but trying again with lsblk or gparted nothing seems to have changed. EDIT: The output of dmesg after plugging in the USB is:               [  931.543277] usb 5-7: new high-speed USB device number 7 using ehci-pci     [  931.668457] usb-storage 5-7:1.0: USB Mass Storage device detected     [  931.669171] scsi6 : usb-storage 5-7:1.0     [  932.670552] scsi 6:0:0:0: Direct-Access     Generic  Flash Disk 2.0   2.60 PQ: 0 ANSI: 2     [  932.671782] sd 6:0:0:0: [sdc] 16384 512-byte logical blocks: (8.38 MB/8.00 MiB)     [  932.672412] sd 6:0:0:0: [sdc] Write Protect is off     [  932.672419] sd 6:0:0:0: [sdc] Mode Sense: 0b 00 00 08     [  932.673030] sd 6:0:0:0: [sdc] No Caching mode page found     [  932.673036] sd 6:0:0:0: [sdc] Assuming drive cache: write through     [  932.677671]  sdc: unknown partition table     [  932.680661] sd 6:0:0:0: [sdc] Attached SCSI removable disk      EDIT2: Output of fdisk -l:               $ sudo fdisk /dev/sdc -l          Disk /dev/sdc: 8 MiB, 8388608 bytes, 16384 sectors     Units: sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes


Tail -f piped through grep not outputing to file, but outputs to console

I'm using the following command               tail -f /mydir/myfile |  grep "searchterm" >> outfile      Without the `-f` it works fine, but with the `-f`, which I need, nothing is written to the file. The following outputs to the console just fine               tail -f /mydir/myfile |  grep "searchterm"      What do I need to do in order to get my command to correctly write out to a file?


How to get milliseconds since Unix epoch?

I want to do a bash script that measures the launch time of a browser for that I am using an html which gets the time-stamp on-load in milliseconds using JavaScript. In the shell script just before i call the browser I get the time-stamp with:               date +%s      The problem is that it gets the time-stamp in seconds, and I need it in milliseconds since sometimes when ran a second time the browser starts in under a second and I need to be able to measure that time precisely using milliseconds instead of seconds. How can I get the time-stamp in milliseconds from a bash script?


ufs fails on debian

I am a longtime openSUSE user. However, my friend convinced me to give debian a try. When installing, I noticed there was no ext3 option (which I usually use), so I selected ufs. Then I got an error: > ufs file system creation failed. I tried multiple times. It would seem that it only succeeded when I created only one partition (and not a seperate /home like I usually do). Any ideas what went wrong here? And why is there no ext3 option? Are people no longer using that? I thought they were.


How to setup SVN over VPN?

I'm looking on how to implement a SVN connection over a VPN on my CentOs server. I need to see up this VPN to work with the team in the office from outside.   1. required packages ( yum ... )   2. configuration files I have to mod ( /etc/... )   3. a basic configuration example I don't have any particular requirement I just need to set up this service in order to get it work. ( so any suggested kind of VPN that can suit this is accepted ).


regex wanted to exclude a string

I want to have an expression that targets all lines that begin with _http_ , end with _icon.ico_ and **do not** contain _config.privoxy.org_. In the sample list below, I would like to catch all except the third and fourth entries (from the top).               http://cdn.sstatic.net/askubuntu/img/favicon.ico     http://cdn.sstatic.net/unix/img/favicon.ico     http://config.privoxy.org/error-favicon.ico     http://config.privoxy.org/favicon.ico     http://economictimes.indiatimes.com/icons/etfavicon.ico     http://forums.linuxmint.com/images/favicon.ico     http://forums.mozillazine.org/static/common/images/favicon.ico     http://gmane.org/favicon.ico     http://mail.yimg.com/ok/u/assets/img/favicon-yhoo.ico     http://portableapps.com/favicon.ico     https://help.ubuntu.com/favicon.ico     https://www.axisbank.co.in/favicon.ico     http://user.services.openoffice.org/favicon.ico     http://www.gardnermuseum.org/favicon.ico     http://www.theregister.co.uk/favicon.ico     http://www.webupd8.org/favicon.ico     http://www.wilderssecurity.com/favicon.ico      The best I could come up with is `'^.{19}[^x].*icon\.ico$'` which is a cheap workaround since **x** is relatively rare. Is there a fool-proof, proper way to do what I want?


Test variable if its string or not

I'm writing a script which will have some arguments and so I am using `getopts` but i want to solve the problem with one argument. I use a switch, for example `-d`, and I want the argument for `-d` will be the path to a directory, like `./work`. I want to test the user's input for a string or path, not a number. Is there any solution to solve this problem? I want to solve it with something like:               If (test)       then echo it is string     else        echo it is not string


Creating directory on an external hard drive via command line (SSH) on Linux

**I have tried many approaches to create a directory on my external hard drive. Here is the details when I do**               fdisk -l      **What I get:**               pi@raspberrypi:~$ sudo fdisk -l          Disk /dev/mmcblk0: 3965 MB, 3965190144 bytes     4 heads, 16 sectors/track, 121008 cylinders, total 7744512 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x000a589c                  Device Boot      Start         End      Blocks   Id  System     /dev/mmcblk0p1            2048     2464843     1231398    e  W95 FAT16 (LBA)     /dev/mmcblk0p2         2465792     7744511     2639360   85  Linux extended     /dev/mmcblk0p5         2473984     2588671       57344    c  W95 FAT32 (LBA)     /dev/mmcblk0p6         2596864     7744511     2573824   83  Linux          Disk /dev/sda: 320.1 GB, 320072933376 bytes     255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xbe707a93             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *          63   625137344   312568641    7  HPFS/NTFS/exFAT      **I found that my external hard drive is most likely located at /dev/sda so I tried 'cd'ing to it, but came to a dead end when it says**               pi@raspberrypi:~$ cd /dev/sda      -bash: cd: /dev/sda: Not a directory **Any help with getting on with my task?**


use drivers from old kernel in new kernel

I am using newest Raspbian but I found out stk1160 drivers are not working properly. But in older raspbian it works ok. So I would like to move drivers from older Raspbian to newer Raspbian. How can I do it?


iptables REDIRECT in combination with matching on interface vs. IP address

I've successfully set up Tor for transparent proxying using iptables (ie, all outgoing traffic is sent through Tor without the application's knowledge). In doing so, I discovered both an odd problem and an equally odd fix (workaround?). My rules are as follows. No user-defined chains or other rules present, all policies are ACCEPT.               -t nat -A OUTPUT -o lo -j RETURN     -t nat -A OUTPUT -p tcp -m owner --uid-owner tor -j RETURN     -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports 54     -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 55          -A INPUT -j ACCEPT          -A OUTPUT -o lo -j ACCEPT # Rule A     -A OUTPUT -d 127.0.0.1 -j ACCEPT # Rule B     -A OUTPUT -p tcp -m owner --uid-owner tor -j ACCEPT     -A OUTPUT -j REJECT # Rule C      In other words:   * All traffic from/to localhost is untouched.   * All traffic generated by Tor is untouched.   * All outgoing TCP connections are sent through Tor (transparent proxying port is 54).   * All outgoing DNS queries are resolved by Tor (DNS on port 55).   * To prevent leakage, all other outgoing traffic is hit on the head with a brick and dropped in a ditch. (While this setup has some problems, like failing to respond to connections from the LAN, those are irrelevant to the issue at hand.) If Rule B is not present, all outgoing connections are immediately rejected by Rule C. I know they are rejected by Rule C because changing the rejection type (ex. `--reject-with icmp-proto-unreachable`) results in a different error. Example error messages without Rule B:               # With Rule C --reject-with icmp-port-unreachable, the default:     $ curl 213.155.151.153 # (google.com; DNS also doesn't work)     curl: (7) Failed connect to 213.155.151.153:80; Connection refused          # With Rule C --reject-with icmp-proto-unreachable:     $ curl 213.155.151.153     curl: (7) Failed connect to 213.155.151.153:80; Protocol not available      With Rule B, connections work fine. Based on my understanding of iptables, when an outgoing TCP connection is made, the third rule in OUTPUT chain of `nat` will rewrite the packet's destination to 127.0.0.1:54. The packet will then enter OUTPUT chain of `filter`, and it _should_ be matched by Rule A, since its outgoing interface is now the loopback interface. However, it is _not_ matched by Rule A, and if Rule B (which does match it) is not present, the packet gets dragged into an alley and mugged by Rule C. Why aren't Rule A and Rule B equivalent? How is matching the loopback interface different from matching the loopback address, in this situation?


deleted user is still an option in gnome login in Debian 6

I'm running Debian 6.0.8. I misnamed the original username I wanted, so I made a new user with the proper username. On the gnome log on screen, I see two users of the same name (the login screen displays the users "human" name). I knew the second user was the correct user name so I clicked on it. Once inside gnome, I went to System > Administration > Users and deleted the misnamed user. However, upon reboot, the old, wrongly-named user was still listed there and I clicked on it without thinking. The user directory was apparently gone because the desktop never loaded its icons and I got several errors about not being able to write to or find certain user directories. I rebooted to get to the correct user and ran `userdel -r <bad_username>` and first I got an error that the user's home directory didn't exist. After I created it to see if that would get the command to work, I got the error that the user doesn't exist. So I guess the user doesn't exist unix-wise, but the Gnome login screen still presents that user as an option. It's annoying because it's the first option, and the actual name displayed is my name, the same as the user with the correct username. So if I don't think about it, I wind up clicking on the wrong username. How can I prevent Gnome from displaying this non-existent user as a login option?


how do I mount a CIFS share so I can fully control the mounted volume on the client

It's a simple question: but I am in much pain over this situation, so here is the question: How can I "mount" a share so that a) the share is run on boot b) that I can control things like chown/chmod from the client.               # mount -t cifs -o username=root,password=******** //192.168.0.110/backup/ /var/backup/     # chown -R wwwroot:www /var/backup/      this second line will fail as a million "Permission Denied", is there anyway I can place the system settings such that a) this self same command in `/etc/fstab/` auto-mounts and b) set things up so I can manage the share as if it were to behave exactly like a local volume


How to start "Shape collage" application from terminal

I just installed application "shape collage" on my Archlinux, but I don't know how to start it via the terminal. Command `shape-collage` doesn't seem to work.


Using `ls` recursively without -R

I am trying write a shell script that has output similar to `ls -R` without using the option `-R`. This is part of a programming assignment that forbids me from using `-R`, `find` and `du`. I need to identify the top 5 files/directories inside my entire home directory and to say how many directories and files there are in total. I understand that I can use `{sort -n | tail -n}` to get the top 5 files but I can't work out how to get an unfiltered list of all files and directories recursively without using the option `-R`.


Queuing disciplines are per-interface, what happen with interfaces using same device?

I have read about queuing disciplines here http://lartc.org/. I understand that for instance band 0 of pfifo policy is prioritized over band 2 within same qdisc, but what happen when i have ppp0 and ppp1 interfaces using same ADSL line? I mean which ATM frame is prioritized when there is outgoing traffic in both interfaces, band 0 of ppp0 or band 0 of ppp1?


How to divide the output of one command by the output of another?

I would like to know the server load divided by the amount of CPU cores in order to judge which servers are overloaded. I can get the amount of CPU cores with:               $ grep -c processor /proc/cpuinfo     2      I can get the server load with:               $ uptime | awk '{print $11}'     0.47,      Now I would like to divide `0.47/2` to get `0.23`. **How would I know which manpage to read to do this?** I'm really looking for how I can learn what the next step in finding the correct command is, I'm not asking for the command itself. I've tried searching the question online and even Google couldn't steer me in the right direction. Thus, alternatively, which keywords should I be searching on? The obvious "linux, division, bash, output" did not help.


Understanding line numbers reported when using eval

Okay, so I'm stuck working with a shell script that needs to use `eval` (I know, I know, ultimate evil etc…) however I'm having difficulty debugging some of the line numbers being thrown out by errors. For example:               script.sh: eval: line 315: syntax error near unexpected token `('      The line definitely doesn't correspond to line 315 in `script.sh` as that's entirely unrelated to the error. So I threw in random new-lines to figure out which line is originating the error, and as you'd expect it's a line with an `eval` statement. However, when I output the code being passed into the `eval`, it doesn't even contain 200 lines, let alone 315+! So what's going on here? Is there a way to usefully use the line numbers being reported, are they somehow based on the position at which the `eval` statement is run or something? I don't seem to be able to see a pattern thus far. If I could I'd replace all the `eval` statements, but unfortunately the code being passed is dynamically generated (not from user-input, don't worry!), and needs to be able to manipulate variables in the same scope as the rest of the script, which seems to preclude using `echo "$commands" | sh` or similar alternatives. I also have the issue of compatibility, and unfortunately as evil as it is `eval` is widely available.


Complete install on RAID1 + LVM

When doing a complete install of Linux is it possible to install everything including `/boot` on 2 software RAID 1s (4 hdds) + LVM? I haven't been able to figure out whether this is definitely possible. I am pretty sure it is possible but documentation/opinions appear to differ.


cannot find libarchive when compiling YAP prolog in OSX

I am trying to compile the last development version of Yap Prolog in OSX (Mountain Lion). The first time I tried I saw this message:               ##################################################################     # ERROR: Could not find library archive (-larchive).  Dropped     # library(archive). Library archive is available from     # http://code.google.com/p/libarchive/     #     # Most Unix/Linux distributions are shipped with binaries.  Make     # sure to have the development library installed.  E.g.     #     #   Debian/Ubuntu/Mint: aptitude install libarchive-dev     #   Fedora/...      yum install libarchive-devel     #   MacOS (Macports):   port install libarchive     ##################################################################      So I installed libarchive using mac ports as suggested with `sudo port install libarchive`. The installation was successful. However, after compiling again it keeps saying that libarchive is missing. I tried to find a libarchive file in my system and I found an alias `/opt/local/lib/libarchive.dylib` pointing to `/opt/local/lib/libarchive.2.dylib`. Just in case I set the environment variable `DYLD_LIBRARY_PATH` to `/opt/local/lib` but the problem is still there. Does someone have a clue how I can solve this ?


Reversing the direction of a trackball

For some reason, I want to use a trackball Logitech (aka Logicool) Marble Mouse (aka Trackman Marble) upside down. Is there a way to reverse the left and right rolling and up and bottom rolling respectively software-wise, without modifying the hardware? I tried this by writing a configuration file in `/etc/X11/xorg.conf.g/` such as               Section "InputClass"         Identifier "Marble Mouse"         MatchProduct "Logitech USB Trackball"         Option "EmulateWheel" "true"         Option "EmulateWheelButton" "8"         Option "XAxisMapping" "6 7"         Option "Emulate3Buttons" "true"         Option "ButtonMapping" "1 2 3 5 4 7 6 2 2"     EndSection      The crucial part is that I switched the keys 4 and 5 and 6 and 7 so that instead of:                   Option "ButtonMapping" "1 2 3 4 5 6 7 2 2"      I have:                   Option "ButtonMapping" "1 2 3 5 4 7 6 2 2"      But this is not working, and this maybe only valid for scroll wheel emulation mode. How can I reverse the rolling?


Unix User Level Keylogger

I need to record my own keystroke data for some academic research. I wrote a regular keylogger for Windows, but now I need to write one for a Unix environment, with the constraint that I have only user-level access. Furthermore, I'm only in the terminal, so this problem is more narrow in one sense. What would be the best way to do this? Is there some easy way to sort of fork my input so that it goes to a special program as well as to Bash? I'm using Python or Ruby if there's a lot of code involved, or Bash would work. The system is Red Hat Enterprise Linux 6.3 if it matters. **Update** : I should have listed out more detailed requirements:   * Need to record timing somehow (script -t seems to be fine)   * Need to handle special keystrokes (it matters if a Ctrl or a shift was hit in-between keystrokes); so far as possible, every key event should be handled   * Optional: Might also be good to differentiate key down and key up events for more fine-grained data.


Should 'LC_ALL=fr_FR.UTF-8 date +%x' give consistent results across machines?

The `%x` format specifier to the `date` utility should, according to the man page, use the locale specific date format. However, when I specify the same installed locale and try this on two different machines, I get different formats on each: On machine 'A':               $ locale -a | grep fr_FR     fr_FR     fr_FR.ISO8859-1     fr_FR.ISO8859-15     fr_FR.UTF-8     $ LC_ALL=fr_FR.UTF-8 date +%x     31.05.2012      On machine 'B':               $ locale -a | grep fr_FR     fr_FR.utf8     $ LC_ALL=fr_FR.UTF-8 date +%x     31/05/2012      I had a look at http://demo.icu-project.org/icu-bin/locexp?d_=en&_=fr_FR, and the section for 'short date' makes it look as if machine 'B' has it right here. Or have I misunderstood something, and in fact the locale settings do not absolutely specify the date format and this sort of variation is to be expected across implementations? Edit: Hmm.. no takers... Would it be more interesting if I said that machine 'A' is OS X Lion and machine 'B' is Ubuntu 12.04, both of which it would seem reasonable to expect to have correct internationalization/localization settings?


Setup DSL Network Connection in KDE

I have recently migrated to KDE from unity (ubuntu 12.04). I have a PPPoE network where I live. Under unity, gnome, xfce I am able to set up a DSL connection and everything works fine. I tested a live cd opensuse (kde) and when I try to set up a DSL connection it fails in a weird way. Under kde (ubuntu) happens the same thing. I tested also an ZevenOS KDE and fails. This is what I get when I try to set it up: ![screenshot](http://i.stack.imgur.com/U6GyZ.png) I am sure my username and password are correct. I set it to connect automatically and to be a system connection. Ethernet tab, IPv4 Address and IPv6 tabs are default. Under PPP tab only "Allow BSD compression", "Use TCP header compression" and "Send PPP echo packets" are checked. I also tried other combinations. The weird thing is that if I log on with unity and make the connection it works. If I log back in with KDE I see the DSL connection created on unity and it works.


How to disable live shell session command history under AIX 5-6?

It's okay that there are history files logging the commands that has been used. That't not the problem. The problem is that when 2 admins are logged in to an AIX server then it could be bad: If admin #A uses               rm FILENAME      then if admin #B hits the up arrow he gets the               rm FILENAME      command which is not a very good thing. So how can the termial be forced to only write the command history if the ssh session ended? (UPDATE#2: or solution could be that that each session has it's uniq command history, and thus we can't see each others command, only when they sign out for ex.) UPDATE#1               4:root@SERVER:/root # echo $SHELL     /usr/bin/ksh     4:root@SERVER:/root # oslevel -s     6100-05-01-1016     4:root@SERVER:/root #


In a script, check if standard input comes from a file or pipe

I know this has been _poorly_ covered previously, but those answers either lack explanation or don't apply. Basically at some point my scripts needs check if a file is specified, if it was it will be used later as input.               [ -f "$1" ] && TINPUT="$1"      simple enough... Now if a file was not found, or not specified, I would have `TINPUT="-"` which would tell the later command to read stdin. Here is my question... How do i get the script to die with error, if it was run without a pipe or without a file specified? I'm using dash, the Debian POSIX complient shell, so I can't use Bashisms. I also prefer to use lists, over `ifs` but most `ifs` could be written in lists anyway.