title: Extract TAR to SD-Card and verify contents afterwards

text: We currently extract a TAR archive to a SD-Card like this               tar xf ${ROOT}/rootfs.tar -C /cynox/${DRIVE}/${TARGET}       As a side note: The rootfs.tar contains files for an embedded Linux system. Some of those systems experience some kind of data corruption on the SD-cards. This can result in missing files, corrupted file contents etc. preventing the embedded system from functioning properly or even booting. This is most likely NOT related to problems during SD-Card creation, but to be totally sure, we also have to investigate in that direction. What is the best way to compare the contents on the SD-Card to the contents of the source TAR afterwards? Without knowing if its practical on Linux, things that come to mind are   1. Create a new archive from the SD-Card and compare the MD5 of both archives (or will those somehow naturally be different?)   2. Extract the source TAR elsewhere, calculate the MD5 of every file and compare file by file (is it practical to crawl all the folders/files?)   3. Somehow directly compare the SD-Card contents to the packed contents of the TAR file by file?   4. Do we need some special validations regarding folder structure, file/folder permissions and so on? I don't know what possibilities Linux provides for this task, so I would be thankful for any suggestions, pointers in the right direction and examples if possible.


title: How to start an application automatically on boot

text: I am new to Linux & looking forward to start application (which toggles a led every 10 sec). I have written the application program & it is working fine but now I want to start it automatically on boot. The documentation here says to copy the startup script to the `/etc/init.d` directory and make a symbolic link to the copied script in the `rc.d` directory. What should be the extension and name of these script files? Can we manually add the symbolic link in `rc.d` or is there some specific procedure for this? Any suggestion how to achieve it?


title: SquashFS image as rootfs in LXC

text: Is it possible to use a SquashFS filesystem as an LXC rootfs? I can mount an ext3 image as a rootfs just by setting `lxc.rootfs` to the filename, but if it's any other type of image, `lxc-start` just says that it can't mount an ext3 filesystem. The `lxc.conf` man page doesn't suggest any way to specify the filesystem type. Additionally, if I get past that stage, can you mount other loopback filesystems in the container just by using `lxc.mount.entry` entries with `'loop'` in the options field?


title: How can I make my .bashrc call to shopt -s autocd depend on the bash version?

text: In Ubuntu I like having               shopt -s autocd      in my `.bashrc` file for automatic CD'ing with typing 'cd', i.e. just type the directory name (and probably use tab completion too) and press return and be cd'd to the directory if it exists. On OSX this isn't valid in my `.bashrc` How can I do a 'depends on' for this? So that I can share and maintain just one .bashrc between the two OS's ? I know for a file I can do stuff like:               if [ -f /etc/bash_completion ] && ! shopt -oq posix; then         . /etc/bash_completion     fi      and for an application like tmux that depends on screen I can do               if [[ ! $TERM =~ screen ]]; then       if [ -n "$(type -P tmux)" ]; then         exec tmux       fi       fi      but I can I do this kinda thing for whether I can do `shopt -s autocd` ?


title: Are there GPG-signed OpenBSD ISOs with which I can verify an installation disc?

text: Are there GPG-signed OpenBSD ISOs that I can download and later verify the downloaded file? Or at least a GPG-signed shasum?


title: Configuring shortcuts for Sakura

text: I am massively confused by the sakura terminal emulator's .conf file. I want to make `Alt`+`;` open a new tab and `Alt`+`:` close a tab. I have tried:               add_tab_key=alt+;     add_tab_key=alt-;     add_tab_key=;      None of these seem to work. In fact no control key combination works, and only certain single keys work. The default is `add_tab_key=T` and if I leave it as this I need to press `Ctrl`+`Shift`+`T`. However I changed fullscreen to `fullscreen_key=F` and now it goes fullscreen if I press either `Shift`+`F` or `Ctrl`+`Shift`+`F`. I'm using sakura on Lubuntu 13.10 running i3wm


title: luksOpen: No key available with this passphrase

text: I've created a **encrypted volume with LUKS** at home and was looking to use it at work too. Unfortunately, that's not possible. Whyever, I'm unable to access the encrypted data on _any_ other computer than my workstation at home. After entering the passphrase, I do recieve this error message: ![Gnome screenshot](http://i.stack.imgur.com/wVkUz.png)               No key available with this passphrase.      Strangely enough, I've _no WTF complications_ to access the encrypted data on my home workstation. How can I encrypt the volume ?


title: Is there an online bash script testing site?

text: Sometimes I need to help friends with bash scripting. When I'm on a Windows machine, it's a working environment and I can't just setup Cygwin or use a VM. Is there some free scripting website I can use, preferably where I can use Putty to connect it or something similar?


title: Debian 7 / XFCE - NTFS partition umounts suddenly

text: Couple of days ago i faced strange problem: my NTFS partition (separate hard- drive) started to ummount suddenly. when i do umont/mount in terminal - usually it errors on umount, telling me that mount point is busy, so i kill processes and then mount partition again. it makes me think, that _mabye_ the problem is not on the level of ntfs-3g, but on xfce level? how can i check it? what logs should i check? anybody faced the same problem?


title: can't update with this error messg

text: I got this message: > not enough free disk space.... The upgrade needs a total of 31.8 M free > space on disk '/boot'. Please free at least an additional 31.8 M of disk > space on '/boot'. Empty your trash and remove temporary packages of former > installations using 'sudo apt-get clean' I'm really not that good of a user and have very little experience with Linux. I'd like some help with how to resolve this error.


title: Which option of ls should be used for understanding metadata changes?

text: How can one find the latest time of metadata changes to a file? Let's say I changed the ownership of a file and then I did `ls -l`. It still shows the latest file changes. But I want to see the time that I changed the ownership.


title: How do you binarize a colored image?

text: My friend has an colored image with Chinese handwriting (basically by taking photo of or scanning what he wrote on a piece of white paper), and he would like me to convert it into a black and white binary image. Are there applications under Ubuntu that can accomplish that? Here is an example image: ![enter image description here](http://i.stack.imgur.com/hWxAz.png)


title: How can I set all subdirectories of a directory into $PATH?

text: It looks like when adding a directory into $PATH, its subdirectories are not added recursively. So can I do that? Or is there a reason why this is not supported?


title: Refer to a file under the same directory of a script found in $PATH

text: I have a bash script file, which is put under some directory added to $PATH so that I can call the script from any directory. There is another text file under the same directory as the script. I wonder how to refer to the text file in the script? For example, if the script is just to output the content of the text file, `cat textfile` won't work, since when calling the script from a different directory, the text file is not found.


title: PS/2 to USB port for keyboard gives "unable to enumerate USB device on port 5"

text: I got my hands on a Logitech Ultra X (Y-SX49) keyboard, with US key marks. The US key placement is much better than my Swedish native, at least for programmers, because there are much fewer shortcuts for things typically desired when writing code. For example, all kinds of brackets, but also semicolon, backslash, etc.: such things would typically demand a key combination under the Swedish keymap (to give room for the three special Swedish characters), while, with the US placement, often a single key will do. (And the compose key will deal with Å, Ä, and Ö.) So I changed, while still using keyboards with Swedish marks. However, with this new keyboard, everything should be in sync. Only, it has this old port, which I think is called PS/2 (round, with nails for holes). I have a one decimeter wire to transform this port into USB (as I lack a PS/2 port on my laptop) but, when I type, it says (for example):               [ 258.228055] hub 4-0:1.0: unable to enumerate USB device on port 5      Anyone knows why it doesn't work and, if possible, how to fix it?


title: Which processes should I NOT strace?

text: I've created a little function for `strace`'ing a set of the current user's processes by name:               function pstrace() {         local pattern="$1";         shift;         prefixDashP $(pgrep -U $(whoami) $pattern) | xargs strace -o /dev/stdout $@;     }          function prefixDashP() {         local new_args=();         for arg; do             new_args+=( '-p' );             new_args+=( "$arg" );         done;         for arg in "${new_args[@]}"; do             echo "$arg";         done;     }          # Usage:  pstrace pattern1 pattern2 ...      The trouble is, if I accidentally specify too broad of a pattern, it tries to monitor processes that it shouldn't monitor, and so my system freezes. Is there a list of processes that I can always exclude?


title: Using Atlas from scipy

text: I installed Ubuntu 12.04 64 bit. I need to work with python and scipy, I installed them and when I run the test:               python -c "import scipy; scipy.test()"      I get the message: > ImportError: libatlas.so.3gf: cannot open shared object file: No such file > or directory However, I have libatlas libraries installed under the directory `/usr/lib/atlas-base`. I know I can copy the files directly under `/usr/lib`, but I wonder how I could setup the scipy to use the libraries from `usr/lib/atlas-base`?


title: How to check if virtio storage access is in use?

text: How to check if virtio storage access `virtio_blk` really is in use or an eventually existing fallback driver? Existing documentation doesn't answer it:   * http://www.linux-kvm.org/page/Boot_from_virtio_block_device   * http://wiki.libvirt.org/page/Virtio The following.               lsmod | grep virtio      Only shows, that the virtio kernel module is loaded. It isn't hard to load arbitrary kernel modules for hardware that you don't have installed. The question remains, is the virtio kernel module actually in use or an eventually existing fallback driver?


title: Specify the sector of manpage

text: When `man declare` in bash, I get the manpage of `declare`in sql. But I would like to get the manage of `declare` in shell. How can I do that?


title: Identify text/ascii files in Linux/Solaris

text: I have a little project to build `bash` script that search in the OS ( Linux/Solaris ) the current IP address from files and replace them with other IP address. The problem is that IP address could be in text file or in not text file as binary/data files, etc. I use the command:               file –mime $PATH ( --mime is valid only for Linux )      In order to verify if file is text file, or not text file ( as binary or data file, etc ) Please advice if I do the correct thing. Is my conclusion correct? For example if command:               file –mime $PATH      Return the results **"text/plain"** Then its text/ascii file, if not then it's not text file ? The second question:               file –mime      `\--mime` flag is valid only for Linux but not exists in Solaris, so what the alternative for Solaris? As all know `file` command sometimes not identify exactly the definition of the target file, so if someone have other idea how to identify text file, I will be happy to get any brilliant suggestion.


title: Why isn't there standard library to modify /etc/{passwd, shadow}?

text: Why doesn't glibc provide standard library to modify /etc/passwd and /etc/shadow, i.e add a user, change passwd, I came to that conclusion because I checked the source code of `shadow` and failed to find such interface


title: rename directory of images numeric

text: I'm trying to rename a directory full of images like so: > test.jpg   >  funny.gif   >  sad.png   >  filename.PNG   >  filenaaskjas.JPG to: > 1.jpg   >  2.gif   >  3.png   >  4.png   >  5.jpg I've got it working except for the uppercase --> lowercase conversion:               i=1;     shopt -s nullglob;     for f in *.jpg *.gif *.png *.jpeg *.JPG *.JPEG *.GIF; do         mv -- "$f" "$i.${f##*.}";         ((i++));     done      I also want `jpeg` to become `jpg`.


title: How to reduce kjournald activity

text: The culprit that do large write to my hard disk has been caught. It's kjournald One way to solve the issue is to change the file system to ext2. Is there an easy way to do so? Another thing that can work is to increase commit time to hard disk. What does it actually do? If I make commit time 600 seconds will my hard disk fail to write for 600 seconds? Will it mean less journalling or just delayed journalling? The data are mostly cache and I don't need perfect accuracy. We don't have journalling for windows right?


title: Non-Root Package Managers

text: From my research, I seem to notice that all package managers insist on being used as a privileged user and must be installed into `/`. Typically, what I like to do is create a throwaway account, compile some software, and install to `$HOME` for that account. I can try a variety of setups and then when I'm done, just destroy the account. However, compiling software becomes tedious. My experience is really just limited to `yum`, but I don't understand why I wouldn't be able to drop a repo file into `~/etc/yum.repos.d` and have yum install everything into a home account. Is there any reason why package managers must be used as a privleged user to install software?


title: 'Distribution' to install in home directory (on older Linux)

text: > **Possible Duplicate:**   >  Non-Root Package Managers I'm stuck with a pretty old Linux distribution at work (Centos 5.4 from the end of 2009), and also don't have root access. If I want to use more recent software, I can compile it myself and install it my home directory (or somewhere where I have write access). That works fine with many programs, but it gets complicated with bigger ones (such as LibreOffice or Chromium). It is pretty complicated to track all the dependencies. I'm wondering if someone did this before, and maybe built a sort of Linux* distribution that I can install in my home directory (without root), and that brings all the needed dependencies with it. Preferably as binaries, as that would make it a lot faster and easier to install on an old machine. But I'd also take a 'ports' like system, or even just tips how to organize stuff if I have to compile it all manually. * * * *) Note to nitpickers: of course this wouldn't be a _Linux_ distribution _technically_ , since the one thing missing will be the actual _Linux kernel_. Before someone says this is not possible, I know it is possible, at least in most cases. For one, a lot of Linux libraries are backwards compatible, although this is not used nearly as much as in Windows (where there is no package manager). Second, you can compile most libraries needed yourself, the only thing you can't replace is the kernel. You can force the new libraries via LD_LIBRARY_PATH, or when compiling the programs that shall use them. I've managed to install a recent Skype some time ago, which needed a newer version of glibc. There even used to be someone who maintained Chromium with all its ridiculous dependencies for this version of CentOS. It's certainly possible, but its unwieldly, and seems like an ideal task for a computer program / distribution / package manager.


