title: Know when the desktop is running, in bash

text: I have a deamon, implemented in bash and running by means of `cron` and the `@reboot` option, that shows the desktop in inactivity. The script is as following (timings are short for testing purposes):               #!/bin/bash     P_STATE=0     while :     do         sleep 5         if [ $P_STATE == 0 ]; then              [ `xprintidle` -ge 25000 ] && P_STATE=1 && wmctrl -k on         else              [ `xprintidle` -le 25000 ] && P_STATE=0     done      Problem: If a user is still, for example, in the login screen, `xprintidle` and `wmctrl` fails since the desktop isn't yet loaded. In order to avoid this, I've put the next lines at the very beginning of the script:               while:     do         sleep 10s         [ -n `who | grep "$USER"` ] && break     done      So, the script waits the user (the USER variable is set to my user-name in the crontab file) is logged. But, it a user begins, for example, a terminal session (and not a graphical session like KDE or GNOME), the script also continue. How can I determine if a user is already in a "graphical" session capable of "showing desktop mode" or not? And moreover, how can I ensure that a "graphical" session is completely loaded and not in process of loading or something like that? **My solution:** My (informal) solution is adding in the main loop the `grep` line:               WAIT_TIME=180          while:     do         sleep $WAIT_TIME              [ ! -n "`ps -ef | grep "$WM_CMD" | grep -v "grep"`" ] && continue              ## My actions here     done      Being "$WM_CMD" the target _windows manager command_. I assume that, if the _windows manager command_ is running in the system, it means the desktop is completely loaded and any "graphic" command is sure. Where is WM_CMD variable defined? In the `crontab` line:                @reboot DISPLAY=:0 WM_CMD=/usr/bin/gnome-shell exec script_path/myscript.sh &> /dev/null      But also I think that it would be possible to detect the "windows manager command" by means of other system requests. However, for me defining WM_CMD in the crontab file is enough.


title: How linux know the type of the file it is dealing with?

text: In windows the OS know the type of file by using extension: exe,doc,ppt,pdf .... etc In Linux as we know that the extension is useless. My question is how can Linux know the type of file it is dealing with: shell script, audio file,video file .... etc or is it dealing with all the files in the same way?


title: Iptables forward with pptp and openvpn

text: I have OpenVPN and PPTP installed on a VPS. I'm having a few questions that I can't seem to get a firm answer on. I want to install OpenVPN on 1.1.1.1 (eth0, public IP address) and PPTP on 1.1.1.2 (eth0:1, public IP address). I was able to achieve this with SNAT. However, from all the tutorials I've been reading it recommends forwarding ppp+ to eth0 and vice versa and the same situation for the tun interface.               iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT     iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT     iptables -A FORWARD -i ppp+ -o eth0 -j ACCEPT     iptables -A FORWARD -i eth0 -o ppp+ -j ACCEPT      My setup is CentOS, dedicated server. For some reason I'm assuming iptables will route all traffic from eth0 to tun0 and stop at that.   1. Will these forward rules conflict with each other?   2. Will I need to forward the ppp+ to eth0:1 instead to avoid confliction? Is it even possible? I haven't figured out a way yet.    3. Is iptables smart enough to route traffic that is specific to tun and ppp through these rules?


title: Apache created files and its permissions for CentOS 6.x

text: In short, I have an authenticated HTTP-POST that:   * posts a jpg image (created as 666 apache:www) into `/directory1` (777 `ftpuser:www`)   * creates `/directory2` (created as 666 apache:www) in a 777 `ftpuser:www` dir   * moves image into `/directory2` (fails) All of `/var/www/website.com` is `ftpuser:www` with the exception of Apache- created files of course. Currently, the image is uploaded as 666 `apache:www`, the folder is created, but the next step of copying the photo fails. Where am I going wrong? I've tried `setpacl` on the apache user and `umask` but I'm spinning my wheels now.   1. Why is it that the apache user can't copy a file it created to a folder it created?   2. `apache` and `ftpuser` are both part of the `www` group. is this bad practice; what's the recommended practice? Other notes: I'm using `vsftpd` for FTP and using a umask of 002 in my `vsftpd.conf`.


title: systemd - umount device after service which depends on it finishes

text: I'm trying to implement a mechanism of automated backup using udev rules and systemd. The idea is to launch a backup routine upon hot-plugging a specific storage device, quite similar to this question, for which I provided an answer myself by the way, but here I'm interesteded in discussing some further tweaks. Namely I want the device to be umounted after the backup service finishes. **Some background:** So far I got it to work using udev to start up a systemd service which itself runs a backup routine. The relevant files follow: **backup.service**               [Unit]     Description=<DESCRIPTION HERE>     BindsTo=<STORAGE DEVICE UNIT HERE>.device mnt-backup.mount     After=<STORAGE DEVICE UNIT HERE>.device mnt-backup.mount          [Service]     ExecStart=<CALL TO BACKUP SCRIPT HERE>      **mnt-backup.mount**               [Unit]     DefaultDependencies=no     Conflicts=umount.target     Before=umount.target          [Mount]     What=/dev/disk/by-uuid/<DEVICE UUID HERE>      Where=/mnt/backup     Type=<FILESYSTEM HERE>      **90-backup.rules**               KERNEL=="sd*", ATTRS{serial}=="<HD SERIAL HERE>", TAG+="systemd", ENV{SYSTEMD_WANTS}+="backup.service"       **The question:** Now I want mnt-backup.mount to be stopped as soon as backup.service finishes. According to the documentation ExecStartPost= will be executed after the command in ExecStart=, so I tried adding               ExecStartPost=/usr/bin/systemctl stop mnt-backup.mount      to backup.service, even though I realise it stops mnt-backup.mount, to which it is itself bound, what, as far as I understand, effectively requires backup.service to be stoped before mnt-backup.mount for a graceful stop, hence creating a cyclic dependence. When testing this, it worked a couple of times before I experienced a kernel panic, the first I've seen on my machine, so it got me wondering if this was somehow the cause. In any case, **is my approach correct?**


title: Piping for loop output prevents local variable modification

text: I am trying to write a simple bash function that takes, as its arguments, a number of files and/or directories. It should:   1. Fully qualify the filenames.   2. Sort them.   3. Remove duplicates.   4. Print all that actually exist.   5. Return the number of non existant files. I have a script that almost does what I want, but falls down on the sorting. The return value of the script as it stands is correct, but the output is not (unsorted and duplicates). If I uncomment the `| sort -u` statement as indicated, the output is correct but the return value is always `0`. N.B. Simpler solutions to solve the problem are welcome but the question is really about why is this occuring in the code I have. That is, why does adding the pipe seemingly stop the script incrementing the variable `r`? Thankyou for your help. Here's the script:               function uniqfile     {         local r=0               for arg in "$@"         do               readlink -e "$arg" || (( ++r ))              done #| sort -u    ## remove that comment              return $r     }


title: Why is my variable being localized in one 'while read' loop, but not in another seemingly similar loop

text: Why do I get different values for $x from the snippets below?               #!/bin/bash          x=1     echo fred>junk ; while read var ; do x=55 ; done <junk     echo x=$x      #    x=55 .. I'd expect this result          x=1     cat junk | while read var ; do x=55 ; done     echo x=$x      #    x=1 .. but why?          x=1     echo fred | while read var ; do x=55 ; done     echo x=$x      #    x=1  .. but why?


title: bash script var not changed after the loop

text: I'm quite new to bash scripting, and I wrote the following script to emulate the `wc -c` command: (I know it doesn't count the end of the line)               #!/bin/bash          echo $1     len=0     cat $1 | while read line     do         let len+=${#line}         echo $len     done     echo $len      the output is the following:               xyz.sh     11     11     18     27     51     53     70     79     83     92     0      why doesn't `len` stays changed after the loop, and hoe to make it to do so?


title: question about a 'while' logics error

text: > **Possible Duplicate:**   >  Why is my variable being localized in one ‘while read’ loop, but not in > another seemingly similar loop I have a bash script that scraps URLs to feed a MySQL database. In my loop, I have a variable called query that gets filled ok, but when I try to output it, it always says it's empty!               #!/bin/bash          #   get path to here     [ -L $0 ] && P1=$(readlink $0) || P1=$0     P2=$(dirname $P1)          #   slugify the name of the city into URL format     function slugify() {         slug="$@"              echo    "$slug"             |         tr      '[A-Z]' '[a-z]'     |         sed     's/\s/-/g'     }          echo "Getting list of cities from csv file"          i=$(( 0 ))      #   lines read     g=$(( 0 ))      #   curl OK     f=$(( 0 ))      #   number of pages not found          #   total number of cities in CSV file     lines=$(wc -l  $P2/docs/cities.csv | cut -d' ' -f1)          #   Reading CSV file line by line     while read ROW     do         # getting city iso_code         city_iso_code=$(echo $ROW | cut -d, -f1| sed -e 's/.$//' | sed 's/^FR\([^A-Z0-9]\+\)//')         # getting city name         city_name=$(echo $ROW | cut -d, -f3 | sed "s/'/\\\'/g" | sed -e 's/.$//')              # stop after 1 good result to see if everything ok         # [[ "$city_name" == A* ]] || {         [ $g -gt 1 ] && {             echo 'Done for today'             # THIS IS WHERE query is empty when it should not!!             echo "Query: <$query>"                  exit         }              # slugify city name         city_slug=$(slugify $city_name)              # construct url to fetch         city_url="http://******/****$city_slug.html"              # visual teller         echo -en "\r$g ok, $f not found | $city_name | $city_url            "              # check if page exists, if so scrap it, else fill the Not found page         # I realize I am doing 2 curl Calls for every request :(         [ $(curl -s -o /dev/null -w "%{http_code}" $city_url) -eq 200 ] && {                  # increment the total of OK             g=$(( g + 1 ))                  # getting contents and scrapping it             curl 2>/dev/null $city_url  |                  sed     's/</\n/g'      |                  grep    'td id="r'      |                  cut     -d'>' -f 2      |                  sed     "s/'/\\\'/g"    |                  while read street                 do                     # constructing query                     query="$query insert into cc_streets (city_iso_code,street_name) values ('FR $city_iso_code','$street');"                 done             } || {                 # not found                 f=$(( f + 1 ))                 notfound="$notfound     FR $city_iso_code,$city_name,$city_url"         }               i=$(( i + 1 ))     done < $P2/docs/cities.csv      So in the WHILE loop,when I echo 'Done for today', and try to output the variable query, it says it's empty, but I know the query variable gets filled alright if I echo query in the second WHILE, so query gets reset at one moment in the loop but I can't quite get when. Anybody has a clue as why it does not work? Thanks for your insight!


title: Why does selecting text only "copy" it (as in copy and paste) circumstantially?

text: One of the most user-friendly features of Linux is that highlighting or selecting text will automatically _copy_ it so that it can be pasted upon a middle- click. However, this can also be a point of frustration because this behavior only works under certain conditions. For example, it works consistently in Chrome, in terminals, and many GTK apps, but strangely, not in LibreOffice. Is there any way to make selecting text _copy_ the text under every circumstance?


title: I have a cpp error on UNIX

