title: Cannot change brightness after standby or logout

text: Laptop: Toshiba R630     http://www.linlap.com/toshiba_portege_r700-r705     OS: Mint 14, Cinnamon           $ lspci | grep -i vGA     00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)      Apart from the commonly reported problem of loss of brightness level, I cannot change my brightness at all once I recover from stand by. If I use 'brightness and lock' and try to move the slider, the brightness never change. I have seen multiple threads related to the problem. I have tried a few suggested fixes but I could not get it to work. It looks like for an average linux user like me the solutions described are not much understandable. Can someone explain or point to right documentation to understand the problem related to setting/modify display brightness? # 1. xrandr               xrandr --output LVDS1 --brightness 0.8      this works but what i do not understand is when I bring the value below 1.0 (max brightness), the screen is not convenient to look at. I am unable to describe technically which constituent related to brightness is not correct. # 2. acpi               echo 7 > /sys/class/backlight/acpi_video0/brightness      i tried this solution but it does not change brightness # 3. toshset               $ toshset     required kernel toshiba support not enabled.      Not sure what to do with the above. # 4. setpci               rag@rag-tos-laptop:~$ sudo lspci | grep VGA     00:02.0 VGA compatible controller: Intel Corporation Core Processor         Integrated Graphics Controller (rev 02)     $ setpci -s 00:02.0 F4.B=80     pcilib: Cannot open /sys/bus/pci/devices/0000:00:02.0/config      but something seems to be different for my laptop


title: How to more easily specify tasks for batch, using command prefix tool?

text: The tool `batch` that comes with the `atd` daemon is pretty useful in principle, running commands only when the system utilisation falls below a certain level (by default, 1.5). However, using it (and also `at`) is pretty ugly by modern standards: you either have to feed a script which can be run by `/bin/sh`, or type commands interactively into a basic prompt with no completion, color-coding, etc. What would be really nice is a command prefix tool, more like `nice`, that one can put in front of any command to add it to the batch queue (and a similar utility for `at` would be handy, although that's not the main point of my question). For example, it might work like this: `my-batchifying-command python some_longrunning_computational_script.py` Does such a thing exist? If not, how might it be created? I use `zsh` for my main shell, but a `bash` answer would be equally OK and might have wider applicability.


title: Using $ in a password

text: Lets assume that password of my server is `Abcd$1234` I am trying to ftp a file from other server to my server using the following in shell script               ftp -inv (IP) << EOF     user Username Abcd$1234          "lines to ftp file"          bye      I am unable to ftp. I tried replacing password as `Abcd\$1234` and also `"Abcd\$1234"` but no use. But I am able to login to my server without ftp (just to verify whether password is valid or not) Can anyone please help. I want to use `$` in my password at any cost


title: How do I configure mailutils pop3d to not set the flags on the mailspool?

text: How do I configure mailutils pop3d to not set the flags on the mail spool to read? I could not find a setting for this in the documentation. I am using an android (stock) MUA and this does not seem to have an option for this setting. The user functionality I am seeking is that the mail must remain as _unread_ on the server so that when I use my _official_ application, then I see mails as _unread_ even though I may have read them _on the go_ as it were. Thanks for any suggestions.


title: Asus USB N10 wireless adapter works on Ubuntu but not Fedora

text: I could make it work in Ubuntu, due to this answer. But the same approach shows no result in Fedora 15 (64 bits). The device is an Asus USB N10 (wireless-usb converter): Bus 001 Device 003: ID 0b05:1786 ASUSTek Computer, Inc. Any idea how to make it work? Fedora doesn't come with this driver?


title: Are limits in linux (like those controlled by ulimit or /etc/security/limits.conf) per user or per user per process?

text: I saw three copies of a process running and one of them cored in what seems like memory issue. Each individually occupies about 3-4 GB of memory..would a limit account for killing one of them? And if this was the case which one would be killed?


title: Ignorantly dd'd /dev/sda*

text: I was trying to write an iso to a flash drive. I mistakenly thought that all /dev/sda* are flash drives attached to the system. I wasn't sure how to figure out which was which, so I just unplugged my flash drives and overwrote them all. In retrospect.... this was unbelievably dumb. So I now have a non-booting system (grub-rescue prompt at boot). I do have an eeebuntu iso on a flash, so I can boot into linux off that, but I'm at a loss. I have a windows partition on the first part of the drive, then the Ubuntu install, but GParted is showing a single 500GB unallocated partition. I would greatly appreciate advice... I have no idea where to start.


title: How to display result of df every 30s?

text: All I want to see is the % after I issue `df /` every 30s but on the same line just after the previous number. So the final output would be `86% 86% 86% 87% 87% ......` Could it be one line code? Or multiple line 'program'?


title: How can I do the equivalent of tail -f with ls?

text: > **Possible Duplicate:**   >  Is it possible to follow a command (run repeatedly)? as one would follow a > file using tail -f? I would like to monitor files that are being downloaded to a directory in real time on screen in bash. Is there an easy way in Linux to do the equivalent of `tail -f` but on a directory, perhaps using ls?


title: Can I install "development-tools" offline? Or, how to make my CD the yum repository?

text: I'm looking for the "development-tools" for Fedora, but I can't find information about how/where to download it to install offline (I have no internet connection in my Fedora). **Attempt 1:** There's a hint here about how to use the DVD as repository, but I don't have the `media.repo` in the root of my Fedora 15 DVD.. any idea where's it? **Attempt 2:** I also found this image, in a page saying that I can choose during the installation to install the development-tools. But I just re- installed Fedora paying attention, and didn't saw that screen or that option.. **Attempt 3:** I found this approach, but it requires to install the `createrepo`, and I can't install a thing here.. **Using Bakha Nurzhanov's approach:** Mount your DVD media: mount -r /dev/cdrom /media/CentOS Create file /etc/yum.repos.d/CentOS-Media.repo with the following content:               [c5-media]     name=CentOS-$releasever - Media     baseurl=file:///media/CentOS/     gpgcheck=0     enabled=0      Use your DVD to install "Development Tools"               yum --disablerepo=\* --enablerepo=c5-media groupinstall "Development Tools"      On this last step I got:               $ yum --disablerepo=\* --enablerepo=c5-media     Loaded plugins: langpacks, presto, refresh-packagekit     file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml     Trying other mirror.     You need to give some command     Usage: yum [options] COMMAND      I checked, really there's no repodata folder or repomd.xml file.. Here's the DVD tree:               $ tree     .     ├── EFI     │   └── boot     │       ├── bootx64.conf     │       ├── bootx64.efi     │       ├── grub.conf     │       ├── initrd0.img     │       ├── isolinux.bin     │       ├── isolinux.cfg     │       ├── memtest     │       ├── splash.jpg     │       ├── splash.xpm.gz     │       ├── vesamenu.c32     │       └── vmlinuz0     ├── GPL     ├── isolinux     │   ├── boot.cat     │   ├── initrd0.img     │   ├── isolinux.bin     │   ├── isolinux.cfg     │   ├── memtest     │   ├── splash.jpg     │   ├── vesamenu.c32     │   └── vmlinuz0     └── LiveOS         ├── livecd-iso-to-disk         ├── osmin.img         └── squashfs.img          4 directories, 23 files      Is my version of the DVD different of your? I downloaded the lastest from the site..


title: How to set default file permissions for all folders/files in a directory?

text: I want to set a folder such that anything created within it (directories, files) inherit default permissions and group. Lets call the group "media". And also, the folders/files created within the directory should have g+rw automatically.


title: Pre-defined umask under a given path

text: > **Possible Duplicate:**   >  How to set default file permissions for all folders/files in a directory? Say I have default umask, `umask1`. I would like all files/folders that I create/modify under a specific path               /path/to/foo      to have a different umask, `umask2`, and keep using `umask1` for everything else. Is there a way to have the shell do this automatically for me? If so, how? Is there a way to do this for everyone else who belongs to the groupID of `/path/to/foo`?


title: Gnome 3 always on fallback upon login

text: I have a Debian Wheezy install, with Gnome 3 as the windows manager. I also have a NVidia video card for what it matters. I autolog in gnome upon boot to my user account, but it always start gnome in fallback mode. After I logout and relog again in the same account (without changing options in the login windows), then it starts gnome 3 properly. I was wondering if this could be linked to 3D rendering, but: `|> cat /etc/X11/xorg.conf` [...]               Section "Device"         Identifier     "Device0"         Driver         "nvidia"         VendorName     "NVIDIA Corporation"     EndSection          Section "Screen"         Identifier     "Screen0"         Device         "Device0"         Monitor        "Monitor0"         DefaultDepth    24         SubSection     "Display"             Depth       24         EndSubSection     EndSection      and `glxinfo | grep -e "direct " -e" renderer"`               direct rendering: Yes      OpenGL renderer string: NVS 4200M/PCIe/SSE2


title: Finding the current speaker volume (signal strength)

text: I'm trying to create a widget for awesome wm that controls and monitors volume. Getting and setting the speaker volume is easy in ALSA and PulseAudio, but how about getting the actual signal strength? By this I mean the actual noise you hear, e.g. if no sound is playing it is zero. Just like you would see of an amplifier (the VU-monitor). Usually I can manage to find a file in `/proc/` that holds some value as to what is being used (eg. `/proc/stat` for cpu usage), but this is not the case this time. The goal is really to show a real-time audio display (preferrably separate L/R channels) that resembles the gain VU-monitor from an amplifier. _note that the question is not about how to program this for awesome wm, but how to get the values that can be used to do it_


title: FTP bulk download and rename

text: First of all: Why I'm trying this? Because we need to download some files AND rename to shorten ones with date "stamps". The remote files have really huge filenames and it's not an option to change(isn't our ftp). I'm trying to make a bulk download and rename of some files in a remote ftp server, without having to open one ftp connection to each file I have to download. So far, i could achieve renaming and download on-the-fly with `nmap` ftp command, renaming every file that starts with "N" and ends with ".TXT" to "N_date_time_stamp.TXT"               ftp -niv $url << FTP_COMMAND             user $user $password             cd $remotedir             nmap N*.TXT N_`date "+%H%M%N"`.TXT             mget N*             bye     FTP_COMMAND      The problem is: nmap keeps the same %N value to all files passed to mget, and it should change on every download to the current nanosecond value:               250 CWD command successful.     local: N_1054232349627.TXT remote: NO2346662345257245624572457245724562411125555341346134771345123461146-44.TXT     227 Entering Passive Mode (xxxxxxxxxxxxxxx).     125 Data connection already open; Transfer starting.     226 Transfer complete.     2220 bytes received in 0,0995 secs (22 Kbytes/sec)     local: N_1054232349627.TXT remote: NO2346662345257245624572457245724562411125555341346134771345123461146-45.TXT     227 Entering Passive Mode (xxxxxxxxxxxxxx).     125 Data connection already open; Transfer starting.     226 Transfer complete.     2220 bytes received in 0,107 secs (20 Kbytes/sec)      Is there a way to update the `nmap` on each download?


title: vim - how can i do a 'change word' using the current paste buffer

text: I have some text in my paste buffer, e.g. I did a `yw` (yank word) and now I have 'foo' in my buffer. I now go to the word 'bar' and I want to replace it with my paste buffer. To replace the text manually I could do `cw` and then type the new word. How can I do a 'change word' but use the contents of my paste buffer instead of manually typing out the replacement word? The best option I have right now is to go to the beginning of the word I want to replace and do `dw` (delete word), then go to the other place and do the `yw` (yank word), then go back to the replacement area and do `p` (paste) which is kinda clumsy especially if they are not on the same screen.


title: Why can't I run Gnome apps over remote SSH session?

text: Logging into a remote host using `ssh -X me@host`, I successfully run `gnome- terminal -e "tail -F /var/log/file" &`. When I log off and then try the same thing the next day, I get this: > Failed to get the session bus: Failed to connect to socket > /tmp/dbus-K99gT9yDjS: Connection refused Falling back to non-factory mode. > Failed to summon the GConf demon; exiting. Failed to contact configuration > server; some possible causes are that you need to enable TCP/IP networking > for ORBit, or you have stale NFS locks due to a system crash. See > http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to > get connection to session: Failed to connect to socket /tmp/dbus-K99gT9yDjS: > Connection refused) How do I run gnome-terminal in this situation?


title: How to display technical codec info for a FLAC file?

text: Given a `.flac` file, how is it possible to query and display the technical info relating to the codec? I looked into `man flac` with no luck (the `\--analyze` output is not humanly parseable). I'm specifically interested in the **bit rate** (say, 16 bits per sample), the **sample rate** (say, 44.1 KHz) and the **number of channels**. Either GUI or CLI utilities are acceptable.


title: Why is my embedded Linux unable to detect the sd device?

text: I have this ARM9 SAM9G25 embedded System, running a Linux 2.6.39 Kernel and a Busybox. I put the Images (of the bootloaders, and the linux+initramfs) on a SD so that in the end the system is booting from it - this works no problem so far. Now when I try to get access of the SD card in Linux or Busybox then the problem starts. It's not there no entry in               ls /dev      about `mmcblk0p1`, `mmcblk0`, `sdb` or anything else related. But with               cat /proc/devices      in the last line there is               179 mmc      I guess the 179 is the major number, so I tried to add it to the device_table, so that buildroot generates the `mmcblk0p1` for the next image               /dev/mmcblk0p1 b 755 0 0 179 0 - - -      > (that's respectively: 'name' 'type' 'mode' 'uid' 'gid' 'major' 'minor' > 'start' 'inc' 'count') but nothing changed again the drivers are selected in Linux menuconfig. Does anyone know why I can't even see the SD Card/Device?


