"grep: Unmatched [" error when using regex

I'm trying to find a pattern similar to this:               tail -n 100000 gateway.log | grep -B10 -A10 'Nov 22 11:13:56 Received Packet from [10.50.98.68'      Where "11:13:56" could be any time. This is what I came up with:               tail -n 100000 gateway.log | grep -B10 -A10 'Nov 22 [0-9]:[0-9]:[0-9] Received Packet from [10.50.98.68'      I'm not sure what it is referring to when it says "unmatched [". This part "[0-9]:[0-9]:[0-9]" is supposed to be regex. This part "[10.50.98.68" is supposed to be a string.


Verify a package installed with yum --nogpgcheck having gpg key

due to some network limitations I get this error while installing google chrome from rpmfusion repo:               GPG key retrieval failed      I have also the gpg key of google chrome downloaded from the same url that yum is trying to download from, on my system. I installed google-chrome using this command:               yum install google-chrome-stable --nogpgcheck      And it was installed successfully. Now I'm interested to know is there a way to validate the installed package using the gpg key file I have and the cached package of google-chrome in `/var/cache/...` ?


Have shotwell go through pictures in directory in order?

This has been bothering me for a long time. I have a fairly default installation of Fedora 16 with Gnome 3. I know that since Fedora 15 (don't know about before) I have never been able to view pictures in order in shotwell. Steps:   1. Open a folder with a bunch of pictures ordered by name   2. Double click on one of the files, it opens in shotwell   3. Go next, it picks a seemingly random picture instead of the next one by name Is there any way to be able to have the next feature in Shotwell go to the next picture by name instead of a random one? In case it matters, this happens on both my ext4 linux partition and on my NTFS windows partition.


What is a good X application I can use to test the X server on Solaris?

I am using Solaris, and I want to test if the I can use the X server after setting the `DISPLAY` environment variable. On Linux, I usually use `xeyes`, `xclock` or `xterm`. But none of these seem to available on Solaris. Note that I am using the GA release of Oracle Solaris 11.


Changing linked library for a given executable (CentOs 6)

I have an executable linked like this:                 $ ldd a.out             libboost_system-mt.so.1.47.0 => /usr/lib64/libboost_system-mt.so.1.47.0 (0x00007f4881f56000)             libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f4881cfb000)             libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f4881965000)             librt.so.1 => /lib64/librt.so.1 (0x00007f488175d000)             libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4881540000)             libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f4881239000)     .     .      Where the libcrypto and libssl libraries are openssl 1.0.0-fips libs. I want to experiment with the 1.0.1 libraries instead, and so I've built them in my home directory. Is there a way to get `a.out` to relink against my new openssl libraries without a lot of pain? I would like to avoid   * Having to relink `a.out` (because the build tools are massively complicated)   * Altering any global settings (because other devs work on this machine) Is it possible to do what I'm hoping here?


Linux Mint can not see my partitions - installation problem