text: Hans Lao@Hans ~     $ cd /home/ddscat130527/src          Hans Lao@Hans /home/ddscat130527/src     $ make ddscat     cpp -P -traditional-cpp -Dsp ddprecision.f90 \     ddprecision_cpp.f90     make: cpp: Command not found     Makefile:508: recipe for target 'ddprecision.mod' failed     make: *** [ddprecision.mod] Error 127          Hans Lao@Hans /home/ddscat130527/src     $      I need to install cpp but don't know how.


title: Default GNOME cursors package?

text: I installed a minimal version of Debian (wheezy), and then installed GNOME on top. However, it doesn't come with any special mouse cursors except for a non- descript black cursor. I was wondering if there was a package I could download that contained the cursor set that came default with GNOME?


title: Changing Unix group for files

text: I have a file that a colleague and I are editing together, on a Unix system. We are using Unix group permissions to edit it. We have one Unix group that we are both members of. Whenever I save the file, it changes the Unix group to one that he is not a member of. Is there any way to stop it from doing that?


title: Can I configure my Linux system for more aggressive file system caching?

text: I am neither concerned about RAM usage (as I've got enough) nor about losing data in case of an accidental shut-down (as my power is backed, the system is reliable and the data are not critical). But I do a lot of file processing and could use some performance boost. That's why I'd like to set the system up to use more RAM for file system read and write caching, to prefetch files aggressively (e.g. read-ahead the whole file accessed by an application in case the file is of sane size or at least read-ahead a big chunk of it otherwise) and to flush writing buffers less frequently. How to achieve this (may it be possible)? I use ext3 and ntfs (I use ntfs a lot!) file systems with XUbuntu 11.10 x86.


title: pure-ftpd floods /var/log/messages

text: My `/var/log/messages` is full of messages like:               Jan 29 01:00:02 vm2147 pure-ftpd: (?@::1) [INFO] New connection from ::1     Jan 29 01:00:02 vm2147 pure-ftpd: (?@::1) [INFO] Logout.     Jan 29 01:05:02 vm2147 pure-ftpd: (?@::1) [INFO] New connection from ::1     Jan 29 01:05:02 vm2147 pure-ftpd: (?@::1) [INFO] Logout.      These messages are generated every five minutes. What do they mean and is it a problem? How can I prevent them? My system is `2.6.35.12-90.fc14.x86_64`.


title: strange logs in /var/log/messages

text: My `/var/log/messages` contain lots of messages like this:               Jan 22 05:45:05 vm kernel: hdc: drive_cmd: status=0x41 { DriveReady Error }     Jan 22 05:45:05 vm kernel: hdc: drive_cmd: error=0x04 { AbortedCommand }     Jan 22 05:45:05 vm kernel: ide: failed opcode was: 0xec      I do not even have `hdc` on my system. What can be the cause of them? My system is `2.6.18-194.32.1.el5.centos.plus`.


title: How to avoid escape sequence attacks in terminals?

text: Reading the details of CVE-2009-4487 (which is about the danger of escape sequences in log files) I am a bit surprised. To quote CVE-2009-4487: > nginx 0.7.64 writes data to a log file without sanitizing non-printable > characters, which might allow remote attackers to modify a window's title, > or possibly execute arbitrary commands or overwrite files, via an HTTP > request containing an escape sequence for a terminal emulator. Clearly, this is not really about a security hole in nginx, but in the terminal emulators. Sure, perhaps `cat`ing a log file to the terminal happens only by accident, but `grep`ing a logfile is quite common. `less` perhaps sanitizes escape sequences, but who knows what shell commands don't change escape sequences ... I tend to agree with the Varnish response: > The wisdom of terminal-response-escapes in general have been questioned at > regular intervals, but still none of the major terminal emulation programs > have seen fit to discard these sequences, probably in a misguided attempt at > compatibility with no longer used 1970'es technology. [..] Instead of > blaming any and all programs which writes logfiles, it would be much more > productive, from a security point of view, to get the terminal emulation > programs to stop doing stupid things, and thus fix this and other security > problems once and for all. Thus my questions: How can I secure my xterm, such that it is not possible anymore to execute commands or overwrite files via escape sequences? What terminal emulators for X are secured against this attack?


title: Error with gedit can't save any file

text: meraj@meraj-SATELLITE-C850-A785:~$ sudo gedit /etc/php5/apache2/php.ini          (gedit:16243): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files      whenever I save the file in gedit it is not saved what should I do? I have ubuntu 14.04


title: Is is possible to store Nautilus' thumbnails along with the original files?

text: By default Nautilus stores thumbnails in ~/.cache/thumbnails folder. It has many advantages, but one place it doesn't work well is with network shares full of multimedia accessed by WiFi by several clients. It would be much better to let the file server generate the thumbnails locally and store it along the original files (just like Windows is doing with its `thumbs.db` file), so clients wouldn't have to download much of the folders' contents just to generate the previews. Is this option available at all? If not Nautillus, then maybe Thunar? Nemo? Whatever?...


title: How to suspend from Gnome3 using systemd

text: **Brief background information:** I just installed Fedora 18 with Gnome 3.6.3.1 on my computer. It is connected to a Windows share (CIFS) containing music, which I play using Clementine. If I suspend the computer while Clementine is playing a song from the CIFS mount, upon resuming, it (Clementine) hangs. Eventually, if I try to restart/power off, the whole computer hangs. My workaround to this is to stop playback upon suspension. **My problem:** I've created a script in `/usr/lib/systemd/system-sleep` to stop playback (using MPRIS). The script successfully runs before suspend if I execute               systemctl suspend      However, it does not run if I click on Suspend from the User menu in Gnome3. Doing some legwork, I uncovered that Gnome3 relies on UPower, which itself, it seems, simply uses DBus to issue the "Suspend" command. I'm not savvy enough to follow the trail any further, but from what I can see, the script never gets executed. **My question:** How can I make the Suspend menu item in Gnome3 use systemd to call my script?


title: telnet to localhost and loopback device IP works, but not LAN ip (Xen + Ubuntu)

text: I have set up Xen + Ubuntu per the instructions at https://help.ubuntu.com/community/XenProposed. I am now ready to install a HVM guest OS (Ubuntu Desktop 12.04). After I start my HVM guest OS               xen create ubuntu-hvm.cfg      I need to now connect to it. I am connecting to the HVM guest OS on a Windows box using VNC Viewer. However, I can't connect:               unable to connect to host: Connection refused (10061)      On the Xen+Ubuntu box, Dom0, the LAN IP is 192.168.0.201. Just as a sanity test, I pinged the following addresses while on the Dom0 console               ping localhost     ping 127.0.0.1     ping 192.168.0.201      All pings were successful. Then I tried to telnet via port 5900.               telnet localhost 5900     telnet 127.0.0.1 5900     telnet 192.168.0.201 5900      The last telnet to the LAN IP does not work:               telnet: Unable to connect to remote host: Connection refused      I also checked to make sure port 5900 was opened.               sudo netstat -tcp --listening --programs      I got the following information.               Proto Recv-Q Send-Q Local_Address        Foreign_Address State  PID/Program_name     tcp   0      0      localhost:5900       *:*             LISTEN 2097/qemu-dm     tcp   0      0      192.168.122.1:domain *:*             LISTEN 5653/dnsmasq     tcp   0      0      *:ssh                *:*             LISTEN 1198/sshd     tcp   0      0      [::]:ssh             [::]:*          LISTEN 1198/sshd      On my Windows box, a ping to 192.168.0.201 works, but a telnet 192.168.0.201 5900 does not work. Any help is appreciated.


title: Undefined reference to gzopen64 when building samtools

text: I am trying to install the software package samtools0.1.19. When I run `make`, I get errors:               gcc -g -Wall -O2 -o samtools bam_tview.o bam_plcmd.o sam_view.o bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o cut_target.o phase.o bam2depth.o padding.o bedcov.o bamshuf.o bam_tview_curses.o bam_tview_html.o  libbam.a -Lbcftools -lbcf  -lcurses  -lm -lz -lpthread     phase.o: In function `loadpos':     /illumina/data/galaxy/apps/samtools-0.1.19/phase.c:475: undefined reference to `gzopen64'     bedcov.o: In function `main_bedcov':     /illumina/data/galaxy/apps/samtools-0.1.19/bedcov.c:69: undefined reference to `gzopen64'     libbam.a(bam_import.o): In function `__bam_get_lines':     /illumina/data/galaxy/apps/samtools-0.1.19/bam_import.c:76: undefined reference to `gzopen64'     libbam.a(bam_import.o): In function `sam_open':     /illumina/data/galaxy/apps/samtools-0.1.19/bam_import.c:472: undefined reference to `gzopen64'     libbam.a(bam_import.o): In function `sam_header_read2':     /illumina/data/galaxy/apps/samtools-0.1.19/bam_import.c:126: undefined reference to `gzopen64'     libbam.a(bedidx.o):/illumina/data/galaxy/apps/samtools-0.1.19/bedidx.c:107: more undefined references to `gzopen64' follow     collect2: ld returned 1 exit status     make[1]: *** [samtools] Error 1     make[1]: Leaving directory `/illumina/data/galaxy/apps/samtools-0.1.19'     make: *** [all-recur] Error 1      I tried installing the packages it depends on, and even used elrepo for Red Hat Linux but it doesn't work.


title: How to restrict rm -rf / in CentOS machine?

text: I would like to know how we can restrict `rm -rf /`on CentOS machines?


title: Menus don't show properly in latest Linux Mint

text: I'm using the last version of Mint and I'm having, sometimes, problems with some menus. I can't take a PrintScreen because it happens with the right button function. If I'm right clicking on a item down the screen, the last options, like "Property" for instance, do not appear so I have to use the keyboard arrows to get to the option. My resolution is 1366 x 768 (16:9). Any ideas?


title: can't start x11vnc without attached monitor

text: I'd like to setup `x11vnc` (or any other vnc server) to start at boot-time. The display manager is `kdm`, the distribution is Ubuntu 12.04.2 LTS. When I try to start x11vnc, I'm getting this errors:               $ x11vnc -rfbauth /var/run/xauth/A:0-crWk72  -rfbport 5901      passing arg to libvncserver: -rfbauth      passing arg to libvncserver: /var/run/xauth/A:0-crWk72      passing arg to libvncserver: -rfbport      passing arg to libvncserver: 5901      x11vnc version: 0.9.12 lastmod: 2010-09-09  pid: 2828      XOpenDisplay("") failed.      Trying again with XAUTHLOCALHOSTNAME=localhost ...           *** XOpenDisplay failed. No -display or DISPLAY.      *** Trying ":0" in 4 seconds.  Press Ctrl-C to abort.      *** 1 2 3 4       XOpenDisplay(":0") failed.      Trying again with XAUTHLOCALHOSTNAME=localhost ...      XOpenDisplay(":0") failed.      Trying again with unset XAUTHLOCALHOSTNAME ...      I've tried installing `xserver-xorg-video-dummy` in order to avoid issues with no screen attached, but so far with no success.


title: Tool for measuring entropy quality?

text: Is there a tool available for Linux systems that can measure the "quality" of entropy on the system? I know how to count the entropy:               cat /proc/sys/kernel/random/entropy_avail      And I know that some systems have "good" sources of entropy (hardware entropy keys), and some don't (virtual machines). But is there a tool that can provide a metric as to the "quality" of the entropy on the system?


title: SSH Failing to fork with sshpass

text: I've a problem with port forwarding command using sshpass. Problem is that it's working on one server and does not work on another. Both are Debian 7 x64 boxes.               sshpass -p password ssh -f -D 0.0.0.0:2002  -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=debug root@5.5.5.5 -T -N      This command works with no problems on server 1 but does not work on server 2. Debug output from failing server:               Authenticated to 5.5.5.5 ([5.5.5.5]:22).     debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0     debug1: Local forwarding listening on 0.0.0.0 port 2002.     debug1: channel 0: new [port listener]     debug1: forking to background      Debug output from working server:               Authenticated to 5.5.5.5 ([5.5.5.5]:22).     debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0     debug1: Local forwarding listening on 0.0.0.0 port 2002.     debug1: channel 0: new [port listener]     debug1: forking to background     debug1: Entering interactive session.      Sshpass and ssh binaries are equal on both servers. I've checked this using md5sum. Does anyone have an idea what could be wrong? I'm loosing my mind trying to solve this mystery.


After a recent upgrade in my Arch Linux x64 system, I keep getting this warning message after installing or removing packages with `pacman`.               (gconftool-2:5207): GConf-WARNING **: Client failed to connect to the D-BUS daemon:     /usr/bin/dbus-launch terminated abnormally with the following error: No protocol specified     Autolaunch error: X11 initialization failed.      So, far I have not seen any ill effects from this (that I know of), but I would like to make this warning go away. **EDIT** I can consistently reproduce this by installing or uninstalling GNOME Do. Both of the following commands result in the output above.               $ sudo pacman -S gnome-do     $ sudo pacman -Rns gnome-do      Running `xhost +` seems to temporarily alleviate the warning (at least until I reboot). I can run `xhost -` and the warning returns. **UPDATE** This problem went away after a few upgrades (i.e. `pacman -Syu`).


title: How to search for files by size and extension ?

text: I want to delete all empty files with a particular extension from a directory and all its subdirectories.


title: find files which have a higher permission than xxx

text: I want to find all files which have a higher permission than e.g. 640. Perhaps this would work with a find and exec command. But my knowledge isn't sufficient for such a task.


title: Bash: Use an alias in a variable

text: I am writing a bash script that runs each of its arguments as a command. This works for commands in my `PATH`, but not for aliases. I can directly call an alias in the script, but I can't call an alias that has been passed as an argument. The problem (I assume) is that aliases are expanded before variables. Is there a way to run aliases from a variable? Sample script:               #!/bin/bash     # File: runall          shopt -s expand_aliases     source ~/.aliases          while (( "$#" )); do         $1         shift     done      `runall "echo test"` works, but `runall "myalias"` gives `runall: line 8: myalias: command not found`


title: Java "Could not reserve enough space for object heap" even though there is enough RAM

text: I am currently having some issues running Java. It won't start because of heap issues. But I have more than 9 GB Ram free (or even 16 GB if you assumed the cache would be empty). This is the error I get (and the `free` command)               root@server: ~ # java     Error occurred during initialization of VM     Could not reserve enough space for object heap     Error: Could not create the Java Virtual Machine.     Error: A fatal exception has occurred. Program will exit.          root@server: ~ # free                  total       used       free     shared    buffers     cached     Mem:      25165824   15941148    9224676          0          0    7082176     -/+ buffers/cache:    8858972   16306852     Swap:            0          0          0      I am running a 64 bit Debian on a virtualized server. The virtualization software is OpenVZ. This is my Java version _(I can execute this command after I stop two of my VM's (4 currently running))_ :               root@server: ~ # java -version     java version "1.7.0_45"     Java(TM) SE Runtime Environment (build 1.7.0_45-b18)     Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)      What could I do? * * * **As requested:**               root@server: ~ # cat /proc/meminfo     MemTotal:       25165824 kB     MemFree:        11723412 kB     Cached:          4597552 kB     Active:          9692308 kB     Inactive:        3322544 kB     Active(anon):    7411960 kB     Inactive(anon):  1005340 kB     Active(file):    2280348 kB     Inactive(file):  2317204 kB     Unevictable:           0 kB     Mlocked:               0 kB     SwapTotal:             0 kB     SwapFree:              0 kB     Dirty:               960 kB     Writeback:             0 kB     AnonPages:       8417300 kB     Shmem:             21504 kB     Slab:             427452 kB     SReclaimable:     383424 kB     SUnreclaim:        44028 kB      * * * **Reguest2:**               root@server: ~ # cat /proc/user_beancounters     Version: 2.5            uid  resource                     held              maxheld              barrier                limit              failcnt      10023468:  kmemsize                399250512            506245120           5053325720           5558658292                    0                 lockedpages                     0                    8               246744               246744                    0                 privvmpages               6005602              6291447              6291456              6291456                  221                 shmpages                     8576                 8608               579124         579124289562                    0                 dummy                           0                    0  9223372036854775807  9223372036854775807                    0                 numproc                       598                 1236                30000                30000                    0                 physpages                 4634494              6291456              6291456              6291456                    0                 vmguarpages                     0                    0              6291456  9223372036854775807                    0                 oomguarpages              1529371              2144671              6291456  9223372036854775807                    0                 numtcpsock                     62                  164                30000                30000                    0                 numflock                       25                   39                 1000                 1100                    0                 numpty                         13                   24                  512                  512                    0                 numsiginfo                     10                   75                 1024                 1024                    0                 tcpsndbuf                 3330352              4153232           1179110194           1684441906                    0                 tcprcvbuf                 1216896             34410032           1179110194           1684441906                    0                 othersockbuf               270504               537552            589555096           1094886808                    0                 dgramrcvbuf                     0                67048            589555096            589555096                    0                 numothersock                  287                  333                30000                30000                    0                 dcachesize              355559855            446054103           1103879952           1136996352                    0                 numfile                      4766                 7745               250000               250000                    0                 dummy                           0                    0  9223372036854775807  9223372036854775807                    0                 dummy                           0                    0  9223372036854775807  9223372036854775807                    0                 dummy                           0                    0  9223372036854775807  9223372036854775807                    0                 numiptent                      14                   14                 1000                 1000                    0          root@server: ~ # java     Error occurred during initialization of VM     Could not reserve enough space for object heap     Error: Could not create the Java Virtual Machine.     Error: A fatal exception has occurred. Program will exit.          root@server: ~ # cat /proc/user_beancounters     Version: 2.5            uid  resource                     held              maxheld              barrier                limit              failcnt      10023468:  kmemsize                399246622            506245120           5053325720           5558658292                    0                 lockedpages                     0                    8               246744               246744                    0                 privvmpages               6005601              6291447              6291456              6291456                  233                 shmpages                     8576                 8608               579124         579124289562                    0                 dummy                           0                    0  9223372036854775807  9223372036854775807                    0                 numproc                       598                 1236                30000                30000                    0                 physpages                 4635460              6291456              6291456              6291456                    0                 vmguarpages                     0                    0              6291456  9223372036854775807                    0                 oomguarpages              1529376              2144671              6291456  9223372036854775807                    0                 numtcpsock                     64                  164                30000                30000                    0                 numflock                       25                   39                 1000                 1100                    0                 numpty                         13                   24                  512                  512                    0                 numsiginfo                     10                   75                 1024                 1024                    0                 tcpsndbuf                 3365232              4153232           1179110194           1684441906                    0                 tcprcvbuf                 1249664             34410032           1179110194           1684441906                    0                 othersockbuf               270504               537552            589555096           1094886808                    0                 dgramrcvbuf                     0                67048            589555096            589555096                    0                 numothersock                  287                  333                30000                30000                    0                 dcachesize              355559855            446054103           1103879952           1136996352                    0                 numfile                      4768                 7745               250000               250000                    0                 dummy                           0                    0  9223372036854775807  9223372036854775807                    0                 dummy                           0                    0  9223372036854775807  9223372036854775807                    0                 dummy                           0                    0  9223372036854775807  9223372036854775807                    0                 numiptent                      14                   14                 1000                 1000                    0