title: Do I need a new zone for each domain I have on my server?

text: I currently have a working BIND nameserver Running on my dedicated ubuntu server box. I have one zone set up.. example.com with its own nameservers. If I want to add a new domain to point to the server, can I somehow add it to the existing zone? Or do I have to create a new zone and setcoms nameservers to example.com?


title: Show shutdown messages from last shutdown

text: Where does Linux store the shutdown messages from last shutdown?


title: building pidgin-otr-4.0.0 on CentOS 7: can't find pidgin and purple

text: I have built pidgin from source on CentOS 7. This is because there is no package available yet. This went well, however, `pidgin-otr-4.0.0` cannot find the headers for `pidgin` and `purple`. They reside in `/usr/local/include`, and I can't work out what the configure script wants with its suggestion:               checking for EXTRA... configure: error: Package requirements (glib-2.0 >= 2.6 gtk+-2.0 >= 2.6 pidgin >= 2.0 purple >= 2.0) were not met:          No package 'pidgin' found     No package 'purple' found          Consider adjusting the PKG_CONFIG_PATH environment variable if you     installed software in a non-standard prefix.          Alternatively, you may set the environment variables EXTRA_CFLAGS     and EXTRA_LIBS to avoid the need to call pkg-config.     See the pkg-config man page for more details.      I tried a variety of `PKG_CONFIG_PATH` options such as `/usr/local` and `/usr/local/include`, as well as `EXTRA_LIBS`. I am not sure what to do at this point. I just need to specify somehow that `pidgin` and `purple` reside in `/usr/local/include`.


title: test recursive sed search and replace before running

text: Is there anyway to do a trial run of a recursive search and replace of sed before actually running it? I just want to print out the results before actually doing the search and replace. Something like echoing the results of,               grep -rl term1 . |xargs sed -i -e 's/term1/term2/'


title: Fix Version String Error in FreeNX Setup

text: On OpenSUSE 12.1, I would like to install and run the FreeNX Server. OpenSUSE has provided instructions about the installation for previous versions, and I can adapt them for 12.1, up to a point. I have taken these steps:               zypper ar http://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_12.1 RemoteDesktop     zypper ref     zypper in FreeNX     mkdir /usr/lib64/cups/backend/ipp     nxsetup --install --setup-nomachine-key      I didn't hit many of the issues that the OpenSUSE instructions page listed, so I didn't have to take those steps. However, at the `nxsetup` step, after a few normal warnings (about not being able to use a printer and things like that), the setup script gives me an error: > Error: Could not find 1.5.0 or 2.[01].0 or 3.[0123].0 version string in > nxagent. NX 1.5.0 or 2.[01].0 or 3.[0123].0 backend is needed for this > version of FreeNX. How do I address this error?


title: Tail multiple files and output as additional column with 'find' results

text: Would like to pull the last line of text from a specific (multiple) files in a directory. Additionally, I'd like the results to be in a more traditional column format (like `ls`) with path, rather than the typical format of `tail`. From the following results {1}, I'd like to append as an additional column the last row of data {2} Where {1} = `find . -iname 'updated.txt'`, and {2} = `tail -n1` I'm using `bash` in Mavericks


title: cross compile driver

