Repeat each line multiple times

Would like to have each line in a file repeated a fixed number of times. e.g. have each line repeated four times:               a     b     c      becomes:               a     a     a     a     b     b     b     b     c     c     c     c      I've done some searching, and there are a lot of questions and answers along the lines of doing the reverse, e.g. merging duplicate lines into single lines, and maybe a few about doubling lines by printing them again. It would be easy to do this in C, but I wish I knew more about the native commands so I wouldn't have to resort to these kinds of one-off throw-aways all the time.


how do i redirect output from tailf & grep to a file

All I wanted is to grep for specific lines in an ongoing log and re-direct it to some file..               tailf log | grep "some words"      Now, I want the above command output to get re-directed to some file in on- going basis.... I tried,               tailf log | grep "some words" >> file      But that doesn't seem to work. What am I missing?


Can virtfs/9p be used as root file system?

Is it possible to use a folder shared from the host to the guest via virtfs/9p as the root file system inside the guest? Loosely related to my previous question: Can virtfs/9p be used to share the same host folder with multiple guests?


Why can't I pgrep a process?

$ ps aux | grep -i ssh     USER      4364  0.0  0.0   9004  1032 ?        Ss   12:20   0:00 ssh -v -fND localhost:4000 USERNAME@SERVER-IP-ADDRESS          $ pgrep localhost:4000      Why doesn't this work?


Problems in installing firefox 23 on centos 6.3 ( libpangoft2-1.0.so.0)

XPCOMGlueLoad error for file /home/xd/firefox/firefox/libxul.so: libpangoft2-1.0.so.0: cannot open shared object file: No such file or directory Couldn't load XPCOM. I cannot find a way to install libpangoft2-1.0.so.0 After searching, it _seemed_ to me that the library will be in the pango package. Accordingly, I tried yum install pango but get this Package pango-1.28.1-7.el6_3.x86_64 already installed and latest version Nothing to do How do I get this installed. PS: It is surprising that centos 6.3 needs to be upgraded to install firefox 23. I had to install libstdc++.i686, dbus-glib.i686 and it seems I have to install some more to get this browser to work. Same results with chrome


Can <Location /> be for multiple virtual hosts in httpd.conf?

I have 5 virtual hosts in `httpd.conf`. All of them have the configuration below except for one.               <Location />         Order Deny,Allow         Deny from all         Allow from IP.ADDRESS.GOES.HERE     </Location>      I think it would be better to tell all virtual hosts to have this except for one. Currently, I am telling each virtual host one by one to have this. Is there a wild card method to apply this setting to all virtual hosts and then remove this stanza from one of the virtual hosts in `httpd.conf`?


Search in mutt by date and time

I've been using `mutt` for some days now, and I think I have the basics by now. I'm able to search messages by date (`l`, `~d date ...`) but what I need is to also search by time. Is it even possible?


How do I delete a file whose name begins with "-" (hyphen a.k.a. dash or minus)?

How do you remove a file whose filename begins with a dash (hyphen or minus) `-`? I'm ssh'd into a remote OSX server and I have this file in my directory:               tohru:~ $ ls -l     total 8     -rw-r--r--    1 me  staff  1352 Aug 18 14:33 --help     ...      How in the world can I delete `\--help` from a CLI? This issue is something that I come across in different forms on occasion, these files are easy to create, but hard to get rid of. I have tried using backslash               rm \-\-help      I have tried quotes               rm "--help"      How do I prevent the minus (dash or hyphen) character to be interpreted as an option?


How do I delete a unfortunately named folder?

In an unfortunate series of events, I happened to create a folder named `\--bindir=`. Thing is, I cannot `cd` to him because when I try to `cd` I get this message:               bash: cd: --: invalid option     cd: usage: cd [-L][-P [-e]]] [dir]      I also get similar messages for other binaries I am executing with that as a parameter, e.g `rm -rf`, `rmdir`, `ls` etc. I know this sounds funny, and like those epic fail stories, but I would be glad if you could propose a fix, because I'm all out of them. As a post of proof that I am not trolling or anything, here is a picture of that epic fail: ![enter image description here](http://i.stack.imgur.com/F59yH.png)


Linux Rename File Beginning with "--"

> **Possible Duplicate:**   >  How do I delete a file whose name begins with "-" (hyphen a.k.a. dash or > minus)? This is an awkward one, I have received some files from a windows machine which have been named things like               "----index.html"      When I try to grep hello * in a directory containing these files I get grep errors and when I try to mv ----index.html index.html there are similar errors:               mv: unrecognized option '----index.html'     Try `mv --help' for more information.      Can anyone shed any light on this? Thanks


How can I create a empty file whose name begins with a dash?

How can we create a empty file with the unix name `-stuff`. It means the name start with `-`. I tried with `touch -stuff` but it didn't work.


Handling an option-like filename in the shell

> **Possible Duplicate:**   >  How do I delete a file whose name begins with "--"? Due to mismatched switches when I was trying to run a command, I have a log file named `-w` in a directory. I want to see its contents with `cat` (or `less`) and then delete it. I've tried escaping it with backslashes, single-quotes, double-quotes, parentheses, and backticks, but `cat` always complains that `w` is an unknown option. How can I properly reference this file?


Why do many CLI apps take a single “--” argument?

> **Possible Duplicate:**   >  What does “--” (double-dash) mean? There are many command line tools that take a single "--" argument. For example:               gem install mysql -- —–with-mysql-config=/usr/local/mysql/bin/mysql_config      It seems to be used as some kind of separator. Does it have a special meaning? Is it a commonly used idiom? If so, what's its purpose? PS: I'm not talking about arguments of the form `\--argument`, I'm talking about when you have a `\--` followed by white characters and other arguments.


How can I remove a file called "--help" with bash command line?

I've somehow managed to create a file with the name "--help". If I try to remove the file using "rm" funny stuff happens. Please help here's a printout of the dir listing:               [pavel@localhost test]$ ls -la     total 3640     drwxrwxr-x.  5 pavel pavel    4096 Jun 19 18:33 .     drwxrwxr-x.  6 pavel pavel    4096 Jun  9 12:23 ..     -rw-rw-r--.  1 pavel pavel 1070592 Jun 12 09:40 --help


What does - mean with association to Linux files and directories

> **Possible Duplicate:**   >  What does “--” (double-dash) mean? What does '--' (two dashes) mean with association to Linux files and directories. I've found something else but not too sure if it is correct and relates to the same thing. "Another convention is to use '--' (two dashes) to indicate the end of flags, and the beginning of file names."


deal with file names with "-" as beginning on linux

> **Possible Duplicate:**   >  How do I delete a file whose name begins with “-” (hyphen a.k.a. dash or > minus)? I'm using linux I have some files with file names like               -0fdlfld     -xfifd      I want to delete them using shell "rm" but it doesn't work are there anyways to deal with such file names? thanks!


What does "--" mean in Linux/Unix command line?

> **Possible Duplicate:**   >  What does “--” (double-dash) mean? `git diff [options] [<commit>] [--] [<path>…]` In here, how should I understand what [--] means? And when should I use it.


What good are the signs '-' (minus) in any Linux/UNIX commands?

> **Possible Duplicate:**   >  What does "--" (double-dash) mean?   >  Single dashes `-` for single-character options, but double dashes `\--` for > words? I was reading the man zip page and I found this examples: [...] using the command **unzip -p backup | tar xf -** When [...] For example, **tar cf - . | zip | dd of=/dev/nrst0 obs=16k** is equivalent to **tar cf - . | zip - - | dd of=/dev/nrst0 obs=16k** I' like know the minus utility of these cases. Why two minus signs are written in the third case?


zip a directory that name start with `-`

How can I zip a directory like `-foo`? `$ zip "-foo" "-foo"` shows only help page. I think `-foo` is recognized as a options, but I don't know how to solve it.


how to remove a file named "-f" from the command-line?

Here are some options a) rm -f b) rm "-f" (double quotes) c) rm '-f' (single quotes) d) all of the above e) none of the above


What does "--" (double-dash) mean? (also known as "bare double dash")

I have seen `\--` used in the `compgen` command. For example:               compgen -W "foo bar baz" -- b      What is the meaning of the `\--`.


Why cat, grep and other commands can't understand files starting with minus sign?

If I have a file which name starting with single or several minus sign, for example `\--1` it can't be used as a parameter of many commands. Even if I run               cat --1      instead of file content I get unrecognised option error message:               cat: unrecognized option '--1'      Same effect appears when I type               cat "--1"     cat '--1'     cat \-\-1      nothing works. Files starting with '-' is not illegal in file system, but it is quite hard to work with them in cli and scripts. OK, in case of `cat` or `grep` I can use               cat <--1      and this will work, but               rm --1      won't work either and it is quite hard to substitute this command with something else. Very uncomfortable after all. Is there any universal workaround different from not using such file names? BTW, if name file is single `-` and all most of commands will understand it as `stdin`, wouldn't they? And it would be hard not to use such file names since I can't rename them all in script using `mv` command either.


Why do we use double hyphen in "tar --anchored" and single hyphen in "tar -b"?

Why do we use double hyphen in `tar --anchored` and single hyphen in `tar -b`? I mean to say why some command line options have single hyphen (-) while some others have double (--)? Also a `git` example:               git commit --amend     git commit -a


delete file with name --help.tgz

I have file with name `\--help.tgz`. I want to delete but don't know how. I tried `rm "--help.tgz"`, `rm \\-\\-help.tgz` and it did not work. How can I delete a file with such name?


How to remove/rename file which contains special character eg. "-x" using command line

> **Possible Duplicate:**   >  What does “--” (double-dash) mean? Can anybody explain me below things i have file named "-xyz". if i try to remove or move that file using command line , it's unable to move. i tried below things :               [rahul@srv100 ~]# ls -lrt  -- "-xyz"     -rw-r--r-- 1 rahul rahul 0 Dec 19 08:06 -xyz     [rahul@srv100 ~]# mv "-xyz" xyz     mv: invalid option -- x     Try `mv --help' for more information.     [rahul@srv100 ~]# mv \-xyz xyz     mv: invalid option -- x     Try `mv --help' for more information.     [rahul@srv100 ~]# mv -\xyz xyz     mv: invalid option -- x     Try `mv --help' for more information.     [rahul@srv100 ~]# mv '-xyz' xyz     mv: invalid option -- x     Try `mv --help' for more information.      finally i rename that file using winscp, and after trying multiple ways i got one option and it's working.               mv -- '-xyz' xyz      Wish the help of "--", i created file/directory as below               mkdir -- --abc     touch -- -xyz      So my Question is what is this "--" in bash ? Please explain.