title: dircolors: modify color settings globaly

text: I understand `ls` uses `dircolors` to display colored output. `dircolors` has default database of colors associated with file extensions, which can be printed wiht the command               dircolors --print-database      From `man dir_colors` I read, the system-wide database should be located in `/etc/DIR_COLORS`. But this file does not exist on my system (Debian). How can I modify system-wide color settings for `dircolors`? Where does the command `dircolors --print-database` take the settings from, when no file exists. I am aware that user can have user-specific file `~/.dir_colors` with his settings, but this is not suitable for me, since I need to change the settings for everybody. A second questions is, whether it is possible to use 8-bit colors for dircolors. My terminal is `xterm-256color`.


title: Why do the data and code segments completely overlap in Linux?

text: Context: I'm reading "Understanding the Linux kernel, 3d ed", which uses the 2.6.11 kernel. Question: As I understand, the physical address is obtained by translating the linear address, which is obtained by translating the logical address. The logical address consists of a segment selector, which identifies a segment in a Description Table The Linux Global Description Table includes, amongst other segments, a user code and data segment. But the base address of both segments is `0x0`, and their size is also the same. So they completely overlap. So as I understand, the logical address `cs + offset` is identical to the logical address `ds + offset`, where `cs` and `ds` are the CPU registers that hold respectively the code segment selector and data segment selector. I think this is the case because both segments have the same base address, which is incremented with the offset to get the linear address. If this is the case and they both map to the same linear address, don't they also map to the same physical address? If so, what is the use of having seperate `cs` and `ds` registers?


title: Some garbage characters in Linux terminal

text: My embedded linux app sometimes outputs the text like this:               root@variscite /mnt/nfs$ ./test      > GPIO_IMX6_C: i=1 cannot open GPIO device file /sys/class/gpio/gð½Å¢ j¤Ôè > Uêêª eú5¥Jõ¹¹2¥±zåÍ½±Í?:e½½:e½Å¢j¤Ôè Uêêª 2¥±zåÍ½±Í?:e½½:e½åj¤Ôè > eú5¥Jõº¹¹½?zU¹:A%="? Uêêª 2¥±zåÍ½±Í?:e½½:e½åj¤Ôè eú5¥JõÂ¹¹½?zU¹:A%="? Uêêª > 2¥±zåÍ½±Í?:e½½:e½Å¢Âj¤ÔÈªWKV.¤ËR-k®W«U¹:A%="? ×¤¬,]Z»Y1 DEBUG[0700]: Fan > Control Board: Fan control Write byte ... call CreateServerSocket...9600 Set attrib Any ideas, what could cause this?


title: Why is return is ignored during output in bash?

text: When I start a program that runs for a bit, say `make`, I could just type the next command in bash even before I got a prompt back and when the first command finished, the second one was executed as if I had typed it later. But suddenly this doesn't work any more. The additional command will be shown at the prompt after the first one finished but is not executed. If I type more commands, they are all shown at the prompt (without any space or newline between them). Any idea what is at fault here or how I can figure it out myself?


