title: What is tmux's "message-command"?

text: I've been trying to figure out how to change the background color of the command prompt in tmux's copy mode. It defaults to black on orange, at least on my setup. I changed the color of the command prompt that lives in the status-line with these lines in my `.tmux.conf`               set -g message-bg '#e7e7e7'     set -g message-fg '#000000'      but this has no effect on the prompt that shows up above the status-line when, for instance, I run `list-keys` and hit `/` to search. The `Search Down:` prompt is black on orange. I'd hoped I could change it with `set -g message-command-bg '#e7e7e7'` but no dice, and in fact, I can't figure out what `message-command-style` changes at all. The manual says it changes the stye of 'status line message command', but I have no idea what that would be, if not exactly what I changed with `message-bg`. Any help? _As requested_ : My `.tmux.conf`               # This seems to have no effect at all     set -g message-command-style bg=red     # nor does this     set -g message-command-bg red          # use UTF8     set -g utf8     set-window-option -g utf8 on          # 256 colors     set -g default-terminal "screen-256color"          # reload config     bind R source-file ~/.tmux.conf \; display-message "Config reloaded"          # scrollback history     set -g history-limit 3000          # act like GNU screen     unbind C-b     set -g prefix C-a     bind C-a send-prefix          # indifferent bindings     bind C-n next-window     bind C-p previous-window     bind C-l last-window          # kills     bind-key k kill-pane     unbind &     bind-key K confirm-before -p "kill-window #W? (y/n)" kill-window     unbind x     bind-key x confirm-before -p "kill-session #S? (y/n)" kill-session          # shorten command delay     set -sg escape-time 1          # set pane color     set-option -g pane-border-fg colour240     set-option -g pane-active-border-fg colour240          # status bar     set -g status-utf8 on     set -g status-bg '#e7e7e7'     set -g status-fg '#404040'     set -g status-attr bright     set-window-option -g window-status-format ' #I #W'     set-window-option -g window-status-current-format ' #I #W'     set-window-option -g window-status-current-fg '#1922bd'     set-window-option -g window-status-current-attr bright     set -g message-bg '#e7e7e7'     set -g message-fg '#000000'          set -g status-justify left     set -g status-right-length 50     set -g status-right ' (#S) :: #h :: #(sysctl vm.loadavg | cut -d " " -f 3-5) '     set -g status-left ''


title: Can't rename a directory that I own

text: I have a directory with a big load of sub directories. I own all of them, and the permissions are all 777.               pascal@azazel /box $ ls -al     total 147872     drwxr-xr-x 293 root   root      12288 aoû 22 19:44 .     drwxr-xr-x  25 root   root       4096 jun 28 18:49 ..     drwxrwxrwx   7 pascal pascal     4096 aoû  4  2010 131082     [...]      I want to rename the directories :               pascal@azazel /box $ mv 131073 NewName     mv: impossible de déplacer « 131073 » vers « NewName »: Permission non accordée      The message is in french, basically it said that I dont have the permission to rename (move) the directory. What is happening ?


title: ipfw on Mac OS X 10.8

text: I'm trying to setup local transparent proxy with `ipfw` and `squid` and ran into some problems. I have a single rule `00100 fwd 127.0.0.1,3128 log tcp from any to any dst-port 80` but it either gets into infinite loop or doesn't work for some other reason. There's a `ipfw: 100 Forward to 127.0.0.1:3128 TCP 172.17.244.135:56788 74.125.232.0:80 out via en0` message in `system.log` when I `curl` something but `nc` listening on port 3128 doesn't receive anything. Any ideas?


title: Alphabetizing names in `ls` alias with .files not intermingled

text: I am currently using the following `ls` alias: `alias ls='ls -alhGkpsq --color=auto'`. This results in following directory listing.               [03:35] bryson@brys  ~ :$ ls     total 48K     4.0K drwx------ 4 bryson 4.0K Nov  2 03:34 ./     8.0K drwxr-xr-x 3 root   4.0K Apr 19  2012 ../     4.0K -rw------- 1 bryson  676 Nov  2 03:35 .bash_history     8.0K -rw-r--r-- 1 bryson   21 Nov 23  2011 .bash_logout     8.0K -rw-r--r-- 1 bryson   57 Nov 23  2011 .bash_profile     4.0K -rw------- 1 bryson   50 Nov  2 03:34 .lesshst     4.0K drwxr-xr-x 3 bryson 4.0K Nov  2 03:21 source/     4.0K drwx------ 2 bryson 4.0K Nov  2 03:23 .ssh/     4.0K -rw------- 1 bryson 1.6K Nov  2 03:23 .viminfo      The issue I have with this, which is _not_ an issue with OS X's version of `ls`, is that `.ssh/` is alphabetized _ignoring the`.`_ in the filename. What I would like is for `ls` to alphabetize the dot files all together at the top, which is where it puts `.` and `..` as well. (Arch Linux, Bash)


title: Show List of USB device to know name /dev/?

text: I want use two USB webcam with motion, I've connected both to an USB hub, giving from CLI the command               sudo lsusb      I can see that both cams are connected               Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 008: ID 046d:09c1 Logitech, Inc. QuickCam Deluxe for Notebooks **//THIS**     Bus 001 Device 021: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB     Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.      Bus 001 Device 004: ID 0951:1643 Kingston Technology DataTraveler G3 4GB     Bus 001 Device 005: ID 05e3:0610 Genesys Logic, Inc. 4-port hub     Bus 001 Device 006: ID 05e3:0610 Genesys Logic, Inc. 4-port hub     Bus 001 Device 007: ID 046d:092f Logitech, Inc. QuickCam Express Plus **//THIS**     Bus 001 Device 022: ID 0461:4d0f Primax Electronics, Ltd HP Optical Mouse     Bus 001 Device 023: ID 04f2:0841 Chicony Electronics Co., Ltd       The problem is that I'm not able to see the videostream of the second cam. I've seen in `/etc/motion/thread1.conf` the first cam using `videodevice /dev/video0`, by default. The second `/etc/motion/thread2.conf` use `videodevice /dev/video1`, always by default. The first works, the second doesn't. [I use port 8081 for first webcam and port 8082 for the second] ![/dev/video0](http://i.stack.imgur.com/r4Yw3.png) ![/dev/video1](http://i.stack.imgur.com/go0Tj.png) I thought that one error could be the wrong name `/dev/video1`. Any advice?


title: API for IPROUTE2 in any programming language

text: Is there any API that can be used to manipulate Linux routing table? I want to write a program that listens to sockets and then modifies routing table accordingly, just a simple code, but need an API.


title: Window content freezes

text: I recently started using Kanotix, a Debian based distro that loads itself into RAM on boot, and i'm loving it. But this is the second time I have this problem, and I was wondering what caused it and how to fix it. So it boots up and KDE works perfectly, but for some reason the content of windows freeze up. It kind of looks like you're screen that split second before a BSOD. Everything inside the window still works, I can still type and everything. When I minimize and restore a window enough times, it will show the actual content. I can switch between desktops and all effects work perfectly. Restarting the X server doesn't do anything. Any help will be greatly appreciated. EDIT:   result of free                            total       used       free     shared    buffers     cached     Mem:       8175584    1801436    6374148          0      77632     408004     -/+ buffers/cache:    1315800    6859784     Swap:            0          0          0


title: Zenity dialog windows have excessive height and cannot be resized. Bug workaround anyone?

text: I'm trying to do some things in zenity, and it's been driving me bonkers. To illustrate my problem, try running this:               zenity --info --text "Hello there friends."      Simple enough right. Now try this:               zenity --info --text " Hello there friends. Hello there friends. Hello there friends. Hello there friends."      Notice how the dialog box got considerably taller? So you can resize the width of the dialog. In particular, notice what happens when you try to make the width as small as possible. This illustrates my next point: you can't resize the height DOWN at all--it appears to have a hard minimum which is based on the height that would be required if your dialog box was squeezed horizontally to the smallest size possible. None of this matters for short messages, but what if you have a long message? You don't have to do very much typing in order to end up with a dialog box that is so tall that the ok button is off the screen -- and that is a big problem for my users. Here's a bug report: FS#34164 : [zenity] - dialog size bug https://bugs.archlinux.org/task/34164 But that patch doesn't do me any good. My end users are installing Zenity on their own computers and I can't patch their Zenity. Is there any way around this? Any tricks with regard to the text or anything else?


title: Installing GNU Make on ChromeOS

text: Playing around with the new Chromebook, was trying to get Make working to the end of installing other software. However, can't seem to get Make anywhere near to install; ./configure doesn't generate the needed build.sh. Does anyone have any advice on how I can go about doing this, or installing Linux software on ChromeOS in general?


title: Problems changing PS1 to use special character

text: I'm trying to get my zsh to look something like this: https://bbs.archlinux.org/viewtopic.php?pid=1068202#p1068202. Whenever I print the               └───╼ part of the PS1 to my terminal (or in the .zshrc for that matter). I get question marks (i.e. `??????`) or a sequence of `â`. I guess this has to do with the character encoding? I have also tried this in urxvt (which as I would suspect would have no problem with this). I also tried changing the font with no results.


title: How can I use the "mail" command?

text: I am not great at using the `mail` command on Linux. How can I get better? I don't even know what program this is. Is it pine? I doubt it. It is in `/usr/bin/mail` and when I start it is tells me that it is `Version 8.1.2 01/15/2001`. When I type `list` it tells me               Commands are:     next, alias, print, type, Type, Print, visual, top, touch, preserve,      delete, dp, dt, undelete, unset, mail, mbox, pipe, |, more, page, More,      Page, unread, Unread, !, copy, chdir, cd, save, source, set, shell,      version, group, write, from, file, folder, folders, ?, z, headers,      help, =, Reply, Respond, reply, respond, edit, echo, quit, list, xit,      exit, size, hold, if, else, endif, alternates, ignore, discard, retain,      saveignore, savediscard, saveretain, core, #, inc, new      If I type in `?` it tells me this:               Mail Command               Description     -------------------------  --------------------------------------------     t [message list]           type message(s).     n                          goto and type next message.     e [message list]           edit message(s).     f [message list]           give head lines of messages.     d [message list]           delete message(s).     s [message list] <file>    append message(s) to file.     u [message list]           undelete message(s).     R [message list]           reply to message sender(s).     r [message list]           reply to message sender(s) and all recipients.     p [message list]           print message list.     pre [message list]         make messages go back to /var/mail.     m <recipient list>         mail to specific recipient(s).     q                          quit, saving unresolved messages in mbox.     x                          quit, do not remove system mailbox.     h                          print out active message headers.     !                          shell escape.     | [msglist] command        pipe message(s) to shell command.     pi [msglist] command       pipe message(s) to shell command.     cd [directory]             chdir to directory or home if none given     fi <file>                  switch to file (%=system inbox, %user=user's                                system inbox).  + searches in your folder                                directory for the file.     set variable[=value]       set Mail variable.      I type `z` and it shows me the end of the list of messages - but that command is not showing up in the `?` help page. My biggest questions are:   1. What program is this?   2. How can I learn it better? Are there some links to tutorials?   3. **MOST IMPORTANTLY How can I get back to the message list after I run another command (or refresh the message list, or move up and down in the message list??)**   4. What are the most command commands, or what are the most helpful tricks to using it?   5. What is the opposite command of `z` for scroll down the list page by page? **Clarification** : I'm asking about how to use the interactive program and not the scriptable command - i.e. what happens when you just type `mail` with no flags or parameters. I only seem to be able to find tutorials online of how to script with the program, not how to use it. I know it hasn't been updated since 2001, I would just like to get a little more efficient at using it and I'm having a hard time finding resources to do that.