title: Write default array to variable in Bash

text: I was expecting               excludes="${excludes:-( ${default_excludes[@]} )}"      to be an array if `$excludes` is empty. Unfortunately the stuff after `:-` is taken to be a string. Did I miss some syntax contortion, or do I have to use the clunky               if [ -z "${excludes:-}" ]     then         excludes=( "${default_excludes[@]}" )     fi      ?


title: Uncommenting multiple lines of code, specified by line numbers, using vi or vim

text: I have learned from this Stack Overflow question that it is possible to use `vi`/`vim` to comment out a specified range of line numbers. For example, suppose I have the following bash script:               #!/bin/bash          This     is     my     very     very     great     script      Now suppose that I want to comment out line numbers 6 through 8 (which contain the words `very`, `very`, and `great`) using the `#` comment character. In `vi`/`vim`, I can simply type `:6,8s/^/#` to obtain the following:               #!/bin/bash          This     is     my     #very     #very     #great     script      which comments out lines 6 through 8. My question is, is it possible to type a similar one liner that will **_remove_** the `#` comment character from lines 6 through 8 (but not any other commented lines in the file)? Having said this, I realize that there is some debate about whether I am actually using `vi` or `vim`. In practice, I open a file `script.sh` with the command `vi script.sh`. Also, when I type the command `which vi`, I obtain `/usr/bin/vi`. Nevertheless, when I simply type `vi` and press `Enter`, I obtain this:               ~                              VIM - Vi IMproved     ~     ~                               version 7.2.330     ~                           by Bram Moolenaar et al.     ~                 Vim is open source and freely distributable     ~     ~                           Sponsor Vim development!     ~                type  :help sponsor<Enter>    for information     ~     ~                type  :q<Enter>               to exit     ~                type  :help<Enter>  or  <F1>  for on-line help     ~                type  :help version7<Enter>   for version info      which seems to suggest that I'm actually using `vim`. I am accessing a remote Ubuntu Linux cluster using SSH from my PC. I am not using a Ubuntu Linux GUI.


title: Why wasn't `creat` called `create`?

text: Was it just to save typing one letter? I don't think C function names were limited to five characters at the time, as `strcmp` and `unlink` are probably just as old. I'm hoping someone who was involved said something on the record about this, but I haven't been able to find it. This is not the same as asking 'What did Ken Thompson mean when he said, “I'd spell create with an 'e'.' because it is a different question with a different answer.


title: What is a Transaction Check Error ? (yum update)

text: I tried today to replace packages from atomiccorp's repositories with newer packages from the epel/remi repositories and received `Transaction Check Error`s. I cannot proceed with my update.               Install       5 Package(s)     Upgrade      23 Package(s)          Total size: 24 M     Is this ok [y/N]: y     Downloading Packages:     Running rpm_check_debug     Running Transaction Test     Finished Transaction Test               Transaction Check Error:       file /etc/php.ini from install of php-common-5.3.6-1.el5.remi.x86_64 conflicts with file from package php-common-5.2.17-1.el5.art.i386       file /usr/share/man/man1/php.1.gz from install of php-cli-5.3.6-1.el5.remi.x86_64 conflicts with file from package php-cli-5.2.17-1.el5.art.i386          Error Summary     -------------      What is a `Transaction Check Error` and how can I fix it ?


title: configure python3-tk for manually installed python 3.4 debian wheezy

text: On wheezy apt packaging python3-tk requires python3.2 & python3 packages. I want python 3.4 and have built it manually. The trouble is I don't know how to get my manual 3.4 build to 'see' the python3-tk install - when trying to import tkinter I get:               Traceback (most recent call last):       File "/myscript.py", line 9, in <module>         import tkinter as tk       File "/opt/python3/lib/python3.4/tkinter/__init__.py", line 38, in <module>         import _tkinter # If this fails your Python may not be configured for Tk     ImportError: No module named '_tkinter'      if I start the system python3 interpreter and import tkinter it will load the module. I have my 3.4 manual build installed to a dir in /opt/. How do I get it to see the apt-installed tkinter?


title: Make a windowmanager/desktop (Gnome) use only a part of an X11 server's (Xvfb) resolution

text: I have the following problem: Let's say I have an X11 server (it is the Xvfb) set to run at a resolution of 1024x768. Now I want to run inside it the Gnome desktop, not at the resolution of 1024x768 but, lets say, 640x480 with the condition that the Gnome desktop is centered inside the X11 space. Anyone knows how to do that? I have tried passing gnome-session the parameter --geometry but it does not like it. Just In case it matters: The system is a Centos 5.5 with the latest updates installted. Thanks in advance!


title: where can i find the good man pages?

text: I have read the man pages that have come along with the red hat os.But it takes too long to understand the documentation. I want to know about the good sites which provide more clear man pages.


title: PAM authentication program in C recognizes only the logged in user

text: I am trying to write a C program to authenticate users using PAM. Here is what I have at present:               #include <security/pam_appl.h>     #include <security/pam_misc.h>     #include <stdio.h>          int main (int argc, char* argv[])      {       pam_handle_t* pamh;       struct pam_conv pamc;            /* Set up the PAM conversation.  */       pamc.conv = &misc_conv;       pamc.appdata_ptr = NULL;       /* Start a new authentication session.  */       pam_start ("su", argv[1], &pamc, &pamh);       /* Authenticate the user.  */       if (pam_authenticate (pamh, 0) != PAM_SUCCESS)         fprintf (stderr, "Authentication failed!\n");       else         fprintf (stderr, "Authentication OK.\n");       /* All done.  */       pam_end (pamh, 0);       return 0;     }      This works correctly and authenticates the user I am currently logged in as. It does not recognize any other user on my system and says authentication failed even after providing correct login details.      What am I missing ? **Edit :**   From further reading I think this is because only the user who starts the application is able to authenticate. But I still don't know how to switch users in that case. The attempt is to do something like this:                 su temp     Password:      and eventually switch users.


title: vim colors not automatically loaded (probable Vundle conflict)

text: I've been trying to port my Windows .vimrc to Linux, to use on the command line (on gnome-terminal). Everything works fine, except for the colorscheme. It looks like it's loaded (`:colorscheme` returns `solarized`; `:set t_Co` returns `t_Co=256` and `:set background` returns `background=light`), but it looks ugly on my terminal. If I run any of those commands again manually (either setting `colorscheme`, `t_Co` or `background`), then the theme displays normally. This is the .vimrc.bundle that's sourced on my .vimrc GVim also behaves normally. I tried other terminals (xterm, urxvt, screen), but none worked. **Edit:** Looks like there's some sort of conflict with a plugin loaded by Vundle. If I comment out the `source ~/.vimrc.bundle`, the colorscheme is loaded properly.


title: Linux 0.0.1 Kernel - Starting Kernel Programming

text: To start kernel programming, instead of reading the books, the online references suggested to download the linux 0.0.1 source and find bugs.   I have downloaded it and I am going through the code with parallel reading of "UNIX internals" by Bauch.   Now, the latest kernels will be far more advanced then this. But at the same time reading Robert Love's book, doesn't give me a clear picture, as the code is not compiled and executed.   How can I test this kernel using my Ubuntu distribution in a way that will not affect my installed system?


title: difference tun/tap, is the interfaces that handle protocols or the OS?