title: Are there any full featured pdf readers that integrate comment function?

text: I'm needing reading some research papers whose formats are almost pdf.However I cannot find a good pdf reader which can make some notes while reading. Currently I use **xournal** however there seems not many choices when I want to make different comments. There exists another problem:the comments made is actually on another layer so other pdf readers cannot recongnize it. "Export to PDF" seems a little rude for me.


title: How to get a previous date using a reference to a file with the date command?

text: I'm trying to get Previous date of reference file. What I've tried :               [rahul@testsrv]$ date +%F -r /tmp/ftpbkp.log     2013-08-27          [rahul@testsrv]$ date +%F -r /tmp/ftpbkp.log -d "1 day ago"     date: the options to specify dates for printing are mutually exclusive     Try `date --help' for more information.


title: After ubuntu install + software raid 0 config, we see: rejecting I/O to offline device

text: I'm trying to pin down what this error `rejecting I/O to offline device` is, as seen towards the end of this syslog. Ideas:   * Problem with RAID-0 configuration (we have 2 4TB disks in RAID-0 and I do see a warning about it)   * Virtual CD - there is no CD on this server, but I did have a virtual CD attached over an IPMI/KVM tool for the installation. That should not be attached now though, but I see some messages about it. Other than the above notes, this is a new installation of ubuntu 12.04 that was done over netboot and via the IPMI/KVM console.               Apr 12 19:42:46 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3     Apr 12 19:42:46 ubuntu dhclient: DHCPREQUEST of 10.1.5.255 on eth0 to 255.255.255.255 port 67     Apr 12 19:42:46 ubuntu dhclient: DHCPOFFER of 10.1.5.255 from 10.1.0.1     Apr 12 19:42:46 ubuntu dhclient: DHCPOFFER from 10.1.3.48 rejected by rule 10.1.3.48 mask 255.255.255.255.     Apr 12 19:42:46 ubuntu dhclient: DHCPACK of 10.1.5.255 from 10.1.0.1     Apr 12 19:42:46 ubuntu dhclient: bound to 10.1.5.255 -- renewal in 43104 seconds.     Apr 12 19:42:46 ubuntu kernel: [    8.512887] init: failsafe main process (745) killed by TERM signal     Apr 12 19:42:46 ubuntu kernel: [    8.551401] type=1400 audit(1365820966.336:8): apparmor="STATUS" operation="profile_replace" name="/sbin/dhclient" pid=866 comm="apparmor_parser"     Apr 12 19:42:46 ubuntu kernel: [    8.552253] type=1400 audit(1365820966.340:9): apparmor="STATUS" operation="profile_replace" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=866 comm="apparmor_parser"     Apr 12 19:42:46 ubuntu kernel: [    8.552723] type=1400 audit(1365820966.340:10): apparmor="STATUS" operation="profile_replace" name="/usr/lib/connman/scripts/dhclient-script" pid=866 comm="apparmor_parser"     Apr 12 19:42:46 ubuntu kernel: [    8.562192] type=1400 audit(1365820966.348:11): apparmor="STATUS" operation="profile_load" name="/usr/sbin/tcpdump" pid=868 comm="apparmor_parser"     Apr 12 19:42:46 ubuntu cron[895]: (CRON) INFO (pidfile fd = 3)     Apr 12 19:42:46 ubuntu mdadm[910]: DeviceDisappeared event detected on md device /dev/md/0, component device Wrong-Level     Apr 12 19:42:46 ubuntu cron[920]: (CRON) STARTUP (fork ok)     Apr 12 19:42:46 ubuntu cron[920]: (CRON) INFO (Running @reboot jobs)     Apr 12 19:42:54 ubuntu ntpdate[818]: adjust time server 91.189.94.4 offset 0.188979 sec     Apr 12 19:42:56 ubuntu kernel: [   18.721994] eth0: no IPv6 routers present     Apr 12 19:43:12 ubuntu kernel: [   35.070907] usb 1-5.3: reset high-speed USB device number 4 using ehci_hcd     Apr 12 19:43:23 ubuntu kernel: [   45.212938] usb 1-5.3: reset high-speed USB device number 4 using ehci_hcd     Apr 12 19:43:39 ubuntu kernel: [   61.354018] usb 1-5.3: reset high-speed USB device number 4 using ehci_hcd     Apr 12 19:43:39 ubuntu kernel: [   61.521613] usb 1-5.3: reset high-speed USB device number 4 using ehci_hcd     Apr 12 19:43:49 ubuntu kernel: [   71.663780] usb 1-5.3: reset high-speed USB device number 4 using ehci_hcd     Apr 12 19:43:49 ubuntu kernel: [   71.756135] sr 6:0:0:0: Device offlined - not ready after error recovery     Apr 12 19:43:49 ubuntu kernel: [   71.756166] sr 6:0:0:0: rejecting I/O to offline device     Apr 12 19:43:49 ubuntu kernel: [   71.756722] sr0: scsi3-mmc drive: 0x/0x caddy     Apr 12 19:43:49 ubuntu kernel: [   71.756726] cdrom: Uniform CD-ROM driver Revision: 3.20     Apr 12 19:43:49 ubuntu kernel: [   71.756951] sr 6:0:0:0: Attached scsi CD-ROM sr0     Apr 12 19:43:49 ubuntu kernel: [   71.757034] sr 6:0:0:0: rejecting I/O to offline device     Apr 12 19:43:49 ubuntu kernel: [   71.757643] sr 6:0:0:0: Attached scsi generic sg2 type 5     Apr 12 19:43:49 ubuntu kernel: [   71.778813] sr 6:0:0:0: rejecting I/O to offline device     Apr 12 19:43:49 ubuntu kernel: [   71.779394] sr 6:0:0:0: rejecting I/O to offline device     Apr 12 19:43:49 ubuntu kernel: [   71.779972] sr 6:0:0:0: rejecting I/O to offline device     Apr 12 19:43:49 ubuntu kernel: [   71.780829] sr 6:0:0:0: rejecting I/O to offline device      * * * **Update:** @jordanm & others - correct, I just confirmed that this is the CDROM device, but this is a "virtual cd" that was created by a previous KVM session via IPMI on the server. It doesn't exist any more, any idea how can I get rid of it? Or not attempt to access it, I'm not sure why it's there.


title: Shortcut to minimize all windows?

text: In Windows systems, I use the keyboard shortcut `Start`-`D` (show desktop) a lot. I'm using Linux Mint, and I wonder: Can I create a keyboard shortcut that will do the same? **edit** after the comment from `Gert van den Berg` - if you could explain how to make a short-cut equivalent to `Start`-`M` that well do. I think the windows manager is KDE.


title: what is the difference between if and [[ in bash?

text: I see that               if cmd     then     echo Hi     fi      works differently from               if [[ $(cmd) ]]     then     echo Hi     fi      So what happens when there is a [[ and when there is not?


title: Getting no tty present and no askpass program specified when using git over ssh

text: I'm trying to push a `git commit` from my laptop to my server but keep getting the following error message:               remote: sudo: no tty present and no askpass program specified      To ssh://git@example.com/~/site_hub      I have the following in my sudoers:               Defaults:git !requiretty     git ALL=(apache) NOPASSWD: /usr/bin/git      Not sure why I'm getting that error message. I've Googled around but I'm not finding the solution.


title: vsftpd: 550 Failed to change directory

text: I'm using ubuntu 12.04. and `ftp` service I've installed `vsftpd` and it's working fine. But may I'm facing some user complexity. My system directory like:               -/     --/home     ----/rony     --/vol      When I list directories through `ftp`, it's going to `/rony` first. But when I `cd /vol` or `cd ..`, it's showing `550 Failed to change directory` error.


title: Creating an HTTPS tunnel

text: I have a VPS. How do I connect to my server through HTTPS protocol and redirect my browser connections to the HTTPS connection? Currently I use SSH tunnel but it's too slow.


title: FreeBSD on ARM architecture?

text: Can FreeBSD be used for ARM architecture devices? Also, is there a camera driver for FreeBSD?


title: What is wget idiom for curl -o?

text: So I use code in some function like               if [ ! -e $DOWNLOADS/$1 ]; then         echo_run curl -L http://$4/$5/$1 -o $DOWNLOADS/$1     fi      I wonder how to achieve the same thing without curl?


title: Will yum remove mysql-server delete my databases?

text: My MySQL server has broken down, and I can't figure out why. Trying to do a yum reinstall I get this: Error: mysql-server conflicts with mysql-server I figure that's because the server already had the mysql server, and when I ran the upgrade, everything got messed up. I'm unable to access MySQL, so I can't even do a mysqldump. How can I reinstall without compromising my existing databases?


title: autoconf save ./configure command line to config.h

text: Some binaries save the command line used to configure them inside the binary (I don't remember any that do, otherwise I'd check the source). Is there a way to obtain the command line used as a macro in configure.ac? For example, if I compile my code with               ./configure --foo bar CXX=g++      I would like to save **--foo bar CXX=g++** to a macro in config.h so it can be output by the binary using a flag               ./myprogram -V     Version 1.0, compiled using: "./configure --foo bar CXX=g++"


title: Setting gnome themes inside xfce

text: I have a few apps (such as Aisleriot) that are GNOME based, therefore they use the gnome defaults (which is some light theme), but I use xfce4 with compiz. My xfce theme is a dark one (atolm to be exact). How do I make the theme for these GNOME applications the same as my xfce4 theme? I already tried starting in gnome, setting the theme then switching back, this doesn't fix the problem.


title: How can you mirror the stdout of one terminal to another one?

text: I'm not sure if I'm phrasing the question correctly, but let's say that I have two virtual terminals open, and if I typed `ls` in one of them, I'd get the contents of the directory in **both** of them (the second one doesn't have to be writable, it only needs to display the stdout of the first one). How would I go about achieving this?


title: SSH tunnel: "channel x: will not send data after close"

text: When I work with ssh tunnel, I get the following message repeatedly: `debug3: channel x(a number): will not send data after close` What does it mean? I also get the following messages:               debug2: channel 3: open confirm rwindow 2097152 rmax 32768     debug2: channel 4: open confirm rwindow 2097152 rmax 32768     debug2: channel 3: rcvd eof     debug2: channel 3: output open -> drain     debug2: channel 7: rcvd eof     debug2: channel 7: output open -> drain     debug2: channel 7: obuf empty     debug2: channel 7: close_write     debug2: channel 7: output drain -> closed     debug2: channel 7: rcvd close     debug2: channel 4: rcvd eof     debug2: channel 4: output open -> drain     debug2: channel 31: rcvd close     debug2: channel 34: rcvd close     debug2: channel 35: rcvd close     debug2: channel 18: rcvd eof     debug2: channel 18: output open -> drain     debug2: channel 18: obuf empty     debug2: channel 18: close_write     debug2: channel 18: output drain -> closed     debug2: channel 18: rcvd close     debug3: channel 7: will not send data after close     debug3: channel 18: will not send data after close     debug3: channel 31: will not send data after close     debug3: channel 34: will not send data after close     debug3: channel 35: will not send data after close     debug2: channel 7: send close     debug2: channel 7: is dead     debug2: channel 7: garbage collecting`      Is there anything wrong?