Single dashes `-` for single-character options, but double dashes `--` for words?

Where did the convention of using single dashes for letters and doubles dashes for words come from and why is continued to be used? For example if I type in `ls --help`, you see:                 -a, --all                  do not ignore entries starting with .       -A, --almost-all           do not list implied . and ..           --author               with -l, print the author of each file       -b, --escape               print octal escapes for nongraphic characters           --block-size=SIZE      use SIZE-byte blocks       -B, --ignore-backups       do not list implied entries ending with ~     ...      I tried googling `\- and -- convention` even with quotes with little success.


How can I grep through files whose name begins with `-`?

I've tried this.               grep -r thanks *                                      slave-iv     grep: invalid option -- '@'     Usage: grep [OPTION]... PATTERN [FILE]...     Try `grep --help' for more information.      Here's what the directory looks like. They're log files from pidgin.               ls -1     -100000139702926@chat.facebook.com     -100001138571192@chat.facebook.com     -1021869012@chat.facebook.com     -12120618@chat.facebook.com     -1251570038@chat.facebook.com     -1269333626@chat.facebook.com     -1394365872@chat.facebook.com     -1657581332@chat.facebook.com     -211203163@chat.facebook.com     -505152641@chat.facebook.com     -549333601@chat.facebook.com     -557177029@chat.facebook.com     -573222477@chat.facebook.com     -584051302@chat.facebook.com     -65000319@chat.facebook.com     -663869224@chat.facebook.com     -664953132@chat.facebook.com     -755682783@chat.facebook.com


Accidently created a file called -X, how can I delete it?

> **Possible Duplicate:**   >  How do I delete a file whose name begins with "-" (hyphen a.k.a. dash or > minus)? Like an idiot, I ran this command:                   tar -cf -X awstats-icon icon tarfile.tar .      I was trying to use the -X switch to exclude awstats-icon and icon directories. Now I have a large file named -X and I cannot seem to delete it. I tried using:                   rm -X         rm `-X`         rm '-X'      However none of these have worked. Any suggestions?


How to make a TCP socket time out

For network catastrophe simulations of our server environment, we are looking for a way to intentionally timeout a TCP socket. Are there any simple ways for existing sockets? Also, little C test-case program would be a plus. We have already tried putting down network interfaces during TCP buffer reading, and reading from disconnected mounted resources (samba). Out test server is Ubuntu 12.04.4.


Can I configure bash to execute "clear" before every command typed in the console?

I would like to configure bash to execute `clear` command every time I type some command in the terminal (before executing my command). How can I do that? I'm using Debian Linux.


awk-Printing column value without new line and adding comma

input.txt                EN1      EN2      EN3      EN4      EN5      output               EN1,EN2,EN3,EN4,EN5      I have tried awk.But it is not printing with comma               awk 'BEGIN { OFS = ","} { printf $1}' input.txt      I have GNU Awk 4.0.0 version


Basic rsync command for bit-identical copies

As far as I undstand, the following command:               sudo rsync --delete -azvr /home/oshiro/Desktop/source/ /home/oshiro/Desktop/destination      Is this all I need to create a simple synchronisation of files from 1 location to another? Or does the above command do anything more in the background which I don't know about? For example, does it create some sort of versioning, where I can specify a past time to get files how where were in the passed? That's a feature which I do not want to enable at this stage. All I want is bit-identical copy of the files from 1 location to another. Can I get rid of any of those parameters or do I need to add further parameters to make the copies bit-identical with no versioning. Basically, I don't want to create backups how the mac time machine backup system creates backups.


Privileges on Linux?

In Linux, I had created a userid. After creating this, I encountered a problem that the .EXE Files are not opened on simple click. They seem to be not privileged for my user account. How can I overcome from this?


Installing extra packages of Debian Wheezy from terminal (after a net install)

I've installed the small image of Debian Wheezy from here but had to skip the mirror install of the extra packages. Now that I have the command line how do I get the rest of the stuff? When I tried `apt-get install ssh-server`, it told me to insert the CD.


Most reliable way to check for connected client?

I have an embedded Linux OS developed from scratch using Yocto. This talks to a Windows XP/7 client. The embedded OS runs a DHCP server and gives an address to the client. The problem is that the client is "locked down" and blocks many standard ports and methods of doing things. If the client is detected present by the embedded system, my startup script will launch the server that tests the system; otherwise I kexec to another OS. **What is the best way to detect if a client connected over Ethernet is there on startup (in Linux) without adding significant bootup time to the system?** Here are the things I've tried and what does not work:   1. ICMP packets are blocked on the client side so traditional pinging does not work    2. arping works (as well as nmap using ARP scan) but Windows clients try to be "smart" and dial out so it takes 20-25 seconds to actually establish the connection, which is unacceptable; ideally, it should detect something in 5-10 seconds. Is there anything I can set on the server side to speed this up? It always boots into this partition first so the quickest solution is the best solution.   3. ifplugd, ethtool, netplugd, and probing /sys/class/net/eth0/operstate and /sys/class/net/eth0/carrier do not work because the Ethernet port on the embedded system is connected to an internal switch so it is always "up" and "connected" hardware wise   4. A future solution will likely use Bonjour on the client side and Avahi on the server so we can have a connectionless protocol, but this will take time to implement and I need an interim solution because any software we add to the client side takes a very long time to get approval for. Again, I can't do anything on the client side because these units are configured by another company and locked down. So what else can I try on the server to detect if the client is present?


Extract audio from video in Linux with a GUI program?

When I use Thunar I like adding to custom actions command lines like those presented here, here and here to extract audio from videos. I mean **without transcoding/altering the sound, just putting it out of the video** (a flv or mp4 video, for example, is a aac audio - which cannot be played as such, but rapped into a m4a, like in the the command in the links posted. a webm video has a ogg audio which needs to be extracted.) Now, I am using elementayOS, and will not use Thunar, nor Nautilus, just Pantheon-Files. I want to know if there is a GUI solution to achieve this.


Hidden password is being displayed when invoking the su command?

This is the first time it has happened to me where I am using the su command and it actually displays the password on the terminal and doesn't stay hidden. Here is my code snippet:               sshpass -p "password" ssh -q username@74.11.11.11 "su -lc 'mkdir temp/'"      Code explanation: I am accessing a remote server and trying be root on that server to create a folder. In doing so I have to use the su command and it prompts me for the password. When I enter the password, it gets displayed and doesn't stay hidden.


using cross-compiled Valgrind

I have downloaded the sources from the Valgrind trunk and built it for using on an embedded Linux system(Montavista Linux) powered by an ARM926(ARMv5t architecture). Everything went well until I tried to run it to check some application I've made; Valgrind tells me: _"valgrind: failed to start tool 'memcheck' for platform 'arm-linux': No such file or directory"._ Trying to run any other tool gives the same message. For _make install_ I used the --prefix option pointing to the embedded system's filesystem which is mounted through NFS(e.g. --prefix=/home/NFS_mounted/opt/valgrind). I checked the installation location and the _lib_ directory there contains the proper tools; I also checked the corresponding pkgconfig file for Valgrind and it seems to be OK so I'm kind of clueless right now and can't figure out what's going wrong. 2 questions:   1. Is it correct to use/install a cross-compiled Valgrind like that? Maybe I'm doing something wrong regarding the setup, or maybe there is something involving the host system that I'm missing(gdb/gdbserver like).   2. Has anyone tried running it on ARM architectures? I'm aware that the support is fairly recent so I'm wondering if I could get decent results.


How to access Win7 on a dual boot machine?

I've been dual booting Win7 and Ubuntu for about 4 months and I got on it today to change the default boot on grub, because my girlfriend kept getting locked out when it reboots and, by default, goes to the Ubuntu partition. I tried using the command promt. I used the command found here which was `sudo gedit /etc/default/grub` That didn't appear to do anything so I changed the grub using the file manager and changed "Default grub=4" which, is the boot I was supposed to use... This led to my Windows 7 partition dissapearing from the boot list, somehow, although all files are still showing up on the OS (checked through Ubuntu) and System Recovery shows my latest restore, attempted to restore and said it should be working.. So I'm assuming its hidden in some way? I'm using BT5R3. `/etc/default/grub:`               # If you change this file, run 'update-grub' afterwards to update     # /boot/grub/grub.cfg.          GRUB_DEFAULT=4     #GRUB_HIDDEN_TIMEOUT=0     GRUB_HIDDEN_TIMEOUT_QUIET=true     GRUB_TIMEOUT=10     GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`     GRUB_CMDLINE_LINUX_DEFAULT="text splash vga=791"     GRUB_CMDLINE_LINUX=""          # Uncomment to disable graphical terminal (grub-pc only)     #GRUB_TERMINAL=console          # The resolution used on graphical terminal     # note that you can use only modes which your graphic card supports via VBE     # you can see them in real GRUB with the command `vbeinfo'     GRUB_GFXMODE=1024x768          # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux     #GRUB_DISABLE_LINUX_UUID=true          # Uncomment to disable generation of recovery mode menu entries     #GRUB_DISABLE_LINUX_RECOVERY="true"          # Uncomment to get a beep at grub start     #GRUB_INIT_TUNE="480 440 1"      Shell history:               1  exit         2  startx         3  apt-get software center         4  apt-get software-center         5  sudo apt-get software-center         6  install software-center         7  mkdir /opt/java         8  mv -f jre1.70_05/ /opt/java         9  tar xzvf jre-7u45-linux-i586.tar.gz.        10  tar: tar xzvf jre-7u45-linux-i586.tar.gz        11  tar xzvf jre-7u45-linux-i586.tar.gz        12  apt-get install synaptic        13  help        14  install synaptic        15  apt-get synaptic        16  apt-get install synaptic        17  lspci -v        18  help]        19  help        20  help mapfile        21  help        22  info strict refs        23  startx        24  edit grub        25  search grub        26  apt-get install sphinxsearch        27  search grub        28  edit grub boot        29  find grub        30  startx        31  startsx        32  startx        33  -terminal        34  terminal        35  apt-get install rsplib-tools        36  --fix-missing        37  apt-get update        38  terminal        39  apt-get install rsplib-tools        40  terminal        41  update grub        42  update-grub        43  open partition manager        44  open        45  help        46  search partition manager        47  help        48  find partition manager        49  find partitionmanager        50  startx        51  find gparted        52  get gparted        53  get Gparted        54  get-apt Gparted        55  X-AppInstall-Package=gparted        56  help        57  startx        58  run history        59  history                    $ sudo grub-mkconfig > /dev/null     Generating grub.cfg ...     Found linux image: /boot/vmlinuz-3.2.6     Found initrd image: /boot/initrd.img-3.2.6     Found memtest86+ image: /boot/memtest86+.bin     done          $ sudo fdisk -l       Disk /dev/sda: 1000.2 GB, 1000204886016 bytes     255 heads, 63 sectors/track, 121601 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xb3b6d9a6                Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1          13      102400    7  HPFS/NTFS     Partition 1 does not end on cylinder boundary.     /dev/sda2              13       83647   671785946    7  HPFS/NTFS     /dev/sda3           83647      119927   291422209    5  Extended     /dev/sda4          119927      121577    13249536    7  HPFS/NTFS     /dev/sda5           83647      118706   281610240   83  Linux     /dev/sda6          118706      119927     9810944   82  Linux swap / Solaris