text: I have a cross compile environment setup to compile for an ARM 9 processor, this works fine, now I want to compile an external third party driver within this environment. I downloaded the driver, and copied it into a directory. When I now call `make`, the compiler can't find the headers because the references are made from `../`. So what I get is:               $ make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-     rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.* modules.order     make -C /lib/modules/3.11.0-14-generic/build SUBDIRS=/home/reg/semios/ACME/linux-3.11.6/Gobi modules     make[1]: Entering directory `/usr/src/linux-headers-3.11.0-14-generic'       CC [M]  /home/reg/semios/ACME/linux-3.11.6/Gobi/GobiSerial.o     In file included from include/linux/types.h:5:0,                      from include/linux/list.h:4,                      from include/linux/wait.h:5,                      from include/linux/fs.h:6,                      from include/linux/tty.h:4,                      from /home/reg/semios/ACME/linux-3.11.6/Gobi/GobiSerial.c:47:     include/uapi/linux/types.h:4:23: fatal error: asm/types.h: No such file or directory     compilation terminated.     make[2]: *** [/home/reg/semios/ACME/linux-3.11.6/Gobi/GobiSerial.o] Error 1     make[1]: *** [_module_/home/reg/semios/ACME/linux-3.11.6/Gobi] Error 2     make[1]: Leaving directory `/usr/src/linux-headers-3.11.0-14-generic'     make: *** [all] Error 2     reg@regDesktopHome:~/semios/ACME/linux-3.11.6/Gobi$      How do I get this to compile properly?


title: Dwm - pertag patch - save state between restarts

text: I'm using Pertag patch As a Gentoo user I apply dwm patches using Portage. Basically there's a directory where user can put a patch for sourcecode and Portage will apply it during the compilation process (if patching procedure goes wrong whole compilation will fail) So basically I used just these commands:               cp ~/pertag.patch /etc/portage/patches/x11-wm/dwm     emerge -av dwm       Anyway Pertag patch seem to work fine - I can set different layouts for different tags etc, but when I restart dwm, all these changes are gone and I need to set it up again. Is there a way (maybe different patch?) to save these changes, so when I start dwm again, tag 2 still has for example monocle layout, tag 3 floating layout, and there's no statusbar on tag 4?


title: Red Hat Enterprise Linux installation process through virt-manager

text: I'm going through the installation process using virt-manager which I will install a virtual Red Hat machines with on my physical host. I have the image iso on the host and mounted it on `/media/cdrom`. Red Hat lists four installation methods.   * Local CD/DVD   * Hard drive    * NFS directory   * URL My first option is to use CD/DVD, although I end up getting a "disc was not found in any of your CDROM drives." For hard drive it lists `sda` and `sr0`. We also have a NFS directory, which I can try if I don't get it going with the first two options.


title: Is more or find more resource intensive in finding the number of times an item lists in a file?

text: I recently read How to find the total number of occurrences of text and files with find command, which asked about a way to find the number of times text "abc" appears in a file. The answer there provided the command `find . -name "*.txt" | xargs grep -i "abc" | wc -l` to find the count. Previously I have used something like `more "file_name*" |grep "abc" |wc -l` to list the number if times text "abc" appears in a specific file(s). I tried this and found that the `more` command returned faster, but seemed to use ~30% more CPU (I was also monitoring via `top`) than the `find` command. I was wondering if anyone had some more solid data on which of these two commands would be more intensive on resources if you were to query through approximately 15 files? How about 30+ files?


title: Rotate screen using udl driver (DisplayLink) on Ubuntu 14.04?

text: Recently got a DisplayLink device, it works, but I would like to rotate counter-clockwise. Apparently the driver does not allow rotation (tried via gnome-shell and xrandr). Searching on google I found this link: http://plugable.com/2010/01/02/displaylink-linux-rotation but it seems a bit outdated. The configuration file / etc/X11/xorg.conf does not exist, I guess xorg uses another configuration structure. Any tips on how I could rotate the screen in Ubuntu 14.04? Kernel: 3.13.0-32-generic   Xorg: 1.15.1   Device: Bus 002 Device 011: ID 17e9: 019e DisplayLink (DL-165?)


title: How to change the default line length for od and hexdump

text: Is there any way to change the default line length for the `od` and `hexdump` commands? Can't see anything apropriate in the man pages.


title: Repackaging a Debian package

text: I need instructions on how to do repackage a `.deb` package. Situation: I have a `.deb` package for an application with no source. I need to modify a `Description` field, save the file change and repackage back into a `.deb` package. Is there a step by step on how to do that?


title: When should I not kill -9 a process?

text: I am always very hesitant to run `kill -9`, but I see other admins do it almost routinely. I figure there is probably a sensible middle ground, so:   1. When and why should `kill -9` be used? When and why not?   2. What should be tried before doing it?   3. What kind of debugging a "hung" process could cause further problems?


title: gparted live CD can't resize a partition?

text: I recently ran out of space on a VirtualBox VM (CentOS guest) managed by Vagrant. It was using a `.vmdk` image, so I couldn't dynamically resize it. Following these instructions, I cloned the old image to a new, much larger `vdi` image, then attempted to resize the old partition using the GParted LiveCD. Unfortunately, even though I can see that the backing device is much larger, the partition (which is managed by LVM, since it is a CentOS guest) is displayed with a lock icon, and I can't resize it. I don't understand why the partition is locked: I'm using a LiveCD, so the FS is shouldn't be mounted (at least as I understand these things). Any suggestions on what I've done wrong? Thanks.


title: OpenVPN not connecting on one network?

text: I've been using my VPN (privateinternetaccess) for almost a year. I've been connecting through the same gateway, using the same username and password, with the same settings. Yesterday, it randomly refused to connect at home. I got to school and it worked fine, so I assumed it was an issue with their servers that was resolved. But when I got back home, it wasn't working again. I tried connecting to different locations my account has access to (Canada and various places in the US), but none of them worked. I usually connect to the VPN with NetworkManager, and it takes about 3 seconds to connect. The weird thing is, while NetworkManager always times out when trying to connect, running "openvpn file.ovpn" on the .ovpn file provided by the VPN provider will connect, but it will take over a minute. What could be wrong here? Just to clarify, it still works perfectly fine on my school's network, but not my home one.


title: Is ext2 suitable for daily use on a desktop or laptop?

text: Is a journaling filesystem needed in today's desktop world? A good OS doesn't kernel panic every month, and if we are using a laptop, then there aren't any power outages, so why shouldn't we use ext2 as the standard filesystem on a desktop or laptop?


title: Bittorrent Sync Autostart as a Service

text: I'm running a raspberry pi with the latest raspbian (debian) on it. I've installed btsync. Now I want to run Bittorrent Sync, when the system boots, not only when somebody logs in. Do I have to run btsync as a service in init.d? How would you solve this "Problem"?


title: Check for updates of packages installed through yaourt

text: Is there anyway to update package installed with yaourt ? `yaourt -Syu` seems to do the same as `pacman -Syu`, which only care about package in official repository.


title: How can I stop an amok running process from logging to systemd?

text: There's a process on my system called **demond** which logs around 100 entries to the systemd journal _every 15 seconds_ :               Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev0. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev1. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev2. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev3. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev4. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev5. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev6. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev7. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev8. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev9. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev10. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev11. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev12. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev13. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev14. No such file or directory     Okt 11 04:58:42 scarecrow demond[1692]: [P:1692 T:108160832] src/discovery.c : 158  getHidDevices        -- failed in opening HIDDEV file: /dev/hiddev15. No such file or directory      This fills up the journal very quickly and creates permanent disk access, which drains battery. The entries all have priority 7 (debug). demond is part of the Lexmark printer driver. I guess they use it for Wifi discovery of devices. I contacted Lexmark support and they said they cannot change the driver, and there's no way to suppress those messages. And since the driver is closed source, I cannot change it myself. I know that I can suppress debug level 7 altogether using `MaxLevelStore=info` in journald.conf, but this suppresses the debug level for _all_ processes. Is there a way to suppress logging _for a certain process_ such as demond? I'm using ArchLinux with latest systemd 208. I don't use syslog-ng or rsyslog.


title: error when apt-get install nfs-kernel-server

text: I'm now using the command `sudo apt-get install nfs-kernel-server` to make my Ubuntu 12.04.2 LTS server support NFS. But it reports this error:               Need to get 559 kB of archives.     After this operation, 1980 kB of additional disk space will be used.     Do you want to continue [Y/n]? Y     Err http://cn.archive.ubuntu.com/ubuntu/ precise/main libcap2 amd64 1:2.22-1ubuntu3       Temporary failure resolving 'cn.archive.ubuntu.com'      I tried to `ping cn.archive.ubuntu.com`, this address cannot be accessed. But I don't think this is the reason, because on my other good Ubuntu machine, I was able to use the command `sudo apt-get install smbfs`, and it worked. The `ping cn.archive.ubuntu.com` command also did not work from this machine. Can anyone tell me why this is not working and how to fix this issue?


title: Kernel panic-not syncing: no init found

text: When I try to boot up my custom linux from scratch it mounts the root filesystem then I get this message: `Kernel panic-not syncing: no init found.` I have the init compiled from source and I have the necessary libraries to run init. What did I do wrong?


title: Is it safe to only partially restore a disk image with dd?

text: I have saved my whole hard-disk with `dd` to an image file. The hard-disk contained some primary partitions formatted with ntfs, swap and ext4. I did it this way:               dd if=/dev/sda | ssh user@fastmachine "cat - > diskimage.img"      Then I have overwritten the first 5 to 6 GB of my hard-disk for testing purposes with a new system:   1. I created a swap primary partition with 1.5 GB.   2. I created an ext4 primary partition with 4 GB. After testing the test system now I want my old system back. But my local hard-disk is **very slow when writing.** To save time and energy I want to only restore about 6 GB from the image. Is this enough and safe? Would it work? I would do it this way:               ssh user@fastmachine "dd if=diskimage.img bs=1M count=6000" | dd of=/dev/sda      ## Update—partially restoring test It worked to only partially restore the hard-disk. ## Update—speedtest of 1.8" pata hard-disk I just testet the writing speed with               dd if=/dev/zero of=blub count=1000 bs=1M      And               ssh user@fastmachine "dd if=/dev/zero count=1000 bs=1M" | dd of=blub        * First gave me 14.5 MByte/s as writespeed to my 1.8" hard-disk—not as bad as I thought   * Second gave me 11.4 MByte/s = 91.2 Mbit/s ≈ 100 Mbit/s = speed of my ethernet connection But: **ssh over WLAN (wireless)** only was 1,3 MByte/s! That was the problem. ssh took 68 % cpu load when copying over ethernet, and only 20 % when copying over WLAN (wireless). **Conclusion:** If I had a faster network and hard-disk/flash-drive I would use netcat (nc) to copy the data.


title: Wrong timezone offset. How do I correct it? (help with zic timezone compiler)

text: I have an iPod touch (2nd gen) and constant troubles with the clock setting itself one hour ahead of the actual time when I connect it to the computer. long story short, When I SSH into the device:   * `date "+%Z"` returns `ARST` which is correct (I'm in Buenos Aires, Argentina)   * `date "+%z"` the result is `-0200`, which is wrong and should be `-0300` My question is: **How do I correct the offset of my timezone to the real value?** I have found mentions of `zic`, `zdump` and references to a "IANA Time Zone Database".   I've tried to find allready compiled files in order to replace the whole "zoneinfo" folder, but the downloads I could find seem to use a different folder structure than the one on the iPod. _edit_ : I am looking for a way to edit or update the timezone information, so that my timezone "ARST" is configured correctly. I have found several references to a compiler named `zic`, but need help in order to work out a solution.   Both `zic` and `zdump` are present on the device, which leads me to believe it can be done via SSH and UNIX-commands.


title: Sharing Multiple Folders with Samba

text: How can I share multiple folders in Samba? If I use mutiple `[public]` sections in `smb.conf` only the last 1 has effect. Then if I try to name each section differently, I samba doesnt seem to recognize them as shares.


title: My audio device not working

text: I have been setting up a new CrunchBang Linux and my sound doesn't work. When I type `lspci -v` command and `alplay -l` command in command prompt I can see that my sound card is connected and detected. Results:               ziga@ziga-laptop:~$ aplay -l     **** List of PLAYBACK Hardware Devices ****     card 0: SB [HDA ATI SB], device 0: HDA Generic [HDA Generic]       Subdevices: 0/1       Subdevice #0: subdevice #0      More results:               ziga@ziga-laptop:~$ lspci -v     00:14.2 Audio device: ATI Technologies Inc SBx00 Azalia (Intel HDA) (rev 40)         Subsystem: Hewlett-Packard Company Device 1604         Flags: bus master, slow devsel, latency 64, IRQ 16         Memory at 90400000 (64-bit, non-prefetchable) [size=16K]         Capabilities: <access denied>         Kernel driver in use: HDA Intel      Well I've figured out that my audio card model is `ATI SBx00` and I can't find it on www.alsa-project.org although my soundcard already worked with alsamixer when I was using Xubuntu 12.04. And it also worked with previous versions of CrunchBang Linux. So I've tried to reconfigure alsamixer by using command `alsamixer`, pressing F5 and then increasing all sliders to the max like shown below.               ┌───────────────────────────── AlsaMixer v1.0.23 ──────────────────────────────┐     │ Card: HDA ATI SB                                     F1:  Help               │     │ Chip: Realtek ID 270                                 F2:  System information │     │ View: F3: Playback  F4: Capture  F5:[All]            F6:  Select sound card  │     │ Item: PCM [dB gain: 0.00, 0.00]                      Esc: Exit               │     │                                                                              │     │                       ┌──┐     ┌──┐     ┌──┐     ┌──┐                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       │▒▒│     │▒▒│     │▒▒│     │▒▒│                        │     │                       └──┘     └──┘    L└──┘R    └──┘                        │     │                                       CAPTURE                                │     │                     100<>100 100<>100 100<>100 100<>100                      │     │                      Master <  PCM   >Capture  Digital                       │     │                                                                              │     └──────────────────────────────────────────────────────────────────────────────┘      When in alsamixer i tried to hit F2 and this menu pops out:               ┌───── Select File ──────┐     │/proc/asound/version    │     │/proc/asound/cards      │     │/proc/asound/devices    │     │/proc/asound/oss/devices│     │/proc/asound/timers     │     │/proc/asound/pcm        │     └────────────────────────┘      Below i will paste outputs of all of all menu options, here it goes:               ┌───────────────── /proc/asound/version ─────────────────┐               │Advanced Linux Sound Architecture Driver Version 1.0.21.│               └────────────────────────────────────────────────────────┘               ┌──────────────── /proc/asound/cards ─────────────────┐                 │ 0 [SB             ]: HDA-Intel - HDA ATI SB         │                 │                      HDA ATI SB at 0x90400000 irq 16│                 └─────────────────────────────────────────────────────┘                 ┌─────── /proc/asound/devices ───────┐                       │  2:        : timer                 │                       │  3:        : sequencer             │                       │  4: [ 0- 0]: digital audio playback│                       │  5: [ 0- 0]: digital audio capture │                       │  6: [ 0- 0]: hardware dependent    │                       │  7: [ 0]   : control               │                       └────────────────────────────────────┘            ┌ /proc/asound/oss/devices ┐     │  0: [0- 0]: mixer        │     │  3: [0- 0]: digital audio│     │  4: [0- 0]: digital audio│     └──────────────────────────┘     ┌──────────── /proc/asound/timers ─────────────┐                    │G0: system timer : 4000.000us (10000000 ticks)│                    │P0-0-0: PCM playback 0-0-0 : SLAVE            │                    │P0-0-1: PCM capture 0-0-1 : SLAVE             │                    └──────────────────────────────────────────────┘                    ┌─────────────────── /proc/asound/pcm ────────────────────┐               │00-00: HDA Generic : HDA Generic : playback 1 : capture 1│               └─────────────────────────────────────────────────────────┘              When i press F6 i get the menu for selecting sound card which looks like this:               ┌───── Sound Card ──────┐     │-  (default)           │     │0  HDA ATI SB          │     │   enter device name...│     └───────────────────────┘


title: How to align a column in a text file

text: Using bash on Linux, how can I process a text file such that space is inserted before a certain column so that column is aligned in the output? For example: ### Input               1653455 ASDFASDF22 bla bla bla asd xmv ASDFASDF22 AA     1944444 ASDFASDF22 klasdfmxvl yxklc erisa ask xdk asdm ase ASDFASDF22 BB     1984945 ASDFASDF22 jklyck aklsdfl asfjasl asdkkcii wdkkkxd aslasl wqe ASDFASDF22 BB      ### Output               1653455 ASDFASDF22 bla bla bla asd xmv                                ASDFASDF22 AA     1944444 ASDFASDF22 klasdfmxvl yxklc erisa ask xdk asdm ase            ASDFASDF22 BB     1984945 ASDFASDF22 jklyck aklsdfl asfjasl asdkkcii wdkkkxd aslasl wqe ASDFASDF22 BB      The columns between the two `ASDFASDF22`s must be less than 50 characters, or it should be truncated.


title: History of apropos command

text: I am writing a paper on my project, the goal of which is to write a new implementation of the `apropos(1)` command. While I realize that `apropos` was written in the early days of Unix when computing resources were scarce and hence its designers kept it simple. I am looking for a concrete source of information on this to back my point. Is there any historical document or artifact that describes when and why these commands were introduced into Unix? My Google searches have not returned anything useful so I was wondering whether perhaps those of you who have been involved with Unix since the early days might have some knowledge about it.


title: How can I flash_erase mtd0?

text: I am trying to find a way to `nandwrite` my mtd0 partition which contains my u-boot environment. When I try to `flash_eraseall /dev/mtd0` though I get: > flash_eraseall: /dev/mtd0: Permission denied Is there any way I can get permission to do this? After doing some reading I get the suspicion that I would have to modify and recompile my Kernel. I am trying to find a way to work around that though.


title: Running executables on an NTFS partition?

text: My system configuration is the following:   * UEFI computer   * Dual-boot with Windows 8 and Linux Mint 15 Olivia I would like to be able to run Linux executables that are stored on an NTFS partition rather than having to copy them each time on a Linux partition. Whenever ticking the _Execute_ check box it de-ticks itself, I guess because it's on an NTFS partition.               ![enter image description here](http://i.stack.imgur.com/PLqDm.png) I've come across this post:   * http://askubuntu.com/questions/11840/how-to-chmod-on-an-ntfs-or-fat32-partition Searching on my system, I have found that mentioned settings can be done in _Disks_ settings dialog:     ![enter image description here](http://i.stack.imgur.com/WjQw0.png) I thought about appending _exec_ at the end of default parameters but I'm not sure about these things:   * According to answer 2 of the above question: _NTFS is a POSIX-compatible_ and _To enable this, you need a "User Mapping File"_.   * So, is the _User Mapping File_ a file stored on the Linux partition? (i.e. stores Linux-specific permissions in my Linux partition instead of directly changing the permissions in the NTFS partition). **In short :** Can I safely do this as I will still use my Windows with this partition?


title: Switchable graphics drivers installation on Linux Mint

text: Firstly, sorry if there is something unclear in my question but English is not my native language and I will correct the question if needed. Here is my problem: I have a notebook with ATI RADEON (venus pro) HD 8850M dedicated GPU and intel HD 4400 GPU. I have installed Intel GPU drivers successfully by modifying /etc/lsb-release and using their GUI (Intel(R) Graphics Installer). However i have had no success installing AMD drivers. After clean Mint Linux 17 xfce install (no Intel drivers) I downloaded the linux x64 drivers from AMD's website. I have executed the *.run file, some GUI wizard showed up and I tried to install drivers but then I got the message `Your graphics adapter is not supported by this driver. Installation will not proceed.`. Then I downloaded the latest beta version of the driver and tried the same but again I got the message `Your graphics adapter is not supported by this driver....`. I have searched for the message above and I have read that AMD dropped support for many of their products and that might be the reason I get it. However ATI HD 8850M was released in 2013 so is it possible AMD to have dropped driver support? Anyway I decided to try another approach. I have used the Synaptic package manage and installed fglrx, fglrx-amdcccle and fglrx-pxpress. Then I rebooted and after reboot I was able to start the Catalyst Control Center. I have used GUI program called "Hardinfo" to check if AMD GPU was running instead and it was running. I have checked also in google chrome `chrome://gpu` to see if hardware acceleration worked and it worked. Everything seemed to be OK. Next I used CCC to switch graphics to the Integrated Intel GPU and rebooted. It could not boot correctly first time. Mint logo showed up but after it disappeared nothing more happened except that I could see the screen black with backlight on, heat started to build up rapidly and fans accelerated. I have waited more than 5 minutes to boot after the screen was black but nothing happened. Next time it started normally and using `hardinfo` I could see that Intel GPU was used. Checked `chrome://gpu` and hardware acceleration worked too. I have succesfully started Catalyst CC, switched to AMD graphics and rebooted without problems. When I checked what `hardinfo` was saying I saw Intel GPU was used and not AMD (I switched to it before restart). Then I tried to open Catalyst CC but I had no success. I tried to run it using cli as I have successfully done before (`sudo amdcccle`) but I got `command not found`. When I checked `/usr/lib/fglrx` everything was there so I tried to run amdcccle and I got the message that I had no compatible graphics (or something similar) and i t refused to start up. Synaptic package manage showed that fglrx, fglrx- amdcccle ... were installed so I removed them completely, rebooted and tried to install them again. However I could not start Catalyst again normally. `sudo amdcccle` still results in `command not found and if I run it from`/usr/lib/fglrx` it says i have no compatible device or sth... I also tried to install the "fglrx-update, fglrx-amdcccle" combo instead but I had the same experience. The last thing I tried was using Mint Linux's "Driver Manager" GUI and it shows three options: "xserver-xorg-video-ati" which is the recommended option and "fglrx" and "fglrx-update". **Is there any way to install both Intel and AMD graphics drivers and be able to switch GPUs when I want? Why I was unable to start Catalyst CC normally after switching to Intel HD 4400 and back? Why`command not found`? Was it removed from the path variable after the reboot and why? Have AMD dropped the support for ATI Radeon HD 8850 and if they have stopped supporting it what could I do?**