text: I have difficulties to understand difference between tap and tun interface. I know it is an often asked question and I apologize for that. I asked the same questions on stackoverflow and someone told me to try this forum so I hope I'm in a good place. Moreover, I'm only curious about networks but I'm not a network student or professional so forgive me if my questions are too easy for you. I read tap work at layer 2 and tun works at layer 3. I also read that tap is used for bridging and tun is used for routing. I already heard things like "ROUTERS work at layer 3" or "BRIDGES work at layer 3" : this make sense for me because routers manipulate layer 3 protocols and bridge manipulate layer 2 protocols? but, because tap and tun are "interfaces", it means the sentence like "INTERFACES work at layer 3" has a sense but i don't understand what it is : I mean interfaces doesn't manipulate protocols(the OS do that but not an interface) so it sounds like tun interface == tap interface: If I create two tap interfaces(with tunctl) with two ip that are on different networks (192.168.2.1/24 and 192.168.3.1/24), then I link these to two kvm virtual machine (one tap interface match to one VM) and if I enable routing on the host, my two VM can communicate. So tap interfaces can also be used for routing : what is the difference with tun ? maybe a tap is also a tun interface? Also I can create a tap interface with tunctl command but how can I create a tun interface with the same command(the command is called TUNctl not TAPctl...)? Moreover someone told me : > a TUN device is a virtual Ethernet adapter whereas a TAP device is a virtual > point-to-point IP link (in case these don't make sense, ask your search > engine what is the difference between point-to-point ip link and an > Ethernet) So i do research about point-to-point ip link and Ethernet link and i have others questions :   1. what is a "point-to-point ip link"? According to me, a point-to-point link is, when we have a network of several machine, the fact of communicate between two machines without the others machines know it. So I guess a "point-to-point ip link" is a specific case of one could call "layer 3 point-to-point link" meaning the point-to-point connection is ensure by the level 3 is that right?   2. if i have several PC connected to a switch by Ethernet , all links can be consider as "point-to-point ip link". the Wiki Ethernet page say a similar thing ("(...)which was designed for point-to-point links"). Same thing here : http://ethernetdirect.com/support_faqs.asp "Ethernet is a point to point network scheme" so what is the difference between "point-to-point ip link" and Ethernet link? Can you help me to clarify that? Thank you.


According to this documentation passenger is a native yum package since RHEL6. **Linux version and type**               [vagrant@localhost ~]$ cat /etc/*release     Scientific Linux release 6.5 (Carbon)     Scientific Linux release 6.5 (Carbon)      **Yum install Passenger** _Before installing RPM_               [vagrant@localhost ~]$ sudo yum search passenger     Loaded plugins: security     sl                                                       | 3.6 kB     00:00     sl-security                                              | 3.0 kB     00:00     sl-security/primary_db                                   | 4.5 MB     00:17     sl6x                                                     | 3.6 kB     00:00     sl6x-security                                            | 3.0 kB     00:00     sl6x-security/primary_db                                 | 4.5 MB     00:19     Warning: No matches found for: passenger     No Matches found      _After installing RPM_               [vagrant@localhost ~]$ sudo yum install mod_passenger -y     Loaded plugins: security     sl                                                       | 3.6 kB     00:00     sl-security                                              | 3.0 kB     00:00     sl-security/primary_db                                   | 4.5 MB     00:19     sl6x                                                     | 3.6 kB     00:00     sl6x-security                                            | 3.0 kB     00:00     sl6x-security/primary_db                                 | 4.5 MB     00:17     Setting up Install Process     No package mod_passenger available.     Error: Nothing to do      As passenger does not to be included in the yum repository, an attempt was done to install it using RPM, although this only should be required in case of RHEL 5 according the documentation. **RPM install** The RPM has been installed.               [vagrant@localhost ~]$ sudo rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm     Retrieving http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm     warning: /var/tmp/rpm-tmp.w5Z8Il: Header V4 DSA/SHA1 Signature, key ID 71e042e4: NOKEY     Preparing...                ########################################### [100%]        1:passenger-release      ########################################### [100%]      **Yum install after installing RPM**               [vagrant@localhost ~]$ sudo yum install mod_passenger -y                        Loaded plugins: security     http://passenger.stealthymonkeys.com/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     http://passenger.stealthymonkeys.com/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     http://mirror.hmdc.harvard.edu/mirrors/passenger/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     Error: Cannot retrieve repository metadata (repomd.xml) for repository: passenger. Please verify its path and try again      **Yum search**               [vagrant@localhost ~]$ sudo yum search passenger     Loaded plugins: security     http://passenger.stealthymonkeys.com/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     http://passenger.stealthymonkeys.com/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     http://mirror.hmdc.harvard.edu/mirrors/passenger/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     Error: Cannot retrieve repository metadata (repomd.xml) for repository: passenger. Please verify its path and try again      **6.5 directory unavailable** It appears that the 6.5. directory does not exist. ![enter image description here](http://i.stack.imgur.com/LQIYl.png) **Question** How to Install Passenger on Scientific Linux 6.5 via RPM?


title: A set of libraries like ncurses in a shell script

text: Supose you present the following `TUI` in the shell: ![enter image description here](http://i.stack.imgur.com/uuyqP.png) I need a set of libraries that can be used in the shell to do it. Being sure, `ncurses` has not been used, because it make a dependecy. Question: How to build the widget/window or another `TUI` in the shell?


title: Simulate x-screen?

text: I'm working in a koding terminal running ubuntu 13.04, and I'm trying to run an application that requires an x-screen (even to run in terminal mode). I am unable to connect with x11 forwarding, and I'm wondering if there is a workaround that will allow me to run this application (lmms).               $ lmms -v     lmms: cannot connect to X server      $ uname -a     Linux vm-2.masd.koding.kd.io 3.9.0-0-generic #4userns5 SMP Mon May 13 06:15:34 PDT 2013 x86_64 x86_64 x86_64 GNU/Linux     $ lsb_release -a     No LSB modules are available.     Distributor ID: Ubuntu     Description:    Ubuntu 13.04     Release:        13.04     Codename:       raring      Thanks in advance!


title: Let users create their own daemons

text: How do I let server's users create their own daemons? They should auto-start on boot and otherwise behave just like regular daemons but with lower privileges overall. I remember I saw a tool that let a user create a file in format similar to a crontab one with his wishes. The tool made sure the programs from the file would _be running at all times_. But now just couldn't find it's name. `nohup ./app &` just doesn't cut because it is won't autostart and the app won't restart automatically. Same as `@reboot` in user's `crontab`. The thing is that I don't want to reinvent a wheel. If there is something that does what I want in full, I would use it. And only if there is nothing, I would fall back to a hand-made approach. (I am using Debian stable, so I don't have systemd yet, as far as I understand.)


title: clone create date

text: I would like to clone only the create date and the filenames in source and destination are different. The name part of it is the same, it's the extension that isn't. AVI videos in one directory, MP4 in another. So I wanted to use `touch --reference=file1 file2`. works great on one file but I have about 100. Was hoping to script this but I am clueless. any help is appreciated. I do have a text file containing all the source filenames. Oh and lots of them have spaces and apostrophes in them too.


title: sh script will not execute as root (cron)

text: I have the following script added to `cron`. If I add `touch thisisatest.file` to the first line it will create a file named `thisisatest.file`, but not execute the rest of the code. If I manually type `./thescriptname.sh` as root the file will execute as it should. I added `/usr/bin` before `find`, `grep`, and `truncate` as suggested by someone, however the script still will not execute.               #!/bin/bash     KEYWORDS=("Word1" "Word2" "Word3" "Word4" "Word5")     IFS=$'\n'     /usr/bin/find /root/ . -size +1c -type f ! -exec /usr/bin/grep -qwF "${KEYWORDS[*]}" {} \; -exec /usr/bin/truncate -s 0 {} \;      `cronjob -l`:               SHELL=/bin/sh     PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin          */1 * * * *  /bin/sh /root/miami.sh     root@zzzz:~#


title: Shall I expect faster boot when I boot my system with run level 1

text: I understand that when I set runlevel as 1, my system will boot with very basic set of commands. Does that mean the system will boot faster as compared to run level 5 or 3?


title: Fastest way of find and replace in large file with replacing filed present in another file

text: I have two files. File1 is a csv with 60 fields:               111,Check1|^/h1/h2/h3,22062014184500,20,0.....     111,Check2|^/h43/h40/h9,22062014184500,4,.....     111,Check3|^/h1/h3/h4,22062014184500,0,0,.....      File2 is a mapping file:               OPUM04181,Check1|^/h1/h2/h3     OPUM04040235,Check3|^/h1/h3/h4     OPUM04051898,Check2|^/h43/h40/h9       Now what I have to do is in field 2 of file 1 I have to replace the field with the field 1 of file 1 of matching field 2. Example: In file1:               111,Check1|^/h1/h2/h3,22062014184500,20,0.....      will be               111,OPUM04181,22062014184500,20,0.....       where OPUM04181 and Check1|^/h1/h2/h3 is mapped in file2. My constraint is that File1 and file2 don't have the same set of values, their count is different. Also the line count is 3 million for both the files. This is what I was trying: I ran a loop taking field2 in file 1 I was checking if that field is present in file2. If present I took the field1 in file2. I was replacing the field2 in file1 using sed s///g. But this is taking enormous time. Also I can not sort File1. What is a faster method?


title: Linux kernel slab usage growing on embedded system

