How do SO (shared object) numbers work?

I'm aware that shared objects under Linux use "so numbers", namely that different versions of a shared object are given different extensions, for example:   * `example.so.1`   * `example.so.2` I understand the idea is to have two distinct files such that two versions of a library can exist on a system (as opposed to "DLL Hell" on Windows). I'd like to know how this works in practice? Often, I see that `example.so` is in fact a symbolic link to `example.so.2` where `.2` is the latest version. How then does an application depending on an older version of `example.so` identify it correctly? Are there any rules as to what numbers one must use? Or is this simply convention? Is it the case that, unlike in Windows where software binaries are transferred between systems, if a system has a newer version of a shared object it is linked to the older version automatically when compiling from source? I suspect this is related to `ldconfig` but I'm not sure how.


How to have find recurse into subdirectories when using -prune option

I see that the `find` command does **not** descend into subdirectories when you're using the `-prune` option. How do I tell find to recurse into the sub directories, but also ignore some stuff? Specifically, I want to search the `/var/lib/foo` directory, but exclude any directories with the name `.snapshot/`.               sudo find /var/lib/foo -prune -name '.snapshot'      With the above, it properly ignores .snapshot, but doesn't go into the sub dirs. FYI, I'm working in bash on a CentOS 6.3 host.


how to find out wich chain in iptables in listing

Suppose I have the following two entries line of iptables:               iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE     iptables -A INPUT -s 192.168.1.0/24 -j DROP      So, I have `POSTROUTING` and `INPUT` chains. Then i can get the result list with:               iptables -L  -t nat -n --line-numbers -t filter      My result is:               Chain INPUT (policy ACCEPT)     num  target     prot opt source               destination              1    DROP       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:70     2    DROP       all  --  10.10.10.0/24        0.0.0.0/0                 **My quesion is** , how can I find out which rule belong to `POSTROUTING` and wich belong to `INPUT` ?


how to plot multiple graphs in one plot?

I want a plotting script that will plot multiple graphs on the same plot where the values of my data have the same `x` coordinate. This will help me the differences of each variable in the plot. I tried to plot using spreadsheet, but the plots are not clearly identifiable each other. I want you help me with the script to do my plot. My data looks like:               x y1 y2 y3 y4           1 10 25 28 30      2 20 15 40 20      3 10 10 30 20      4 2 5 15 30         . . . .


Keyboard macros for X and/or KDE

I'm looking for a utility to record and playback keyboard macros in X applications (KDE specifically). I've tried `xmacrorec` and `xmacroplay`, but after running them, my mouse and keyboard does not respond properly _(i.e. the left mouse button gets stuck in a "clicked" state)_ and I have to restart X. Are the any modern alternatives that work under **KDE 4.5** and **openSUSE 11.3**?


Is there a good combination of command-line and graphical file browser?

Is there a feasible solution than combines the advantages of a command-line and a graphical file browser? For example, the command-line is good to change the directory and execute commands but can't show thumbnails and the file browser is intuitive, gives a good overview on where you are in the tree but you can't "talk" to the computer like in a command-line. EDIT: for me, as a command-line user, its more like needing a command-line with additional file-browser capabilities than having a file browser with some command-line features.


Why read() is slower than getc()?