title: Idiomatic way to kill -9 only if "graceful" way doesn't work?

text: Is there a common way or existing utility to do the following?   * `kill` a process   * Give it a few seconds to shut down gracefully   * `kill -9` it if it hasn't stopped


title: How to hide file size using ls command

text: I need to list some files in a directory using the `ls` command, but I need to also to hide the file sizes. How can I do that with the `ls` command?


title: Some software runs only by root terminal

text: I'm facing this odd situation here, programs such as `gparted`, `furiusisomount` and `Rstudio` never run by clicking on their icons in the applications menu or by running them with terminal as a normal user. But they would work only on sudo terminal. I encounter following errors:               Gtk-WARNING **: Locale not supported by C library.         Using the fallback 'C' locale.     Traceback (most recent call last):       File "/usr/share/furiusisomount/main.py", line 431, in <module>         app = main_window(parameter)       File "/usr/share/furiusisomount/main.py", line 51, in __init__         locale.setlocale(locale.LC_ALL, '')       File "/usr/lib/python2.7/locale.py", line 547, in setlocale         return _setlocale(category, locale)     locale.Error: unsupported locale setting      though rstudio never has any output. I have no idea whats going on and i,m totally new to linux and debian wheezy. P.S:this is the warnings I face by R command only on terminal without sudo:               During startup - Warning messages:     1: Setting LC_CTYPE failed, using "C"      2: Setting LC_COLLATE failed, using "C"      3: Setting LC_MESSAGES failed, using "C"       output of locale:               locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     LANG=en_GB.utf8     LANGUAGE=     LC_CTYPE="en_GB.utf8"     LC_NUMERIC=en_US.utf8     LC_TIME=en_US.utf8     LC_COLLATE="en_GB.utf8"     LC_MONETARY=en_US.utf8     LC_MESSAGES="en_GB.utf8"     LC_PAPER="en_GB.utf8"     LC_NAME="en_GB.utf8"     LC_ADDRESS="en_GB.utf8"     LC_TELEPHONE="en_GB.utf8"     LC_MEASUREMENT=en_US.utf8     LC_IDENTIFICATION="en_GB.utf8"     LC_ALL=


title: exact match in regrex when using vim, man, or less