text: I'm in the process of QA/debugging a project on a custom embedded linux system. The problem we're VERY tight on memory, and even a couple megs can cause issues with our software. What I'm seeing (sometimes) is that when our system crashes (soft crashes), our own software isn't taking up any more memory than usual. But what's weird is that the linux kernel slab has a MUCH higher than normal number of objects in its 32byte slab cache:               size-32           103674 103734     32  113    1 : tunables  120   60    0 : slabdata    918    918      0      This is what the slab looks like under normal circumstances:               size-32             5400   6554     32  113    1 : tunables  120   60    0 : slabdata     58     58      0      Obviously that's a significant difference. I know there's not much information here, but this is really all the information I have to go on. Is there any way to determine what the slab contains? Or where it was allocated from or anything like that? Or maybe just force it to free its memory? This is running on an ARM based board with 64mB of ram running a 2.6.30 kernel. Btw, this is the entirety of what's running on the machine.               10711  8778 root     R     2980  4.9   0  0.0 top      8745  2740 root     S     6452 10.7   0  0.0 sshd: root@ttyp1      9411  2740 root     S     6312 10.4   0  0.0 sshd: root@ttyp2      2740     1 root     S     3704  6.1   0  0.0 /usr/sbin/sshd      8778  8745 root     S     2984  4.9   0  0.0 -sh     10034  9411 root     S     2984  4.9   0  0.0 -sh         1     0 root     S     2980  4.9   0  0.0 init      9432     1 root     S     2848  4.7   0  0.0 runsv ui      1115     1 root     S <   1576  2.6   0  0.0 udevd --daemon       989     2 root     SW<      0  0.0   0  0.0 [mmcqd]       223     2 root     SW<      0  0.0   0  0.0 [kswapd0]       175     2 root     SW<      0  0.0   0  0.0 [kblockd/0]       222     2 root     SW       0  0.0   0  0.0 [pdflush]       221     2 root     SW       0  0.0   0  0.0 [pdflush]         6     2 root     SW<      0  0.0   0  0.0 [khelper]         5     2 root     SW<      0  0.0   0  0.0 [events/0]       186     2 root     SW<      0  0.0   0  0.0 [khubd]         2     0 root     SW<      0  0.0   0  0.0 [kthreadd]       220     2 root     SW       0  0.0   0  0.0 [khungtaskd]         3     2 root     SW<      0  0.0   0  0.0 [ksoftirqd/0]         4     2 root     SW<      0  0.0   0  0.0 [watchdog/0]        12     2 root     SW<      0  0.0   0  0.0 [async/mgr]       189     2 root     SW<      0  0.0   0  0.0 [kseriod]       194     2 root     SW<      0  0.0   0  0.0 [kmmcd]       224     2 root     SW<      0  0.0   0  0.0 [aio/0]       225     2 root     SW<      0  0.0   0  0.0 [unionfs_siod/0]       226     2 root     SW<      0  0.0   0  0.0 [nfsiod]       227     2 root     SW<      0  0.0   0  0.0 [crypto/0]       895     2 root     SW<      0  0.0   0  0.0 [zd1211rw]       899     2 root     SW<      0  0.0   0  0.0 [mtdblockd]       972     2 root     SW<      0  0.0   0  0.0 [usbhid_resumer]       992     2 root     SW<      0  0.0   0  0.0 [rpciod/0]      and it's still growing               size-32           181312 181365     32  113    1 : tunables  120   60    0 : slabdata   1605   1605      0      **Update:**   This is the current state:               Mem: 38416K used, 21764K free, 0K shrd, 1836K buff, 11548K cached     CPU:  0.0% usr  0.0% sys  0.0% nic  100% idle  0.0% io  0.0% irq  0.0% sirq     Load average: 0.01 0.02 0.05 1/28 11050       PID  PPID USER     STAT   VSZ %MEM CPU %CPU COMMAND      8745     1 root     S     6452 10.7   0  0.0 sshd: root@ttyp1     11045     1 root     S     3704  6.1   0  0.0 /usr/sbin/sshd      8778  8745 root     S     2984  4.9   0  0.0 -sh         1     0 root     S     2980  4.9   0  0.0 init     11050  8778 root     R     2980  4.9   0  0.0 top       989     2 root     SW<      0  0.0   0  0.0 [mmcqd]       223     2 root     SW<      0  0.0   0  0.0 [kswapd0]       175     2 root     SW<      0  0.0   0  0.0 [kblockd/0]       222     2 root     SW       0  0.0   0  0.0 [pdflush]       221     2 root     SW       0  0.0   0  0.0 [pdflush]         6     2 root     SW<      0  0.0   0  0.0 [khelper]         5     2 root     SW<      0  0.0   0  0.0 [events/0]       186     2 root     SW<      0  0.0   0  0.0 [khubd]         2     0 root     SW<      0  0.0   0  0.0 [kthreadd]       220     2 root     SW       0  0.0   0  0.0 [khungtaskd]         3     2 root     SW<      0  0.0   0  0.0 [ksoftirqd/0]         4     2 root     SW<      0  0.0   0  0.0 [watchdog/0]        12     2 root     SW<      0  0.0   0  0.0 [async/mgr]       189     2 root     SW<      0  0.0   0  0.0 [kseriod]       194     2 root     SW<      0  0.0   0  0.0 [kmmcd]       224     2 root     SW<      0  0.0   0  0.0 [aio/0]       225     2 root     SW<      0  0.0   0  0.0 [unionfs_siod/0]       226     2 root     SW<      0  0.0   0  0.0 [nfsiod]       227     2 root     SW<      0  0.0   0  0.0 [crypto/0]       895     2 root     SW<      0  0.0   0  0.0 [zd1211rw]       899     2 root     SW<      0  0.0   0  0.0 [mtdblockd]       972     2 root     SW<      0  0.0   0  0.0 [usbhid_resumer]       992     2 root     SW<      0  0.0   0  0.0 [rpciod/0]                       size-32           191069 191083     32  113    1 : tunables  120   60    0 : slabdata   1691   1691      0


title: command for joining a series of files together

text: I have... > me@computer:~/gutenberg/euclid$ ls > > book01.html book04.html book07.html book10.html book13.html book02.html > book05.html book08.html book11.html book03.html book06.html book09.html > book12.html and I want to join all these .html files into the same big file, in order. What command or command sequence can I use?


title: How to find files in subdirs and sort them by filename in a single command?

text: Result of a normal find using `find . ! -path "./build*" -name "*.txt"`:               ./tool/001-sub.txt     ./tool/000-main.txt     ./zo/001-int.txt     ./zo/id/002-and.txt     ./as/002-mod.txt      and when sorted with `sort -n`:               ./as/002-mod.txt     ./tool/000-main.txt     ./tool/001-sub.txt     ./zo/001-int.txt     ./zo/id/002-and.txt      however the desired output is:               ./tool/000-main.txt     ./zo/001-int.txt     ./tool/001-sub.txt     ./zo/id/002-and.txt     ./as/002-mod.txt      which means output is sorted based on _filename only_ , but folder information should be maintained as part of the output. **Edit** : Make example more complicated as the subdirectory structure may include more than one level.


title: Installing mlocate on mac OS 10.7

text: I'm a beginner in using Linux. I'm trying to use the command "locate". Once I use this command, I get an error that says the locate database should be created. I used the command below to create that database, but I still get the same error:               sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist      I tried so many things including installing locate, but the commands work in Ubuntu seem not to work in mac os. Does anybody know what the issue is? Thanks in advance,


title: Carry-on Ubuntu Customization

text: Like most of us, I have several machines: at home, at work, for travelling... etc. I mainly write papers or books while I code. But I'm tired of svn'ing, rsync'ing and so on, so I've decided to carry a pendrive with me, with my Ubuntu customizations (bash, emacs, ...) and at the end of the day, do a rsnapshot. My question is: how do I minimally run my home directory from a pendrive? What should I put in there? Thanks for any input.


title: Network printer needs to be manually enabled after reboot

text: I've recently installed Debian squeeze on a new machine, and decided to try out the default gnome setup rather than attempt to do everything myself. I added a printer using _System > Administration > Printing_ -- it found my network printer just fine. However, when powering on the machine this printer is disabled. I have to go to the same dialog as above, enter the root password and enable the printer manually before jobs will be accepted. Any ideas on how to enable the printer automatically? Note that it's quite possible the printer is turned on _after_ the computer, if this makes a difference. Either way it would be nice if the computer noticed when the printer was turned on.


title: How to implement conditional update of deb package

text: I am creating a deb package of a product which is part open source and part proprietary. In order to reuse the built in functionality of some distributions like Ubuntu to monitor a list of repositories and update the package when a new version comes available I will probably create such a repository. The problem is that the proprietary part of the package depends on licenses which are valid for a limited interval versions (valid for all the versions in a course of a year). Which means that at some point of time when a new version is available it will be nice to at least warn the user that his license will not be valid for the new version. Is there a way to do that check and interact with the user? I see that there are scripts in the deb package itself that can be executed before installation, but I have no idea if they can interact with the user and abort the package installation. Any suggestions on how such a functionality can be created are appreciated.


title: use net instread of cdrom. linux, aptitude install

text: Got debian installed finally but during install I think I choose to use the local media over the internet for packages. needed to do that as was not sure if will try to connect right away (my modem needs a login). Now I want to install/ enable sudo and install other programs like thunderbird eclipse, and chrome. but I do not have sudo when I type the command,               aptitude install sudo      Get this message:               The following NEW packages will be installed:       sudo  0 packages upgraded, 1 newly installed, 0 to remove and 0 not     upgraded. Need to get 0 B/842 kB of archives. After unpacking 1,882 kB     will be used. Media change: Please insert the disc labeled 'Debian     GNU/Linux 7.1.0 _Wheezy_ - Official amd64 CD Binary-1 20130615-23:06'     into the drive '/media/cdrom/' and press [Enter].      Do not have a cdrom. What to do? Have root user password though logged in as another user.


title: Are commands executed through SSH transparent to a remote host's administrator?

text: Can administrators know what commands I execute **non-interactively** through SSH? For example: does `echo hello` get logged somewhere at `remote` if I run this?               $ ssh me@remote "echo hello"      Can remote commands be otherwise monitored?


title: awk - gensub function

text: I need to insert contents of variable to parameter function `gensub` in `awk`, specifically instead of regular expression's parameter. Can you help me with it? I have:               gawk '      BEGIN {        a = "abc15d56ef";        b = gensub(/.*([0-9][0-9])d([0-9][0-9]).*/, "\\2 \\1", "g", a);        print b;      }'      ### output               output:56 15      I need it to be in this form, but it doesn't work:               gawk '      BEGIN {        a = "abc15d56ef";        c="/.*([0-9][0-9])d([0-9][0-9]).*/";        b = gensub(c, "\\2 \\1", "g", a);        print b;      }'      ### output               output:56 15


title: startx results in blank screen

text: I just installed Xorg on Arch Linux but when I run startx, I only get a blank screen. What could be the problem here?


title: Processing control characters

text: I have a log file which contains a bunch of non visible control characters such as hex \u0003. I would like to replace this using something like SED, but can't get the first part of the regex to match: > /s/^E/some_string I am creating the ^E by pressing CTRL-V CTRL-0 CTRL-3 to create the special character, as read from the 'man ascii' page: > 003 3 03 ETX However, nothing matches this control character. Any help appreciated!


title: using cron to run script

text: Hey guys, im trying to run a script using cron, im using a crontab created by the user ashtanga, in the crontab i have               */5 * * * *  /home/custom-django-projects/SiteMonitor/sender.py      in top of the script i have:               #!/usr/local/bin/python      and the user ashtanga does have executable permission to the file, but cron is not running the script, its giving me the error:               /bin/sh: /home/custom-django-projects/SiteMonitor/sender.py: No such file or directory      so my question is, how can i get cron to run the script ?


title: Redhat Enterprise Linux 4.7 - Ping problem

text: When I try to ping some of the IP addresses I get "connect: No buffer space is available" error. Also when I check /var/log/messages, there are some errors like as following               printk: 99 messages overflow     kernel: Neighbour table overflow      do you have any ideas about this problem?


title: sed regexp HEX char