title: General problem solving steps when print jobs hang in AIX?

text: What should I do if jobs are getting stuck in the print queue even after restarting spooling?               $ stopsrc -g spooler     $ startsrc -g spooler     $ lpstat -oQUEUENAME | wc -l; sleep 30; lpstat -oQUEUENAME | wc -l     139     139          $ oslevel     6.1.0.0


title: space utilization

text: I need to show space utilisation on the system, and find the largest 3 files on /home (or any other folder) I've been using 2 different command lines               df -m -a -h     df -m -h /home      I still can't manage to get it to show me only the 3 largest files on that folder


title: remote desktop view of a Debian Lenny Machine

text: Let me give a summary of my project specification. I have a windows server and bunch of debian clients on the same LAN, Debian machines do not have x window system, they are bound to command line use. I am running a QT application on system start so user only interacts with my GUI before he sees anything else. According to my project requirements, we should allow system admins to view what end user is doing in debian machines at any time, therefore he should be able to see their screens at any time. He will be using a windows machine to do that. Therefore I am wondering if it is possible to share debian's screen with a windows server, and what would be involved in that. Do I need VNC server setup on debian machines to accomplish that? Is there any other way?


title: No incoming connections on Fedora 17, except on port 80

text: All incoming connections seem to be refused on my Fedora machine, except on port 80 with apache. The ports I have tried are 8111 and 1111, neither does work. I have done the forwarding on my hardware router and configured the firewall (iptables, using the GUI) to allow connections on those ports. However, it is still not working. When I run a small HTTP server (the node.js hello-world) on one of these ports and try to curl it, it only works on localhost but not with the public ip address. Using the public address, I immediately get `curl: (7) couldn't connect to host`. Without the port forwarding or the firewall exception, this takes a while and does not appear immediately - so i think that that's not the problem. I also tried using the web browser instead of curl, without any difference. I have tried a tool named `tcptrack`, which shows this whenever I try to curl using the public address (I changed the public address here, 192.168.0.2 is the local one):               215.17.123.60:52014   192.168.0.2:1111      RESET        16s    0 B/s     192.168.0.2:52014     215.17.123.60:1111    RESET        16s    0 B/s      So I am receiving the packages but they are rejected somehow (I don't know exactly what RESET means). Is there another firewall or something? Like I said, port 80 works fine.


title: Network Disabled

text: I have just installed ubuntu server edition in order to create a home network. But I am not able to find IP of the machine through ifconfig (showing only localhost). Then I tried                lspci | grep -i ethernet      output:               09:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8040 PCI-E Fast Ethernet Controller (rev 13)      lshw -C Network Then output was `*-network DISABLED`


title: How to mount multiple directories on the same partition?

text: I am installing an SSD and would like to put `/` on the SSD and `/home`, `/var`, and `/tmp` on the HDD. My current distro is Kubuntu but I would not mind trying another distro if this procedure can be accomplished easier there. I have installed many different Linux OSes on multiple partitions, however I know of no installer that lets one mount multiple directories on a single partition. I would rather not use three separate partitions as particularly `/home`, `/var`, and `/tmp` are prone to large changes in size and it is not practical to allot each of them some arbitrary maximum. Note that I am discussing a new install, not moving the current system to the SSD / HD split.


title: Starting Linux from power off at predetermined time (and executing command)?

text: To put it simply, I'm trying to use my computer as an alarm clock. It's slightly old and noisy, so I'd like it to start from power off at a scheduled time and then execute a command, such as playing an MP3 file. I'm running Linux Mint Nadia. How would I go about this?


title: Check what process is spiking the average load with atop

text: In trying to find the culprit of a high load average on a system during night (which does not seem to be related to logrotate) I installed atop to write a raw file with a specific interval. While reading the file, it seems the processlist stands still, can I somehow go back and forth between the samples to see what sticks out, and further sort by any column (like cpu usage)?


title: WBC_ERR_DOMAIN_NOT_FOUND only for a specific account

text: Platform: RHEL 5.10 Version: Samba 3.6.6-0.136 Only on a single VM, one of my co-workers is able to log into the VM using his AD credentials without issue, whereas my account appears to have trouble locating user information:               [root@ncxxxlwb05 ~]# wbinfo -i myDom.mjplakus     XXX.mjplakus:*:16777224:16777229::/home/XXX/mjplakus:/bin/bash     [root@ncxxxlwb05 ~]# wbinfo -i myDom.jadavis6     failed to call wbcGetpwnam: WBC_ERR_DOMAIN_NOT_FOUND     Could not get info for user xxx.jadavis6      Thinking that winbind could have just cached a negative return (for instance AD wasn't available when it had to refresh its cache entry for my user account) I set both `winbind cache time` and `idmap negative cache time` to be 1 second but I got the same results. Same results with above cache values and doing `net cache flush` several times. I didn't find anything in `/var/log/samba/*` under normal debug levels so I set `debug level = 8` and this started being printed in the logs when I tried to resolve my name:               [2013/12/05 14:21:59.795061,  3] winbindd/winbindd_getpwnam.c:56(winbindd_getpwnam_send)       getpwnam myDom.jadavis6     [2013/12/05 14:21:59.795161,  1] ../librpc/ndr/ndr.c:414(ndr_pull_error)       ndr_pull_error(13): value out of range     [2013/12/05 14:21:59.795219,  5] winbindd/winbindd_getpwnam.c:137(winbindd_getpwnam_recv)       Could not convert sid S-1-5-21-652622394-3291385539-1351089441-10771: NT_STATUS_INVALID_PARAMETER     [2013/12/05 14:21:59.795391,  6] winbindd/winbindd.c:869(winbind_client_request_read)       closing socket 29, client exited      Which seems like it contains the actual problem but I don't know how to read the error and would like some guidance on this. It seems like it doesn't like the SID associated with my AD account for some reason, but I don't know why or how to work around it. I'm present in the active directory domain referenced, but for some reason it's unable to pull only my account's information.


title: So what are logical cpu cores (as opposed to physical cpu cores)?

text: I was googling about how I could find the number of CPUs in a machine and I found some posts but I am confused as some mentioned that you get the logical cores vs physical cores etc.   So what is the difference between logical and physical cores and is there a way I could get the physical cores only? Or does it make sense to include logical cores in our count?


title: Automating pipes?

text: I find myself using basically the same line over and over again:               cat file | command1 | command2 | command3 > file      Is there a way I can put all these pipes into one script, so I can just run               automatic.sh file      and accomplish the same thing?


title: Method to check connectivity to other server