How do I replace symlinks in a path with their target within a script?

I want to extract part of a file path up to a symlink, use `readlink` to find the path to the link target, and then replace the link name with the actual path. This has to be done within a script. For example, say I my original path is:               /path/to/*latest*/files/test.txt        # where *latest* is the symlink      Then I run `readlink` to reveal the target of the symlink:               readlink /path/to/*latest*     ver2      The output of the script would then be               /path/to/ver2/files/test.txt      NOTE that the original path could have several links so I don't want to run readlink -f on the whole path and file name. i.e. readlink -f /path/to/latest/files/test.txt /data/today/to/v2/files/test.txt


ls -l --group-directories-first (act on symlinks as well)

`ls` option `\--group-directories-first` causes directories to be listed on the top, which makes the output of `ls` nice and clean:               ls -l --group-directories-first      However, it does not act on `symlinks`, which are actually `symlinks` to directories. There is a possibility to use               ls -l -L --group-directories-first      which will list both kind of directories on top, but will not distinguish between proper directory and symlinked directory, which is again confusing. Can `ls` display symlinked directories on top, while still keeping them distinct from regular directories? **EDIT:** I am using `bash`.


Characters are encoded twice when I ask SSH to reattach a screen session on the remote host

I want to be able to SSH to a remote host and restore a screen session with one command. Both hosts use UTF-8 locale. My problem is that then, inside the screen session, characters are encoded twice. As stated in other related questions, I need to pass the `-t` option to `ssh` command in order to allocate a pseudo-tty for an interactive session: http://stackoverflow.com/questions/474967/automatically-or-more-easily- reconnect-to-a-screen-session-after-network-inter Thus the command I use is `ssh -t remotehost screen -dr`. When I restore screen this way, the characters I send from the keyboard are encoded twice, and the characters I receive from the remote host are decoded twice:               localhost % ssh -t remotehost screen -dr     remotehost % echo ä | hexdump -C     0000000 c3 83 c2 a4 0a     0000005      This doesn't happen if I first connect to the remote host and then restore screen:               localhost % ssh remotehost     remotehost % screen -dr     remotehost % echo ä | hexdump -C     0000000 c3 a4 0a     0000003      What I mean by "characters are encoded twice" is that normally I see the same output if I type:               localhost % echo ä | iconv -f ISO-8859-1 -t UTF-8 | hexdump -C     00000000  c3 83 c2 a4 0a     00000005      The pseudo-tty allocation alone doesn't cause the problem. I've tried:               localhost % ssh -t remotehost /bin/zsh     remotehost % screen -dr     remotehost % echo ä | hexdump -C     0000000 c3 a4 0a     0000003


what programming language required to develop linux O.S?

I want to know, what programming language is required to develop Linux operating system?. How to start and what are the required concepts ? I want to create my own O.S to my PC. I have knowledge in `C` and `C#.NET` as basic Programmer. Please suggest me the way.