Why is `read` slower than `getc`? For example, this:               for (;;) {             chr++;             amr=read(file1, &wc1, 1);             amr2=read(file2, &wc2, 1);             if (wc1 == wc2) {                 if (wc1 == '\n')                     line++;                 if (amr == 0) {                     if (eflg)                         return (1);                     return (0);                 }                 continue;             }      is slower than that:               for (;;) {         chr++;         c1 = getc(file1);         c2 = getc(file2);         if (c1 == c2) {             if (c1 == '\n')                 line++;             if (c1 == EOF) {                 if (eflg)                     return (1);                 return (0);             }             continue;         }      `getc` uses the `read` system call, so why is it slower?


Increasing conky height

Is there any way to change the height of a conky window? ### .conkyrc               background no     update_interval 1          cpu_avg_samples 2     net_avg_samples 2          override_utf8_locale yes          double_buffer yes     no_buffers yes          text_buffer_size 2048     #imlib_cache_size 0          # Window specifications #          own_window_class Conky     own_window yes     own_window_type desktop     own_window_transparent yes     own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager     own_window_argb_visual yes          border_inner_margin 0     border_outer_margin 0          minimum_size 200 200     maximum_width 200          alignment tr     gap_x 0     gap_y 25          # Graphics settings #     draw_shades no     draw_outline no     draw_borders no     draw_graph_borders no          # Text settings #     use_xft yes     xftfont Ubuntu:size=8     xftalpha 0.5          uppercase no     temperature_unit celsius     default_color FFFFFF          # Lua Load  #     lua_load ~/.conky/draw_bg.lua     lua_draw_hook_pre draw_bg          lua_load ~/.conky/clock_rings.lua     lua_draw_hook_post clock_rings          TEXT     ${voffset 8}${goto 25}${color FFFFFF}${font Ubuntu:size=16}${time %A}${font}${voffset -8}${alignr 50}${color FFFFFF}${font Ubuntu:size=38}${time %e}${font}     ${color FFFFFF}${goto 25}${voffset -30}${color FFFFFF}${font Ubuntu:size=18}${time %b}${goto 75}${font Ubuntu:size=20}${time %Y}${font}${color 0B8904}     ${voffset 150}${font Ubuntu:size=10}${font}     ${font Ubuntu:size=12}${color FFFFFF}${alignr}${font}     ${voffset -20}${alignr 50}${color FFFFFF}${font Ubuntu:size=38}${time %H}${font}     ${alignr 50}${color FFFFFF}${font Ubuntu:size=38}${time %M}${font}          ${voffset -95}     ${color FFFFFF}${goto 23}${voffset 48}${cpu cpu0}%     ${color 0B8904}${goto 23}CPU     ${color FFFFFF}${goto 48}${voffset 23}${memperc}%     ${color 0B8904}${goto 48}RAM     ${color FFFFFF}${goto 73}${voffset 23}${swapperc}%     ${color 0B8904}${goto 73}Swap     ${color FFFFFF}${goto 98}${voffset 23}${fs_used_perc /}%     ${color 0B8904}${goto 98}Disk     ${color FFFFFF}${voffset 25}${alignr 62}${downspeed eth1}${goto 135}D     ${color FFFFFF}${alignr 62}${upspeed eth1}${goto 135}U      ${color 0B8904}${goto 123}Net          ${color FFFFFF}${font Ubuntu:size=8}${goto 55}Uptime: ${goto 100}${uptime_short}     ${color FFFFFF}${font Ubuntu:size=8}${goto 42}Processes: ${goto 100}${processes}     ${color FFFFFF}${font Ubuntu:size=8}${goto 50}Running: ${goto 100}${running_processes}}      ### draw_bg lua script               -- Change these settings to affect your background.     -- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.          corner_r=0          -- Set the colour and transparency (alpha) of your background.          bg_colour=0x000000     bg_alpha=.8          require 'cairo'     function rgb_to_r_g_b(colour,alpha)         return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha     end          function conky_draw_bg()         if conky_window==nil then return end         local w=conky_window.width         local h=conky_window.height         local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)         cr=cairo_create(cs)              cairo_move_to(cr,corner_r,0)         cairo_line_to(cr,w-corner_r,0)         cairo_curve_to(cr,w,0,w,0,w,corner_r)         cairo_line_to(cr,w,h-corner_r)         cairo_curve_to(cr,w,h,w,h,w-corner_r,h)         cairo_line_to(cr,corner_r,h)         cairo_curve_to(cr,0,h,0,h,0,h-corner_r)         cairo_line_to(cr,0,corner_r)         cairo_curve_to(cr,0,0,0,0,corner_r,0)         cairo_close_path(cr)              cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))         cairo_fill(cr)     end      ### Screenshot of setup                                          ![Screenshot](http://i.stack.imgur.com/J4Htg.png) ### Question I want to increase the background(drawn by the lua script using `conky_window.height`) to occupy the entire screen height. ### Tried   * Changing `minimum_size` has no effect   * Adding lines at the botto has no effect, see http://imgur.com/KJ5uVD3 ### Fix Turns out that `conky_window.height` used by the lua script is preserved between conky restarts. Logging out and back in resolves this issue. Changing `minimum_size` works.


use `/run/shm` (formerly `/dev/shm`) as a temp directory

Is it good practice to create a directory in `/run/shm` (formerly `/dev/shm`) and use that like a temp directory for an application? Background: I am writing black box tests for a program which does a lot of stuff with files and directories. For every test I create a lot of files and directories and then run the program and then create the expected set of files and directories and then run diff to compare. I now have about 40 tests and they are already taking over 2 seconds to run. Hoping to speed things up I want to run the tests in a directory on some sort of ramdisk. Researching about ram disk I stumbled upon a question with an answer stating that it is okay to create a directory in `/dev/shm` and use that like a temp directory. Researching some more however I stumbled upon a wiki page from debian stating that it is an error to use `/dev/shm` directly. I should use the `shm_*` functions. Unfortunately the `shm_*` functions seem to be not available for use in a shell script. Now I am confused. Is it okay or not to use `/run/shm` (formerly `/dev/shm`) like a temp directory?


How do I track all the most recent file changes on my UNIX system?

Say, either for a Debian system or a Red Hat one.


Search and replace next n words in vi

> **Possible Duplicate:**   >  Vim :s replace first N < g occurrences on a line In vi, how do I search and replace a word's first `n` occurrences with a word, say "hello", and the next `m` occurrences with `bonjour`, and all the rest with `namaste`?


How can I (and should I) use my Linux file server as a Time Machine backup server for my Macs?

I have two Macs that I'd like to start backing up using Time Machine, but all of my storage is attached to my Linux file server. How can I use my Linux file server (which happens to be running Ubuntu Karmic) as a custom Time Capsule replacement, and have my Macs (running 10.6) automatically back up to it using Time Machine? And lastly, is this wise? Is there any inherent risk in doing this that compromises the whole point of the backup?


How to see output of a running program over ssh

I use debian 6 on an embedded system which is supposed to run a program called `pilot`. The OS is configured to login as root without asking password (there is no monitor nor keyboard connected). After login, `pilot` will run automatically. I need to see std output of the `pilot`. I'm connecting with ssh over wireless.


pdf viewer for command line only

Is it possible to view pdf documents without having gdm (or similar) running? Rationale: I'm working on a remote server (assume no X forwarding) processing some data, creating some plots (assume pdf files). And I would like to view them without having to `scp` and open them on my machine. (There may be other use cases, probably.)


How to run grep with multiple AND patterns?

I would like to get the multi pattern match with implicit **AND** between patterns, i.e. equivalent to running several greps in a sequence:               grep pattern1 | grep pattern2 | ...      So how to convert it to something like?               grep pattern1 & pattern2 & pattern3      _I would like to use single grep because I am building arguments dynamically, so everything has to fit in one string. Using filter is system feature, not grep, so it is not an argument for it._ * * * Don't confuse this question with:               grep "pattern1\|pattern2\|..."      This is an **OR** multi pattern match.


Compare two files with first column and remove duplicate row from 2nd file in shell script

I will ask my question with an example. I have 2 files: **File #1:**               118D FC300_R5_TP  FX.B      32775       2112   6       2038   6       2112   0     118E FC300_R5_TP  FX.B      32775       2136   7       2065   6       2136   0     118F FC300_R5_TP  FX.B      32775       2124   6       2064   6       2124   0     1190 FC300_R5_TP  FX.B     819210     814632  99     814609  99     814632   0     1191 FC300_R5_TP  FX.B     819210     104100  13     103714  13     104100   0     1192 FC300_R5_TP  FX.B    1638420    1609476  98    1609402  98    1609476   0     1196 FC300_R5_TP  FX.B    1638420    1638432 100    1638379 100    1638432   0     119A FC300_R5_TP  FX.B    3276840    3271776 100    3271698 100    3271776   0     119E FC300_R5_TP  FX.B    3276840    3264120 100    3264034 100    3264120   0     11A2 FC300_R5_TP  FX.B    3276840    2328648  71    2328546  71    2328648   0     11A6 FC300_R5_TP  FX.B    3276840    2328444  71    2328355  71    2328444   0     11AA FC300_R5_TP  FX.B    3276840    2328528  71    2328403  71    2328528   0     11AE FC300_R5_TP  FX.B    3276840    2328648  71    2328468  71    2328648   0     11B2 FC300_R5_TP  FX.B    3276840    2130000  65    2129766  65    2130000   0     173A FC300_R5_TP  FX.B    6553680    6478572  99    6477747  99    6478572   0      **File #2:**               11AA FC300_R5_TP  FX.B    3276840    2328528  71    2328403  71    2328528   0     11AE FC300_R5_TP  FX.B    3276840    2328648  71    2328468  71    2328648   0     11B2 FC300_R5_TP  FX.B    3276840    2130000  65    2129766  65    2130000   0     173A FC300_R5_TP  FX.B    6553680    6478572  99    6477747  99    6478572   0     0BDB FC600_R5_TP  FX.B   33554640    6044364  18    6033105  18    6044364   0     0BDC FC600_R5_TP  FX.B   33554640    6613536  20    6481974  19    6613536   0     0BDD FC600_R5_TP  FX.B   33554640    4435848  13    4057170  12    4435848   0     0BDE FC600_R5_TP  FX.B   33554640    6620868  20    6249518  19    6620868   0      ### Desired Output **File #3:**               0BDB FC600_R5_TP  FX.B   33554640    6044364  18    6033105  18    6044364   0     0BDC FC600_R5_TP  FX.B   33554640    6613536  20    6481974  19    6613536   0     0BDD FC600_R5_TP  FX.B   33554640    4435848  13    4057170  12    4435848   0     0BDE FC600_R5_TP  FX.B   33554640    6620868  20    6249518  19    6620868   0      I'd like to compare file 1 and file 2 using their first columns and remove the entire line or row from file 2 where they match in file 1. I'd also like to save the results to a 3rd file, file #3.


How to make files inside TMPFS more likely to swap

I'm using tmpfs for my `/tmp` directory. How can I make the computer decide to swap out the files inside the `/tmp` before swapping out anything that is being used by applications? Basically the files inside `/tmp` should have a higher swappiness compared to the memory being used by processes. It seems this answer http://unix.stackexchange.com/a/90337/56970 makes a lot of sense, but you can't change swappiness for a single directory. I know about cgroups though, but I don't see any way of making tmp into a cgroup?


How can I force the IP address & hostname to only be exposed as domain.com on a Tomcat Server?

I have a web server which is running on CentOS 6 on top of Tomcat7. Everything works fine, however, there are many ways that users can access the server. For instance:   * IP Address   * domain.com   * www.domain.com These addresses are all accessible via a browser. However I'd like to configure the server so that when IP address or www.domain.com is accessed, it would point to domain.com. > Example   > IP Address, xxx.xx.xx.xx ► domain.com   > www.domain.com ► domain.com What is the easiest way to achieve this? Is DNS required to configure this on server?


bash terminal [\t] (time) is not same timezone as 'date'

In my .bashrc file I configured how I would like my prompt to be displayed. My .bashrc is sourced in .bash_profile. The command in the .bashrc file is:               PS1='[\t] \u@\h is $PWD :: '      I switched the user (for me) timezone to GMT+0 using tzselect. The problem I am having is that using the date command I am getting the GMT time (which I am pleased with) but the terminal prompt is still on the system time (even after logging in and logging out), which I am not pleased with. How can I get the terminal to display the time in the time format that I, the user, am specifying?


Install Gnome-Shell theme without gnome-tweak-tool?

I've just installed fedora 17 and `gnome-tweak-tool`, but it crashes everytime and I can't change the theme. Any other way to do that?


Why doesn't Linux use the IANA Ephemeral port range?

According to Wikipedia > The Internet Assigned Numbers Authority (IANA) suggests the range 49152 to > 65535 for dynamic or private ports. Many Linux kernels use the port range > 32768 to 61000. Even though there seems to be some historical deviation from IANA's suggested range, it seems awkward that Windows Vista, Windows 7, Windows Server 2008, FreeBSD 4.6+ and many others all have agreed upon this range and yet Linux still stands out. Looking into it though, low and behold:               $ cat /proc/sys/net/ipv4/ip_local_port_range      32768   61000      Why hasn't Linux adopted the standard range?


Regular expression problem(s) in Bash: [^negate] doesn't seem to work

When I execute `ls /directory | grep '[^term]'` in Bash I get a regular listing, as if the `grep` command is ignored somehow. I tried the same thing with `egrep`, I tried to use it with double and single quotes, but to no better results. When I try `ls /directory | grep '^[term]` I get all entries beginning with term - as expected. I have tried out this command in an online editor, where I can test my regex and it worked as it should. But not in Bash. So it works in a simulation, but not in real life. I work on Crunchbang Linux 10. I hope this is enough information and am looking forward to every hint, because failing to execute on such a basic level and wasting hours of time is really frustrating!


Stopping output from a program run in SSH session NOW

## Problem I execute command that outputs LOTS of information through SSH. For example, I foolishly add debug information inside a loop that executes million times, or just run `cat /dev/urandom` for kicks. The terminal is flooded with information. ![Example what I'm talking about](http://i.stack.imgur.com/Ozwib.gif) I want to terminate the command ASAP and fix my program. I don't care what it prints. Now, the thing is that I press `Ctrl`+`C` ASAP (in the example above I pressed it immediately after running the command), but **it still takes its time to print all the information I don't even need**. ## What I've tried I tried pressing `Ctrl`+`C` so hard that it had funny results when terminal finally caught up:               OUTPUT HERE^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     ^C^C          ^C^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C     ^C^C^C^C^C^C^C^C^C^C^C^C^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C     rr-@burza:~/xor$ ^C      I also read about `Ctrl`+`S` which apparently is used to tell terminal "stop output, I need to catch up" but apparently it does nothing. ## Miscellaneous details I'd like not to alter the command I run so I can rescue myself in any situation, even if I don't remember that the program I run could end up like that. My SSH client runs on Cygwin (`CYGWIN_NT-6.1-WOW64 luna 1.7.30(0.272/5/3) 2014-05-23 10:36 i686 Cygwin`) in MinTTY with terminal type set to `xterm-256color`. SSH server runs on Debian (`Linux burza 3.2.0-4-686-pae #1 SMP Debian 3.2.51-1 i686 i686 i686 GNU/Linux`).


How to start the Snort service with logging enabled?

I setup snort on Centos server and add as a service. When I use `service snortd start` command, the log file is created but it is empty. If I use `snort -q -l /var/log/snort` command, the log file created and filled with logs. What should I do in order to use `service snortd start` and have the logs work?


Arch Linux run script a minute after boot

I have set up a bridge between eth0 and wlan0 with netctl. It works fine if I tell it to configure eth0 and wlan0 at startup and then for me to manually start the bridge after it boots. If I tell the bridge to start automatically as well though for some reason the wlan adapter does not connect to an access point. I therefore need "netctl start bridge" to run a minute or so after the entire system has finished booting. Any idea how I should do this? PS. This is a headless system as in no xorg so running it at xorg startup won't work.


Pattern replacement

Please can anyone explain to me in brief the syntax of this command. Explanation in terms of how actually this command is written significance of each and every character used. I know the output of this command but want to learn how it is working .               sed -i 's|\(LAYOUT PATH \).*|\1 "../GDS/'$1'.gds"|g' drcCustimize2        Thanks in advance Yisha


/etc/default/grub syntax error

How can I add kernel parameters with whitespaces to `GRUB_CMDLINE_LINUX_DEFAULT`? For example when I do:               GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_os_name=\"Microsoft Windows XP\""      followed by               grub-mkconfig -o /boot/grub/grub.cfg      I get the following `linux`-line in grub.cfg:               linux /vmlinuz-linux root=UUID=<long id> rw quiet acpi_os_name="Microsoft Windows XP"      If I boot with this grub.cfg, I get the following output during the boot process:               /init: eval: line 1: syntax error: unterminated quoted string      If I remove `acpi_os_name=\"Microsoft Windows XP\"` everything works as before. However the reason, I'm doing this, is an acpi fan problem with my notebook. So I'm following this article in order to make the fan work: https://wiki.archlinux.org/index.php/DSDT **Edit 0:** The output of `uname -s -r -v` is:               Linux 3.13.8-1-ARCH #1 SMP PREEMPT Tue Apr 1 12:19:51 CEST 2014


What are the responsibilities of each Pseudo-Terminal (PTY) component (software, master side, slave side)?

I am trying to figure out **how a tty works** 1 (the work-flow and responsibilities of each elements). I have read several interesting articles about it, but there are still some blurry areas. This is what I understand so far:   * The emulated terminal makes different system calls to `/dev/ptmx`, the master part of the pseudo-terminal.   * The master part of the pseudo terminal allocates a file in `/dev/pts/[0-N]`, corresponding to the obsolete serial port, and "attaches" a slave pseudo terminal to it.   * The slave pseudo terminal keeps information such as session Id, foreground job, screen size. Here are my questions:   1. **Has ptmx** any purpose besides allocating the slave part? Does it provide **some kind of "intelligence"** , or the emulated terminal (xterm for instance) has all the intelligence of behaving like a terminal?   2. **Why does xterm** has to interact with the master part, as it only forwards the stdout and stdin of the slave part? Why can't it **directly write and read from the pts file**?   3. Is a session ID always attached to one pts file and vice versa? Could I type a ps command and found **2 sessionId for the same /dev/pts/X**?   4. What other information does the `pts` store? Does Xterm update all fields by himself, or does the `ptm` add some "intelligence" on it? * * * 1. I base my understanding on the TTY demystified by Linus Akesson, and the Linux Kernel by Andries Brouwer posts, as on several other questions on these sites


Prevent transparent font on Termite when using Compton

Termite dropped their Opacity-Option, so you have to define a Opacity-Rule in Compton to make the Terminal transparent, _and the font is also transparent_. How can I change that? Anybody has an Idea? In a related Question I've asked there is an Image in the accepted Answer that looks like the Font is non-transparent... ranger image-preview with transparent terminal background


Diff the output of two `awk` commands

I'm trying to compute the difference between the output of two `awk` commands but my simple attempts at it seem to be failing. Here is what I'm trying:               diff $(awk '{print $3}' f1.txt | sort -u) $(awk '{print $2}' f2.txt | sort -u)      This doesn't work for reasons unknown to me. I was under the assumption that `$()` construct was used to capture the output of another command but my "diff" invocation fails to recognize the two inputs given to it. Is there any way I can make this work. By the way, I can't use the obvious solution of writing the output of those two commands to separate files given that I'm logged on to a production box with no 'write' privileges.


Finding text between two specific characters or strings

Say I have lines like this:               *[234]*     *[23]*     *[1453]*      where `*` represents any string (except a string of the form `[number]`). How can I parse these lines with a command line utility and extract the number between brackets? More generally, which of these tools `cut`, `sed`, `grep` or `awk` would be appropriate for such task?


Changing timezone on Debian keeps Local Time in UTC

I'm trying to get programs to log in local time for my own sanity. I have updated my timezone with:                dpkg-reconfigure tzdata      But the result of that command is:               Current default time zone: 'Australia/Adelaide'     Local time is now:      Mon May 20 03:09:52 UTC 2013.     Universal Time is now:  Mon May 20 03:09:52 UTC 2013.      Notice the **UTC** in `Local time` Any reason why this may be? I have done a lot of Googling but my problem seems different to all of them :( **Here are some more details:**               # cat /etc/timezone     Australia/Adelaide          # date     Mon May 20 03:41:06 UTC 2013          # export TZ='Australia/Adelaide'; date     Mon May 20 13:16:11 CST 2013      Setting `export TZ='Australia/Adelaide';` in my `/etc/profile` makes `date` work by default in a bash session but does not change the system log date (after restarting the service) **Edit:**               # ls -l /etc/localtime     lrwxrwxrwx 1 root root 20 May 10 14:48 /etc/localtime -> /usr/share/zoneinfo/          # ls /etc/localtime/     Adelaide    Chile    GMT        Japan      PST8PDT    Universal     Africa      Cuba     GMT+0      Kwajalein  Pacific    W-SU     America     EET      GMT-0      Libya      Poland     WET     Antarctica  EST      GMT0       MET        Portugal   Zulu     Arctic      EST5EDT  Greenwich  MST        ROC        iso3166.tab     Asia        Egypt    HST        MST7MDT    ROK        localtime     Atlantic    Eire     Hongkong   Mexico     Singapore  localtime.dpkg-new     Australia   Etc      Iceland    Mideast    SystemV    posix     Brazil      Europe   Indian     NZ         Turkey     posixrules     CET         Factory  Iran       NZ-CHAT    UCT        right     CST6CDT     GB       Israel     Navajo     US         zone.tab     Canada      GB-Eire  Jamaica    PRC        UTC      ## Answer: Worked it out thanks to jamzed. for some reason I had /etc/localtime as a symlink... the IT Guy here set up the server using Turnkey 12 so maybe that was the problem.               # mv /etc/localtime /etc/localtime.old     # cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime     # date     Thu May 23 09:36:17 CST 2013


What's the difference between a screen being attached and detached?

[blah]$ screen -ls     There are screens on:             16517.pts-0.blah       (01/28/2012 01:55:32 PM)        (Detached)             4345.pts-1.blah     (01/27/2012 11:22:48 AM)        (Attached)     2 Sockets in /var/run/screen/S-blahblah.      Got 2 questions 1) What's the difference between attached and detached screen 2) Can you kill attached and detached screen and how do you do it? (I killed attached screen with screen -X -S id kill before but I don't think it works on detached one)