text: i have this string:                echo -e "a12\x8fb12\x9f"|xxd     0000000: 6131 328f 6231 329f 0a                   a12.b12..      i want delete this sequence string `12\x9f` and `12\x8f` with `sed`. i can do it with this command `sed -e 's_12\x8f__g' -e 's_12\x9f__g'` but why this command dose not work?               sed -e 's_12[\x8f\x9f]__g'


title: How to update remote file?

text: I need to update the contents of a file on a remote host from my local Linux machine. How can i do this?


title: Installing debian on existing ubuntu - will /home folder be removed?

text: I want to install Debian with LXDE on partition, that already have Ubuntu 11.04 installed. I have a lot of music there, and I don't want copy it to another partition. I know that Debian installer will propt that on this partition is already linux installed, but will it remove all from my /home/ folder if I type the same username in setup? Or should I have to encrypt this folder?


title: Are there any other Linux distributions that automatically get UEFI right?

text: Recently I've been trying many different linux distros, and the only one that can setup UEFI correctly out of the box is Fedora. There is 0 tweaking involved. Somehow it just automatically knows if a computer can support UEFI mode or not and automatically sets up the gpt partitions and everything. Are there any other Linux distros that will also correctly setup UEFI mode upon installation?


title: What does the commands sudo, apt-get, install, and fakeroot stand for?

text: I am a newbie to Linux and I am trying to build a custom kernel on ubuntu and I saw this document and it said I needed to install the packages https://help.ubuntu.com/community/Kernel/Compile               To start, you will need to install a few packages. The exact commands to install those packages depends on which release you are using:          Hardy (8.04):           sudo apt-get install linux-kernel-devel fakeroot kernel-wedge build-essential     Note: The package makedumpfile is not available in Hardy.          Lucid (10.04):                sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge     sudo apt-get build-dep linux     sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev     sudo apt-get install linux-kernel-devel fakeroot kernel-wedge build-essential      > **sudo** = permits users to execute command as super user   >  **apt-get** = Get a package from the Advance Packing Tool ( something like > extract a package from a library kind of I believe)   >  **Install** - Operation to do   >  **linux-kernel-devel - ??????????????( what does this mean)**   >  **fakeroot** - Lets user do file manupulations as a fake user.   >  **kernel-wedge build-essential - ??????????????( what does this mean)** How and where can I see the meaning or function for every command in a document? Thanks in advance


title: xmodmap hanging the system for 20 secs and not sticking

text: I edited the keyboard map using xmodmap as per https://wiki.archlinux.org/index.php/Xmodmap, and I have two problems: executing `xmodmap ~/.Xmodmap` completely hangs the system for 15-25secs, which seems a bit odd considereing I'm just remapping the keyboard, and the changes don't stick on logoff, and not even on suspend. It's a pain in the ass for my boot time to be increased by 20 secs or more, plus having to run it everytime I wake up from suspend. Is this normal (I don't really think so?) and is there anything I can do, perhaps an alternative way to remap the keyboard? Linux Mint 15 x64 Cinnamon


title: Why does the Debian installation manual suggest to do "sync" after raw copy of image file to USB key?

text: According to the Debian installation manual, section 4.3, the hybrid installation ISO image can be easily copied on a USB key this way:               # cp debian.iso /dev/sdX     # sync      But according to my previous question about `sync`, it looks like it only works to flush _file system_ buffers. Then, **why would`sync` work in the above command which does not involve a file system?**


title: Script to login to ssh twice

text: I need to login through `ssh` twice with a script and can't get it to work. This is what I have in my script file:               #!/usr/bin/expect          set login "user"     set addr "address1"     set addr2 "address2"     set pw "password"          spawn ssh $login@$addr     expect "$login@$addr\'s password:"     send "$pw\r"     expect "$login@host:"     spawn ssh $addr2     expect "$login@$addr\'s password:"     send "$pw\r"     interact      but this fails with the error:               user@host:~$ ssh: Could not resolve hostname address2: Name or service not known     send: spawn id exp7 not open         while executing     "send "$pw\r""      If I change the line `spawn ssh $addr2` with `exec ssh $addr2` it fails with the error:               user@host:~$ ssh: Could not resolve hostname address2: Name or service not known         while executing     "exec ssh $addr2"      What do I need to change in order to make this work?


title: fluxbox keyboard switch german, greek (modern) and polytonic greek

text: Where can i find a list of keyboard-layout codes to switch between german, greek (modern) and polytonic greek in fluxbox menu?               vim ~/.fluxbox/menu          [begin] (fluxbox)     [include] (/etc/X11/fluxbox/fluxbox-menu)     [submenu] (Keyboards)     [exec] (de) {setxkbmap de}     [exec] (greek) {setxkbmap greek}     [exec] (polytonic greek) {setxkbmap polytonic greek}     [end]


title: Can't set a blacklist for usb autosuspending

text: I'm trying to disable usb autosuspend for my wireless USB mouse:               CONTROL_USB_AUTOSUSPEND="auto"     AUTOSUSPEND_USE_WHITELIST=0     AUTOSUSPEND_USBID_BLACKIST="046d:c52f"      I already put these values to `/etc/laptop-mode/conf.d/usb-autosuspend.conf`, and restarted `laptop-mode`, but that just don't work (it still stuck for one second when I move my mouse)


title: Is there a robust command line tool for processing csv files?

text: I work with CSV files and sometimes need to quickly check the contents of a row or column from the command line. In many cases `cut`, `head`, `tail`, and friends will do the job; however, cut cannot easily deal with situations such as               "this, is the first entry", this is the second, 34.5      Here, the first comma is part of the first field, but `cut -d, -f1` disagrees. Before I write a solution myself, I was wondering if anyone knew of a good tool that already exists for this job. It would have to, at the very least, be able to handle the example above and return a column from a CSV formatted file. Other desirable features include the ability to select columns based on the column names given in the first row, support for other quoting styles and support for tab-separated files. If you don't know of such a tool but have suggestions regarding implementing such a program in Bash, Perl, or Python, or other common scripting languages, I wouldn't mind such suggestions.


title: Extract given column from comma-separated values with inner commas and quotation marks

text: I have a file in which the fields are separated by comma. Some example input:               col1,"1,2",col3     col1,"1,2,3",col3     col1,"1  2,3",col3     col1,"1 "2,3"",col3      Now, I have to fetch the second column, so that I get:               "1,2"     "1,2,3"     "1  2,3"     "1 "2,3""      `cut -d, -f2 file` doesn't do what I want. So, how can I retrieve column 2 from the above input?


title: Handling comma in string values in a CSV file

text: I have a comma-separated file which has numeric and string columns. String columns are quoted and can have comma in between the quotes. How do I identify the columns with `FS =","`? Sample records               "prabhat,kumar",19,2000,"bangalore,India"      In AWK it should be               $1 = "prabhat,kumar"     $2 = 19     $3 = "2000"     $4 = "bangalore,india"      Setting `FS=","` is creating the problem. Input is:               "prabhat,kumar",19,2000,"bangalore,India","ABC,DEF","GHI",123,"KLM","NOP,QRS"     "prabhat,kumar",19,2000,"bangalore,India","ABC,DEF","GHI",123,"KLM","NOP,QRS"      Output should be:               "prabhat,kumar"|19|2000|"bangalore,India"|"ABC,DEF"|"GHI"|123|"KLM"|"NOP,QRS"     "prabhat,kumar"|19|2000|"bangalore,India"|"ABC,DEF"|"GHI"|123|"KLM"|"NOP,QRS"      Code I am trying:               awk -F"," '{for(i=1;i<=NF;i++){if(i%NF==0){ORS="\n"} {if($i ~ /^\"/ || $i ~ /\"$/) {a=a OFS $i;j++;{if(j%2==0){sub(/^\,/,X,a); print a;j=0;a=""}}} else {print $i}}} {ORS="|"}}' ORS="|" OFS=, p.txt


title: Parse csv using awk

text: > **Possible Duplicate:**   >  Is there a robust command line tool for processing csv files? I am trying to parse the second line in a file (which contains commas within double quotes) > "100 Watt A19 10,000 Hour - Clear Light Bulb",American-Light-Bulb- > Mfg,552,Indoor Living>Home Furnishings>Lighting>Light Bulbs,"Product Code: > H20821 Energy Used: 100 Watts Rated Life: 10,000 Hours Volts: 130 Base: E26 > - Medium Screw (standard household base) Length: 4.45 Inches Diameter: 2.375 > Inches Bulb Type: > A19",1.75,Yes,http://www.buylighting.com/ProductDetails.asp?ProductCode=H20821&click=104182,http://www.buylighting.com/v/vspfiles/photos/H20821-2T.jpg,,New,,,0.1,H20821,,,,,,,,,,,,,,,,.25,Absolute,,,,,,,               head -2 file.csv | tail -1 | awk -F',' '{print $1}'      But it outputs:               "100 Watt A19 10      How can I use `awk` to get `"100 Watt A19 10,000 Hour - Clear Light Bulb"` as the value of `$1`? Also how can I use `awk` to get `"Product Code: H20821 Energy Used: 100 Watts Rated Life: 10,000 Hours Volts: 130 Base: E26 - Medium Screw (standard household base) Length: 4.45 Inches Diameter: 2.375 Inches Bulb Type: A19"` as the value of $5?


title: Convert Amazon .pem key to Putty .ppk key Linux

text: I have generated and downloaded a private `.pem` key from AWS. However, to use Putty in order to connect to the virtual machine, I must have that key in `.ppk` format. The process of conversion is detailed in roughly 20 lines here:   * http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html#prepare-for-putty I am using Linux Mint (an Ubuntu distro) and I know I can use puttygen in the terminal. However, I have no idea how to use this tool, nor how to configure the needed parameters. When I type puttygen --help I get               PuTTYgen unidentified build, Aug  7 2013 12:24:58     Usage: puttygen ( keyfile | -t type [ -b bits ] )                     [ -C comment ] [ -P ] [ -q ]                     [ -o output-keyfile ] [ -O type | -l | -L | -p ]       -t    specify key type when generating (rsa, dsa, rsa1)       -b    specify number of bits when generating key       -C    change or specify key comment       -P    change key passphrase       -q    quiet: do not display progress bar       -O    specify output type:                private             output PuTTY private key format                private-openssh     export OpenSSH private key                private-sshcom      export ssh.com private key                public              standard / ssh.com public key                public-openssh      OpenSSH public key                fingerprint         output the key fingerprint       -o    specify output file       -l    equivalent to `-O fingerprint'       -L    equivalent to `-O public-openssh'       -p    equivalent to `-O public'      But I have no idea whatsoever on how to do what the website tells me to do and all my tentatives failed so far. How do I do what the website tells me to do, using puttygen on the terminal?


title: How do you kick a benign user off your system?