How to diff files ignoring comments (lines starting with #)?

I've two configuration files, the original from the package manager and a customized one modified by myself. I've added some comments to describe behavior. How can I run `diff` on the configuration files, skipping the comments? A commented line is defined by:   * optional leading whitespace (tabs and spaces)   * hash sign (`#`)   * anything other character The (simplest) regular expression skipping the first requirement would be `#.*`. I tried the `\--ignore-matching-lines=RE` (`-I RE`) option of GNU diff 3.0, but I couldn't get it working with that RE. I also tried `.*#.*` and `.*\\#.*` without luck. Literally putting the line (`Port 631`) as `RE` does not match anything, neither does it help to put the RE between slashes. As suggested in “diff” tool's flavor of regex seems lacking?, I tried `grep -G`:               grep -G '#.*' file      This seems to match the comments, but it does not work for `diff -I '#.*' file1 file2`. So, how should this option be used? How can I make `diff` skip certain lines (in my case, comments)? Please do not suggest `grep`ing the file and comparing the temporary files.


What do the numbers in a man page mean?

So, for example, when I type `man ls` I see `LS(1)`. But if I type `man apachectl` I see `APACHECTL(8)` and if I type `man cd` I end up with `cd(n)`. I'm wondering what the significance of the numbers in the parentheses are, if they have any.


What are the difference between man1, man2, man3... folders?

> **Possible Duplicate:**   >  What do the numbers in a man page mean? What are the differences between man _X_ pages? Why are they separated?


man pages: meaning of '2' in STAT(2)?

What's the significance of the number, like the `2` in `STAT(2)`, seen in man pages? For example, `man 2 stat` yields a man page with `STAT(2)` at the top and a description that begins, `The stat() function...`, while `man stat` yields a man page with `STAT(1)` at the top and a description that begins, `The stat utility...` I noticed the page for `STAT(1)` says `BSD General Commands Manual`, while that for `STAT(2)` says `BSD System Calls Manual`, so maybe the number is a code for the type of command?


What is the significance of the "1" in ls(1)?

> **Possible Duplicate:**   >  What do the numbers in a man page mean? I see functions referred to with numbers in the parenthesis in documentation. What does this mean? It takes one argument? Sorry, noob.


What does the number mean in a man page?

> **Possible Duplicate:**   >  What do the numbers in a man page mean? If I type`man ls`, I see`LS(1)` in the top left and top right corners of the manpage. I also see programs on the internet being refered to this way. ex. `man(1), xman(1x), apropos(1), makewhatis(8) and catman(8).` What are these numbers (and in some cases letters)?


What means the "integer argument" in system call descriptions?

> **Possible Duplicate:**   >  What do the numbers in a man page mean? All system calls described in manpages have an associated number such as `exec(3)`. What is the meaning of this number?


About the command and the number in the man

> **Possible Duplicate:**   >  What do the numbers in a man page mean? such as:               http://www.postfix.org/qmgr.8.html     The qmgr(8) daemon awaits t      what's the meaning of 8? just don't know it.


What is the meaning of the number part of man pages?

> **Possible Duplicate:**   >  What do the numbers in a man page mean? As in the "(1)" in git-svn(1)


Deleting many files except one type

> **Possible Duplicate:**   >  Deleting all files in a folder except files X, Y, and Z I am writing a script to compile many `.tex` files. After that, many auxiliaries files were created. So, I would like to remove them at the end of the script. I tough to use `rm $file.xxx` but I would have to write all the extensions by hand, since that I want to keep my source file and the pdf output, so I can not use the * to delete all. How to delete all the extensions except those with extension `.tex/.pdf`? Thanks.


How to copy files *to* a camera?

I'd like to copy a firmware update file to my Canon 7D camera. After it was auto-mounted by `thunar` + `thunar-volman` + `gvfs-gphoto2` I tried the following:               $ cp eos7d-v205-win/7D000205.FIR /run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A001%2C012%5D/     $ echo $?     0     $ ls /run/user/1000/gvfs/gphoto2\:host\=%5Busb%3A001%2C012%5D/     DCIM  MISC      So that went into a black hole. * * * The first time I try to copy it with `Ctrl`-`c` and `Ctrl`-`v` prints the following error message when pasting the file: > Error writing file. > > -108: No such file or directory. > > Do you want to skip it? If I try again after that it simply crashes:               $ thunar     Segmentation fault (core dumped)     $ echo $?     139      * * * The Gphoto 2 shell has an _undocumented_ `put` function which I also tried:               $ sudo umount /run/user/1000/gvfs     $ gphoto2 --shell     gphoto2: {.../eos7d-v205-win} /> help put     Help on "put":          Usage: put [directory/]filename     Description:             Upload a file          * Arguments in brackets [] are optional      So this function takes a **single** argument with an **optional** directory. Weird, but should be doable. Some attempts at making it work:               $ gphoto2 --shell     gphoto2: {.../eos7d-v205-win} /> ls     store_00010001/          gphoto2: {.../eos7d-v205-win} /> put 7D000205.FIR                                 *** Error ***                   You need to specify a folder starting with /store_xxxxxxxxx/     *** Error (-1: 'Unspecified error') ***     gphoto2: {.../eos7d-v205-win} /> put /store_00010001/7D000205.FIR          *** Error ***                   PTP Access Denied     *** Error (-1: 'Unspecified error') ***     gphoto2: {.../eos7d-v205-win} /> put /store_00010001/MISC/7D000205.FIR          *** Error ***                   PTP Access Denied     *** Error (-1: 'Unspecified error') ***      Maybe it's not supported? * * * Digikam has an upload feature, but that just reported ' _Failed to upload file "7D000205.FIR"._ ' Running it from the shell produced no more information. Too many WTFs per minute. **What do I need to do to copy a file to my camera in Arch Linux?**


Creating deb and rpm from the same source

Is there a standard for source packages to be able to build rpms, debs (and perhaps others) without too much customization? I'm talking mostly about Python, PyQt programs.


LFSH ... what is '/lib/init' for?

I'm trying to understand the init/boot process. My system is LMDE, so I presume it will be pretty much standard Debian in that regard. I believe I more or less understand the basics of the init scripts, `/etc/init.d/`, `/etc/defaults/` and so on, but there's this strange use of `/lib/init/` for a few of the scripts that look to me like they should be in /etc/init.d/ with all the rest. Can someone explain the logic of this? There's lots of discussion of `/lib/init/rw/` but none that I can find about `/lib/init/` itself. This is all that's in there:               drwxr-xr-x 3 root 4.0K 2013-12-25//15:20:41 rw/     -rw-r--r-- 1 root 1.3K 2014-01-21//07:37:07 vars.sh     -rw-r--r-- 1 root 3.3K 2014-01-21//07:37:07 tmpfs.sh     -rw-r--r-- 1 root  741 2014-01-21//07:37:07 swap-functions.sh     -rw-r--r-- 1 root  17K 2014-01-21//07:37:07 mount-functions.sh     -rw-r--r-- 1 root 4.4K 2014-01-21//07:37:07 bootclean.sh      Running `dpkg-query -S /lib/init` returns:               initscripts: /lib/init


Use an alias with watch command

The post repeat command every x seconds shows that `watch` is the utility that is useful for the invoking a command at fixed interval repeatedly. Now, I have very long commands, and have used aliases to group them logically to get a quicker output, like               $ alias c1='grep "checking for" file1.log'     $ alias c2='grep "validated" file1.log'     $ (echo "Checking: "`c1`) && (echo "Validated: "`c2`)      The output of 3rd command is like               Checking: 100     Validated: 80      It is a long running process, I need to check the status of this process, to get the mentioned counts. But invoking the above with `watch` gives error > $ watch '(echo "Checking: "`c1`) && (echo "Validated: "`c2`)'   >  c1 command not found I can put the entire command in there and remove the aliases, but is there any other work-around to get the aliases working with `watch` command? **Note:** Did quickly go through the man page for `watch`, but didn't find any reference to `alias` in specific.


GPU not listed in lspci after SysRQ reboot

I have my Ubuntu Server machine with XFX 7970 GPU in it, and sometimes, when ATI driver fails, I have to reboot it manually. When I'm trying to reboot the machine using SysRQ, the system reboots well, but GPU is not listed in lspci output. It appears again after hand reboot. Is there a way to reboot it without hand reboot remotely?


remote desktop on host

I have a host and I need people from Europe to access application on its desktop. So far I have told them to use `ssh -x -C user@host` and then launch an application with `application&` to get the app transferred to their desktop. That works, but they were complaining about the speed. Now I thought `VNC` might work better. so I installed a vncserver `Xvnc4` and I can connect to `127.0.0.1:5902` from the local shell but how can I tunnel this through ssh from external?


How to modify the Quadro driver to install on a GeForce

I have a consumer GeForce GTX680. It's professional equivalent is Quadro K5000. Both cards have exactly the same chip inside (GK104), the hardware is nearly identical. I need to install the Quadro driver instead of Geforce so I can have access to quad-buffered stereo system-wide. Windows users can force a Quadro driver by unpacking it and modifying one of the *.inf files. I managed to unpack the linux driver with:               sh NVIDIA* --extract-only      I can see two files reffering to specific device IDs of cards - monitoring.conf and pci.ids But suspect that on Linux we might have just one generic driver for all cards as I downloaded both the GTX680 driver and K5000 driver and both appear to be the same from inside. So the method for Linux might be different. Does anybody know how to modify the official driver or manually choose the one for K5000 from the files?


Why am I observing different behaviour of echo?

I am a bash beginner and observed the below behavior of echo               #!/bin/bash          x=" hello"          echo $x     echo "$x"      Now when I run the above code I get               ronnie@ronnie:~$ bash test.sh     hello      hello     ronnie@ronnie:~$      So, can someone explain to me why `whitespace` in first case is not present in output and also points me to the documentation where this behavior is defined.


udev rule for assigning known symlinks for identical usb serial devices

I have two (and possibly in the future, more) USB serial devices which are identical (down to the serial number, unfortunately) - they're actually BTC miners. Currently they end up as `ttyUSBX` where X is 0, 1 or 2, as there's another unrelated USB serial device as well (which need not be worried about here). I would like to write a udev rule which will assign them predictable names within `/dev`, like `/dev/miner0` where the zero is an incrementing integer. I don't care which of them ends up as which, but I do need them to be within a predictable range which won't change. Currently I have this:               SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="miner%n"      This is pretty close, as I end up with names like I want. The only problem is, since the miners and the third device can sometimes appear in a random order, I might end up with two of `miner0`, `miner1` and `miner2`, but I never know which two (without manually looking). If I add any more non-miner usb serial devices (which is a possibility), it'll exacerbate the problem. I had found reference to `%e` which looked like it did exactly what I wanted, but it doesn't seem to exist anymore. How might I give these devices predictable names? I'd prefer not to tie them to their location on the USB bus as well if possible. * * * **Further information/background** It's worth mentioning that I'm not that bothered what the names are, just that they be known and unchanging even if/when the device gets plugged into a different USB socket. I would simply forget the whole udev thing and use entries in `/dev/serial/by-id`, but as they have the same serial number, there's only one of them in there! It's also worth mentioning that the reason for doing this is that the mining software needs to be told a list of devices to probe and find. I can just have it do all (it basically just finds all valid miners in the `ttyUSB*` range), but that annoys the non-miner device. So I need the names of the miners known ahead of time so I can configure it to use just those. Sadly it won't accept a wildcard (so just telling it to use `/dev/miner*` seems to be out of the question), hence this problem.


Where is my Cursor?

My OS is Ubuntu 13.10, I use the following code to remove the KDE desktop installed before:                 sudo apt-get purge kde*      And then use the following code to install GNOME 3.10:                 sudo add-apt-repository ppa:gnome3-team/gnome3-next && sudo apt-get update       sudo apt-get update && sudo apt-get install gnome-shell ubuntu-gnome-desktop       sudo add-apt-repository ppa:gnome3-team/gnome3-staging       sudo add-apt-repository ppa:gnome3-team/gnome3       sudo apt-get update && sudo apt-get dist-upgrade      After all these were done, I restart my computer and can not find my cursor in Unity, while all things are OK in GNOME. I want to find the cursor in Unity, what should I do?


Quoting in command substitution

The command               pdftk FileOne.pdf "File two.pdf" output Combined.pdf        works as expected, merging PDF's One and Two. However, if I put the filenames in a file               FileOne.pdf      "File Two.pdf"        and then use               pdftk $(< Files.lst) output Combined.pdf        I get the error messages               Error: Failed to open PDF file:         "File       Error: Unable to find file.     Error: Failed to open PDF file:         Two.pdf"        Obviously, `pdftk` is seeing the quotes, so I don't understand how it can distinguish the two cases (which is why I am posing the question in this forum). For the record, I am using MKS Toolkit Korn shell, invoked from Emacs. I get the same in the Cygwin bash shell.


How to configure fonts on a remote X connection (XDMCP vs. ssh)?

Connecting to a remote Solaris 10 system over X11 I observe inconsistent behavior regarding the used fonts. I am connecting from a Cygwin/X system. When I connect using ssh forwarding like this               $ ssh -Y mymachine.example.org      fonts work as expected, i.e. the rendering is very nice and programs seem to find all kind of different fonts (e.g. gvim or emacs). When I connect to the same machine via XDMCP (to the stock blue Solaris 10 login manager screen) and login there seems only 1 fixed size font available. An Emacs from OpenCSW even fails to execute because it can't find the fonts it needs. It prints that it can't find a font using following specification:               -dt-interface user-medium-r-normal-m      I establish the XDMCP connection like this:               $ XWin -query mymachine.example.org -from mywindowsclient.example.org      My objective is no to get also proper fonts for the XDMCP use case. How can I investigate this issue? Can I duplicate some configuration which is implicitly used with `ssh -Y` for the XDMCP case? How is the font-thing usually setup during ssh-X11-forwarding?


rs232 to usb not working

**I also asked this question on AskUbuntu but there nobody comments on it** I have a konig rs232 serial to usb adapter (no FTDI chip), but when I try to connect to a cisco switch/router (via Putty, screen, minicom....), sometimes it just shows nothing (But it is connected because when i remove the USB it says disconnected, and sometimes it show garbage. But it also can just work ok, for about 5-10 seconds, after that it just freezes. I checked the adapter on an other linux pc (slackware), and here it just works flawless. I'm running ubuntu 13.10 (3-11-0-15-generic , Lenovo laptop) lsusb               Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 025: ID 0cf3:3004 Atheros Communications, Inc.      Bus 001 Device 032: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port     Bus 001 Device 003: ID 5986:0295 Acer, Inc      Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub     Bus 003 Device 002: ID 058f:6366 Alcor Micro Corp. Multi Flash Reader     Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub      dmesg | grep 2303               [22933.099512] pl2303 1-1.2:1.0: device disconnected     [22934.926969] usb 1-1.2: New USB device found, idVendor=067b, idProduct=2303     [22934.927665] pl2303 1-1.2:1.0: pl2303 converter detected     [22934.929688] usb 1-1.2: pl2303 converter now attached to ttyUSB0      **edit** I borrowed another converter from a friend (this one does have a FTDI chip), but it still doesn't work. I forgot to mention that i tried it on USB 2.0 as well as 3.0 **BUMP**


awk high precision arithmetic

I am looking for a way to tell awk to do high-precision arithmetic in a substitution operation. This involves, reading a field from a file and substituting it with a 1% increment on that value. However, I am losing precision there. Here is a simplified reproduction of the problem:                $ echo 0.4970436865354813 | awk '{gsub($1, $1*1.1)}; {print}'        0.546748      Here, I have a 16 digit after decimal precision but awk gives only six. Using printf, I am getting the same result:               $ echo 0.4970436865354813 | awk '{gsub($1, $1*1.1)}; {printf("%.16G\n", $1)}'     0.546748      Any suggestions on to how to get the desired precision?


bash scripting - Any function to escape character?

I am trying to automate some of my stuff and facing a issue, the problem boils down to escaping the value that is being passed as a argument to the script. ### myScript.sh               #!/bin/bash          loadPatch -name $1      where `$1` is the first argument and can have value like 'p12.9.5-bug34' Running it as               myScript p12.9.5-bug34      produces no result. I checked with `echo $?` the output was successful, but the required operation didn't happen. I replaced `$1` with this actual value to test in the script and it worked as expected. There is no way for me to put a print statement in `loadPatch` to verify what arguments it has received. So, I envisage there is some escaping problem here and hence need to know, is there any function/utility which I could use to escape the argument before using? Please let me know if you see any other error with this?


How do I stop Gthumb from opening when I plug in my camera?

I'm using Linux Mint 13. Whenever I plug my camera into the USB port, Gthumb opens _and_ a directory window opens. I can't find config files, autoplay options or an option in the preferences of Gthumb to change this. How can I stop Gthumb opening when I plug in my camera? O_O


Why is my PC freezing while I'm copying a file to a pendrive?

I have a really strange situation here. My PC works fine, at least in most cases, but there's one thing that I can't deal with. When I try to copy a file from my pendrive, everything is ok -- I got 16-19M/s , it works pretty well. But when I try to copy something to the same pendrive, my PC freezes. The mouse pointer stops moving for a sec or two, then it moves a little bit and it stops again. When something is playing, for example, in Amarok, the sound acts like a machine gun. The speed jumps from 500K/s to 15M/s, average 8M/s. This occurs only when I'm copying something to a pendrive. When the process of copying is done, everything backs to normal. I tried everything -- other pendrive, a different USB port on front panel or those ports from back, I even changed the USB pins on motherboard (front panel), but no matter where I put my USB stick, it's always the same. I tried different filesystem -- `fat32`, `ext4`. I have no problem with the device on Windows, on my laptop. It has to be my PC or something in my system. I have no idea what to look for. I'm using Debian testing with standalone Openbox. My PC is kind of old -- Pentium D 3GHz, 1GiB of RAM, 1,5TB WD Green disk. If you have something that would help me to solve this issue, I'd be glad to hear that. I don't know what else info I should provide, but if you need something, just ask, I'll update this post as soon as possible. I tried to reproduce this problem on ubuntu 13.04 live cd. I mounted my encrypted partition + encrypted swap and connected my pendrive to a usb port. Next I tried to start some apps, and now I have ~820MiB in RAM and about 400MiB in SWAP. There's no problem with copying, no freezing at all, everything is as it should be. So, it looks like it's a fault of the system, but where exactly? What would cause such a weird behavior?


Introspection of the interface of a shared library

I have a problem with a library I'm working with for the first time ( it's Boost.Python but my question is much more general than this case). As a consequence I need to check what is the interface of the library I have built: so as to check if I have at least built everything correctly. _(Python is complaining that he doesn't see my module, though I put the .so renammed in .pyd into its PYTHONPATH, so there's something wrong in my library)_ I need to know all the names of the exposed functions of my .so library, and their prototype if possible. Are there commands or package that I could install to achieve something like this ?


'mv' equivalent of drag and drop with replace?

In a GUI environment, a drag-and-drop with replace will replace files and entire directories (including contents) with whatever is being copied in. Is there a way to accomplish this same intuitive result with the 'mv' command?


What does `l` mean in an `ls` listing?

When I run `ls -adl .*` in one of my directories, I get a file that has this listing:               lrwxrwxrwx  1 user group   43 Jul  3 16:25 .#filename.py ->       person@computer.edu.4018:1372874769      The filename and URL-looking thing are highlighted in red. **What does the`l` mean in `lrwxrwxrwx`? What kind of file is this?**


CentOS no network interface after installation in VirtualBox

I have Ubuntu 12.10 on which i installed virtual box on which I setup centos 6.4 i386. On Ubuntu I have: 3.5.0-17-generic kernal running. On virtual box I install centos 6.4 and everything works fine, however when i boot into VM machine, there is only on loopback interface. Nothing else. I tried to manually add ifcfg-eth0 file but nothing happens. On VM settings i have added NAT and HostOnly interfaces but whenever I boot into centos there is just lo interface. What should I do?


User input in linux bash to check against a list and respond with result

I am trying to get bash to ask for a user input from read and to check against a file or list of files, then respond with the result from that chesk. This is as far as I have gotten as of yet...               read -p "what are we looking for?" RESP     if [ "$RESP" = sed -n ${some line from inside file} ./file |      then do "returned variable from file"          else     echo "You need more bash programming"       I know I am very new here but I cant figure it out, what ever the response is needs to be check against a file (what inside the file)- line by line then return an associated variable of that line say like               "RESP"=line 3(or any line that matches) of ./this_file      return "var1" of that line     Do "var1"          fi      Is this the way to do this what would this code look like in simple bash I am so lost please help example: line1:"please open google" "var1[open http:www.google.com] pass "var1" to bash


How to copy Big files on other Linux Server Independent of TTY

Actually i was trying to copy all the files in another director. Total size of the file is 188GB so its going to take a time. Im trying to copy for Linux server A to B using this command               nohup scp Files-from-Server-A root@xxx.xxx.xxx.xxx:tmp &      but as soon i close the terminal it stops copying the files but the process is still shown in process manager.


Is the historical Unix V5 tr command padding behavior of set2 different from what we consider today "classic" System V (1983-1988) behavior?

The `tr` command is almost 40 years old. It seemingly appeared in Unix for the first time in 1973 with Unix V4. The source for this is not available. Here is probably the second oldest available Unix implementation of the command from Unix V5 about 6 months later in June 1974:               int dflag 0;     int sflag 0;     int cflag 0;     int save 0;     char code[256];     char squeez[256];     char vect[256];     struct string { int last, max, rep; char *p; } string1, string2;     int inbuf[259];          main(argc,argv)     char **argv;     {         int i, j;         int c, d;         char *compl;         extern fout;              string1.last = string2.last = 0;         string1.max = string2.max = 0;         string1.rep = string2.rep = 0;         string1.p = string2.p = "";              if(--argc>0) {             argv++;             if(*argv[0]=='-'&&argv[0][4]!=0) {                 while(*++argv[0])                     switch(*argv[0]) {                     case 'c':                         cflag++;                         continue;                     case 'd':                         dflag++;                         continue;                     case 's':                         sflag++;                         continue;                     }                 argc--;                 argv++;             }         }         if(argc>0) string1.p = argv[0];         if(argc>1) string2.p = argv[1];         for(i=0; i<256; i++)             code[i] = vect[i] = 0;         if(cflag) {             while(c = next(&string1))                 vect[c&0377] = 1;             j = 0;             for(i=1; i<256; i++)                 if(vect[i]==0) vect[j++] = i;             vect[j] = 0;             compl = vect;         }         for(i=0; i<256; i++)             squeez[i] = 0;         for(;;){             if(cflag) c = *compl++;             else c = next(&string1);             if(c==0) break;             d = next(&string2);             if(d==0) d = c;             code[c&0377] = d;             squeez[d&0377] = 1;         }         while(d = next(&string2))             squeez[d&0377] = 1;         squeez[0] = 1;         for(i=0;i<256;i++) {             if(code[i]==0) code[i] = i;             else if(dflag) code[i] = 0;         }              inbuf[0] = 0;         fout = dup(1);         close(1);         while((c=getc(inbuf)) >=0 ) {             if(c == 0) continue;             if(c = code[c&0377]&0377)                 if(!sflag || c!=save || !squeez[c&0377])                     putchar(save = c);         }         flush();     }          next(s)     struct string *s;     {         int a, b, c, n;         int base;              if(--s->rep > 0) return(s->last);         if(s->last < s->max) return(++s->last);         if(*s->p=='[') {             nextc(s);             s->last = a = nextc(s);             s->max = 0;             switch(nextc(s)) {             case '-':                 b = nextc(s);                 if(b<a || *s->p++!=']')                     goto error;                 s->max = b;                 return(a);             case '*':                 base = (*s->p=='0')?8:10;                 n = 0;                 while((c = *s->p)>='0' && c<'0'+base) {                     n = base*n + c - '0';                     s->p++;                 }                 if(*s->p++!=']') goto error;                 if(n==0) n = 1000;                 s->rep = n;                 return(a);             default:             error:                 write(1,"Bad string\n",11);                 exit();             }         }         return(nextc(s));     }          nextc(s)     struct string *s;     {         int c, i, n;              c = *s->p++;         if(c=='\\') {             i = n = 0;             while(i<3 && (c = *s->p)>='0' && c<='7') {                 n = n*8 + c - '0';                 i++;                 s->p++;             }             if(i>0) c = n;             else c = *s->p++;         }         if(c==0) *--s->p = 0;         return(c&0377);     }      With time this evolved and since the early days, there's been variations with how the command deals with sets of different length, and here my interest is with the case where set2 is shorter than set1. The _GNU Coreutils_ manual discusses the situation: > When tr is performing translation, set1 and set2 typically have the same > length. If set1 is shorter than set2, the extra characters at the end of > set2 are ignored. > > On the other hand, making set1 longer than set2 is not portable; POSIX says > that the result is undefined. In this situation, BSD tr pads set2 to the > length of set1 by repeating the last character of set2 as many times as > necessary. System V tr truncates set1 to the length of set2. > > By default, GNU tr handles this case like BSD tr. When the --truncate-set1 > (-t) option is given, GNU tr handles this case like the System V tr > >instead. This option is ignored for operations other than translation. > > Acting like System V tr in this case breaks the relatively common BSD idiom: >   >   >      tr -cs A-Za-z0-9 '\012' >   > > because it converts only zero bytes (the first element in the complement of > set1), rather than all non-alphanumerics, to newlines. There is also such a discussion in _The Open GroupBase Specifications Issue 7 IEEE Std 1003.1_, 2013 Edition: > When string2 is shorter than string1, a difference results between > historical System V and BSD systems. A BSD system pads string2 with the last > character found in string2. Thus, it is possible to do the following: > > tr 0123456789 d > > which would translate all digits to the letter 'd'. Since this area is > specifically unspecified in this volume of POSIX.1-2008, both the BSD and > System V behaviors are allowed, but a conforming application cannot rely on > the BSD behavior. It would have to code the example in the following way: > > tr 0123456789 '[d*]' Now, if you read the man pages for the tr command in V4 and V5, you see the following reference in both:               If string2 is short, it is padded with corresponding characters from string1.      But that reference is omitted in the V6 manual and later early versions of Unix yet the V6 implementation of the command is line for line identical to V5? So you have a difference in the manuals but not in the code? Also, this implementation seems different from what is considered "classic BSD or System V" behavior i.e. pad from adding from set2 elements or truncate to length of set1. So is the V4-V5 implementation different from the System V milestone Unix and what is the rationale for that different implementation and ultimately why was it discarded down the road? How can I find out more information about such an early design of the command?


Multiple SSH tunnel through raspberry pi?

In my home network I have a PC, raspberry pi, macbook and a few other devices which I want to access away from home. As it stands, I have setup VNC server on my PC along with remote desktop and have changed the default ports. These ports are open on my router and redirect to the PC so that I can access them via dynamic dns. However I was wondering if it was possible to close those open ports on the router, and instead leave only port 22 on the raspberry pi so I can use an SSH tunnel through the pi, to the PC and run VNC through that? If so how would the command prompt look? I understand vaguely how SSH tunnels work and can use them applying to 1 remote host, i.e:               ssh -L 22222:localhost:5900 user@pi      then running `localhost:22222` in my vnc viewer will let me connect to the pi. Reading up on the subject suggests I could do something like `ssh -L 22222:internal_pc_ip:5900 user@pi` and run `localhost:22222` like before? Can I do this?


How to prevent the auto creation of the "Desktop" folder?

> **Possible Duplicate:**   >  Which application should I blame for compulsively creating a directory > again and again? When I upload files via Firefox, the `Open File` dialog appears and the `Desktop` folder is automatically created. I am using Arch Linux with Xmonad and quite frankly I don't need a `Desktop` folder inside my `home` folder. How do I stop this from happening in the future (i.e. disable the auto creation of the `Desktop` folder)?


How can I prepend a tag to the beginning of several files?

I need to add PHP tags surrounding a file. It's easy to append them using               find . -exec echo "?>" >> '{}' \;      but how can I _prepend_ the tag `<?php`?


Inserting text at the beginning of a file with sed via the terminal in Linux

> **Possible Duplicate:**   >  How can I prepend a tag to the beginning of several files? How do I insert text at the beginning of a file via terminal?


Download specific files with FTP?

I am trying to use FTP to download several hundred files within a directory. Is there a way to only download specific files with FTP? Ideally, I would like to match specific files using a regular expression. Unfortunately, the directory is massive and it's too large to download the entire directory and then use find or grep locally to manipulate certain files. Is there a simply way to do what I am trying to do on Unix? If not, I plan to just write a script in perl or python. Thanks in advance for the help.


How to run a script during Gnome log out

I would like to run a script to rsync my home directory to another machine whenever I log out of Gnome. There is a way to hook into the Gnome logout process?


Is there a simple flag to prevent installing X and anything that depends on it via ports?

I'm running FreeBSD in a small VMWare image and I want to keep it headless. Is there a setting someplace that will guarantee I never pull in X as a dependency, or will I have to rely solely on eternal vigilance? Thanks. See also: the same basic question on SuperUser


Installing OpenMediaVault without keyboard and monitor

So I got the parts to my server delivered and assembled it. Now I have the problem that I don't have access to a monitor or keyboard and would like to install OMV to my server. I plan on running the OS from an USB stick (I know this is not recommended, but I got a SLC based stick, so it should be fine). I have a MacBook that's running OS X, could I setup the USB here and move it to the server and then just boot it there? Otherwise I guess I could use some sort of preseed file for headless installation, but I'm not well-versed in unix enviroments so I'm not sure how I should set it up. From what I gather I need to get the install iso on an USB and use that to install to another USB, is this possible to set up with a preseed file? I think OMV locks the OS drive, so ideally the stick should be split (1GB OS – 7GB Storage) so that the one half can be used for storing plugins and other stuff. On a sidenote, found this while looking for help/guides:   https://gist.github.com/ngnpope/3806732 Can I benefit from this in some way?


Setup linux cluster like Windows with CentOS or Ubuntu?

Along the lines of this MSDN article, how would you setup a pair of Ubuntu or CentOS (or RHEL) servers in a cluster so they appear to hosted applications as a single server, but will continue to work even if a node in the cluster becomes inoperable (or needs maintenance, etc)? I presume this is possible.


Cancel completion, but only completion, in zsh

When a completion function takes a long time, I can interrupt it by pressing `Ctrl`+`C` (terminal interrupt key, sends SIGINT) or `Ctrl`+`G` (bound to `send-break`). I am then left with the uncompleted word. However, if I happen to hit `Ctrl`+`C` or `Ctrl`+`G` just as the completion function finishes, my key press may cancel the command line and give me a fresh prompt instead of cancelling the completion. How can I set up zsh so that a certain key will cancel an ongoing completion but do nothing if no completion function is active?


Why does skype not pick up my microphone?

I've got `skype` running (32 bit mode) on Slackware64 -- the sound is fine but my mic is not able to be detected. KMIX shows that my mic is enabled, and I can hear myself when I test it. Some notifications I get in Konsole when starting `skype` are below:               ALSA lib conf.c:4692:(snd_config_expand) Unknown parameters CARD=PCH     ALSA lib control.c:953:(snd_ctl_open_noupdate) Invalid CTL default:CARD=PCH      EDIT -- Added screenshot. ![enter image description here](http://i.stack.imgur.com/bEDd7.png) Here is my ALSA mixer. If I turn the Front Mic all the way up, I can hear myself speaking through my output device. I have kept it down all the way so I don't hear myself. ![enter image description here](http://i.stack.imgur.com/plNnL.png) Edit -- Another snapshot of AlsaMixer ![enter image description here](http://i.stack.imgur.com/xbf9m.png)


How to use wildcards (*) when copying with scp?

Why can't I copy with scp when I'm using `*` characters in the path?               scp SERVERNAME:/DIR/* .      What configs do SCP need to allow `*` in the path? UPDATE: the problem is not on server side, pscp is trying to use SCPv1, and that's why the error message: ![enter image description here](http://i.stack.imgur.com/AWxRl.png)


How to show lines after each grep match until other specific match?

I know that by using the `"-A NUM"` switch I can print specific number of trailing lines after each match. I am just wondering if it's possible to print trailing lines until a specific word is found after each match. e.g. When I search for "Word A" I want to see the line containing "Word A" and also the lines after it until the one containing "Word D". context:               Word A     Word B     Word C     Word D     Word E     Word F      command:               grep -A10 'Word A'      I need this output:               Word A     Word B     Word C     Word D


How to remove cache device from bcache?

I believe, that once I made sure my cache device state is "clean":               $ sudo cat /sys/block/bcache0/bcache/state      I can just physically remove it from the machine when it is powered off or boot with liveCD and clean the superblock with:               $ sudo dd if=/dev/zero of=<backing device for cache> bs=1024 count=1024      But I cannot find anywhere a confirmation, that this procedure wouldn't mess anything up.


"find: .: No such file or directory" while using find on the current directory

Find command seems not to work at all. For example, I'm in a directory where there absolutely is file named index.php and I execute this:               [root@server htdocs]# find . -name "index.php"     find: .: No such file or directory      I always get this no such file or directory error. No matter what path I define, or what file I search for, I always get this error. I'm pretty sure that I'm overlooking something very simple. Can someone point out what I'm doing wrong?               [root@server htdocs]# pwd     /srv/www/htdocs     [root@server htdocs]# type -a find     find is /usr/bin/find     [root@server htdocs]# ls -la | grep index.php     -rw-rw-r--  1 andris users  413 Sep  1  2013 index.php     [root@server htdocs]# find . -name "index.php"     find: .: No such file or directory     [root@server htdocs]# find .     .     find: .: No such file or directory          [root@server htdocs]# stat .       File: `.'       Size: 4096            Blocks: 8          IO Block: 4096   directory     Device: ca00h/51712d    Inode: 155686      Links: 12     Access: (0775/drwxrwxr-x)  Uid: (  504/  andris)   Gid: (  100/   users)     Access: 2014-06-17 19:37:22.000000000 +0000     Modify: 2014-06-08 21:06:16.000000000 +0000     Change: 2014-06-08 21:06:16.000000000 +0000          [root@server htdocs]# find --version     GNU find version 4.2.27     Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION SELINUX      `strace find .` output: https://gist.github.com/andrisp/f3adaf740548eead33da               [root@server htdocs]# find . -noleaf -name "index.php"     find: .: No such file or directory


What is the "~/" directory?

I'm trying to locate where some files are stored and I can easily browse to them via ssh by going to "cd ~/foldername", however, I have no idea what directory "~/" actually is. When I browse around folders via WinSCP (yes, I'm a Windows admin), I can't seem to locate this folder at all. This is probably the most "noob" question I've ever asked but I've been having a tough time Googling it due to the length and it not actually coming up. **Note:** I'm using Amazon Linux on EC2 if it makes any difference. Thanks in advance.


Set environment variable for all of tmux shells when gnome-sessions gets restarted

To solve this problem, I need to set the environment variable `DBUS_SESSION_BUS_ADDRESS` for all shells inside `tmux` every time I restart gnome without restarting tmux (this is often). How can I best solve this?   * I cannot cleanly change another processes' environment.   * I cannot send a command to every pane   * I could set the environment variable in my `PROMPT_COMMAND`. It means I need to press `Enter` before I can run gnome applications. It's ugly and overkill.   * I could set the environment variable by executing a command before every command, but that's a bit overkill. Is there another way to fix this in a cleaner way?


Does perf includes some "graphing" abilities?

It's possible to create a bitmap or a vector image out of the data collected by the `perf` profiler under linux ?


How to authenticate a user with PAM, that is not the user that started the application

I'm currently developing an authentication module for an application. The decision was made to do this by using PAM. I have made this work but it can only authenticate the user that started the application. This means that if I started the application as the user 'appname' the authentication only tells me it is successful if the user is 'appname' and not 'some_user' If I su to that 'some_user' and started the application in that terminal then I can authenticate 'some_user' but not 'appname' I turned on the debug flag for pam_unix in common-auth. Resulting in the following output when it rejects:               unix_chkpwd[4107]: check pass; user unknown     unix_chkpwd[4107]: password check failed for user (pamtest)     [app]: pam_unix(other:auth): authentication failure; logname=[appname] uid=1000 euid=1000 tty= ruser=[appname] rhost=  user=pamtest


Creating a local workspace for development/testing

I want to be able to `mount`, say /home/$USER/workspace to /usr/local/workspace. Right now I'm using the python package pyfilesystem which uses `fuse` to do that. My problem is, that inside that mount I am not able to create `symlinks`. I don't even need symlinks going outside the mount, but even a symlink that normally is created for a shared library during compilation, will not be created inside the mount. So I'm either looking for a totally different approach, or a tool (preferably written in `Python`) that does exactly what `pyfilesystem` is doing and supports the creation of symlinks. Further constraints:   * Using a simple symlink instead of a mount does not work for me as the mounted directory will actually be inside a `chroot`.   * Mounting must not require root privileges.   * Changing `fstab` is not an option.   * Thus using `mount bind` is not an option.


How to set Linux to ask for authentication when running potentially dangerous commands?

I've faced times when I accidentally ran dangerous commands and lost all my data. How do I set Linux to ask for current user password or root user password when running potentially dangerous commands like `rm -rf .` or `rm -rf /` and many other?


apt-get install without debconf prompt

I would like to install chef via apt non-interactively, but by default, apt installation brings up this prompt: ![apt install chef prompt](http://i.stack.imgur.com/Rs9Ly.png) Is there a way to skip this step during installation or pass a value to apt install? I'm only using chef-solo, so don't actually need the server componenent, so simply press return on this prompt.


How to undelete just deleted directory with "rm -R" command?

I deleted an important directory with `rm -R` command. This is an very populer host data. It was located `/var/zpanel/hostdata/ayrintilih` After remove ayrintilih directory has gone everything. I tried to undelete with `ext4magic` program. But it need to another hdd volume for recovery. Error message:               ERROR: can not use "/root/recoveried" for recover directory. It's the same filesystem : "/dev/dm-0"      My ISP just replied my request:               Unfortunately there is no way to add another Volume to a virtual Instance.      If it would be a dedicated Server, we could do it, but not in a Cloudserver.      You could try to minimize the partition and create another one, that would      count as another Volume. We also recommend to have allways a      Backup for your Important files.


Is there any point in using `sudo` when you are the sole user of your machine?

I'd like to know if there is any reason why I should use `sudo` instead of `su`, taking into account that I am the owner and sole user of my machine (and hence have root access whenever I want). Also, in case there is a good reason to prefer `sudo`, I want to know what privileges should I give myself. * * * **EDIT:** I have just found a very nice reference for `sudo`. If anyone is interested it is here.


Can't access internet after connecting to L2TP IPsec VPN

I have configured a L2TP VPN on Ubuntu server 11.04, and I can connect to it with a Mac client. But after connecting successfully to this L2TP VPN, my Mac cannot access the internet. To access the internet, I have to disconnect from the VPN. My local IP address on Mac is 192.168.1.105, after connecting to VPN, I use this IP: 10.1.2.2. How can I fix this?


Best parameters for ext4 filesystem to handle virtualbox disk images

I have ext4 partition, which holds disk image files VirtualBox works with. They all are fixed-size images (i.e. files never change their size). They are defragmented as much as possible (with e4defrag). I assume that a lot of filesystem features are redundant in this case. I.e. as files are never created, never deleted, never change their size, only reading and "in-place" writing happens, and file contents are aligned on the hard- drive continuously, thus much simpler filesystem could be used in this case (no need for file attributes, directories, journal, etc). Theoretically, I could even use logical volumes instead of files in this case (I am just not sure that I want). So, questions:   1. How to tune ext4 filesystem, to get best performance in this case?   2. May be another filesystem is more suitable? (Some filesystem that don't support directories, and only continuous fixed-size files?) Or may be Linux has a possibility to mount _part_ of existing partition as a file? I.e. that I create unformatted partition /dev/sda2 and then     * mount K-th to L-th bytes of it as /somepath1/somefile1.vdi,     * mount M-th to N-th bytes of it as /somepath2/file2.vdi,     * and so on.


What can go wrong if /var/tmp is on a temporary filesystem?

I have read that I should not mount /var/tmp as a temporary filesystem (e.g., as tmpfs), because files in /var/tmp must not be deleted on reboot. Is that correct? Suppose I did mount /var/tmp as a tmpfs, so its contents are deleted on every reboot. Would that be bad? If yes, what could go wrong? How bad would it be?


How can I add invisible watermark to images on commandline?

Similar question here but for Tex -document. Imagemagick shows ways of watermarking here but not how to do it as invisible as possible. I currently just obfuscate some functional elements into photos so extremely hard to remove, without distorting the image itself. Is there some commandline tool to add invisible watermark to images, something like to check with microscope perhaps but still readable? I have a massive tree of images (of very different variety so watermark should adopt to env etc) -- some commandline tool to add watermarks fast invisibly on every photo?


remove Cinnamon Desktop replace with MATE

I'm guessing this is something simple I'm missing because nobody else seems to have this problem I just installed fedora 20 which installs cinnamon desktop (I believe) and want to use MATE because that's what I'm familiar - this installed OK But how do I uninstall cinnamon? When I do yum groupremove "Cinnamon Desktop" I get "No environment named Cinnamon Desktop" exists


How do I set key binding for set mark in emacs?

_I'm new to emacs and newer to lisp_ I'm trying to set Meta + spacebar to set the mark for highlighting text (at current cursor position). searching around online and experimenting I've ended up with the command `(global-set-key (kbd "M-SPC") 'push-mark nil nil 1)` The above command isn't working for me though, I'm getting an "incorrect number of arguments error". Got the function definition, push-mark &optional; position nomsg activate from elisp manual here **Position:** nil for position should default to current cursor position **nomsg:** I don't care about (I think) **activate:** apparently isn't true by default so I need to set it to...something. How would I format the command to pass in three values? _The error is definitely due to the push-mark function call as other functions such as backward-char (which I'm not passing inputs to) work correctly_


What's the difference between SFTP, SCP and FISH protocols?

I used to think SCP is a tool to copy files over SSH, and copying files over SSH is called SFTP, which is itself a synonym to FISH. But now as I was looking for a Total Commander plugin to do this in Windows, I've noticed that on its page it says "Allows access to remote servers via secure FTP (FTP via SSH). Requires SSH2. This is NOT the same as SCP!". If it's not the same then what am I misunderstanding?


Update not working properly

Whenever I write sudo apt-get update it does not work properly and shows following :               tusharmakkar08@tusharmakkar08-Satellite-C660 ~ $ sudo apt-get update     Ign http://archive.ubuntu.com nadia Release.gpg                                     Ign http://packages.medibuntu.org nadia Release.gpg                                 Ign http://archive.canonical.com nadia Release.gpg                                  Get:1 http://packages.linuxmint.com nadia Release.gpg [197 B]                       Ign http://security.ubuntu.com nadia-security Release.gpg                           Hit http://dl.google.com stable Release.gpg                                         Hit http://ppa.launchpad.net quantal Release.gpg                                    Ign http://archive.ubuntu.com nadia-updates Release.gpg                             Hit http://archive.canonical.com quantal Release.gpg                                Get:2 http://packages.linuxmint.com nadia Release [17.6 kB]                         Get:3 http://security.ubuntu.com quantal-security Release.gpg [933 B]               Hit http://dl.google.com stable Release.gpg                                         Hit http://ppa.launchpad.net quantal Release                                        Hit http://packages.medibuntu.org quantal Release.gpg                               Hit http://archive.ubuntu.com quantal Release.gpg                                   Ign http://archive.canonical.com nadia Release                                      Ign http://security.ubuntu.com nadia-security Release                               Hit http://dl.google.com stable Release                                             Hit http://ppa.launchpad.net quantal/main Sources                                   Hit http://archive.canonical.com quantal Release                                    Get:4 http://security.ubuntu.com quantal-security Release [49.6 kB]                 Hit http://dl.google.com stable Release                                             Get:5 http://archive.ubuntu.com quantal-updates Release.gpg [933 B]                 Hit http://ppa.launchpad.net quantal/main i386 Packages                             Ign http://packages.medibuntu.org nadia Release                                     Get:6 http://packages.linuxmint.com nadia/main i386 Packages [22.6 kB]              Hit http://dl.google.com stable/main i386 Packages                                  Hit http://packages.medibuntu.org quantal Release                                   Get:7 http://packages.linuxmint.com nadia/upstream i386 Packages [11.3 kB]          Hit http://archive.canonical.com quantal/partner i386 Packages                      Get:8 http://packages.linuxmint.com nadia/import i386 Packages [44.0 kB]            Hit http://dl.google.com stable/main i386 Packages                                  Ign http://archive.ubuntu.com nadia Release                                         Ign http://archive.ubuntu.com nadia-updates Release                                 Hit http://archive.ubuntu.com quantal Release                                       Get:9 http://archive.ubuntu.com quantal-updates Release [49.6 kB]                   Ign http://ppa.launchpad.net quantal/main Translation-en_IN                         Ign http://ppa.launchpad.net quantal/main Translation-en                            Get:10 http://security.ubuntu.com quantal-security/main i386 Packages [104 kB]      Hit http://packages.medibuntu.org quantal/free i386 Packages                        Hit http://packages.medibuntu.org quantal/non-free i386 Packages                    Ign http://dl.google.com stable/main Translation-en_IN                              Err http://archive.canonical.com nadia/partner i386 Packages                          404  Not Found [IP: 91.189.92.191 80]     Ign http://dl.google.com stable/main Translation-en                                 Ign http://archive.canonical.com nadia/partner Translation-en_IN                    Ign http://dl.google.com stable/main Translation-en_IN                              Ign http://archive.canonical.com nadia/partner Translation-en                       Ign http://dl.google.com stable/main Translation-en                                 Ign http://archive.canonical.com quantal/partner Translation-en_IN                  Get:11 http://security.ubuntu.com quantal-security/restricted i386 Packages [3,531 B]     Ign http://archive.canonical.com quantal/partner Translation-en                     Get:12 http://security.ubuntu.com quantal-security/universe i386 Packages [45.8 kB]     Get:13 http://security.ubuntu.com quantal-security/multiverse i386 Packages [1,402 B]     Hit http://security.ubuntu.com quantal-security/main Translation-en                 Hit http://security.ubuntu.com quantal-security/multiverse Translation-en           Hit http://archive.ubuntu.com quantal/main i386 Packages                            Ign http://packages.linuxmint.com nadia/import Translation-en_IN                    Hit http://archive.ubuntu.com quantal/restricted i386 Packages                      Hit http://security.ubuntu.com quantal-security/restricted Translation-en           Hit http://archive.ubuntu.com quantal/universe i386 Packages                        Hit http://archive.ubuntu.com quantal/multiverse i386 Packages                      Ign http://packages.linuxmint.com nadia/import Translation-en                       Hit http://security.ubuntu.com quantal-security/universe Translation-en             Ign http://packages.linuxmint.com nadia/main Translation-en_IN                      Hit http://archive.ubuntu.com quantal/main Translation-en                           Ign http://packages.linuxmint.com nadia/main Translation-en                         Ign http://packages.linuxmint.com nadia/upstream Translation-en_IN                  Hit http://archive.ubuntu.com quantal/multiverse Translation-en                     Ign http://packages.linuxmint.com nadia/upstream Translation-en                     Hit http://archive.ubuntu.com quantal/restricted Translation-en                     Hit http://archive.ubuntu.com quantal/universe Translation-en                       Get:14 http://archive.ubuntu.com quantal-updates/main i386 Packages [225 kB]        Get:15 http://archive.ubuntu.com quantal-updates/restricted i386 Packages [4,841 B]     Get:16 http://archive.ubuntu.com quantal-updates/universe i386 Packages [179 kB]     Get:17 http://archive.ubuntu.com quantal-updates/multiverse i386 Packages [10.8 kB]     Hit http://archive.ubuntu.com quantal-updates/main Translation-en                   Hit http://archive.ubuntu.com quantal-updates/multiverse Translation-en             Hit http://archive.ubuntu.com quantal-updates/restricted Translation-en             Hit http://archive.ubuntu.com quantal-updates/universe Translation-en               Err http://packages.medibuntu.org nadia/free i386 Packages                            404  Not Found     Err http://packages.medibuntu.org nadia/non-free i386 Packages                        404  Not Found     Err http://security.ubuntu.com nadia-security/main i386 Packages                      404  Not Found [IP: 91.189.92.200 80]     Ign http://packages.medibuntu.org nadia/free Translation-en_IN                      Err http://security.ubuntu.com nadia-security/restricted i386 Packages                404  Not Found [IP: 91.189.92.200 80]     Err http://security.ubuntu.com nadia-security/universe i386 Packages                  404  Not Found [IP: 91.189.92.200 80]     Ign http://packages.medibuntu.org nadia/free Translation-en                         Err http://security.ubuntu.com nadia-security/multiverse i386 Packages                404  Not Found [IP: 91.189.92.200 80]     Ign http://security.ubuntu.com nadia-security/main Translation-en_IN                Ign http://packages.medibuntu.org nadia/non-free Translation-en_IN                  Ign http://security.ubuntu.com nadia-security/main Translation-en     Ign http://security.ubuntu.com nadia-security/multiverse Translation-en_IN          Ign http://packages.medibuntu.org nadia/non-free Translation-en                     Ign http://security.ubuntu.com nadia-security/multiverse Translation-en     Ign http://security.ubuntu.com nadia-security/restricted Translation-en_IN          Ign http://packages.medibuntu.org quantal/free Translation-en_IN                    Ign http://security.ubuntu.com nadia-security/restricted Translation-en     Ign http://security.ubuntu.com nadia-security/universe Translation-en_IN            Ign http://security.ubuntu.com nadia-security/universe Translation-en               Ign http://security.ubuntu.com quantal-security/main Translation-en_IN              Ign http://security.ubuntu.com quantal-security/multiverse Translation-en_IN        Ign http://security.ubuntu.com quantal-security/restricted Translation-en_IN        Ign http://security.ubuntu.com quantal-security/universe Translation-en_IN          Ign http://packages.medibuntu.org quantal/free Translation-en                       Ign http://packages.medibuntu.org quantal/non-free Translation-en_IN                Ign http://packages.medibuntu.org quantal/non-free Translation-en                   Err http://archive.ubuntu.com nadia/main i386 Packages        404  Not Found [IP: 91.189.92.202 80]     Err http://archive.ubuntu.com nadia/restricted i386 Packages       404  Not Found [IP: 91.189.92.202 80]     Err http://archive.ubuntu.com nadia/universe i386 Packages       404  Not Found [IP: 91.189.92.202 80]     Err http://archive.ubuntu.com nadia/multiverse i386 Packages       404  Not Found [IP: 91.189.92.202 80]     Ign http://archive.ubuntu.com nadia/main Translation-en_IN     Ign http://archive.ubuntu.com nadia/main Translation-en     Ign http://archive.ubuntu.com nadia/multiverse Translation-en_IN     Ign http://archive.ubuntu.com nadia/multiverse Translation-en     Ign http://archive.ubuntu.com nadia/restricted Translation-en_IN     Ign http://archive.ubuntu.com nadia/restricted Translation-en     Ign http://archive.ubuntu.com nadia/universe Translation-en_IN     Ign http://archive.ubuntu.com nadia/universe Translation-en     Err http://archive.ubuntu.com nadia-updates/main i386 Packages       404  Not Found [IP: 91.189.92.202 80]     Err http://archive.ubuntu.com nadia-updates/restricted i386 Packages       404  Not Found [IP: 91.189.92.202 80]     Err http://archive.ubuntu.com nadia-updates/universe i386 Packages       404  Not Found [IP: 91.189.92.202 80]     Err http://archive.ubuntu.com nadia-updates/multiverse i386 Packages       404  Not Found [IP: 91.189.92.202 80]     Ign http://archive.ubuntu.com nadia-updates/main Translation-en_IN     Ign http://archive.ubuntu.com nadia-updates/main Translation-en     Ign http://archive.ubuntu.com nadia-updates/multiverse Translation-en_IN     Ign http://archive.ubuntu.com nadia-updates/multiverse Translation-en     Ign http://archive.ubuntu.com nadia-updates/restricted Translation-en_IN     Ign http://archive.ubuntu.com nadia-updates/restricted Translation-en     Ign http://archive.ubuntu.com nadia-updates/universe Translation-en_IN     Ign http://archive.ubuntu.com nadia-updates/universe Translation-en     Ign http://archive.ubuntu.com quantal/main Translation-en_IN     Ign http://archive.ubuntu.com quantal/multiverse Translation-en_IN     Ign http://archive.ubuntu.com quantal/restricted Translation-en_IN     Ign http://archive.ubuntu.com quantal/universe Translation-en_IN     Ign http://archive.ubuntu.com quantal-updates/main Translation-en_IN     Ign http://archive.ubuntu.com quantal-updates/multiverse Translation-en_IN     Ign http://archive.ubuntu.com quantal-updates/restricted Translation-en_IN     Ign http://archive.ubuntu.com quantal-updates/universe Translation-en_IN     Fetched 771 kB in 1min 19s (9,715 B/s)     W: Failed to fetch http://archive.canonical.com/ubuntu/dists/nadia/partner/binary-i386/Packages  404  Not Found [IP: 91.189.92.191 80]          W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/nadia-security/main/binary-i386/Packages  404  Not Found [IP: 91.189.92.200 80]          W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/nadia-security/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.92.200 80]          W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/nadia-security/universe/binary-i386/Packages  404  Not Found [IP: 91.189.92.200 80]          W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/nadia-security/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.92.200 80]          W: Failed to fetch http://packages.medibuntu.org/dists/nadia/free/binary-i386/Packages  404  Not Found          W: Failed to fetch http://packages.medibuntu.org/dists/nadia/non-free/binary-i386/Packages  404  Not Found          W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/nadia/main/binary-i386/Packages  404  Not Found [IP: 91.189.92.202 80]          W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/nadia/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.92.202 80]          W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/nadia/universe/binary-i386/Packages  404  Not Found [IP: 91.189.92.202 80]          W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/nadia/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.92.202 80]          W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/nadia-updates/main/binary-i386/Packages  404  Not Found [IP: 91.189.92.202 80]          W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/nadia-updates/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.92.202 80]          W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/nadia-updates/universe/binary-i386/Packages  404  Not Found [IP: 91.189.92.202 80]          W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/nadia-updates/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.92.202 80]          E: Some index files failed to download. They have been ignored, or old ones used instead.           My Sources.list looks like :               deb http://packages.linuxmint.com/ nadia main upstream import     deb http://archive.ubuntu.com/ubuntu/ nadia main restricted universe multiverse     deb http://archive.ubuntu.com/ubuntu/ nadia-updates main restricted universe multiverse     deb http://security.ubuntu.com/ubuntu/ nadia-security main restricted universe multiverse     deb http://archive.canonical.com/ubuntu/ nadia partner     deb http://packages.medibuntu.org/ nadia free non-free          # deb http://archive.getdeb.net/ubuntu quantal-getdeb apps     # deb http://archive.getdeb.net/ubuntu quantal-getdeb games     deb http://archive.ubuntu.com/ubuntu/ quantal main restricted universe multiverse     deb http://archive.ubuntu.com/ubuntu/ quantal-updates main restricted universe multiverse     deb http://security.ubuntu.com/ubuntu/ quantal-security main restricted universe multiverse     deb http://archive.canonical.com/ubuntu/ quantal partner     deb http://packages.medibuntu.org/ quantal free non-free          # deb http://archive.getdeb.net/ubuntu quantal-getdeb apps     # deb http://archive.getdeb.net/ubuntu quantal-getdeb games


SCO Unix run interactive script when sending a print job

I'm working with (read, "around") a proprietary ERP system on top of SCO Unix. It has several "query at print time" reports where you can assign a printer to send your job to. You usually input something like "%lp5", which spools your job to printer lp5. If I want to create a pseudo-printer that will interact with the user and then return control to the ERP how would I go about it? I have manipulated the LP interfaces scripts in the vein of this article, to include dynamic data into the reports and flow control to a print server. But now I want to do actual interaction with the user to connect print jobs with a separate HylaFax server that I've built, so I need a way of triggering a shell script and asking the user for fax coversheet information. Our system has a built in fax system using VsiFax (which I'm trying to subvert), but I don't see how it is performing the same function I'm trying to do. You usually send your job to the VsiFax system by printing to "@fax" which I don't know if it's a hardcoded printer on the ERP side or if there is some Unix convention that is being used to call a shell script. I guess what I'm looking for is a resource or some help on what the SCO Unix printer assignment conventions might be related to syntax of printer names (what does "@" and "%" mean and are there other special characters, and how I could call a shell script when sending that print job?


Change default DNS on openvpn connect

I am using Network Manager on Ubuntu 12.10 to connect to an openvpn server. The connection works without problems. However, when I connect, I would like to change my default DNS server to a server on the vpn network. That way I can use domain names that are only defined on the vpn network. Is there a way I can make this automatic with Network Manager? I can also change settings on the openvpn server if that is the way I need to go. Thanks!


find files without extension

Let say I have:               foo.txt     bar     baz.ooo      If I use `ls -1 !(*.*)` then I'll get only `bar` on the output. Great, now I wish to have same results with find - some `find -regex` that will do the job. **NOTE:** `find -name !(*.*)` is not the answer as `!(*.*)` in it is still Bash's glob which I can NOT use.


Deduplication on partition level

What are available solutions for block level or more detailed deduplication ? There are file-based ones - with "Copy-On-Write" approach. I'm looking for block level "copy-on-write", so I could periodically look for common blocks, or - preferably - parts of files, merge them and flag for CoW use manner. Is there sth like this available, or does it still need to be created ? I am not sure if Btrfs deduplication is block/file/subpart level ? There is LessFS, but I'am not sure what level of deduplication does it provide ? Maybe other solution?


Partitioning for Web Servers

I was curious what some general best practices are in relation to partitioning for a new Linux VM that will be used as a web server? Are there certain guides that should be consulted or followed? What partitions should be created? What are the common sizes for the various partitions that should be created? Should I worry about LVMs, and if so, what do I need to know about them? I am working on building a template for many new web server builds and I wanted to make sure that I have something that will be able to be used now and for a little while into the future to turn up new servers with. Also, this will likely be used on CentOS 6.x or RHEL 6.x.


Use AWK add new line if match exists

I have a file with the following format:               aaa@ bbb     bbb@ ccc& ddddd@ aaaf     ccc@ ddd& eee: abcd& dassda      The output should be:               aaaa@ bbb     bbb@ ccc&     ddddd@ aaaf     ccc@ ddd&     eee@ abcd& dassda      How would I be able to achieve this using AWK? I've tried sed and awk but I can only print a new line after the delimeter, I don't know how to print the whole thing on the next line.