How to get the name of the user that launched `sudo`

My problem: I have a Python program, and the user launch it using `sudo`. Sometimes I have to get the user's home, and I can do this only knowing its name:               import pwd          pwd.getpwnam(username)      So: how can I get the name of the user that launched the program?


How to disable multiple logins in GNOME?

Basically, I want to disable multiple logins. The family laptop (not mine) has a problem with the x server -- at least it seems to be the x server. When two users are logged in simultaneously the x-server fails to start for the one who was logged in first. Having two users logged in seems to steal processor speed anyway. So I want to disable people from choosing 'switch user' over 'log out (username)' or 'shut down'.


How can I copy a subset of files from a directory while preserving the folder structure?

I want to move some subset of files from dirA to dirB (let's say files with "blah" in the filename), but I want all the nested directories to be the same in the new location. How can I do that?


How to set window size and location of an application on screen via command line?

I want Firefox window to be opened in a specific size, and location on screen using a shell command, for example:               firefox myfile.html size 800x600 location bottom-left      Is there such a command?


Loss of .eps file quality after using scp to transfer from remote server

When I scp (secure copy protocol) a .eps image file (generated using IDL) from a remote server to my desktop, the image seems to be of a lowered resolution and "choppy". Strangely, when I transfer from one remote server to another I do not have this problem. How can I maintain image quality while transferring such files to my desktop?


Sending signal to user that a partricular driver is loaded

These are some of the messages coming on console from Microzed board (Cortex A9):               [Sat May 17 18:18:26.603 2014] DMA: preallocated 256 KiB pool for atomic coherent allocations     [Sat May 17 18:18:26.603 2014] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xf004e000     [Sat May 17 18:18:26.603 2014] usbcore: registered new interface driver usbfs     [Sat May 17 18:18:26.624 2014] usbcore: registered new interface driver hub     [Sat May 17 18:18:26.624 2014] usbcore: registered new device driver usb     [Sat May 17 18:18:26.624 2014] Switching to clocksource xttcps_clocksource     [Sat May 17 18:18:26.624 2014] e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps     [Sat May 17 18:18:26.624 2014] console [ttyPS0] enabled     [Sat May 17 18:18:26.634 2014] xdevcfg f8007000.ps7-dev-cfg: ioremap f8007000 to f0052000 with size 100     [Sat May 17 18:18:26.662 2014] xqspips e000d000.ps7-qspi: master is unqueued, this is deprecated     [Sat May 17 18:18:26.662 2014] spi spi32766.0: setup: unsupported mode bits 3     [Sat May 17 18:18:26.662 2014] xqspips e000d000.ps7-qspi: can't setup spi32766.0, status -22     [Sat May 17 18:18:26.662 2014] spi_master spi32766: spi_device register error /amba@0/ps7-qspi@e000d000/ps7-qspi@0     [Sat May 17 18:18:26.662 2014] xqspips e000d000.ps7-qspi: at 0xE000D000 mapped to 0xF0054000, irq=51     [Sat May 17 18:18:26.671 2014] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver     [Sat May 17 18:18:26.680 2014] ULPI transceiver vendor/product ID 0x0424/0x0007      After the line:               [Sat May 17 18:18:26.624 2014] usbcore: registered new device driver usb      I want to inform that yes USB driver is indeed loaded. One way I though would be to light an LED immediately after this line is printed on the console. But how do I do this? Is there any other better way of doing this? Main requirement is to measure the timing right from power ON to the USB driver loaded. This can be done if I get any signal on the board the moment USB driver is loaded. I will capture this signal along with power ON, and this will give me precise information about the time USB is loaded. This precision cannot be achieved by looking at the time stamps in log file since the messages do not come immediately and there is considerable time spent before the message start coming.


Internetless/Remote Arch Install

Don't have a WiFi card compatible with any modules for Linux or Ethernet, but I do have working OS X install with WiFi. Do have brew on OS X, and it being OSX, most Linux programs will run. How can I install Arch in this scenario? What are my install options? I have heard If I am running a existing Linux install (not sure if BSD/Darwin counts, hoping it does) I can do a install without booting to **LIVE ARCH LINUX DISK**. Will I have hope? I don't need wifi, I just need it installed with packages!


How to rename pattern in one file to another over several directories recursively

I have several directories through which I want to recursively iterate over and change the file name of > *.GEOT14246.* to > *.GEOT15000.* Is there a one liner on the bash script to do this or do I have to the write a script with a for loop. My try (which doesn't work) is below:               #!/bin/bash          for file in `find . -type f -name "*.GEOT14246.*"`       do         echo "file = $file"         mv $file *.GEOT15000.*     done      I then call with:               cd /path/to/script/     sh ./script1.sh /path/to/starting/dir      Obviously this doesn't work because I don't think I'm passing the starting directory path as an argument. I'm very new to Unix, so how can I pass arguments to it to say from which directory it should start searching and how do I get the script to work?


How to split a file by using keyword boundaries

I have a vcf file that contains numerous vcards. When importing the vcf file to outlook it seems to only import the first vcard. Hence I want to split them up. Given that a vcard starts with               BEGIN:VCARD      and ends with               END:VCARD      What is the best way to split each vcard into it's own file. Thanks **UPDATE** Thanks for all the responses. As with questions of this nature there's various ways to skin a cat. Here's the reasoning why I chose the one I did. **ROUND-UP** Here's a roundup of what I liked from each answer and what drove me to select one of them.   * `csplit`: I really really liked the conciseness of this method. I just wished it was able to also set the file extension.   * `gawk`: It did everything i asked of it.   * `paralell`: Worked. But I had to install new things. (it also decided to make a new /bin dir in my home dir)   * `perl`: I liked that it created vcf based on contact's name. But the -o option didn't really work **Conclusion**   * So the first one to go was `perl` because it was a bit broken   * Next was `paralell` because I had to install new things   * Next was `csplit`, because as far as I can see it can't create extensions on the output files   * So the award goes to gawk, for being a utility that's readily available, and versatile enough that I can chop and change the file name a bit. Bonus marks for `cmp` too :)


Change a specific line using sed

I need to change a line in a Java file called `DbConnection.java` using the `sed` command. The line is:               connection = DriverManager.getConnection("jdbc:mysql://**localhost**/**bajaj**","**root**", "**root**");      I have tried the below which works fine (I can replace user provided value):               sed -i "s|://localhost/bajaj|://${HOSTNAME}/${DBNAME}|" DbConnection.java      But the below one I need some help with, I can't replace the `DBUSERNAME` & `DBPASSWORD`:               sed -i "s|"jdbc:mysql://localhost/bajaj","root", "root"|"jdbc:mysql://${HOSTNAME}/${DBNAME}","${DBUSERNAME}", "${DBPASSWORD}"|" DbConnection.java


Create directory using filenames and move the files to its repective folder

I have a folder with around 150 text files. I would like to create folders in the name of the 150 files. After that I would like the text file to be moved to its respective folder. Example names of the files inside myfolder directory:               ~/myfolder/            |______ ajhaslf.txt            |______ oiueed.txt            |______ dsflije.txt      How I would like my new structure to be:               ~/myfolder/            |______ ajhaslf                        |____ajhaslf.txt            |______ oiueed                        |____oiueed.txt            |______ dsflije                        |____dsflije.txt      Of course creating directory with the filenames is not a problem for me with `mkdir`.


Creating an email that can trigger a script

I have a CentOS 6.3 server. I would like to create an email address like, for example, list@myserver.com that will be a special kind of email that will trigger a script. For example: suppose I mail list@myserver.com and the subject is an IP address. I want the server to receive that mail, extract that IP from the subject and append it to a file. How is this done on Linux? Can you guys tell me how this can be done?


Selectively disabling gvfsd-cdda in Debian Squeeze?

Is there a way to selectively disable `gvfsd-cdda` on Debian Squeeze? Since I updated my machine to Squeeze `grip` can no longer eject a CD, which interferes with ripping. I traced it back to `gvfsd-cdda`, but found no preference or configuration to disable it. I can't uninstall package `gvfs- backends` either, because it is required by `gnome-core`. I did find `/usr/share/mounts/cdda.mount`, but disabling that feels like an ugly hack that will be overwritten on the next update of the package.


ffmpeg and libmp3lame produces bad audio quality?

when I get a flash video from YouTube, why is the quality of the audio much worse than the origin video on YouTube? When I downloaded the flash movie, I convert it to avi like this:                  ffmpeg -i ~/"$2.flv" -sameq -acodec libmp3lame -vol 200 -ar 44100 -aq 300 -ab 2097152 ~/"$2.avi"      I already set -aq (audio quality) to 300, but no difference to 100 or 200. Moreover 100 is the max. value in my opinion. -ar (frequecy) 44100 should be ok too and the bitrate in bit/s (-ab) should be 256kb/s (2097152 / 1024 / 8). I am not sure what is the right bitrate for a good quality but I think 256kb/s should be fine. Or did I calculate it wrong? What could be the problem?


What happened to bzip1?

bzip2 had been a _de facto_ standard for quite strong compression throughout many years already. I myself had typed the `bzip2` command thousands of times already, which makes me wonder - what happened to bzip, or bzip1? Google doesn't seem to tell me much about it and it sounds like it could be an interesting history lesson.


Cowfiles directory?

My bashrc issues a cow from `cowsay` and with a random `fortune`. Like this:               echo -e "\e[00;33m $(fortune -a -o -s | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n1) | sed -e 's/^/       /g')\e[00m"      This works on Linux Mint but I moved to Arch Linux, and the cowfile directory is different now. Is there a standard way to figure out the cow directory?


Difference between Login Shell and Non-Login Shell?

I understand the basic difference between an interactive shell and a non- interactive shell. But what exactly differentiates a login shell from a non- login shell? Can you give examples for uses of a **_non-login interactive_** shell?


Install RHEL 5.7S on machine with 4TB disks

I'm getting errors about GPT when installing OS using kickstart. The Dell R720 has 8x 600GB SAS. I can't figure out what to configure in BIOS and kickstart file. In BIOS, there're boot options of BIOS and UEFI. SATA has a few options, AHCI and RAID mode. In PERC, I select all disks and select RAID level 5. I tried a few combinations but they all don't work. Does anyone here has experience setting up machine with such large local disk array? My kickstart.cfg has this:               clearpart --all --drives=sda     part /boot --fstype ext3 --size=16     part pv.2 --size=0 --grow --ondisk=sda     volgroup vg --pesize=65536 pv.2          logvol / --fstype ext3 --name=root --vgname=vg --size=51200     logvol swap --fstype swap --name=swp --vgname=vg --size=131072     logvol /tmp --fstype ext3 --name=tmp --vgname=vg --size=524288     logvol /opt/lo --fstype ext3 --name=lo --vgname=vg --size=3072000      Thank you in advance.


Compiling PHP and installing it under one directory

I have to compile a few versions of PHP in work but I need an apache service for each version running like we have on Windows. However the configure options seem to have different folders for everything. I was wondering if there was an easy way to configure so when I make install it is all in one folder, with all the extensions in ext etc rather than scattered around the system. I want to compile 5.5.1, 5.3.27, 5.2.17 and 4.3.11. Now this wouldn't be a problem with just one PHP version but with multiple versions things will probably be overwritten/conflicted in other ways. Say I want everything to go to `/php/5.5.1/` ./configure --prefix=`/php/5.5.1/` How else is this to be configured to put everything in that folder? Has anyone else done this?


How to know I am using vi or emacs input?

Crash shell allows to specify the command line editing mode to vi or emacs. What will be the difference in these input methods? I am not asking about the internal features.


OOM Killer value always one less than set

I am trying to set the `oom_adj` value for the out of memory killer, and each time I do (regardless of the process) I get back exactly one less than I set (at least for positive integers. I haven't tried negative integers since I want these processes to be killed by OOM Killer first).               [root@server ~]# echo 10 > /proc/12581/oom_adj     [root@server ~]# cat /proc/12581/oom_adj     9     [root@server ~]# echo 9 > /proc/12581/oom_adj     [root@server ~]# cat /proc/12581/oom_adj     8     [root@server ~]# echo 8 > /proc/12581/oom_adj     [root@server ~]# cat /proc/12581/oom_adj     7     [root@server ~]# echo 7 > /proc/12581/oom_adj     [root@server ~]# cat /proc/12581/oom_adj     6     [root@server ~]#       Is this expected behavior? If not, why is this happening?


How do I launch Pidgin when I click on an irc:// link?

Is there a way that when you click an IRC url (such as `irc://##linux`) that it will open Pidgin? I believe it has something to do with `gconf-editor`, but I do not know the terminal command to start an IRC chat in Pidgin. I am using Linux Mint, if that matters.


last reboot/uptime/... strange behaviour

I know this has been more or less asked before but I still don't have any answer. I started to investigate why on my system (it is a remote machine) `who -b` and `uptime` gave different results (~3 days for one / 5 days for the other). Some answers would say that maybe `/var/run/utmp` is corrupted. Some other answers would say that the ntp server was launched after the reboot and so the system had to go backwards to set the time. Here are a few commands I have typed down :               ubuntu@arm:~$ sudo hwclock --show     Mon 25 Nov 2013 03:07:02 PM CET  -0.464179 seconds          ubuntu@arm:~$ uptime     15:08:17 up 3 days, 53 min,  1 user,  load average: 0.88, 0.51, 0.41          ubuntu@arm:~$ date     Mon Nov 25 15:08:33 CET 2013          ubuntu@arm:~$ who -b     system boot  2013-11-20 12:38          ubuntu@arm:~$ last reboot     reboot   system boot  3.7.10-x9        Wed Nov 20 12:38 - 15:08 (5+02:30)        reboot   system boot  3.7.10-x9        Wed Nov 20 12:37 - 15:08 (5+02:31)        reboot   system boot  3.7.10-x9        Thu Nov  7 14:26 - 12:36 (12+22:10)       reboot   system boot  3.7.10-x9        Thu Nov  7 14:25 - 12:36 (12+22:11)       reboot   system boot  3.7.10-x9        Thu Nov  7 14:23 - 12:36 (12+22:12)       reboot   system boot  3.7.10-x9        Thu Nov  7 14:22 - 12:36 (12+22:14)       reboot   system boot  3.7.10-x9        Tue Nov  5 14:58 - 14:22 (1+23:23)        reboot   system boot  3.7.10-x9        Sat Nov  2 12:20 - 14:58 (3+02:37)        reboot   system boot  3.7.10-x9        Sat Nov  2 12:20 - 12:20  (00:00)              wtmp begins Sat Nov  2 12:20:00 2013      Notes : the machine is remote/embed in a system. Sometimes the electricity is shut down. The internet connection is very slow (sim card) Questions : 1) What does it mean when there are multiple lines for 1 boot ? I would expect all the lines to look like Nov 5, but on the 7th there are 4 lines at almost the same time and the end time is the same for all of them. I would expect 14:22-14:23 (00:01), 14:23-14:25 (00:02), ... 2) If the electricity is turned down and up again, does it count as a reboot ? How does it affect the internal time ? (ntp server stuff) 3) Is there a scenario one can trust for the 2 days difference between uptime and who -b ? My guts tell me that the file `/var/run/utmp` can't be corrupted/have permissions errors as no one else than the system use it. Any help is grandly appreciated Ref: Uptime and who -b are showing different times when the system was last booted on Linux


cat line X to line Y on a huge file

Say I have a huge text file (>2GB) and I just want to `cat` the lines `X` to `Y` (e.g. 57890000 to 57890010). From what I understand I can do this by piping `head` into `tail` or viceversa, i.e.               head -A /path/to/file | tail -B      or alternatively               tail -C /path/to/file | head -D      where `A`,`B`,`C` and `D` can be computed from the number of lines in the file, `X` and `Y`. But there are two problems with this approach:   1. You have to compute `A`,`B`,`C` and `D`.   2. The commands could `pipe` to each other **many more** lines than I am interested in reading (e.g. if I am reading just a few lines in the middle of a huge file) Is there a way to have the shell just work with and output the lines I want? (while providing only `X` and `Y`)?


Efficient way to print lines from a massive file using awk, sed, or something else?

If I had a plain-text file containing 8 million lines and I want to print out lines 4,000,010 to 4,000,000 to the screen, which would be more efficient: awk or sed? There is no pattern to the text, and unfortunately, a database isn't an option. I know this isn't ideal, I'm just curious on which one would complete the task quicker. Or maybe there is even a better alternative to sed or awk?


Split a file into multiple based on selected lines

I have a file in which more than 50,000 lines are there. How can I split the file into two or more based on the selected lines? Suppose I want to split a file from line 10,000 to line 40,000.


How to echo from specific line of a file to another specific line

Assume I have a file with about 10000 lines. How can I print 100 lines, starting from line 1200 to line 1300?


read specific lines from the file

I have some text file (for example json). I can use `head` order for the reading of the first lines. For example:               head -n 100 file.json      get me 100 first lines back. What is Linux order, which I can use to read some general lines somewhere in file? For example from the line 500 to the line 700.


How can I get a specific line from a file?

I want to extract an exact line from a very big file. For example, line 8000 would be gotten like this:               command -line 8000 > output_line_8000.txt


Easy way to copy lines from one file to another

> **Possible Duplicate:**   >  cat line X to line Y on a huge file Very simple issue but can't seem to find a simple resolution! I have a massive text file from which I only need around 150 lines. The lines are really long and therefore viewing it in putty is a bit of a nightmare. I just want to copy these lines to another file so that I can view it properly in an editor. (I can't view the original file in an editor as my Windows machine can't handle it). The lines I want start at around line 2000. Thanks,


Command to print few consecutive lines from middle of a file

For a file containing 20 lines, lines 6-10 can be printed using following command:               head -10 filename | tail -5      Can this exactly same thing be done without using 'head' and 'tail' commands ?? Please comment the link if similar question already exists.


proper permissions under HTTP root with Apache2 + FastCGI + Suexec

I currently have a setup which runs Apache2 + FastCGI PHP + Suexec. As an example, I'm using `/mnt/data/www/vhosts/inflex.co.uk/htdocs` as a DocRoot for one of my virtual hosts. I have a script `/mnt/data/www/php5-cgi/inflex.co.uk/php5-cgi` which contains:                   #!/bin/sh         exec /usr/bin/php5-cgi      The account the scripts should run under is `duncan`, this file is owned by duncan and also in the group duncan. It has `-rwxr-x---` permissions. `.../www/vhosts/inflex.co.uk` and `../inflex.co.uk/htdocs` is owned by duncan and in the group duncan. If I remove all access for others, such as `chmod 750`, I get an error regarding permissions when trying to access the website, if I allow read/write for others, 755 say, it works. I'm assuming this is an issue with `www-data` (apache2 user) accessing the directory, but I thought the point of Suexec was that all of this was ran under a seperate user, or does `www-data` require read (maybe write?) on the folder and then executes PHP php file as the user?


Thunar file manager: Sort by column keyboard shortcut?

I'm using Xfce 4.3 and the lightweight Thunar file manager. I often change file listings between Sort by Date Modified and Sort by Name. But it seems the only way to do this is by clicking the column header with the mouse, which slows down productivity. Is there anyway to activate these sort mechanisms using the keyboard? They are not listed in any of the menus.


Linux Home Firewall

I was recently delving into thoughts of building a small home server to run random things off of (maybe a TF2 server). Thinking about this further I realized I would need to get a better firewall system for my current home network. I was wondering what would be a good Linux distro to run for a home network firewall? There are a ton of distro's out there, and it is kinda overwhelming when you're new to it. I have looked at Zentyal (previously eBox), SmoothWall, M0n0wall and a couple others. I have little experience in setting up firewalls, but I am willing to do some research into it and give it a shot. I would just like a little help with the starting ground. If someone could provide some pro's/con's of available distro's or some insight on what might be best to set up in a home network it would be appreciated! Thanks!


Is it possible to bind a shell script to a key press

I used xev to find the key code for fn-f5 and came up with a little script to toggle the bluetooth on or off. My question is whether it's possible to bind fn-f5 (keycode 246) to my shell script (bttoggle) using, preferably, xmodmap.


Trouble installing MySQL from binaries

So, I am a freshman in Computer Science, and I have dug an old computer out of my garage to use as a personal hosting server for various services (email, web site, subversion, etc.), partly because I actually need those things and partially for the learning experience. WOPR (props if you get the reference) is a 10yr+ old Dell Dimension with 256 MB RAM and a 500MHz Intel Pentium III processor. It is running Arch Linux 2010.05 (kernel 2.6.33); I downloaded the MySQL binaries from here just now and tried installing. I am following this procedure from the MySQL docs:                   shell> groupadd mysql         shell> useradd -r -g mysql mysql         shell> cd /usr/local         shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz         shell> ln -s full-path-to-mysql-VERSION-OS mysql         shell> cd mysql         shell> chown -R mysql .         shell> chgrp -R mysql .         shell> scripts/mysql_install_db --user=mysql         shell> chown -R root .         shell> chown -R mysql data         shell> cp support-files/my-medium.cnf /etc/my.cnf         shell> bin/mysqld_safe --user=mysql &         shell> cp support-files/mysql.server /etc/init.d/mysql.server      I get the following messages: > >     WARNING: The host 'WOPR' could not be looked up with resolveip. >     This probably means that your libc libraries are not 100 % >   > > compatible with this binary MySQL version. The MySQL daemon, mysqld, should > work normally with the exception that host name resolving will not work. > This means that you should use IP addresses instead of hostnames when > specifying MySQL privileges ! Installing MySQL system tables... > ./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open > shared object file: No such file or directory >   >   >     Installation of system tables failed!  Examine the logs in >     ./data for more information. >   >     You can try to start the mysqld daemon with: >   >         shell> ./bin/mysqld --skip-grant & >   >     and use the command line tool ./bin/mysql >     to connect to the mysql database and look at the grant tables: >   >         shell> ./bin/mysql -u root mysql >         mysql> show tables >   >     Try 'mysqld --help' if you have problems with paths.  Using --log >     gives you a log in ./data that may be helpful. >   >     Please consult the MySQL manual section >     'Problems running mysql_install_db', and the manual section that >     describes problems on your OS.  Another information source are the >     MySQL email archives available at http://lists.mysql.com/. >   >     Please check all of the above before mailing us!  And remember, if >     you do mail us, you MUST use the ./bin/mysqlbug script! >   I have glibc installed from the latest version of Arch. Does anyone know what libaio.so.1 is, what package it comes from, and what its dependencies might be?


Run expect script from other shell

My target is to create the `/var/tmp/add_user.bash` script from `/var/tmp/create_script_add_user.bash` script and run the expect script (`add_user.bash`) from `create_script_add_user.bash` script. The problem is that when I run the script `add_user.bash` from `create_script_add_user.bash`, then expect gets stuck on the question:                     Proceed? n)       It looks like expect can't see the question from standard output. But when I run the script `/var/tmp/add_user.bash`, then it works fine. Why can't expect run from the other script? And how to solve this issue? ### Contents of `/var/tmp/create_script_add_user.bash`                  #!/bin/bash                  echo '#!/bin/bash                  add_user=`cat << EOF        set timeout -1        spawn /var/tmp/add_user.bash user_name=OBAMA        expect n)   { send "yes\r" }        expect eof        EOF`              /usr/local/bin/expect -c  "$add_user"              '> /var/tmp/add_user.bash              chmod +x /var/tmp/add_user.bash              #need sleep for 5 seconds         ( sleep 5 ; /var/tmp/add_user.bash ) &      ### Contents of `/var/tmp/add_user.bash`                #!/bin/bash           add_user=`cat << EOF      set timeout -1      spawn /var/tmp/add_user.bash user_name=OBAMA      expect n)   { send "yes\r" }      expect eof      EOF`           /usr/local/bin/expect -c  "$add_user"


Why does it take so much time to execute semodule -i mypol.pp?

Command `semodule -i mypol.pp` takes more than one minute to execute. Why?


Tmux makes a sound when I launch it, how could I disable that?

When I launch tmux in the terminal, is causes my Linux Mint to play a sound in the speakers. The sound is a Linux Mint system sound. Perhaps it's the "alert" sound, but I cannot identify it by name. The same alert sound plays when I exit tmux. Any ideas on how to disable this sound when tmux is launched?


What is the connection between a gedit bug and a Unix-&-Linux Q/A href?

While answering a _Unix-&-Linux question_, I observed that Gedit and two other editors, Leafpad and Medit (I tested 12 editors altogether) exhibit the a certain bug. As it turns out, the bug is known to Canonical's launchpad as Bug #332321 _search (and replace) takes ss as ß_. The bug's behaviour is that `find ß` will match both `ß` and `ss`... (not nice, especially if you do a replace-all). I then noticed that the StackExchange software, in order to create the question's href link, had converted the question's title from `How to bind “ß” to Meta-s?` to `how-to-bind-ss-to-meta-s`. So two completely unrelated environments are treating `ß` in a similar manner.. What is this strange attraction between `ß` and `ss`? ... and are there other such 'relationships'?


Making multiple calls to a program via a bash shell script

Suppose that I have a program `make_ndx` that outputs via the `-o` switch. I would like to call `myprogram` from a bash shell script and output two files, `out1.ndx` and `out2.ndx`. (`myprogram` takes a string as input to the `-o` switch and automatically appends the file extension `.ndx` to that string.) So, I have written a bash shell script:               #!/bin/bash          make_ndx -o out1     make_ndx -o out2      I obtain two output files: `out1.ndx` and `out2.ndx`. But I would like to instead obtain `out1.ndx` and `out2.ndx`. It seems like the `` character in corresponds to a newline or return character (possibly `\n` or `\r`?), because when I copy and paste the file name to a text file (or to this post), `out1.ndx` appears as               out1     .ndx      (Note that, for the purpose of this post, I am using another character (``) to represent the square symbol that I see in my SSH GUI, since when I copy the actual character from the SSH GUI to here, I simply obtain a newline character.) How can I write my bash shell script so that the newline character does not appear in the filename of the first output file? The same problem occurs when I put an extra space between the calls to `make_ndx`:               #!/bin/bash          make_ndx -o out1          make_ndx -o out2      Thanks for your time.


Tool to convert between human-readable byte sizes and bare byte counts

Can you recommend a Unix-style tool that converts between human-readable bytesizes (e.g., 10KiB->10240, 10240->10KiB)? By Unix-style I mean that it should do just this (i.e., be just a simple filter without any GUI or other cruft) and do it well (i.e., handle different units, behave intelligently by default while allowing optional settings, such as different interpretation of non-IT units (k==1000 OR 1024), optional custom rounding, optional conversion to units that aren't the most fitting ones, etc.).


How can I send attachment with ssmtp in Linux?

I can send email from my gmail account by ssmtp in Linux now. But how can I attach files to the email?


id3v2 used recursively at command line?

Trying to get my id3 tags cleaned up and am loving id3v2 on the command line -- but I've been using it only with a *.mp3 wildcard and want to explore if there's a way to use it recursively so I can batch all of my MP3s. There doesn't seem to be an option to use it recursively. I'm pretty sure all you awesome command line folks know of a sweet way to do this, but I am still learning my way through it... Here's the commands I have aliased to brute force it:               id3v2 --remove-frame "COMM" *.mp3     id3v2 --remove-frame "PRIV" *.mp3     id3v2 -s *.mp3      So -- is there a way to do this recursively, so I can run it a the root of my music folder? Gravy points for: including other audio file types and collapsing all three commands above into one uber command (I can do this with the `;` between commands... right?)


What does C-u 0 mean in Emacs

What does C-u 0 followed by another command mean in general in Emacs? For example, I thought C-k and C-u 0 C-k were the same, but find out that C-u 0 C-k kill the part of the current line before the cursor, while C-k kill the the part after. Thanks.


How to restore the partition layout for GPT disk

parted -ms /dev/sda print > sda.parted      This actually copies the layout to a file. If I want to restore the layout, what command should I give?


What's the difference between a normal user and a system user?

Some documentation I'm going through has a boolean switch on whether or not a user is a 'system' user or a 'normal' user defaulting to 'normal'). What is the difference between these two modes of user-ship? I'm not new to basic UNIX concepts, but I am pretty new to UNIX sysadmin.


mknod permanent in archlinux

I have a custom kernel module (on ArchLinux) that I can load manually and interact with. What I would like to do is have it loaded at boot time. So far I have managed to get the device appear in `/proc/devices` when booting. How to make a node out of it at boot time is what is haunting me. Having looked at `udev` most examples use USB drives as guides which is not the case for me. The actual device is a custom made IO card. It is a character device. Below is the script to load the device from the shell (which works):               #!/bin/sh     sudo insmod ./robsio.ko     DEV=`cat /proc/devices | grep robsio | awk '{print $1}'`     sudo mknod /dev/proc/robsio c $DEV 0


What is the difference between a Library call and a System call in Linux?

I would like to know what is the difference between a Library call and a System call in Linux. Any pointers for a good understanding of the concepts behind both will be greatly appreciated.


How do open files behave on linux systems?

I just renamed a log file to "foo.log.old", and assumed that the application will start writing a new logfile at "foo.log". I was surprised to discover that it tracked the logfile to its new name, and kept appending lines to "foo.log.old". In Windows, I'm not familiar with this kind of behavior - I don't know if it's even possible to implement it. How exactly is this behavior implemented in linux? Where can I learn more about it?


Unable to get the right exit code from a script

I have a script which connects to a remote server via SFTP and get some file from there. My script goes like this:               /usr/bin/sftp USER@remote.server.com <<EOF     lcd /dir1/dir2/dir3     cd /rsdir1/rsdir2/rsdir3     get file_pattern`date -d "last month" +%m%Y`.csv     EOF     rc=$?             if [[ $rc != 0 ]]                then             echo "Error occured getting file and the script abended with error code $rc" `date "+%Y-%m-%d-%H.%M.%S"`                 exit 1         else         echo "Successfully transferred the file" `date "+%Y-%m-%d-%H.%M.%S"`             fi      However, even if the script doesn't find the file with the pattern it goes to the **else** part of the script and gives me the output on the screen as               Connecting to remote.server.com...     sftp> lcd /dir1/dir2/dir3     sftp> cd /rsdir1/rsdir2/rsdir3     sftp> get file_pattern032014.csv     Couldn't stat remote file: No such file or directory     File "/rsdir1/rsdir2/rsdir3/file_pattern032014.csv" not found.     Successfully transferred the file YYYY-MM-DD-24HH.MI.SS       Any advices on what I might be doing wrong here?


How to install red5 & Java on centos 6.4

There are many tutorials out there but not so many for 6.4 and it seems people are having problems with running either Java 6 or 7 and Ant. So does anyone know where to find a definitive guide? Should Java be version 6 or 7 and can I just `yum install java`? Then which version of `red5` should I be installing? On their site they have video tutorials that don't even reflect the sitemap of their site! so confused..


Why does my system freeze during bootup unless I boot into recovery mode?

I installed some packages, and now when I try to boot into it normally it freezes at this point. ![enter image description here](http://i.stack.imgur.com/WPfKY.jpg) The only thing I can do from there is reboot the system. When I do that, this is what's displayed. ![enter image description here](http://i.stack.imgur.com/BsGmb.jpg) The only way to boot into my system is to select "recovery mode," and then when the menu comes up select "continue booting." What happened to my system? This is Ubuntu 13.10.


`file` doesn’t show proper mime-type for .m2ts files

I need to define mime type of various video files and I got a problem with .m2ts files. Before I stumbled on this, I used `file` utility with `-iL` keys and parsed the output with `sed`. Today I found that `file` 5.15 defines mime type of .m2ts files as ‘application/octet-stream’. O-okay, I updated the package and now it calls them just ‘binary’. When I expected video/something. Reading about utilities doing similar job, I’ve tried `xdg-mime query filetype`. The problem with `xdg-mime` is that it looks only at the extension of the file. It defines .m2ts as ‘video/mp2t’, but shows it for any, even an empty text file with such extension. Maybe it was correct to call .m2ts files a stream because it is actually a stream, but then why in the mime database the extension is bound to ‘video/mp2t’?               $ grep m2ts /usr/share/mime/video/mp2t.xml       <glob pattern="*.m2ts"/>


Question regarding linux installation (Kali Linux (Debian Based)

Please tell me that following steps will help me in installing Kali Linux dual boot with windows?   1. If I have 500GB and windows is taking all of it. I will create 100GB for Kali Linux by shrinking C.    2. After that a 100GB will be as unallocated space.   3. I'll boot into kali linux (through USB) and choose Graphical Install.   4. In partition disks section, I'll choose Manual and click on Continue.   5. Then it will show me 2 or 3 partitions (one will have 400GB and the other will have 100GB). I'll choose the 100GB.   6. After it will ask me that how to use this space. I will choose Automatically partition the free space instead of choosing create new partition. I hope that choose automatically partition the free space won't ask me anything to enter amount for swap etc.   7. After those steps, It will show me Yes and No options... The main question is in 6th point that is, If I choose automatically partition the free space. Then It will do everything automatically in that 100GB? like creating swap etc. It's so confusing if I do it manually that's why I am asking. I want that windows will be on 400GB partition and the linux will be on 100GB partition and it should automatically manage the partition for linux. I was reading an article regarding to Dual booting kali with windows 7. In that the author chose NO option at the GRUB Boot loader to the master boot record. But I think I should choose YES. The author after choosing NO, manually typed `/dev/sda5` in device for boot loader section. He said: By default, the installer will want to install GRUB, the boot loader, in the Master Boot Record (MBR). However, for setting up this dual-boot system, we want GRUB in the boot partition. So, select “No.” Continue. I don't think that Choosing YES will cause any problem. In that way too it will ask me to boot into the OS i want then Why I should follow the one shown in the article (of that author) and make everything confusing Please tell me that by following the above steps, I'll be able to install kali linux dual boot with windows or there will be any problem ?


Use time ,timeout and ulimit commands properly

I'm running a command in CentOS and at the same time I want to do 2 things:   1. write the run time of the command to a file and    2. set a time limit which stops the command I implemented the first one successfully. Here's how it is:               (time ./minisat+_64-bit_static opb_clauses.txt ) 2>>../measures.txt      As you can see, I used the time command to count the time needed by the command and then I forwarded the time results to a file `measures.txt`. Here's a sample of `measures.txt`:               real    0m0.002s     user    0m0.000s     sys 0m0.000s      I'm trying to add the second thing like this:               (timeout 1s time ./minisat+_64-bit_static opb_clauses.txt ) 2>>../measures.txt      The results of this command messed up my file and returned something like this:               0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 6368maxresident)k     0inputs+0outputs (0major+440minor)pagefaults 0swaps      As you can see, the results of the "real time" is somehow gone and the other results are in a different format. How can I separate the results of commands `time` and `timeout`? EDIT:A second thought is to use the ulimit command instead of timeout.I tried the same thing but with ulimit:                (ulimit -t 10 time ./minisat+_64-bit_static opb_clauses.txt ) 2>>../measures.txt      but this time i don't have any result written to measures.txt


Re-installing Ubuntu over a dual boot laptop

I am trying to get ubuntu back to work on my dual boot laptop (Win8 + Ubuntu 12.10). It happens that Ubuntu 12.10 is not loading, and even after checking and repairing errors from LiveCD. Further, this repair process also messed up with Win8, and had me repair it as well. So I decided just to get it a clean fresh install of Ubuntu on top of the "old" Ubuntu. This laptop has 2 disks with 500 gb each. It is organized like this:   * /dev/sda/     1. sda1 (fat32, labeled win recovery environment);     2. sda2 (ntfs, win8 loader);     3. sda5 (ext4, linux-secure-remix 12.10, 320Gb);     4. sda6 (swap)   * /dev/sdb/ 1.sdb1 (non-labeled) 2.sdb2 (non-labeled) **So my questions are** I am guessing that I should choose format and reinstall ubuntu over sda5 right? Do you think this will mess up with Win8? Should I instead install Ubuntu over sdb (and creating a swap there as well), while reformatting sda just to have Win8?


How to force the change of the LUKS password in every 90 days?

Using an Ubuntu 12.04 or a Red Hat Enterprise Linux Desktop 6 for Desktop, how can we force the users to change their LUKS passwords at every 90 days?


Opening a file with program in background from shell

The command to launch a program, say evince, from bash shell in background is               evince &      But what if I want to open some file with evince in background? Nor `evince myfile.pdf &` neither `evince & myfile.pdf` work as expected: the first outputs something like `[2] 5356 ` but in the next line the shell returns locked; the second opens an empty istance of evince. So, what syntax can I use?


How to Open Visual Studio 2013 Solution in MonoDevelop

My Toshiba Laptop had started running slow recently and, quite frankly, I was tired of Windows 8, so I created a USB of the most recent version of Linux Mint and installed it, moving all my needed projects to GitHub. I installed MonoDevelop because I know of its tendency for WinForms, but when I try opening the .sln file it opens it in a text editor in MonoDevelop rather than as a solution. I have two major Solutions I need to develop Yahtzee and GemsCraft. How do I open these solutions in MonoDevelop? Yahtzee is in VisualBasic and GemsCraft is in C#


SSH tunneling through a busybox router

I have a busybox router and I'm able to login to the console using telnet & I also have access to the web interface. My question is, how can I create an ssh tunnel from my local network through the router so that I may be able to access my computer remotely? I'm looking for a command line based solution & I'm also aware of the fact that routers have low memory and very limited set of utilities. But although it's a minimal linux system having only a small subset of tools, but they do have utilities like route, iptables, etc. so I think may be it's possible. Also my knowledge of busybox system is quite low so if I'm wrong somewhere, feel free to correct me.


Can root kill init process?

Can root kill init process (the process with pid 1)? What would be its consequences?


How to allow to run su instantly after I added the user to the appropriate group

I have the `su` executable with the following permissions:               bash-4.2# ls -la /bin/su     -rws--s--- 1 root wheel 59930 Sep 14  2012 ./su      When I am logged in as a user, not in the `wheel` group and try to run `su`, I get an error, which is correct:               bash-4.2$ su     bash: /bin/su: Permission denied      After that I add this user to `wheel` group from `root`:               bash-4.2# usermod -a -G wheel user      But for the same terminal session I still can't run `su`:               bash-4.2$ su     bash: /bin/su: Permission denied      For the new sessions I can run `su`. How to allow to run `su` instantly after I added the user to the appropriate group?


wireshark: Couldn't run /usr/sbin/dumpcap in child process

> **Possible Duplicate:**   >  How to add write permissions for a group? When I run Wireshark, It shows the following message:               Couldn't run /usr/sbin/dumpcap in child process: Permission denied     Are you a member of the 'wireshark' group? Try running     'usermod -a -G wireshark _your_username_' as root.      I ran this command: `usermod -a -G wireshark myusername` and checked my groups using `groups myusername` and I was added to the _wireshark_ group. But I still get that error message.               [nima@nma ~]$ groups nima     nima : nima wheel dialout wireshark     [nima@nma ~]$ ls -l /usr/sbin/dumpcap      -rwxr-x--- 1 root wireshark 67884 Aug 16 12:04 /usr/sbin/dumpcap     [nima@nma ~]$ /usr/sbin/dumpcap     -bash: /usr/sbin/dumpcap: Permission denied      What's the problem?


Not able to change default group for user with `sudo usermod -g`

I have looked at the questions and answer here at U&L but I still cannot get my default group to change from a user.               [red@ws-red-l ~]$ whoami     red     [red@ws-red-l ~]$ groups     yellow green     [red@ws-red-l ~]$ sudo usermod -g green red     usermod: no changes     [red@ws-red-l ~]$ sudo usermod -G green red     [red@ws-red-l ~]$ groups     yellow green     [red@ws-red-l ~]$ touch file     [red@ws-red-l ~]$ ls -l file     -rw-r--r-- 1 red yellow 0 Feb 18 13:51 file      I would prefer if `red` did not belong to group `yellow` so when I do a `touch file` the group of the file would be `green`. What am I doing wrong here?


Can I add to my groups in the current (shell) process?

If I add myself to a group, it applies only to newly launched processes. Actually it's more restricted than that; it seems to apply only to new logins. I'm not sure what the exact mechanism is, but that's not my question (though I'm curious about that too). My question is this: Is it possible to update my group membership _in the current shell process_? I suspect the answer is no. An example (this is not a direct copy-and-paste):               $ groups ; groups kst     kst oldgroup1 oldgroup2     kst : kst oldgroup1 oldgroup2     $ sudo adduser kst newgroup     [sudo] password for kst:     Adding user `kst' to group `newgroup' ...     Adding user kst to group newgroup     Done.     $ groups ; groups kst     kst oldgroup1 oldgroup2     kst : kst oldgroup1 oldgroup2 newgroup     $      After the `adduser`, my account is a member of `newgroup`, but that membership is not reflected in the current shell process. The obvious solution is to log out and log in again, but that's inconvenient.


how to initialize `/etc/group`?

After editing `/etc/group`, How this update starts functioning without restarting the system in Unix?   Is there any command we need to run?


Full access by group user of /var/www/html

> **Possible Duplicate:**   >  How to add write permissions for a group? On Centos 6 I'm trying to give full access to make and delete by the user `mitch` for `/var/www/http`. I did `addgroup www` and then `chmod -R 775 /var/www/html` then `groupmod -g www mitch`, and did a `chgrp -R www /var/www/html` but when I went into /html on mitch and tried to make a file with `touch` it said "permission denied." Can someone help me make anyone in `www` able to create and delete in the html dir?               drwxr-xr-x.  6 root root 4096 Feb 13  2012 .     drwxr-xr-x. 22 root root 4096 Sep 29 23:30 ..     drwxr-xr-x.  2 root root 4096 Feb 13  2012 cgi-bin     drwxr-xr-x.  3 root root 4096 Oct  1 21:23 error     drwsrwsr-x.  2 root www  4096 Oct  2 16:15 html     drwxr-xr-x.  3 root root 4096 Oct  2 16:13 icons      is the ls -la output for the /var/www dir


Permissions not extended to user in minecraft group

I have a directory, under /srv: `drwxrwxr-x 3 minecraft minecraft 4096 Dec 30 06:23 minecraft` Owned by user minecraft, group minecraft. Group has read/write/search permissions. I have a user, shelvacu, that is part of the minecraft group:               $ groups shelvacu     shelvacu : shelvacu sudo minecraft      And, as shelvacu, I run `mkdir /srv/minecraft/testdir`:               $ mkdir /srv/minecraft/testdir     mkdir: cannot create directory ‘/srv/minecraft/testdir’: Permission denied      Why? The minecraft group has write permission on the directory, and shelvacu is part of the minecraft group. What am I missing?


Added user supplementary group, but 'groups(1)' not showing change

I'm trying to add myself to the _fuse_ user group but it doesn't look like the change is taking effect even though _/etc/group_ looks correct after invoking _addgroup_ or _usermod_. I've tried both ...               sudo addgroup fjohnson fuse      and               sudo usermod -a -G fuse fjohnson      _/etc/group_ shows the change               fuse:x:104:fjohnson      but I can't read               -rw-r----- 1 root fuse 215 Oct 16 10:39 /etc/fuse.conf      as               cat: /etc/fuse.conf: Permission denied      and _groups(1)_ returns               fjohnson adm dialout cdrom plugdev lpadmin admin sambashare


Why does "logging out" of a session activate a newly added supplementary group?

I asked the following question Added user supplementary group, but 'groups(1)' not showing change earlier today. Now I'd like to know why the answer works. After running               adduser user group      Why does _user_ need to log out (I'm not even sure what that means in a context without a window manager), or why does _newgrp(1)_ need to be invoked?


As what user does a command end up executing?

How can I find out as what user a command executes? (I'm running Ubuntu, but I suspect the answer applies to Unix in general). What I'm trying to do is get `msmtp` running and logging to `/var/log/msmtp`. I've set the owner and group of that file to `mail`, then added my user to the mail group via `sudo adduser dandv mail`:               $ ls -al /var/log/msmtp.log     -rw-rw---- 1 mail mail 0 Jul 24 18:45 /var/log/msmtp.log     $ groups dandv     dandv : dandv mail sudo      Yet when when I run               cat testmail | msmtp dan@example.org -v      I get a permission denied:               msmtp: cannot log to /var/log/msmtp.log: cannot open: Permission denied      What is msmtp's problem?


I added a user to a group, but group permissions on files still have no effect

I changed permissions of a file (`chmod g+w testfile`) and running `ls -l testfile` gives:               -rwxrwxr-x 1 user1 user1 0 2011-01-24 20:36 testfile      I then added a user to that group (" **/etc/group** " has `user1:x:1000:user2` line), but am failing to edit that file as user2. Why is this so?


Troubleshooting joining a group in Mint in VirtualBox

I am trying to join my user to the `vboxsf` group to access a VirtualBox shared folder from inside my Linux Mint virtual machine. However I'm encountering a problem that I can't troubleshoot. I've edited `/etc/groups` to add my user to the appropriate group.               user394-VirtualBox media # grep user394 /etc/group     ...     vboxsf:x:108:user394      But I can't access a directory that that group supposedly has permissions to:               user394@user394-VirtualBox /media $ cd sf_Dropbox/     bash: cd: sf_Dropbox/: Permission denied          user394@user394-VirtualBox /media $ ls -lha     total 40K     drwxr-xr-x   5 root root   4.0K Jul 13 12:51 .     drwxr-xr-x  23 root root   4.0K Mar 16 22:04 ..     drwxrwx---   1 root vboxsf  28K Jul 13 12:08 sf_Dropbox     drwxrwx---   1 root vboxsf    0 Jul 13 12:16 sf_mint-shared-folder      The command `groups` shows that I'm not a member, yet `groups {user}` and `id` seem to indicate that I am:               user394@user394-VirtualBox /media $ groups     user394 adm cdrom sudo dip www-data plugdev lpadmin sambashare     user394@user394-VirtualBox /media $ id     uid=1000(user394) gid=1000(user394) groups=1000(user394),4(adm),24(cdrom),27(sudo),30(dip),33(www-data),46(plugdev),112(lpadmin),118(sambashare)     user394@user394-VirtualBox /media $ groups user394     user394 : user394 adm cdrom sudo dip www-data plugdev vboxsf lpadmin sambashare      How can I properly join this group and access these directories?


id command doesn't show all user's groups

I did a `usermod` to add the current user `user` in a group, but when I run `id -Gn` it only shows the main user's group:               [user@computer ~]$ id -Gn      user      But when I specify the user, it works normally:               [user@computer ~]$ id -Gn user     user newgroup      Do you have an idea why it works like it? Am I missing something concerning the groups management in UNIX?


Sendmail can't find local users (with uppercase letters)

Sendmail works through sending to a smarthost, but can't find local users.               # sendmail -bv  LocalUser@myhost.net     LocalUser@myhost.net... User unknown     # grep LocalUser /var/log/maillog     Sep  8 03:48:30 myhost sendmail[6678]: r887mUs3006678: LocalUser@myhost.net... User unknown      but ...               # ls /home|grep LocalUser     /LocalUser      and ...               # grep LocalUser /etc/passwd     LocalUser:x:1001:1001:LocalUser:/home/LocalUser:/bin/bash      How can I configure sendmail to find localusers? How should I diagnose this?


Connect two VirtualBox virtual machines through SSH

I have two VirtualBox virtual machines: one with SuSE Enterprise 10 and one with Red Hat Enterprise 5. I want to connect through SSH from RedHat to SuSE. Both are configured to use a bridged adapter with `vnic0` as name and “Allow All” for “Promiscuous Mode”. SuSE has IP 10.211.55.5 and Red Hat has IP 10.211.55.6. I can connect through SSH from SuSE to Red Hat but not vice- versa. What could be the problem? If I ping from Red Hat to SuSE and vice versa, everything is in order and the transmitted packets are received. If I traceroute from SuSE to Red Hat I get               1 10.211.55.6 (10.211.55.6)(H!) 0.509 ms (H!) 14.974 ms (H!) 0.877 ms      which seems in order, but when I traceroute from RedHat to SuSE I get               traceroute to 10.211.55.5 (10.211.55.5), 30 hops max, 40 byte packets     1 * * *     2 * * *     3 * * *     4 * * *     ...      If I do `ssh -l user 10.211.55.6` from the SuSE virtual machine everything connects ok but if I do `ssh -l user 10.211.55.5` from the Red Hat virtual machine I get “Connection timed out”. Both systems are connected to the internet and I can surf the net. What am I doing wrong? Why I can't SSH from Red Hat to the SuSE virtual machine?


How to scroll in a terminal using keyboard?

How can I scroll in bash using only the keyboard? If it's not possible in bash, are there any other shells that support this?


Subprocesses of bash/gnome-terminal don't terminate (CentOS/RHEL)

today I observed something which probably has an easy explanation, but was quite quite unexpected from my side: I'm running CentOS (and RHEL which behaves same). I open a bash in a terminal and start any subprocess like gedit. The window opens, fine. When I do a 'ps', I can see that gedit has the bash as it's parent process which itself has the gnome-terminal as it's parent. When I then stop bash, I would expect that all child processes stop as well. But gedit keeps running and the parent changed to 1 (init)! I tried to don't stop the shell gracefully, but kill it hard, same result. It tried killing the terminal instead of the shell, still same result. Only when I close the terminal by clicking the X button, then gedit is closed as well. I didn't expect that behaviour. Starting gedit with nohup, I would not be surprised, but even without nohup ... why does it stay alive? Maybe someone can shed some light and knows what's going on there. Thanks in advance!


Finding a substring in files across subdirectories with a single built-in command?

In Windows, if I wanted to find a string across all files in all subdirectories, I would do something like               findstr /C:"the string" /S *.h      However, in Linux (say, Ubuntu) I have found no other way than some piped command involving `find`, `xargs`, and `grep` (an example is at this page: How can I recursively grep through sub-directories?). However, my question is different: is there any _single, built-in command_ that works through this magic, without having to write my shell script?


Are quotes needed for local variable assignment?

Can I safely omit quotes on the right side of a local assignment?               function foo {         local myvar=${bar}         stuff()     }      I'm mainly interested in `bash`, but any info on corner cases in other shells are welcome.


How do I 'unbook' a pdf

I have a pdf file that was made into a booklet format. It is meant to print on A4 paper in landscape orientation; here are two pages in the pdf, which should correspond to four pages in the actual book.                -------------------------------     |              |                |     |              |                |     |              |                |     |    (1)       |      (3)       |     |              |                |     |              |                |     |              |                |      -------------------------------            -------------------------------     |              |                |     |              |                |     |              |                |     |    (4)       |      (2)       |     |              |                |     |              |                |     |              |                |      -------------------------------      The bracketed numbers correspond to the order of the individual pages. I know that there are all sorts of commands (pdfbook, pdfnup, etc.) on linux (which was probably used to make this booklet in the first place). How do I 'unbook' it---that is, I'd like to make a pdf document from this where each individual page of the final product is an individual page of the pdf, ordered in the usual way. **Edit** Thanks to Gilles, I managed to use the following code:               import copy, sys     from pyPdf import PdfFileWriter, PdfFileReader     input = PdfFileReader(sys.stdin)     output = PdfFileWriter()     second_half = []     for i in range(0,input.getNumPages()):         p = input.getPage(i)         q = copy.copy(p)              print >> sys.stderr, 'splitting page',i         print >> sys.stderr, '\tlowerLeft:',p.mediaBox.lowerLeft         print >> sys.stderr, '\tupperRight:',p.mediaBox.upperRight              p.mediaBox.upperRight = (ur[0], (bl[1]+ur[1])/2)         p.mediaBox.lowerLeft = bl              q.mediaBox.upperRight = ur         q.mediaBox.lowerLeft = (bl[0], (bl[1]+ur[1])/2)              if i % 2 == 0:             output.addPage(p)             qold = q         else:             output.addPage(q)             output.addPage(qold)             output.addPage(p)     output.write(sys.stdout)


Reverse Loopback

How to configure reverse loopback on an ethernet device? In that case, all the traffic received will be sent back to transmitter connected to ethernet port.


Entry point of linux kernel

In the linux kernel is there a file that I can start to add my code, ex. load libraries? thanks


Bash newline doesn't print

I would like to output results in latex table format using a bash script. However, when I want to add a newline symbol, bash either prints it (\n) or doesn't add a newline. I already tried several things (e.g. the ones mentioned http://superuser.com/questions/154936/echo-text-with-new-line-in-bash), but nothing seems to work. What am I doing wrong?               echo "$(cat $outputFile)$latexString" > $outputFile     echo "\\\\" >> $outputFile     echo "" >> $outputFile      `$latexString` is the line of the table I want to save, `\\\` is the EOF for the line in the table, and after that I want to have a newline. EDIT The output file should look like:               res1 & 1 & 2 & 3 & 4 \\     res2 & 5 & 6 & 7 & 8 \\     ...      'latexString' is then e.g.,               res1 & 1 & 2 & 3 & 4


How to associate with an EA-N66 (in repeater mode) in Debian Wheezy?

I bought an Asus EA-N66 that I want to use in repeater mode to extend the range of my 2.4 GHz wireless network. The setup guide allowed me to associate it to the correct SSID without a hitch, and I configured it (as per Asus' instructions) with a different SSID (but the same network passphrase) to be able to select one of the two networks depending on which one provides the best signal strength. However, I can't seem to get Debian Wheezy to associate with the EA-N66. `iwlist scan` shows it being there, along with my non-repeated wireless network. With the following in `/etc/network/interfaces`, the system connects to the regular wireless network:               auto wlan3     iface wlan3 inet dhcp         wpa-psk <long hex string>         wpa-ssid MySSID         wpa-proto RSN      However, if I change it to the following               auto wlan3     iface wlan3 inet dhcp         wpa-psk <same long hex string>         wpa-ssid MyRepeaterSSID         wpa-proto RSN      then it doesn't seem to want to associate when I do `/etc/init.d/network stop` followed by `start` (indicated by not receiving any DHCP replies). Digging around I came across a wireless security how-to on UbuntuForums, which has some specific suggestions. Based on it, instead I tried:               auto wlan3     iface wlan3 inet dhcp         wpa-psk <still same long hex string>         wpa-ssid MyRepeaterSSID         wpa-proto RSN WPA         wpa-pairwise CCIP TKIP         wpa-group CCIP TKIP         wpa-key-mgmt WPA-PSK         wpa-ap-scan 1      but the system still doesn't seem to want to associate (still no DHCP replies). What further settings do I need to change? **How do I make use of the EA-N66 in repeater mode with Debian Wheezy?** Preferably with a minimum of changes between the regular and the repeated networks while still able to actively pick one over the other. Just in case it matters, the network card is an Atheros AR9287-based TP-LINK TL-WN881ND, run by the `ath9k` kernel module.


Synergy: Connection failed to connect to server: incompatible client 1.3

I have installed synergy 1.5 on a RHEL6 server (panther) and Xubuntu 13.10 (wolf). My synergy.conf file is               section: options         screenSaverSync = true     end     section: screens         panther:         wolf:     end     section: links         panther:         right = wolf        wolf:            left = panther     end      As a non-root user on panther I start the server               synergys --config /etc/synergy.conf      and get the following message               INFO: Synergy 1.5.0 Server on Linux 2.6.32-358.2.1.el6.x86_64 #1 SMP Wed Feb 20 12:17:37 EST 2013 x86_64      However when I run `synergyc -f panther` on the client machine               NOTE: connecting to panther: 172.31.70.161:24800     WARNING: failed to connect to server: incompatible client 1.3      I get the same error when substituting panther with the ip and also with iptables disabled on the server. Any ideas


Rearrange the file content

I have a file with content as               123 OneTwoThree     234 TwoThreeFour     345 ThreeFourFive      I want to convert this file into something like this               OneTwoThree  123     TwoThreeFour  234     ThreeFourFive  345      Here the first column entries must get replaced at 25th place. If second column of original file have more letters that 25 then, rest letter must get skipped **that means it should remove all characters after the 25th** e.g. in above sample output file, `1` of first column is at 26th position. Is it possible to do this with the help of awk, sed or any such command line tool ?


Is it alright to have two PATH variables in .bash_profile

I am trying to setup Metasploit on osx 10.7, but I need to edit my `.bash_profile` and I noticed something unusual to me. I have been reading about setting the environment variable on http://linux.die.net. I read the `.bash_profile` stuff and the section on invocation. But, I don't understand why my `.bash_profile` file looks like this (these are the only two statements in the file):               PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin :/usr/X11/bin          PATH=/usr/local/opt/ruby193/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/us r/sbin:/sbin:/usr/local/bin:/usr/X11/bin      Why are there two `PATH` statements? I don't understand how bash works, so I read a little bit about that, `.bash_profile`, and setting environment variables in a book by Newham & Rosenblatt called _bash_. I think we are programming the shell's setup environment. But, from my programming experience I would think that the 1st PATH statement is just getting overwritten by the 2nd statement. I think the 2nd statement was created when I used an automated installation for ruby. The 2nd statement is the same as the 1st one, but it has the ruby directory at the beginning. Can I just delete the 1st statement?


How do I run a command if my server wakes up from hibernate?

How do I get a bash command executed each time when my server wakes up from hibernate? For ex. I want to restart my XBMC on Ubuntu when my PC wakes up with               $ sudo killall xbmc.bin -9      Where should I place that command?


Can I insert sudo via the ^ command?

Sorry if this is a yes/no question.. I am reading this unix tutorial and found the following: > Repeating and Modifying the Previous Command > > [..]   >  If you mistype leavenworth as leaveworth you can correct it with the > following command: % ^leave^leaven Unfortunately I don't have a computer to try this on, but I was wondering: Since some commands require `sudo` to run, could I then write `^^sudo` to "insert" sudo to the previous command?


Create url link in menu

How can I create a menu item that points to a URL? I've tried creating a `mylink.desktop` entry like this:               [Desktop Entry]     Encoding=UTF-8     Name=My Link Name     Icon=my-icon     Type=Link     Categories=Office;     URL=http://www.example.com/      then using `xdg-desktop-menu install mylink.desktop` should put this entry in the current user's menu. This does not work however. The file is copied into `~/.local/share/applications/` but the entry doesn't show up in the menu. If I change `Type` to `Application` and define `Exec` instead of `URL` then it works. But I don't want to have menu entry for a local application. I want a default browser to launch on a specified address when the menu entry is selected. How can I do that? Also, by using this command: `xdg-desktop-icon install mylink.desktop` the result is as expected - a new link is created on the desktop. So why doesn't it work in the menu? I tested this on RedHat Enterprise Linux 6 with KDE, but I would like to know how to do it in Gnome as well.


Start Akregator in system tray

I have added Akregator to the list of startup applications, but it opens up window every time I boot into my system. Is there a way to make it not open the window and start silently in the system tray?


Restrict file access to append only

I have a directory with log files and I'm putting logs from script launched by users into them. Logging with syslog doesn't seem possible in this case. (non- daemon rsync) I want the users to have only write permissions on log files. The problem is, that write permissions must be further restricted, so that users (script) can **only append** to that files. The underlying filesystem is XFS. The following doesn't work:               # chattr +a test.log     chattr: Inappropriate ioctl for device while reading flags on test.log      Is there any other solution for this? Thank you for your hints.


Add USB space in conky

I'm setting conky and I'd like to add the usb space, I use:               $font${color DimGray}/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_free_perc /}%     ${fs_bar /}      for the full hdd, what should I write as path for USB?


How to write a systemd script that runs usb_modeswitch and connects to the internet at startup?

I have a cisco AM10 wireless adapter and every boot, I need to run               usb_modeswitch -v 1307 -p 1169 -L -I -u -l      to get it to function as an adapter. Then I have to run a `netcfg` profile to connect to the internet. I'm very new to systemd, how can I write a startup script that can run these commands, so I won't have to?


Difference between [[ $variable ]] and [[ -n $variable ]]?

In bash, are `[[ $variable ]]` and `[[ -n $variable ]]` completely equivalent? It appears to be the case judging by the output below, but I see both forms of usage prevalent in shell scripts.               $ z="abra"     $ [[ $z ]]     $ echo $?     0     $ [[ -n $z ]]     $ echo $?     0     $ z=""     $ [[ $z ]]     $ echo $?     1     $ [[ -n $z ]]     $ echo $?     1     $ unset z     $ [[ $z ]]     $ echo $?     1     $ [[ -n $z ]]     $ echo $?     1


Catdoc xls2csv converting only one sheet

I have Catdoc's `xls2csv` installed on Debian/Squeeze. It used to work beautifully when I copied files to a folder like `/var/www/xyz`, converting all sheets into `.csv` format, separated by `^L`. But now, for whatever reason, it converts only the first sheet when I use the command:               xls2csv filename.xls > filename.csv      Any suggestions on what I could be doing wrong here?


Why does eth0 only go up sometimes on boot?

I just installed Arch with Archboot. On boot, there's about 50% change of eth0 to go up. If it doesn't I'll have to reboot. What could cause this? If it goes up, dmesg contains:               [ 7.9...] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready     [11.5...] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None     [11.5...] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready      If it doesn't, only the "link is not ready" line is there. The server is configured for a static IP at 192.168.1.16, gateway 192.168.1.1 and DNS 192.168.1.1.


efibootmgr not found while grub-install --recheck on Arch linux install

I'm not an expert on linux. I've been used Ubuntu for a year or something. When I bought a new laptop (Lenovo G500) and wanted to install Arch Linux on this machine. I followed the steps of official Turkish wiki of Arch Linux installation http://archtr.org/wiki/index.php/Arch_Linux_Kurulumu_(Resimli_Anlat%C4%B1m) on the check grub installation step               # grub-install --recheck /dev/sda      I get an error that               which: no efibootmgr in (/usr/local/sbin:usr/local/bin:/usr/bin:/usr/bin/core_perl)     efibootmgr: Not found      I don't know how to install that manager nor why this error pops up. PS: is it related or not I don't know, but there is a warning on my computer when I try to boot some of the modern Linux distros:               That KVM disabled by bios.      ### EDIT #1 I hacked a little and got a new error               EFI distribitor id isn't specified


Echoing Total Page Number in Bash Script

I have the following script for batch pdf-ocr processing & it works fine               #!/bin/sh     # apt-get install exactimage tesseract-ocr ghostscript     # bash tut: http://linuxconfig.org/bash-scripting-tutorial     # Linux PDF,OCR: http://blog.konradvoelkel.de/2013/03/scan-to-pdfa/          y="`pwd`/$1"     echo Will create a searchable PDF for $y          x=`basename "$y"`     name=${x%.*}          mkdir "$name"     cd "$name"          # splitting to individual pages     gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r300 -dTextAlphaBits=4 -o out_%04d.jpg -f "$y"          # process each page     for f in $( ls *.jpg ); do       # extract text       tesseract -l eng -psm 3 $f ${f%.*} hocr      # echo Page ?? of ?? done!             # remove the “<?xml” line, it disturbed hocr2df       grep -v "<?xml" ${f%.*}.html > ${f%.*}.noxml       rm ${f%.*}.html            # create a searchable page       hocr2pdf -i $f -s -o ${f%.*}.pdf < ${f%.*}.noxml       rm ${f%.*}.noxml       rm $f     done          # combine all pages back to a single file     # from http://www.ehow.com/how_6874571_merge-pdf-files-ghostscript.html     gs -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=../${name}_searchable.pdf *.pdf          cd ..     rm -rf $name      I just want to echo which page being completed out of the total pages of the input pdf file?


What does "LC_ALL=C" do?

What does the `C` value for `LC_ALL` do in Unix-like systems? I know that it forces the same locale for all aspects but what does `C` do?


Is 32bit still preferable to 64bit?

> **Possible Duplicate:**   >  Should I install 32 or 64 bit? I want to migrate from Ubuntu to OpenSUSE, and I need to decide between the 32bit and the 64bit versions. 6 years ago, when I purchased a Windows desktop, I was advised to stick with the 32bit version of Windows XP due to compatibility reasons. That was 6 years ago, so I assume things are different now. Also, that was on Windows, and Linux works differently(which can either make things better or worse), so I need to know:   1. How much of the software library of OpenSUSE(Linux in general?) compatible with 64bit?   2. Is there a performance difference between a 32bit Linux running a 32bit application on a 64bit processor and a 64bit OS running a 32bit application in 32bit emulation mode?   3. In the rare occasions 32bit emulation mode fails to activate(happened to me once on Windows Server 2008...), is there a way to force Linux to activate it for specific applications? Thanks in advance! Most of the data I find on Google is old, and probably outdated...


How do I convert a ssh-keygen public key into a format that openssl PEM_read_bio_RSA_PUBKEY() function will consume?

I'm having an issue generating a public key that the openssl `PEM_read_bio_RSA_PUBKEY()` function can consume. I keep getting errors. Obviously I cannot simply use the ASCII string in the `ssh-keygen <>.pub` key file as it is in SSH file format or I perhaps `SubjectPublicKeyInfo` structure. Here's the key gen code: `ssh-keygen -t rsa -b 1024 -C "Test Key"` I found a converter in php on the web which will convert the contents of the public key into a base64 PEM ASCII string format. However the function still doesn't like it. The Openssl documentation states:   1. “RSA_PUBKEY() function which process a public key using an EVP_PKEY structure”   2. “RSA_PUBKEY functions also process an RSA public key using an RSA structure” How do I get my OpenSSH public key into either format that the OpenSSL function will consume it?


Why do some applications use ~/.config/appname for their config data while others use ~/.appname?

I've noticed that some applications put their configuration files to `~/.config/appname` while others use `~/.appname` (the classic way, AFAIK) for this. What's the sense in this distinction and what could be better to consider for an application of mine? UPDATE: Looks like my (XUbuntu 11.10 default) $XDG_CONFIG_HOME is set to `~/` and the most of the applications in my system (like Mozilla Firefox, Adobe Flash Player, Midnight Commander, Opera, Wine, etc.) comply to this. But there are still many applications (like Compiz, Deadbeef, VLC, Qt Creator, Google Chrome, XFCE, etc.) using `~/.config/` instead. Another suspicious thing is that directories in `~/.config/` are not themselves hidden (no dot in their names) - aren't application config dirs expected to have constant own names without depending on the location ($XDG_CONFIG_HOME value)?


Installing Epel repository on CentOS fails

This has been working on my vagrant vm for a few month without any issues. I didn't change anything, it has been `vagrant up` and `vagrant destroy`'d several times before with no problems. But now it fails and I can't find out what the problem seems to be. I can't even install vim. ### Version Information               [root@localhost ~]# uname -a     Linux localhost 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux          [root@localhost ~]# cat /etc/*{release,version}     CentOS release 6.5 (Final)     CentOS release 6.5 (Final)     CentOS release 6.5 (Final)      ### Installing EPEL               [root@localhost ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/$(uname -i)/epel-release-6-8.noarch.rpm     Receiving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm     Warning: /var/tmp/rpm-tmp.RGvUnd: Header V3 RSA/SHA256 Signature, Key-ID 0608b895: NOKEY     Preparing...                ########################################### [100%]        1:epel-release           ########################################### [100%]     [root@localhost ~]# yum clean all     [root@localhost ~]#      ### /etc/yum.repos.d/epel.repo               [epel]     name=Extra Packages for Enterprise Linux 6 - $basearch     #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch     mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch     failovermethod=priority     enabled=1     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6      ### Trying to check update (FAILS)               [root@localhost ~]# yum check-update     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: ftp-stud.fht-esslingen.de      * epel: mirrors.ircam.fr      * extras: mirror2.hs-esslingen.de      * updates: mirror2.hs-esslingen.de     http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     [...]      ### Trying to check update excluding epel (WORKS)               [root@localhost ~]# yum --disablerepo="epel" check-update     Loaded plugins: fastestmirror     Loading mirror speeds from cached hostfile      * base: ftp-stud.fht-esslingen.de      * extras: mirror2.hs-esslingen.de      * updates: mirror2.hs-esslingen.de     [vagrant@localhost ~]#      ### URLGRABBER_DEBUG               [root@localhost ~]# URLGRABBER_DEBUG=1 yum check-update 2> debug.log          2014-09-03 07:39:10,534 MIRROR: trying repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2 -> http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2     INFO:urlgrabber:MIRROR: trying repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2 -> http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2     2014-09-03 07:39:10,535 combined options: {       'checkfunc'    : (<bound method YumRepository.checkMD of <yum.yumRepo.YumRepository object at 0x27c8490>>, ('primary_db',), {}),       'copy_local'   : 1,       'http_headers' : (),       'range'        : None,       'reget'        : 'simple',       'size'         : '6623767',       'text'         : 'epel/primary_db',       'delegate'     : {         'bandwidth'    : 0,         'cache_openers': True,         'checkfunc'    : None,         'close_connection': 0,         'copy_local'   : 0,         'data'         : None,         'delegate'     : None,         'failure_callback': (<bound method YumBaseCli.failureReport of <cli.YumBaseCli object at 0x276c0d0>>, (), {}),         'ftp_headers'  : None,         'http_headers' : (),         'interrupt_callback': <bound method YumBaseCli.interrupt_callback of <cli.YumBaseCli object at 0x276c0d0>>,         'keepalive'    : True,         'max_header_size': 2097152,         'opener'       : None,         'password'     : None,         'prefix'       : None,         'progress_obj' : <output.YumTextMeter instance at 0x279e4d0>,         'proxies'      : None,         'quote'        : None,         'range'        : None,         'reget'        : 'simple',         'retry'        : 10,         'retrycodes'   : [-1, 2, 4, 5, 6, 7],         'size'         : None,         'ssl_ca_cert'  : None,         'ssl_cert'     : None,         'ssl_cert_type': 'PEM',         'ssl_context'  : None,         'ssl_key'      : None,         'ssl_key_pass' : None,         'ssl_key_type' : 'PEM',         'ssl_verify_host': True,         'ssl_verify_peer': True,         'text'         : None,         'throttle'     : 0,         'timeout'      : 30.0,         'urlparser'    : <urlgrabber.grabber.URLParser instance at 0x28f1f38>,         'user_agent'   : 'urlgrabber/3.9.1 yum/3.2.29',         'username'     : None,         }       }     DEBUG:urlgrabber:combined options: {       'checkfunc'    : (<bound method YumRepository.checkMD of <yum.yumRepo.YumRepository object at 0x27c8490>>, ('primary_db',), {}),       'copy_local'   : 1,       'http_headers' : (),       'range'        : None,       'reget'        : 'simple',       'size'         : '6623767',       'text'         : 'epel/primary_db',       'delegate'     : {         'bandwidth'    : 0,         'cache_openers': True,         'checkfunc'    : None,         'close_connection': 0,         'copy_local'   : 0,         'data'         : None,         'delegate'     : None,         'failure_callback': (<bound method YumBaseCli.failureReport of <cli.YumBaseCli object at 0x276c0d0>>, (), {}),         'ftp_headers'  : None,         'http_headers' : (),         'interrupt_callback': <bound method YumBaseCli.interrupt_callback of <cli.YumBaseCli object at 0x276c0d0>>,         'keepalive'    : True,         'max_header_size': 2097152,         'opener'       : None,         'password'     : None,         'prefix'       : None,         'progress_obj' : <output.YumTextMeter instance at 0x279e4d0>,         'proxies'      : None,         'quote'        : None,         'range'        : None,         'reget'        : 'simple',         'retry'        : 10,         'retrycodes'   : [-1, 2, 4, 5, 6, 7],         'size'         : None,         'ssl_ca_cert'  : None,         'ssl_cert'     : None,         'ssl_cert_type': 'PEM',         'ssl_context'  : None,         'ssl_key'      : None,         'ssl_key_pass' : None,         'ssl_key_type' : 'PEM',         'ssl_verify_host': True,         'ssl_verify_peer': True,         'text'         : None,         'throttle'     : 0,         'timeout'      : 30.0,         'urlparser'    : <urlgrabber.grabber.URLParser instance at 0x28f1f38>,         'user_agent'   : 'urlgrabber/3.9.1 yum/3.2.29',         'username'     : None,         }       }     2014-09-03 07:39:10,535 attempt 1/10: http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2     INFO:urlgrabber:attempt 1/10: http://mirrors.ircam.fr/pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2     2014-09-03 07:39:10,535 opening local file "/var/cache/yum/x86_64/6/epel/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2" with mode ab     INFO:urlgrabber:opening local file "/var/cache/yum/x86_64/6/epel/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2" with mode ab     * About to connect() to mirrors.ircam.fr port 80 (#0)     *   Trying 129.102.1.37... * connected     * Connected to mirrors.ircam.fr (129.102.1.37) port 80 (#0)     > GET /pub/fedora/epel/6/x86_64/repodata/9fdd4609f219b3ec5cfa5408ab03b84b2bce97ab6de268b890577ee86b998618-primary.sqlite.bz2 HTTP/1.1     User-Agent: urlgrabber/3.9.1 yum/3.2.29     Host: mirrors.ircam.fr     Accept: */*          * The requested URL returned error: 404 Not Found     * Closing connection #0     2014-09-03 07:39:10,610 exception: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     INFO:urlgrabber:exception: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     2014-09-03 07:39:10,610 calling callback: (<bound method YumBaseCli.failureReport of <cli.YumBaseCli object at 0x276c0d0>>, (), {})     INFO:urlgrabber:calling callback: (<bound method YumBaseCli.failureReport of <cli.YumBaseCli object at 0x276c0d0>>, (), {})      Any ideas?


How to interact with the concrete file system?

Can a userspace program interact with the concrete file system(not VFS). What i have got is, that VFS allow linux to treat all file systems alike and gives a abstracted api to user space. I want to achieve a condition where a custom file system should be able to give a api for read, write and erase on disk(SSD) at page level usable at userspace. For which i will need to have a method to achieve interaction to the concrete file system bypassing the VFS.


Java SWT App: Need 64-bit swt.jar

I have a Java app that I want to run in Ubuntu, but I have Java 64 so I can't run it because it only has the 32-bit swt.jar. I can't build it myself, so Is there anyone that can provide the 64-bit swt.jar?


How do I record disk performance on slow hardware and then replay it to faster hardware and benchmark it?

I am currently performing various development tasks that are slow on my current system because of IO performance. Is there a way to record disk operations while performing IO consuming tasks, including performance info (writes/second, reads/second, etc) and then replay them on a new system to see which would the performance be there _(without having to re-run the same command over the same set of data)_? Would **blktrace** , **blkparse** or **fio** help me in this case? For example: Let's say on my system I want to benchmark a               find -name "*.php" | xargs grep -r "test_string"      inside a folder containing 50 000 files (on multiple levels, of course) I'd like to capture all the disk operations, including statistics, and then replay them on another system that does not have the 50 000 files folder. Basically, just simulating the operations and checking out if they are done any faster. I've tried capture the disk samples by using               blktrace -d /dev/sda -o myfile.blk      but I do not know how I can try and replay them with **fio**. Is this possible? Thanks


Autocomplete of filename in directory

This question is quite similar to this one, but I can't understand the solution. I also know this tutorial, but still I am unable to understand what I am doing wrong. I am trying to autocomplete the list of directories that are placed in `/something/`:               $ ls /something/          One    Other    Three      in a way that this will happen:               $ hi [TAB]          One Other Three     $ hi O[TAB]          One Other      Only when the first word is `hi` and not only inside `/something/`. This is what I am doing in `.profile`:               _codeComplete()     {         local cur=${COMP_WORDS[COMP_CWORD]}         COMPREPLY=( $(compgen `ls /something/` -- $cur) )          }     complete -F _codeComplete "hi "


booting very slow

I have Linux Mint 14 and it was fine, but lately it takes a lot longer to boot. I have my linux installation on one partition. I had a dual boot first, then I removed windows. So, that freed up 2 more partitions, which I added entries to /etc/fstab to mount them automatically instead of requiring me mounting them manually every time. Not always, but sometimes a screen shows up during boot that says the /tmp drive is not ready and gives me the options to wait, cancel or manually. I am not sure why it takes so long to boot now when it used to be fine earlier. Here is the bootchart - http://dl.dropbox.com/u/521537/laptop- nadia-20130409-1.png. I can see some long delays but I dont think I can understand why or how to fix it. Can anyone help me out?


Installing openjdk-7-jdk does not update java (which is still version 1.6)

I am having issues updating Java. I am running Ubuntu 11.10. I can execute `sudo apt-get install openjdk-7-jdk` and it completes successfully. `javac -version` is 1.7, however `java -version` is 1.6. This is similar to this problem but my issue is not, as far as I can tell, the path.               $ echo $PATH     /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games      Thanks.


Why 2 linux machine behave differently with command of the same syntax?

I am using 2 machine , which is both _Red Hat Enterprise Linux AS release 3 (Taroon Update 2)_ ( I check it in /etc/*-release ). I checked they are using the same default shell by `ps -p $$`, which is bash. I tried to execute a find command with wildcard pattern: find path -name pattern -type f -ctime +3 and the pattern contain * character as wildcard. The first machine seems to expanded the wildcard character and causing error:               find /home/primbat/testing -name sftp_bcs_report_*.log -type f -ctime +7     find: paths must precede expression      and I need to either make the pattern in between 2 delimited qoute, e.g: `\"sftp_bcs_report_*.log\"` or using `set -f` in the script to suppress wildcard expansion. Which in the other machine, it have no such problem. Do you have any idea?


FuncName(){} vs function FuncName() {}

There is two ways to define function in bash script. 1.               function FuncName() {         echo "$FUNCNAME"     }      2.               FuncName() {         echo "$FUNCNAME"     }      So my questions is what's the different between in this and which one should be use.


Could not open X display after hostname change

I need to change the hostname of my Computer from `localhost.localdomain` to `DESKTOP`. However, I can't manage to do this, even after browsing some of the net. I've changed my hostname with `hostname DESKTOP` The best informations I've found so far as in there : http://stackoverflow.com/questions/20611783/after-changing-hostname-gedit-not- open However, once my hostname is changed to `DESKTOP`, I can't access `gedit` or any other thing that are IHM-linked in my terminal, as a root user. Which I need to do.               $ xauth list     xauth : file /root/.Xauthority does not exist      I can't get to add something to `xauth`, I've tried to type this:               $ xauth add ${DESKTOP}/unix:0 . [Same key as in xauth list as normal user]      Which gives me:               $ xauth: (argv):1:  bad display name "/unix:0" in "add" command      Is there a way to get this to work? I'm on the same machine, I don't use SSH. Oddly, I seem to be able to use `gedit` if I use `sudo -i` to log as `sudo`. But why? And how can I get to work permanently with `su` to log?


apt-show-versions - Maybe no deb entries

When installing Ajenti I get this error:               Error: No information about packages! (Maybe no deb entries?)     E: Problem executing scripts APT::Update::Post-Invoke-Success 'test -x /usr/bin/apt-show-versions || exit 0 ; apt-show-versions -i'     E: Sub-process returned an error code      I have cleared all files in /var/lib/apt/lists. I have cleared all entries and added one-by-one from /etc/apt/sources.list. I have rebooted, twice. apt-get update gives the same error. I have tried 'dpkg --configure -a' It returns this message:               Setting up apt-show-versions (0.22.3) ...     ** initializing cache. This may take a while **     Error: No information about packages! (Maybe no deb entries?)     dpkg: error processing package apt-show-versions (--configure):      subprocess installed post-installation script returned error exit status 255     dpkg: dependency problems prevent configuration of ajenti:      ajenti depends on apt-show-versions; however:       Package apt-show-versions is not configured yet.          dpkg: error processing package ajenti (--configure):      dependency problems - leaving unconfigured     Errors were encountered while processing:      apt-show-versions      ajenti      Then I have read the first 30 hits in Google, followed all steps in all threads that came out. Deleted all .gz files, created 'partial' directory etc. Linux debian-imx6 3.0.35-g0f2006c-dirty #161 SMP PREEMPT Tue Dec 31 14:06:45 IST 2013 armv7l GNU/Linux All commands executed as root. I read some stuff about bugs, some stuff about bad files in apt dir and some other stuff, I'm looking for some directions on how to fix apt-show-versions. * * *               root@debian-imx6:~# ls -la /usr/bin/apt-show-versions /var/lib/dpkg     -rwxr-xr-x 1 root root 34551 sep 30 12:15 /usr/bin/apt-show-versions          /var/lib/dpkg:     total 4424     drwxr-xr-x  7 root root    4096 feb  8 01:18 .     drwxr-xr-x 47 root root    4096 feb  8 01:03 ..     drwxr-xr-x  2 root root    4096 feb  8 01:11 alternatives     -rw-r--r--  1 root root 1038192 feb  8 01:05 available     -rw-r--r--  1 root root 1010493 feb  8 00:04 available-old     -rw-r--r--  1 root root       8 nov 15 23:21 cmethopt     -rw-r--r--  1 root root     560 dec 16 21:23 diversions     -rw-r--r--  1 root root     448 dec 16 21:23 diversions-old     drwxr-xr-x  2 root root  249856 feb  8 01:17 info     -rw-r-----  1 root root       0 feb  8 01:17 lock     drwxr-xr-x  2 root root    4096 okt  1 21:25 parts     -rw-r--r--  1 root root     116 feb  8 01:11 statoverride     -rw-r--r--  1 root root      70 nov 15 23:30 statoverride-old     -rw-r--r--  1 root root 1086813 feb  8 01:18 status     -rw-r--r--  1 root root 1086813 feb  8 01:17 status-old     drwxr-xr-x  2 root root    4096 feb  8 01:09 triggers     drwxr-xr-x  2 root root    4096 feb  8 01:18 updates      * * *               root@debian-imx6:~# apt-show-versions -iv     Unknown option: iv      * * *               root@debian-imx6:~# apt-show-versions -i -v     Error: No information about packages! (Maybe no deb entries?)


Play .wav when text scrolls in terminal

After watching a TV show, I came up with a fun idea. Is there a way to take that cheesy high-pitched sound effect they play every time text scrolls down a command-line screen on TV and play it when text scrolls in my terminal window (talking X here)? Bonus points if you can modulate it with the amount/speed of scrolling text.


gnuplot lost the plot

I'm experimenting with evolutionary algorithms and I have written two text files that I cannot get the plot. Based on the information on google, I think I have the format correct. (generation-number) (tab) (best-fitness) for example: 1 231 2 240 3 245 ... To plot this, I start gnuplot and I am greeted by the welcome screen. I then type: plot 'ga.txt' The cursor immediately returns and nothing is plotted. I am using 64 bit Mint with Mate.


creating abbreviations for commonly used paths

I am new to linux and was wondering whether it is possible to create abbreviations that can be used in terminal. I know about `alias` command, but am not sure whether that can be used for what I am looking for. Example: Say I often need to copy stuff from folder `~/Dropbox/thisfolder`. I know that I can create a shortcut to switch to this folder by creating an alias, such as,               alias tf="cd ~/Dropbox/thisfolder"      However, if I do               alias justpath="~/Dropbox/thisfolder"      then, I cannot use commands such as `cp justpath/blahfile ./`. Is it possible to do something like this using some other way to abbreviate the path `~/Dropbox/thisfolder`?


How to preserve special characters highlighting when converting to HTML?

I have an issue with the `:TOhtml` command. It works great, but it doesn't preserve the `list` option. If I do:               :set list listchars=tab:>-,trail:.,extends:>     :TOhtml      The special characters highlight is missing in the generated HTML file. Any idea how to fix that?


no default repositories in yum

I am trying to install gtk-murrine-engine on my RedHat Linux Client 5.5 using yum install. It says package not available. It appears that there only exists some local repositories in yum , pertaining to my company use. Is there any way i can add the default repositories that normally exists , so that i can install other applications too?? PS: It is not a single case. I have been trying to install other packages too and gives the same error.


Failure to recover grub2 after installing arch-linux

I am currently installing and and re-installing Arch Linux for learning purposes. As I don't have a secondary machine, I have to do it on my main one. The thing is - I couldn't find a way to avoid installing grub in the installation process of Arch. That's another problem, but I fail to use `boot-repair` as explained here to make Ubuntu my default OS again. After installing Arch I get grub1 booting, and it doesn't have entries to log into my Ubuntu system, and I don't really know how to edit grub. I prefer just restoring grub2 used by Ubuntu. My question is simple - how do I do that? Thanks in advance


How to find text in files and only keep the respective matching lines using the terminal on OS X?

I am pretty new to the terminal and command lines, from what I have found out grep seems to be the right tool for search files for specific text strings. I have a folder with many huge text files and I would like to to only keep those lines of each file that contains a certain string (e.g. "/foobar"., for instance:               file1 (no file ending)           1. lorem ipsum      2. trololo /foobar abc      3. dolor sit      4. foobar def      shall afterwards be:                1. trololo /foobar abc      2. foobar def      I guess the command looks something like this               grep -wE "(/foobar)"       but I have no clue how to tell the command to only keep those lines and do that for each file that you find in the current folder. Would you do that with `find` or does grep have an own functionality for that? Something like:               find ./* -exec do grep stuff here


Getting data section with maximum element

I have some data stored in JSON-like format.               {         {             value1: 14,             value2: 12,             value3: 1         },         {             value1: 4,             value3: -1         }     }      How can I get subsection with maximum 'value3' value using `awk` (which is most preferable and related to that kind of problems, I think), `sed` or `grep`? So, this output is expecting:               {         value1: 14,         value2: 12,         value3: 1     }


automatic proxy selecting depending on target

Situation:   * ISP with proxy server   * local TOR service I would like to automatically let all .onion-domain traffic go to the local TOR-service and all other traffic to the ISP proxy (am using TOR only to browse the hidden TOR sites, not for privacy). Now I was thinking of using Squid for that. Squid can automatically select a parent proxy depending on the target (with the plus that it then also caches the slow tor sites) but I could not find a way to let it connect to the TOR socks5 service. Anyone got an idea how to do this? Thanks.