Scenario:   * On my laptop I have Windows 7   * My disk drive has several partitions whereof not all are used (for now) ![Partitions](http://i.stack.imgur.com/byK8A.png)   * My plan is to install Linux Mint on the 20000 MB (19,53 GB) partition (called I: in the picture) To complete my plan I:   1. Downloaded the iso Linux Mint 11 "Katya" - DVD (64-bit) (I have also tried Linux Mint 11 "Katya" - CD no codecs (64-bit)).   2. Downloaded xBoot   3. Used xBoot to installed the iso on a bootable USB-pin.   4. Booted Linux Mint from the USB and choose to install Linux Mint.   5. When I come to the partition screen, there are only four partitions - all partitions starting from the blank partition is viewed as _ONE_ partition with the attribute _UNKNOWN_. Moreover,   * In Linux Mint I can easily mount the partitions K: and I:    * I have tried to format I: to ext2 and to ext4   * I have also tested other USB-installers, but with the same result. **Any ideas...?**


Connect to LDAP with cn=config in Debian Squeeze

How can I connect with an LDAP-Browser to a Debian Squeeze default openldap- installation? (It uses `cn=config` only).


What fd's are used when doing diff <(cat old) <(cat new)?

If I do:               diff <(cat old) <(cat new)      Hoe does that work internally for the diff program? And how I do the same trick with a bash script?


Execute MySQL commands directly instead of entering console first

**PostgreSQL** In PostgreSQL it is possible to execute commands without entering the `postgres=#` console by executing `sudo -u postgres psql -c "\l"` instead of entering the console first and executing `\l`. By doing this psql commands can be directly executed in one step instead of two steps. **MySQL** In MySQL, `sudo -u root mysql -c ""` is not accepted as in PSQL. So the console has to be entered first by executing `sudo mysql -u root` before further commands can be issued. **Question** Is it possible to execute MySQL commands directly (one step) instead of entering the console first and issuing commands (two steps) like in PostgreSQL?


Detecting cron tasks run by another user

I am currently working through the Nebula challenges on exploit-exercises.com, and one of the challenges relies on a script being run by cron. This is run by another user (flag03) and the user I am logged in as (level03) doesn't have privileges to run "crontab -u flag03" to view the job. The hint clearly indicates the script is run by cron. Additionally, it is the only script in the /home/flag03 directory, so we would likely investigate further. However, if this was the real world, I wouldn't know that this script was being run by cron. Therefore the question is, how would I detect that the task was being run from the perspective of an unprivileged user? I have tried the following:               while true; do ps au | grep <scriptname> | grep -v grep; done;      This allows me to see processes that run for a significant length of time, but not ones that exit almost immediately. It also presumes I know the name of the script. The specific environment is Ubuntu. I can't use apt-get, but I have access to gcc. Any ideas?


Library version, API version and soname how should it be done?

When I've a library called `libfoo` and its version is `0.4.2` where `0.4` is the API version and `2` the release number which may add new API functions. Should the soname be `libfoo.so.0.4`, `libfoo.so.0.4.2` or something else?


CentOS replace config error

I'm currently working on updating our CentOS server, however whenever I'm trying to use yum I get this error.               Config Error: Plugin "replace" requires API 2.6. Supported API is 2.5.      I'm new to CentOS and have previously only worked with Debian/Ubuntu servers and I can't seem to get rid of this error; Google also doesn't help much, hence I'm using this as a last resort before bothering my server company.


How to output the lines of a file after find and a grep?

Hello I want to output ERROR messages from logfiles from the current date. First I search for the logs of today with specific prefix:               find /home/USER/logfilesError/ -maxdepth 1 -type f -name "xy_*" -daystart -mtime -1      It gives me that output:               /home/USER/logfilesError/xy_2071.log     /home/USER/logfilesError/xy_2072.log     /home/USER/logfilesError/xy_2073.log      In these files I want to search for the string "ERROR":               grep -rl "ERROR" /home/USER/logfilesError/      This gives me all the Logfiles containing "ERROR" not only from today. Output(only some of the output):               /home/USER/logfilesError/xy_55.log     /home/USER/logfilesError/xy_1015.log      Question: How can I combine those in a script? The Syntax from a line in the logfiles are:               2013-11-24 06:30:30,549 [main] ERROR *(+Errormessage)*


Is it possible to install bottom launcher on Debian 7

I want to install Debian 7 on a laptop and have tried to read some information about this platform. On this review, Review Debian Squeeze 6.0.5 : The Father of Linux Distro , I saw the last slide with the bottom application launcher: ![debian 6](http://i.stack.imgur.com/31cXC.png) I wondering how do I configure it in Debian 7.


How can I automatically include all firmware needed by selected Linux kernel modules

I have certain modules which I need compiled into the kernel. Some of these modules require firmware, which used to be automatically included from `/usr/src/linux/firmware/`. However, no new firmware will be added to this directory, and kernel modules are gradually switching to firmware from `/lib/firmware` instead. Each time this happens, it appears I need to add the firmware name to `CONFIG_EXTRA_FIRMWARE` in Kconfig. Is there some way I can automatically collect the list of firmware blobs needed by my compiled-in modules and have them built into the kernel like the `CONFIG_EXTRA_FIRMWARE` option? To clarify: I could make a list of all drivers I'm building into the kernel, search their source code for references to firmware blobs, and then set `CONFIG_EXTRA_FIRMWARE` to this list of files. But this process would be time consuming and error prone. I want it to happen automatically and reliably.


Absolutely jail a user with minimum IP, file, & command rights

I am trying to secure a custom application as much as possible from outside tampering. I've seen many pages on jailing a user, but they usually include many exceptions, and I want to lock down this user as much as possible. The user only needs to execute an application that is a websocket++ client & server that needs the ability to:   * Accept incoming connections port forwarded from 443 to another port, for example 8000   * Seek outgoing connections   * Communicate with a local PostgreSQL server   * Read from & write to a few specific files in the directory where the application is executed   * Get output from `ntpd -c 'rv'`   * Accept keyboard input How can my intent be implemented?


Process status on AIX

I want to get process status on AIX like we get it on Linux from `/proc/<PID>/stat`, I did not find the status in `/proc/<PID>/status` file. There was some encrypted text there. Which file should I access on AIX to get status of a particular process?


Linux VT Emacs in tmux, breaks color and cursor

`TERM` is set to screen. I tried with `screen-256color`, but then the colors went **really** nuts. I also tried `xterm`, `linux`, and some others (that I could think of, not really thinking) but `screen` is the closest I got - albeit not quite - to "pure" tty Emacs colors. As you see below, the **colors** work (top window), only for some reason they show up incorrect as cyan, in the case of Emacs-w3m. Also, probably related, the block, solid-color cursor that I had, got replaced by an underscore. I prefer the color-shifting block cursor - not the least because it is much easier to spot after a search. (Note: the cursor problem does not show below as I used the shell command to get the screenshots.) ![in_tmux](http://user.it.uu.se/~embe8573/emacs_tmux_colors/emacs_in_tmux.png) ![not_in_tmux](http://user.it.uu.se/~embe8573/emacs_tmux_colors/not_in_tmux.png)


non-smooth fonts in Fedora's gnome

![screenshot](http://i.stack.imgur.com/7U1oH.png) I don't know is that only my problem or not but I have a little eyestrain when using Fedora (19) with Gnome 3(.8) compared to Ubuntu, Linux mint or Windows. Maybe the problem is caused by font rendering or anti aliasing or even the fonts themselves. I think the fonts are sharp. I cannot explain that but I believe that it's different from Ubuntu.


Force dd not to cache or not to read from cache

I'm working on an embedded system with the busybox version of dd. I'm trying to test an erase to the drive from some outside utility, however dd does not read from the disc again after the erase, but shows me the cached data. I've narrowed it down to dd as when I do an initial dd, see the data, restart my system to flush the cache, did the erase, and then ran dd again it came up with all zeros. However, if I do dd on factory settings, erase the drive, and do dd again without restarting it won't show me all zeros until a restart. I've read in the GNU manpage that dd supports the iflag opt, with a nocache flag, but busybox does not support that option so that's out of the question. My question is how can I force dd to read from the disk again rather than from cache?


Bash inside Vim not working properly

In MacVim I'm using Conque to run bash commands inside Vim. I have a problem with the text navigation while using Conque. If I'm at the end of a line of text and press down `Alt``←` I skip a word to the left, if I then press `←` the cursor moves back to after the word I skipped. How do I solve this? Here you can see that I first move a few characters using `←` and then `Alt``←` to move to the start of the word. Then when I press `←` I get back to where I were. ![enter image description here](http://i.stack.imgur.com/5jOfm.gif)


xinetd apache2-proxy service unavailable

I'm using the filesharing service `F*EX` F*EX . If I run the service without a `proxy` I can reach it and it works. The service is controlled by `xinetd`. Now a `apache2` is configured to run as proxy and a redirection to `port 443`, but the service is unreachable. I got neither error messages from xinetd nor from apache2. The output of `netstat -tulpnq` :               tcp  0  0 127.0.0.1:9988    0.0.0.0:*    LISTEN      15302/xinetd      Apache2 config file http:               <VirtualHost *:80>         ServerName fex.myserver.de         Redirect / https://fex.myserver.de     </VirtualHost>      Apache2 config file http:               <IfModule mod_ssl.c>     <VirtualHost *:443>          ServerName fex.myserver.de     ProxyPass / http://127.0.0.1:9988/     ProxyPreserveHost On              DocumentRoot /home/fex         <Directory />                 Options FollowSymLinks                 AllowOverride None         </Directory>         <Directory /home/fex/htdocs/>                 Options Indexes FollowSymLinks MultiViews                 AllowOverride None                 Order allow,deny                 allow from all         </Directory>              ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/         <Directory "/usr/lib/cgi-bin">                 AllowOverride None                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch                 Order allow,deny                 Allow from all         </Directory>              *SSL OPTIONS GO HERE*         ErrorLog ${APACHE_LOG_DIR}/error.log          </VirtualHost>     </IfModule>      `xinetd.d/fex :`               # default: on     # description: F*EX web server     #     service fex     {         socket_type             = stream         log_type                = FILE /var/log/xinetd         log_on_success          = PID HOST EXIT DURATION         log_on_failure          = PID HOST EXIT DURATION         wait                    = no         type                    = unlisted         protocol                = tcp         bind                    = 127.0.0.1         port                    = 9988         cps                     = 10 2         user                    = fex         groups                  = yes         server                  = /home/fex/bin/fexsrv         nice                    = 0         disable                 = no     }


Can a file be corrupted by copying from NFS to CIFS?

I have Linux RedHat 6.x, and I mounted a Windows 2008 R2 NFS share. If I copy data from my Linux machine to Windows, that doesn't seem like any harm. But if I take that file that is in my exported NFS share (the share on Windows), and I copy it to another Windows machine that is not using NFS, can that file be corrupted just because they are different file systems? Example: I needed space on my Linux machine for a backup, I backup to the mounted drive, which is the NFS share on the Windows server, I will then take the copied over files which are now on my Windows machine and copy them to another Windows server, just regular CIFS and NTFS, right-click copy paste, From there I have backup software to put it on tape, I cannot at this time have the Linux machine to directly to the machine with the tape drive. Of course, I need to be able to restore those files, but if moving them between file systems somehow corrupts them.


Determining RHEL Type (Workstation vs Server)

How do I tell whether or not I have Red Hat Server or Workstation? I know my redhat release info is in /etc/redhat-release. `Red Hat Enterprise Linux Client release 5.9 (Tikanga)` I need to order an updated subscription, but do not know whether to ask for Workstation 5.


Zend installation on Fedora 19

I am trying to install Zend Server on Fedora 19. Once I run `yum install zend- server-ce-php-5.3` I get following error:               Transaction check error:       file /usr/local/zend/var/log conflicts between attempted installs of zend-server-php-5.3-common-6.3.0-19.x86_64 and mod-php-5.3-apache2-zend-server-5.3.28-1.x86_64      How can I fix the problem? I am following the instructions on the official zend installation documentation.


tmux session stops updating screen randomly

I use tmux 1.6-2 on a Debian 7.6 (wheezy). I open a new session and start a long running script that gives updates in form of a progress bar and an activity indicator (spinning bar: /-\|/ ). When I detach and reattach everything is still fine. But after some random time when I reattach the screen content is stuck. No spinning bar, no progress. I looked into the following:   * I can see in top that the process is still running   * I can successfully enter tmux commands (like new window, detach, etc.)   * I can kill the script with Ctrl-C, but the tmux screen doesn't change   * Ctrl-S and Ctrl-Q (like suggested in other threads) doesn't help Any help is very much appreciated.


Storage Formats for Flat File DB

Currently I use a flat file database with               find -type f -ls      to store information for about 400GB of files. I'd like to store also the md5sum/sha[1|256]sum of the files. Because the files are often changing, I'd like also to store snapshots of the files and their hashes. I'm looking for a solution to get only the hashes of a diff from a new snapshot and have the ability to quick view the changes. Any hints?


Port Routing/DNS for individual program

## Background Flickr has closed its http api leaving an https only api. My favourite uploader (the official Flickr Uploadr version 2.5 running under wine) is no longer maintained, so this change broke it. My current solution to this is to set up a reverse proxy server to translate `http://www.flickr.com` to `https://www.flickr.com` and fix my DNS so that `www.flickr.com` traffic gets forwarded to this proxy server. This works but obviously I don't want all my flickr traffic going to the proxy, just the traffic coming from the uploader. ## Question Can I send just traffic from this app, directed to www.flickr.com, to my reverse proxy? ## Supplementary Question Is there a simpler way to achieve this? eg, forward `http://www.flickr.com` straight to `https://www.flickr.com` without the proxy server. ## Solution Embarrassingly the app itself has a proxy setting, so all I had to do was set this to point at my proxy server. Alternatively Giles's answer below shows how you can set a proxy for an individual Unix app and all Wine apps.


How to 'simulate' a Fn key

I want to 'simulate' a Fn key of an ASUS laptop running Ubuntu when using a normal external keyboard. How can I do this?


BASH return to main function

I have a BASH script that calls a function, which calls other functions:               #!/bin/bash     function foo     {         function bar         {             # do something         }         bar     }     foo      How can I return from `bar` directly to the main function? The case is that `bar` handles user input and if it receives a negative answer, it must return to the main function, otherwise it has to return to `foo`. Returning to `foo` is not a problem with a simple `return` statement. For the other, I tried this (which actually works):               #!/bin/bash     function foo     {         function bar         {             if [negative] # abstract statement             then return 1             else return 0             fi         }         ! bar && return     }     foo      But since I have functions like `foo` spread across the whole project (`bar` is defined in a header file), is there a way that only requires modification to `bar`? The project is ~2k lines long and consists of several files, it would be much easier that way if there's a solution.


I am seeing this message in `dmesg`:               btrfs: mismatching generation and generation_v2 found in root item      I found a related question here: Understanding btrfs dmesg However, unlike that question, I am not seeing any `parent transid verify failed` messages. Should I be concerned about the message I am seeing?


GUI for mount_afp?

I have installed `mount_afp`, so I can access my iMac via `AFP` on my PowerBook G4 running Debian XFCE. It works in Terminal (screenshot), but is there a GUI for it - like File Manager?


Copying protected files between servers in one line?

I'd like to copy `squid.conf` from one server to another.   * The servers don't talk to each other. I'd like to go through my workstation.   * Both servers have the file, so it will be overwritten on the target.   * The files have `600` permission and are owned by root.   * root login via ssh is disabled (`PermitRootLogin no`).   * I'd like to do it in one line, if possible, since it will be a part of a setup guide. I know to do               ssh source 'tar czpf - -C /etc/squid/ squid.conf' | \         ssh target 'tar xzpf - -C /etc/squid/'      to copy files between servers and preserve permissions. However, in this case I will get "Permission denied". I also know I can do this:               ssh -t source 'sudo cat /etc/squid/squid.conf'      This way the `-t` allows sudo to ask for the admin password before outputing the content of the file. The problem is, I don't know how to combine those techniques into something that will ask for the sudo password on each server, and transfer the file to its destination. Is this possible? **UPDATE** : Here's the best I could come up with:               ssh -t source 'sudo tar czf /tmp/squid.tgz -C /etc/squid squid.conf' && \     ssh source 'cat /tmp/squid.tgz' | \         ssh target 'cat >/tmp/squid.tgz' && \     ssh -t source 'sudo rm /tmp/squid.tgz' && \     ssh -t target \         'sudo tar xzf /tmp/squid.tgz -C /etc/squid && sudo rm /tmp/squid.tgz'      Calling this a one-liner seems like a stretch. I think I'll just break it down to separate steps in the setup guide.


If I see a process running using ps, how can I find the executable?

If I can see a process running using `ps -e`, how can I find the file which launched it?


Wine and parallel processing

I'm quite new to linux, right now, running LMDE on my machine. I was wondering if wine can support the parallel processing needs of some software. Anyone knows any performance benchmark of wine ? thanks !


How to merge two files in corresponding row?

Now,I have two files: `aaaa.txt`:               a=0;          b=1;          c=2;      `bbbb.txt`:               d=3          e=4          f=5      I want to merge `aaaa.txt` and `bbbb.txt` to `cccc.txt`. `cccc.txt` as follow:               a=0;d=3          b=1;e=4          c=2;f=5      So, what can I do for this?


dhclient for normal (non-root) users

Calling dhclient as root works beautifully on my debian machine. However, I would like to allow some users to execute dhclient, too. So far, I have tried these two examples: Example 1: When a normal user calls               user@box:~$ dhclient      ..., the result is:               bash: dhclient: command not found      Example 2: I have also tried               user@box:~$ /sbin/dhclient      ..., and got               [...]          can't create /var/lib/dhcp3/dhclient.leases: Permission denied     SIOCSIFADDR: Permission denied     SIOCSIFFLAGS: Permission denied     SIOCSIFFLAGS: Permission denied     Open a socket for LPF: Operation not permitted      Now... I have the feeling it is neither a good a idea (or would work) to chmod the entire /sbin directory for user access, nor does it appear to be elegant to chmod everything dhclient complains about in the second example above. What is the best and safest way to attack this issue?


Installing driver on Debian Squeeze laptop

I'm trying to activate the wireless chipset on my Debian Squeeze laptop by following this tutorial. I detected the type of wireless chipset I have built in my laptop using `lspci` and now I am trying to install this driver by following the instructions on the page. I installed the `firmware-brcm80211` package using `apt-get` (after adding a non-free repo). Once installed, the next step according to the tutorial is to do this:                # modprobe -r brcm80211 ; modprobe brcm80211      And here's the error I get:               rahmu:~$ sudo modprobe -r brcm80211      FATAL: Module brcm80211 not found.      I tried to look for the existing modules and here's what I got:               rahmu:~$ modprobe -l | grep brcm     kernel/drivers/staging/brcm80211/brcmsmac/brcmsmac.ko      For what it's worth, I haven't rebooted after `apt-get`ting the firmware. Would it make a difference?


What do the "apachectl fullstatus" columns mean?

The columns are:   * Srv   * PID   * Acc   * M   * CPU   * SS   * Req   * Conn   * Child    * Slot   * Client   * VHost   * Request


Vim freezes for a short time

When I work in vim, it happens (often) that it freezes for a second or two... after that it comes back to a normal life, executing all what I have typed when it was frozen I saw this behavior on two different machines with Ubuntu, one after a fresh installation. No additional plugins nor fancy configuration. Any idea?


Rename a lot of files with all types of characters, with POSIX portability

Sometimes I need to rename all the files (the renaming convention follows later) in a directory where the filename is always in the form of 'filenamename.extension' (extension always exists and varies). The name may contain whitespaces and characters from the [:graph:] class. My first problem is that it should be absolutely portable between *NIX systems (especially Linux, BSD, later other systems, say AIX). My second problem is with the [:graph:] class. Filenames could be:               cat.txt     dog_and_cat.txt     Where is the cat?.png     my.cat.is.cute.txt.js.html     ;;; ;;; ;;;.......321     áéúő _[a lot of whitespaces]_ óü^^^^^ö.jpg      Easy to see, those are difficult to handle and put into a for loop. For example, the               for i in *; do something; done      doesn't always like whitespaces and the weird characters, especially in different operating systems. The renaming convention is to rename all files to the `$FOOBAR.$EXTENSION` form where `$FOOBAR` is some kind of hash, for example md5sum. So in the for loop I have got a line which is like               mv $FILE $(md5sum $FILE | sed 's/\ \ .\+//');      It will move the file to the md5sum of itself, but the extension is disappeared. I want to preserve the extensions, which are almost always in the `.[a-zA-Z0-9]{1,3}` form. Occasionally there are extensions like `.tar.gz` which are also needed to be preserved (certainly I could add them into a variable, say `MYEXTENSIONS='tar.gz tar.bz2 foo.bar'`). My intuition tells me that the problem is solvable with well-parametrized default UNIX/shell commands, but it is extremely difficult for me now. I'm sure I'll learn a lot from the answers. I know I said the magical word **portability** , but the solution is preferred in bash, if I must specify the language.


Show message when cd into specific directory

How can I display a message when I `cd` into a specific directory? This directory is a local one, and I just need a reminder when I go into it from the terminal.


Linux, fat32 and etc/fstab

I mounted a FAT32 drive onto my Linux computer using the following terminal command:               > sudo mount /dev/sdb1 /media/exampleFolderName -o dmask=000, fmask=111      I did this so I could share / edit the files over a network connection. Unfortunately Linux doesn't support per file permissions in FAT32 format, so this sets the entire drive in the right permissions whilst it's connected. If I understand mount correctly, I'll have to do this every time I plug the drive in, which I don't want to do. I've heard about:               /etc/fstab      So my question - how do I turn the above mount command into an fstab entry? If anyone could also explain what **dmask** and **fmask** mean, that would be appreciated.


How to make a scheduled task based on a file creation time?

The supercomputer I run my Analysis uses SGE to do the job management and requires each job duration not longer than 24 hours. And this feature is causing me quite a headache. Sadly, I was asked to use checkpoint mechanism to output results and resubmit the script `qsub myJobScript`. On program's part, it's not difficult for me to have it output a temporary file when the clock time hits 23:30:00 (I give the IO operation half of hour), let's say the output file name is called `1.00137/U` and `1.00137/p`, etc.   _Note: when you submit a job, you never know when it is going to start. but it does have a log file under my folder when it is started._ So my question is how to use `crontab` or `at` or bash scripts to submit my job automatically when "new files" are created and detected? Any ideas?


Is there a way to download pure Unix?

I'm just asking out of curiosity, is there a way to obtain a 'pure' so to say copy of Unix? So, not OS X or Linux with Unix in the background, but simply Unix..   Like I said, this is simply out of curiosity; also, I'm not to familiar with the world of Unix yet, so this may be a dumb question. I'm honestly not sure..


Find scsi device ids under Linux?

How can I list scsi device ids under Linux?


Why is PECL installing a beta package?

I'm running Ubuntu 12.04. If I type               # pecl install apc      it tries to install 3.1.13 which is beta rather than 3.1.9.               $ pear config-get preferred_state     stable      Looking inside the two archives there's package.xml that has the following: 3.1.9:               <version>      <release>3.1.9</release>      <api>3.1.0</api>     </version>     <stability>      <release>stable</release>      <api>stable</api>     </stability>      3.1.13:               <version>      <release>3.1.13</release>      <api>3.1.0</api>     </version>     <stability>      <release>beta</release>      <api>stable</api>     </stability>      I'm inferring from this that 3.1.13 is genuinely considered beta, but I don't know about PECL package internals. Any idea how I can have PECL install just the latest stable package?


what does `adduser --disabled-login` do?

An install document I'm following instructs to add a user like so:               sudo adduser --disabled-login --gecos 'GitLab' git      The `\--disabled-login` flag is absent from most man pages I have searched. I've made two users, one with the `\--disabled-login` (`foo`), and one without (`git`). As far as I can tell the `\--disabled-login` flag does nothing. I can still `su` to both users, and both use `/bin/bash` as their login shell. The only difference I can see is `getent passwd` has extra commas before the home folder on the user that has login's disabled. There is no documentation that I can find to indicate what this would mean.               root@gitlab:~# getent passwd git     git:x:998:998:GitLab:/home/git:/bin/bash            root@gitlab:~# getent passwd foo     foo:x:1001:1002:GitLab,,,:/home/foo:/bin/bash      ### UPDATE #1 I've found another difference, one user has a `*` as their password, the other has `!`:               root@gitlab:~# getent shadow git     git:*:15998::::::     root@gitlab:~# getent shadow foo     foo:!:15998:0:99999:7:::      What exactly does `\--disabled-login` do on Ubuntu?


I just compile the kernel 3.10.19 from kernel.org Support for bnx2 is enable. On my server when I try to start the eth0 interface I got the following error : bnx2: Can't load firmware file "bnx2/bnx2-mips-09-6.2.1b.fw" In /lib/firmware/bnx2 I have the following files :               bnx2-mips-06-6.2.1.fw        bnx2-rv2p-09-6.0.17.fw     bnx2-mips-09-6.2.1a.fw     bnx2-rv2p-06-6.0.15.fw           bnx2-rv2p-09ax-6.0.17.fw      The file bnx2-mips-09-6.2.1b.fw is missing. If I do :               cp bnx2-mips-09-6.2.1a.fw bnx2-mips-09-6.2.1b.fw      it is working but this is not a clean solution. I have been reading the following post : https://lkml.org/lkml/2012/4/18/142 But I am not sur to understand. What is the best way to solve the problem ?


Basic job control: stop a job, add a job onto the stack, and `fg`

Job control is probably my favorite thing about Linux. I find myself, often, starting a computationally demanding process that basically renders a computer unusable for up to days at a time, and being thankful that there is always `CTRL-Z` and `fg`, in case I need to use that particular computer during that particular time period. Sometimes, however, I want to insert a job onto the job stack. I've never figured out how to do that. I'm using `bash`. It would probably look something like:               $ ./reallybigjob     ^Z     [1]+  Stopped                 reallybigjob     $ (stuff I dunno) && ./otherbigjob     $ fg


python regex equivalent of kwrite [ ]+ and [0-9]+

I've never been good at regular expressions. When ever I read about them, I sort of get a headache, get up from my desk, and forget what I'm doing. Attention difficulties. But when I finally started making use of them in `kwrite`, I got a lot more comfortable with them. To the extent that, I can not now live without them. Now, I need to sort of translate my knowledge of `kwrite` to python. The kwrite regex `[ ]+` matches a single space, two spaces, and a quadzillion spaces. How do I match spaces like that in a python regular expression? Also, the kwrite regex `[0-9]+` matches 0, 10, 123, and 103984875749409202. How do I match those in a python regular expression?


What is Bash's string{ending1,ending2} construct called and what is the equivalent in zsh?

I've been trying to switch to zsh. Something I've missed so far is this:               #!/bin/bash     mv /very/long/path/to/file1.conf{,.old}     #bash expandes that to:     mv /very/long/path/to/file1.conf /very/long/path/to/file1.conf.old      What is that called, and is there a zsh equivalent?


Differences between VNC and ssh -X

Why would you use VNC (or for that matter NX) instead of just using `ssh -X (-Y)`. I read that VNC uses less bandwidth, but is there any other differences/advantages with respective tool?


zsh - fully expand binary path on <tab>

In my current zsh behaviour, hitting tab after typing "sudo" just adds a space.               $ sudo ...      What I really want is for the tab to fully expand to the path of the binary it is about to execute when I hit tab, allowing me to see what will be run:               $ /usr/bin/sudo ...      The aim is to protect against the case where the local user on my machine is hacked, an entry added to my `$PATH` variable, and 'sudo' runs a malicious program, which would be an easy escalation to root.


Ubuntu 12.04 / Elementary OS - Shutdown Problem / Logfiles

I have new Desktop PC on which I've installed Elementary OS, based on Ubuntu 12.04 LTS. The problem: the system doesn't shut down as expected: When using the 'Shut Down' option from the main menu, or typing $ sudo shutdown -P now in a terminal window, the screen turns black immediately, but the PC doesn't power off. _*_ I know, this was asked before, but none of the tips work for me. I've tested all(?) the grub options, found here and in other sites but to no avail. This happens every time, no matter if additional user programs are running, or the shutdown attempt was made immediately after startup. Basic system info:   * Intel Processor: Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz   * no extra graphics adapter, using the built in   * SSD drive: Crucial M500 120GB (the boot drive)   * a 2 GB Toshiba FDD is present, but not yet formatted.   * Fritz USB WLAN stick - using ndiswrapper Trying to pinpoint the root cause, I was looking in the /var/log directory for any helpfull log entry, but there is nothing in it: /var/log/syslog:               Mar  6 17:45:55 ludmilla kernel: Kernel logging (proc) stopped.     Mar  6 17:45:55 ludmilla rsyslogd: [originMar  6 17:48:23 ludmilla kernel: imklog 5.8.6, log source = /proc/kmsg started.      that's it manually switched off, then - after a some minutes I started it again; these are the first lines after startup:               Mar  6 17:48:23 ludmilla rsyslogd: [origin software="rsyslogd" swVersion="5.8.6" x-pid="644" x-info="http://www.rsyslog.com"] start     Mar  6 17:48:23 ludmilla rsyslogd: rsyslogd's groupid changed to 103     Mar  6 17:48:23 ludmilla rsyslogd: rsyslogd's userid changed to 101     Mar  6 17:48:23 ludmilla rsyslogd-2039: Could not open output pipe '/dev/xconsole' [try http://www.rsyslog.com/e/2039 ]      same in /var/log/kern.log:               Mar  6 17:45:55 ludmilla kernel: Kernel logging (proc) stopped.          ...          Mar  6 17:48:23 ludmilla kernel: imklog 5.8.6, log source = /proc/kmsg started.     Mar  6 17:48:23 ludmilla kernel: [    0.000000] Initializing cgroup subsys cpuset     Mar  6 17:48:23 ludmilla kernel: [    0.000000] Initializing cgroup subsys cpu      The only reliable way to power it off without using the hardware button is to issue:               # poweroff -fp      But I doubt that this is good practice. (this is bypassing the shutdown procedure) My questions are:   1. does anyone has a solution for this problem?   2. Or any more tips what the cause might be?   3. Any information if there are more logs in which I may find the root cause?   4. Is there a "shutdown debug mode" for generating the missing information? - to see every step while the shutdown is executed?   5. poweroff -fp: can this do any harm to the system?


Sort data on multiple columns

INPUT (unsorted, bad)               "XYZ-ZTE-43255 serverB618 agreed","XYZ-ZTE-44432"     ,"XYZ-ZTE-43255"     "XYZ-ZTE-52775 serverB110 agreed",     "XYZ-ZTE-79213 - serverB688 agreed",     "XYZ-ZTE-77323 serverB617 agreed",     "XYZ-ZTE-81422 - serverB609 agreed","XYZ-ZTE-77323"     "XYZ-ZTE-32785 - serverA626 agreed","XYZ-ZTE-52775"     "XYZ-ZTE-43235 - serverA605 disagreed (asdfjlasdj yxvv il lkyeas sadfa)","XYZ-ZTE-43235"     "XYZ-ZTE-11591 serverB144 agreed",     ,"XYZ-ZTE-11591"      OUTPUT (sorted, the needed thing, the good one!)               "XYZ-ZTE-43255 serverB618 agreed","XYZ-ZTE-43255"     ,"XYZ-ZTE-44432"     "XYZ-ZTE-52775 serverB110 agreed","XYZ-ZTE-52775"     "XYZ-ZTE-79213 - serverB688 agreed",     "XYZ-ZTE-77323 serverB617 agreed","XYZ-ZTE-77323"     "XYZ-ZTE-81422 - serverB609 agreed",     "XYZ-ZTE-32785 - serverA626 agreed",     "XYZ-ZTE-43235 - serverA605 disagreed (asdfjlasdj yxvv il lkyeas sadfa)","XYZ-ZTE-43235"     "XYZ-ZTE-11591 serverB144 agreed","XYZ-ZTE-11591"      So in short: this is a snippet from an XLS with two columns. The two columns must be sorted together in a way that e.g.: XYZ-ZTE-77323 in the left column matches the XYZ-ZTE-77323 on the right column But there are things like:               ,"XYZ-ZTE-43255"      which have to go with the line:               "XYZ-ZTE-43255 serverB618 agreed","XYZ-ZTE-43255"      but the line (in the INPUT) already contains a right column:               "XYZ-ZTE-43255 serverB618 agreed","XYZ-ZTE-44432"      and e.g. if:               "XYZ-ZTE-44432"      doesn't exists in the left column, then it must be in a new row in the OUTPUT Does anybody has an idea how to do this?


SysBench highlighting abysmal disk write performance on white box vs Tier1 server

Have been testing white box system with SuperMicro X8DTL motherboard with various SATA hard disks such as 7,200RPM Seagate Constellation ES and 10,000 RPM Western Digital VelociRaptor. Have tested Fedora 15, Fedora 16, Ubuntu 11, running SysBench with the command found here MySQL High Performance blog Disk write results are abysmal - typically results such as:               Operations performed:  0 Read, 3635 Write, 3635 Other = 7270 Total         Read 0b  Written 14.199Mb  Total transferred 14.199Mb  (145.39Kb/sec)         36.35 Requests/sec executed      On the other hand, a tier1 server with exactly the same CPU and 7,200RPM SATA hard disks running Fedora 15 produces these test results:               Operations performed: 0 Read, 151453 Write, 151453 Other = 302906 Total         Read 0b  Written 591.61Mb  Total transferred 591.61Mb  (5.9159Mb/sec)         1514.48 Requests/sec executed      I cannot understand how there can be such a massive difference and that the SuperMicro based system is producing such awful disk write performance. I have tested various things including tweaks to fstab, scheduling, disabling disk standby and using sar, iostat, vmstat and so on to look for potential problems. But `%idle`, `%iowait` and so on don't show anything unusual. Also `vm.zone_reclaim_mode` as indicated here Poor disk performance although default setting on Fedora is already 0. I tried different BIOS settings for the hard disk including IDE and AHCI. Would expect that AHCI should be the best, but write performance difference between IDE and AHCI options is negligible. Anyone have ideas?


control keyboard input on GUI over SSH

i am searching for a solution how to echo a keydown over SSH to a running GUI (based on debian). like VNC or Teamviewer but only command line based.


Copying specific text from one file into a schema

I have two files. One being a schema, and the other a list of data. The schema looks like:               line_name:     shot_edit:     channel edit:     cable_edit      and repeats regularly for the number of lines that I have. The other file is a list of line names and goes:               name1     name2     name3      I'd like to copy all the line names into just after the line_name field, but I'm really not all that good with awk. Could anyone give me some pointers?


Problems using ecpsf in Snoopy with IRAF

I'm trying to fit a psf to some stars in an image using ecpsf in Snoopy. When I read in the image I get the following error:               snoopy> ecpsf filename     ERROR: Cannot open image (filename)       "imget(nome0,"exptime")"          line 37: snoopydir$proc/ecpsf.cl          called as: `ecpsf (nome=filename)'      Anyone know what could be wrong here? [Scientific Linux 6, IRAF 2.16.1, DS9 v7.3b5,]


Hard disk spins down and up too frequently when on battery

I'm using Debian Wheezy               No LSB modules are available.     Distributor ID: Debian     Description:    Debian GNU/Linux 7.3 (wheezy)     Release:    7.3     Codename:   wheezy               $ uname -a     Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux      on Lenovo G580 with Seagate 1TB Hard Disk. The problem I'm facing is that the hard disk spins down and up too frequently when on battery. I tried using `hdparm` and used the following commands, but that didn't help me. Also installed `laptop-mode` and edited `laptop-mode-conf` to               LM_AC_HD_IDLE_TIMEOUT_SECONDS=2000     LM_BATT_HD_IDLE_TIMEOUT_SECONDS=2000     NOLM_HD_IDLE_TIMEOUT_SECONDS=7200      after reading similar posts, but that too didn't work, and so, I uninstalled it. Can someone help me out with this?


What is the most accurate way to measure disk read/write speed for an OpenVZ VPS host from within the host itself?

CentOS 6.x | OpenVZ I have an openvz VPS host and would like to measure disk read/write speed. Historically, on other physical systems, I've ran `hdparm` to collect this information. I haven't been able to get hdparm to work on my openvz host (presumably because of the simfs file system -- maybe something else though). I've tried the quick-and-dirty method of `dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync` and while that works, I'm not quite confident that its accurate. Is there a better way to collect this information?


Setting up clearcase view through nautilus file manager

On my workplace, in order to access certain folder on the server, say `/x/y`, I need to set up a clearcase view using the `cleartool` command. (I don't have much idea about `clearcase` or `cleartool`). Only then can I browse through its files/directories. All this can be done using the command line. I was wondering if I could do the same through a graphical file manager, like nautilus: it would make my job easier. However, if I set up a view and then invoke nautilus from the commandline, it cannot browse through `/x/y` directory. Nautilus says that it could not find `/x/y`. How can this be done?


Difference between ifconfig and ipconfig? What actually does dhcpcd and ifconfig does?


What's the difference between $(stuff) and `stuff`?

There are two syntaxes for command substitution: with dollar-parentheses and with backticks. Running `top -p $(pidof init)` and `top -p `pidof init`` gives the same output. Are these two ways of doing the same thing, or are there differences?


What's the difference between `` and $()?

When you want to return a command line output, you may consider using two methods: ``cat file`` or `$(cat file)`. As far as I know, they are equivalent before my eyes. Is there a difference between both? If so, what's the difference please?


Command substitution declaration syntax in bash - which of these two is better practice?

This is part of a bash `find` loop, and I wondered which is more correct syntax and why?               filename="$(echo "$i" | cut -c5-)";     filename=`echo "$i" | cut -c5-`;      Both function for the purpose of getting the file name.


Different behavior of $() and ``

% PATH="MYPATH"     % VAR="PATH"          % echo $(eval echo \$$VAR)     MYPATH          % echo `eval echo \$$VAR`     5707VAR      ^^     This is the process number.      I thought those two were exactly the same, but obviously there are some differences, like escaping behavior. What are the differences?


What's the difference of get command output using`command`and $(command) in Shell?

What is the difference in collect a command output in Shell script using `command` and $(command)? For example:               # IP1=$(ifconfig eth0 | grep -e "inet " | cut -d: -f2 | awk '{print $1}')     # IP2=`ifconfig eth0 | grep -e "inet " | cut -d: -f2 | awk '{print $1}'`     # echo $IP1 $IP2     > 192.241.145.112 192.241.145.112


How to install gimp 2.8 on Debian Squeeze?

Gimp 2.8 comes with a lot dependencies. How to install gimp 2.8 with dependencies on Debian Squeeze ?


Bash shell with problematic outcomes under Linux (C)

Following my previous post, I still have one annoying bug that won't leave . I wrote a simulator for the `bash` command under Linux. When I run my code in a single run, with the these commands:               ls Debug/ | grep r     ls >> file.jer & ls & ls & ls &     ls >> file.jer     ls > file1.rrr     ls & ls | grep e     ls & ls & ls &     ls Debug/ | grep r     ls Debug/ > k.out     ls Debug/ >> k.out     exit      then in the third line `ls >> file.jer` the program writes `ls: cannot access : No such file or directory` . When I run the program and every run I hit the inputs **separately** then the correct output is presented. I've tried to debug this so many times, but couldn't find the problem. **Specific problem** : when I run the code and hit `ls Debug/ | grep r` , the correct output is presented. Following that, when I hit `ls >> file.jer & ls & ls & ls &` , also here the code works great. But when I hit `ls >> file.jer` , then something very wrong is happening, and I can't seem to find its source , where again the output for the `3rd` command is **No such file or directory** , but clearly it's wrong, since when I run it in a single run, the file `file.jer` is appended with the contents of the current path. I have a `main`, and two `.h` files with their two `.c` files.


How can I create a bash script which runs irb, then some ruby code?

I'm trying to do this to make unit testing a breeze for myself. The contents of an example script in question are as follows:               irb     require 'random_utils.rb'     a = SuccessChecker.new      Right now this just opens irb. I'd like to be able to run arbitrary code afterward, so that I might make scripts to make my life easier by requiring files, instantiating classes, populating test conditions, etc.


Bash Script on Startup? (Linux)

Is there any way to make/run a bash script on reboot (like in Debian/Ubuntu for instance, since thats what my 2 boxes at home have) Also, any recommended guides for doing cron jobs? I'm completely new to them (but they will be of great use)


Run a command when system starts for any users

How can my system run a command every time that it is started? Is there any script that the system runs when it is starting? I'm using CentOS 6.2.


iwlwifi error, then WLAN is very slow and can't see other WLANs

I have a wireless interface Intel 1030 on a Dell XPS 15 laptop. `lspci` says:               03:00.0 Network controller: Intel Corporation Centrino Wireless-N 1030 [Rainbow Peak] (rev 34)      Recently I noticed that the error message `iwlwifi 0000:03:00.0: fail to flush all tx fifo queues` appears in dmesg, then my WLAN is very slow (to the point that names will fail to resolve 90% of the time). ~~and I can't connect to any network other than the one I'm currently connected to (both`iwlist wlan0 scan` and NetworkManager or wicd don't show any other networks)~~ (edit: this last problem was a false alarm) The only cure is disabling/enabling the wireless network. Here I find that it might be related to suspend, however it appears even after a fresh boot or when under heavy traffic (e.g. downloading a torrent). Forcing the card to use only 802.11g (`11n_disable=1` option when loading the module) helps somewhat. Any clues? It happens both in Ubuntu 12.10 (kernel 3.5), openSUSE 12.3 (kernel 3.7) and Arch Linux (kernel 3.7.10 or 3.8.2-ck).


Kiwi produces huge initramfs

I'm using Kiwi to build a boot CD based on OpenSUSE 13.1. I want the disk ISO image to be as tiny as possible. I managed to get the read-only filesystem down to only 100MB, but for reasons unknown, the `initrd` file is 80MB on its own. (!!)   1. Is there some way I can convince Kiwi to produce a smaller initrd?   2. Is there a way to take the initrd image that Kiwi has produced and shrink it somehow? PS. The `initrd` file is actually an initramfs image. But you probably knew that.. * * * Possibly relevant: If I unpack `initrd`, I get the following:               # du -d1 -h .     12K     ./root     4.0K    ./selinux     4.0K    ./tmp     20K     ./run     4.0K    ./mnt     304K    ./image     16K     ./boot     8.8M    ./etc     760K    ./var     4.0K    ./sys     4.0K    ./proc     8.0K    ./dev     1.1M    ./bin     97M     ./usr     4.0K    ./opt     1.7M    ./sbin     88M     ./lib     198M    .


Why do I have four CPUs listed in /proc/cpuinfo?

When I bought my Lenovo Thinkpad 520, it had Windows installed. I promptly cleaned that out and installed Fedora 16. I recently visited the `/proc/cpuinfo` and, much to my surprise, discovered that it has four CPUs listed (0-3). I do not remember asking for extra CPUs when I got it, believeing I was getting only a single processor. Could this be a mistake in the `cpuinfo` file?


How to prevent .jar files from going into /etc when installing OpenJDK from rpm?

After I found and installed OpenJDK in Fedora 20 using Apper I noticed there is a series of directories starting with `jar` prefix under `/etc/alternatives`, specifically:               /etc/alternatives/jre (93,4MB)     /etc/alternatives/jre_1.8.0 (93,4MB)     /etc/alternatives/jre_1.8.0_exports (1,3GB)     /etc/alternatives/jre_exports (1,3GB)     /etc/alternatives/jre_openjdk (93,4MB)     /etc/alternatives/jre_openjdk_exports (1,3GB)      with total size of **4,3GB** Can I direct Apper/yum/whatever to put these files in some other location as I keep my whole `/etc` directory in Dropbox and I do not want to have these gigantic jar files there.   Also, I do not think this type of files belong to `/etc` at all which makes me wonder why they were put there in the first place?


PC -> to -> Server. How to disable video card test inside BIOS?

I'm trying to setup my old PC as a server. Motherboard EliteGroup P4S5A/DX. Upto 2Gb of DDR 1 Ram. Video card: `vga1 at pci1 dev 0 function 0 "NVIDIA GeForce4 MX 440" rev 0xa3` About a 2-days I'm test my server with memtest. It fail test #1, called "Address test, own address". 5-10 minutes and monitor show me blizzard of red, green, black and white blinking scratches over blue screen. I thought this is old Ram bank (512mb), now I buy new 1GB DDR1 x 2. But memtest return me the same result. Now I'm think this is NVIDIA GeForce4 MX 440, cause it is too very old. The last things will be north and south bridges. I have my own custom build OpenBSD 5.4 LiveDvd. It is boot `To RAM` automatically and discovery the network with my second machine, I can get ssh access. Boot take a 3 minutes. When I disconnect video card from host, I can't see is it boot normally. But after 3-4 minutes there is no ping, no ssh access. What should I set in the BIOS, to boot properly without VideoCard? What distributive is a best way to test videocard-less host by network?


Kill a process if it goes quiet for a certain amount of time

I have a utility that has a nasty habit of going quiet and staying there, I already know how long into the process it does this so I am using `timeout` to fight this, but sometimes it does it before that time. Is there a tool similar to `timeout` that will kill the process if it stops directing output to stdout?


Access or recover files from Apple hdd with bad S.M.A.R.T. and 05-reallocating sector bad

I have a Macintosh HD (hfsPlus)               [/dev/sdc2 on /media/ubuntu/Macintosh HD type hfsplus(ro,nosuid,nodev,uhelper=udisks2)]     WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.           Disk /dev/sdc: 750.2 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x00000000          Device    Boot      Start         End      Blocks   Id  System     /dev/sdc1               1  1465149167   732574583+  ee  GPT Partition 1 does not start on physical sector boundary.      Diagnostic software tells me that the S.M.A.R.T. status is bad and also that the 05-reallocating sector count is bad. I'm trying to recover some data from it without having to spend $600 to ship it to a company that does the manual recover. I don't care about the disk, it's still under warranty. I tried to go to mac doctor but they couldn't get anything out (I think they just tried mounted it on a mac and runitf MacDrive.) I've tried with Windows 7 and I managed to mount the drive but some software was not seeing it and the only one who did it was too slow and kind of _crappy_. I'm trying now with Ubuntu in a bootable flashdrive but I cannot open the media because of input/output errors while reading the `.journal` file.               Error mounting /dev/sdc2 at /media/ubuntu/Macintosh HD: Command-line mount -t "hfsplus"     -o "uhelper=udisks2,nodev,nosuid" "/dev/sdc2" "/media/ubuntu/Macintosh HD"' exited with     on-zero exit status 32: mount: wrong fs type, bad option, bad superblock on     /dev/sdc2,missing codepage or helper program, or other error.In some cases useful info     is found in syslog - try dmesg | tail or so      I'd love it if someone could point me in the right direction; I have some fundamental knowledge on computers but I'm not a developer.


sudo testing for credentials

I have a working bash script, that may run from 0 to 8-9 minutes. It requires `sudo` if it finds a problem and needs to change permissions/ownership on a file. I do not want to wait for the `sudo` prompt, as this might be a few minutes into the run, so I do `sudo -v` at the beginning of the script. If I expect the script to take long, I often walk over to the cafeteria. So some time ago I included a trap handler, that calls a function, that does `sudo -k` to drop my credentials. This way pressing `Ctrl`+`C` does not leave someone with access to `sudo` while I am not back yet. I do also call that function at the end of the script, in case the script terminates before I am back. If I already did a `sudo` command before calling the script, `sudo -v`, it doesn't ask me for my credentials. That is nice.   Depending on where I start I know the script is not going to take long, and I wait for it to finish. If I started it after having just done a `sudo` command, **every time I end up without`sudo` credentials** after it finishes. I did check the return value of `sudo -v`. On exit 0, that doesn't tell me if the credentials were already there (from before running the script) or that the password was typed in correctly just before. That doesn't help me to know if I should run `sudo -k` at the end or not. I thought about making two versions of the script, one with and one without `sudo -v`/`sudo -k`, but I don't think that is a nice solution and I am bound to select the wrong version at times. Is there a better way to solve this? Am I missing something?


grep and command-line variable substitution

In the following command sequence,                $ grep -E '^.{11,22}John' emplist       Operations John Thompson  PARTHawks        Cher                 Sales      John Jacobs    FULLHawks        Davinder Singh       Finance    Dean Johnson   FULLVegans       Sandeep Jain         $ Name=John      $ grep -E '^.{11,22}$Name' emplist       $       I want the output of               grep -E '^.{11,22}$Name' emplist      to be the same as the output of               grep -E '^.{11,22}John' emplist


How do you increase the size of someone's mailbox quota in Linux?

In a Linux Bash shell, how do you modify (increase or decrease) another user's email quota? The best & most relevant information I could offer you about my environment, (in my opinion, of course) is this:               OS:             Linux 2.6.32-279.5.2.el6.x86_64 x86_64     Current user:   SomeUser@SomeDomain     System:         CentOS release 6.3 (Final)     KDE:            4.3.4 (KDE 4.3.4)      In most cases, our client's `username` & `password` are stored locally on a wiki that we update every time any requests/responses/requirements/needs/changes take place. With that being said, I can `su` into the user on the appropriate server if I need to have his/her permissions to modify anything. I don't have access to run commands as `root` and I don't even know if it is necessary to do so. How can I adjust another user's mailbox quota from Linux Bash shell?


what starts runsv on a Debian system using init and how?

A bit of background: I installed `git-daemon-run` on a Debian system, and now git-daemon starts at boot automatically, even though there is no init script for it in `/etc/init.d`. I did some digging and found out that this particular daemon is managed by `runsv` and the `sv` utility, an alternative to the `init` scheme. Yet I cannot find anywhere a script or a command that tells runsv to start at boot. How does `runsv` start? How can I disable it starting at boot, so that I can turn on and off the `git-daemon` service at will?


Installing ZeroMQ for PHP on Hostmonster

I'm working on the shared hosted solution from Hostmonster. I'm trying to get ZeroMQ installed so that it will work with Ratchet. I have configured and build ZeroMQ 4.0.4 locally, as well as libzmq. However as I do not have admin access I cannot run the sudo ldconfig step of the base ZeroMQ install and when running make install for php-zmq it too tries to install to locations I do not have access. Does anyone know how to install ZeroMQ for PHP locally for a shared hosted environment without sudo access?


How to disable the "medium" style for every font using the fonts.conf file?

I would like to disable the "medium" style for every font installed in my computer. I've searched the specific settings for the file fonts.conf but I couldn't find it. Any idea?.


Cant install gnutls.i686 on a x64 CentOS install

I need to install `gnutls.i686` on CentOS 7 but I get this error in yum:               Transaction check error:       file /usr/share/man/man5/pkcs11.conf.5.gz from install of p11-kit-0.18.7-4.el7.i686 conflicts with file from package p11-kit-0.18.7-4.el7.x86_64       file /usr/share/man/man8/p11-kit.8.gz from install of p11-kit-0.18.7-4.el7.i686 conflicts with file from package p11-kit-0.18.7-4.el7.x86_64      I dont know if this is a bug I should report to the CentOS team of if it's just another regular conflict. The only way I can think of fixing this is either deleting those files or having yum override the conflict and install it anyway. Full output of yum: http://pastebin.com/ZHWbHrHJ


Pivot root between two Linux installations

I have two Linux distributions installed (Debian and Ubuntu). Each with its own usr, swap, and whatever. Both are completely independent, each in its partition. According to the man pages, I could pivot between them with:               cd new_root     pivot_root . put_old     exec chroot . command     umount /old-root      Is that that easy? Could I break something doing this (like files being copied or overwritten in any installation). Will this just stop running the distribution A and start running the distribution B 'as if' I had re-booted? Both distributions have different kernels.


Systemd fails to start Nginx on reboot, but it works manually

Here's my situation whenever I reboot:               $ systemctl --failed     UNIT          LOAD   ACTIVE SUB    DESCRIPTION     nginx.service loaded failed failed A high performance web server and a reverse proxy server     ...     $ nginx -t     nginx: the configuration file /etc/nginx/nginx.conf syntax is ok     2014/01/18 05:44:47 [emerg] 254#0: open() "/run/nginx.pid" failed (13: Permission denied)     nginx: configuration file /etc/nginx/nginx.conf test failed     $ cd /run     $ ls -al | grep nginx     $ sudo systemctl start nginx     $ ls -al | grep nginx     -rw-r--r--  1 root     root        4 Jan 18 06:27 nginx.pid      I don't understand how `nginx.pid` could have incorrect permissions before it's even created, or what one would do to resolve that. I'm using Arch and I've seen similar issues relating to chroot-jail, but I did not install nginx in a chroot.


Keeping the latest two version and delete the remaining

I have a list of files (say xsl format below) in one directory. I want to keep the last two version of all files. (I can delete the remaing files)               {A}_1.0.xsl     {A}_2.0.xsl     {A}_3.0.xsl     {A}_4.1.xsl     {A}_5.0.xsl     {A}_6.0.xsl     {B}_1.0.xsl     {B}_2.0.xsl     {B}_3.0.xsl     {B}_4.0.xsl     {C}_1.0.xsl     {C}_2.0.xsl     {C}_3.0.xsl      The remaining files present in the directory should be               {A}_5.0.xsl     {A}_6.0.xsl     {B}_3.0.xsl     {B}_4.0.xsl     {C}_2.0.xsl     {C}_3.0.xsl      How can it be achieved?


Adding timestamp to file/dir name

I am trying to write a script, that will copy file or directory with added timestamp to filename/dirname Something like:               cover.jpg --> cover_18-01-2014_17:37:32.jpg     directory --> directory_18-01-2014_17:37:32      I don't know how to add the timestamp to filename/dirname. Can anybody help? Timestamp               now="$(date +'%d-%m-%Y_%T')"


find: prune does not ignore specified path

I need to exclude `.git` from my `find` search. To achive that, I am using the `-path ./.git -prune` switch:               $ find . -path ./.git -prune -o \( -type f -o -type l -o -type d \) | grep '.git'     ./.git      However, even though this skips the contents of the .git directory, it lists the directory itself. It works when I add `-path ./.git -prune -o -print -a`               find . -path ./.git -prune -o -print -a \( -type f -o -type l -o -type d \) | grep '.git'      Why is this necessary. I thought that both commands should have same output. The second syntax is quite ugly.


tcpdump host filter doesn't work

I'm using tcpdump on a linux ARM computer (Raspberry Pi). The command `tcpdump host "ip" -v` gives nothing when I go on the website "ip" with my laptop, but if I try `tcpdump port 80 -v` it works properly, I see packets. Why doesn't the host filter work?


System freezing on Fedora 15 - graphics issue?

I've been using Fedora 15 for a couple months now and haven't had any problems. Last week I switched desks and got a new monitor, and now all of a sudden it will randomly freeze up. Also sometimes without freezing it will make all title bars (including the system bar at the top of the screen) and system images (such as the images for the launcher on the left side of gnome 3) plain blue, and any text on them is just blocked out in darker blue. It usually freezes some time after everything turns blue. I can switch to another terminal using ctr + alt + F2 and reboot. I checked the messages log and found this:               kernel: [ 1706.856599] [drm] nouveau 0000:01:00.0: PGRAPH - TRAP     kernel: [ 1706.856602] [drm] nouveau 0000:01:00.0: PGRAPH - ch 4 (0x0000b45000) subc 5 class 0x8297 mthd 0x0e08 data 0x04380000     kernel: [ 1706.856611] [drm] nouveau 0000:01:00.0: VM: trapped read at 0x20ff202000 on ch 4 [0x00000b45] PGRAPH/TEXTURE/00 reason: PT_NOT_PRESENT     kernel: [ 1706.856695] [drm] nouveau 0000:01:00.0: magic set 0:     kernel: [ 1706.856698] [drm] nouveau 0000:01:00.0:  0x00408904: 0x8008700f     kernel: [ 1706.856700] [drm] nouveau 0000:01:00.0:  0x00408908: 0x20ff2020     kernel: [ 1706.856702] [drm] nouveau 0000:01:00.0:  0x0040890c: 0x40000e04     kernel: [ 1706.856703] [drm] nouveau 0000:01:00.0:  0x00408910: 0x20200000     kernel: [ 1706.856705] [drm] nouveau 0000:01:00.0: PGRAPH - TRAP_TEXTURE - TP0: Unhandled ustatus 0x00000003     kernel: [ 1706.856707] [drm] nouveau 0000:01:00.0: PGRAPH - TRAP     kernel: [ 1706.856709] [drm] nouveau 0000:01:00.0: PGRAPH - ch 4 (0x0000b45000) subc 5 class 0x8297 mthd 0x1b0c data 0x1000f010     kernel: [ 1706.856716] [drm] nouveau 0000:01:00.0: VM: trapped read at 0x20ff202000 on ch 4 [0x00000b45] PGRAPH/TEXTURE/00 reason: PT_NOT_PRESENT      My system admin thought it might be some loose RAM, but I tried taking out and putting back in all my RAM sticks and it didn't work.   I am using a graphics card that I took off an old machine, under Fedora System Settings it says my graphics driver is: Gallium 0.4 on NV86. Is it time to upgrade to a new graphics card? If so it's not a big deal, I can get one that will fit my needs for around $50. I'm just not sure if that's the problem, or if it can be fixed with a different way.


Get separate used memory info from free -m comand

As a output of `free -m` command I got following.                            total       used       free     shared    buffers     cached     Mem:          2496       2260        236          0          5        438     -/+ buffers/cache:       1816        680     Swap:         1949         68       1881      I want to get only used Memory like 2260 as output. I tried following command.               free -m | grep Mem | cut -f1 -d " "       Help me to improve my command. How can I get it in percentage like 35% ?


How can I build android on my debian while using eclipse ? (java dependencies problem)

I would like to compile a build for my android device (N4) with my debian (jessie). I read that I must have Java 6, but eclipse which I sometimes use seems to need java 7. For example, I uninstalled java so eclipse, then installed openjdk-6, at this point I have 1.6 java version but reinstalling eclipse update it to 1.7 ! What did I miss ?


Find and remove large files that are open but have been deleted

How does one find large files that have been deleted but are still open in an application? How can one remove such a file, even though a process has it open? The situation is that we are running a process that is filling up a log file at a terrific rate. I know the reason, and I can fix it. Until then, I would like to rm or empty the log file without shutting down the process. Simply doing `rm output.log` removes only references to the file, but it continues to occupy space on disk until the process is terminated. Worse, after `rm`ing I now have no way to find where the file is or how big it is! Is there any way to find the file, and possibly empty it, even though it is still open in another process? I specifically refer to Linux-based operating systems such as Debian or RHEL. Thanks.


Is it a bad idea to keep scripts in /root? Simple bash scripts that have the following permissions: -rw-r--r-- They execute fine when ran as root, but is this bad practice? It's a multi- user system, that needs sudo to execute the scripts in question when not logged in as root....


SME server install from USB crashes with "IOError: [Errno 30] Read-only file system"

I managed to make my 8.0GB USB flash drive boot the current SME Server 8 beta ISO image. The installation program starts when I boot from USB, and configuration of install options worked fine. After pressing "Install now", the installation starts, then ends with a python exception error: > IOError: [Errno 30] Read-only file system I tried it twice and got the same error. What does this mean, and how should I alleviate this problem?


What is the typical file limit of a folder on *nix file systems?

Obviously, if you stick a lot of files in one folder, the efficiency of various file operations is going to go down (e.g. `ls` takes a _lot_ longer). However, what's the limit for how many files you can stick in a folder before it chokes on you? Obviously, this may vary from file system to file system, but I would think that they'd at least be similar in their limits. Can you stuff files in there until you run out of disk space, or are going to run into some sort of limit like you can only put 65536 (or some other multiple of 2) files in a folder before your file system chokes on you? I'm most interested in jfs, since that's what I use primarily use for my large partitions, but it would be good to know for *nix file systems in general.


Run a single command at the start of the machine

Most unix servers do have services defined as init scripts, on linux in: `/etc/init.d` and on hp-ux in: `/sbin/init.d`. However, what if I just want a single command to be executed when machine boots? I could write a service init script for that purpose, but that seems to me too complicated for just one command, which launches a process which performs something and then immediately terminates. Is there a script, somewhere, in which I can just append a line, similar to autoexec.bat in ms-dos?


How can I shutdown after unmounting a USB device from the command line?

Previously, I asked this question about how to suspend Linux after a set amount of time. I would like to ask a similar question. Supposing I have a USB device attached to my system (OS = Fedora 13), are there commands that can:   * detach the USB device and,   * after detaching it, shutdown the system after a specified interval.  To be more precise, detaching means a command that safely removes the device.


FreeNAS grub2 booting ISO

I've got usb-keys setup to multi-boot different Linux images. I wouldn't mind adding FreeNAS, and there's a doc with samples to add to `grub.cfg`               menuentry "FreeNAS-8.0.4-RELEASE-x64" {         insmod ufs2         insmod iso9660              # /usr/local/sbin/grub-probe -d /dev/sde1 -t fs_uuid         # c89c-7b3a         #search --no-floppy --fs-uuid --set c89c-7b3a              set isofile="/boot/FreeNAS-8.0.4-RELEASE-x64.iso"         loopback loop $isofile         kfreebsd  (loop)/boot/kernel/kernel.gz         kfreebsd_loadenv  (loop)/boot/device.hints              #set FreeBSD.vfs.root.mountfrom=ufs:/dev/ad4s1a         set kFreeBSD.vfs.root.mountfrom=ufs:/dev/acd0         set kFreeBSD.vfs.root.mountfrom.options=rw         #set vfs.root.mountfrom=cd9660:/dev/ad1s1         #set vfs.root.mountfrom.options=rw     }      I'm a little unsure on setting the vfs root, Here's the result of attempting to boot this; ![failed to mount root](http://i.stack.imgur.com/RyCYQ.jpg) Some useful information may be found at; boot FreeBSD iso from grub2 USB stick


How can I write a new syntax highlighter for gedit?

Some times I wish the particular language I happen to be writing in had syntax highlighting. How can I add that?


How to make my linux-2.6.24.4 to identify a hard disk with serial mode on intel 3201 mainboard

How to make my linux-2.6.24.4 to identify a SATA hard disk on an intel 3201 mainboard? I have pre-load modules `libata.ko ahci.ko scsi_mod.ko sd_mod.ko`, but it doesn't work on `intel 3210` mainboard. On an intel 5000P mainboard it works. Any modules I should to load for support intel 3210 sata hard disk support?


How to disable onboard (on-screen keyboard) that automatically starts when I log onto my system?

whenever I login to my system (Ubuntu 13.10) `onboard` (on-screen keyboard) automatically runs. I don't want it to run any more. Why does it run automatically & how to disable it? Long back as far as I remember, once I manually started `onboard`. And after that it starts on its own.


Is there a freeform playing cards deck&table game for Linux?

I am looking for a playing cards "game" where there are no rules and I can just place and move cards as I want. Just a real cards deck and replacement which I can use to play any single-player (solitaire) card game I may know.


Difference between system calls and library functions

I have been through the answer of this question but do not quite understand the difference between system calls and library functions. Conceptually, what is the difference between the two?


Is Linux kernel free to modify?

While browsing this site Text Files/Programming which contains historical data pertaining to programming and a lot of other stuff I came across this file Info sheet Linux The file in question has a peculier paragraph with the following contents: > Although Linux is supplied with the complete source code, it is copyrighted > software, not public domain. However, it is available for free under the GNU > Public License. See the GPL for more information. The programs that run > under Linux have each their own copyright, although much of it uses the GPL > as well. All of the software on the FTP site is freely distributable (or > else it shouldn't be there) It says although Linux is available for free, but still its source code is copyrighted " **not public domain** " What does it mean by saying that its copyrighted by still available for free, the file specifically says that the source is not under public domain, so is it against the law to modify linux kernel?


How to know what packages I'm missing?

A while ago I made my own distro of Linux using `SuseStudio` and may have left out some important packages.   * Apps like `gnome-software` and `gnome-music` don't work   * The computer runs really high process rates, doing simple tasks like `web browsing`   * `vmware` can't recognize hardware acceleration   * Overall sluggishness about the machine is existent In the past I would update to the latest package version, but now I feel that I'm missing some packages. Is there a `zypper` command I can run or a way to install all the base SuSe rpms?


Debian Squeeze: Left mouse click stops working

After starting a new session in my Debian Squeeze (6.0.4, always updated) running in a VM (VMWare Workstation) there comes the point in time where the left mouse click stops working, so that I cannot resize windows, bring them to front etc. Sometimes I can switch window focus with the right click or with right-click and `Control` key held at the same time, but then it does not work at all. Keys are accepted. I do not run anything special, just Emacs, Okular, Thunderbird and such stuff. Unfortunately I cannot give any sequence of events which reliably creates the problem. Is there a known fix to this problem (my googling efforts were not successful) or do i have to switch to KDE or LXFE?


What is the appropriate value of vm.swappiness when using zram?

I'm using zram on my computer as a compressed RAM-backed swap. When the system needs to swap something out, swapping it to a zram-backed swap file is more or less equivalent to compressing that data in-memory to free up space. This makes swapping very fast most of the time, relative to disk-backed swap. Because of this, I wonder if there is some performance to be gained by encouraging the system to swap out unused stuff more aggressively, since it can do so without actually hitting the disk? So has anyone messed around with, say, setting `vm.swappiness` to 100 while using zram? Would this be desirable?               sysctl -w vm.swappiness=100


Collect EXIF data of a directory

Is there a way to extract EXIF information of all images within a directory (into an output file)? Preferably I also need GPS data but this is not essential. I only ask, as I have a number of directories with a large number of image files within, so automating the EXIF extraction would be useful.


Is VMWare causing my Linux host to lose network connectivity?

I recently upgraded to Xubuntu 13.04 from 12.10, which required uninstalling and reinstalling VMWare Player for Linux. Soon after (not exactly sure the timing) I lost network connectivity on my host Xubuntu machine. Here is my ifconfig:               $ ifconfig     eth1      Link encap:Ethernet  HWaddr 00:90:f5:d8:8e:6a                 inet addr:192.168.254.27  Bcast:192.168.254.255  Mask:255.255.255.0               inet6 addr: fe80::290:f5ff:fed8:8e6a/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:914 errors:0 dropped:0 overruns:0 frame:0               TX packets:343 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:61498 (61.4 KB)  TX bytes:32037 (32.0 KB)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:65536  Metric:1               RX packets:336 errors:0 dropped:0 overruns:0 frame:0               TX packets:336 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:54571 (54.5 KB)  TX bytes:54571 (54.5 KB)          vmnet1    Link encap:Ethernet  HWaddr 00:50:56:c0:00:01                 inet addr:192.168.254.1  Bcast:192.168.254.255  Mask:255.255.255.0               inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:54 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          vmnet8    Link encap:Ethernet  HWaddr 00:50:56:c0:00:08                 inet addr:172.16.145.1  Bcast:172.16.145.255  Mask:255.255.255.0               inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:55 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)      I have both Virtualbox and VMWare player installed, so I'm guessing that's why I have two vmnet entries. On my host I can sometimes (seems to come and go) ping DNS (8.8.8.8) but never anything else (such as www.google.com). I've tried a number of things to no avail. Is it a problem that vmnet1 has IP addr 192.168.254.1, which is on the same network as eth1 (192.168.254.27)? Is that interfering with eth1 and blocking network connectivity? Should vmnet1 be on a different internal network, like 10.x.x.x? If so, how do I change it? * * * **[Update]** Here is more information based on what @slm asked: I can't say for sure, but it seems to me that it used to eth0. Not sure when it changed. Here are a few more things I checked:               $ ls -d /sys/class/net/eth*      /sys/class/net/eth1      I don't much about modprobe, but someone suggested doing this:               $ modprobe -c | grep 'eth[0-9]'     blacklist eth1394      Not sure what that means. Finally, on your question about /etc/udev/rules.d/70-persistent-net.rules. I actually have four entries, not sure why as it seems I have only one NIC (based on running `sudo lshw -class network` and above info)               $ cat /etc/udev/rules.d/70-persistent-net.rules           # PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.0/0000:08:00.0 (tg3)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:38:37:96:26", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"          # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:1c.1/0000:10:00.0 (iwl3945)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:77:92:2d:9c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"          # PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:1c.3/0000:03:00.2 (r8169)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:90:f5:d8:8e:6a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"          # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:1c.2/0000:02:00.0 (iwlwifi)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="58:91:cf:52:e2:11", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"


Configure bash globbing

After coming from cygwin, I'm quite confused about the bash (version 4.1.5) globbing on my Ubuntu 10.4. I'd love one of the following two possibilities:   * ignore `.` and `..`, match everything else   * ignore filenames starting with a dot unless given explicitly The current behavior is plain strange:               cd; ls .*      says "ls: cannot access .*: No such file or directory" although I explicitly asked for filenames starting with a dot.               cd; ls .gnupg/*.gpg      complains as well although I'm asking for files not starting with a dot (it's just the directory name what starts with a dot). ### Output of `shopt -p` (removed) ### The solution I've changed `shopt` to values from another user (not having this problem) and it didn't help. Then I came to the idea to bisect my `.bashrc` and find the offending line which contained something like `GLOBIGNORE='.[!/.]*:..[!/]*:*/.[!/.]*:*/..[!/]*:`... I've replaced it by `GLOBIGNORE='.:..'`, which does nearly what I want, and it works.


How do I make all current and future files in a directory readable by a certain group/user?

I have a "Drop Box" directory for students to submit assignments. Its permissions are set to "drwx-wx---" where all of the students belong to the group. This lets them write to but not read from the folder. I would like to set up ACLs so user cs63 (an account used by the teaching staff) can read all files. I tried doing:               chmod +a "user:cs63 allow read,file_inherit,directory_inherit" Top      on the top-level directory in which all of the Drop Box directories appear. When I look at the attributes with "ls -lde", I see:               user:cs63 allow list,file_inherit,directory_inherit      I assume that "read" was changed to "list" because "read" isn't applicable to directories, but how do I specify that I want cs63 to be able to read, not just list, all of the files? Also, once I set the right ACL, will it apply to files that have already been submitted or only future ones? I connect to the server via ssh, so I need to do all of this at the command line. EDIT: I tried @mindc's suggestion of:               chmod -R +a "user:cs63 allow read,file_inherit,directory_inherit" Top      It worked for most files, but not for a subdirectory whose permissions were:               drwx---rwx+ student cs63sp12      where user cs63 is a member of cs63sp12. When I do "ls -le" on the subdirectory, I get:               0: user:cs63 allow list,file_inherit,directory_inherit


Zgrep stop after first match when arguments are passed from xargs

I'm using this command to find patterns in zip files (similar to the one) suggested here http://superuser.com/questions/144926/unix-grep-for-a-string- within-all-gzip-files-in-all-subdirectories               find . -regex ".*/.*zip" | xargs zgrep -m 1 -E "PATTERN"      Grepping still continues after first match. Probably `find`/`xargs` is the culprit. How to stop finding after `grep` finds first match? P.S. How to stop the find command after first match? won't work because `find` needs to be stopped after a match that succeeds grep and not just the first match of find.


What does the "00:00:00" timestamp mean in kern.log?

I'm looking for causes of a particular problem in kern.log. There are many entries with a 00:00:00 timestamp:               Jun 11 00:00:00 mymachine kernel: [    0.000000] Initializing cgroup subsys cpusetJun 11 00:00:00 mymachine kernel: [    0.000000] Initializing cgroup subsys cpu     Jun 11 00:00:00 mymachine kernel: [    0.000000] Linux version 3.2.0-33-virtual (buildd@batsu) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #52-Ubuntu SMP Thu Oct 18 16:48:3     7 UTC 2012 (Ubuntu 3.2.0-33.52-virtual 3.2.31)     Jun 11 00:00:00 mymachine kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.2.0-33-virtual root=LABEL=cloudimg-rootfs ro console=ttyS0      Assuming I didn't actually boot the machine up at midnight - does the 00:00:00 timestamp mean a particular phase of the bootup process? Any particular reason they do this? (It's an Ubuntu Precise VM hosted on OpenStack, if that matters. I think this boot up was immediately after being cloned from another image.) EDIT More information: As far as I can tell (`pgrep ntp`, `ls /etc/ntp*` ) ntp is not running. The time seems to (correctly) be set to UTC, with (incorrectly) no local timezone set. EDIT2 The last log entries at 00:00:00 looks like this:               Jun 11 00:00:00 mymachine kernel: [    6.324599] type=1400 audit(1370908796.761:11): apparmor="STATUS" operation="profile_load" name="/usr/sbin/tcpdump" pid=875 comm="apparmor_parser"     Jun 11 00:00:02 mymachine kernel: [   12.259133] postgres (1033): /proc/1033/oom_adj is deprecated, please use /proc/1033/oom_score_adj instead.     Jun 11 00:00:05 mymachine kernel: [   13.592385] eth0: no IPv6 routers present     Jun 11 06:22:15 mymachine kernel: [22942.768233] init: tilemill main process (3167) killed by TERM signal     Jun 11 06:40:14 mymachine kernel: [24022.599001] init: tilemill main process (5640) killed by TERM signal


How can I get rid of this invisible file?

## Background I have a folder named `akorg✽`. That Unicode character causes headaches for me when software makes incorrect assumptions about the text encoding of my file paths, so I'd like to remove it from the name. ## The problem You'd think this would be easy:               $ mv akorg✽ akorg     mv: cannot move ‘akorg✽’ to a subdirectory of itself, ‘akorg/akorg✽’      but—that's strange—it thinks a folder called `akorg` already exists. I'm pretty sure there isn't one:               $ ls -la     total 699K     drwxr-xr-x 15 ak ak   15 Jun 12 17:34 .     drwxr-xr-x 57 ak ak 4.0K Jun 12 17:35 ..     drwxr-xr-x 11 ak ak   21 Jun 12 16:58 akorg✽     drwxr-xr-x  2 ak ak    2 May 28 20:47 Desktop     ...      Still, `stat` says otherwise:               $ stat akorg       File: ‘akorg’       Size: 21          Blocks: 33         IO Block: 1536   directory     Device: 15h/21d Inode: 292128      Links: 11     ...      So apparently there is an invisible folder in the way. Whatever, I'll just remove it:               $ rmdir akorg     rmdir: failed to remove ‘akorg’: No such file or directory      Right, then. What in the world is this thing? ## What I know so far   * I'm using the stable release of ZFS on Linux. Here's the zpool status and zfs properties.   * `stat` returns the same inode for both `akorg` and `akorg✽`. Searching by that inode returns only `akorg✽`:              $ find . -maxdepth 1 -inum 292128     ./akorg✽        * More things that don't work on the "invisible" folder:              $ rm akorg     rm: cannot remove ‘akorg’: Is a directory     $ unlink akorg     unlink: cannot unlink ‘akorg’: Is a directory     $ mv akorg akorg_temp     mv: cannot move ‘akorg’ to ‘akorg_temp’: No such file or directory        * I get the same results in both Bash 4.2.45 and zsh 5.0.0. In both, tab-completion of `ak` returns only `akorg✽/`.   * The strace of my initial renaming attempt confirms that I'm typing the names correctly and that the attempt is thwarted by the preexistence of a folder named `akorg`.   * This response to a more explicit renaming attempt is puzzling and scary:              $ mv --verbose --no-target-directory --no-clobber akorg✽ akorg     removed ‘akorg✽’      I don't understand why it claims to have removed `akorg✽`, or why it would try. Fortunately, `ls` and `stat akorg akorg✽` reveal that nothing is actually gone. Here's the strace.   * To rule out encoding quirks as the cause of this, I've temporarily given `akorg✽` an intermediate name:              $ mv --verbose --no-target-directory --no-clobber akorg✽ bananas     ‘akorg✽’ -> ‘bananas’      That worked as expected,              $ ls -la     total 715K     drwxr-xr-x 16 ak ak   16 Jun 13 15:11 .     drwxr-xr-x 57 ak ak 4.0K Jun 13 14:03 ..     drwxr-xr-x 11 ak ak   21 Jun 12 16:58 bananas     drwxr-xr-x  2 ak ak    2 May 28 20:47 Desktop     ...      but the "invisible" folder is still present:              $ stat bananas akorg       File: ‘bananas’       Size: 21          Blocks: 33         IO Block: 1536   directory     Device: 15h/21d Inode: 292128      Links: 11     ...       File: ‘akorg’       Size: 21          Blocks: 33         IO Block: 1536   directory     Device: 15h/21d Inode: 292128      Links: 11     ...      and `mv` still behaves strangely when I try to use the name `akorg`:              $ mv --verbose --no-target-directory --no-clobber bananas akorg     removed ‘bananas’


PuTTY and PowerTerm scripting Problem, Open a just in time URL via Samba share

I'm sshing into a fedora server using Powerterm (an expensive overly priced, license based, terminal emulator). The server uses an ancient form of (what I'm told is similar to) cobalt. I have no control over the server's programming but I'd like at least to not have to pay hundreds of dollars for a PuTTY like terminal emulator every time Windows changes their OS. The software on the server is capable of building spreadsheets and exporting to Excel on a Windows machine via a samba share, but I can't seem to get that to work using PuTTY. I've logged the hidden command that the server sends to PowerTerm and it looks like this               _[P$sExcel.psl "\\serverFQDN\user\spdsht123.xls"_[\       and this was logged in the SSH in/out along with octal stuffs               .......1.[1;1H.P          $sExcel.psl "\\s          erverFQDN\user\s          pdsht123.xls".\       The file gets built but doesn't run, understandably, b/c nothing is scripted on PuTTY to listen for that specific character/string (not sure which is which). There are 2 files on the server that may also come into play somewhere but I can't see the code so I'm just guessing, or possibly just a copy in case someone were to delete them.               [me@erver PSL]$ cat excel.psl     exec "excel.exe $p1"     [me@erver PSL]$ cat PT.psl     exec "$p1"      Putty Settings               SSH -p22     Backspace Key - Control-H     FKeys and Keypad - SCO     Translation is Default Latin-1, West Europe ISO-8859-1:1998     Terminal-type string sends ansi      Initially I thought I could forward and tunnel the smb ports but since the filename is sent by the server live at that minute I'd have to script PuTTY to listen for a specific string ie. _[P$sExcel.psl and open the file using the default windows program associated with the URL. Then I noticed that PuTTY doesn't support this and I've tried countless PuTTY forks to no avail. Any help would be appreciated.


Why is the root directory denoted by a / sign?

I have done some research about this on Google, but the results were cloudy. Why is the `/` sign used to denote the root directory. Are there any solid reasons behind it?


Are there any side effects when two distros share a swap partition?

In order to save disk space, I want to have two OS installations share a single swap partition (a dual-boot). Is this a good idea?


Swap separation for multiple distributions

I have 3 Linux distributions on my machine (Ubuntu, Arch and Fedora). I allocated half the RAM size (3GB) as swap for each of them. (I have realized that having 3 distributions is not of much use to me, but I still have them.) The problem is now the 3 distributions mount all the 3 swap partitions while loading, and treat swap as a single 9GB partition. Now when I hibernate my system, obviously no distribution ever wakes up from hibernation. Is there any way to overcome this?


Alternative regex for {}

I am trying to replace all of this line, but the numbers:               looktype="123"      so only the numbers show up. Is this possible in any easy way?               {sub ("look type=\"[0-9]{0,3}", "TEST")}      I am trying this with `awk`, to no avail. I believe "sub" and {0, 3} are interfering.


sort inplace - like sed --in-place - exists?

Am I blind or is there no option like `\--in-place` for `sort`? In order to save results to the input file, sed uses `-i` (`\--in-place`). Redirecting the output of `sort` to the input file               sort < f > f      results in making it empty. If there is no `\--in-place` option - maybe there is some trick how to do this in _handy_ way? (The only thing that cames to my mind:               sort < f > /tmp/f$$ ; cat /tmp/f$$ f ; rm /tmp/f$$      Moving is not right choice, cause _file permissions_ might be changed. That's why I overwrite it with contents of tmp which I then remove.)


FTP over SSL in AIX (UNIX)

Folks over at SO couldn't answer this, so I am posting over here. I need to do an FTP over SSL to a FileZilla Server running on a Windows server from an AIX Unix clien. I have the Host name of the destination server, the user id and password, and an SSL certificate. I am not sure how to install that certificate in AIX. When I do an ftp command (using the below code) from Unix it does connect successfully to the Filezilla server and I am able to do get and or mget. But, I am not sure if that is happening over SSL since I haven't installed the SSL Certificate yet. Do I need to install the Certificate in the Unix box (AIX)? if yes, then how? (specific steps and commands) and how to utilize the installed SSL certificate to do FTP after the installation?               $ ftp XXX.XXX.XXX.243     Connected to XXX.XXX.XXX.243.     220-FileZilla Server version 0.9.24 beta     220-written by Tim Kosse     220 Please visit http://sourceforge.net/projects/filezilla/     Name (XXX.XXX.XXX.243:littercat): joyride     331 SSL required     Password:     230 Logged on     ftp>      Note: SSH (SFTP/SCP) is not an option and it has to be FTP over SSL/TLS only (From AIX UNIX to Windows FileZilla). AIX version 5.3. Third party tools cannot be used (eg. cURL etc.)


How do I restore default owner of files in /var/ directory?

Accidentally in _/var/_ directory I ran `chown root . -R;chgrp root . -R`. Now services like mysql don't start. Is there a way to restore default owner and groups? If there is no way, what is the default owner and group of _/var/lib/mysql_ directory and it's files?