Undefined reference to symbol 'acs_map' when running makeconfig

I get a linker error when I try to configure the Linux kernel with `menuconfig`:               # make menuconfig       HOSTLD  scripts/kconfig/mconf     /usr/local/bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to symbol 'acs_map'     /usr/local/bin/ld: note: 'acs_map' is defined in DSO /lib/libtinfo.so.5 so try adding it to the linker command line     /lib/libtinfo.so.5: could not read symbols: Invalid operation     collect2: ld returned 1 exit status     make[1]: *** [scripts/kconfig/mconf] Error 1     make: *** [menuconfig] Error 2      Any idea as to what is wrong with it? I'm running CentOS 6.2 and I'm sure I've installed all the needed libs.


selecting specific string in a field

I have this file:               N104    F1810     N104    F3810     N104    F810     N104    F305      and a script to `grep` an input. Script:               enter input     read input     cat file | grep $input      when I input “810”, I get the output:               N104    F1810     N104    F3810     N104    F810      I need the output:               N104  F810      Can you help?


Is there any difference between e2fsck and e4fsck on CentOS / RHEL systems?

ext4.wiki.kernel.org makes it sound like e2fsck was simply renamed to e4fsck so that e4fsprogs and e2fsprogs could coexist without overlapping. However, there is no mention of any difference in the code of the command. The e2fsck man page makes no mention of ext4, but does mention that it works with ext3 (i.e. ext2 with journaling turned on). For Ubuntu, apparently e2fsck can handle ext2, 3 **_and_** 4 filesystems. And of course there's good ol' vanilla fsck which itself makes no mention of ext4. If I need to fsck an ext4 file system on a RHEL based system, which tool do I use? e4fsck? But if it's just a rename of e2fsck, can I just use that instead? Why does Ubuntu mention ext4 in its e2fsck man page but no one else seems to? And what about plain fsck on ext4? **EDIT:** On a Fedora 14 machine there is fsck.ext4, fsck.ext3 and fsck.ext2 in /sbin/. They all have the exact same file size. Curioser and Curioser. **EDIT 2:** Furthermore, when running fsck.ext4, you see that it appears to be e2fsck running. For example, I see this line when running fsck.ext4: `e2fsck: aborted` Tricksters!


Script to create files in a template