title: mail: send email with attachment from commandline

text: I know how to send an email from command line (script)               echo "body" | mail -s "subject" my@email.com      Is it possible to send attachments from commandline (script) as well? I am using `heirloom-mailx` on Debian Wheezy.


title: how to create ISO and hide certain files

text: I am a newbie here and my apologies if I am posting a question which has been answered many times in a another thread. I did my homework find some relevant information But could not. Thanks for reading. I am trying to create a ISO image of my executable By hiding few files off the ISO immage as i want the user only to see an EXE and not the other directories when they open in a PC (Windows) is the targeted ENV in which my users will launch the application.


title: Unix - how to fetch files based on the part of a filename that is date

text: Say I have files say like               AA_XX_20111208     AA_XX_20111207     AA_XX_20111206     AA_XX_20111205     AA_XX_20111204     AA_XX_20111203      So using the date part, how can i fetch previous 2 month files ? For e.g. this month is February, I must fetch all files relating to January and December. and for month of March, i must fetch files of January and February This has to happen each month. Eg. for month of February i need files of Dec and Jan               AA_XX_20121208     AA_XX_20121207     AA_XX_20121206      ...so on               AA_XX_20130108     AA_XX_20130107     AA_XX_20130106      ...so on


title: Cleaner way to delete files on Linux which include a datestamp as part of file name

text: I have a new requirement to purge MySQL dump files that are older than 30 days. The files use a naming convention of "all-mysql-YYYYMMDD-HHMM.dump". The files are located on SAN mounted file system, so restoration is not an issue, but the drive space is limited unfortunately and fills up quickly so it requires frequent human intervention. **Example of files names**   * all-mysql-20130324-2330.dump   * all-mysql-20130325-2330.dump   * all-mysql-20130326-2330.dump My first thought was to use "find" inside a batch script with -mtime +30, however, the modification times cannot be guaranteed and some of the older archives could evade the purge date :) I created the following BASH script, but I was hoping there was there was a cleaner way to perform this operation.               #!/bin/bash          STARTING_DIR=$(pwd)          FILE_PREFIX=all-mysql-     BACKUP_DIR=/opt/backup/mysql/dumps     ARCHIVE_WINDOW_DAYS=30          cd $BACKUP_DIR          # Create YYYYMMDD datestamp for Today - $ARCHIVE_WINDOW_DAYS     ARCHIVE_WINDOW_IN_SECS=$(echo "$(date +%s) - (${ARCHIVE_WINDOW_DAYS} * 86400)" | bc)     PURGE_BEFORE_DATE=$(date -d @${ARCHIVE_WINDOW_IN_SECS} +%Y%m%d)          for backup_file in $FILE_PREFIX*     do         # Trim prefix, time portion of date stamp, and file extension         # from $backup_file to allow numeric comparison against YYYYMMDD         backup_trim_tmp=${backup_file#${FILE_PREFIX}}         backup_trimmed=${backup_trim_tmp%-****.dump}              if [ ${PURGE_BEFORE_DATE} -gt ${backup_trimmed} ]         then             rm $backup_file         fi     done          cd $STARTING_DIR


title: Fedora 15 Crash after xorg.conf file update

text: I updated my `xorg.conf` file looking to set up a dual screen system. Unfortunately, I can't provide you this file because when I went to reboot my system crashed. The last line I get when I try to reboot is:               Started SYSV: Enabled monthly update of Smolt ....      PC/SC...t data.ump directory for each oops....resses.  It must be running on      Then it's a black screen. I know I need to boot from a rescue CD which I've downloaded and it runs but I don't know what to do then. Help?


title: Java version for Tomcat

text: I want to run my Tomcat with Java 7 but all I found about configuring it doesn't work. The management interface of Tomcat shows `1.6.0_24-b24` as Java version. The `JAVA_HOME` variable is empty.               % echo $JAVA_HOME      I understand that in this case Tomcat uses the system default Java, which should be 7.               % java -version     java version "1.7.0_09"     OpenJDK Runtime Environment (IcedTea7 2.3.3) (7u9-2.3.3-0ubuntu1~12.04.1)     OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)      I changed it with `update-alternatives`. What part of the configuration am I missing?


title: How to create a screen lock timer for Awesome WM?

text: I've got an Ubuntu 12.04 system with Awesome WM, and I'd like the screensaver to work _like in Unity_ :   1. **GNOME** Screensaver   2. **`Ctrl` -`Alt`-`L`** to lock   3. _N_ minutes' **timeout which respects applications which temporarily disable the screensaver** The keyboard shortcut was relatively easy:               -- Lock screen     awful.key(         { "Mod1", "Control" },         "l",         function ()             awful.util.spawn("gnome-screensaver-command --lock")         end)      How do I solve point 3?


title: How to pass each line of a text file as an argument to a command?

text: I'm looking to write a script that takes a `.txt` filename as an argument, reads the file line by line, and passes each line to a command. For example, it runs `command --option "LINE 1"`, then `command --option "LINE 2"`, etc. The output of the command is written to another file. How do I go about doing that? I don't know where to start.


title: Automate login with sudo and su

text: I know the security risks, but I am performing this experiment/exercise on an old, seldom used *nix machine I have laying around the house. So doing this exercise will not bring any security risk to my machine. Having said that, please do not post any comments regarding security. I also know I can change `sudoers` to disable password prompts, but I am not interested in that. I have found a command:               echo "password" | sudo -S su      but which works very oddly. I type it in, and the domain stays the same; I don't change into root. Is there something else I'm missing or is there a better way to do this? * * * Things I've done:   1. added a `\n` to the end of the password: password doesn't verify correctly.   2. omitting the `su`: prints out usage on how to use `sudo` correctly


title: Build Gimp from custom-path libraries

text: I'm installing Gimp (2.6.10) on Debian. The system has all the required libraries (dependencies) installed in the default directories, so giving to Gimp               ./configure && make && make install      completes fine, and installs Gimp.   But I compiled some of the dependencies manually, for needed performance. These are GEGL, Glib, and BABL. All them are correctly installed in               --prefix /usr/handsoftware         I configure Gimp with these essential flags: (there are more flags to strip down unused features from the binary)               ./configure --prefix=/usr/handsoftware/ PKG_CONFIG_PATH="../gegl/:../babl/" CXXFLAGS="-march=pentium4 -O3" CXXFLAGS="-march=pentium4 -O3"      where PKG_CONFIG_PATH points to the source directories of GEGL and BABL from which these libraries were compiled and installed. I don't know if this setting is correct nor required. This `./configure`s correctly, but `make` fails pointing out that gegl.h is missing. gegl.h is installed in two points in my system:   1. in the GNU `include` standard directory, where it's been installed by APT   2. in `../gegl/` , as pointed by PKG_CONFIG_PATH I have to point Gimp to the manually-installed includes rather than to the ones installed by APT, as the formers are those compatible with the manually installed library. Can I do this?


title: what is >> symbol and >& in unix/Linux?

text: I have a CRONTAB entry as below. Can someone tell me what the below statement is exactly doing?               1 0 * * * /vol01/sites/provisioning/MNMS/45627/45627.sh1 >> /vol01/sites/provisioning/MNMS/45627/output/cron.log 2>&1


title: input output redirection in bash

text: In Ksh for redirecting i/o from a command away from standard output/error I do , [ where command is any command that produces output/error ]               command 2>filename     command 2>/dev/null      or               command &>filename     command &>/dev/null      In bash , often I see code like               command >&/dev/null      what does that additional `&` signify, when the same can be get done by using               command> /dev/null      I know I am missing something fine, but glad to learn. EDIT: I knew what 2>&1 is, which the so called duplicate question asks , I was told that 1 indicates a file descriptor and hence we need an & to refer that. I was puzzled to see & before the name of the file. Hence this question.


title: Best conventions for icons in Debian/Ubuntu