text: when using vim, man, or less, I want to do some exact match in regrex for example, when using man, I want to check the argument '-c' if I use                 /'-c'      the matching could be -cim -covert......blabla but I only want to match '-c' how to do the exact matching? thanks!


title: grub2-install doesn't work the first time, but does work the second time

text: This is a weird one... I'm working on some software. It has a function to make a USB device bootable. It does this by running a long, complex sequence of actions to copy a minimal Linux OS onto the device and then install GRUB2 as the bootloader. The trouble is, at the end of this procedure, the device won't boot. GRUB2 loads, but drops into a rescue shell and whines that it can't find [whatever the UUID of the boot partition currently is]. The UUID it's whining about is definitely correct. The actual command that my software is running is this:               grub2-install --boot-directory=/mnt/boot /dev/sdb      The command exits with code 0, and says on stdout "installation finished, no errors reported". And yet, GRUB won't boot. Here's the excruciatingly weird part: If I manually type in the exact command above, then the device becomes bootable. Everything works perfectly. But when the software runs this command automatically, something goes wrong... What the hell?? Does anybody have the vaguest idea why this behaviour might occur? Are there any environment variables the installation script depends on? What kinds of disk modifications would upset GRUB? Is there some way I can see what gets changed the second time I run the script? **Edit:** OpenSUSE 12.2, everything is running as `root`. (Is any other user even _allowed_ to fiddle with the MBR of a disk?) **Edit:** `env` returns nearly identical results both from the software and from a terminal. (A few variables such as `PWD`, `SHLVL`, `WINDOWID` were different, but I can't see how that's relevant.) **Edit:** I tried having my software just run the command twice. That made no difference. So it really is an environment difference of some kind...


title: Xen is unable to use URL's to install CentOS

text: I can't seem to use URL's when using the netinstall for CentOS, I'm installing CentOS on a Xen VPS. I keep getting this error in the terminal window, when I use the URL:                         ┌────────────────┤ Error ├────────────────┐               │                                         │               │ Unable to retrieve                      │               │ http://ftp.tu-chemnitz.de/pub/linux/cen │               │ tos/6.3/os/x86_64/images/install.img.  │               │                                         │               │                 ┌────┐                  │               │                 │ OK │                  │               │                 └────┘                  │               │                                         │               │                                         │               └─────────────────────────────────────────┘      The URL is perfectly valid, I have no idea why it's not working, I think it may be something to do with my This is the command that I use to initiate the install on my Dom0:               virt-install --name vmTestio8 --ram 513 --vcpus 1 -f /home/xen/domains/vmTestio8.img --network bridge=xenbr0 --location http://mirror.centos.org/centos/6.3/os/x86_64/      My network settings seem to verify okay with CentOS so I don't see why it's only doing it when it comes to this point, because before when I entered bad data it would throw an error, so I don't know why it's doing this now? Any ideas? Server Specs: Running CentOS 5.9 with XEN Trying to install CentOS 6.3 on the VPS that I'm creating.


title: Should a laptop user switch from ext4 to btrfs?

text: Related to this. I'd like to take advantage of an OS switch to upgrade to BTRFS.   * BTRFS claims to offer a lot (data-loss resiliency, self-healing if RAID, checksumming of metadata **and** data, compression, snapshots). But it's slow when used with `fsync`-intensive programs such as `dpkg` (I know `eatmydata` and the crappy `apt-btrfs-snapshot` programs) and I won't setup a RAID :p.   * EXT4 allow metadata check-summing only and doesn't compress data. In 6 years, I had to reinstall my OS twice because of HDD corruption (after flight trips). The first making the laptop unbootable, the second bunch of corruptions was identified thanks to a corrupted film and then md5sum check of the OS binaries. (SMART tells me the disk is sane). The lappy currently behave quite strangely. I don't know if the hardware or the software is to blame but I suspect the hardware (it all began right after a flight, once again). Would you advise to switch to BTRFS for a laptop because of data compression and check-summing or should I stick with EXT4? (I don't care about which is "best" relative to whatever variable but I have almost no experience with BTRFS and would like some feedback) **EDIT:** Let's be clearer: BTRFS is still flagged as experimental, I **know** , but SUSE says it shouldn't anymore. So does Oracle (I know who Oracle is). And a bunch of distributions already propose BTRFS for installation and most of them are planning to switch to it in the next few months. Two facts:   * **Backups of corrupted data are worthless**. I don't understand why I seem to be the only one to bother. Isn't that common sense? In the meanwhile:      * Stop telling me I should do backups: I _already_ do.     * Stop implying backups are just enough to keep my data safe except if you are willing to give me TBs of free space to do years worth of backups.   * **A corrupted file =/=> Linux complaining**. So:      * Don't assume your system/data are sane just because the OS is booting.     * I hope you understand that I prefer (meta)data checksumming to an over-engineered and bloated piece of software that would inconveniently do half as a good job as BTRFS to check the data integrity. Is that more clear now that I am not asking for which FS is "better"? The question is, given that I regularly do backups, is BTRFS still too experimental to be used for its data-integrity checking functions or should I stick to EXT4?


title: Extract Data between comma

text: I have an output file which contains different numbers seperated by commas. But the issue is I do not know the number of commas. I would in turn like this data to be grep on another file. For example: I have INFO: `10,20,30,55,58,47,52,100` I use               awk '{split($0,a,","); for (i=1; **i <=8**; i++) print a[i]}' TMPFILE to extract the data. But I do not know how long the `for` loop has to be performed. Once I get those numbers like 10, I need to `grep` that on data.txt then 20 on data.txt and so on untill the last number.


title: I deleted /bin/rm. How do I recover it?

text: Just for fun, I thought I would use this command on my Raspberry PI running Raspbian:               sudo rm -f /bin/rm      I thought I could just reinstall `coreutils`: I was wrong! `apt-get install --reinstall coreutils` gives an error from `dpkg`, saying it couldn't remove the package. Compiling from source doesn't work because the `Makefile` uses `rm`. How can I get a working `rm` back?


title: Massively creating files with bash

text: I have been trying to figure this out tried different commands and still have gotten no where. Can you please help me with this question? In your home directory, create a subdirectory called shirts. Within the subdirectory, create 108 files with file names of the form style.size.color.ext, where each file contains one combination of values from the following table.               Style   tee, crew, turtleneck     Size    XXL, XL, L, M, S, XS     Color   red, yellow, blue     Extension   info, inv      This is the last command I used.               $ touch shirts/{tee,crew,turtleneck}.{XXL,XL,L,M,S,XS}.{red,yellow,blue}/{info,inv}


title: How to find the full path of a file from my Desktop in Centos?