text: I want to check connectivity between 2 servers (i.e. if ssh will succeed). The main idea is to check the shortest way between server-a and server-b using a list of middle servers (for example if I'm on dev server and I want to connect to prod server - usually a direct ssh will fail). Because this can take a while, I prefer not to use SSH - rather I prefer to check first if I can connect and if so then try to connect through SSH. Some possible routes to get the idea:               server-a -> server-b     server-a -> middle-server-1 -> server-b     server-a -> middle-server-6 -> server-b     server-a -> middle-server-3 -> middle-server-2 -> server-b      Hope you understand what I'm looking for?


title: keyboard shortcut to jump cursor to prompt?

text: I often mistype a command. So I will type this               sublimetext myfile.txt      instead of               git add myfile.txt      When I do this, I hit up to restore the last command. But after doing so, my cursor is at the end of the previously typed line. Is there a keyboard short cut to jump back to the prompt?


title: Why can user have lower permissions than group or other? Who can change them?

text: It is my understanding that the owner of a file `user` can have lower permissions than `group` or `other`.   1. What is the justification for this?   2. Can only root and the owner change the permissions on a file?   3. If root removes permissions of the owner, can the owner add their permissions back with `chmod`?


title: Linux Mint Olivia doesn't detect HD4000 Intel graphic

text: I opened Mint after a week or so & soon welcomed by a notification saying something like 'CPU high usage will be experienced due to no Graphic module' i opened my system summary & instead of the previously written 'Ivy bridge controller' following was written ![enter image description here](http://i.stack.imgur.com/kh26U.png) All of the graphic module are present none is being changed then what might be the problem. Several terminal outputs are posted following ### inxi output               echo@echo ~ $ inxi -Gx     Graphics:  Card: Intel 3rd Gen Core processor Graphics Controller bus-ID: 00:02.0                 X.Org: 1.13.3 drivers: intel (unloaded: fbdev,vesa) Resolution: 1440x900@59.9hz                 GLX Renderer: Mesa DRI Intel Ivybridge Mobile x86/MMX/SSE2 GLX Version: 3.0 Mesa 9.1.4 Direct Rendering: Yes      ### glxinfo output               echo@echo ~ $ glxinfo     name of display: :0     display: :0  screen: 0     direct rendering: Yes     server glx vendor string: SGI     server glx version string: 1.4     server glx extensions:         GLX_ARB_create_context, GLX_ARB_create_context_profile,          GLX_ARB_multisample, GLX_EXT_create_context_es2_profile,          GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info,          GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer, GLX_OML_swap_method,          GLX_SGI_swap_control, GLX_SGIS_multisample, GLX_SGIX_fbconfig,          GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, GLX_INTEL_swap_event     client glx vendor string: Mesa Project and SGI     client glx version string: 1.4     client glx extensions:         GLX_ARB_create_context, GLX_ARB_create_context_profile,          GLX_ARB_create_context_robustness, GLX_ARB_framebuffer_sRGB,          GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,          GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_EXT_framebuffer_sRGB,          GLX_EXT_create_context_es2_profile, GLX_MESA_copy_sub_buffer,          GLX_MESA_multithread_makecurrent, GLX_MESA_swap_control,          GLX_OML_swap_method, GLX_OML_sync_control, GLX_SGI_make_current_read,          GLX_SGI_swap_control, GLX_SGI_video_sync, GLX_SGIS_multisample,          GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,          GLX_EXT_texture_from_pixmap, GLX_INTEL_swap_event     GLX version: 1.4     GLX extensions:         GLX_ARB_create_context, GLX_ARB_create_context_profile,          GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,          GLX_EXT_visual_info, GLX_EXT_visual_rating,          GLX_EXT_create_context_es2_profile, GLX_MESA_copy_sub_buffer,          GLX_MESA_multithread_makecurrent, GLX_MESA_swap_control,          GLX_OML_swap_method, GLX_OML_sync_control, GLX_SGI_make_current_read,          GLX_SGI_swap_control, GLX_SGI_video_sync, GLX_SGIS_multisample,          GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,          GLX_EXT_texture_from_pixmap, GLX_INTEL_swap_event     OpenGL vendor string: Intel Open Source Technology Center     OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile x86/MMX/SSE2     OpenGL version string: 3.0 Mesa 9.1.4     OpenGL shading language version string: 1.30     OpenGL extensions:         GL_ARB_multisample, GL_EXT_abgr, GL_EXT_bgra, GL_EXT_blend_color,          GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_copy_texture,          GL_EXT_polygon_offset, GL_EXT_subtexture, GL_EXT_texture_object,          GL_EXT_vertex_array, GL_EXT_compiled_vertex_array, GL_EXT_texture,          GL_EXT_texture3D, GL_IBM_rasterpos_clip, GL_ARB_point_parameters,          GL_EXT_draw_range_elements, GL_EXT_packed_pixels, GL_EXT_point_parameters,          GL_EXT_rescale_normal, GL_EXT_separate_specular_color,          GL_EXT_texture_edge_clamp, GL_SGIS_generate_mipmap,          GL_SGIS_texture_border_clamp, GL_SGIS_texture_edge_clamp,          GL_SGIS_texture_lod, GL_ARB_framebuffer_sRGB, GL_ARB_multitexture,          GL_EXT_framebuffer_sRGB, GL_IBM_multimode_draw_arrays,          GL_IBM_texture_mirrored_repeat, GL_3DFX_texture_compression_FXT1,          GL_ARB_texture_cube_map, GL_ARB_texture_env_add, GL_ARB_transpose_matrix,          GL_EXT_blend_func_separate, GL_EXT_fog_coord, GL_EXT_multi_draw_arrays,          GL_EXT_secondary_color, GL_EXT_texture_env_add,          GL_EXT_texture_filter_anisotropic, GL_EXT_texture_lod_bias,          GL_INGR_blend_func_separate, GL_NV_blend_square, GL_NV_light_max_exponent,          GL_NV_texgen_reflection, GL_NV_texture_env_combine4, GL_S3_s3tc,          GL_SUN_multi_draw_arrays, GL_ARB_texture_border_clamp,          GL_ARB_texture_compression, GL_EXT_framebuffer_object,          GL_EXT_texture_compression_s3tc, GL_EXT_texture_env_combine,          GL_EXT_texture_env_dot3, GL_MESA_window_pos, GL_NV_packed_depth_stencil,          GL_NV_texture_rectangle, GL_ARB_depth_texture, GL_ARB_occlusion_query,          GL_ARB_shadow, GL_ARB_texture_env_combine, GL_ARB_texture_env_crossbar,          GL_ARB_texture_env_dot3, GL_ARB_texture_mirrored_repeat,          GL_ARB_window_pos, GL_ATI_envmap_bumpmap, GL_EXT_stencil_two_side,          GL_EXT_texture_cube_map, GL_NV_depth_clamp, GL_APPLE_packed_pixels,          GL_APPLE_vertex_array_object, GL_ARB_draw_buffers,          GL_ARB_fragment_program, GL_ARB_fragment_shader, GL_ARB_shader_objects,          GL_ARB_vertex_program, GL_ARB_vertex_shader, GL_ATI_draw_buffers,          GL_ATI_texture_env_combine3, GL_ATI_texture_float, GL_EXT_shadow_funcs,          GL_EXT_stencil_wrap, GL_MESA_pack_invert, GL_MESA_ycbcr_texture,          GL_NV_primitive_restart, GL_ARB_depth_clamp,          GL_ARB_fragment_program_shadow, GL_ARB_half_float_pixel,          GL_ARB_occlusion_query2, GL_ARB_point_sprite, GL_ARB_shading_language_100,          GL_ARB_sync, GL_ARB_texture_non_power_of_two, GL_ARB_vertex_buffer_object,          GL_ATI_blend_equation_separate, GL_EXT_blend_equation_separate,          GL_OES_read_format, GL_ARB_color_buffer_float, GL_ARB_pixel_buffer_object,          GL_ARB_texture_compression_rgtc, GL_ARB_texture_float,          GL_ARB_texture_rectangle, GL_EXT_packed_float, GL_EXT_pixel_buffer_object,          GL_EXT_texture_compression_dxt1, GL_EXT_texture_compression_rgtc,          GL_EXT_texture_rectangle, GL_EXT_texture_sRGB,          GL_EXT_texture_shared_exponent, GL_ARB_framebuffer_object,          GL_EXT_framebuffer_blit, GL_EXT_framebuffer_multisample,          GL_EXT_packed_depth_stencil, GL_APPLE_object_purgeable,          GL_ARB_vertex_array_object, GL_ATI_separate_stencil, GL_EXT_draw_buffers2,          GL_EXT_draw_instanced, GL_EXT_gpu_program_parameters,          GL_EXT_texture_array, GL_EXT_texture_integer, GL_EXT_texture_sRGB_decode,          GL_EXT_timer_query, GL_OES_EGL_image, GL_MESA_texture_array,          GL_ARB_copy_buffer, GL_ARB_depth_buffer_float, GL_ARB_draw_instanced,          GL_ARB_half_float_vertex, GL_ARB_instanced_arrays,          GL_ARB_map_buffer_range, GL_ARB_texture_rg, GL_ARB_texture_swizzle,          GL_ARB_vertex_array_bgra, GL_EXT_separate_shader_objects,          GL_EXT_texture_swizzle, GL_EXT_vertex_array_bgra,          GL_NV_conditional_render, GL_AMD_draw_buffers_blend,          GL_ARB_ES2_compatibility, GL_ARB_blend_func_extended, GL_ARB_debug_output,          GL_ARB_draw_buffers_blend, GL_ARB_draw_elements_base_vertex,          GL_ARB_explicit_attrib_location, GL_ARB_fragment_coord_conventions,          GL_ARB_provoking_vertex, GL_ARB_sampler_objects, GL_ARB_seamless_cube_map,          GL_ARB_shader_texture_lod, GL_ARB_texture_cube_map_array,          GL_ARB_texture_rgb10_a2ui, GL_ARB_uniform_buffer_object,          GL_ARB_vertex_type_2_10_10_10_rev, GL_EXT_provoking_vertex,          GL_EXT_texture_snorm, GL_MESA_texture_signed_rgba,          GL_ARB_get_program_binary, GL_ARB_robustness, GL_ARB_shader_bit_encoding,          GL_ARB_timer_query, GL_ANGLE_texture_compression_dxt3,          GL_ANGLE_texture_compression_dxt5, GL_ARB_internalformat_query,          GL_ARB_shading_language_packing, GL_ARB_texture_storage,          GL_EXT_transform_feedback, GL_ARB_ES3_compatibility,          GL_ARB_invalidate_subdata


title: With mv, possible to put a time dependence on files mv'ed?

text: Let's say there's a specific time and date I have in mind. All files last edited before this date I want to keep in the directory but all files that have been edited since this date I want to `mv` somewhere else. The `man` page of `mv` doesn't show this being possible with `mv` directly. I thought some form of the the following should work:               ls -t | head -n $number       Where `$number` specifies the number of files that have been edited since the time and date I had in mind. I could then somehow feed this to `mv` to `mv` those files (haven't thought up exactly how to do that). The disadvantage of this is that I would have to count up how many files have been edited since the date and time I had in mind. Is there a way where I can just specify a date and time and let my computer figure out which files need to be `mv`ed and `mv` them for me? If not, then how would I complete the command I have written above to feed those file names to `mv` to have them all `mv`ed to the same location?


title: custom kernel and firmware loading

text: After I have compiled my kernel, and when I type `make modules_install`, not only are the modules copied into `/lib/modules/` but also firmware is copied into `/lib/firmware/`. The following is the end of the output after typing `make modules_install`:               MKDIR   /lib/firmware/radeon     INSTALL /lib/firmware/radeon/R100_cp.bin     INSTALL /lib/firmware/radeon/R200_cp.bin     INSTALL /lib/firmware/radeon/R300_cp.bin     INSTALL /lib/firmware/radeon/R420_cp.bin     INSTALL /lib/firmware/radeon/RS690_cp.bin     INSTALL /lib/firmware/radeon/RS600_cp.bin     INSTALL /lib/firmware/radeon/R520_cp.bin     INSTALL /lib/firmware/radeon/R600_pfp.bin     INSTALL /lib/firmware/radeon/R600_me.bin     INSTALL /lib/firmware/radeon/RV610_pfp.bin     INSTALL /lib/firmware/radeon/RV610_me.bin     INSTALL /lib/firmware/radeon/RV630_pfp.bin     INSTALL /lib/firmware/radeon/RV630_me.bin     INSTALL /lib/firmware/radeon/RV620_pfp.bin     INSTALL /lib/firmware/radeon/RV620_me.bin     INSTALL /lib/firmware/radeon/RV635_pfp.bin     INSTALL /lib/firmware/radeon/RV635_me.bin     INSTALL /lib/firmware/radeon/RV670_pfp.bin     INSTALL /lib/firmware/radeon/RV670_me.bin     INSTALL /lib/firmware/radeon/RS780_pfp.bin     INSTALL /lib/firmware/radeon/RS780_me.bin     INSTALL /lib/firmware/radeon/RV770_pfp.bin     INSTALL /lib/firmware/radeon/RV770_me.bin     INSTALL /lib/firmware/radeon/RV730_pfp.bin     INSTALL /lib/firmware/radeon/RV730_me.bin     INSTALL /lib/firmware/radeon/RV710_pfp.bin     INSTALL /lib/firmware/radeon/RV710_me.bin      As it happens, I need firmware for my ATI radeon graphic card. But I already had firmware in `/lib/firmware/` and I did not want that firmware be build. I have selected following options in my kernel:               [*] Select only drivers that don't need compile-time external firmware     [*] Prevent firmware from being built      So why is firmware being build anyway? And also, how do I find out which one of these firwares my card needs? I can see following message in my `dmesg`, but that does not tell me which file was loaded:               [drm] initializing kernel modesetting (RV620 0x1002:0x95CF 0x1002:0x2143).     [drm] Loading RV620 Microcode      Is there some way to list loaded firmwares, similarly as I would list loaded modules (`lsmod`) # CLARIFICATION: To sum up my question: I have `ATI RV620 (FirePro 2260)` graphics card and I am using kernel `3.12.20`. How can I find out exactly which firmware files my card needs to load?               # lspci | grep -i vga     01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RV620 [FirePro 2260]


title: I'm not getting syntax coloring in vim (using Cygwin)

text: I've been so far unable to figure out why vim's syntax coloring is not working for _most_ files, and it's driving me batty. In case this is relevant: I'm working in Cygwin (more specifically/accurately the bash shell that comes with Git for Windows) because it's the only thing I've been able to smuggle into this Windows shop so far. (I sometimes bring in my MacBook Air but it is somewhat frowned upon. Also, as with most Windows shops they're paranoid about installing software, so a full Cygwin installation would need justification. Also, I'm not using gvim because I prefer to work with vim in a terminal.) I can get syntax coloring to work if I tell vim that the file is C++               :set syntax=cpp      or if it is a shell script, but not if I'm working in Ruby or PHP. I've ensured that syntax is turned on with both `:syntax on` and `:syntax enable`. I've tried installing vim syntax files in `~/.vim/syntax/<syntax-type>.vim` but this has not made a difference. I've ensured files had the standard file extension, so if working with a Vagrantfile I tried adding '.rb', and I've tried avoiding my .vimrc file (as well as tried other .vimrc files):               vim -u /dev/null Vagrantfile.rb      I've also ensured Ruby files had the normal 'shebang' line. Nothing has worked so far. What could prevent vim from properly coloring certain files?


title: Drive auto mounting as read only (errors=remount-ro)

text: My system (12.04 Ubuntu LTS) is auto-mounting as read only and I have no idea why. Output of fstab:               cat /etc/fstab     # /etc/fstab: static file system information.     #     # Use 'blkid' to print the universally unique identifier for a     # device; this may be used with UUID= as a more robust way to name devices     # that works even if disks are added and removed. See fstab(5).     #     # <file system> <mount point>   <type>  <options>       <dump>  <pass>     proc            /proc           proc    nodev,noexec,nosuid 0       0     # / was on /dev/sda1 during installation     UUID=28db2489-f60e-456c-9efd-7a961f3e970a /               ext4    errors=remount-ro 0       1     # swap was on /dev/sda5 during installation     UUID=106e4470-d734-4cec-98a6-c7859aaedf18 none            swap    sw              0       0     /dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0      Output of mount:               /dev/sda1 on / type ext4 (rw,errors=remount-ro)     proc on /proc type proc (rw,noexec,nosuid,nodev)     sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)     none on /sys/fs/fuse/connections type fusectl (rw)     none on /sys/kernel/debug type debugfs (rw)     none on /sys/kernel/security type securityfs (rw)     udev on /dev type devtmpfs (rw,mode=0755)     devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)     tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)     none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)     none on /run/shm type tmpfs (rw,nosuid,nodev)     I have searched all night including: Ubuntu 12.04 SSD root frequent random read only file system      I have no idea why this is going on. I did run fsck at boot and it didn't find errors. The disk is fine (500GB, user 38GB)


title: How do I highlight commas not followed by a space in vim?

text: I've gotten into the habit of not appending spaces after commas in lists, when coding. To break this habit, I thought I'd get `vim` to highlight any comma (`,`) that is not followed by a space. So I've added this to my `.vimrc`:               highlight SquishedCommas ctermbg=red guibg=red     match SquishedCommas /,(?! )/      However, it doesn't seem to highlight anything!


title: Is it possible to integrate Apple iCloud services (e.g. contacts, calendars) with Fedora 20?

text: I am a new laptop user after using an iMac desktop for about seven years. Over that time, I had become fairly reliant on Apple's services syncing between my iPhone and my iMac. Now that I'm on Fedora, I'm having to run two separate calendars and contact books, and manually update changes between the two. Is there a way I can integrate Apple's iCloud features (namely contacts and calendar) onto my laptop? It would make day-to-day computing much easier.


title: How to keep Debian internal clock synchronized (with NTP servers)?

text: I have a home server which runs an up to date Debian 7.5 (wheezy) installation. I just discovered that the server has its internal clock set to ± 3 minutes _in the future_. I knew that I can use NTP to synchronize Debian (and the motherboard internal clock) with NTP. So I installed NTP by following the steps described in the french Debian Wiki (the english page is less detailed). I use the following command to sync the internal clock:               ntpdate -B -q 192.168.0.254      The clock was succesfully adjusted. But this is a temporary solution, so I installed the NTP daemon and added a local server in the `/etc/ntp.conf` file:               # pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will     # pick a different set every time it starts up.  Please consider joining the     # pool: <http://www.pool.ntp.org/join.html>          # added     server 192.168.0.254          server 0.debian.pool.ntp.org iburst     server 1.debian.pool.ntp.org iburst     server 2.debian.pool.ntp.org iburst     server 3.debian.pool.ntp.org iburst      Is it the right solution? In fact I was surprised to find that the `ntp` daemon wasn't already installed. So I'm wondering if the default installation of Debian installs a daemon to keep the internal clock synchronized. Are all the Debian installations time-shifting until their admins install `ntpd` ? Please tell me that the `ntp` daemon won't be useless because Debian has a built-in synchronization mecanism.


title: bash equivalent of zsh's $@[2,$#]

text: (NB: the motivation for this question is only to improve my `bash` programming know-how.) I want to know the `bash` equivalent of `zsh` expressions such as `$@[2,$#]`, which _directly_ address a range of a shell function's (or script's) command- line arguments array (`$@`). (All solutions I've found online for addressing ranges of `$@` in `bash` can be described as " _indirect_ addressing", since they all require first assigning `$@` to an intermediate variable. See example below.) For the sake of concreteness: what would be the `bash`-equivalent of the following `zsh` test function?               testfn () {       printf '>%s<\n' $@[2,$#]     }          % testfn a b c d     >b<     >c<     >d<      Below is the closest I've managed to come up with; as mentioned above, it requires the assignment of `$@` to an intermediate variable:               testfn () {       holdargs=( $@ )       printf '>%s<\n' "${holdargs[@]:1}"     }      All my attempts at something not requiring an intermediate variable fail with a `bad substitution` error.


title: Searching a text file with a single line using regular expressions

text: as far as i know all unix text processing utilities are reading one line at a time and performing one action on this line. I have a huge file with a single line of text which contains several tokens im concerned with. You can think of the content of the file as something like this: xzxzxzzxzxAxzzBxzxCzxxzxxzxzzxzxzAzBzxxxxzzCzxzxzxzxzxxzz I want to get the two strings between (A and B) and (B and C) for every occurrence of A.*B.*C. In this example my desired output would be this: xzz xzx z zxxxxzz How do i do this? edit: sorry, i didn't make it clear. A, B and C are long Strings that can only be identified by regular expressions.


title: Symbolic link of for my user, doesn't work for root

text: I am experimenting with the following scheme in order to share common data among different distributions. In Fedora I have created a symbolic link `/home` pointing to:               /run/media/arun/754ef10a-3f82-4c0b-bde4-a119f7cc472c/Fedora/      In BackTrack I have `/home` pointing to               /run/media/arun/754ef10a-3f82-4c0b-bde4-a119f7cc472c/BT-Linux/      And right now I am doing the same for OpenSuSE 12.3. The `/home` on each distro is a symbolic link to its respective directory on the partition. ie: Fedora, BT-Linux, SuSE. Each of these have `Documents`, `Downloads` and `Videos` folders that are again symbolic links to independent directories (not in `/run/media/...../Fedora` or `BT-Linux` or `Suse`), so I can access those directories right from the `/home` directory. The problem is that although the link is alive in my user account `arun`, the symbolic link is broken when I login as `root`. It is working fine as a normal user but not as `root`. I know the fact that `root` will have its own set of `Documents`, `Desktop`, `Videos` folders, all which needs to be linked too but, the symbolic link `/home` itself is broken. What could be the cause of this issue?               $ uname -a     Linux localhost.localdomain 3.9.5-301.fc19.x86_64 #1 SMP Tue Jun 11 19:39:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


title: Quotes exercise - how to do ssh inside ssh whilst running sql inside second ssh?

text: > **Possible Duplicate:**   >  Quoting in ssh $host $FOO and ssh $host “sudo su user -c $FOO” type > constructs   >  Wrapping a command that includes single and double quotes for another > command I want to run sql over ssh from php . Below command runs nicely               ssh server1 "sudo -u db2inst1 sh -c '/opt/ibm/db2/V9.7/bin/db2 connect to RATIONAL; /opt/ibm/db2/V9.7/bin/db2 set schema Edumate; /opt/ibm/db2/V9.7/bin/db2 \"select * from edumate_settings\"'"      Now I need to do ssh from server1 to server2 and then run "sudo -u db2inst1 .... " there. Is there any easy way how to deal with quotes if I add additional server to this scenario? So it will start like               ssh server1 "ssh server2 "the rest is as above"      Note the I need to run above code from php.


title: Wrapping a command that includes single and double quotes for another command

text: I recently learned about watch, but am having trouble making it work with relatively sophisticated commands. For example, I would like to ask `watch` to run the following command on `zsh` every three seconds*:               for x in `command_1 | grep keyword | cut -d' ' -f1`; do command_2 "word[word=number]" $x; done      as you can see the line above includes single quotes, double quotes, among other special characters. So I tried:               watch -n 3 "for x in `my_command | grep keyword | cut -d' ' -f1`; do command2 "rusage[mem=7000]" $x; done"      but then I got: > no matches found for x in !@#$# ....; done I tried other combinations without success. Here's one of those attempts:               watch -n 3 "for x in $(bjobs -w | grep pre_seg | cut -d' ' -f1); do bmod -R "rusage[mem=7000]" $x; done"      which also results in a similar error. Any ideas how to make this work? * * * *I would also be intersted in solutions that work on `bash`


title: What is Wayland?

text: I was looking for a lightweight X server, but failed to find one. Then I found out about Wayland. I says that it aims to coexist with X, but can run standalone. When I try to compile it, it needs Mesa, which needs X. What exactly _is_ Wayland?


title: How to Remove Windows from dual boot setup?

text: I originally had Windows 7 Starter and Updated to the Windows 8 90 Day Trial. 30 Days into the trial I decided I absolutely hate it and wanted to try Linux Mint. I installed Linux Mint and found out I absolutely love it, and now I want to remove Windows 8. I have researched all over the web, using: `How to remove Windows 8 from Linux Mint`, but my search results always end up being `How to remove Linux Mint`. This is not what I want. I want to remove Windows 8 from my computer by using Linux Mint. What should I do to do this? I absolutely love Linux Mint.


title: ffmpeg -pattern_type glob -- not loading files in correct order

text: I have a dilemma.. I've had a script for a while now that downloads pictures from a webcam every few minutes. The naming convention just does `new_image((len(files(dir))+1) + '.jpg')` and that's all fine.. until today.. I've had a Python script that loads the images **based on creation date** and renders them and i take the OpenGL data and dump it into a movie, which isn't hard and it's all ok.. Except now i have a few thousand images and it's quite ineffective to go on about it this way (even tho it's cool because i can build my own GUI and overlay etc).. anyway, i'm using ffmpeg to combine the images into a slideshow, like so: `ffmpeg -f image2 -r 25 -pattern_type glob -i '*.jpg' -qscale 3 -s 1920x1080 -c:v wmv1 video.wmv` The ffmpeg works fine, except that `-pattern_type glob` takes the images in naming order which doesn't work because the way the files get fed is similar if not the same as `ls`, which looks like:               user@host:/storage/photos$ ls     0.jpg     1362.jpg  1724.jpg  2086.jpg  2448.jpg  280.jpg   3171.jpg  3533.jpg  3896.jpg  4257.jpg  4619.jpg  4981.jpg  5342.jpg  5704.jpg  6066.jpg  650.jpg     1000.jpg  1363.jpg  1725.jpg  2087.jpg  2449.jpg  2810.jpg  3172.jpg  3534.jpg  3897.jpg  4258.jpg  461.jpg   4982.jpg  5343.jpg  5705.jpg  6067.jpg  651.jpg      `0, 1000, 1, 2000, 2`... this is the logic of `ls` so the image sequence (timelapse) will be all f-ed up.. Any ideas on how to use ffmpeg to load the images in a more sorted manner?


title: What happens if I delete all user passwords?

text: I have a Fedora VPS with a root user that has no password. I login with SSH keys. I had another, less privileged account on that server, used for web administration. I've now deleted its password too. If there are no users with passwords on a server, what exactly would happen if I were to lose my SSH key, for example? Would the server become forever unavailable since there is no way to log in on it? Also, how does the `sudo` program behave when neither the root nor the calling user have passwords? I tried it and it didn't even ask me for a password: it just worked, since I have that `user ALL=(ALL) ALL` line in my sudoers file (should I change that?)


title: I stopped MiniSSDPD, will something bad happen?

text: I have been trying to harden my Debian system by stopping and disabling the 20 or so unnecessary services listening by default. One of them is called "minissdpd". Apparently this provides "discovery" services to plug-and-play devices, whatever that means. Seems kind of crazy to me that something intended to help local peripherals needs to be listening to Chinese hackers on the other side of the world. What does discovery services even mean? I looked in some vulnerability database, and sure enough minissdpd had a whole slew of vulnerabilities listed. How can they have this enabled in the default distribution? Seriously, its like install Debian, get hacked. Anyway, my main question is: now that I have disabled this service, is something bad going to happen (like plug something in and it won't work)?


title: Access through samba to link to different filesystem in shared directory (permission error)

text: I have a laptop with Dual Boot Lubuntu 14.04/Windows 7 I have a `BorrajaX` user in Lubuntu and another `Borrajax` user in Windows. In my Lubuntu `$HOME/Documents/` directory I created a link to the Windows `BorrajaX` user's documents, so I can store things there when in Linux and retrieve them when in Windows, and viceversa. In Lubuntu, the directory structure is:               /home/borrajax/    drwxr-xr-x  borrajax borrajax       |-> Downloads/     drwxr-xr-x  borrajax borrajax                   |-> Documents/     drwxr-xr-x  borrajax borrajax       |     |-> TestDir/    drwxrwxr-x borrajax borrajax       |     |-> Windows7_Documents -> /media/windows7/Documents and Settings/borrajax/Documents/    lrwxrwxrwx  borrajax borrajax       |           |-> Android Things/  drwxrwxr--  root  plugdev       |           |-> desktop.ini      -rwxrwxr--  root  plugdev       |           |-> My Pictures -> /media/windows7/Users/borrajax/Pictures  lrwxrwxrwx root plugdev       |-> Pictures/     drwxr-xr-x  borrajax borrajax      The link to `Windows7_Documents` is pointing to a directory in a different partition than where my `/home/borrajax` is mounted (my `$HOME` is on `/dev/sda5` while the Windows 7 partition is `/dev/sda3`) Everything works fine when I access the Windows filesystem locally through that `Windows7_Documents` link, but now I want to share my Linux `$HOME`, being able to access that `Windows7_Documents` remotely, and (here's the issue) I can't. I get a `Permission Denied` error. This is how my shared `$HOME/Documents/` directory shows on a Mac OS X that is accessing it through Samba: ![enter image description here](http://i.stack.imgur.com/hIW3F.png) From the Mac Os X I can properly create new files or directories within my Lubuntu's `$HOME/Documents/`, but I can't access the link in `$HOME/Documents/Windows7_Documents/` Below is the configuration of the Samba share in Lubuntu's config file (`/etc/samba/smb.conf`):               [borrajax]         path = /home/borrajax         writeable = yes         browseable = yes         valid users = borrajax         hosts allow = 192.168.1. 127.0.0.1          Is there a way to access the `Windows7_Documents` directory through samba? I suspect it might have something to do with all the files within the `Windows7_Documents` belonging to `root:plugdev` ? But if that's the case, how could I make the Samba users belong to the `plugdev` group (which I guess it would be the best solution? ) Thank you in advance,


title: Displaying and updating a counter in bash

text: I think it's something like this: (Fedora14/bash)               #!/bin/bash          for i in {0..10..1}; do echo -e "$i"'\c'     echo -e "\n\r"     sleep 1     done      But it doesn't work. Purpose: like this, but without the "clear":               #!/bin/bash          for i in {0..10..1}; do echo -e "$i"     sleep 1     clear     done      So a counting script that doesn't deletes the whole screen to output +1 number, instead it only deletes the line, where the counting is, so that there could be ex.: a beatifull "progress bar"..


title: Loop examples in bash

text: Any examples for "loop" in bash?               for i in {1..5}; do echo $i; done     1     2     3     4     5      AND               for i in 1 2 3 4 5; do echo "Welcome $i times"; done     Welcome 1 times     Welcome 2 times     Welcome 3 times     Welcome 4 times     Welcome 5 times      AND               # {START..END..INCREMENT}     for i in {0..10..2}; do echo "Welcome $i times"; done     Welcome 0 times     Welcome 2 times     Welcome 4 times     Welcome 6 times     Welcome 8 times     Welcome 10 times      AND               for i in $(seq 1 3 20); do echo "Welcome $i times"; done     Welcome 1 times     Welcome 4 times     Welcome 7 times     Welcome 10 times     Welcome 13 times     Welcome 16 times     Welcome 19 times      AND               for (( c=1; c<=5; c++ )); do echo "Welcome $c times..."; done     Welcome 1 times...     Welcome 2 times...     Welcome 3 times...     Welcome 4 times...     Welcome 5 times...


title: How to modify the output of tcpdump to be human-readable?

text: I have a tcpdump command:               tcpdump -i wlan0 dst port 80 and ! dst 192.168.1.201 and ! src 192.168.1.201 -vvv -s0 -w proba.txt      Which gives the following output:               root@SERVER:/tmp# egrep "GET|Host:" proba.txt | awk 'BEGIN {FS=" "}{print $2}'     emaffia.hu     /     google.hu     /     www.google.hu     emaffia.hu     /textinputassistant/tia.png     www.google.hu     /logos/2011/pierre_de_fermat-2011-hp.jpg     www.google.hu     /gb/images/b_8d5afc09.png     ssl.gstatic.com     /favicon.ico     www.google.hu     /     hwsw.hu     /js/mootools-1.2.5.1-more.js     www.hwsw.hu      How can I modify these lines to get this output?:               emaffia.hu/     google.hu/     www.google.hu     emaffia.hu/textinputassistant/tia.png     www.google.hu/logos/2011/pierre_de_fermat-2011-hp.jpg     www.google.hu/gb/images/b_8d5afc09.png     ssl.gstatic.com/favicon.ico     www.google.hu/     hwsw.hu/js/mootools-1.2.5.1-more.js     www.hwsw.hu      Is it possible?


title: expr help - managing strings

text: I need to take text like this:               A234321=http://www.google..... a normal URL      And pull out only the URL, getting rid of the first part. I think I can use `expr` to do it, but I can't figure out the right way The entire regex I can use is `http:[a-zA-Z0-9/_]+`


title: Human-readable ls output under AIX?

text: How can I get human-readable `ls` output under AIX? There is no `-h` parameter


title: Reducing packet loss in tc rate limiting

text: I use this tc command to limit upload speed on an interface:               tc qdisc add dev eth1 root tbf rate 2mbit burst 10kb latency 70ms peakrate 2.4mbit minburst 1540      But it results in heavy packet loss. If the data coming via `eth0` (WAN) is 7 GB, it will be 6.2 GB on the rate-limited interface `eth1`. Are there any other rate limiting solutions that cause lesser packet loss?


title: httpd start fails and shows up error

text: I installed Apache through `yum install httpd` in Fedora. When I try to start the service it shows the following error:               [root@localhost ~]# systemctl enable httpd.service      ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'           [root@localhost ~]# systemctl start httpd.service      Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.                    [root@localhost ~]# systemctl status httpd.service      httpd.service - The Apache HTTP Server              Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)         Active: failed (Result: exit-code) since Sat 2014-05-17 21:19:25 IST; 1h 13min ago        Process: 2622 ExecStop=/usr/sbin/httpd $OPTIONS -k graceful-stop (code=exited, status=1/FAILURE)             Process: 2620 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)                May 17 21:19:25 localhost.localdomain systemd[1]: Starting The Apache HTTP Se...      May 17 21:19:25 localhost.localdomain httpd[2620]: httpd: Syntax error on lin...      May 17 21:19:25 localhost.localdomain systemd[1]: httpd.service: main process...      May 17 21:19:25 localhost.localdomain httpd[2622]: httpd: Syntax error on lin...      May 17 21:19:25 localhost.localdomain systemd[1]: httpd.service: control proc...      May 17 21:19:25 localhost.localdomain systemd[1]: Failed to start The Apache ...      May 17 21:19:25 localhost.localdomain systemd[1]: Unit httpd.service entered ...      [root@localhost ~]#


title: OpenELEC, non-root user, home directory, SSH

text: I'm running OpenELEC on Raspberry Pi   As you know, directory `/storage` is a shared home folder between user `root` and user `openelec`   This makes a problem when you want to setup ssh key authentication for root   Because for that, you will have to change the owner of `/storage` from `openelec` to `root`, and change it's permission to `755` so that it wont be writable by non-root users including `openelec`   In other words, user `openelec` won't be able to write to his own home directory I have done that, and I want to make sure that wouldn't make a problem   When I look at the output of `ps aux` I can't find any process running by `openelec` user (so that it needs to write to his own home folder)   (the main process `xbmc` is running by root too) Now I have several questions: 1- Why does that user `openelec` exist in the first place?   2- Why it's using a common home directory with root?   3- Why `/storage` is not owned by root by default?   4- Have I done/understood something wrong?


title: Bad configuration option: ControlPersist while scp with control master?

text: I am using `SCP` with `ControlMaster` to copy the files but somehow I am getting this error back -               command-line: line 0: Bad configuration option: ControlPersist     command-line: line 0: Bad configuration option: ControlPersist     command-line: line 0: Bad configuration option: ControlPersist     command-line: line 0: Bad configuration option: ControlPersist     command-line: line 0: Bad configuration option: ControlPersist      Here is my shell script -               #!/bin/bash          export PRIMARY=/filetransfer/test01/primary     readonly SERVERS_LOCATION=(machineB machineC)     export SERVERS_LOCATION_1=${SERVERS_LOCATION[0]}     export SERVERS_LOCATION_2=${SERVERS_LOCATION[1]}     export MAPPED_LOCATION=/data/snapshot     FILE_PARTITION=(550 274)          export dir3=$MAPPED_LOCATION/20140510          find "$PRIMARY" -mindepth 1 -delete          do_CopyFiles() {       el=$1       scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@$SERVERS_LOCATION_1:$dir3/pp_week_1543_"$el"_200003_5.data $PRIMARY/. || scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@$SERVERS_LOCATION_2:$dir3/pp_week_1543_"$el"_200003_5.data $PRIMARY/.     }     export -f do_CopyFiles     parallel -j 5 do_CopyFiles ::: "${FILE_PARTITION[@]}"      Is there anything wrong I am doing? This is only happening to this machine in which I am running my shell script. Other machine in which I am running my same shell script, it works fine. So some setting configuration is different I guess in this machine which I am not aware of.


title: Is there a way to share a service listening on loopback of the host with an LXC guest?

text: I'm trying to provide a service to the LXC guests, but do not want to expose it from the host. I also don't want to put up firewall rules for the service, so loopback appears to be the most straightforward solution. Is there a way to have a service listening on `lo` (loopback) shared with LXC guests, e.g. similar to bind-mounting directories into place?