I just wrote a function in my `~/.bashrc` that will let me create a folder for a new website with one command. The function looks like this:               function newsite() {       mkcd "$*"  # mkdir and cd into it       mkdir "js"       mkdir "imgs"       touch "index.html"       touch "main.css"       vim "index.html"     }      Woo hoo super complicated function... Okay in all seriousness I understand this is really basic, it's the first function I've made without copy and pasting from online though so bear with me. Now what I would like to do is, instead of just touching index.html and main.css I'd like to create basic template files for index.html and main.css problem is I have absolutely no idea how to do that. I don't know much about writing to files using bash commands. Typically I'd just open the files in vim and go to town but I'd like to have something already started when I get into vim...


Pass output of a command as arguments to another(non-blocking)?

I was wondering how I can iterate over each line of the output of a command and pass it as command line arguments to another one. I want to do this in a non-blocking fashion as the output never reaches an EOF. To be more precise I want to take each line of output from `acpi_listen` and pass it to a user-level acpi handler script similarly to what acpid does as root(eg. "button/lid LID close" where $1="button/lid" $2=LID $3=close).


How do I convert FLAC files to AAC (preferrably VBR 320k+)?

I back my CDs up to FLAC and then transcode to AAC (.m4a) files for portability on my android phone and the wife's iPhone. I had been using XLD on Mac and it does a great job but I'd rather not steal her Mac to do this and be able to do it on my own Debian box. The following works:               avconv -i "inputfile.flac" -acodec aac -strict experimental "outputfile.m4a" -map_metadata "inputfile.flac":"outputfile.m4a"      But the following doesn't (well it does, but ignores the 320 for audio quality and results as the same as above):               avconv -i "inputfile.flac" -acodec aac -aq 320 -strict experimental "outputfile.m4a" -map_metadata "inputfile.flac":"outputfile.m4a"      I'd found other commands online such as "ffmpeg" but apparently most or all of them are depreciated in favour of the avconv method above. Any help would be greatly appreciated! I could live with 320 Kbps if not true VBR, but LC VBR of at least 320 would be best.


Sudo email notification setup error

I'm Using Centos version:               [sysadmin@backup-srv ~]$ cat /etc/redhat-release      CentOS release 6.4 (Final)      I'm using this sudo version:               [sysadmin@backup-srv ~]$ sudo -V     Sudo version 1.8.6p3     Sudoers policy plugin version 1.8.6p3     Sudoers file grammar version 42     Sudoers I/O plugin version 1.8.6p3      I tried to setup notification mail for sudo, added this entry in bottom of sudo file using command visudo, but I am getting the following syntax error:               Defaults    mailto "babin@xxxxxxxxx.com"     Defaults    mailfrom "root@media.xxxxxxxxxxx.com     Defaults    mail_always on     Defaults    mailsub “*** Command run via sudo on %h ***”     Defaults    mail_badpass on     Defaults    badpass_message "Please Provide Correct Password"     Defaults    !lecture,tty_tickets,!fqdn,!syslog     Defaults    logfile=/var/log/sudo.log      This is the error I get while saving the sudo config file:                121 Defaults        mailto "babin@xxxxxxxxx.com"      122 Defaults        mailfrom "root@media.xxxxxxxxxxx.com      123 Defaults        mail_always on      124 Defaults        mailsub “*** Command run via sudo on %h ***”      125 Defaults        mail_badpass on      126 Defaults        badpass_message "Please Provide Correct Password"      127 Defaults        !lecture,tty_tickets,!fqdn,!syslog      128 Defaults        logfile=/var/log/sudo.log      The error is:               visudo: >>> /etc/sudoers: syntax error near line 121 <<<     visudo: >>> /etc/sudoers: syntax error near line 121 <<<      What to do now? How to setup the mail notification for Sudo version 1.8.6p3?


Learn Linux System Programming by doing projects

I have only a very basic idea about linux system programming. I have not done any real projects using linux system programming. In my current company I do system admin type work, but I am more interested in Linux System Programming. I want to do some projects on my own, so that I could put those projects in my resume when I apply for jobs at another companies. Kindly tell me the whether there is any projects where I could learn more linux system programming by doing some real programming stuff. Please note that I only have experience in C programming and not in Linux System Programming. But I know very basic things about linux system programming. Thanks.


reading cifs share fails with permission denied - cifs samba directory permission denied

I'm trying to setup a samba server to share data among clients via cifs. As a test, I mounted the samba share on the same machine and tried to access the contents of the directory. The mount command was:               mount -t cifs -o username=sthomaso,workgroup=WORKGROUP //server/scratch /mnt/server/scratch      ...which worked fine after entering the password. Although I can `cd /mnt/server/scratch`, when I try to list the contents of the directory with `ls`, I get error `ls: reading directory .: Permission denied`. On the server, my `/etc/samba/smb.conf` is:               [global]         security = user         workgroup = WORKGROUP          [homes]         writeable = yes          [scratch]         path = /var/scratch         valid users = @feausers         writeable = yes      User "sthomaso" was added to tdbsam with command:               pdbedit -a -u sthomaso      User "sthomaso" is in group "feausers", verified with the "groups sthomaso" command. `/bin/ls -lF /var | grep scratch` shows:               drwxrwx--T. 2 root feausers 4096 Jun 14 14:40 scratch/      `/var/log/samba/log.smbd` contains validation of a successful connection in line:               <snip> smbd/service.c:1070(make_connection_snum)     <snip> connect to service scratch initially as user sthomaso (uid=500, gid=501) (pid 99999)      So it looks like I am successfully mounting the share, but why can't I read the directory and access the files?


wireless problem

I just installed Ubuntu 10.10 to make my dell inspiron 1564 <64bit> dual boot. But I can't access wi-fi. I guess, I need to download drivers for wireless. My system details are:               raman@ubuntu:~$ sudo lshw -C network       *-network                           description: Network controller            product: BCM4312 802.11b/g LP-PHY            vendor: Broadcom Corporation            physical id: 0            bus info: pci@0000:04:00.0            version: 01            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress bus_master cap_list            configuration: driver=b43-pci-bridge latency=0            resources: irq:17 memory:f0200000-f0203fff       *-network            description: Ethernet interface            product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller            vendor: Realtek Semiconductor Co., Ltd.            physical id: 0            bus info: pci@0000:05:00.0            logical name: eth0            version: 02            serial: 00:26:b9:21:a7:41            size: 10MB/s            capacity: 100MB/s            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress msix vpd bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation            configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10MB/s            resources: irq:45 ioport:3000(size=256) memory:f0410000-f0410fff memory:f0400000-f040ffff memory:f0420000-f043ffff       *-network DISABLED            description: Wireless interface            physical id: 4            logical name: wlan0            serial: c4:17:fe:d5:ec:ca            capabilities: ethernet physical wireless            configuration: broadcast=yes driver=b43 driverversion=2.6.35-22-generic firmware=N/A link=yes multicast=yes wireless=IEEE 802.11bg               raman@ubuntu:~$ iwconfig     lo        no wireless extensions.          eth0      no wireless extensions.          wlan0     IEEE 802.11bg  ESSID:off/any                 Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Power Management:off               raman@ubuntu:~$ ifconfig     eth0      Link encap:Ethernet  HWaddr 00:26:b9:21:a7:41                 UP BROADCAST MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)               Interrupt:45 Base address:0xe000           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:265 errors:0 dropped:0 overruns:0 frame:0               TX packets:265 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:22358 (22.3 KB)  TX bytes:22358 (22.3 KB)      Any suggestions?


Spell check fails in LibreOffice Word 4.1.2.3 in Linux Mint 16 Petra

I am using LibreOffce 4.1.2.3 in Linux Mint 16 Petra. When I try to run a spell check, no checking occurs, and I immediately get this response: ![spell check error](http://i.stack.imgur.com/rxqnd.png) It seems to indicate my language and location aren't set, so I have tried to ensure my language is set to Canadian English: ![setting language](http://i.stack.imgur.com/Tq8fy.png) I've also double checked in the preferences: ![language preferences](http://i.stack.imgur.com/gTypk.png) Nothing I have done has had any effect. How do I get the spell checker to work?


Moving Data From Old System to New System via NFS Mount

My old system was running RHEL 5,(systemold.blah.blah), and I wanted to update the server with as little downtime as possible, so I built out a new system (systemnew.blah.blah) and put RHEL 6 on it. Now I want to transfer the data from the old system to the new system using NFS Mount, or the IP address. Which would be better, and how would I go about performing the data transfer? Thanks!


debian cannot install kernel source

I want to use debian linux for my laptop again. So I took my old debian 6.0 cds and installed it.   From the last time I know, that I have to build the driver for my Atheros AR8151 Gigabit Ethernet Controller.   It seems that this time I installed less base packets.   I had to install make and gcc (apt-get install build-essential).   Now I want to build the driver. When I go to the src folder and type make install, I read               Linux kernel source not found      So I googled, found some answers and typed               apt-get install kernel-source-2.6.32-5-amd64      with the following message               paket could not be found      The directory `/usr/src` is empty.


Copy files with renaming

I have a huge file tree. Some files have same name but in different case, e.g. 'some_code.c' and 'Some_Code.c'. So when I'm trying to copy it to NTFS/FAT filesystem it asks me about whether i'm gonna replace it or skip. Don't you know is there any way to automaticly rename such files, for example, by adding '(1)' to the name of conflict file (like windows 7 does)?


http://www.geekzone.co.nz/foobar/6229      How can I fully disable the .desktop file function under GNOME?


mozilla sync server and mysql auth

Recently I updated my debian squeeze to wheezy. Unfortunately my firefox sync server (weave) stopped working. I saved the config files and downloaded the new version via hg. I already fixed some errors but I'm not able to solve the last problem. My sync.conf:      `[storage]   backend = syncstorage.storage.sql.SQLStorage   sqluri = mysql://user:password@localhost:port/user   standard_collections = false   use_quota = true   quota_size = 50120   pool_size = 100   pool_recycle = 3600   create_tables = true   [auth]   backend = services.user.sql.SQLUser   sqluri = mysql://user:password@localhost:port/user   pool_size = 100   pool_recycle = 3600   create_tables = true   [nodes]   fallback_node = https://domain.com/sync/   [captcha]   use = true   public_key = thekey   private_key = thekey   use_ssl = true   [smtp]   host = localhost   port = 25   sender = weave@domain.com   [cef]   use = true   file = syslog   vendor = mozilla   version = 0   device_version = 1.3   product = weave   [reset_codes]   backend = services.resetcodes.rc_sql.ResetCodeSQL   sqluri = mysql://user:password@localhost:port/user   create_tables = true` My apache2 configuration:      `WSGIDaemonProcess sync user=ffsync group=ffsync processes=2 threads=25   WSGIScriptAlias /sync /opt/moz-sync-server/sync.wsgi   WSGIPassAuthorization On   WSGIProcessGroup sync` The server starts with `bin/paste serve development.ini` without errors, but via mod_wsgi the following messages are in error.log:      `[Thu Aug 22 13:05:29 2013] [error] [client ip-address] File "/opt/moz-sync- server/deps/server-core/services/pluginreg.py", line 108, in load_and_configure   [Thu Aug 22 13:05:29 2013] [error] [client ip-address] backend_name = params[cls_param]   [Thu Aug 22 13:05:29 2013] [error] [client ip-address] KeyError: 'backend'` The sync server is very important because I have lots of bookmarks.


Execute command on shared account login

At work our team uses a shared account "appadmin" to administer our application. At login, each one of us sources an "aliasrc" file containing his or her preferences. (aliases, display, prompt, ...). So far I do something like this:               normaluser$ su - appadmin     password:     appadmin$ . ~normaluser/.aliasrc     [superprompt: appadmin@machine]$       I am looking to reduce all this to a single command. So far I have replaced the use of `su` by `rlogin` in order to take advantage of `.rhosts` and avoid having to input the password each time. (I know ssh is secure, but rlogin seems to be the standard around here). Is there a way to source my aliasrc file as soon as I login in the shared account? I don't insist on using `rlogin`. If you have something better to suggest I am all ears (... well eyes :-/ ). Hope I am clear enough. _**Technical environment** : Solaris 10, Ksh._


I would like to put one single icon in the Desktop that actually opens the Desktop. Any ideas?

The idea is to turn my Desktop into a place where I can put a image reference of what I am learning at the moment. This would be an example This means:   * puttig an image of the reference of what I'm learning as a background of the Desktop (already possible)   * having the icons of files, folders or even removable USB pens available (one click away) but without blocking te view to that background Any Ideas? Or alternative solutions?


fstrim trims more than half of partition size even though partition mounted with discard

When I installed my SSD I just mounted with `discard` and didn't sweat it. However today I was reading about the pros and cons of using `fstrim` instead and decided to run the program to get an idea of how long it would actually take (still with my partitions mounted with `discard`). The command took several minutes on both my root and home partitions. For my home partition I used `-v` and got this:               $ sudo fstrim -v /home     /home: 137494052864 bytes were trimmed      This is more than the amount of free space on the partition!               $ df -h /home     Filesystem      Size  Used Avail Use% Mounted on     /dev/sda2       206G   78G  118G  40% /home      Subsequent runs finish in less than a second, eg:               $ sudo fstrim -v /home     /home: 0 bytes were trimmed      Surely if I have always had the partition mounted with `discard`, `fstrim` should not trim a large amount of data like that? The `discard` option is definitely enabled, here are the relevant `fstab` lines:               UUID=xxxxxxxx...    /          ext4   noatime,discard,errors=remount-ro  0      1     UUID=xxxxxxxx...    /home      ext4   noatime,discard,errors=remount-ro  0      2      And `mount` output lines:               /dev/disk/by-uuid/xxxxxxxx... on / type ext4 (rw,noatime,discard,errors=remount-ro,stripe=128,data=ordered)     /dev/sda2 on /home type ext4 (rw,noatime,discard,errors=remount-ro,stripe=128,data=ordered)      The SSD is a TOSHIBA THNSNS256GMCP. Why does this happen?


How to capture the standard output of a script that depends on the user for some input?

There is a script that requires me to enter the password before it continues:               bash-3.2$ ./script.sh <parameter_list>     Enter the password for the Database:      ..     ..      I am interested in capturing the standard output of the script into a log file, while securely passing the password to the script. I tried to pass the password into standard input as follows:               bash-3.2$ echo "<password>" > /secure/path/password.txt     bash-3.2$ ./script.sh <parameter_list> < /secure/path/password.txt      But this doesn't seem to work. If it did, I could simply use `tee` to redirect the output to a log file. Could someone kindly point me in the right direction?


How to disallow GNU screen from making change to my putty window title

Currently whenever I open a screen session from within PuTTY, the window title of the PuTTY window changes to "screen". I would like to prevent this from happening. Please let me know what is the way to do it. Apologies if this is a duplicate question. Please note that I'm **NOT** asking about title of various sessions within screen (which can be set with `Ctrl`-`a``Shift`+ `A`). I'm asking about PuTTY's window title.


What is the command for listing all users who are members of the admin group?

I am looking for the name of the superusers list on Fedora. (On Ubuntu is seems to be "sudo".) I want to add one of the users to the superusers list. The `groups` command only lists the groups of the current user.


Difference between `info` and `pinfo`

What's the difference between `info` and `pinfo` besides color? `pinfo` is: > a program for viewing info files while `info` is: > Read documentation in Info format I tried to search the web for the difference between these two command, but found no useful information.


Find files with same name but different extensions, send to tgz

I have a large archive of edited images from my camera, each image is actually a pair of files - *.nef & *.xmp. I would like to go through all the folders and then zip these pairs into single tgz files. Each of the filenames in a directory is unique, so it would be sufficient to move the file names from output of `ls *.nef` to the command `tar -czf {filename}.tgz {filename}.*`, but I'm afraid I've no idea where to start. Thanks in advance.


Compiled a Kernel (2.6.39-rc1), where is the corresponding initramfs?

as I've already wrote in the topic, I compiled a new Kernel with `make defconfig`, the `bzImage` is where it there, so is `vmlinux.bin`. I've installed modules with `make modules_install`. Now, what is the next step? should I rename `bzImage` to my liking and put it into `/boot`? And how do I create an initramfs? `vmlinux.bin` is executable, is that my Kernel? I'm using GRUB, and I'm quite familiar with using and configuring it. But I'm having a hard time putting the kernel together.


rsync: how to relocate absolute symlinks?

I've pored over the rsync manpage as well as on several related questions here on serverfault. I've played with -R and -L and -l options, but no luck. Here is the question: when sending a dir from local to remote, is there an option (or option combo) that relocates symlinks relative to the local dir so that they become relative to the destination dir on the remote machine? Here is a minimal example of what I want to send: **local dir:** `/home/bob/foo`               /home/bob/foo/a --> /home/bob/foo/bar     /home/bob/foo/bar      and here is how I would like it to materialize in the **remote dir:** `/u/apps/foo`               /u/apps/foo/a --> /u/apps/foo/bar     /u/apps/foo/bar      For example, `rsync -az /home/bob/foo/ remote:/u/apps/foo/` doesn't quite do it; we end up with:               /u/apps/foo/a --> /home/bob/foo/bar     /u/apps/foo/bar      Whether `/home/bob/foo/bar` exists or not on the remote machine is irrelevant; in either case, the result is definitely not what I need.


How can I make "bind" command to work in sh shell

How can I make the next script to run when I'm using sh shell:               #!/bin/bash          bind '^[[3'=prefix-2     bind '^[[3~'=delete-char-forward     bind '^[[1'=prefix-2     bind '^[[1~'=beginning-of-line     bind '^[[4'=prefix-2     bind '^[[4~'=end-of-line      ![bind in sh](http://i.stack.imgur.com/vVYbW.png)


How to prepend a license header recursively for all .h and .cpp files in a directory

I'm trying to add a license header to all header files and source files in a project directory using a for loop. This is not working, is there any other approach using `sed`?


Getting second GPU monitors outputted as Multi-Display

**OS** Kali Linux 1.0.6 **Hardware** HD7950 x 3 BenQ Monitors x4 - 1920x1080 Kogan Monitors x2 - 2560 x 1440 **Xorg.conf** http://pastebin.com/JqTPUw7s **Situation** Currently I'm trying to get all 6 monitors running as a multi-display desktop. GPU1 is outputting the picture for Kogan monitors x 2 and BenQ monitors x 2 perfectly. The OS can see all AMD cards. The problem lies in the fact that when I try and get the two final monitors outputting from GPU2 the only selectable option for outputting is "Single Display Desktop", not multi- display desktop with the previous 4 working monitors. Any help would be greatly appreciated with this configuration issue. Any questions please ask.


Losing static IP and and getting DHCP IP

I have a Debian 7.1 machine that is our internal intrusion detection system running snort. It has started flaking on me and will pull a DHCP address even though I have it set to static. This happens every few hours. Here is my `/etc/network/interfaces`                   # This file describes the network interfaces available on your system         # and how to activate them. For more information, see interfaces(5).              # The loopback network interface         auto lo eth0 eth1         iface lo inet loopback              # The primary network interface         allow-hotplug eth0         iface eth0 inet static                 address 10.10.10.107                 netmask 255.255.255.0                 gateway 10.10.10.1              iface eth1 inet manual                 up ifconfig $IFACE 0.0.0.0 up                 up ifconfig $IFACE promisc                 down ifconfig down


Error sending message, child exited 71 (Operating system error)

I'm trying to send mail through mutt command. I got the error message **Error sending message, child exited 71 (Operating system error.)**. I was able to send email through this command earlier, but can't now. I don't know why it happen. I tried searching on Google but not got any appropriate answer. Any help would be appreciated.


Problem creating raw disk image and mounting it in rescue mode to QEMU

I am trying to create booting system from raw disk image. This is what I do:               $ dd if=/dev/zero of=system2.img bs=1M count=6000     6000+0 records in     6000+0 records out     6291456000 bytes (6.3 GB) copied, 69.3662 s, 90.7 MB/s     $ sudo fdisk system2.img     Command (m for help): o     Building a new DOS disklabel with disk identifier 0xdd22ed22.     Changes will remain in memory only, until you decide to write them.     After that, of course, the previous content won't be recoverable.          Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)          Command (m for help): w     The partition table has been altered!          Syncing disks.     $ sudo fdisk system2.img          Command (m for help): n     Partition type:        p   primary (0 primary, 0 extended, 4 free)        e   extended     Select (default p):     Using default response p     Partition number (1-4, default 1):     Using default value 1     First sector (2048-12287999, default 2048):     Using default value 2048     Last sector, +sectors or +size{K,M,G} (2048-12287999, default 12287999):     Using default value 12287999          Command (m for help): a     Partition number (1-4): 1          Command (m for help): w     The partition table has been altered!          Syncing disks.     $ sudo kpartx -avs system2.img     add map loop1p1 (252:0): 0 120832 linear /dev/loop1 2048     $ sudo mkfs.ext4 -U c0f21c98-ebf4-4f27-91b8-205da17c7893 /dev/mapper/loop1p1     mke2fs 1.42 (29-Nov-2011)     Discarding device blocks: done     Filesystem label=     OS type: Linux     Block size=1024 (log=0)     Fragment size=1024 (log=0)     Stride=0 blocks, Stripe width=0 blocks     15104 inodes, 60416 blocks     3020 blocks (5.00%) reserved for the super user     First data block=1     Maximum filesystem blocks=61865984     8 block groups     8192 blocks per group, 8192 fragments per group     1888 inodes per group     Superblock backups stored on blocks:             8193, 24577, 40961, 57345          Allocating group tables: done     Writing inode tables: done     Creating journal (4096 blocks): done     Writing superblocks and filesystem accounting information: done      Then I try to use this disk image QEMU and rescue mode (booting from debian netinst ISO). It offers me to mount `/dev/sda1`, but fails to do so. From `/var/log/syslog` it appears like it sees the `/dev/sda1` as FAT I have another disk image, which works with rescue mode. The only difference I could find between them is that, if I look at the working image with `cfdisk` I see first partition type as `ext4`. In failing image it says `Linux`


View stdout/stderr of systemd service

I have created a simple systemd service file for a custom application. The application works well when I run it manually, but my CPU gets maxed out when I run it with systemd. I'm trying do track down where my problem is, but I don't know where to find the output (or how to configure systemd to put the output somewhere). Here is my service file:               [Unit]     Description=Syncs files with a server when they change     Wants=network.target     After=network.target          [Service]     ExecStart=/usr/local/bin/filesync-client --port 2500     WorkingDirectory=/usr/local/lib/node_modules/filesync-client     Restart=always          [Install]     WantedBy=multi-user.target      Throughout the application, I output to stdout and stderr. How can I read the output of my daemon? Edit: I found `man systemd.exec`, which mentioned the `StandardOutput=` option, but I'm not sure how to use it. From the man page: > StandardOutput= > > Controls where file descriptor 1 (STDOUT) of the executed processes is > connected to. Takes one of **inherit, null, tty, syslog, kmsg, kmsg+console, > syslog+console or socket**. > > If set to inherit the file descriptor of standard input is duplicated for > standard output. If set to null standard output will be connected to > /dev/null, i.e. everything written to it will be lost. If set to tty > standard output will be connected to a tty (as configured via TTYPath=, see > below). If the TTY is used for output only the executed process will not > become the controlling process of the terminal, and will not fail or wait > for other processes to release the terminal. syslog connects standard output > to the syslog(3) system logger. kmsg connects it with the kernel log buffer > which is accessible via dmesg(1). syslog+console and kmsg+console work > similarly but copy the output to the system console as well. socket connects > standard output to a socket from socket activation, semantics are similar to > the respective option of StandardInput=. This setting defaults to inherit. Does this mean that these are my only options? I would like, for example, to put output in `/dev/shm` or something. I suppose I could use a unix domain socket and write a simple listener, but this seems a little unnecessary. I just need this for debugging, and I'll probably end up removing most of the logs and change the output to syslog.


cd and ls in the same call

I often have to `cd` to a directory and `ls` to see the directory listing. Can it be done with one shot, so that I can add to `.bashrc` as alias. I searched on Google, there were some answers, but incomplete.


Change Directory and List Files

> **Possible Duplicate:**   >  Make cd automatically ls I think that it would be very useful to have a unix utility that combines 'cd' and 'ls' so that when you change your directory, it automatically lists the files in that directory. I have tried to do this using shell scripts, and C programs and a combination of the two, but nothing seems to work, because any 'cd' or 'chdir()' call in a shell script/ c program only changes the directory for that instance (not for the shell). The psudocode would look like (if it was only this simple!):               cd $1     ls      If anyone has any ideas of how to implement this I would really appreciate it! Thanks, Kevin


XBMC Live TV setting to get network iptv channels

Im currently running Linux Mint 17-qiana cinnamon, and i wanted to test something that later i want to configure in a home media server that i will build. The thing is, i have a contract with an internet/phone/tv provider,Vodafone 50MB fiber, and their setup currently is a DVR TV box that is only connected to my router, their box gets the channels, and i was wondering if I could somehow get the channels too and view them with xbmc, hence, building an home media server that would be in my network and i could after that do everything... Visit websites, share content with my laptop... well everythin that a linux computer can do, but it would be connected to my projector so i could watch tv and movies. The thing here is, i've been looking online and the closest i can get to this is downloading m3u playlists for viewing the channels as if i didnt pay for them, which isn't my plan, since i already pay for the channels, i would like to not have to use their box, and instead connect a computer. I have noticed there is a channel search feature but only certain add-ons support that, first of all, does anyone know which add-ons support that? Second, would this solve the problem? Could the search find these channels? If this does not solve it, what could do what i want? Would i need to talk to the provider about this? Could they possibly give me access to their m3u playlist? im technically not infringing anything, i'm paying for the service and i only want to integrate it with my system, so i dont see a problem, but on the other hand, i dont know much about this live TV stream, and i'm afraid they might think i want to share this m3u list so people get free TV (i don't know if it is even possible) Sorry for the long post but most is for context, if there is anything i can clarify, just ask me to and i will. Thanks,


Linux-swap on reboot

I'm wondering what actually happens to a Linux-swap partition reboot. I've been taking a course in computer organization and while installing/partitioning a new drive I became rather curious about this.   1. As I understand it, Linux-swap partitions are more-or-less unallocated space within a partitioning scheme on a hard-drive that acts as a stack of memory in similar fasion to ram but had a larger databus waiting time (since it is a HDD/SSD managed in part by the drive itself rather than true ram managed directly by the CPU). Is this model correct?   2. Is information persistent until a Linux-swap tool cleans it, unlike RAM which is erased by a lapse in power?   3. Can you address it directly? Or in C/C++ by the assistance of the kernel (so as to not mess stuff up)?


What does the 'd' mean in ls -al results and what is that slot called?

In Linux, what does the `d` mean in the first position of `drwxr-xr-x`? And what are all of the possible letters that could be there, and what do they mean? I'm trying to learn more about the Linux file permissions system, and I'd like to see a list of the character meanings for the first slot.


Fix LVM physical volume definition after removing /dev/sdb

Recently I set up LVM partition with an new disc /dev/sdc. I created the LVM with the following commands:               pvcreate /dev/sdc     vgcreate data /dev/sdc     mkfs.ext4 /dev/data/srv     tune2fs -m 0 /dev/mapper/data-srv      Now the problem is that the old disc /dev/sdb is gone and I get errors in /var/log/messages like:               sd 2:0:2:0: [sdc]  Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK     sd 2:0:2:0: [sdc] CDB: Read(10): 28 00 00 00 00 3f 00 00 04 00     blk_update_request: 8 callbacks suppressed     end_request: I/O error, dev sdc, sector 63     sd 2:0:2:0: [sdc] Unhandled error code     sd 2:0:2:0: [sdc]  Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK     sd 2:0:2:0: [sdc] CDB: Read(10): 28 00 00 00 00 3f 00 00 04 00     end_request: I/O error, dev sdc, sector 63     sd 2:0:2:0: [sdc] Unhandled error code      Because the old disc /dev/sdb was removed after crating the LVM, /dev/sdc (which is no longer present) took its place:               >pvs       /dev/sdc1: read failed after 0 of 2048 at 0: Input/output error       PV         VG   Fmt  Attr PSize   PFree       /dev/sdb   data lvm2 a--  330.00g    0          >lvscan       /dev/sdc1: read failed after 0 of 2048 at 0: Input/output error       ACTIVE            '/dev/data/srv' [330.00 GiB] inherit      The partition works fine though /sdc is no longer present. Nevertheless how can I fix the LVM to no longer search for /dev/sdc? I think LVM uses UUIDs internally. Otherwise this scenario wouldn't recognize sdb as the correct pv (disc) .


Split the input file with line breaks

I am trying to insert line breaks on a file based on the same names which happens to be the second field in my file. So, my input file is like below.               17412193|name1|organization     43979400|name1|organization     1405541|name2|organization     53595498|name2|organization     50439202|name2|organization     54678379|name3|Not Found     21757330|name3|organization      So I am trying to get the output like,               17412193|name1|organization     43979400|name1|organization     ###linebreak inserted here     1405541|name2|organization     53595498|name2|organization     50439202|name2|organization     ###linebreak inserted here     54678379|name3|Not Found     21757330|name3|organization     ###linebreak inserted here      I am using this line break to split the input file to group the similar names together. I would later apply a similarity algorithm on these grouped names. So, for the above example, after the output I would apply the similarity algorithm on 3 pairs of names.


HTTP request failed after listening on multiple ports or after enabling SSL Module on my Linux Board

I have one custom Linux board on which I want to run apache web server to test HTML and other web based services. I have configured, cross compiled and installed default httpd (2.2.24, 2.4.1, 2.4.4 and 2.4.9) on my Linux PC (Ubuntu 12.04 LTS) as well as on my own custom Linux board. Then I have added support of SSL Module (mod_ssl) to test HTTP as well as HTTPS request. Both HTTP and HTTPS request works fine without any issue on my Linux PC (Ubuntu 12.04 LTS). But when I tried to execute same HTTP request on my Linux Board using httpd (2.4.4 and 2.4.9) at that time browser page goes into loading state and can not be came out from that situation after enabling SSL module. Also I have seen that HTTPS request works fine at that time. I have also did some debugging task through wire-shark tool and found that connection is established successfully after sending request through HTTP but can not get response of that request. I have also found that response of that HTTP request received on wire-shark after closing that HTTP requested page from browser. Also, I can run HTTP and HTTPS requests successfully using httpd (2.2.24 and 2.2.27) on my Linux Board but failed to execute same request using httpd (2.4.X) package. I have also changed some configurations by creating different virtual host for HTTP (Port 80) and HTTPS (Port 443) but still failed to execute that HTTP request. I have also tried to listen on different ports like (Listen 80 and Listen 8000) without SSL module (using httpd 2.4.4. and 2.4.9 ) at that time HTTP request goes into loading state. Can anyone has idea about this issue or help me to solve this type of issue?


How do I add a new user to an embedded Linux system by hand?

I have a system which was designed for use by root only and I want to run an FTP server on it. The software I use handles authentication by using same username and password as OS itself. To me it looks safer to have another user for FTP data transfer and another which would just run FTP server. So here's my problem: As I've said, system was designed to be used only by root and there's no useradd or anything similar, as far as I can see. Is it possible to add user by hand? I'm running OpenWRT Backfire 10.03.1-rc4, if it matters, but generic answers would be best.


Installing individual packages from Solaris .iso

I need to update the following packages:               SUNWjaf     SUNWjato     SUNWjmail      I read that the updated versions of these packages can be found on the latest version of Solaris, and that it's possible to just install the specific packages I want. I can only find them as directories in the .iso and they all have the following structure:               |-- archive     |   |-- none.7z     |-- install     |   |-- copyright     |   |-- depend     |   |-- i.none     |-- pkginfo     |-- pkgmap     |-- reloc      Is it possible to install these as some sort of package? Or turn them into a .pkg? Thanks for any help.


Can I get infected in this case if I run a live cd?

I recently got rid of a nasty trojan on Windows and want to migrate to Linux(Ubuntu). I want to run a Live CD so that I can format an SD card to put my brand new firmware on my router and format the HDD so I can install Ubuntu. In this case, is it possible to get my system infected or to infect the SD card? I mention the fact that my Windows 7 is a genuine license and also my nod32 but I do not trust the fact that my virus is gone.


Confusion regarding the term 'mount' in Linux

I am reading the man page of mount and clone. I understand that mount is used to add a directory hierarchy to a mount point (a directory). In clone's man page, under the CLONE_NEWNS section, they refer to mounts as the file hierarchy as seen by a process. My question is that, is the term 'mount' being used to refer to the individual directories in the directory hierarchy seen by a process, and 'mount points' used to refer to the directories where file systems can be mounted ?


Make Ubuntu acknowledge that a custom built version of PHP is installed

I'm trying to install PHP from source code on my Ubuntu 12.04 VPS. I'm installing PHP like this:   1. Download the latest version from the php.net website.   2. Configure it using the parameters below.   3. Install any dependencies when necessary. (libxxxxx-dev)   4. Then do a make   5. Then a make install   6. Move the php.ini file and the fpm configuration files in the right place I'm using these parameters in the configure command:               --enable-intl     --with-openssl     --without-pear     --with-gd     --with-jpeg-dir=/usr     --with-png-dir=/usr     --with-freetype-dir=/usr     --with-freetype     --enable-exif     --enable-zip     --with-zlib     --with-zlib-dir=/usr     --with-mcrypt=/usr     --with-pdo-sqlite     --enable-soap     --enable-xmlreader     --with-xsl     --enable-ftp     --with-curl=/usr     --with-tidy     --with-xmlrpc     --enable-sysvsem     --enable-sysvshm     --enable-shmop     --with-mysql=mysqlnd     --with-mysqli=mysqlnd     --with-pdo-mysql=mysqlnd     --enable-pcntl     --with-readline     --enable-mbstring     --with-curl     --with-pgsql     --with-pdo-pgsql     --with-gettext     --enable-sockets     --with-bz2     --enable-bcmath     --enable-calendar     --with-libdir=lib     --enable-maintainer-zts     --with-gmp     --enable-fpm      Now, this goes all well and good. The version works as expected and during the installation I had no trouble. Now the fun stuff comes. Whenever I want to install something like `mcrypt` (for example) I would normally type `apt-get install php5-mcrypt` but when I do, and take a look at the dependencies I see that PHP5 is still listed as one and will be installed once I hit `y` (overwriting my own version). Now the real core of my question is, how do I let Ubuntu know that I already have PHP5 installed so that it does not attempt to install PHP5 as a dependency anymore. Do I have to change something in the configure process? Do I have to install PHP5 using the `apt-get` manner first, remove it manually, and install my own version of PHP after. It is worth mentioning that I need this custom PHP build to make Pthreads work since there isn't a repo that offers a ZTS version of PHP (yet, please make one, somebody?).


Why current directory doesn't change in makefile?

I'm trying to run a simple script- clone a git repository into a certain directory, then `cd` to this directory in order to execute an installation script. This script is in a Makefile. But the `cd` seems not to be working. It doesn't find my installation script. I added a pwd after the `cd` in the script, and it shows me the directory from where I'm executing the script, not the directory where I `cd` into. What's the problem?               git clone http://somerepo ~/some_dir     cd ~/some_dir/     pwd     python myscript.py install      => `pwd`: `/hereIsPathToDirectoryFromWhichIRunTheScript` > python: can't open file 'setup.py': [Errno 2] No such file or directory It also doesn't work with `./setup.py`. If I enter the absolute path `~/some_dir/setup.py` the script fails later because it's trying to access resources in the same folder.


Unable to use dumpfilter command to filter and dump sub folder of a repository

I am using `svnadmin dump E:\Repositories\OR1234 | svndumpfilter include Test > E:\123.dump` to dump a particular sub folder in the repository. I am successful in uploading the dump to the new repository when I filter out a immediate sub folder in a repository, i.e Test. (I am also able to upload the dump of entire repository to a new repository by `svnadmin dump` command.) e.x:               Repo123     -Test     -Test1..      But when I try to use `dumpfilter` command to dump the sub folder of Test, i.e Test1, then it dumps the file. When I use `svnadmin load` command to load the dump of Test1 to new repository, then the size of the new repository increases but nothing can be seen in the repository browser.


Linux routing table entry disappears

I run Fedora 20 (3.13.10-200.fc20.i686) inside VirtualBox on a Windows 7 SP1 host. The Ethernet adapter on the guest is configured as a Bridged Adapter in VBox, and gets an IP via DHCP. Here's the routing table on the guest:               Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         router          255.255.255.255 UGH   1024   0        0 p2p1     default         router          0.0.0.0         UG    1024   0        0 p2p1     192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 p2p1      Every so often (every day, perhaps), the 1st entry in the routing table disappears; as a result, I can make outbound connections to the intranet, but not to the Internet. How do I find out who's modifying the routing table? Are there logs I could look at? [P.S. I asked this on superuser, but got no response, so trying here.]


Move completed torrents in rTorrent according to label

I've got a seedbox with rTorrent (and ruTorrent) installed, and I'm trying to automate as much as possible... Currently, I've got this in my rtorrent.rc to move completed files to ~/Download:               system.method.set_key = event.download.finished,move_complete,"execute=mv,-u,$d.get_base_path=,~/Download/;d.set_directory=~/Download/"      And then I've got a script that rsyncs those completed files back to my home computer... I've got ruTorrent set to apply labels to torrents, and I'd like to move files according to the labels instead of moving them all to the same folder. I can't find any documentation at all, though. There are lots of examples of configuring rTorrent for 'common tasks', but nothing that I've been able to use to infer how to even check labels, never mind move completed torrents according to the labels...


How to detect RAID 0 from Ubuntu Live CD?

I have Ubuntu 10.04 installed on a server with RAID 0 configuration. The server has many user accounts and the users have a lot of data in the server. The server has been crashed due to removal of certain packages and now there is kernel panic during startup. How do I now take backup of the data present in RAID 0? Can I use a Ubuntu Live CD? Will it be able to detect the RAID 0? What do I need to do for the detection of RAID 0 from Ubuntu Live CD? I do not want to lose the data. Is there a way to install Ubuntu without losing any data. Is there any other way to take back of all the data present in RAID 0?


How to delete line if longer than XY?

How can i delete a line if it is longer than e.g.: 2048 chars?


Linux - command to list files (except ls)

> Imagine you were working on a system and someone accidentally deleted the > `ls` command (`/bin/ls`). How could you get a list of the files in the > current directory? Try it. I tried many methods and also searched on the Internet but nothing. I want to ask beside `ls` command what command can we use to list out all the files.


Bash for loop create folders; do I have to escape some chars?

I want to create 5 files with the same name but with an incremental counter. If I do:               for i in {1..5}; do touch hallo_$i; done      I get `hallo_1`, `hallo_2`, `hallo_3`, etc. If I do:               for i in {1..5}; do touch company-price-$i_spec.rb; done      I get: `company-price-.rb` Do I have to escape something? Could it be that bash thinks I want to remove/subtract from the `$i` variable? If I escape `.` and `-` I still got the same result. Any hints?


The future of OpenSolaris

since OpenSolaris is more or less abandoned by Oracle, is there a nice alternative that implements the unique features of OSOL? ZFS is one thing, but I liked the image creation system, that let you create images of a master system and then distribute it quickly to other computers. This was an effort to simplify creation of clusters. According to the Wikipedia page of OSOL, there's Illumos, which is a fork of OSOL, with all closed source parts replaced by open source parts. Illumos is in active development. But is Illumos an alternative to OSOL, with all it's features? Is anyone using it and could tell us his or hers experiences?


How do I write a script to keep retrying Yum Update Program?

My job let me always release a new version of the program to a satellite server, then in the running server, I use `yum update program` to update the program. However, due to unknown reason, in most of times, even if I upload the program to the satellite server, `yum update program` can't get the update soon. I always have to wait, keep retrying, etc. So anyone can tell me how to write a script, so   1. it keeps retrying `yum update program` if no update available   2. if update is available, then the update in yum is forced   3. after successful update, the script quits. Thanks


How do I keep 'indent' from moving curly braces to the next line?

I have several empty inline function definitions in C++ like so:               class C     {         void foo(){}         void bar(){}     };      now if I run `indent -st -i4 -nut test.cc` in order to just fix the indentation I get               class C     {         void foo ()         {         }         void bar ()         {         }     };      But I just want to fix the indentation without moving curly braces around! How can I achieve that?


repairing a damaged grub with centos

I have a damaged grub in my centos system. to repairing this problem, I use rescue mode and then I execute this follwing comand :               chroot /mnt/sysimage          grub-install /dev/mapper/ddf1OSp3          and then reboot ;      when boot from hard disk, it's sshow error message "file not found" when I execute the same comand in grub.conf under grub CMD, it s work fine and the file existe !! how to proceed to resolve this problem information about system : linux kernel 2.6. repartition of disk:               $ df          /dev/mapper/ddf1OSp3    /          /dev/mapper/ddf1OSp1    /boot          /dev/sdd1               /data          tmpfs                   /dev/shm


Blank lines of unknown origin when running vim after tput clear

I have a rather bizarre issue with terminal behaviour. If I execute `tput clear` to clear the screen, my cursor (as expected) goes to the top of the terminal. If I run `vi` after that (`vim` actually), when it exits there are some blank lines before the next prompt. When I do that normally, the prompt simply shows up at the next line. The following shows a transcript after `tput clear` and running `vi` twice (simply exiting each time):               +--------------------------+     |pax> vi                   |     |                          |     |                          |     |                          |     |pax> vi                   |     |pax>                      |     :                          :     +--------------------------+      As you can see, the first execution left three blank lines between the prompts, the second left none. Other terminal manipulation style programs like `less` don't exhibit this behaviour. There's nothing the least bit suspicious in my `PS1` prompt variable, it's simply set to `"pax> "` with absolutely no funny characters or escape sequences. What could be causing it? Environment: running Debian 7.3 (from `/etc/debian_version`), vim 7.3 (from `vim --version`), Gnome Terminal 3.4.1.1 (from `gnome-terminal --version`), `uname -a` output of:               Linux paxbox01 3.2.0-4-686-pae #1 SMP Debian 3.2.51-1 i686 GNU/Linux


Finding function parameters for functions in shared object libraries

I am currently fiddling around with some c libraries without documentation. I am wondering if it is at all possible to retrieve more metadata, such as parameters and return values, outside of what is provided by calling `nm -D` or `objdump -T filename | grep text`. I'm not sure if this is possible, but if it is, it saves me from hunting down whoever was in charge of the library! Edit: I'd like to be able to do this without reading machine code if possible. It appears that there are some solutions that allow me to do so easily if I was an expert at machine code, but since I am not and do not have the current desire to jump down that rabbit hole, I'm really hoping there is another way.


Backup 'empty' parts of disk drive

I have a USB drive which has around 7MB of 'empty' space at its beginning. The first partition in MBR starts at 8225kB, according to Parted. How can I back up this space using something like `dd`? I've already backed up the MBR table using `dd if=/dev/sdX bs=512 count=1 of=device.mbr`. How can I give dd a byte range in the disk to grab and then write that locally to a file on disk?


Use a keyboard shortcut to switch between synergy-"ized" monitors/windows

Is it possible to map a command to my keyboard so that I can switch between my various windows? I checked on the synergy website but was not able to find very much about the subject. I'm trying to be able to essentially alt+tab and cycle through all the applications I have running on all my computers. It's not necessary that all windows show up on the main screen but I'd like to be able to shift focus to a different window without having to move my mouse.


How can I find and filter a specific column in a .csv file?

I have .csv files with the following structure:               cat,dog,mouse,pig,bird,cow,...     21,34,54,566,78,1,...     23,10,12,569,56,4,...     32,20,13,123,56,3,...     34,30,44,322,66,2,...      I want to filter the column related to the mouse, for instance:               54     12     13     44      How do I do it? Please keep in mind that I do not know in which column the mouse is found (my files are quite large, there are several files to filter, and the positions of the columns vary). If I knew the exact position, I could use, for instance:               cat $file | awk '{printf("%s\n", $3);}' > filtered_file      What if I do not know the mouse is in column 3? I really appreciate any help.


Is it possible to copy data from one screen session to another?

I recently needed to copy X amount of lines from a file, that I opened in `vim` and then paste them to another file opened in a different screen session (and different server). So on screen #1 I ran in `vim`: `:15,20y` and on screen #2 I tried to use `p` to paste the lines, but I couldn't because the register was empty (to be honest, I was expecting that but I just wanted to give it a try). I eventually worked my way around in order to get those lines to the right place, but I wonder if it is possible to copy-paste data between screen sessions.


Can't map XF86AudioRaiseVolume key in QJoyPad

I wanted to map my PSone gamepad to do some basic KDE/keyboard/mouse functions and everything works well except one thing. I use logitech ultra-x keyboard which has a few multimedia buttons (play, home, volumeup, volumedown..) and I wanted to map `volumeup` and `volumedown` keys to my pad with everything else. `volumedown` works well, but `volumeup` makes some trouble. after I start qjoypad and map it - it does work but after mapping it I still see the "[NO KEY]" (while it is doing its job - volumeup; that's strange).. after I turn qjoypad off and on I get this error: "Error reading button 6" and after that "Error reading definition for joystick 0". This is my layout:               QJoyPad 4.1 Layout File          Joystick 1 {         Axis 4: gradient, dZone 6505, maxSpeed 11, tCurve 2, sens 2, mouse+h         Axis 5: gradient, dZone 6264, maxSpeed 11, tCurve 2, mouse+v         Button 1: key 114         Button 2: mouse 3         Button 3: mouse 1         Button 4: key 113         Button 5: key 122         Button 6: key 123         Button 7: key 62         Button 8: key 105         Button 9: key 23         Button 10: key 65     }      With `xev` I got it what 122 and 123 are (they work normaly under KDE when I press them, it's just that 123 wont map and stay mapped for my pad)               keycode 122 = XF86AudioLowerVolume     keycode 123 = XF86AudioRaiseVolume      Any hint on what I should do to fix this and make my configuration stay? If it means anything, or helps anyhow - system is arch with 2.6.35 kernel, kde 4.5.1.


Uname gives unfamiliar timestamp for kernel

I'm recompiling a new kernel (adding some debugging info) on Ubuntu by doing the following:               make vmlinux; make install;      after this I do a reboot and select my new custom kernel from the list. However, when I do:               uname -a      I get a timestamp that doesn't correspond to the last time I built the kernel. When I look in /boot not a single file in there matches up with this timestamp. Also, my changes aren't showing up in the log files. What could be going on here?! Thanks!


sed: match two lines

I have a text file, where records are split on two lines. I would like to put them on one line. The records look something like this:               2013-07-29      apt-get install git     2013-07-29      apt-get install rsync     2013-07-31      apt-get install nmap     2013-08-02      apt-get install cifs-utils     2013-08-05      apt-get install telnet      I would like to get the following:               2013-07-29 apt-get install git     2013-07-29 apt-get install rsync     2013-07-31 apt-get install nmap     2013-08-02 apt-get install cifs-utils     2013-08-05 apt-get install telnet      I tried with `sed`, but I am unable to match two lines. Is there some trick in `sed`, or is there some better tool ?


Grub-customizer: error while loading shared libraries: libarchive.so.13: cannot open shared object file: No such file or directory

I wrote this question at stackoverflow and got recommended I prob would have a better shot here. So I'm trying to install grub customizer so I can make Windows the default OS to boot since I use that more frequently (I'm sorry). Anyway, I finally got it isntalled, but now I can't start it cause of the error message in the description. My real problem is that, that file do exist... I think... I am a real linux novice. I've only used it from now and then for roughly 6 months. Mostly worked with the allready installed software and other times apt-get has worked! Anyway! Here is what I get in my terminal.               root@ninjaPanda:~# gksu grub-customizer     grub-customizer: error while loading shared libraries: libarchive.so.13: cannot open shared object file: No such file or directory     root@ninjaPanda:~# ls -l /usr/local/lib/     total 8056     drwxr-sr-x 2 root staff    4096 Aug 29 13:30 grub-customizer     -rw-r--r-- 1 root staff 5217320 Aug 29 13:26 libarchive.a     -rwxr-xr-x 1 root staff     997 Aug 29 13:26 libarchive.la     lrwxrwxrwx 1 root staff      20 Aug 29 13:26 libarchive.so -> libarchive.so.13.1.2     lrwxrwxrwx 1 root staff      20 Aug 29 13:26 libarchive.so.13 -> libarchive.so.13.1.2     -rwxr-xr-x 1 root staff 3002216 Aug 29 13:26 libarchive.so.13.1.2     drwxr-sr-x 2 root staff    4096 Aug 29 13:26 pkgconfig     drwxrwsr-x 4 root staff    4096 Aug 27 18:45 python2.6     drwxr-xr-x 4 root root     4096 Aug 27 18:45 python2.7     drwxrwsr-x 3 root staff    4096 Aug 27 18:45 python3.2     drwxr-sr-x 4 root staff    4096 Aug 27 18:45 site_ruby      Edit: Someone told me it could Possibly /etc/ld.so.conf does not contain /usr/local/lib. and asked me to run this.               root@ninjaPanda:~# ldd grub-customizer     ldd: ./grub-customizer: No such file or directory


How can I peek at the output of a running crontab task on OpenBSD?

I have an hourly hour-long crontab task running with some `mtr` (`traceroute`) output every 10 minutes (that is going to go for over an hour prior to it being emailed back to me), and I want to see the current progress thus far. On Linux, it can be done by accessing the open fd of the temporary file to which the results of the script are saved. How can I do this on OpenBSD? I've tried doing `fstat | fgrep -e USER -e cron -e mtr`, but couldn't find any temporary files at all.


How can I access a deleted open file on Linux (output of a running crontab task)?

I have an hourly hour-long crontab job running with some `mtr` (`traceroute`) output every 10 minutes (that is going to go for over an hour prior to it being emailed back to me), and I want to see the current progress thus far. On Linux, I have used `lsof -n | fgrep cron` (`lsof` is similar to BSD's `fstat`), and it seems like I might have found the file, but it is annotated as having been deleted (a standard practice for temporary files is to be deleted right after opening):               COMMAND     PID       USER   FD      TYPE     DEVICE  SIZE/OFF       NODE NAME     ...     cron      21742       root    5u      REG      202,0      7255      66310 /tmp/tmpfSuELzy (deleted)      And cannot be accesses by its prior name anymore:               # stat /tmp/tmpfSuELzy     stat: cannot stat `/tmp/tmpfSuELzy': No such file or directory      **How do I access such a deleted file that is still open?**


Scripting vmware-player with Windows in Linux

I have a Windows XP virtual machine, that I run with vmware-player on Linux. In the virtual machine, I have a .bat script that reads some input from a given place (insite the machine's virtual disk), does something with it and puts it somewhere (again, in the virtual disk). What I want to do is somehow "automate this". To be more exact, what I want to do is:   * run the vmware machine in the player    * somehow copy input file from the "regular computer" to the virtual machine   * run the .bat script in the Windows XP    * after the .bat script is done, copy the file "out"   * and then turn off the virtual machine (just suspending is fine) I would suspect this will be quite simple, but I have no idea where to look. I hope this question is on-topic, since the _outside machine_ is running Linux. However, it is slightly Windows-related too, since the _virtual_ machine runs Windows XP.


Linux drivers for Ricoh Aficio SP 100SU

Does anyone have a driver for the Ricoh Aficio SP 100SU on Linux? Any directions to correctly install it and have the printer work?


Install Tribes: Ascend on Linux Mint?

I've been able to install any game that I want besides Tribes: Ascend. I'm trying to install it on Wine 1.4.1, and I get the following install error: `Failed to start the Hi-Rez Authentication and Update service` I've done a plethora of research looking for this game ported to Linux and any possible bugs. I've found this bug, but no fix for it. Does anyone know a workaround for this game?


Semi-asynchronous pipe

Assume I have the following pipe:               a | b | c | d      How to wait for completion of `c` (or `b`) in `sh` or `bash`? This means that script `d` can start any time (and does **not** need to be waited for) but requires complete output from `c` to work correctly. The use case is a `difftool` for `git` that compares images. It is called by `git` and needs to process its input (the `a | b | c` part) and display the results of the comparison (the `d` part). The caller will delete input that is required for `a` and `b`, this means that before returning from the script, process `c` (or `b`) must terminate. On the other hand, I cannot wait for `d` because this means I'm waiting for user input. I know I can write the results of `c` to a temporary file, or perhaps use a FIFO in `bash`. (Not sure if the FIFO will help, though.) Is it possible to achieve this without temporary files in `sh`? **EDIT** : Perhaps it would be sufficient if I could find out the process ID of the `c` (or `b`) process in a reliable fashion. Then the whole pipe could be started asynchronously, and I could wait for a process ID. Something along the lines of               wait $(a | b | { c & [print PID of c] ; } | d)      **EDIT^2** : I have found a solution, comments (or still better solutions) are welcome.


appendable and greppable archive on CentOS to hold many log files (logrotate on steroids)

I have a bunch of applications on a CentOS 6.3 box, which generate daily logs (text files with a very similar content) in this vein:               /data/logs/app/my-2014-06-29.log     /data/yet_another_app/logs/catalina.20140629     /data/in_fact/there_are/around_500_such_paths/2014-06-29-1.log      I need to keep 5 years of these logs. I currently treat them in a traditional Unix way, just compressing them in place (as `.log.bz2`), but I'm unhappy they still occupy a lot of space. I feel I could save a lot of space but compacting them and then compressing (think one giant .zip that holds entire year of logs). Requirements: ## RHEL kosher No "compile from source" please. If it isn't mature enough to be distributed in an .rpm then it's not for me. ## grep Archive should allow a recursive grep (like `grep -rli`):               grep_my_zip  -rli  pattern   /this/and/that/wildcards/2014-06-*      The archive shouldn't de-compress everything when grepping, just the files that match a wildcard. ## append Each week I'm putting my files into the _same_ archive and deleting them from filesystem:               append_and_remove   $( find /this/and/that  -name '*.log' -type f -mtime +31 )     # weekly log cleaning job      This is not the weekly archive, I want to append to a single big yearly archive each week. ## MS Windows access Archive, while mainly operated on CentOS Linux, should also allow a single file retrieval on Windows for emergency purposes (so a squashfs-style filesystem is not a viable option). ## Optional stuff (a plus, but not neccessary)   * append should be space effective - consider that previous log files are very similar to the current log files   * logrotate integration for the weekly job   * grep_my_zip that works on Windows   * archive could also be updateable (i.e. writable), not only appendable Originally posted on this pitiful sibling


Specific directory permission for one user using sftp

My web server structure looks like this:               /Home/User/Public_Html/Website_one                           /Website_two                           /Website_three/Directory_one                                         /Directory_two                                         /Directory_three                                          /Directory_four      Now, I need my friend to have access from this server only to `Directory_two` and `Directory_four` under `website_three`. I have created an SFTP account based on SFTP Jails. I also created a `home` folder for him and SFTP works fine. But the problem is I couldn't give him access to those directories with sub files. How can I give him access only to `Directory_two` and `Directory_four`?


mutt: macro for saving messages to a folder

This is an expansion on my previous question. I have following macro, which will save **tagged** messages to my `archive` folder.               macro  index  S  ":set confirmappend=no delete=yes\n<tag-prefix-cond><save-message>=archive\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n"      and a second macro for doing the same action, but on the current message (not tagged):               macro index A ":set confirmappend=no delete=yes\n<save-message>=archive\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n"      Is there a way to combine these two macros into one? I.e., I would like a macro that does following action when I press `S`:               a) in case any messages are tagged, move all of them to `archive`     b) in case no messages are tagged, move current message to archive


Is the FreeBSD login program compatible with AFS?

Is FreeBSD's `login` program compatible with AFS, so you can just login normally instead of using the `kinit` method (this is possible according to the OpenAFS manual)?


How can I script the creation of a single partition that uses the entire device?

I am specifically using this to partition and mount EBS volumes on Amazon EC2 instances, but really this should be generally applicable to initializing any new drive. As the question says I want to script the creation of a single primary partition which uses all available space on the given device. I won't know ahead of time how big the device is and it could be very large (i.e. several TB). In researching this it seems `parted` is the best command to use for scripting. I think something along the lines of `parted /dev/sdf mkpart primary 0 END` is what I want, but I'm having a hard time figuring out an elegant way to determine what END should be. Does anyone know an easy way to do this?