text: I was googling this a bit ago and noticed a couple of ways, but I'm guessing that google doesn't know all. So how do _you_ kick users off your Linux box? also how do you go about seeing they are logged in in the first place? and related... does your method work if the user is logged into an X11 DE (not a requirement I'm just curious)?


title: debian does not detect serial PCI card after reboot

text: I have installed a PCI card with two serial and one parallel port on it. the chipset is `MCS9865`. I downloaded the latest driver(V1.0.12) from here. I ran `make` and `make install`. now the two serial ports are `/dev/ttyD0` and `/dev/ttyD1`. I have tested them with `picocom` and it is working perfectly. the problem is that when I reboot the system there is no `/dev/ttyD0` and `/dev/ttyD1`. I need to do another `make install`. Is there any solution? output of `lspci -v` shows this:               03:01.0 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02 [16550])         Subsystem: Device a000:1000         Flags: bus master, medium devsel, latency 32, IRQ 19         I/O ports at df00 [size=8]         Memory at fbeff000 (32-bit, non-prefetchable) [size=4K]         Memory at fbefe000 (32-bit, non-prefetchable) [size=4K]         Capabilities: [48] Power Management version 2         Kernel driver in use: mcs9865-serial          03:01.1 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02 [16550])         Subsystem: Device a000:1000         Flags: bus master, medium devsel, latency 32, IRQ 18         I/O ports at de00 [size=8]         Memory at fbefd000 (32-bit, non-prefetchable) [size=4K]         Memory at fbefc000 (32-bit, non-prefetchable) [size=4K]         Capabilities: [48] Power Management version 2         Kernel driver in use: mcs9865-serial          03:01.2 Parallel controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 03 [IEEE1284])         Subsystem: Device a000:2000         Flags: bus master, medium devsel, latency 32, IRQ 7         I/O ports at dd00 [size=8]         I/O ports at dc00 [size=8]         Memory at fbefb000 (32-bit, non-prefetchable) [size=4K]         Memory at fbefa000 (32-bit, non-prefetchable) [size=4K]         Capabilities: [48] Power Management version 2      `make install` shows this:               cp mcs9865.ko mcs9865-isa.ko /lib/modules/2.6.32-5-amd64/kernel/drivers/serial/     depmod -A     chmod +x mcs9865     cp mcs9865 /etc/init.d/     ln -s /etc/init.d/mcs9865 /etc/rcS.d/S99mcs9865 || true     ln: creating symbolic link `/etc/rcS.d/S99mcs9865': File exists     modprobe mcs9865     modprobe mcs9865-isa      I'm running debian 6.0.5 with most updated packages.


title: Importance of fsck at boot with Journalled filesystems?

text: I noticed that XFS does not implement a fsck at system boot and one of the reasons touted in that journaling file-systems help ensure the file-system is in a consistent state after an unclean shutdown; on the next mount (e.g. after reboot) the journal is replayed. Is a fsck still needed after an unclean shutdown and why?


title: How do I install openSUSE 12.1 from an external hard disk?

text: For some reason, my laptop (HP ProBook 5320m) refuses to boot when I install the ISO images for openSUSE 12.1 on an USB stick (the stick starts to blink and then the internal fan goes into overdrive and I have to switch off the laptop). I also tried the NET version, different USB sticks, no game. Currently, openSUSE 11.4 is installed on the laptop, is it's not _impossible_ to install. My guess is that something was changed in the 12.1 release which the BIOS of the laptop doesn't like. So my last hope is to create a bootable external hard disk but when I look into the folder `/boot` of the ISO image, I can't find GRUB or anything that I recognize. Questions:   1. Is there a way to replace the ISO boot loader with GRUB?   2. Is there some other way to install 12.1 on openSUSE 11.4? Ubuntu can do a dist upgrade in the running system, for example. Is something like that possible with openSUSE, too?   3. Could I boot with the installer for 11.4 and somehow make it use the installation files for 12.1? PS: Dear HP engineers. Your BIOS looks great but I'd prefer one that works. Just saying :-(


title: Builiding a UEFI bootable USB

text: I'm having a really hard time getting Mint13 installed on my new laptop, no optical UEFI support and having odd corruption of grub.cfg when I do try and use unetbootin. Is there a method to build a UEFI bootable USB drive that I can place the Mint13 iso on? Is below sane sounding?               $ sudo mount /dev/sdb1 /mnt     $ sudo mkdir /mnt/boot     $ sudo mkdir /mnt/boot/efi     $ sudo grub-install --boot-directory=/mnt     $ sudo mkdir /mnt/iso/     $ sudo mkdir /mnt/boot/grub/scripts      Save autoiso.cfg script in the /mnt/boot/grub/scripts               Then echo 'configfile /boot/grub/scripts/autoiso.cfg' >> /mnt/boot/grub/grub.cfg


title: Why is ping so slow?

text: My setup: Server in the cellar + GBit switch. Long cable to the roof. GBit switch. I have three computers in the roof. One has only 100MBit ethernet, one laptop with GBit and a new computer. Ping times from the old 100MBit computer: 0.5ms on average Ping times from laptop: 0.4ms on average Ping times from my new computer: 5ms or 30ms or 200ms on average but I often see ping times up to 980ms. In general, the throughput is very unstable. I replaced the switch in the roof. No change. I replace the cable which connects the new computer to the roof switch. No change. I installed a PCI network card with an Intel GBit chip (82541PI) and used that instead of the built in Realtek RTL8111/8168B. No change. Yes, I'm sure that I plugged the cable into the correct port because I now get a different IP address from my DHCP server. The very same network card worked perfectly find on my old computer using the same operating system (openSUSE 12.1). `ifconfig` says:                     UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:15679 errors:0 dropped:0 overruns:0 frame:0           TX packets:13077 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 Sendewarteschlangenlänge:1000       `ethtool` says:                   Speed: 1000Mb/s         Duplex: Full         Port: Twisted Pair      What could be causing this behavior? **[EDIT]** I found something interesting:               # cat /proc/interrupts                 CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7              0:        178          0          0          0          0          0          0          0  IR-IO-APIC-edge      timer       1:          6          0          0          0          0          0          0          0  IR-IO-APIC-edge      i8042       8:          1          0          0          0          0          0          0          0  IR-IO-APIC-edge      rtc0       9:          0          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   acpi      12:         10          0          0          0          0          0          0          0  IR-IO-APIC-edge      i8042      16:    3302428          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   ehci_hcd:usb1, nvidia, mei, eth1      17:        184          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   snd_hda_intel      23:      16721          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   ehci_hcd:usb2      As you can see, interrupt 16 serves one USB port, the graphics card, "mei" (?) and `eth1`. I guess that would explain why it's slow. How do I assign interrupts in 2012?


title: How to iterate through a comma-separated list and execute a command for each entry

text: I have been give a command which outputs a comma-separated list for autosys jobs in the variable `$all_jobs`:               box=box-of-jobs;all_jobs=$(jobscout -box $box | egrep "^\w+" | tr '\n' ','  | sed s/.$//);       I want to call a sendevent command for each item in the list:               sendevent -verbose -S NYT -E JOB_OFF_HOLD -J $job --owner me      So for example if `$all_jobs` evaluated job1,job2,job3 I want to call               sendevent -verbose -S NYT -E JOB_OFF_HOLD -J job3 --owner me     sendevent -verbose -S NYT -E JOB_OFF_HOLD -J job2 --owner me     sendevent -verbose -S NYT -E JOB_OFF_HOLD -J job1 --owner me      I'm sure I could write a ksh script to loop through, but I know these things can often be written much faster using awk/sed, both of which I'm not very familiar with so it's beyond my megre skills. I'm using ksh (rather than bsh).


title: executing multiple greps in a single find command

text: I want to use find command to find some files containing multiple patterns at the same time. I tried something like this:               find . -name "*.xml" -exec grep -iH keyword1 + && grep -iH "keyword2" {} \;      But the above command doesn't work. Is it possible to do it in bash?


title: Configuration management, shared files, etc with a Laptop

text: I have a couple computers sitting around in my home network. They all run the same version of Ubuntu, and I would like to unify their configuration to some extent. At my university, you can log in to any computer with your university account and have all your data right there. I assume they use central authentication and have `/home` mounted over the network. That is what I would like to have to some extent. The problem is that the computers I and my girlfriend use the most are laptops that are taken out of the house regularly. So logging in over the network only is not really an option. Having no files locally is not an option either. I would like to use the computers that I have for a HTCondor cluster, but most jobs will end up on my laptop since it is the fastest machine. I assume that it is a problem if it is not connected to the network occasionally. Is it possible to have   * the same user accounts (and passwords, if that makes sense)   * some common files (maybe `/common/$USER`)   * common set of installed packages   * giving computing power to the HTCondor pool on all machines without coupling them so tightly that they do not function outside the network? I have heard the buzzwords keberos, nfs, sshfs, btsync, chef, puppet, nagios, ldap, but I am not sure whether the core idea makes sense in the first place, i. e. whether it would actually save work instead of creating even more.


title: What does the "interruptible sleep" state indicate?

text: I had Firefox running on a Parted Magic LiveCD, then (possibly) as a result of a key combination I don't recall, it quickly vanished from screen and Task Bar/Window List. However:   1. `ps ax | grep firefox` returns the below (and the unneeded `grep firefox` line). Both `ps` and the GUI Task Manager, show firefox with seemingly unchanging RSS, VM-SIZE and 0% CPU usage.              johndoe      1916 36.6 14.0 923772 504372 tty1    Sl   13:30  12:15 firefox      2. `pstree | grep firefox` returns:              init─┬─2*[ROX-Filer───firefox───25*[{firefox}]]      3. `strace -p 1916` returns, and seemingly stays on this line forever: `futex(0xac975608), FUTEX_WAIT_PRIVATE, 1, NULL` I understand from an answer to What do the STAT column values in ps mean? that `S` (in `Sl`) indicates that the process is in an `interruptible sleep` state. Can anyone elaborate as to what the state is, in more detail? **EDIT** I will start a new question, with more specifics on my distro, to address the original 2nd question.


title: Unable to transfer files via SFTP when using a normal user account

text: I'm unable to transfer files via `WINSCP>sftp` to a GNU/Linux server. When transferring a file using root account, there's no problem. However, when I transfer using another account, the file being transferred shows 0 bytes and nothing happens when opening it. The folder I transfer files is `/home/avex` and the account I'm using to transfer is _avex_. I've verified that the folder has read and write permission and the owner of `avex` folder is _avex_ user. What would be the cause for such output here? and How do I transfer the file under _avex_ user ?


title: Several groups can have the same groupID?

text: 0:root@SERVER:/root # grep 300 /etc/group     ipsec:!:300:admgrp     0:root@SERVER:/root #       ?? Several groups (ipsec/admgrp) can have the same groupID (300)?? how can this be? /AIX 6.1/


title: KMail extremely slow/frozen when operating on local maildir folder

text: KMail seemingly freezes when trying to open a message or executing any command on the local email folders (maildir) such as moving or marking of messages. Sometimes the triggered action is executed with very long delay or when restarting akonadiserver. Furthermore, Akonadi and the attached MySQL server are busy (but not fully occupied). For me, the problem probably came up after switching from MySQL to MariaDB on Arch Linux or after an update from KDE 4.11.1 to 4.11.2. The special issue here is that there is no specific error message or warning in Akonadi or KMail related to the source of the problem. Moreover, neither re-initializing all Akonadi databases nor re-installing or even downgrading kdepim packages solves the problem.


title: Why do I get this message whenever I open a terminal?

text: I keep getting this strange message when I open a terminal:               me@batcuter:~$      Message from syslogd@batcuter at Apr 21 14:10:38 ...       such IMContext          Message from syslogd@batcuter at Apr 21 14:10:38 ...       such IMContext          Message from syslogd@batcuter at Apr 21 14:10:43 ...       invalid char is given at scim_bridge_string_to_uint (): -          Message from syslogd@batcuter at Apr 21 14:10:43 ...      valid message: Close the connection.      I have no idea what's happening...   1. Where can I read these logs?   2. Should I be afraid of a malicious cyberattack?


title: vi: how to use a line as a command?

text: cat a.txt     echo hi     echo hu     echo ha      **Q:** how can I execute ex.: the second line in a.txt when it is opened with vi? so "vi a.txt" -> then SOMEMAGICCOMMAND -> then the "echo hu" is executed as a command. How?


title: Cron log on debian systems

text: On Redhat systems cron logs into `/var/log/cron` file. What is the equivalent of that file on Debian systems?


title: How can I improve nscd's cache hit rate?

text: **My Goal:** Let nscd maintain a fairly large DNS cache in excess memory since I have it available. **Description:** I have a webserver that has a broadly dispersed but high-repeat user base. It has plenty of memory so I thought I'd improve response time by caching lookups but according to `nscd -g` I'm only at a 6% cache hit rate (meaning `nscd` is most likely introducing more latency saving to the cache or looking through the cache for an entry it will never find, than it's preventing by going out to the network):               hosts cache:                      yes  cache is enabled                 yes  cache is persistent                 yes  cache is shared                 211  suggested size              216064  total data pool size                2328  used data pool size               36000  seconds time to live for positive entries                  20  seconds time to live for negative entries                4455  cache hits on positive entries                   0  cache hits on negative entries               17357  cache misses on positive entries               42348  cache misses on negative entries                   6% cache hit rate                  17  current number of cached values                  40  maximum number of cached values                   3  maximum chain length searched                   0  number of delays on rdlock                   0  number of delays on wrlock                   0  memory allocations failed                 yes  check /etc/hosts for changes      Probably a large contributor to the 6% hit rate is the fact that apparently it's only cached 17 entries. Doing a `strings /var/db/nscd/hosts` shows that the host cache entries it has created are mostly for machines on our internal network. It's good to have these cached since the daily re-publish of the website is likely sped up but my goal is to speed up end user experience without making any real configuration changes. This is the relevant segment of `nscd.conf`:                   threads                 10         server-user             nscd         debug-level             0         paranoia                no         [.....snip......]         enable-cache            hosts           yes         positive-time-to-live   hosts           36000         negative-time-to-live   hosts           20         suggested-size          hosts           10657         check-files             hosts           yes         persistent              hosts           yes         shared                  hosts           yes         max-db-size             hosts           33554432      Basically, I need help understanding how my host cache can be so small even though I've set the positive TTL's on the host cache to be incredibly high. I'm sure it's the small number of actual cached entries that is causing the hit rate to be so low. I'm assuming since the hit rate is 6% but my positive TTL is fairly large, that means my current workload _is_ performing DNS host lookups, but they're just not being save. I have no idea why these aren't being saved nor what to check next. What I had expected would be a fairly large DNS cache now. Even if the hit rate stayed small (i.e: clients weren't repeating as often as I thought) I'd still expect _those_ DNS lookups to be cached but looking at the "current number of cached values" that doesn't appear to be happening either.


title: Perform Cisco's DNS Doctoring on FreeBSD

text: How to perform a change in the DNS response from a DNS server to be a different IP address than the DNS server actually answered for a given name? http://www.cisco.com/en/US/products/hw/vpndevc/ps2030/products_tech_note09186a0080094aee.shtml Currently using PF (Packet Filter) on FreeBSD 9.0-RELEASE. Please help.


title: How to disable auto suspend when I close laptop lid?

text: I'm using archlinux. It never auto-suspend before a recent system upgrade(maybe I updated the kernel?). I think it is related to `laptop-mode` or `acpid`, so I stop them:               /etc/rc.d/laptop-mode stop     /etc/rc.d/acpid stop      I also edit `/etc/laptop-mode/laptop-mode.conf`:               ENABLE_LAPTOP_MODE_TOOLS=0      Then I edit `/etc/acpi/actions/lm_lid.sh`, commented out the last line:               # /usr/sbin/laptop_mode auto      But all of above don't work. Following lines were found in `/var/log/kernel.log`(unrelated lines omitted):               Oct 23 15:29:20 localhost kernel: [18617.549098] PM: Syncing filesystems ... done.     Oct 23 15:29:20 localhost kernel: [18618.001898] PM: Preparing system for mem sleep     Oct 23 15:29:30 localhost kernel: [18618.039565] Freezing user space processes ... (elapsed 0.01 seconds) done.     Oct 23 15:29:30 localhost kernel: [18618.052596] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.     Oct 23 15:29:30 localhost kernel: [18618.065999] PM: Entering mem sleep     Oct 23 15:29:30 localhost kernel: [18618.066167] Suspending console(s) (use no_console_suspend to debug)     Oct 23 15:29:30 localhost kernel: [18618.097917] sd 0:0:0:0: [sda] Synchronizing SCSI cache     Oct 23 15:29:30 localhost kernel: [18618.098103] sd 0:0:0:0: [sda] Stopping disk     Oct 23 15:29:30 localhost kernel: [18618.270537] snd_hda_intel 0000:00:14.2: power state changed by ACPI to D3hot     Oct 23 15:29:30 localhost kernel: [18619.274374] PM: suspend of devices complete after 1196.192 msecs     Oct 23 15:29:30 localhost kernel: [18619.274691] PM: late suspend of devices complete after 0.313 msecs     Oct 23 15:29:30 localhost kernel: [18619.440877] ohci_hcd 0000:00:14.5: wake-up capability enabled by ACPI     Oct 23 15:29:30 localhost kernel: [18619.642144] ACPI: Waking up from system sleep state S3     Oct 23 15:29:30 localhost kernel: [18620.049424] PM: noirq resume of devices complete after 333.503 msecs     Oct 23 15:29:30 localhost kernel: [18620.049852] PM: early resume of devices complete after 0.334 msecs     Oct 23 15:29:30 localhost kernel: [18622.418605] PM: resume of devices complete after 2371.906 msecs     Oct 23 15:29:30 localhost kernel: [18622.419018] PM: Finishing wakeup.     Oct 23 15:29:30 localhost kernel: [18622.419019] Restarting tasks ... done.     Oct 23 15:29:30 localhost kernel: [18622.464752] video LNXVIDEO:01: Restoring backlight state      I think this is not caused by `pm-susend`, because `/var/log/pm-suspend.log` don't log anything. I don't want my laptop go to sleep when I close the lid. How to do it? Kernel version: 3.6.2-1-ARCH


title: Backup & restore from Linux to Windows while Linux is running

text: I have a lab with some Linux machines, some are Red Hat 5.1 machines installed on HPDL580 HW, and some are Linux installed on BLADE IBM machines. Also I have laptop computer with Windows XP. My question: I want to backup the Linux machine as an image on my Win laptop, and then I need to restore the image to another HW, while the Linux machine I am restoring from must be up during backup process (I mean I can't shutdown the Linux machine). Please advice which free tool/application I can run on my Win XP laptop in order to backup the Linux machine and then restore to a second Linux machine from the imgae located on my Windows XP laptop. What is the best free tool for that?


title: Most efficient grep method

text: Currently I am grepping data from a file containing any of the following:               342163477\|405760044\|149007683\|322391022\|77409125\|195978682\|358463993\|397650460\|171780277\|336063797\|397650502\|357636118\|168490006...............      This list is longer and contaings ~700 different values. What is the most efficient way of extracting it? I can chop it in parts of 10/20/50/100... Or are there other unix methods? This grep is piped to python for further analysis which goes fast enough.


title: What does exit do in an if block in a shell script?

text: I have a question regarding unix shell script. Say if you do `exit 1` in inner `if`: will it exit or will it still execute the outer `if`? The following is a dummy example.               if [ "$PASSWORD" == "$VALID_PASSWORD" ]; then         if [ "$PASSWORD" -gt 10]; then             echo "password is too large!"             exit 1         fi         echo "You have access!"         exit 1     fi


title: Full Linux distro under 50 MB for a business card CD

text: I need a full Linux distribution for a non-profit activist organisation that can fit on a business card CD. If that's not possible, there is a business card DVD option too with up to 400 MB capacity. But I would really prefer CD over DVD if such spartan Linux distribution under 50 MB exist.


title: Cannot install rsync (unable to create...Input/output error)

text: How do I resolve the following error to get `rsync` installed? `unable to create '/usr/bin/rsync.dpkg-new' (while processing './usr/bin/rsync'): Input/output error` Full log follows:               ubuntu@explorer:~$ uname -a     Linux explorer 3.8.2-g659a590 #1 SMP PREEMPT Tue Sep 24 02:38:40 PDT 2013 armv7l armv7l armv7l GNU/Linux          ubuntu@explorer:~$ sudo apt-get install rsync     sudo: unable to resolve host explorer     Reading package lists... Done     Building dependency tree     Reading state information... Done     The following NEW packages will be installed:       rsync     0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.     Need to get 0 B/282 kB of archives.     After this operation, 516 kB of additional disk space will be used.     (Reading database ... 27315 files and directories currently installed.)     Unpacking rsync (from .../rsync_3.0.9-4_armhf.deb) ...     dpkg: error processing /var/cache/apt/archives/rsync_3.0.9-4_armhf.deb (--unpack):      **unable to create `/usr/bin/rsync.dpkg-new' (while processing `./usr/bin/rsync'): Input/output error**     dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)     Processing triggers for ureadahead ...     Errors were encountered while processing:      /var/cache/apt/archives/rsync_3.0.9-4_armhf.deb     E: Sub-process /usr/bin/dpkg returned an error code (1)      Running Linux for Tegra.