text: I've been looking for a while for the best conventions for icons, but I just find lots of inconsistent web pages. Maybe the conventions have changed and they need updating, or maybe I just haven't been able to find the right page.   1. It seems like both PNG and SVG icons are supported. Are SVG icons preferred? Are there any downsides (because many packages don't use them)?   2. If I use an SVG icon, can I have a separate PNG one for 16x16? Our icon will not resize down to 16x16 very well.   3. If I use PNG icons, what sizes should I provide?   4. What should the icons be named?   5. Where should they be placed? /usr/share/icons? /usr/share/pixmaps?


title: Shell variables not working?

text: I'm trying to store the date in a variable (`$DATE`) so I can use it later, but it doesn't seem to work. See anything wrong?               DATE=$(date +"%Y-%m-%d %R")     sudo mysqldump -u root -pnotgivingyoumypassword --all-databases > ~/mysql_backups/$DATE.sql     cd /var/www && sudo tar -czf ~/www_backups/$DATE.tar ./ **Update** The error message is: > get:tar: 20\:41.tar: Cannot stat: No such file or directory tar: Exiting > with failure status due to previous errors It appears to work for the mysql dump, but it fails when using it in the last command.


title: BASH: Grouping files by name

text: I have over one million files. And I have to proceed over them.   My files' directory hierarchies just like below               source=/opt/output/renamed/     target=/opt/output/combine     send=/opt/output/send/combined       Firstly I have to loop 1000 files from source (/opt/output/renamed) directory and group them by filename. Filename ==> ORACLE_gprtcp_201209221454_312312.log.gz first and second colun is not important so much. But I have to group them by third field which is a timestamp. And they have to be grouped by thirty minutes. For example,there are two files which like these               1.ORACLE_gprtcp_201209231632_987546.log.gz      2.ORACLE_gprtcp_201209231612_123876.log.gz      3.ORACLE_gprtcp_201209231602_987546.log.gz      4.ORACLE_gprtcp_201209231644_987546.log.gz       5.ORACLE_gprtcp_201209231647_987546.log.gz      6.ORACLE_gprtcp_201209231601_987546.log.gz       the first group's time interval must be in thirty minutes for example, first goruped files are 2, 3 and 6 files (they are in first thirty minutes) 1,4 and 5 files(they are in last thirty minutes) I have tried to write a script just like this               #!/bin/bash      sourceFolder="/opt/rename/"     limitCount=10 # Limit for send file count for per process     renamed="/opt/combine"     target="/opt/send/combined/"              for sf in ${sourceFolder}; do         fileList=$(find ${sf} -type f -name "*.gz"  | sort -t '_' -k3 | head -${limitCount} )          for filePath in $(echo "${fileList}"); do            fileName=$(basename ${filePath}) # source file name           dirName=$(dirname ${filePath}) # source dir name           #timeRef=$(echo ${fileName} | cut -d '_' -f 3 |  sed 's/\(.\{11\}\).*/\1/')            timeRef=$(echo ${fileName} | cut -d '_' -f 3 |  cut -c-11)            #time ref : ORACLE_gprtcp_20120923012703_3431593.log.gz                  if [ "${sf}" == "/opt/rename/" ]; then #####  combine             #Move files to under /opt/combine/ to process files in the fastest way             mv ${filePath} ${renamed}             timeRef30="${group} | cut -d '_' -f 3 |  sed 's/\(.\{10\}\).*/\1/')"             echo  $timeRef30             for files in $(find ${renamed} -name "*${timeRef}*" | uniq)             do              fileGroup=$(echo $files | sort -t '_' -k 3 )              first=$(echo ${fileGroup} | head -1 | cut -d '_' -f 4 | cut -d '.' -f 1)              last=$(echo ${fileGroup}  | tail -1 | cut -d '_' -f 4 | cut -d '.' -f 1)                          for group in ${fileGroup}               do                timeInt=$(echo ${group} | cut -d '_' -f 3 |  sed 's/\(.\{10\}\).*/\1/')                zcatBaseName=$(dirname ${group}) #/opt/rename/                zcatName=$(basename ${group})                 zcatUniq=$(echo ${group}| cut -d '_' -f 4 | cut -d '.' -f 1)                newName=$(echo ${targetNAT}/ORACLE_gprtcp_${timeInt}000_${first}${last}.log)                sleep 1                echo "starting to zcat all files ${fileGroup}"                zcat -f $(echo ${fileGroup}) >> "/opt/combine/ORACLE_gprtcp_${timeInt}000_${first}${last}.log"                gzip "/opt/infolog/output/iotest/24/combine/ORACLE_gprtcp_${timeInt}000_${first}${last}.log"                rm -f $(echo ${fileGroup})                sleep 4                                             done              done              fi      done      done      Is there anyone that can give me a suggestion about how can I success to group files between thirty minutes and zcat them to new file ? Thanks in advance


title: make grep confirm all matches

text: I am writing a "unit test" for a bunch of .tex files and want to check for incorrect entity names, e.g. "Data Items" instead of "DataItems". Currently, I use `grep` to search for the incorrect versions:               grep -i "Data items" *.tex      however, the list is pretty large, also there are false positives sometimes. I'm looking for a `grep` alternative that prompts what to do on each match. To deal with the false positives, one of the options needs to be ignore, and it needs to remember it as ignored, so it doesn't prompt about that particular instance again in the future. (Sort of like how you can tell a word processor to ignore a misspelling in the spell checker.)


title: SSH jumping over socks(4/5) proxy chain. Host -> socks proxy -> socks proxy -> destination

text: I got a great answer for my previous question about connecting from Machine `A` to Machine `C` via Socks proxy located on Machine `B`. Say Machine B Ip is `218.62.97.105` and it is listening on port 1080 The command for that: `ssh -o ProxyCommand='socat - socks:218.62.97.105:HOST_C:21,socksport=1080'` I wonder if it is possible to make a chain from the socks proxies. Consider scenario: Machine A `->` Machine B (Socks proxy 1) `->` Machine C (Socks proxy 2) `->` Machine D (destination) Machine B IP: `218.62.97.105` PORT `1080` Machine C IP: `11.11.11.11` PORT `3128` Machine D IP: `55.55.55.55` PORT `8080` I hope there is someone out there experienced with socat or any other tool as it seems pretty complicated for me at this point. +100 for anyone who could give me the working answer. * * * debug of socat 1 command:               2012/10/02 20:45:00 socat[15641] D read -> 8     2012/10/02 20:45:00 socat[15641] D received socks4 reply data (offset 0): 00 5c 00 50 c1 6b 90 17     2012/10/02 20:45:00 socat[15641] D received all 8 bytes     2012/10/02 20:45:00 socat[15641] I received socks reply VN=0 CD=92 DSTPORT=80 DSTIP=193.107.144.23     2012/10/02 20:45:00 socat[15641] E socks: ident refused by client     2012/10/02 20:45:00 socat[15641] N exit(1)     2012/10/02 20:45:00 socat[15641] I shutdown(4, 2)     2012/10/02 20:45:00 socat[15641] D shutdown()  -> 0     2012/10/02 20:45:00 socat[15641] I shutdown(3, 2)     2012/10/02 20:45:00 socat[15641] D shutdown()  -> 0     2012/10/02 20:45:00 socat[15638] I childdied(signum=17)     2012/10/02 20:45:00 socat[15638] D waitpid(-1, 0xbfbea3fc, 1)     2012/10/02 20:45:00 socat[15638] D waitpid(, {256}, ) -> 15641     2012/10/02 20:45:00 socat[15638] I childdied(17): cannot identify child 15641     2012/10/02 20:45:00 socat[15638] D saving pid in diedunknown1     2012/10/02 20:45:00 socat[15638] W waitpid(): child 15641 exited with status 1     2012/10/02 20:45:00 socat[15638] D waitpid(-1, 0xbfbea3fc, 1)     2012/10/02 20:45:00 socat[15638] D waitpid(, {256}, ) -> -1     2012/10/02 20:45:00 socat[15638] I waitpid(-1, {}, WNOHANG): No child processes     2012/10/02 20:45:00 socat[15638] I childdied() finished      socat second command:               2012/10/02 20:44:38 socat[15640] D socket(2, 1, 6)     2012/10/02 20:44:38 socat[15640] I socket(2, 1, 6) -> 3     2012/10/02 20:44:38 socat[15640] D fcntl(3, 2, 1)     2012/10/02 20:44:38 socat[15640] D fcntl() -> 0     2012/10/02 20:44:38 socat[15640] D connect(3, {2,AF=2 127.0.0.1:22222}, 16)     2012/10/02 20:44:38 socat[15640] D connect() -> 0     2012/10/02 20:44:38 socat[15640] D getsockname(3, 0xbf8111cc, 0xbf811058{112})     2012/10/02 20:44:38 socat[15640] D getsockname(, {AF=2 127.0.0.1:40843}, {16}) -> 0     2012/10/02 20:44:38 socat[15640] N successfully connected from local address AF=2 127.0.0.1:40843     2012/10/02 20:44:38 socat[15640] I sending socks4 request VN=4 DC=1 DSTPORT=21 DSTIP=xx.xxx.xxx.xxx USERID=mnmnc     2012/10/02 20:44:38 socat[15640] D malloc(42)     2012/10/02 20:44:38 socat[15640] D malloc() -> 0x8f1ec80     2012/10/02 20:44:38 socat[15640] D sending socks4(a) request data 04 01 00 15 3e f4 9f 9a 6d 6e 6d 6e 63 00     2012/10/02 20:44:38 socat[15640] D write(3, 0xbf811304, 14)     2012/10/02 20:44:38 socat[15640] D write -> 14     2012/10/02 20:44:38 socat[15640] I waiting for socks reply     2012/10/02 20:44:38 socat[15640] D read(3, 0xbf811234, 8)     2012/10/02 20:45:00 socat[15640] D read -> 0     2012/10/02 20:45:00 socat[15640] E read(): EOF during read of socks reply, peer might not be a socks4 server     2012/10/02 20:45:00 socat[15640] N exit(1)     2012/10/02 20:45:00 socat[15640] I shutdown(3, 2)     2012/10/02 20:45:00 socat[15640] D shutdown()  -> 0     ssh_exchange_identification: Connection closed by remote host


title: Grep a string with spaces from a file

text: #!/bin/bash     LIST=/errors_exception.txt     cd /test     for PATTERN in `cat $LIST`     do             for FILE in $(ls)             do             if zcat $FILE | grep -Fxq "$PATTERN"; then             echo "$PATTERN found pattern in $FILE" >> output             fi     done     done      I'm trying to scan a lots of compressed log files (.gz) and check if the pattern I'm looking for is still exist on those logs. For example in my code above, lets say, `errors_exception.txt` contains below               one      one two three     four five     six      `/test` - dir contain log files Why is it when I run the script, it doesn't read the 2nd line "one two three" as a single line? When I run bash -x test.sh (name of the script) it reads the 2nd line like there's another 3 more line where in the text file it shows "one two three" as a single line.


title: Using USB hub for keyboard and mouse in multiseat

text: I want to configure a 2 user multi-seat in Linux.   Is it possible to configure keyboard and mouse for second seat with a USB hub on a single USB port or I need to connect each of them to a separate USB port?


title: Unwanted text highlighting in Vim latex-suite

text: I have installed vim latex-suite. Whenever I type`$$` to get inside math mode, as a side effect, it also highlights the last search term using `/exp`. What has caused this and how can I avoid this highlighting when I type `$$` without affecting the functioning of latex-suite?


title: Find processes using a network interface

text: I'm trying to find a way to safely shutdown a network interface, i.e. without disturbing any processes. For this I need to find out what processes are currently using that interface. Tools like `ss`, `netstat` or `lsof` are helpful showing which processes have open sockets, but they don't show `wpa_supplicant`, `dhcpcd`, `hostapd` and others. Is there a way to detect these processes in a general way? It might not for dhcpcd, as it is just a program opening a socket every now and then, but I'm assuming wpa_supplicant and hostapd would “do something” to that interface which is detectable and perhaps also leads to the relevant PID.


title: sshd service is not being started: Centos 6.5

text: I am getting the error message below when I start the `sshd` service in centos 6.5. Any help to get rid of this issue? ![sshd error message](http://i59.tinypic.com/9avh46.png)               81: GSSAPIAuthentication yes     83: GSSAPICleanupCredentials yes     97: UsePAM yes      100:AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES     101:AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT     102:AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE     103:AcceptEnv XMODIFIERS      whole file # $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $               # This is the sshd server system-wide configuration file.  See     # sshd_config(5) for more information.          # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin          # The strategy used for options in the default sshd_config shipped with     # OpenSSH is to specify options with their default value where     # possible, but leave them commented.  Uncommented options change a     # default value.          #Port 22     #AddressFamily any     #ListenAddress 0.0.0.0     #ListenAddress ::          # Disable legacy (protocol version 1) support in the server for new     # installations. In future the default will change to require explicit     # activation of protocol 1     Protocol 2          # HostKey for protocol version 1     #HostKey /etc/ssh/ssh_host_key     # HostKeys for protocol version 2     #HostKey /etc/ssh/ssh_host_rsa_key     #HostKey /etc/ssh/ssh_host_dsa_key     # Lifetime and size of ephemeral version 1 server key     #KeyRegenerationInterval 1h     #ServerKeyBits 1024          # Logging     # obsoletes QuietMode and FascistLogging     #SyslogFacility AUTH     SyslogFacility AUTHPRIV     #LogLevel INFO          # Authentication:          #LoginGraceTime 2m     #PermitRootLogin yes     #StrictModes yes     #MaxAuthTries 6     #MaxSessions 10          #RSAAuthentication yes     #PubkeyAuthentication yes     #AuthorizedKeysFile .ssh/authorized_keys     #AuthorizedKeysCommand none     #AuthorizedKeysCommandRunAs nobody          # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts     #RhostsRSAAuthentication no     # similar for protocol version 2     #HostbasedAuthentication no     # Change to yes if you don't trust ~/.ssh/known_hosts for     # RhostsRSAAuthentication and HostbasedAuthentication     #IgnoreUserKnownHosts no     # Don't read the user's ~/.rhosts and ~/.shosts files     #IgnoreRhosts yes          # To disable tunneled clear text passwords, change to no here!     #PasswordAuthentication yes     #PermitEmptyPasswords no     PasswordAuthentication yes          # Change to no to disable s/key passwords     #ChallengeResponseAuthentication yes     ChallengeResponseAuthentication no          # Kerberos options     #KerberosAuthentication no     #KerberosOrLocalPasswd yes     #KerberosTicketCleanup yes     #KerberosGetAFSToken no     #KerberosUseKuserok yes          # GSSAPI options     #GSSAPIAuthentication no     GSSAPIAuthentication yes     #GSSAPICleanupCredentials yes     GSSAPICleanupCredentials yes     #GSSAPIStrictAcceptorCheck yes     #GSSAPIKeyExchange no          # Set this to 'yes' to enable PAM authentication, account processing,      # and session processing. If this is enabled, PAM authentication will      # be allowed through the ChallengeResponseAuthentication and     # PasswordAuthentication.  Depending on your PAM configuration,     # PAM authentication via ChallengeResponseAuthentication may bypass     # the setting of "PermitRootLogin without-password".     # If you just want the PAM account and session checks to run without     # PAM authentication, then enable this but set PasswordAuthentication     # and ChallengeResponseAuthentication to 'no'.     #UsePAM no     UsePAM yes          # Accept locale-related environment variables     AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES     AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT     AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE     AcceptEnv XMODIFIERS          #AllowAgentForwarding yes     #AllowTcpForwarding yes     #GatewayPorts no     #X11Forwarding no     X11Forwarding yes     #X11DisplayOffset 10     #X11UseLocalhost yes     #PrintMotd yes     #PrintLastLog yes     #TCPKeepAlive yes     #UseLogin no     #UsePrivilegeSeparation yes     #PermitUserEnvironment no     #Compression delayed     #ClientAliveInterval 0     #ClientAliveCountMax 3     #ShowPatchLevel no     #UseDNS yes     #PidFile /var/run/sshd.pid     #MaxStartups 10:30:100     #PermitTunnel no     #ChrootDirectory none          # no default banner path     #Banner none          # override default of no subsystems     Subsystem   sftp    /usr/libexec/openssh/sftp-server          # Example of overriding settings on a per-user basis     #Match User anoncvs      #   X11Forwarding no     #   AllowTcpForwarding no     #   ForceCommand cvs server      I have copied `sshd_config` from another machine but still it is showing this error message. I have removed `sshd` service and install through yum again but to no avail. I have made clone of this machine from where I copied. I have been using this machine last four months after making clone but suddenly I got this error message.


title: Flash videos turn to gray box with light gradients on edges

text: As explained in the title .. it started happenning since installation of new openSUSE and it looks quite bizarre, see below for a shot from blip.tv. ![bizarre](http://i.stack.imgur.com/Dev3q.png) It happens usually after few minutes of watching a video, sometimes sooner, sometimes later. It happens also on Youtube. Any ideas? I would like to retain hardware acceleration so I do not accept solutions disabling it. To add more details about my setup. Laptop is a Thinkpad T420 with NVIDIA Quadro NVS 4200M, hooked up to double monitors via docking station.


title: echo a customized message with VIM editor

text: How can I deltect if there is a file modification in VIM upon exiting (`:q`)? If there is a file modification Vim echos               E37: No write since last change (add ! to override)       I want to override this message with a custom message and an action similar to               File modified: Do you wish to save the file? (y)Yes (n)No (c)Cancel      I have modified Vim's behavior to save file on `Ctrl-s` and quit on `Ctrl-w` Now I am looking for a solution if the file is already modified and user is quitting it with Ctrl-w I want Vim to prompt to save. Here is the content of my .vimrc file:               map <C-S> :w<CR>     imap <C-S> <Esc>:w<CR>i          map <C-w> :q<CR>     imap <C-w> <Esc>:q<CR>


title: mbcache documentation

text: I want to experiment with mbcache kernel module, but I'm having trouble finding the documentation for it. If I understood correctly, mbcache allows the use of a fast SSD disk to act as a transparent cache for much slower hard disks. Where can I find the documentation? I'm on Linux 3.0.0-17-generic #30-Ubuntu SMP x86_64


title: How do I determine whether my services are using runit or init?

text: How do I determine whether my services are using `runit` or `init`? I use Ubuntu 10.0.4. Such as nginx, chef, puppet, etc.


title: mutt: move IMAP folder

text: Can an IMAP folder be moved within `mutt`? If one navigates to the list of folders (`c?`), the default key bindings allow one to create a new mailbox (`C`), change mailbox/folder (`c`), delete a mailbox (`d`), or rename a mailbox (`r`). However, I don't know how to move an existing folder to another folder (thereby becoming a subfolder of the destination folder) or to move a subfolder up one or more levels in the directory structure (e.g., `mv folder ..`). How can these move operations be performed?


title: How to change keys for window manipulation (from menu, default: alt+space) in openbox?

text: I'd like to change default keys which manipulate window. For example default set is: maximize: x key but unmaximze: is e key I really want to have for example x key for maximize and unmaximze. How to change that? **update** I'd like to change letters binded to menu items, from 'alt + space' menu: So.. alt + space (menu shows), then menu items are:   * 'Send to desktop' binded with 's' letter   * Layer binded with 'l' letter   * Move binded with 'm' letter   * so on.. I'd like to change these letter, like: 's', 'l' and 'm'..


title: Permissions issues for shared directory on a server

text: The setup is we have a VPS running Debian Squeeze, and I've set up a shared directory for us to share files. So far I've followed this guide: http://www.cyberciti.biz/faq/linux-setup-shared-directory/ I've also set the umask to 002 correctly (see the comments on that guide), so we can both now create files and directories directly on the server and we both have read/write permissions on them. The only problem is that a lot of our files are created on our local machines (both running Ubuntu 10.10), and then dumped on the server. This results in only the creator of the file/directory having write permissions on, and the other member of the group I set up for sharing this folder only having read access. My next thought would be to change the default umask on our local machines, but it seems a bit extreme to have to do that, and I don't know if it's a security risk. Can someone tell me if there's a better solution to what I'm trying to achieve, or if this really is the way to go? Many thanks in advance


title: Detect if it's lilo boot loader or grub?

text: Without rebooting, is it possible to tell if the boot loader currently present was LILO. GRUB 0.97 or GRUB 1.9X? I was thinking about reading MBR, but not sure about it. Just by checking the files on system, i.e /etc/lilo.conf doesn't testify anything Any ideas?


title: Adding Text After Specific Line of File in Bash Script

text: I have a txt (`ip.txt`) file that contains IP addresess. I group them under TCP and UDP. File excerpt is below:               #TCP     162.298.38.930     162.298.38.931     162.298.38.932     #UDP     162.298.38.930     162.298.38.931     162.298.38.932      I have a specific IP (`162.298.38.929`) to add both by bash script into this ip.txt under TCP and UDP lines so it should like this.               #TCP     162.298.38.929     162.298.38.930     162.298.38.931     162.298.38.932     #UDP     162.298.38.929     162.298.38.930     162.298.38.931     162.298.38.932      How can I achieve this in bash script? Line number is not usable for my case because #TCP and #UDP line number can change because I add lots of comments into the file. Bash Script should search and add the IP both under TCP and UDP.


title: How can I create a /dev/null-like "blackhole" directory?

text: I would like to create a "`/dev/null`" directory (or a "blackhole" directory) such that any files written to it are not really written, but just disappear. I have an application that writes out large temporary files to a directory. I have no control over the name of the files and I don't really care about the content of these files. I could write a script that periodically clobbers these files, but the files are written out very quickly and fill my disk. I'm looking for something cleverer. I want the application to "think" that it is writing out these files, when in fact, the writes are just being discarded at the other end. Also see this old related thread.


title: multiple clients accessing one email account over IMAP

text: I am using `Postfix` + `Dovecot` + `IMAP` + `Maildir` and I am accessing my server from two different machines (desktop and Laptop), i.e. two clients (`Thunderbird`). The are sometimes running simultaneously, and sometimes only one or the other client is running. I have moved a message from from `Inbox` to `Archive` in one client, and then started the second client. In the second client, I see the message still in `Inbox`, and I see it in `Archive` as well. I have checked on my server (this is easy because I am using `Maildir`) and the message is no longer in the `Inbox`. It is in the `Archive`. So why does the second client show it bot in `Inbox` and `Archive`. Apparently, it has not realized, that the message has been moved while he was not running. Is there a problem with syncing? How can I make two clients accessing the same `IMAP` server behave orderly? I have been using `IMAP` through multiple clients before, although the server was `Exchange` (not under my control, so I have no idea how it was set up). This problem did not exist. Is there some setting in `Dovecot` ?


title: Busybox compilation fails - networking/nslookup.c Error

text: I'm trying to compile Busybox with Buildroot Cross-Compiler. Here are the steps:   * Download Busybox and untar it **wgethttp://www.busybox.net/downloads/busybox-1.22.1.tar.bz2 && tar xjf busybox-1.22.1.tar.bz2**   * Configure BusyBox and compile **make menuconfig** **make CROSS_COMPILE=/usr/local/cross-rpi/usr/bin/arm-linux-** (The path to the Cross-Compiler is correct) The compilation returns the following error:               CC      networking/nslookup.o     networking/nslookup.c: In function ‘server_print’:     networking/nslookup.c:123:37: error: ‘struct <anonymous>’ has no member named ‘nsaddrs’     networking/nslookup.c: In function ‘set_default_dns’:     networking/nslookup.c:163:15: error: ‘struct <anonymous>’ has no member named ‘nsaddrs’     make[1]: *** [networking/nslookup.o] Error 1     make: *** [networking] Error 2      If I don't use the Cross-Compiler everything builds fine. Do you have any advice?


title: When opening a terminal, I can't type without clicking it first

text: In Xfce4 with CentOS 6, when I double click on the terminal icon to open the terminal, I can't start typing in it unless I click in the terminal once. It's as if the window is not selected or something. How can this be fixed? Which setting influences this behaviour?


title: What does the "number" in the owner field of files signify in linux?

text: I copied many files to my new linux host. I see that all files have the owner and group both set to `515`. What does that mean?


title: Should all plain text files have some sort of suffix (e.g. *.txt, *.conf)

text: I create many notes in plain text files, but after a while the `.txt` suffix I put at the end of them seems to be unnecessary typing and visual noise. Is appending `.txt` to plain text files a strongly encouraged convention or just a suggestion?


title: Updating PHP to Gaurd Against Mayhem Malware

text: How will making sure my PHP version is updated thwart the Mayhem Malware? Will updating PHP on my Ubuntu server prevent the Mayhem Malware from being able to make it onto the server, prevent it from running, or something else? Is there anything else I can do to safeguard against it? Edit: This is the most informational article I've found which describes Mayhem: https://www.virusbtn.com/virusbulletin/archive/2014/07/vb201407-Mayhem


title: transfer a file to remote dir only if doesn't exist without replacing

text: I'm using CentOS linux. In one line cmd, that returns 0 if success, non-0 if failure, I need: >   1. Transfer a file to a remote server. >   2. Don't transfer the file if filename exists in remote server (return > non-0) > I thought about using `rsync`, but it returns 0 if the filename exists. `scp` replaces the existing file, so it doesn't help me either. **A twist** : The user that performs this command is **not** root, the files are owned by this user. The destination is owned by same user. There is an `ssh` trust for root. But not for this user. Can't be prompted for password, because this command is part of an automatic script. Preliminary configuration steps are possible. I can add them as a one time configuration. Can anyone help?


title: Escaping argument in bash script?

text: I'm writing a bash script wherein I want to check that one of the arguments passed to it is a valid group. I have the line               if [ `grep -c -e '\b$2\b' /etc/group` -eq 0 ]; then       echo "Error: $2 is not a valid group."     else      Which always tells me that valid groups aren't valid. I think it's an escaping problem; I think it's grepping for a group called `$2`. The error message properly shows the passed argument. However I'm not sure if I'm escaping `$2` within the backticks properly. How do I get this line working?


title: Unset Read Only Variables

text: Is it possible to unset or change a `readonly` variable in Korn Shell? I am using AIX 5.


title: How to force a Bash word to reference an alias, function, file, etc?

text: When trying to add a bit more detail to a related question, I realized I don't know how to specify which one of the available Bash word types to execute. According to `help type` there are five word types:   * alias   * keyword   * function   * builtin   * file It's possible for a word to have several types (`true` is just an example; a more commonly overridden word would be `cd`):               $ type -a true     true is a shell builtin     true is /bin/true      **How do you force the execution of a specific synonym?** So far, in order of precedence:   * alias: This is a special case since it has precedence over all the other synonyms. Forcing this would only be useful when the command should fail if the alias is not defined.              $         * keyword:              $         * function:              $         * builtin:              $ builtin true        * file:              $ command true     $ $(which true)     $ /bin/true      Partial solutions:   * Quoting a word excludes aliases and keywords. That is,              $ 'true'      will run only the function, builtin or file.


title: When was a process started

text: To know when was a process started, my first guess was to check the time when `/proc/<pid>/cmdline` was written/modified the last time. `ps` also shows a `START` field. I thought both of these sources would be the same. Sometimes they are not the same. How could that be?


title: Find files given an exact filename with mdfind

text: Is there a way to ask `mdfind` to search for filenames with an exact filename ? At some point in a pipe I have this:               (filenames are produced here) | while read f; do mdfind -name "$f" | grep -E "/$f";      I have two problems:   * if the filename contains a `+`: `grep: repetition-operator operand invalid`   * if the filename contains a parenthesis, the result is empty. How can I fix this ?


title: Sending cron output to email?

text: I'm trying to send cron output to an email address and am struggling... I'm running the following command:               13 15 * * 1-5 root /path/to/mysql-backup.sh 2>&1 | mail -s "Daily Database Backup Report" my.email@emailhost.com      That shows this error within `/var/mail/root`               /usr/bin/mail: line 1: syntax error near unexpected token `('     /usr/bin/mail: line 1: `Config file not found (-s)'      Is this trying to validate/execute the output of the cron? Do you do this on your server? If so, how?


title: How do I force the user to become root

text: I have written a bash script for use on my ubuntu box. Now I would like to prevent running this script under my own user and only able to run it as root (sudo). Is there a possibility to force this. Can I somehow let my script ask for root permissions if I run it under my own username?


title: How to monitor top applications using CPU (and IO if possible) in a graph?

text: I need to find what and when these applications used so much CPU (and IO if possible too). This should be in a graphic timeline like we see in GNOME System Monitor CPU History. I also want to compare that graphic with the Psensor temperature monitor too. I found answers for single process where you already know the PID, but I am looking for that information whenever the applications are top-using CPU or IO, which can be any pid any time, on the last 1 hour. I wonder if there is some application that can do it.


title: multiple conversion bam to bed using bedtools

text: I have ten .bam files (bioinformatic format) and I would like to convert it to 10 .bed files, but for this conversion I need to use special command               bedtools bamTobed -i (input file) > output file.bed


title: How to set a default/primary graphics card

text: I have the following graphics card on my laptop: Intel HD intergrated graphics HD Radeon 6000m series Currently I think the Intel one is being used but is there a way in linux to set it so that the radeon one is the one always being used or being able to switch them? there used to be a program for that in windows 7


title: Why the order of wildcard results might be different when used from the terminal or from perl?

text: There's a folder with a bunch of files and a perl scrip that lists them using ls with a wildcard like:               #!/usr/bin/perl     system("ls -U -1 dir/*");      I noticed that if I run exactly the same command from my bash terminal, I'll get the same results but they are in a different order. Why might this be? Is the wildcard handled differently in both contexts? Example:               mkdir dir     touch dir/a_0 dir/a1_0      terminal output:               dir/a_0     dir/a1_0      perl output:               dir/a1_0     dir/a_0


title: Is crontab multithread?

text: I don't know where I can find more information about crontab, so I ask here. Crontab is it multithread? How does it work?


title: Linux USB Driver Compilation

text: I'm using Linux Mint 15. When I try to compile the EXAR UART driver file version for kernel v3.5.0 and later provided here: http://www.exar.com/connectivity/uart-and-bridging-solutions/usb- uarts/xr21v1410 I get the following error:               v@lenovo-linux ~/Downloads/xr21v141x-lnx-3.5-pak $ sudo make     make -C /lib/modules/3.8.0-19-generic/build M=/home/v/Downloads/xr21v141x-lnx-3.5-pak     make[1]: Entering directory `/usr/src/linux-headers-3.8.0-19-generic'       LD      /home/v/Downloads/xr21v141x-lnx-3.5-pak/built-in.o       CC [M]  /home/v/Downloads/xr21v141x-lnx-3.5-pak/vizzini.o     /home/v/Downloads/xr21v141x-lnx-3.5-pak/vizzini.c: In function ‘xr21v141x_tty_set_termios’:     /home/v/Downloads/xr21v141x-lnx-3.5-pak/vizzini.c:1104:22: error: invalid type argument of ‘->’ (have ‘struct ktermios’)     make[2]: *** [/home/v/Downloads/xr21v141x-lnx-3.5-pak/vizzini.o] Error 1     make[1]: *** [_module_/home/v/Downloads/xr21v141x-lnx-3.5-pak] Error 2     make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-19-generic'     make: *** [all] Error 2      How can I resolve this error?


title: Where to put swap space, at beginning or end and other swap questions

text: Where do I put my swap? Debian installation gives 2 choices: (1) at the end or (2) at the beginning of the disk space. What is optimal? What is the optimal amount of swap given my computer has 512Mb RAM? Should I have more than one swap? Should I define swap space as a logical or primary partition? I'm installing Debian 6 testing 32bit on a 40Gb disk.


title: What makes systemd-nspawn still "unsuitable for secure container setups"?

text: This is stated in the man page for systemd-nspawn > Note that even though these security precautions are taken systemd-nspawn is > not suitable for secure container setups. Many of the security features may > be circumvented and are hence primarily useful to avoid accidental changes > to the host system from the container. The intended use of this program is > debugging and testing as well as building of packages, distributions and > software involved with boot and systems management. This very question was subsequently asked on the mailing list in 2011, but the answer seems to be outdated. systemd-nspawn contains code to execute `CLONE_NEWNET` using the `\--private- network` option now. This seems to cover the private `AF_UNIX` namespace issue, and I guess the `CAP_NET_RAW` and `CAP_NET_BIND` issues mentioned. What issues remain at this point and what does for example LXC do in addition to what `systemd-nspawn` can currently do?


title: How do I make a file NOT modifiable?

text: While logged in, I can do the following:               mkdir foo     touch foo/bar     chmod 400 foo/bar      chmod 500 foo      Then I can open vim (not as `root`), edit `bar`, force a write with `w!`, and the file is modified! How can I make the operating system disallow any file modification?


title: Determine monthly internet transfer to detect right FUP

text: I live in a country where many ISP (internet service providers) have FUP (fair use policy, limit on amount of data transferred). I need to get a new connection and I would like to measure how much data I transfer now, in order to determine how large (and how expensive) tariff I do need. I'm looking for a utility that would log e.g. my hourly upstream and downstream values, so that I know how much data I transfer doing various activities. System: Fedora 12


title: Recursively Move All MP3's in a Directory

text: I have a lot of mp3 files located at various levels of subdirectories inside a single folder and I want to move them all to a single directory, what command could I use to do this? Thanks!


title: FreeBSD 9,1 - upowerd's cpu consumption off the roof and causes OS to restart

text: I've been experiencing a really annoying problem with a FreeBSD setup on my laptop. The setup is as follows: FreeBSD 9.1 / KDE4 desktop / Broadcom wireless 4313 through NDIS / Intel GPU with the new KMS driver. The problem occurs some time after turning on the laptop, the desktop becomes sluggish. When checking the processes, upowerd is taking 100% cpu and cannot be killed. And either I reboot the system or it ends up rebooting on its own. And lately, such reboots are affecting the filesystem: I had to boot on live system and repair the damaged partitions. Any pointers to what might cause this or how to prevent it ?


title: How do I copy a file with scp with special characters?

text: I am trying to copy a file that has colons and periods, e.g., with:               scp "test.json-2014-08-07T11:17:58.662378" remote:tmp/          scp test.json-2014-08-07T11\:17\:58.662378 remote:tmp/      and combinations with file:               scp "file:///home/.../test.json-2014-08-07T11:17:58.662378" remote:tmp/      My guess is that scp tries to interprete parts of the file as a server and/or port number. How do I avoid that? If I rename the file to test.json then `scp test.json remote:tmp/` works ok, but not even `scp test*62378 remote:tmp/`works.


title: update ss utility on centos

text: My centos version is: > 2.6.32-131.17.1.el6.x86_64 #1 SMP Thu Oct 6 19:24:09 BST 2011 x86_64 x86_64 > x86_64 GNU/Linux And my `ss` version:               ss --version     ss utility, iproute2-ss091226      I need to update to version that I have on my Ubuntu machine :               ss --version     ss utility, iproute2-ss131122      How can I update the version (tried `yum install ss`)?


title: Get Return value of sub shell script

text: I have a shell script, where i start a new .sh script. Now I want to save the return value of the sub script in a variable. I found this script:               #!/bin/bash     r=1     while [[ r -ne 0 ]]     do     r=`vx $* < \`tty\` > \`tty\``     done     exit 0      It calls the Script vx with a param and saves the return value in the variable r. What does the tty ... mean? Is that the return value? Can't I use $? for return value? Thanks! Edit: So would be the following wrong?               #!/bin/bash          returnvalue=1          while  [ $returnvalue -ne 0 ]     do         bash ./vx $1         returnvalue=$?     done


title: How do I disable wireless on Mint 14?

text: This got closed on AskUbuntu because it wasn't Ubuntu enough for them. I don't have any WLAN connections set up, and I always connect via Ethernet cable. However my computer has a small light on it that flashes to indicate network activity. For some reason this light keeps flashing, at extended random intervals, which is very annoying. I remember that I disabled it somehow on my old partition (Ubuntu, Mate), but I'm not seeing an option for it now. Added: since asking I found an answer to the LED problem here: "Wireless indicator light flashing for activity on laptop keyboard" but I would feel slightly better knowing that I solved the source of the problem and not just the symptom. Then I tried `sudo rfkill block all`. Will that solve it permanently? Is there a better way?


title: Crontab + Ruby on Rails: /usr/bin/env: ruby: No such file or directory

text: I have a ruby on rails app and I need to schedule a crontab for a rake task.               */5 * * * * RAILS_ENV=production /usr/local/bin/rake -f /usr/local/www/mysite-web-production/current/Rakefile my_site:export_products >> /var/log/export_feed.log 3>&1      However, it's not working (it works when I do it manually, but not as a crontab) and it's showing me `/usr/bin/env: ruby: No such file or directory`. I'm not using RVM. I'm using ruby 1.9.3 and rails 3 on Linux.


title: How to use the sed command to only show the first column and last column in a text file

text: I need some help to figure out how to use the sed command to only show the first column and last column in a text file. Here is what I have so far for column 1:               cat logfile | sed 's/\|/ /'|awk '{print $1}'      My feeble attempt at getting the last column to show as well was:               cat logfile | sed 's/\|/ /'|awk '{print $1}{print $8}'      However this takes the first column and last column and merges them together in one list. Is there a way to print the first column and last columns clearly with sed and awk commands?


title: Transform an array into arguments of a command?

text: I have an array of "options" of a command.               my_array=(option1 option2 option3)      I want to call this command in a bash script, using the values from array as options. So, `command $(some magic here with my_array) "$1"` becomes:               command -option1 -option2 -option3 "$1"      How can I do it? Is it possible?


title: Giving a custom script root permissions

text: I have a backup drive that is Truecrypt Encrypted. I'd like to automnt this drive so I can automate backups when in the office. I am using Linux Mint 12 x64bit I wrote a script that runs successfully with Sudo to mount the encrypted drive. However, I can not get the drive to mount automatically... I tried entering the script into rc.local, but that doesn't work. So I tried editing the sudoers file (thinking I could enter this script into the startup applications area for Mint):               username ALL= NOPASSWD: /usr/local/bin/bakmnt.sh      *username is replaced with my real my username in the sudoers file Still, when I try to run the script without sudo, I get:               Error: Failed to obtain administrator privileges.      I'm out of ideas, googling around seems to be an issue with Truecrypt..but I still come up empty for a solution. Any thoughts out there? thanks for reading!!


title: File missing after fsck

text: Recently, my HDD crashed and I had to run a `fsck` command. Many files were moved to the `lost+found` folder and I've retrieved the important ones using `find` and `grep`, but I can't find my SQL databases. ### Questions   * How can I find InnoDB databases in my lost+found directory ?   * Is that possible that fsck hasn't saved my SQL database ?   * If yes can I recover this file?


title: newsyslog for paths with empty spaces

text: How can I configure newsyslog to trim logs with paths containing empty spaces? I define my paths at /etc/newsyslog.d/frank.conf like this:               "/Users/frank/Library/Application Support/Google/Drive/*.log"    644  0     5120 *    GN      I also tried this:               /Users/frank/Library/Application\ Support/Google/Drive/*.log    644  0     5120 *    GN      However I always get the error:               newsyslog: error in config file; unknown user:      So far I can solve the problem by using a static link with no empty spaces, but I really would like a solution without that hack


title: Convert ascii code to hexadecimal in UNIX shell script

text: I'd like to convert ASCII code (like `-` or `_` or `.`, etc.) to hexadecimal representation in the Unix shell (without `bc` command), eg : `-` => `%2d`. Any ideas?


title: How to Re-Create Missing Vim Directory?

text: The `/etc/vim` directory and the symlinks from `/usr/share/vim` to it are missing. Does anyone know how to re-create the directory and links?


title: How can we remove duplicate line without sorting?

text: I want to remove duplicate lines without sorting lines. Also I want to ignore leading white space. cat test.txt                abc             def          pqr                abc                      xyz                       def               efg      then output should be,               abc          def          pqr          xyz          efg


title: Changing terminal emulators

text: I have ssh access to a remote machine. In this machine if I run `echo $TERM` I get `xterm`. If I want to change my terminal emulator to some other emulator (assuming that it's installed on the remote machine), how would I do it?


title: Checking how many colors my terminal emulator supports

text: Is there a reliable way to check how many colors my terminal emulator supports? If `echo $TERM` prints `xterm`, does that **unequivocally** tell me how many colors my terminal emulator supports? How could I check this information reliably?


title: Support for usb 3.0?

text: I could not seem to find the question here but I was wondering what experience if any users have had with USB 3.0? My asus p5x58d has usb 3 on it but I have yet to try it out and also do not know much in terms of support. I feel this is best as a community wiki where we can share experience on USB 3.0. This article discussed briefly linux and usb 3. Let the comments flow...


title: Disable processor speed changes on AC vs battery

text: My Toshiba Satellite L300 laptop freezes when I plug in the AC power cord. The problem is, whenever the processor goes in power management or downclocks, the system freezes and shows colorful horizontal or vertical lines. This happens both under Windows and under Linux. I fix this problem in Windows 7 by going into Safe Mode then Control Panel > Device Manager > Processors and disable both processor drivers. What I am disabling is the processor driver actually thus preventing the processor from going into C or P states. I want to try Ubuntu. How can I disable the clock changes that cause the crashes when I plug in the AC power cord?


title: Authenticating To Multiple LDAP Servers

text: Owing to a corporate strategy I am moving human user authentication from an implementation of LDAP locally to a centralized Active Directory domain. The problem is that we have a tightly constrained sudoers setup within LDAP. Our Windows admins are unable to mirror this setup without considerable work and possibly not even completely if the time is devoted. An idea that was posed was this: Authenticate to Active Directory but maintain sudoers management within our existing LDAP infrastructure. The question then is it possible to either authenticate using an alternate method/server for AD so I can have LDAP for sudoers and something alternative for passwd in /etc/nsswitch.conf? Due to scale, maintaining local /etc/sudoers files for each guest would be administratively prohibitive and a step back in terms of architecture and scalability.


title: I am the only person with access to my machine. Any reasons to enable group/other permissions on files and directories?

text: I have noticed that some files in my home directory have read and write permissions for `group` and even `other`. If I am the **only person** who I want to give access to my machine, is there any reason to enable `group` or `other` permissions for files or directories?


title: How can I receive top-like CPU statistics from the shell?

text: I'm trying to get an accurate read of my used CPU (in percent) from `top`. This is the command I'm running for testing:               top -n1 | awk '/Cpu\(s\):/ {print $2}'      This returns:               10.7%us,      Which is the proper piece of data I want. However, every time I run the command I get the same output, even though I am applying different loads on my system (and not to mention `htop` tells me my usage is different). It seems that whenever I start `top`, my CPU usage is the same. Only after a couple of frames does it give me proper values. It doesn't seem like I can parse top's output this way, so I'm looking for other reliable applications which will give me an accurate reading from the shell. I really like how `htop` can give me a per-core reading. I've tried `iostat` and `mpstat` but they seem to give inaccurate and "slow to change" values.


title: replace a pattern found with a number plus 1 on the same line

text: I have a file where each line contains a keyword (`HELLO`) and one or more numerical fields designated `A1`, `A2`, etc. The value in the numerical field is enclosed in brackets after the field name and is optional; if not present, it defaults to 0. Each field can contain multiple numbers separated by `:`; I only care about the first. I need to replace the keyword (`HELLO`) with `A1[X-Y+1]. Here is a quick example:               case1: my test is (HELLO) with some numbers (A1, A2, A3, A4)     case2: my test is (HELLO) with some numbers (A1[X:Y], A2, A3, A4)     case3: replaceit(something(HELLO)) sometext (single_bit_here, somedatahere[4], something, something,something,something) ;      In the first one, the field `A1` isn't given a value, so 0 is assumed. 0+1=1, so the output is 1. In the second case, `A1` has a range X:Y, so the result is X-Y+1. Let's have X=10 and Y=3. Then "HELLO" will become 10-3+1=8. Output:               case1: my test is (1) with some numbers (A1, A2, A3, A4)     case2: my test is (X-Y+1) with some numbers (A1[X:Y], A2, A3, A4)     case3: replaceit(something(1)) sometext (single_bit_here, somedatahere[4], something, something,something,something) ;      The code was modified a bit and it worked for all situations. awk 'BEGIN {FS="[[\]]"} { nFields=split($2,a,":") if(nFields ==2) n=1+a[1]-a[2] else n=1 gsub("data_width", n) } 1' the following on question: I need to do the same "inline" replacement for all files in the same dir so I don't need to save back files. I'd like to use the perl script suggested below.


title: Upgrade to Debian testing shows only white noise

text: I've installed Debian on my desktop, but now all I can see is white noise on my screen.   1. started with a squeeze netinstall   2. updated my `/etc/apt/sources.list` from:              # deb http://ftp.belnet.be/debian/ squeeze main          deb http://ftp.belnet.be/debian/ squeeze main     deb-src http://ftp.belnet.be/debian/ squeeze main          deb http://security.debian.org/ squeeze/updates main     deb-src http://security.debian.org/ squeeze/updates main          # squeeze-updates, previously known as 'volatile'     deb http://ftp.belnet.be/debian/ squeeze-updates main     deb-src http://ftp.belnet.be/debian/ squeeze-updates main      to:              deb http://ftp.belnet.be/debian/ wheezy main contrib non-free     deb-src http://ftp.belnet.be/debian/ wheezy main contrib non-free          deb http://security.debian.org/ wheezy/updates main contrib non-free     deb-src http://security.debian.org/ wheezy/updates main contrib non-free        3. Run:              aptitude update     aptitude install apt dpkg aptitude     aptitude full-upgrade      The only thing that stood out during the upgrade was the warning that firmware for `r8169` was no longer installed. During the boot I can see normal text, but - before I need to type my password - my screen only shows white noise. **Edit:**   * The `/home` directory is coming from a Ubuntu (11.04 upgraded to 11.10).   * I haven't installed X yet. On my first install run (this is currently the third), I tried installing X to "fix" the problem, but that resulted in the same thing (although there was a different noise block for my mouse that I could move around).   * Copied the syslog to gist-8929da15


title: How to start AbiWord with full screen?

text: 2.8.2-2ubuntu1.1 How can I set Abiword to always start with full screen?


title: LVM issue with VM - Physical disk not present

text: Am trying to troubleshoot an issue that has arisen during a DR test and admit from the outset that LVMs are not my forte. We have a RHEL6 VM running on ESXi 5.1. We are using a LUN to LUN replication to allow us to use a system called SRM to recover our VMs. There is a 3TB Logical Volume on the VM with each "physical disk" having its own hard disk and LUN created. The test recovery process takes a snapshot of the LUNs at the recovery site allowing tests to be made etc and then any changes are dumped. All other VMs have been brought up correctly but this VM is not playing ball. The error I am receiving is:               Couldn't find device with uuid B91AAR-........     Couldn't find device with uuid zcRrvn-........      This means the LVM is missing two physical volumes so will not mount. Running "fdisk -l" I can see the two devices /dev/sdb/ and /dev/sdc/ but their is not /dev/sdb1 or /dev/sdc1. I initially thought that this meant the partition info had been trashed but running the same command on its live counterpart yielded the same result (sdb and sdc do not have a partition that fdisk is aware of). Form my understanding this is not a requirement for LVMs, though is not considered best practice for sanitys sake. I have tried to recreate the physical disk using a restorefile and pvcreate but that states it still cannot find the physical disk. I am a bit stumped as to what to try next to try and get this working and would be grateful of any guidance someone could throw my way. EDIT: fstab:               [root@proddossvm ~]# more /etc/fstab     /dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1     LABEL=/boot             /boot                   ext3    defaults        1 2     tmpfs                   /dev/shm                tmpfs   defaults        0 0     devpts                  /dev/pts                devpts  gid=5,mode=620  0 0     sysfs                   /sys                    sysfs   defaults        0 0     proc                    /proc                   proc    defaults        0 0     /dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0     /dev/VolGroup01/LogVol00 /PRODDOSS              ext3    defaults        0 0


title: How to change the properties of a desktop panel from the command line?

text: I use RHEL 6 as my regular operating system and for one of my user accounts I made one of the desktop panels as auto-hide and other as a fixed panel. I expected the hidden panel to appear above the fixed panel but was surprised to see a clash of both the panels in the same space (bottom). This has caused me to not get the session at all as the clash between the panels does not stop. However, if I could somhow use the terminal from another user account to change the properties of one of the desktop panels, it would solve the problem.


title: Strange errors when using ffmpeg in a loop

text: I have a bash script looping through the results of a find and performing an ffmpeg encoding of some FLV files. Whilst the script is running the ffmpeg output seems to be interupted and is outputting some strange looking errors like the one below. I've no idea what is going on here. Can anyone point me in the right direction? It's as though the loop is still running when it shouldn't be and interupting the ffmpeg process. The specific error is:               frame=   68 fps= 67 q=28.0 00000000000000000000000000001000size=      22kB time=00:00:00.50 bitrate= 363.2kbits/s dup=1 drop=0         Enter command: <target> <time> <command>[ <argument>]     Parse error, at least 3 arguments were expected, only 1 given in string 'om/pt_br/nx/R3T4N2_HD3D_demoCheckedOut.flv'      Some more details from the ffmpeg output:               [buffer @ 0xa30e1e0] w:800 h:600 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:flags=2     [libx264 @ 0xa333240] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64     [libx264 @ 0xa333240] profile High, level 3.1     [libx264 @ 0xa333240] 264 - core 122 r2184 5c85e0a - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=cbr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=500 vbv_bufsize=1000 nal_hrd=none ip_ratio=1.40 aq=1:1.00     Output #0, mp4, to './mp4s/pt_br/teamcenter/tc8_interactive/videos/8_SRM_EN.mp4':       Metadata:         audiodelay      : 0         canSeekToEnd    : true         encoder         : Lavf54.3.100         Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 800x600, q=-1--1, 500 kb/s, 30k tbn, 29.97 tbc         Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 44100 Hz, mono, s16, 128 kb/s     Stream mapping:       Stream #0:1 -> #0:0 (vp6f -> libx264)       Stream #0:0 -> #0:1 (mp3 -> libfaac)     Press [q] to stop, [?] for help     error parsing debug value0 00000000000000000000000000000000size=      13kB time=00:00:00.-3 bitrate=-3165.5kbits/s dup=1 drop=0         debug=0     frame=   68 fps= 67 q=28.0 00000000000000000000000000001000size=      22kB time=00:00:00.50 bitrate= 363.2kbits/s dup=1 drop=0         Enter command: <target> <time> <command>[ <argument>]     Parse error, at least 3 arguments were expected, only 1 given in string 'om/pt_br/nx/R3T4N2_HD3D_demoCheckedOut.flv'      The script is as follows               #!/bin/bash     LOGFILE=encodemp4ize.log     echo '' > $LOGFILE     STARTTIME=date     echo "Started at `$STARTTIME`" >> $LOGFILE     rsync -avz flvs/ mp4s/ --exclude '*.flv'     #find flvs/ -name "*.flv" > flv-files     # The loop     find flvs/ -name "*.flv" | while read f     do     FILENAME=`echo $f | sed 's#flvs/##'`     MP4FILENAME=`echo $FILENAME | sed 's#.flv#.mp4#'`     ffmpeg -i "$f" -vcodec libx264 -vprofile high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -threads 0 -acodec libfaac -ab 128k "./mp4s/$MP4FILENAME"     echo "$f MP4 done" >> $LOGFILE     done


title: How to check if pipe is empty

text: I have piped line in bash script and want to check if pipe has data, before feeding program Searching I found about `test -t 0` but it doesn't work here. Always returns false. So how to be sure that pipe has data? * * * I'm providing example: `echo "string" | [ -t 0 ] && echo "empty" || echo "fill"`   output: `fill` `echo "string" | tail -n+2 | [ -t 0 ] && echo "empty" || echo "fill"`   output: `fill`


title: Black screen when starting X

text: I have two systems. The only real difference between them is that one is OpenSUSE 12.2, and the other is OpenSUSE 13.1. Oh yeah, and that the 12.2 box _works_ , while the 13.1 one doesn't. Basically, when I start X, I get a black screen. The other VTs still work just fine, but X doesn't. The most bizarre thing is that all the logs _seem_ to indicate that X is functioning just fine. (!) The only error message I can find is this:               xdm[524]: Starting service gdm..done     xdm[524]: Failed to give slave programs access to the display. Trying to proceed.     xdm[524]: can't open /etc/X11/Xresources     xdm[524]: /usr/bin/xrdb: No such file or directory     xdm[524]: /usr/bin/xrdb: can't open file '/etc/X11/Xresources'      (This appears near the end of `/var/log/messages`.) On the working system, the _first_ message appears, but none of the following ones. The file `/etc/X11/Xresources` does not exist on either of the two systems. Yet one works, and the other doesn't. Is this error message the source of my troubles, or is this a red herring? Any ideas what I might have done wrong here?


title: Remote SSH login not working

text: I have a PC behind a router with port forwarding setup Port 22 for SSH which works perfectly - I can login and everything. What I am trying to do is let this PC connect to a VPN and only allow traffic on local network or via the VPN connection (for internet access). This is also working great. As soon as the VPN connection is broken, the PC has no connection to internet. Now I am doing this with IPTABLES, the problem is that I can not seem to get incoming SSH to work from external sources via the router port forwarding. I am thou able to SSH to the pc from within the local network. Here is what I have tried:               # Allow traffic to VPN SERVER     sudo iptables -A INPUT -s $REMOTE_IP -j ACCEPT          # Allow ssh traffic     iptables -A INPUT -i eth1 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT         iptables -A OUTPUT -o eth1 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT          # Allow local traffic.     sudo iptables -A INPUT -s 10.0.0.0/8 -j ACCEPT     sudo iptables -A INPUT -s 172.16.0.0/12 -j ACCEPT     sudo iptables -A INPUT -s 192.168.0.0/16 -j ACCEPT          # Disallow everything else.     sudo iptables -A INPUT ! -i tun+ -j DROP          # Allow traffic from VPN SERVER.     sudo iptables -A OUTPUT -d $REMOTE_IP -j ACCEPT          # Allow local traffic.     sudo iptables -A OUTPUT -d 10.0.0.0/8 -j ACCEPT     sudo iptables -A OUTPUT -d 172.16.0.0/12 -j ACCEPT     sudo iptables -A OUTPUT -d 192.168.0.0/16 -j ACCEPT          # Disallow everything else.     sudo iptables -A OUTPUT ! -o tun+ -j DROP          sudo openvpn --config client.cfg --auth-user-pass client.cred --daemon      Here is my iptables -vL -n output: (Replaced the vpn server with XX.XX.XX.XX)               Chain INPUT (policy ACCEPT 25674 packets, 4792K bytes)      pkts bytes target     prot opt in     out     source               destination              78848   11M ACCEPT     all  --  *      *       XXX.XXX.XXX.XXX      0.0.0.0/0                 3176  318K ACCEPT     tcp  --  eth1   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22 state NEW,ESTABLISHED          0     0 ACCEPT     all  --  *      *       10.0.0.0/8           0.0.0.0/0                    0     0 ACCEPT     all  --  *      *       172.16.0.0/12        0.0.0.0/0                 2517  231K ACCEPT     all  --  *      *       192.168.0.0/16       0.0.0.0/0                   35 12374 DROP       all  --  !tun+  *       0.0.0.0/0            0.0.0.0/0                     Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain OUTPUT (policy ACCEPT 32187 packets, 4374K bytes)      pkts bytes target     prot opt in     out     source               destination               3681 2443K ACCEPT     tcp  --  *      eth1    0.0.0.0/0            0.0.0.0/0           tcp spt:22 state ESTABLISHED      70697   10M ACCEPT     all  --  *      *       0.0.0.0/0            XXX.XXX.XXX.XXX               0     0 ACCEPT     all  --  *      *       0.0.0.0/0            10.0.0.0/8                   0     0 ACCEPT     all  --  *      *       0.0.0.0/0            172.16.0.0/12               27  5787 ACCEPT     all  --  *      *       0.0.0.0/0            192.168.0.0/16            2265  150K DROP       all  --  *      !tun+   0.0.0.0/0            0.0.0.0/0      And yes if I do a ifconfig I only have a eth1 and not a eth0 so it is not that. Here is also the output of netstat -rn               Kernel IP routing table     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     0.0.0.0         XX.XXX.242.128  128.0.0.0       UG        0 0          0 tun0     0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth1     XX.XXX.193.107  192.168.1.1     255.255.255.255 UGH       0 0          0 eth1     XX.XXX.242.0    0.0.0.0         255.255.255.0   U         0 0          0 tun0     128.0.0.0       XX.XXX.242.128  128.0.0.0       UG        0 0          0 tun0     192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1


title: Get Node value from a XML using xmllint

text: I have a xml called Det.xml like this :               <?xml version="1.0" encoding="UTF-8"?>         <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">             <S:Body>                 <ns4:grtHgetRed xmlns:ns2="http://object" xmlns:ns3="http://object" xmlns:ns4="http://object">                     <RequestId>lol</RequestId>                     <MessageDateTime>54.009</MessageDateTime>                     <SenderId>UH</SenderId>                     <ReceiverId>GER</ReceiverId>                     <TrackingNumber>45</TrackingNumber>                     <ServerName>trewds</ServerName>                     <ResponseType>success</ResponseType>                     <StatusInfo>                     <Status>success</Status>                     <SystemMessage>Hagert</SystemMessage>                     <UserMessage>Hgert</UserMessage>                     <Origination>htref</Origination>                     </StatusInfo>                 </ns4:grtHgetRed>             </S:Body>         </S:Envelope>      I am trying to get the `ResponseType` node value `success` from it using `xmllint` in Unix shell script and so i tried the following :               echo "cat //*[local-name()='S:Envelope'/*[local-name()='S:Body']/*[local-name()='ns4:grtHgetRed']/*[local-name()='ResponseType']" | xmllint --shell Det     .xml | sed '/^\/ >/d' | sed 's/<[^>]*.//g'      But it's not working . Also i don't have `xpath` in my unix environment . Can any one tell me what am i doing wrong here ? I also tried using `statusMSG=="$(echo "cat /Envelope/Body/grtHgetRed/ResponseType/text()" | xmllint --nocdata --shell response.xml | sed '1d;$d')"`, then `echo "$statusMSG"`, but this gives an empty echo. Is this because of namespace problem ?


title: Build kernel in one machine, install in another

text: I want to build my Linux kernel on my host and use it in my VWware virtual machine. They both use the same Ubuntu kernel now. On my Host, I do `make` and `make configure`. Then, what files should I copy to the target machine, before I do `make modules_install` and `make install`? What other things do I need to do?


title: Measuring disk I/O usage of a program

text: `time` is a brilliant command if you want to figure out how much CPU time a given command takes. I am looking for something similar that can measure the disk I/O of the program and any children. Preferably it should distinguish between I/O that was cached (and thus did not cause the disk to spin) and I/O that was not cached. So I would like to do:               iomeassure my_program my_args      and get output similar to:               Cached read: 10233303 Bytes     Cached write: 33303 Bytes  # This was probably a tmp file that was erased before making it to the disk     Non-cached read: 200002020 Bytes     Non-cached write: 202020 Bytes      I have looked at `vmstat`, `iostat`, and `sar`, but none of these are looking at a single process. Instead they look at the whole system. I have looked at `iotop`, but that only gives me a view this instant. --- edit --- snap's answer seems close. 'File system inputs:' is the non-cached reads in 512-byte blocks. 'File system outputs:' is the cached writes in 512-byte blocks. You can force the cache empty with:               sync ; echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null      I tested with:                seq 10000000 > seq      /usr/bin/time -v bash -c 'perl -e "open(G,\">f\"); print G <>;close G; unlink \"f\";" seq'


title: Enable systemd-baclight@intel_backlight instead of systemd-backlight@acpi_video0

text: I have 2 files in `/sys/class/backlight/` - `acpi_video0` and `intel_backlight`. `intel_backlight` is the one which controls my screen brightness (echo/cat), however `acpi_video0` is the default. By default the service `systemd-backlight@acpi_video0.service` is enabled which _should_ save/restore brightness at shutdown/startup, but it doesn't work since it points to the wrong file. When trying to enable `systemd-backlight@intel_backlight.service` instead, but I get this message:               The unit files have no [Install] section. They are not meant to be enabled     using systemctl.     Possible reasons for having this kind of units are:     1) A unit may be statically enabled by being symlinked from another unit's        .wants/ or .requires/ directory.     2) A unit's purpose may be to act as a helper for some other unit which has        a requirement dependency on it.     3) A unit may be started when needed via activation (socket, path, timer,        D-Bus, udev, scripted systemctl call, ...).      How do I fix this?


title: Solarized colors in st (simple terminal)

text: I want to use st with solarized colors like I can with `urxvt` (of course this is done via `.Xresources`, in `st` the colors are defined in a header file). I've tried to put the colors in `st`'s config file (config.h), but the colors are "used for the wrong things" in `st` (eg. dircolors and colors in `vim` are rearranged relative to `urxvt`). I think I have to modify the escape sequences used by `st`, but I'm not getting anywhere. Can anyone offer me a hint on how to apply the solarized colors to `st`?


title: configure xscreensaver through X resource database

text: I want to get rid of the xscreensaver config file in my home `.xscreensaver`. I read in `man xscreensaver`, that:               Options to xscreensaver are stored in one of two places: in a .xscreensaver file in      your home directory; or in the  X  resource  database.   If  the     .xscreensaver file exists, it overrides any settings in the resource database      but I don't understand what that means. What is this `X resource database`? Where should I put the contents of my `$HOME/.xscreensaver`, so that this file can be deleted from my home?


title: How can I make the backspace key delete one character backwards in tcsh?

text: I have a clean installation of openSuse. This automatically sets up bash as the default shell. For historic reasons, all of the aliases and shortcuts I want to port from an old computer are in tcsh, and I don't really feel up to learning how to do the same in bash. Instead, I changed the login shell to tcsh, and I'm happy. The problem I have now is that backspace only deletes forward (like the `del` key), instead of backward (like `ctrl`+`h`). How can I bind the backspace key to delete backwards instead of forward?


title: Total RAM used by a program with `ps`?

text: > **Possible Duplicate:**   >  Measuring RAM usage of a program I am trying to use `ps` to benchmark a program, I'm just not sure which flags to use. I would like to get the amount of RAM the program used in total, what flag should I use?


title: How to know maximum memory usage of a process?

text: > **Possible Duplicate:**   >  Measuring RAM usage of a program I have a process, which is quite short-running (about 10 minutes), but memory heavy. I want to know how much memory does the process uses at its peak. I want some way to track it, more efficient than running `htop` and writing down the memory usage every 20 seconds. Ideally, I would like something like `time` - some way to write `trackmemory command` and the command would run and at the end, the memory usage would be shown. However, I will survive manually writing the `pid` somewhere; I just don't want to watch `htop` and writing it down.


title: a handy tool to measure memory consumption of a program

text: I develop a C code on Debian. I am looking for a program to monitor memory consumption of my code in real-time. The only value I care is the maximum RAM consumption, it should hold the value even if the the program is killed (e.g. by SIGKILL) . Could anyone suggest a handy tool for it? Normally I use `top -p pidnumber`, but it outputs with too much delay and if my program gets killed, it does not show the RAM consumption just before it is ended.


title: Does `ntpd` set hardware clock?

text: Does `ntpd` set hardware clock? Does `ntpd` set hardware clock if I pass `-q` option (mean one-time correction)? Linux 3.5.6, ntp 4.2.6.p5. Here is written that ntpd syncs the system clock to hardware every 11 minutes, but I can't find reference to this in the ntpd mans.


title: systemctl output is truncated

text: A need to grep the output for this command:               systemctl | grep failed      The problem is that it does not show complete units:               systemd-...-clean.service loaded failed failed        Cleanup of Temporary Directories     systemd-...-setup.service loaded failed failed        Recreate Volatile Files and Directories     tcsd.service              loaded failed failed        LSB: Init script for TCSD     cups.socket               loaded failed failed        CUPS Printing Service Sockets      Your can see the units show like: `systemd-...es-clean.timer` for `systemd- tmpfiles-clean.service` I tried with a file:               systemctl --failed > file      Or cat:               systemctl --failed | cat      But the problem is the same. I need some help to understand why that happens and how fix it.


title: How to replace a symbolic link with an equivalent hard link?

text: Having a (single, no batch filesystem processing needed) symlink, what a command line to use to turn it into a hard link to the same file?


title: What screensaver should I use under XFCE?

text: I'm running XFCE and Gnome3 and have some trouble with choosing a screensaver. Any advice on which screensaver to use and how to configure it? AFAIK xscreensaver works, but I wonder if it's a better option? Gnome-screensaver no longer have any configurable device so how do I use it? Any other advice with screensaver under XFCE?


title: find . -size -1GB in Centos

text: In Centos, I have a text file in my home directory. The command `find . -size -1M` doesn't show my file but `find . -size -1000k` does show it. This problem just seems to be happening when I use the number "1". The first command will work if I use `-2M` even though the file is only 500k in size. Am I doing something wrong?


title: How to automatically force fsck disks after crash in `systemd`?

text: Sorry for bad english. How to set `systemd` for automatically force fsck disks after crash (hard poweroff)? When I used `sysvinit` (in Arch Linux) as `/sbin/init` I used the hack: in the `rc.local` I create `/forcefsck` file; in the `rc.local.shutdown` I remove it. At boot-up `rc.sysinit` enable force fsck if `/forcefsck` exists. How to do same in `systemd`? Maybe it has built-in facilities for automatic fsck after crush?


title: Why is "shebang" called "shebang"?

text: Does "shebang" mean "bang she"? Why not "hebang" as "bang he"? Thanks.


title: Incremental backup with hard links for multiple folders

text: Can anyone refer me to a simple backup script or program, that will backup in the following way:   * Incremental   * Rotation of X backups   * Backup to a mounted drive (no need for remote connections)   * Multiple source folders   * Hard links from the last backup to non-changed files, to save space   * Full files backup, and not only diff files   * Optional: exclusion list of files / folders to not backup   * Optional: send an Email with the backup details at the end of the process Most of the scripts that I found are dealing with full images backups, or diff backups, whereas I wish to backup only selected folders, and have the full files in case a restore is needed. If additional data is needed, I'll be glad to add it.


title: Automatically build a manually installed kernel module upon installing a kernel update on Ubuntu

text: I am experimenting with flashcache on my Ubuntu and it looks interesting enough to do a long term test with it. I downloaded the sources, compiled them and installed the resulting kernel module. So far so good. But once I update my Operating System and a new kernel is installed, the module needs to be recompiled for the new kernel and installed in a different path. I am sure this can be done automatically, but I don't know how. Whenever I update the kernel on my system, serveral modules are automatically compiled (amongst others the virualbox modules). How can I automatically recompile a manually installed kernel module upon upgrading my kernel package? I basically need some hook that does the `make` and `make install` stages for flashcache during an `apt-get upgrade`.


title: Changing user in a script?

text: I am trying to change user in order to execute a specific command during startup. It fails silently and apparently the userchange isn't carried out as I can tell that the command isn't executed. What am I doing wrong in my below shown initscript?               respawn     console none          start on startup     stop on shutdown          script       su -u anotheruser -c "myCommand" >> "myLogfile.log"     end script