text: My folders in desktop: ![my folder in desktop](http://i.stack.imgur.com/8UpS2.jpg) My folder name about which I'm interested is `Ram`: ![what are the sub folders in my main folders](http://i.stack.imgur.com/xc6mO.png) ![enter image description here](http://i.stack.imgur.com/GlKPT.png) I tried the following command for installing `yoono-desktop`:               [root@localhost mpatil]# tar jxf ~/Ram/Downloads/yoono-desktop-1.8.43.tar.bz2 tar     tar (child): /root/Ram/Downloads/yoono-desktop-1.8.43.tar.bz2: Cannot open: No such file or directory     tar (child): Error is not recoverable: exiting now     tar: Child returned status 2     tar: Error is not recoverable: exiting now      I have root and password. I tried as root.


title: Fluctuating wifi signal and random disconnects rtl8192ce

text: Running Ubuntu 14.04 on a custom build. I have Encore wireless N300 PCI-E Adapter ( seen here ) The driver is available for download at this link as well. I am reading that a common fix for connection issues is to uninstall/reinstall the wireless driver. But before I jump the gun, I wonder if there is some other things I should look at first? Also, once downloaded, how do I install? It only drops connection for a second, and then re connects. The problem is, I lose my VPN connection and it then reconnects clean. (WiFi drops regardless of vpn or open) Note: I also have this posted for a few days in Ubuntuforums, but I've gotten no response yet.               lspci          Network controller: Realtek Semiconductor Co., Ltd. RTL8192CE PCIe Wireless Network Adapter (rev 01)      `lsmod | grep rtl`:               rtl8192ce              53550  0     rtl_pci                26690  1 rtl8192ce     rtlwifi                63475  2 rtl_pci,rtl8192ce     rtl8192c_common        53172  1 rtl8192ce     mac80211              626557  3 rtl_pci,rtlwifi,rtl8192ce     cfg80211              484040  2 mac80211,rtlwifi          iwconfig | grep Power     eth0      no wireless extensions.          lo        no wireless extensions.                    Bit Rate=144.4 Mb/s   Tx-Power=20 dBm                 Power Management:off      `wget -N -t 5 -T 10 http://dl.dropbox.com/u/57264241/wireless_script && chmod +x wireless_script && ./wireless_script`:               ########## wireless info START ##########          ##### release #####          Distributor ID:    Ubuntu     Description:    Ubuntu 14.04 LTS     Release:    14.04     Codename:    trusty          ##### kernel #####          Linux mike-System-Product-Name 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux          ##### lspci #####          03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 09)         Subsystem: ASUSTeK Computer Inc. P8H77-I Motherboard [1043:8505]         Kernel driver in use: r8169          06:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8192CE PCIe Wireless Network Adapter [10ec:8178] (rev 01)         Subsystem: Realtek Semiconductor Co., Ltd. RTL8192CE PCIe Wireless Network Adapter [10ec:8178]         Kernel driver in use: rtl8192ce     07:00.0 USB controller [0c03]: ASMedia Technology Inc. ASM1042 SuperSpeed USB Host Controller [1b21:1042]          ##### lsusb #####          Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub     Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 003: ID 04d9:a06b Holtek Semiconductor, Inc.     Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub     Bus 003 Device 002: ID 03f0:8904 Hewlett-Packard DeskJet 6940 series     Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub          ##### PCMCIA Card Info #####          ##### rfkill #####          0: phy0: Wireless LAN         Soft blocked: no         Hard blocked: no          ##### iw reg get #####          country 00:         (2402 - 2472 @ 40), (3, 20)         (2457 - 2482 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS         (2474 - 2494 @ 20), (3, 20), NO-OFDM, PASSIVE-SCAN, NO-IBSS         (5170 - 5250 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS         (5735 - 5835 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS          ##### interfaces #####          # interfaces(5) file used by ifup(8) and ifdown(8)     auto lo     iface lo inet loopback          ##### iwconfig #####          wlan0     IEEE 802.11bgn  ESSID:"HighMoon"                 Mode:Managed  Frequency:2.437 GHz  Access Point: <MAC address removed>                 Bit Rate=144.4 Mb/s   Tx-Power=20 dBm                 Retry  long limit:7   RTS thr=2347 B   Fragment thr:off               Power Management:off               Link Quality=70/70  Signal level=20 dBm                 Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:88   Missed beacon:0          ##### route #####          Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0     192.168.1.0     0.0.0.0         255.255.255.0   U     9      0        0 wlan0          ##### resolv.conf #####          nameserver 127.0.1.1     search hsd1.pa.comcast.net          ##### nm-tool #####          NetworkManager Tool          State: connected (global)          - Device: wlan0  [HighMoon] ----------------------------------------------------       Type:              802.11 WiFi       Driver:            rtl8192ce       State:             connected       Default:           yes       HW Address:        <MAC address removed>            Capabilities:         Speed:           144 Mb/s            Wireless Properties         WEP Encryption:  yes         WPA Encryption:  yes         WPA2 Encryption: yes            Wireless Access Points (* = current AP)         HighMoon-guest:  Infra, <MAC address removed>, Freq 2437 MHz, Rate 54 Mb/s, Strength 97         *HighMoon:       Infra, <MAC address removed>, Freq 2437 MHz, Rate 54 Mb/s, Strength 100 WPA2            IPv4 Settings:         Address:         192.168.1.146         Prefix:          24 (255.255.255.0)         Gateway:         192.168.1.1              DNS:             75.75.76.76         DNS:             75.75.75.75         DNS:             192.168.1.1          - Device: eth0 -----------------------------------------------------------------       Type:              Wired       Driver:            r8169       State:             unavailable       Default:           no       HW Address:        <MAC address removed>            Capabilities:         Carrier Detect:  yes            Wired Properties         Carrier:         off          ##### NetworkManager.state #####          [main]     NetworkingEnabled=true     WirelessEnabled=true     WWANEnabled=true     WimaxEnabled=true          ##### NetworkManager.conf #####          [main]     plugins=ifupdown,keyfile,ofono     dns=dnsmasq          [ifupdown]     managed=false          ##### iwlist #####          wlan0     Scan completed :               Cell 01 - Address: <MAC address removed>                         Channel:6                         Frequency:2.437 GHz (Channel 6)                         Quality=70/70  Signal level=26 dBm                           Encryption key:on                         ESSID:"HighMoon"                         Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s                                   24 Mb/s; 36 Mb/s; 54 Mb/s                         Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s                         Mode:Master                         Extra:tsf=0000000000000000                         Extra: Last beacon: 0ms ago                         IE: Unknown: 0008486967684D6F6F6E                         IE: Unknown: 010882848B962430486C                         IE: Unknown: 030106                         IE: Unknown: 2A0100                         IE: Unknown: 2F0100                         IE: IEEE 802.11i/WPA2 Version 1                             Group Cipher : CCMP                             Pairwise Ciphers (1) : CCMP                             Authentication Suites (1) : PSK                         IE: Unknown: 32040C121860                         IE: Unknown: 2D1AFC181BFFFF000000000000000000000000000000000000000000                         IE: Unknown: 3D1606081500000000000000000000000000000000000000                         IE: Unknown: DD810050F204104A00011010440001021041000100103B0001031047001002519461683B1AF5B2843176671BB6DB102100074C696E6B7379731023000D4C696E6B7379732045343230301024000776312E302E30321042000234321054000800060050F20400011011000D4C696E6B737973204534323030100800020084103C000103                         IE: Unknown: DD090010180203F02C0000                         IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00               Cell 02 - Address: <MAC address removed>                         Channel:6                         Frequency:2.437 GHz (Channel 6)                         Quality=70/70  Signal level=26 dBm                           Encryption key:off                         ESSID:"HighMoon-guest"                         Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s                                   24 Mb/s; 36 Mb/s; 54 Mb/s                         Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s                         Mode:Master                         Extra:tsf=0000000000000000                         Extra: Last beacon: 0ms ago                         IE: Unknown: 000E486967684D6F6F6E2D6775657374                         IE: Unknown: 010882848B962430486C                         IE: Unknown: 030106                         IE: Unknown: 2A0100                         IE: Unknown: 2F0100                         IE: Unknown: 32040C121860                         IE: Unknown: 2D1AFC181BFFFF000000000000000000000000000000000000000000                         IE: Unknown: 3D1606081100000000000000000000000000000000000000                         IE: Unknown: DD090010180200F02C0000                         IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00          ##### iwlist channel #####          wlan0     13 channels in total; available frequencies :               Channel 01 : 2.412 GHz               Channel 02 : 2.417 GHz               Channel 03 : 2.422 GHz               Channel 04 : 2.427 GHz               Channel 05 : 2.432 GHz               Channel 06 : 2.437 GHz               Channel 07 : 2.442 GHz               Channel 08 : 2.447 GHz               Channel 09 : 2.452 GHz               Channel 10 : 2.457 GHz               Channel 11 : 2.462 GHz               Channel 12 : 2.467 GHz               Channel 13 : 2.472 GHz               Current Frequency:2.437 GHz (Channel 6)          ##### lsmod #####          rtl8192ce              53550  0     rtl_pci                26690  1 rtl8192ce     rtlwifi                63475  2 rtl_pci,rtl8192ce     rtl8192c_common        53172  1 rtl8192ce     mac80211              626557  3 rtl_pci,rtlwifi,rtl8192ce     cfg80211              484040  2 mac80211,rtlwifi          ##### modinfo #####          filename:       /lib/modules/3.13.0-29-generic/kernel/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko     firmware:       rtlwifi/rtl8192cfwU_B.bin     firmware:       rtlwifi/rtl8192cfwU.bin     firmware:       rtlwifi/rtl8192cfw.bin     description:    Realtek 8192C/8188C 802.11n PCI wireless     license:        GPL     author:         Larry Finger    <Larry.Finger@lwfinger.net>     author:         Realtek WlanFAE    <wlanfae@realtek.com>     author:         lizhaoming    <chaoming_li@realsil.com.cn>     srcversion:     EF063698748457BBEDB4633     alias:          pci:v000010ECd00008176sv*sd*bc*sc*i*     alias:          pci:v000010ECd00008177sv*sd*bc*sc*i*     alias:          pci:v000010ECd00008178sv*sd*bc*sc*i*     alias:          pci:v000010ECd00008191sv*sd*bc*sc*i*     depends:        rtlwifi,rtl_pci,rtl8192c-common,mac80211     intree:         Y     vermagic:       3.13.0-29-generic SMP mod_unload modversions     signer:         Magrathea: Glacier signing key     sig_key:        <MAC address removed>:3B:EA:01:C4:BD:A9:65:67:CF:A7:23:C9:70:D8     sig_hashalgo:   sha512     parm:           swenc:Set to 1 for software crypto (default 0)      (bool)     parm:           ips:Set to 0 to not use link power save (default 1)      (bool)     parm:           swlps:Set to 1 to use SW control power save (default 0)      (bool)     parm:           fwlps:Set to 1 to use FW control power save (default 1)      (bool)     parm:           debug:Set debug level (0-5) (default 0) (int)          filename:       /lib/modules/3.13.0-29-generic/kernel/drivers/net/wireless/rtlwifi/rtl_pci.ko     description:    PCI basic driver for rtlwifi     license:        GPL     author:         Larry Finger    <Larry.FInger@lwfinger.net>     author:         Realtek WlanFAE    <wlanfae@realtek.com>     author:         lizhaoming    <chaoming_li@realsil.com.cn>     srcversion:     9B7F19319428FF0EFE7E350     depends:        mac80211,rtlwifi     intree:         Y     vermagic:       3.13.0-29-generic SMP mod_unload modversions     signer:         Magrathea: Glacier signing key     sig_key:        <MAC address removed>:3B:EA:01:C4:BD:A9:65:67:CF:A7:23:C9:70:D8     sig_hashalgo:   sha512          filename:       /lib/modules/3.13.0-29-generic/kernel/drivers/net/wireless/rtlwifi/rtlwifi.ko     description:    Realtek 802.11n PCI wireless core     license:        GPL     author:         Larry Finger    <Larry.FInger@lwfinger.net>     author:         Realtek WlanFAE    <wlanfae@realtek.com>     author:         lizhaoming    <chaoming_li@realsil.com.cn>     srcversion:     27E91755814596D634B7709     depends:        mac80211,cfg80211     intree:         Y     vermagic:       3.13.0-29-generic SMP mod_unload modversions     signer:         Magrathea: Glacier signing key     sig_key:        <MAC address removed>:3B:EA:01:C4:BD:A9:65:67:CF:A7:23:C9:70:D8     sig_hashalgo:   sha512          filename:       /lib/modules/3.13.0-29-generic/kernel/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko     description:    Realtek 8192C/8188C 802.11n PCI wireless     license:        GPL     author:         Larry Finger    <Larry.Finger@lwfinger.net>     author:         Ziv Huang    <ziv_huang@realtek.com>     author:         Georgia        <georgia@realtek.com>     author:         Realtek WlanFAE    <wlanfae@realtek.com>     author:         lizhaoming    <chaoming_li@realsil.com.cn>     srcversion:     32F826C623BC49F764F7974     depends:             intree:         Y     vermagic:       3.13.0-29-generic SMP mod_unload modversions     signer:         Magrathea: Glacier signing key     sig_key:        <MAC address removed>:3B:EA:01:C4:BD:A9:65:67:CF:A7:23:C9:70:D8     sig_hashalgo:   sha512          ##### modules #####          lp     rtc          coretemp     nct6775          coretemp     nct6775          ##### blacklist #####          [/etc/modprobe.d/blacklist-ath_pci.conf]     blacklist ath_pci          [/etc/modprobe.d/blacklist.conf]     blacklist evbug     blacklist usbmouse     blacklist usbkbd     blacklist eepro100     blacklist de4x5     blacklist eth1394     blacklist snd_intel8x0m     blacklist snd_aw2     blacklist i2c_i801     blacklist prism54     blacklist bcm43xx     blacklist garmin_gps     blacklist asus_acpi     blacklist snd_pcsp     blacklist pcspkr     blacklist amd76x_edac          [/etc/modprobe.d/fbdev-blacklist.conf]     blacklist arkfb     blacklist aty128fb     blacklist atyfb     blacklist radeonfb     blacklist cirrusfb     blacklist cyber2000fb     blacklist gx1fb     blacklist gxfb     blacklist kyrofb     blacklist matroxfb_base     blacklist mb862xxfb     blacklist neofb     blacklist nvidiafb     blacklist pm2fb     blacklist pm3fb     blacklist s3fb     blacklist savagefb     blacklist sisfb     blacklist tdfxfb     blacklist tridentfb     blacklist viafb     blacklist vt8623fb          ##### udev rules #####          # PCI device 0x10ec:0x8168 (r8169)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<MAC address removed>", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"          # PCI device 0x10ec:0x8178 (rtl8192ce)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<MAC address removed>", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"          ##### dmesg #####          [    5.120047] rtl8192ce: Using firmware rtlwifi/rtl8192cfw.bin     [    5.194147] ieee80211 phy0: Selected rate control algorithm 'rtl_rc'     [    5.194286] rtlwifi: wireless switch is on     [    8.897871] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [    8.898113] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [   11.059263] wlan0: authenticate with <MAC address removed>     [   11.079193] wlan0: send auth to <MAC address removed> (try 1/3)     [   11.080713] wlan0: authenticated     [   11.082910] wlan0: associate with <MAC address removed> (try 1/3)     [   11.085949] wlan0: RX AssocResp from <MAC address removed> (capab=0x411 status=0 aid=2)     [   11.086080] wlan0: associated     [   11.086087] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready     [   11.130630] wlan0: deauthenticating from <MAC address removed> by local choice (reason=2)     [   11.161112] wlan0: authenticate with <MAC address removed>     [   11.507939] wlan0: send auth to <MAC address removed> (try 1/3)     [   11.509417] wlan0: authenticated     [   11.510494] wlan0: associate with <MAC address removed> (try 1/3)     [   11.517862] wlan0: RX AssocResp from <MAC address removed> (capab=0x411 status=0 aid=2)     [   11.517993] wlan0: associated     [   19.514761] wlan0: Connection to AP <MAC address removed> lost     [   20.825705] wlan0: authenticate with <MAC address removed>     [   20.845680] wlan0: send auth to <MAC address removed> (try 1/3)     [   20.849279] wlan0: authenticated     [   20.853472] wlan0: associate with <MAC address removed> (try 1/3)     [   20.856489] wlan0: RX AssocResp from <MAC address removed> (capab=0x411 status=0 aid=2)     [   20.856620] wlan0: associated          ########## wireless info END ############      Also went into Network Manager and locked in BSSID number in previously blank field. Still, I see the WiFi icon fluctuating. BSSID found through running:               cat /var/log/syslog | grep -e etwork -e wlan | tail -n20      Which gave me a message:               WLAN:0 WPA: GROUP     Rekeying completed with ( BSSID NUMBER)     [GTK=CCMP]


title: Replacing part of a string with another part of that same string

text: How would I go about replacing part of a string with another part of that same string, in a bash script, using `sed`?


title: Working of rm/ls with [0-9]

text: I am learning the shell commands and came across the short tags eg.[0-9],[[:digit:]] etc.. As a proof of concept i tried deleting all the files with the rm command(i know its not a good practise but i am trying to understand how things work),like this               rm [0-9].txt      there were two files in the directory 0.txt and 9.txt and it deleted the files 0.txt and 9.txt .I guessed that the expression [0-9] is expanded and then read as 0.txt 1.txt 2.txt .... However when you try only rm 5.txt,and the file does not exist, an error is thrown.. someone please tell me how the shorthand commands work when used with rm or ls.


title: Locate encfs rootdir

text: If a rootdir is mounted by encfs to a mount point, I can see the mount point by "mount" command or from the /proc/mounts. However, if I can get the mount point, but I don't know which rootdir I have mounted, how do I locate that encrypted directory?


title: How do I assign the controlling terminal to other process?

text: I use `TIOCSCTTY` to forcibly take over the controlling terminal in other "remote" application. But after the application finishes running, controlling terminal gets orphaned and `bash` stops reacting to `Ctrl`+`C` until I restart it with `bash$ exec bash`. How should I explicitly return the controlling terminal back after taking it with `TIOCSCTTY`?


title: Learning linux at the lower level

text: How do I learn about linux at a low level? I was trying to customize grub and utterly failed and suddenly realized I don't know anything about grub, or anything that low level. Where do I learn?


title: How to get a string between two special characters using Shell?

text: I want to get a string between two special characters. For example,               /home/oracle/ggs/text.ext      I want **oracle/ggs** in the above string. How can I do this using bash?


title: How to put the output of the trailing lines of grep in on-line?

text: Assuming that I have this file:                Thu May  8 15:32:07 2014             User-Name = "Mark"             Framed-IP-Address = 0.0.0.0             Acct-Status-Type = Interim-Update             Acct-Input-Octets = 95684             Acct-Output-Octets = 23564              Thu May  8 15:32:07 2014             User-Name = "Mike"             Framed-IP-Address = 0.0.0.0             Acct-Status-Type = Interim-Update             Acct-Input-Octets = 95684             Acct-Output-Octets = 23564         Thu May  8 15:32:07 2014             User-Name = "Mike"             Framed-IP-Address = 0.0.0.0             Acct-Status-Type = Interim-Update             Acct-Input-Octets = 95684             Acct-Output-Octets = 23564              Thu May  8 15:32:07 2014             User-Name = "Mark"             Framed-IP-Address = 0.0.0.0             Acct-Status-Type = Interim-Update             Acct-Input-Octets = 95684             Acct-Output-Octets = 23564      I have managed to get the Information that are related to a user using `grep` with `-A` option:               grep -A4 "Mark" test             User-Name = "Mark"             Framed-IP-Address = 0.0.0.0             Acct-Status-Type = Interim-Update             Acct-Input-Octets = 95684             Acct-Output-Octets = 23564     --             User-Name = "Mark"             Framed-IP-Address = 0.0.0.0             Acct-Status-Type = Interim-Update             Acct-Input-Octets = 95684             Acct-Output-Octets = 23564      but my desired output is something like that:               User-Name = "Mark"                  Acct-Input-Octets = 95684 95684                 Acct-Output-Octets = 23564 23564      as we notice I want to eliminate the first two lines after "Mark" `Framed-IP- Address = 0.0.0.0`, `Acct-Status-Type = Interim-Update` and put all the values of the same field in the same line? as Warwick suggest,the first part of my question can be easily answered:               grep -A4 "Mark" test| grep -v Framed-IP-Address | grep -v Acct-Status-Type      Note this is an example, the file may contain a lot of section with User-Name ="Mark" and the desired output will be something like that:               User-Name = "Mark"                      Acct-Input-Octets = val1 val2 val3 val4 .......                     Acct-Output-Octets = val1 val2 val3 val4 ........


title: Open old Kde Wallet/KWallet

text: Recently I replaced the hard drive on a laptop with an SSD. I recycled the old drive as a backup drive. I have the old home folders of my setup and nothing else. I have discovered that I am missing paswords which were stored in the old kde wallet. Can I somehow open the old wallet ( I still now it's password ) and see what was stored on it?


title: Create an absolute symbolic link to the current directory

text: I am now under a directory with very long path. For future visiting it quicker, I would like to create a link to it. I tried `ln -s . ~/mylink` `~/mylink` actually links to `~`. So can I expand `~` into the obsolute pathname, and then give it to `ln`?


title: Proxy from OSX laptop to debian server for web browsing

text: I want to setup a proxy from my OSX laptop (10.9) to a debian server via SSH, to browse the net via that server. The debian server has an openssh-server running, and I can login. I tried several things, but nothing worked.               ssh -D 8888 -C -N john@server.com      I have to enter my password, and there is nothing that indicates that the connection is created. If I try a faulty password, then there is an error message, so I guess no message means that the connection is OK. I've installed the Proxy Selector addon in Firefox, created the proxy with port 8888, for server.com and user john. When I open a website I get the following error:               The proxy server is refusing connections      Should I change some configuration on the server? Do I need to open port 8888 on the server? Why doesn't this work?


title: POSIX usage standards for requiring at least one optional arg

text: So, I'm writing a CLI for an API, and I ran into a point where one of the commands `support` has two optional arguments, `id` and `fields` I want to know how to show that these arguments are optional, BUT, you have to supply at least ONE of them, or even both. I'm not sure how to word the Google search, so I haven't been able to turn anything up. My best guess is something like `Usage: support [id=...]||[fields=...]` but I'd like to know the standard.


title: How do I get my laptop screen backlight brightness controls to work?

text: What do I need to do to get my laptop screen backlight brightness controls to work? I currently have Ubuntu 13.04 and a Dell Studio 1558. After reading these two links: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1007765   http://ubuntuforums.org/showthread.php?t=2061712 I attempted the following, I change the permissions (since I was having errors editing the files)               sudo chmod a+w /sys/class/backlight/intel_backlight/brightness      And then I overwrote the file with `1000` (appears `max_brightness` is `4882`)               sudo echo 1000 > /sys/class/backlight/intel_backlight/brightness      And lo and behold, my screen dimmed. I've tweaked it before, I'm not sure exactly how, and I don't know why I had to change the permissions on the file again, if I did it that way before. How can I adjust brightness with the standard keys?


title: Why it is necessary to update /etc/default/grub, and not just save it?

text: I understand that the grub file contains some instructions that are required before booting such as: booting in text or booting in Graphics mode. My question is why do I need `update-grub`? Why just saving the file after making changes would not work?


title: Linux Equivalent of Windows Reparse Points?

text: I've recently become aware of a neat feature of Windows file systems called a reparse point. My understanding is that they are files whose contents when read are not the contents on the actual disk, but whatever the application they request says they are. The most striking use of this I am aware of is in Skydrive: All of your Skydrive files can be made to appear to be on disk even when they're not. When you access them they are actually streamed from the internet by Skydrive, because determining the true contents of the file is delegated to it. Is there any mechanism in the Linux world to provide this kind of functionality? I've stumbled across Device Files and Named Pipes, but they both seem tailored to having a single file represent the interface to an application, rather than having several files and folders all appearing to be regular files but being "translated" by an application when accessed.


title: Automatically detect when I typed "vi" but meant "cd"?

text: Title says it all. About 5 times a day, I type "vi" when I meant "cd", and end up opening a directory in vi. It's making me NUTS. It seems like there should be a way to detect when I type in "vi + directory" and automatically change it to "cd + directory". Thoughts?


title: How to create a custom keyboard-shortcut for renaming files on CentOS?

text: I want to create a keyboard-shortcut for renaming files, like the `F2` key in Windows. How can I do that in CentOS 6.4? Following is the image of the panel for keyboard shortcuts: ![keyboard shortcuts panel](http://i.stack.imgur.com/DYyVr.png)


title: multiple background processes in a script

text: Suppose if i have a situation in which some files need to be copied and it takes long time so i would have to go for parallel processing of the file copy. for example it may look like this               for i in ipaddresslist     do          cp x y &  //running in back ground or some other process in background          done          wait  //will cause till all the files are copied or whatever process if all are finished      now i have used `wait` so that all the backgroud processes are completed but there are cases in it like 1) some file copy may happen earlier so if i have to do some processing on these files i have to wait till all the files are copied. 2) if the copy process (or any other program running in back ground) writes to a log file the log file could be garbled with each background process trying to write to the file at the same time. is there any workaround for such things, 1)i mean if i can know that this process has finished then i could start doing the rest of the processing for that particular instance of the process(say file copy) if its completed. also, moreover writing to log files could be in orderly fashion. please make suggestions


title: How should I manage CentOS for long term production use?

text: I am newbie server developer who is preparing a new service. I looked for some server hosting services, and the company I chose supports only CentOS 5.8 and 6.2. So I wanted to try it on my local VM, but I discovered the versions are deprecated, and no longer supported from CentOS team. As far as I know, one reason for choosing for CentOS is its long term support, so I am confused now. I have used Ubuntu on my VM, and Ubuntu has explicit policy for long term use called LTS. I am expecting something like that on CentOS. What version should I choose for long term production use, and should I upgrade the system version when newer version comes out? What kind of installation and management pattern is expected on CentOS?


title: Debugging lock-up - systemd loses my logs

text: Ever since I have "upgraded" to systemd on Arch Linux, I keep losing logs when an unexpected lockup happens. I hit the same log-losing issue one month ago and just hit the issue again. There are also independent other confirmations. Situation:   * While doing some stuff in Java and with network-related utilities, I saw that KDE (the clock) was frozen. The CPU fan became noisy and the heat was rising. The mouse pointer could still be moved though.   * I tried to ssh from another machine (failed due to "no route to host")   * I waited a few minutes, perhaps the NMI watchdog could kill the offending task. No dice.   * `Ctrl` + `Alt` + `F1` did not work either, even after `SysRq` + `R`   * Since the above steps did not work, I decided to issue the SysRq sequence R-E-I. After `E`, the screen became black, but no console either. Not even after `SysRq` + `K`   * So, this session appears to be lost, the only thing that can be done is gathering debugging information. Looking at Wikipedia, I decided to press `SysRq` + `d` (display held locks) among some others.   * After pressing `SysRq` + `S` I waited a second and then rebooted with `SysRq` + `B`.   * After rebooting and logging into a console, I saw no traces of any crash. The most recently logged entry was from using Wireshark, but there was still a gap of 45 minutes. (I was running Linux v3.8-rc5-218-ga56e160 btw) So, how can I make sure that my logs are retained when abnormally rebooting due to a lockup?


title: Run command based on output of another command

text: OS: AIX 7100-04-1216 So basically I'm trying to write a for loop that sees which volumegroups I have on my system, which filesystems reside in those volume groups and what the size of each of those filesystems is. I have following code:               for LINE in `lsvg` ; do         echo "Volume Group: "${LINE}         for LINE2 in `lsvgfs ${LINE}` ; do             echo "`lsvgfs ${LINE}` \n"             df -g ${LINE2}         done     done      The output of lsvg               rootvg     nimvg      The output of lsvgfs (for rootvg)               /     /usr      The output of lsvgfs (for nimvg)               /export/nim/lpp_source     /export/nim/spot       The output of df -g (for / in volumegroup rootvg)               Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on     /dev/hd4           5.25      2.86   46%     9957     2% /      The output of df -g (for /usr in volumegroup rootvg)               Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on     /dev/hd2           2.00      0.17   92%    43194    50% /usr      The output of df -g (for /export/nim/lpp_source in volumegroup nimvg)               Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on     /dev/fslv02       10.00      8.24   18%      597     1% /export/nim/lpp_source      The output of df -g (for /export/nim/spot in volumegroup nimvg)               Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on     /dev/hd4           5.25      2.86   46%     9957     2% /      What it should do:               Volume Group: rootvg     File System: /     /dev/hd4           5.25      2.86   46%     9957     2% /     File System: /usr     /dev/hd2           2.00      0.17   92%    43194    50% /usr     File System: /var          Volume Group: nimvg     File system: /export/nim/lpp_source     /dev/fslv02       10.00      8.24   18%      597     1% /export/nim/lpp_source     File system: /export/nim/spot      /dev/hd4           5.25      2.86   46%     9957     2% /      What I get:               Volume Group: rootvg     /     /usr     Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on     /dev/hd4           5.25      2.86   46%     9957     2% /     /     /usr     Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on     /dev/hd2           2.00      0.17   92%    43194    50% /usr               Volume Group: nimvg     /export/nim/lpp_source     /export/nim/spot      Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on     /dev/fslv02       10.00      8.24   18%      597     1% /export/nim/lpp_source     /export/nim/lpp_source     /export/nim/spot           Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on     /dev/hd4           5.25      2.86   46%     9957     2% /


title: CPU fan extremely fast even with 0% CPU

text: I just reinstalled my operating system (Crunchbang on Debian testing), and all of a sudden the fan is running as fast as it can even with 0% CPU. The air coming out of it is cold. The only CPU frequency governors available according to `/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors` are performance and powersave, and it was already set to powersave by default. What else could be wrong?               ruukasu@cb-lt:~$ sensors     acpitz-virtual-0     Adapter: Virtual device     temp1:        +38.0°C  (crit = +108.0°C)          pkg-temp-0-virtual-0     Adapter: Virtual device     temp1:        +39.0°C            coretemp-isa-0000     Adapter: ISA adapter     Physical id 0:  +39.0°C  (high = +87.0°C, crit = +105.0°C)     Core 0:         +32.0°C  (high = +87.0°C, crit = +105.0°C)     Core 1:         +39.0°C  (high = +87.0°C, crit = +105.0°C)


title: Vim command mapping help

text: I'm a relatively recent convert to Vim, so I don't know a whole lot. My question is about mapping a multi-part command to a single key combo. In my .vimrc, I've got the following line:               nnoremap <leader>ss :w\|:silent !execute_external_script > output_of_script.txt\|:redraw!<cr>      As you can see, I've got three commands I want to execute when i press `<leader>ss`. First, write the file, then execute my external script (the script runs a unit test). Unfortunately, my terminal doesn't redraw Vim after executing the shell command. So I tried appending that `:redraw!` command, apparently that command is getting passed to the shell, not to Vim, because I'm getting this error: `bash: :redrawecho: command not found`. How do I write the command so that the script executes in the shell, then redraw executes in Vim? (Also, as a bonus, could anyone explain what `<cr>` does?)


I am in **Ubuntu 10.04**. When I install the software updates with " **Update Manager** ", there is a pop up dialog which tells me "The volume "boot" has only 0 byte disk space remaining" How to get rid of this?


title: Automatically run commands over SSH on many servers

text: There is a list of IP addresses in a .txt file, ex.:               1.1.1.1     2.2.2.2     3.3.3.3      Behind every IP address there is a server, and on every server there is an sshd running on port 22. Not every server is in the `known_hosts` list (on my PC, Ubuntu 10.04 LTS/bash). How can I run commands on these servers, and collect the output? Ideally, I'd like to run the commands in parallel on all the servers. I'll be using public key authentication on all the servers. Here are some potential pitfalls:   * The ssh prompts me to put the given servers ssh key to my `known_hosts` file.   * The given commands might return a nonzero exit code, indicating that the output is potentially invalid. I need to recognize that.   * A connection might fail to be established to a given server, for example because of a network error.   * There should be a timeout, in case the command runs for longer than expected or the server goes down while running the command. The servers are AIX/ksh (but I think that doesn't really matter.


title: Log in to multiple remote servers and execute a script

text: I want to make a script that will remote login to the multiple servers listed in a txt file like               10.3.9.6     10.3.9.7      and all servers have same username and password. and want to capture the output of each script of each server to the server which is executing the script.


title: ssh to multiple hosts and run a command

text: How do I ssh into multiple hosts (e.g host1, host2, host3, etc) and cat `/etc/fstab` to generate `report.txt`?


title: Running commands on multiple servers

text: I want to execute a process on multiple servers. I am using the following wrapper script. The script moves to servers one at a time. I would like to change it so it can execute on multiple servers. Is there way to do it?               #!/bin/bash     for ip in $(<ALL_SERVERS_IP); do         # Tell the remote server to start bash, but since its         # standard input is not a TTY it will start bash in         # noninteractive mode.         ssh -q "$ip" bash <<-'EOF'             printf "%s\n" ================== "$(hostname) ::: Current date : $(date)" \                                 ==================             ./remote          EOF     done


title: How to display TSV (csv) in console, when empty cells are missed by: `column -t -s $'\t' `

text: I have file with columns spearated with `tab`. I have file when some rows have empty cells (on begining, in middle). In such cases `column -t -s $'\t'` simply fails: Input:               $ echo -e 'A\tB\tC\tD\n\tb1\t\td1\n\t\t\td2\na3\t\t\td3' > in.tsv     $ hexdump -C in.tsv      00000000  41 09 42 09 43 09 44 0a  09 62 31 09 09 64 31 0a  |A.B.C.D..b1..d1.|     00000010  09 09 09 64 32 0a 61 33  09 09 09 64 33 0a        |...d2.a3...d3.|     0000001e      column output:               $ cat in.tsv | column -t -s $'\t'     A   B   C  D     b1  d1     d2     a3  d3      instead of:               A       B       C       D             b1              d1                             d2     a3                      d3      Could you recommend how to do TSV command line formatting ? (in Unix way, I want to pipe output of program into formatter, like `column`) Any way of "fixing" `column` approach? Maybe another tool?