title: Can I read and write to the same file in Linux without overwriting it?

text: > **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output? I frequently connect to amazon ec2 using their public DNS names   (`ec2-12-34-56-78.compute-1.amazonaws.com`) and because of this my `known_hosts` file gets overwhelmed with a lot of `ec2` entries I will never use again. I know I could probably use `sed -i` to edit in place but I wanted to use `grep` and so I did this:               grep -v ec2 ~/.ssh/known_hosts > ~/.ssh/known_hosts      That leaves `known_hosts` as an empty file. If I do:               grep -v ec2 ~/.ssh/known_hosts > ~/.ssh/tmp     mv ~/.ssh/tmp ~/.ssh/known_hosts      then things are fine, but I am confused why reading and writing to the same file leaves it blank, and if there is any way around this when using `grep`, `cat`, etc.


title: Redirecting tr stdout to a file

text: > **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output?   >  Can I read and write to the same file in Linux without overwriting it?               $ cat test.txt      This is a test file.     $ tr 'a' 'z' < test.txt      This is z test file.     $ tr 'a' 'z' < test.txt > test.txt     $ cat test.txt     $       Why does tr seem to output nothing to test.txt? I found this thread, but I don't really understand what is going on, and how to fix the problem. (Also, the reason I'm not using sed is because I want to replace newlines with another character, and I don't think sed can operate on a non-line-by-line basis?)


title: Redirecting head output for update hosts file

text: > **Possible Duplicate:**   >  How can I make iconv replace the input file with the converted output? I'm writing a script to change the content of my `hosts` file but I got stuck on the `head` output redirection. If I do `head -n -1 hosts >hosts` my `hosts` file will result empty and yes, it has more than 1 line.


title: How can I make iconv replace the input file with the converted output?

text: I have a bash script which enumerates through every *.php file in a directory and applies `iconv` to it. This gets output in STDOUT. Since adding the `-o` parameter ( in my experience ) actually writes a blank file probably before the conversion takes place, how can I adjust my script so it does the conversion, then overwrites the input file?               for file in *.php     do         iconv -f cp1251 -t utf8 "$file"     done


title: Command line 'buffer'

text: I wanted to `tail` the last 100 lines of a file to the same file, but the command `tail -n 100 file > file` doesn't work, I assume because the stdout gets written to the file 'live', before everything was read from the original file. Is there some way to pipe the output to _something_ , that then keeps it until all 100 lines are there, and then outputs it to the file? Or just another way to shorten the file in this way?


title: regular expressions with grep

text: I have this command right here:               grep -B10 -A10 '14:14:50 {"channels":["/alerts/6979/new"],"data":"New alerts for unit 6979"}' mygateway.log      Rather than searching for 14:14:50 I would like the 50 to be replaced with any number. So I was thinking to use the "." to represent any character in a regular expression. However, in programming languages you usually signify a regex with something like \abc.xyz\ where "." could be any character and any number of characters. But when I use "." in that grep string above it doesn't give me anything back.


title: Detecting which font should be used

text: I am wondering how a system knows which font should be used for an output. E.g. recently I was setting up my Debian for Japanese support, so first: installed Japanese locale, then a package with fonts, rebooted - and whola! - the system is in Japanese now. But I would not get that without installing the specific fonts. How does the system know that a particular font should be used for particular language/locale? Thank you.


title: Personal health records software

text: Does anybody know personal health records software for Linux? I want to record blood pressure, pulse, temperature, feel to analyze later. I will write information manually, as my measuring instruments doesn't have connection to PC. Of course I can just write data to simple plain text file and then plot them with `gnuplot` or `matplotlib` as a true *nix user. But I think that this problem was solved and someone created more comprehensive tool, which for example can store blood analysis results, electrocardiograms, ..., can remind to measure blood pressure and pulse and so on. I've tried to google it, I've looked on this list but found only huge web- based systems for hospitals (like GNU Health, GNUmed, etc.).


title: Create iso image from folder via terminal commands

text: I think the title says it all. How to create a iso image from a folder or single files via terminal commands? Currently i am doing this via `Brasero`s GUI, but i want to do it with a shell script.


title: Alter path of find result

text: > **Possible Duplicate:**   >  Manipulate file name piped from find command How can I alter the path of a file found with `find` before I run an `exec` on it? I want to find files and then `mv` them to a mounted file system that has the same file structure as the system being searched. Say I found `./home/usr1/dir1/file`, I want to move it to `/mountedSystem/home/usr1/dir1/file`, so all I need is to remove the leading `.` and append `/mountedSystem` to the start of the file path before executing the `mv`. Is there any way to do this safely?


title: PHP compilation - link to library

text: I am compiling php 5.3.13 on my server. I want to create an autonome php5 folder. So prefix is:               /usr/local/php5      In this folder I have a lib folder, where I put all lib needed for php to be executed such as:               libk5crypto.so.3     libxml2.so.2     libjpeg.so.62 ....      Even if I compile with `\--with-jpeg-dir=/usr/local/php5/lib/`, php binary is still looking for the file in `/usr/lib64`. The only solution I found so far is to manually export `LD_LIBRARY_PATH=/usr/local/php5/lib` I would like the same automatically at compile time. Is that possible?


title: How to correctly configure Debian watchdog daemon for BIOS Watch Dog?

text: Supermicro main boards contain a BIOS feature named "Watch Dog Function". Having Debian 6.0.6 with kernel "Linux debian 2.6.32-5-amd64 #1 SMP" we did:   1. Change BIOS "Watch Dog Function" from Disabled to Enabled.   2. Install the package watchdog (`# apt-get install watchdog`) Expected: that would be all for the watchdog function to be correctly installed. Result: system reboots every (roughly) 5 minutes. Change **BIOS** " **Watch Dog Function** " from Enabled to Disabled fixes the undesired reboots. The boot process seems to correctly enable the watchdog daemon. At least console displays (when BIOS Watch Dog is disabled):               Starting watchdog keepalive daemon: wd_keepalive.     Stopping watchdog keepalive daemon....     Starting watchdog daemon....      And on reboot this output is generated:               INIT: SUsing makefile-style concurrent boot in runlevel 6.     Stopping watchdog daemon....     Starting watchdog keepalive daemon....      What else need to be done to configure the BIOS watch dog function and Linux OS watchdog daemon to work together correctly?


title: udev Unable to Rename Network Device: Device or Resource Busy

text: I'm trying to use udev rules in order to give my network interfaces static, consistent names. However, it seems like there is some race condition happening preventing these rules from consistently taking effect each boot. When I look at `journalctl` I see the following error message: `systemd-udevd[149]: error changing net interface name eth0 to net0: Device or resource busy` My rules are pretty straight forward, I took them straight from the arch wiki on Network Configuration               SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="wifi0"     SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="net0"      What could be using the interfaces so early in the boot, and what can I do to fix this?


title: Run a command before services are started

text: I have a Oracle Linux 6.3 system on which I would like to run a command when the machines starts up _before_ any other services are started. The reason for this is to try and work around a bug in RHEL 6. I know that `rc.local` exists, but that is run after all other services have been run and is therefore too late. Here is the order in which things are currently run:   * Oracle 11g (fails due to RHEL bug)   * One or more things that depend on Oracle (fail due to no Oracle)   * `rc.local` (too late to help) Ideally I would like to do it this way:   * Command which works around bug.   * Oracle   * One or more things that depend on Oracle. Is it possible to do such a thing? Here are some options I have thought of so far that I would like to avoid as they add complexity and/or are just a bit nasty:   * Creating a custom service that is run before everything else.   * Adding the command to `rc.local` followed by calls to `service <x> start` for all the things that didn't start up.


title: Not wake up after suspension

text: My OS is Ubuntu 12.04 on my laptop Lenovo T400. I had been using it quite well until this week. After suspending Ubuntu, whenever I lift the laptop lid (if the lid is closed), or press "Fn" key (if the lid is not closed), normally Ubuntu should wake up. But starting this week, I couldn't wake it up either way for twice after I carrie my lap in my backpack running to another place. When the problem happens, the laptop light for battery is on, which is normal for suspended status (if it is turned off, there should be no light on). the laptop light for reading/writing from/to HDD is only about 1/4 of full lightness on, which I guess suggests it meets some difficulty of reading data from HDD for waking up? Is this related to some recent update of Ubuntu 12.04? Or is it a signal of onset of failure of some hardware part? Or ...? Thanks! * * * Added: As terdon suggested, I upload   * the log files `/var/log/pm-*` before and after the problem happens here. (the files ending in `.1` in their file names are those when I suspended Ubuntu, the files without `.1` are those most recent log files. Note: after the problem happens, I restarted my Ubuntu, and successfully suspended and woke Ubuntu.   * The output of my hardware info output by `lshw` is here


title: Will grep go faster with line breaks?

text: I have some big files that I have changed into "standardized form", removing line breaks. I want to speed up greps on those files. I know that you can optimize grep by doing `grep 'partofpattern' | grep -E 'partofpattern [[:digit:]]+'` -- that is, have grep search for lines that contain a more simple part of a pattern and then have grep run a second time on the few lines that contain part of the pattern. That makes me think that grep somehow works line-by-line. So will adding line breaks to big files with no line breaks speed up grep?


title: Counting number of times each IP address appears in log file

text: I have a file in the format as follows:               $ cat file.txt          27.33.65.2     27.33.65.2     58.161.137.7     121.50.198.5     184.173.187.1     184.173.187.1     184.173.187.1      What's the best way to parse the file `file.txt` into a format like:               27.33.65.2: 2     58.161.137.7: 1     121.50.198.5: 1     184.173.187.1: 3      In other words, I want to loop through the file and count the number of times each IP address appears. I've already run it through `sort` so all the IP addresses are in order and directly after each other.


title: Forward a host's network traffic to another host with the exception of SSH traffic

text: I am trying to redirect all the network traffic received in a old host to a different host. For that I created two new rules with `iptables` on the old host:               echo 1 > /proc/sys/net/ipv4/ip_forward     iptables -t nat -A PREROUTING -d old_machine_ip -j DNAT --to-destination new_machine_IP     iptables -t nat -A POSTROUTING -s new_machine_ip -j SNAT --to-source old_machine_ip     /etc/init.d/iptables save     /etc/init.d/iptables restart      Everything worked perfectly however I cannot access the old host with `ssh` any more since it redirects it to the new host. I would like to know if it is possible to create a single rule that ignores the prerouting for the ssh service.