Unusual vmware.modconfig-console output

Upon running a batch file I created to iterate recursive directories from / trying to find the Kernel headers for `vmware-modconfig-console` running on openSUSE, when it comes across /usr/include/ it spits out the below                   /usr/bin/lib/vmware-tools/sbin64/vmware-modconfig-console --validate-kernel-headers          -k 3.4.6-2.10-desktop "/usr/include" -- -l "/usr/bin/lib/vmware-tools/"              In file included from <stdin>:2:0:         /usr/include/linux/version.h:2:2: error: #error         "======================================================="         /usr/include/linux/version.h:3:2: error: #error "You should not include /usr/include         /{linux,asm}/ header"         /usr/include/linux/version.h:4:2: error: #error "files directly for the compilation of          kernel modules."         /usr/include/linux/version.h:5:2: error: #error ""         /usr/include/linux/version.h:6:2: error: #error "glibc now uses kernel header files          from a well-defined"         /usr/include/linux/version.h:7:2: error: #error "working kernel version (as recommended          by Linus Torvalds)"         /usr/include/linux/version.h:8:2: error: #error "These files are glibc internal and may          not match the"         /usr/include/linux/version.h:9:2: error: #error "currently running kernel. They should          only be"         /usr/include/linux/version.h:10:2: error: #error "included via other system header           files - user space"         /usr/include/linux/version.h:11:2: error: #error "programs should not directly include          <linux/*.h> or"         /usr/include/linux/version.h:12:2: error: #error "<asm/*.h> as well."         /usr/include/linux/version.h:13:2: error: #error ""         /usr/include/linux/version.h:14:2: error: #error "Since Linux 2.6, the kernel module          build process has been"         /usr/include/linux/version.h:15:2: error: #error "updated such that users building          modules should not typically"         /usr/include/linux/version.h:16:2: error: #error "need to specify additional include           directories at all."         /usr/include/linux/version.h:17:2: error: #error ""         /usr/include/linux/version.h:18:2: error: #error "To build kernel modules, ensure you          have the build environment "         /usr/include/linux/version.h:19:2: error: #error "available either via the kernel-devel          and kernel-<flavor>-devel "         /usr/include/linux/version.h:20:2: error: #error "packages or a properly configured          kernel source tree."         /usr/include/linux/version.h:21:2: error: #error ""         /usr/include/linux/version.h:22:2: error: #error "Then, modules can be built using:"         /usr/include/linux/version.h:23:2: error: #error "make -C <path> M=/home/abuild/          rpmbuild/BUILD/linux-glibc-devel-3.4"         /usr/include/linux/version.h:24:2: error: #error ""         /usr/include/linux/version.h:25:2: error: #error "For the currently running kernel          there will be a symbolic "         /usr/include/linux/version.h:26:2: error: #error "link pointing to the build           environment located at "         /usr/include/linux/version.h:27:2: error: #error "/lib/modules/2.6.37.6-0.11-xen/build          for use as <path>."         /usr/include/linux/version.h:28:2: error: #error ""         /usr/include/linux/version.h:29:2: error: #error "If you are seeing this message, your          environment is "         /usr/include/linux/version.h:30:2: error: #error "not configured properly. "         /usr/include/linux/version.h:31:2: error: #error ""         /usr/include/linux/version.h:32:2: error: #error "Please adjust the Makefile          accordingly."         /usr/include/linux/version.h:33:2: error: #error         "======================================================="      This looks to be an almost exact copy of the contents of /usr/include/linux/version.h, but what I cant't work out is why this one subdirectory is making the vmware-modconfig-console tool echo the contents of a file in a subdirectory to stdout??


How do you play this old unix game?

I recently tried the simh emulator, `pdp11`. The disk image I used can be found on the internet, and instructions for booting it are here. Presumably it belonged to Dennis Ritchie, as the username is "dmr". In the /usr/games folder are about 20 games and amusements for wasting expensive computing resources. One game is called 'moo'. I have not been able to find info about this game, but starting it prints:               MOO     new game     ?      Every input I have tried results in the game printing 'bad guess.' Does anyone have experience with this game? Ritchie is dead, so there's no way to ask him directly.


Can I move a running application to a different X server?

Is there any way to open a graphical program (for instance, gedit) while using X11 forwarding over SSH and transfer the X server connection back to the X server on the SSH host?


What steps to add a user to a system without using useradd/adduser?

I was browsing through some Linux questions and saw this interesting question. _What steps to add a user to a system without using`useradd`/`adduser`?_ The one possible way that comes to my mind is,   * Add an entry for the user in `/etc/passwd` file.    * Add an entry for the group in `/etc/group` file.    * Create the home directory for the added user.   * Set the new user password using the `passwd` command.  I tested the above approach and it worked fine. Is this the only possible way or is there any other work around to achieve this?


Are there any distributions with a working on-the-fly hybrid graphics switcher?

vga_switcheroo is used in many distros (including Arch), but it would be nice to have real-time switching.


What does <defunct> mean in the output of ps?

I had issued the `ps -ef|grep java` command and this is one of the entries that I got :               subhrcho   875   803  0 Jan23 pts/5    00:02:27 [java] <defunct>      What is `<defunct>` implying here ? What state is that process is that process with PID=875 in ?


Connect to wifi using wifi-menu

I just got a Raspberry Pi (in a kit) and installed Arch Linux on it. I plugged in my WiFi dongle (which came in the kit) and I see that Linux has the driver for it. However, I still cannot connect to my WiFi network. I used `wifi-menu` and I selected my network. I entered the password and hit enter. After a few seconds (~10), I got an error: `Connecting Failed! Do you want to save the profile "MyWifiNetwork"?` Is there something else that I have to do?


What is the bug with this script - using 'select' command to print menu in linux

OS - Linux 64-bit I am trying to implement a simple menu using `select` command. The script (for testing purposes) is as follows               #!/bin/bash     echo "*******************"     PS3='Select an option and press Enter: '     options=("apache" "named" "sendmail")     select opt in "${options[@]}"     do       case $opt in             "apache")               date               ;;             "named")               echo "test"               ;;             "sendmail")               echo "test 2"               ;;             *) echo "invalid option";;       esac     done     echo "*********************"      The script is not recognizing any valid inputs I give and always prints the "invalid option" on screen. What am doing wrong in this script.


What is the best way to manage users across multiple servers

I am inheriting about 20 linux servers running different versions of Ubunutu (7 and above). The current setup has people logging in(ssh) with a shared login (it was explained to me that this was done to ease user management) or as root. I assume it would be safer/more customizable to log in to each box using one's own login, right? And sshing in as root is a Bad Thing yes? There's only two of us, but I may want to institute different permissions per user. What would you suggest, while keeping complexity to a minimum?


Which Repository do I add to install Gnome 3 on Fedora 14

I can't seem to find this anywhere. Also is there a list of repositories for third party software apart from livna? and is there a better package manager like Ubuntu's for Linux?


Ruby and Git refuse to update. (Mac)

I've been trying to update Git for a while. I'm currently stuck on 1.7.3.4, and I've tried updating to 1.7.4.x, and 1.7.5.x but it never works. Today I compiled and installed Ruby 1.9.2, but it still shows up as 1.8.7. I'm running 10.6.7 on a MacBook Pro. I have no idea why it won't update. Any ideas? :(


changing name of some files in bulk

> **Possible Duplicate:**   >  Rename all the files within a folder with prefix “Unix_”   >  how can I rename multiple files by inserting a character? Is there a way to make a change in name of some files, for example to append name of each user to files that reside in his home folder that if they moved somewhere can find files of a particular user? I use CentOS 5.5


how can I rename multiple files by inserting a character?

I have many files of the form sw001   sw002   sw003   ... I want to insert a period between the sw's and the number values. How can I accomplish this?


How to modify the permission of jar file exactly same as other machine jar file?

I have two machines, In my `machineA` I have a jar file with these permissions -               -rwxr-xr-x 1 cronus app 16758150 2013-03-19 13:35 exhibitor-1.5.1-jar-with-dependencies.jar      In my another `machineB`, I have a same jar file but with different permissions -               -rw-r--r-- 1 root messagebus 19340260 Nov 25 14:28 exhibitor-1.5.1-jar-with-dependencies.jar      How to make the permission of machineB jar file same as machineA jar file? In short, how do I get this permission `-rwxr-xr-x` which I can apply on machineB jar file? And apart from this, can anybody explain me how does this permission work and what does it mean? **UPDATE:-** Thanks Jordan for the link, I am able to understand its meaning now..


Setting tabstop for bash output

Is it possible to set a tabstop (number of spaces per tab) for the `more` and `less` commands? In vi, I've added this line to `.vimrc`               set tabstop=4      However when I read through a file with `more` it still uses 8 spaces per tab               $ more style.css     div {             width: 100%;     }      Would this be something I could configure in `.bashrc` or a similar file?


Using grep to read a paragraph on Solaris

How can I grep a paragraph from a file in the Solaris operating system? I tried the `-p` option used in AIX, but it's not useful in Solaris. `grep -p Accept` is not working in Solaris. Is there any other option?


ActiveX under Linux

Are there any solution besides a Virtual Machine to get ActiveX support under Linux? I mean are there any ways to use IE with wine to get ActiveX?? Or a plugin for Firefox that enables ActiveX?


How to recursively move batches of 20 files into numbered folders from folder of 1000 files

I have a folder full of 1000 (or more) files. I want to have a script that creates a numbered folder and then moves the first 20 files (ordered by name) into that folder. It should then do this for the other files, increasing the folder number by 1, until all the files are in folders. I've tried the following command but it doesn't do a whole directory automatically and doesn't increment the folder number automatically:               N=1000;     for i in ${srcdir}/*; do       [ $((N--)) = 0 ] && break       cp -t "${dstdir}" -- "$i"     done      How can this be done using bash?


Proper way to setup RAID in linux

I have installed Debian 7.4 on a server, and through the installer I setup both RAID and LVM for the drive that the OS is installed on. However, now I want to add two 4TB drives in a RAID-1 array to the system, and then add in LVM onto those drives. The question I have is: do I need to partition the drives _before_ I put them in an array? Most of the guides that I have seen will do something like this:               mkfs.ext4 /dev/sdb  #create /dev/sdb1     mkfs.ext4 /dev/sdc  #create /dev/sdc1     mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb1 /dev/sdc1     mkfs.ext4 /dev/md0  #create a filesystem table on the RAID array          #LVM creation on the RAID array     vgcreate vg_name /dev/md0     lvcreate -n lv_name -l100%FREE vg_name     mkfs.ext4 /dev/mapper/vg_name-lv_name     mount /dev/mapper/vg_name-lv_name /mount_point      However, I have just tried the following in a VM, which appears to work properly:               mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb /dev/sdc          #LVM creation on the RAID array     vgcreate vg_name /dev/md0     lvcreate -n lv_name -l100%FREE vg_name     mkfs.ext4 /dev/mapper/vg_name-lv_name     mount /dev/mapper/vg_name-lv_name /mount_point      Is there any difference between these two methods of creating a RAID/LVM array? It seems as though creating a filesystem three times is unnecessary.


RAR a folder automatically every x minutes

I want to "code" a shell script which will do the following:   * check for new folders in foler XYZ , will make a cron that opens the script every 30mins   * if NEW folders found = use RAR and rar those folders like they are named . XYZ Main Folder: -Blububb Changed: 7.03.2014 -> create rar -> Blubb.rar  So I need some little help in realizing this / tricks tipps how I should start this.               #!bin/bash     for all in `find / -name "rpc-backup*" -type d -print`     do     #create archive     rar -a -k -v250000k /home/testuser/rar1.rar /home/testuser/rpc-backup1          done      So you see I dont have much so far , I need first of all a find command which looks only for new files or changed after the date (7.03.2014) , then also my rar process has to rar every folder he gets individual and not just one big rar where all my folders are in, i want a single rar for every single folder. would appreciate ya'll help. thanks


How to disable messages in unix if mesg and chgrp not allowed?

This is one of my questions for my exam .. We are not supposed to use `mesg y/n` for this but we should effectively avoid mesgs along with the problem of not being able to change groups.


apt-get: hash sum mismatch

Running "sudo apt-get update" results in: > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_saucy- > security_main_binary-i386_Packages Hash Sum mismatch > > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_saucy- > security_universe_binary-i386_Packages Hash Sum mismatch > > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_saucy_universe_binary- > amd64_Packages Hash Sum mismatch > > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_saucy_main_binary-i386_Packages > Hash Sum mismatch > > W: Failed to fetch > gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_saucy_universe_binary-i386_Packages > Hash Sum mismatch > > E: Some index files failed to download. They have been ignored, or old ones > used instead. I have tried to run: > sudo rm -R /var/lib/apt/lists/partial/* > > sudo rm -fR /var/lib/apt/lists/* > > sudo apt-get clean I have also tried the Fix MergeList problems button of the Software Sources tool. I am running Linux Mint 16 Cinnamon 64 bits. In the Update Manager I can see many updates that I should install but attempting to install them results in: > E: Unable to parse package file > /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_saucy- > updates_universe_i18n_Translation-en (1) E: Problem opening > /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_saucy- > security_main_binary-amd64_Packages E: The package lists or status file > could not be parsed or opened. E: _cache->open() failed, please report. Any ideas?


xmllint shell not showing number from count xpath expression?

I am using xmllint's interactive shell on cygwin. I would like to count the number of nodes, but xmllint doesn't seem to behaving as I expect:               $> cat test.xml     <?xml version="1.0"?>     <result>       <node>         <item/>         <item/>         <item/>         <item/>         <item/>       </node>     </result>     $> xmllint --shell test.xml     / > cat count(/result/node/item)     count(/result/node/item) is a number      It says it's a number, but it doesn't show the number in a manner I've seen from web searches:               count(/result/node/item) is a number : 5      What is going wrong here?               $> xmllint --version     xmllint: using libxml version 20706        compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib


USB drive Dell does not work on Lubuntu

I'm using Lubuntu 11.10 on Sony Vaio. I got one USB Dell external disk 1tb as this one. But when I connect nothing happens. (even I can feel with my hand that it is running) From `dmesg` I got               [ 2758.780713] usb 2-1.3: new high speed USB device number 4 using ehci_hcd     [ 2758.935542] scsi8 : uas     [ 2758.937160] scsi 8:0:0:0: Direct-Access     Dell     USB Portable HDD 0412 PQ: 0 ANSI: 6      My laptop does not have a usb 3.0 connection. Could this be the problem? Gparted does not show it. Some info here:               Aug 14 19:30:41 vaio kernel: [ 2797.116285] sd 8:0:0:4: [sdh] Mode Sense: 00 00 00 00     Aug 14 19:30:41 vaio kernel: [ 2797.116291] sd 8:0:0:4: rejecting I/O to offline device     Aug 14 19:30:41 vaio kernel: [ 2797.116298] sd 8:0:0:4: [sdh] Asking for cache data failed     Aug 14 19:30:41 vaio kernel: [ 2797.116303] sd 8:0:0:4: [sdh] Assuming drive cache: write through     Aug 14 19:30:41 vaio kernel: [ 2797.116332] sd 8:0:0:7: [sdk] Attached SCSI disk     Aug 14 19:30:41 vaio kernel: [ 2797.116507] sd 8:0:0:4: [sdh] Attached SCSI disk     Aug 14 19:30:41 vaio kernel: [ 2797.116719] sd 8:0:0:0: [sdd] Attached SCSI disk     Aug 14 19:30:41 vaio ata_id[25346]: unable to open '/dev/sdg'     Aug 14 19:30:41 vaio ata_id[25349]: unable to open '/dev/sdf'     Aug 14 19:30:41 vaio ata_id[25350]: unable to open '/dev/sdd'     Aug 14 19:30:41 vaio ata_id[25355]: unable to open '/dev/sdk'     Aug 14 19:30:41 vaio ata_id[25348]: unable to open '/dev/sde'     Aug 14 19:30:41 vaio ata_id[25356]: unable to open '/dev/sdi'     Aug 14 19:30:41 vaio ata_id[25353]: unable to open '/dev/sdh'     Aug 14 19:30:41 vaio ata_id[25354]: unable to open '/dev/sdj'


How to see interactive output when running nmap from a bash script?

I'm trying to run nmap from a Bash script, in a way so that when `Enter` is pressed it should give some output, as happens when running directly from the commandline. When calling a few different `nmap` scans from a Bash script, pressing `Enter` will not show the time remaining as it would if I ran it directly from the command line. An example line from my script:               nmap -T4 -iL input.txt -PN -sS -oA tcp_top_1000      Running `nmap` like this via the command line, and then hitting `Enter` results in this type of output:               $ nmap -T4 -iL input.txt -PN -sS -oA tcp_top_1000          Starting Nmap 5.21 ( http://nmap.org ) at 2013-10-18 01:21 EDT     Stats: 0:00:01 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan     Parallel DNS resolution of 1 host. Timing: About 0.00% done     Stats: 0:00:01 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan     Parallel DNS resolution of 1 host. Timing: About 0.00% done     Stats: 0:00:02 elapsed; 0 hosts completed (0 up), 1 undergoing ARP Ping Scan     Parallel DNS resolution of 1 host. Timing: About 0.00% done      However running that same `nmap` command in a shell script inhibits it's ability to do the above. Is there any way to solve this?


How to register application in KDE?

Normally, when you install regular package of KDE application, its icon shows up in KDE menu. Now, I am making package for app which came in *.zip file, I can install it, run it, but it does not show in KDE menu. So how to register it? openSUSE 11.4, KDE3.5.10 (!), app: IntelliJ IDEA.


How can I reconfigure my Ubuntu PC's 2.6.37.6 kernel to shrink it to 950 KB or less?

I need to recompile the kernel with minimum configuration so that after compiling its size stay below 950 KB and it should boot correctly after compilation. I need to compile with minimum possible features just to boot from the kernel. How can I do this?


Disable Bash autocompletion for a specific command only

Is it possible to disable Bash's autocompletion for a specific command only? Use case: For obvious reasons, I would like to disable autocompletion for the `rm` command when I'm root. It would also be a terrible pain if I disabled autocompletion altogether, so I'd like to remove it for `rm` only. Can this be done at all, preferably without hacking `/etc/bash_completion` and friends?


How can I use cron to display messages on the screen via notify-send

I am toying around with `notify-send` and `cron` (on an Arch machine) and I can't figure out a way to combine them: I tried the solution given here and here, but neither worked. How can I use them? **EDIT:** I have set the DISPLAY in the crontab and it still didn't work. I tried the same in Ubuntu and there things are working fine. Here is my cron line:               */1 * * * * DISPLAY=:0.0 /usr/bin/notify-send "hellp" || echo "er" > .er


New SL6 system: No hostname?

This is in regards to Scientific Linux 6.1 system, but should also apply to CentOS 6.1 & RHEL 6.1. I am setting up a new Scientific Linux 6.1 system, using kickstart and DHCP (via xCAT). This machine should be named `'host2.example.org'. I see that some programs are unable to resolving the hostname of this system. It seems that RedHat 6 no longer puts a hostname into `/etc/hosts` (See bug 668830 and RedHat KB DOC-57321 (login required)). In addition, the hostname is not defined in `/etc/sysconfig/network`.               # cat /etc/hosts     127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4     ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6     # cat /etc/sysconfig/network     NETWORKING=yes     HOSTNAME=localhost.localdomain     # hostname     host2     # hostname --long     hostname: Host name lookup failure      I was expecting to see the hostname in `/etc/sysconfig/network` , but it's not there. Shouldn't something (like NetworkManager) put the hostname into a file somewhere? If so, why is there no HOSTNAME line in my `/etc/sysconfig/network`? Should Kickstart or Anaconda do this? For CentOS/SL 5.6, I believe the hostname was always added to `/etc/hosts`.


Quoting in a function results in error

How should I write the `command` variable to get the expected behavior?               #!/bin/bash          function f ( )     {         echo "$2"     }     command="f --option=\"One Two Three\" --another_option=\"Four Five Six\""     $command          f --option="One Two Three" --another_option="Four Five Six"      First calling is wrong, second - right               $> ./test.sh      Two     --another_option=Four Five Six


How can I open a file in VIM in readonly mode if it already has a swapfile?

When I use the command `:e filename` to open a file and this file is already opened by another vim instance, I get a prompt asking me if I want to open the file in _read-only mode_ , edit anyway, recover, exit or abort. When I try `:silent! e filename` what happens is that vim seems to have hanged. But it is indeed asking me what to do with the swapfile, just I can't see it because I told it to be silent. Is there any command where I can tell it to open the file in _read-only mode_ **if** the file can't be opened in write mode and without requiring user interaction? (I want to integrate this into a macro to jump/open files).


Seems that chown is allowed to non root user

We are using LDAP authentication and probably another things that I did not understand well, in our company so maybe the following questions are result of this. I have found strange behavior of `chown` command, and I do not know if this is normal. Here is my scenario: GID of user mark is SK001936 and owner grup of home dir of mark is SK001778, as you can see they are not the same. The group SK001778 is allowed all operations (rwx) with home dir of user mark as owner (mark) has:               [mark@machine ~]$ id     uid=48447(mark) gid=41795(SK001936) groups=40119(SUB_SK001936_PPS),41795(SK001936)     [mark@machine ~]$ ls -lad .     drwxrwxr-x   6 mark SK001778  4096 Oct 10 13:30 .      GID of user michael and mark are both SK001936:               [michael@machine mark]$ id     uid=40570(michael) gid=41795(SK001936) groups=40119(SUB_SK001936_PPS),41795(SK001936)     [mark@machine ~]$ id     uid=48447(mark) gid=41795(SK001936) groups=40119(SUB_SK001936_PPS),41795(SK001936)      user michael cannot create file in home dir of user mark. It is the matter of that michael do not belongs to group (SK001778) which has the full (rwx) access to mark's home directory:               [michael@machine mark]$ touch michael     touch: cannot touch `michael': Permission denied      Under normal circumstances the user cannot issue the chown even if he is the owner of the file. However in this example the owner of home directory (mark) is able to change the owner group of his own home directory (and thus allows the users belonging to this group access to his home dir):               [mark@machine ~]$ chown mark:SK001936 .      The group which now has access to mark home dir is thus the same group as GID of michael, hence the michael is now allowed to create/delete files/folders in mark's home dir:               [michael@machine mark]$ touch michael      mark is unable to change back the group ownership of his home dir (remember only root is allowed to issue chown accoring to this: why-cant-a-normal-user- chown-a-file):               [mark@machine ~]$ chown mark:SK001778 .     chown: changing ownership of `.': Operation not permitted      My question is: how is possible that mark was able to change the group ownership of his home dir even when si declared that chown can be issued only by root. The box is RedHat 5.6.


How to make a Desktop "shortcut" that opens the terminal but under a different directory than the default home?

## Objective I am looking for an easy way to consistently run a terminal that automatically opens to a specific directory. Is there a way to do that without changing the default directory? Preferably I just click on a 'shortcut' link and it opens that customized terminal to that directory or maybe runs the CD command for me. ## Full Story Currently, when I open the terminal (via the Linux Mint GUI menu) it by default 'takes' me to the home directory. This is a fine default choice for the majority of times. However, there are instances where I wish it would open elsewhere. I don't wish typing the CD command every time, for example:               cd Dropbox/GTD      Since I go to work on the files located on that specific directory every now and then (enough to be a pain), I am hoping someone can point a way so all I do is ideally   1. Click on a desktop shortcut (script or whatever mechanism)    2. Terminal opens under that specific directory without me typing any commands.   3. I can instantly work on the files located there.   4. If I open another terminal outside that 'shortcut', the terminal opens to the default home directory like usual. I have a basic understanding working with the command line and Linux in general but am not advanced. Hopefully, you can dumb it down a bit ^_^ Oh and thanks in advance for any tidbits that can help point me in the right direction.


Attach to existing screen session, but new window

So I have a screen session running on one terminal/machine I would like to write a script that would attach to that screen session on another machine, but to a new window in that screen. Does anyone know how I can do this? I feel like it might have somethig to do with `screen -x (session name) -p (window number)`...if i put "-" as the window number, it goes to a blank screen, but I want a fresh window. EDIT: Not really looking for a solution anymore myself, a neat tool called "tmux" replaces screen and makes this all trivial.


cannot open display "default display" in Linux Mint 15

I have a really strange problem, i rebooted my laptop running Linux Mint 15 with XFCE and unexpectedly it doesn't show the login screen instead i see `tty1`. The strange part is, that i haven't changed any configurations before the reboot. The system was running flawlessly weeks before today. At boot i see the animated splash logo, and then i am presented with the blinking cursor of the `tty1`. To check if my graphic card works I've rebooted to windows (it's a dual boot system). Windows works without problems. I also tried to boot older kernel versions, i checked the filesystems, everything ok. When i call `startx` from one of the ttys, i see my desktop without any XFCE stuff, no panels nothing. Cant open a terminal etc. Currently i am writing the last parts of my bachelor thesis, this problem is the total worst case. I am not to familiar with X11 and friends, that means i don't know where to look for the problem. PS: The laptop is a hp elitebook 8460p, with integrated intel hd graphics. I am running the included open source graphic drivers. **UPDATE** : When i call `startxfce4` in a `tty` after i logged in on that terminal, i get my desktop back. But why is there no login screen after all? Someone any ideas? `mdm` is responsible for the login screen in linux mint, i think that there is the problem. **UPDATE-2** : When i call `mdm` in the `tty` after booting, the login screen shows up and i can login. But why doesn't start mdm automatically?


Prevent dom0 IGP from being VGA-passed-through to HVM host with Xen4.4

Usually people want to VGA-passthrough their IGP, and there are a lot of documentation out there. However I _don't_ want my IGP passed-through to the domU as it serves my dom0, only my secondary card (Multi-OS NVidia). Currently everything is working fine with `gfx_passthrough=1`, except that when the domU takes control of the IGP it messes dom0's X server up (I cannot/don't know how to relaunch it, save for rebooting). It does not happen with `gfx_passthrough=0` (but then the secondary card does not work). Would someone please be so kind as to point where I can find information regarding such matters? Need I somehow explicitly forbid the IGP device with VGA passthrough, contrary to PCI passthrough? My running configuration:   * Dell PET620 server   * Xen4.4 with Ubuntu Server 14.04 as dom0 (stock kernels and all)   * domU (HVM) : Win7 / Mint17   * IGP : Matrox something, 16M RAM   * PCI card : NVidia Quadro K4000


ath9k 802.11n 300Mbps at low speed

I'm testing my new home 802.11n network. router - slax 7, kernel 3.8.2, AR9382 mini pci-e (sparklan WPEA-121N)               wlan0     IEEE 802.11abgn  ESSID:"xyz"               Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: 96:77:38:F7:80:C8               Tx-Power=16 dBm               Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:on      desktop - slackware 14.1, kernel 3.10.17, AR9287 pci-e x1 (tp-link TL-WN881ND)               wlan0     IEEE 802.11bgn  ESSID:"xyz"               Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: 96:77:38:F7:80:C8               Tx-Power=20 dBm               Retry  long limit:7   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:off      laptop - windows 7, intel centrino advanced-n 6205 All computers are in the same place, standing next to each other, InSSIDer shows no interference with other networks, very good signal quality. All wireless adapters can theoretically work in 802.11n 300Mbps speed. I set up ad-hoc network with `iw wlan0 ibss join xyz 2412 HT40+` I'm testing speed with iperf. I can't get more than 3-4Mbps between any of my devices. When using 802.11g (NOHT option) I get 17-19Mbps between my desktop and server. Laptop still at 4Mbps. Whats going on? Why I can't reach even 50% of 802.11g? When doing `iwlist wlan0 scan` I never see available bitrates > 54Mb/s for my network.


How to reduce disc access?

This is a follow up question to: How to reduce temperature on a Dell XPS (L502X)? After reading the answer I noticed that my harddrive is spinning constantly, even when running TLP in bat-mode (mostly default settings, laptop-mode=5). **What I already do**   * `/tmp` is mounted as a `tmpfs`. AFAIK this is not recommended for `/var/tmp`, is it?   * `TLP` is running with this configuration   * `/` and `/boot` are `ext4` mounted with `commit=15,noatime`   * `/` is mounted from a `LUKS` partition, is this a problem? **What I am searching for** I guess that constant disc access is the major cause of my disc spinning all the time. **Are there any other ways to reduce disc access and/or ways to allow the disc to spin down?**


Mirror a single X application on a dual-monitor setup with Openbox

In a dual monitor system is it possible to mirror a single window and not the entire screen? Put it another way, can I ask an X application to open simultaneously on DISPLAY `:0.0` and `:0.1`? Basically this can be useful for presentations, where one needs to send to the projector just a copy of the PDF (or the like) window. My window manager is Openbox.


ssh out of port 80 to port 22?

The isp I am currently connected to only has port 80 open, but I need to ssh to my server which listens on port 22 of my router there. Is there a way to go out through port 80 here, then in through 22 there?


Can I use partitions made by Windows 7 in Linux?

I am planning to leave Windows and get to Linux (yet do not know which one, but it is not the question). I was using Windows 7, I have 2 partitions (C:198 GB, D:488 GB). And I have a lot of documents and projects in D:, which I do not want to lose. Now I wonder, can I install Linux distribution without losing data from disk D:?


find words with all vowels in order from a file

I have a large dictionary file with 300,000+ words in it and I'm trying to find all words with the vowels aeiou in that order and have only exactly 5 vowels. My current attempt does not seem to be working and for the life of me I don't understand why.               less mywords | grep -iE [^aeiou]*a[^aeiou]*e[^aeiou]*i[^aeiou]*o[^aeiou]*u[^aeiou]*      I think it get's all the words I'm looking for but there are a few words that pop up which I can not get rid of.               abstemiousnesses     ultraserious      There are a few other but they are in the same vein. Curiously, even if I add something like `[^u]*` to the front `ultraserious` keeping popping back up! Any solution would be fine however I would like it restricted to grep as we've been told it can be done using only grep.


Execute all files in a list

I have a source tree which, when `make` is run, produces several executables named "001", "002", and etc. I'm trying to write a script which will find all of these executables in my source tree, and then execute them. I have this so far: `find build/ -type f -executable | ack --nocolor "\d{3}$"` Which lists the executables that I want to execute correctly. My question is, how do I then run all of them? I thought perhaps some combination of `xargs` and `exec` would do it, but `exec` seems to try replacing the current shell with the command, which isn't what I want.


How does Linux handle 2 identical destinations in its routing table?

I have this is my routing table (in that order):               10.3.68.0/22 via 172.16.100.9 dev vlan4     10.3.68.0/22 dev eth3  proto kernel  scope link  src 10.3.69.254      `eth3` has ip `10.3.69.254/22`. Why does Linux choose to go through the `172.16.100.9` gateway to access the `10.3.68.0/22` subnet (thus not trying direct link)? I tested with `ip route get 10.3.68.123` for example. It says it will go through `172.16.100.9`, and in practice, it does. It only says that it will try the link local routing when I ask for `10.3.68.0` ("network" address), `10.3.71.254` (broadcast), or `10.3.69.254` (itself). I think this is because these 3 cases are specifically handled by the higher priority `local` table (`ip route show table local`). Anyway, **why does Linux consider the first route as the higher priority route?**


How do you run CPU at turbo speed continuously

processor       : 7     vendor_id       : GenuineIntel     cpu family      : 6     model           : 60     model name      : Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz     stepping        : 3     cpu MHz         : 3299.670     cache size      : 8192 KB     physical id     : 0     siblings        : 8     core id         : 3     cpu cores       : 4     apicid          : 7     initial apicid  : 7     fpu             : yes     fpu_exception   : yes     cpuid level     : 13     wp              : yes     flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm     bogomips        : 6599.34     clflush size    : 64     cache_alignment : 64     address sizes   : 39 bits physical, 48 bits virtual     power management:      I've set the following:               title OpenVZ (2.6.32-042stab092.3)             root (hd0,0)             kernel /vmlinuz-2.6.32-042stab092.3 ro root=/dev/mapper/vg_vpsny23-lv_root intel_pstate=disable nomodeset rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_vpsny23/lv_root rd_LVM_LV=vg_vpsny23/lv_swap nodmraid rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet              initrd /initramfs-2.6.32-042stab092.3.img      But it still only shows/runs at 3.30GHz.


linux permission, group member cannot write even with write permission

The logged in user is a member of a group that has a write permission on a folder. But when this user is trying to write something, "permission is denied". The log below summarizes the question:               subv:/www/tracer/ whoami     frank     subv:/www/tracer/     subv:/www/tracer/ ls -ltr      total 4     drwxrwxr-x 2 root tracer 4096 Jan 20 12:25 convert.tracer.com     subv:/www/tracer/ groups frank     frank : frank tracer     subv:/www/tracer/ > convert.tracer.com/test     -bash: convert.tracer.com/test: Permission denied     subv:/www/tracer/      Output of "ls -bail /www/tracer/convert.tracer.com/":               subv:~/ ls -bail /www/tracer/convert.tracer.com/     total 8     38010883 drwxrwxr-x 2 root tracer 4096 Jan 20 12:25 .     38010882 drwxr-xr-x 3 root root    4096 Jan 20 12:25 ..     subv:~/


Keep a Zenity dialog box always-on-top in foreground

Is there a way to detect that a `zenty` dialog is loosing focus? I would like to hold it in the foreground, unless the user presses ESC. This is the script where I want to add this:   https://github.com/rubo77/mouse-speed/blob/master/usr/bin/typebreak#L20


Can't su root after editing PAM confiugration on Rackspace Linux box

I've just hosed a system. Working on pam-ldap on an Ubuntu box, I've run `pam- auth-update` and told it to override local modifications (which had previously allowed for `sudo su`, but I was having issues with `sudo <arbitrary command>`. After applying the settings I can no longer `su root`. Now I'm pretty much locked out of the box and since it's on the cloud the concept of 'boot access is root access' doesn't really apply. Any ideas how I can rescue the box?


Gnuplot and process-substitution

I have a log file where I need to cut out two values at different positions. these are: time and dQ in my file. The main problem is the paste I think. cause the other utilities work pretty well on their own. If I type in the shell it all works fine, and I get 2 columns:                 paste        <(cat log.fireFoam | grep  '^Time'           | cut -d' ' -f3 | tr -d ',')       <(cat log.fireFoam | grep  'dQ'              | cut -d' ' -f9 | tr -d ',')      Now is my problem how I can get this command work in gnuplot?                 plot\        "< exec bash -c\        "paste\        <(cat log.fireFoam | grep  '^Time'           | cut -d' ' -f3 | tr -d ',')\       <(cat log.fireFoam | grep  'dQ'              | cut -d' ' -f9 | tr -d ',')\       "\       "\       u 1:2      Hopefully someone could me


cannot start PostgreSQL on OpenBSD 5.4 through rc.d

I've installed the `postgresql-server` package on OpenBSD 5.4 amd64, and I try starting it through its `rc.d` script, however, it doesn't look like it's running after that.               opti# /etc/rc.d/postgresql start     postgresql(ok)     opti# ps auxw | fgrep -i sql     root      8892  0.0  0.0  1652   276 p1  R/1    5:04PM    0:00.00 fgrep -i sql (tcsh)     opti#        * Why does the script report that it starts successfully?   * Why does it not actually start?


Match a single character in a string bash script

My issues is that I want to read a character from the stdin and compare it with a string value. If that character exists then I want to display a message. Eg, saving `%` into the variable `$a`:               $ read a     %     $echo $a     %      There is variable defined say `v='~`!@#$%^&*()_-+=:;{[}]|\/<>,."'` all possible special character including single tick `'` I need to check if the character input exists in the string value. How can I do this.


Why do I need dbus?

I recently removed dbus from my system (along with consolekit and polkit). I didn't notice any change (I was running it as system daemon and per-user from .xinitrc). However, many people claim that one just need dbus, most of linux applications are using it etc etc. My question is, why do I need it? I don't think I understand what does it exactly do. I know that is a "message bus system", that processes communicate through it etc. And? I still don't know what do I gain from using it. Could someone explain it to me, preferably with examples "from real life"?


Append files with bash one-liner?

Currently I use multiple lines to append content into a combined file, e.g.               ./myprogram 1.txt > Out.txt # Overwrite for the 1st file     ./myprogram 2.txt >> Out.txt     ./myprogram 3.txt >> Out.txt     ./myprogram 4.txt >> Out.txt      Is it possible to replace by one-liner?


Clearing GNU Screen after full-screen application

When working at a normal xterm (not sure about a "real" terminal), when a full-screen program such as man or vim is closed, it disappears, leaving your screen so you can see your prompt, and previous prompts including where you launched the program that closed. When I am running within GNU Screen, however, when the program is closed it does not clear but is simply shifted up so a prompt can be displayed. To me this is ugly, and I'd like to know if "normal" behaviour can be resumed. I realise I could manually clear the screen myself but a) I don't want to and b) that would result in a totally clear screen, not what I'm after (though perhaps better, if this is as good as it gets).


Why is echo a shell built in command?

$ which echo     echo: shell built-in command.     $ which ls     /bin/ls     $ which cat     /bin/cat      Why is echo not an independent utility like `ls`, `ps`, `cat` etc? Why is it shell specific? Any good reasons?


How can I write an OpenSuse script that will change my boot menu.lst file and add "nomodeset" automatically both to failsafe and normal boot option? (This script is for suseStudio I'm going to write it under the "Run script whenever the appliance boots" for the first boot).


What does "spanning files" mean in the help of Manpage?

I open a manpage of some command, and then hit `h`.   * In the help, for the search part, what does "spanning files" mean?   * What are "files" refereed to? I search a pattern, and hit `n` to repeat the previous search. I found there is no difference between `n` and `ESC`-`n`.                                         SEARCHING            /pattern          *  Search forward for (N-th) matching line.       ?pattern          *  Search backward for (N-th) matching line.       n                 *  Repeat previous search (for N-th occurrence).       N                 *  Repeat previous search in reverse direction.       ESC-n             *  Repeat previous search, **spanning files**.       ESC-N             *  Repeat previous search, reverse dir. & **spanning files**.       ESC-u                Undo (toggle) search highlighting.       &pattern          *  Display only matching lines


Using notify-send with cron

I am using Arch Linux with KDE/Awesome WM. I am trying to get `notify-send` to work with `cron`. I have tried setting `DISPLAY`/`XAUTHORITY` variables, and running `notify-send` with "sudo -u", all without result. I am able to call notify-send interactively from the session and get notifications. FWIW, the cron job is running fine which I verified by echoing stuff to a temporary file. It is just the "notify-send" that fails to work. Code:               [matrix@morpheus ~]$ crontab -l     * * * * *  /home/matrix/scripts/notify.sh     [matrix@morpheus ~]$ cat /home/matrix/scripts/notify.sh     #!/bin/bash     export DISPLAY=127.0.0.1:0.0     export XAUTHORITY=/home/matrix/.Xauthority     echo "testing cron" >/tmp/crontest     sudo -u matrix /usr/bin/notify-send "hello"     echo "now tested notify-send" >>/tmp/crontest     [matrix@morpheus ~]$ cat /tmp/crontest     testing cron     now tested notify-send     [matrix@morpheus ~]$       As you can see the echo before & after notify-send worked. Also I have tried setting `DISPLAY=:0.0` UPDATE: I searched a bit more and found that DBUS_SESSION_BUS_ADDRESS needs to be set. And after hardcoding this using the value I got from my interactive session, the tiny little "hello" message started popping up on the screen every minute! But the catch is this variable is not permanent per that post, so I'll have try the the named pipe solution suggested there.               [matrix@morpheus ~]$ cat scripts/notify.sh     #!/bin/bash     export DISPLAY=127.0.0.1:0.0     export XAUTHORITY=/home/matrix/.Xauthority     export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-BouFPQKgqg,guid=64b483d7678f2196e780849752e67d3c     echo "testing cron" >/tmp/crontest     /usr/bin/notify-send "hello"     echo "now tested notify-send" >>/tmp/crontest     [matrix@morpheus ~]$       Since `cron` doesn't seem to support notify-send (at least not directly) is there some other notification system that is more `cron` friendly that I can use?


Replacing LXDE with XFCE, startx issues

Apologies if this seems straight forward but I've recently downloaded XFCE to replace LXDE environment on my raspberry pi running raspbian. I did this by using               sudo apt-get install xfce4      and following all the instructions. Then to remove LXDE I carried out:               sudo apt-get --purge remove lxde     sudo apt-get clean      My problem lies that whenever I run                startx      it still opens and runs LXDE? I know that I should be running startxfce4 if I simply want to use XFCE, but I want to know how to completely remove LXDE? Edit: Also how do I modify the startx file so that I can choose (if both are installed) which desktop environment I want startx to run (either lxde or xfce)? Thanks!


Quoting text with > in mutt

Currently when I reply to a message, my mutt is quoting using > as following               On Sunday ... Mojo Jojo wrote     >Hey Powerpuff girls       I want a space just after `>`, e.g.               On Sunday ... Mojo Jojo wrote     > Hey Powerpuff girls       This package has `stuff_quoted` option which does it. How to do this in mutt?


How to find out what's wrong on all of my Qt programs?

I'm using Arch Linux (Linux 3.13), when I run `qtcreator`, it crashes, and the same happens for other Qt based software:               $ qtcreator     "Qt Warning - invalid keysym: dead_actute"      Segmentation fault (core dumped)          $ qtalarm      "Qt Warning - invalid keysym: dead_actute"       Segmentation fault (core dumped)      all my "qt" installed packages are:               gambas3-gb-qt4 3.5.2-1     gambas3-gb-qt4-ext 3.5.2-1     gambas3-gb-qt4-opengl 3.5.2-1     gambas3-gb-qt4-webkit 3.5.2-1     kdebindings-qtruby 4.12.1-1     kdebindings-smokeqt 4.12.1-1     libdbusmenu-qt 0.9.2-2     phonon-qt4 4.7.1-1     polkit-qt 0.103.0-2     poppler-qt4 0.24.5-1     pyqt4-common 4.10.3-1     python2-pyqt4 4.10.3-1     qt4 4.8.5-7     qt5-base 5.2.0-3     qt5-declarative 5.2.0-3     qt5-graphicaleffects 5.2.0-3     qt5-imageformats 5.2.0-3     qt5-jsbackend 5.1.1-5     qt5-location 5.2.0-3     qt5-multimedia 5.2.0-3     qt5-qtsystems-git 20130509-1     qt5-quick1 5.2.0-3     qt5-quickcontrols 5.2.0-3     qt5-script 5.2.0-3     qt5-sensors 5.2.0-3     qt5-serialport 5.2.0-3     qt5-svg 5.2.0-3     qt5-tools 5.2.0-3     qt5-translations 5.2.0-3     qt5-webkit 5.2.0-3     qt5-x11extras 5.2.0-3     qt5-xmlpatterns 5.2.0-3     qtalarm 4700237.6-1     qtchooser 39-1     qtcreator 3.0.0-2     qtwebkit 2.3.3-1     telepathy-qt 0.9.3-7      How can I find out what's wrong (what the cause of the problem is) on my system?


Setuid directory permission implies execute permission?

Does setting `u+s` on a directory imply `u+x`?


Scp doesn't work in cron

Yeah, I know it's classic. I've googled it all around, but still it doesn't work. I have the following script:                #First go to SVN repo folder     cd $svnrepos               # Just make sure we have write access to backup-folder     if [ -d "$bakdest" ] && [ -w "$bakdest" ] ; then       # Now $repo has folder names = project names       for repo in *; do         # do svn dump for each project         echo "Taking backup/svndump for: $repo"         echo "Executing : svnadmin dump $repo > $bakdest/$repo-$bakdate.svn.dump \n"         # Now finally execute the backup         svnadmin dump $repo > $bakdest/$repo-$bakdate.svn.dump         # You can go an extra mile by applying tar-gz compression to svn-dumps              # We also would like to save the dump to remote place/usb           # USB/other directory exists, copy the dump there           echo "Going to copy $repo dump to $baktousb directory...\n"           /usr/bin/scp -v $bakdest/$repo-$bakdate.svn.dump $baktousb/$repo-$bakdate.svn.dump       done     else       echo "Unable to continue SVN backup process."       echo "$bakdest is *NOT* a directory or you do not have write permission."     fi               # End of backup script     echo "\n\n================================="     echo " - Backup Complete, THANK YOU :-]"      everything works fine in shell, but when It's executed as cron job it simply doesn't scp (but does create a backup). Yes, I have an empty paraphrase. Can't get why it doesn't work.


Why is Apache not respecting aliased directories?

In `ssl_default.conf` where Apache serves as an SSL-adding proxy for Django Gunicorn, I have:                   ...         Alias /admin/static/ "/usr/lib/python2.7/dist-packages/django/contrib/admin/static/"              ProxyPass /media/ !         ProxyPass /admin/static/ !         ProxyPass / http://localhost:8080/         ProxyPassReverse / http://localhost:8080/      What should I be doing differently to have `/admin/static/*` serving up the contents of the URL above? At present it appears to be handing requests, including `/admin/static/*`, to the Django Gunicorn process. **UPDATE** Now I'm getting a 403 after expanding:                   Alias /admin/static/ "/usr/lib/python2.7/dist-packages/django/contrib/admin/static/"         <Directory "/usr/lib/python2.7/dist-packages/django/controb/admin/static/">             Options Indexes MultiViews FollowSymLinks             AllowOverride None             Order deny,allow             Deny from all             Allow from 127.0.0.0/255.0.0.0 ::1/128         </Directory>      This is on attempting to access `/admin/static/css/base.css`. Suggestions?


Is there a readme reader like man?

`man` is the quick interface to online reference manuals. These are usually stored in `/usr/share/man/manN/blah.gz`, or similar. Most debian packages also come with a `README.debian`, which is stored in `/usr/share/doc/blah/README.debian`. Is there an automated reader for these files, that finds the appropriate `README.debian`, and opens it?


How do I know that my rpm installation of a package was succesful?

I downloaded the rpm for dos2unix and installed (on RHEL 6, 64 bit) like this               [root@xilinx Downloads]# rpm -ivh dos2unix-5.3.3-5.ram0.98.src.rpm         1:dos2unix               warning: user mockbuild does not exist - using root     warning: group mockbuild does not exist - using root     warning: user mockbuild does not exist - using root     warning: group mockbuild does not exist - using root     ########################################### [100%]     [root@xilinx Downloads]#       But as can be seen I am getting these warnings. Why? How do I know that my installation of dos2unix was succesful ? **Update**               [root@xilinx Downloads]# rpm -ivh dos2unix-5.3.3-5.ram0.98.src.rpm        1:dos2unix               warning: user mockbuild does not exist - using root     warning: group mockbuild does not exist - using root     warning: user mockbuild does not exist - using root     warning: group mockbuild does not exist - using root     ########################################### [100%]     [root@xilinx Downloads]#      [root@xilinx Downloads]#      [root@xilinx Downloads]#      [root@xilinx Downloads]#      [root@xilinx Downloads]# rpm -ql dos2unix     package dos2unix is not installed     [root@xilinx Downloads]#       I then tried               [root@xilinx acme]# yum install mock     Loaded plugins: refresh-packagekit, rhnplugin     There was an error parsing the RHN proxy settings.     RHN support will be disabled.     Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia. Please verify its path and try again     [root@xilinx acme]#


(Ill)Logical statement

I am attempting to make a simple script to flip my computer screen. My first if statement executes perfectly, but after that, thought $istouch is "on", the elif statement block will not execute! I have tried running bash with the -u option with no failure and have tried switching the checks, nothing works.               #!/bin/bash     xsetwacom --set 16 touch False     istouch='xsetwacom --get 15 touch'     $istouch     if [ "$istouch"=="off" ]     then         xrandr -o inverted         xinput set-prop 13 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1         xinput set-prop 15 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1         xinput set-prop 16 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1         xsetwacom --set 15 touch True          elif [ "$istouch"=="on" ]     then         xrandr -o 0         xinput set-prop 13 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1         xinput set-prop 15 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1         xinput set-prop 16 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1         xsetwacom --set 15 touch False     fi


unable to search and install dos2unix pakage

I have RHEL 6 , 64 bit OS. I need to istall dos2unix for this version. I could not find rpm file for RHEL 6 86_64 bit , so I tried like this:               [root@xilinx acme]# yum search dos2unix     Loaded plugins: refresh-packagekit, rhnplugin     There was an error parsing the RHN proxy settings.     RHN support will be disabled.     Warning: No matches found for: dos2unix     No Matches found      Why no maches found? Also how do I remove the warning               There was an error parsing the RHN proxy settings.             RHN support will be disabled      Also this the content of my yum.conf file:               [main]     cachedir=/var/cache/yum/$basearch/$releasever     keepcache=0     debuglevel=2     logfile=/var/log/yum.log     exactarch=1     obsoletes=1     gpgcheck=0     plugins=1     installonly_limit=3          #  This is the default, if you make this bigger yum won't see if the metadata     # is newer on the remote and so you'll "gain" the bandwidth of not having to     # download the new metadata and "pay" for it by yum not having correct     # information.     #  It is esp. important, to have correct metadata, for distributions like     # Fedora which don't keep old packages around. If you don't like this checking     # interupting your command line usage, it's much better to have something     # manually check the metadata once an hour (yum-updatesd will do this).     # metadata_expire=90m          # PUT YOUR REPOS HERE OR IN separate files named file.repo     # in /etc/yum.repos.d      **Update** It looks like I have to add the repo which contains `dos2unix`. My question is what is that repo. Also I treid finding rpm file for this , but all avallable rpms are for RHEL 5 or 7 ..but not for 6, which is what I am using. I searched rpm here: but could not find for rhel 6 **Update 2** I found the rpm here and installed!!


Need a loop to sleep for a fraction of second

On my machine I need to execute a cycle that iterates 1 simple command that must have a delay expressed in fractions of second. Let's say that I need:   * to save a file with an increasing enumaration ( file-0, file-1, file-2, ... ) generate by something trivial for this example like `time > file-$x`   * I need to do this every 1/70 of second (as an example) because I would like to express my time with fractions of second. How can I be really precise and have everything expressed with a bash script? The fraction can generate an indeterminable quantity, I need to be precise and so I need at least 4-5 decimals.


How can I configure ethernet?

I just started using linux (installed Debian) and the one thing I'm trying to do right now is have my internet working. I connected my ethernet port but still no internet works. I googled for awhile and figured I had edit the network interfaces config file but I couldn't because it said it was read-only. I'm not sure how to access that file as a root because I couldn't find an option for that. Any help in regards with this would be awesome.


How to get gnome to run /etc/gdm/PostSession/Default when using XRDP w/ VNC

I use Microsoft's Remote Desktop Client (`mstsc.exe`) to connect to a linux server with GNOME as my desktop. I've set up `/etc/gdm/PostSession/Default` to execute some steps on cleanup - which works when I'm logged in physically. However, `/etc/gdm/PostSession/Default` is not getting executed when I exit my RDP session. What triggers `/etc/gdm/PostSession/Default` to execute? **NOTE"** I'm using CentOS 6.5 with Gnome 2.28.2


iptables one IP through another network interface

This question is very similar to what I am trying to do: iptables --set-mark - Route diferent ports through different interfaces However I attempted to follow the answer but I was unable to make it work. I have one device that I would like to route through a PPTP VPN connection. If I do it on my router it will put all users through the VPN I decided to try and use the same server I am using as a proxy server to connect to the VPN. I currently have my router (DD-WRT) routing packets to my proxy server using this script:               iptables -t mangle -A PREROUTING -p tcp --dport 80 -j MARK --set-mark 10     ip rule add fwmark 10 table 10     ip route add default via 192.168.0.10 table 10      That is working fine. On my server end I am trying to route 192.168.0.48 through my VPN and all of the others through my proxy server. I am using the following script on my server:               #Redirect all traffic on 80 to proxy except 192.168.0.48 (WORKING)     iptables -t nat -A PREROUTING -p tcp -m tcp ! -s 192.168.0.48 --dport 80 -j REDIRECT --to-ports 3127     #Mark packets from 192.168.0.48 with 20     iptables -t mangle -A PREROUTING -p tcp -s 192.168.0.48 --dport 80 -j MARK --set-mark 20      I then tried to forward traffic marked with `20` to `ppp0` using the following:               ip rule add fwmark 20 table 20     ip route add default via 192.168.1.2 dev ppp0 table 20      All computers can load webpages successfully except for `192.168.0.48` which sits at loading forever. I have confirmed I am getting traffic on `ppp0` from `192.168.0.48` using `tcpdump -i ppp0`


Upgrading Python 2.6. libpython2.6.so.1.0 missing

I am upgrading python on an offline 64bit RHEL 6.4 box and am having to do it via RPM's rather than yum. I am trying to upgrade python from 2.4.3 to 2.6 so I can build nodejs from source. I am running into trouble when I run               rpm -Uvh python26-2.6.8-2.el5.x86_64.rpm      I get a failed dependencies error:               libpython2.6.so.1.0() (64bit) is needed by python26-2.6.8-2.el5.x86_64      I can't find anyway to install libpython2.6 though...


xorg: lost screen resolution after Debian/Jessie upgrade

After update/upgrade within Debian/Jessie (affecting some 50 packages) and a reboot (after an uptime of about a month), the full resolution 2560x1440 of my Dell U2713HM has gone. xrandr is listing at most 1920x1200. Given the long history of my installation, I tried a radical cure, purging all xorg related packages, and reinstalling them. No effect, still limited to 1920x1200. Then I tried               ~$ cvt 2560 1440     # 2560x1440 59.96 Hz (CVT 3.69M9) hsync: 89.52 kHz; pclk: 312.25 MHz     Modeline "2560x1440_60.00"  312.25  2560 2752 3024 3488  1440 1443 1448 1493 -hsync +vsync     ~$ xrandr --newmode "2560x1440"  312.25  2560 2752 3024 3488  1440 1443 1448 1493 -hsync +vsync     ~$ xrandr --addmode HDMI1 2560x1440     ~$ xrandr  --output  HDMI1 --mode 2560x1440     xrandr: Configure crtc 0 failed      The only trace of this in `Xorg.0.log` is the following:               [  3263.882] (II) intel(0): Allocated new frame buffer 2560x1440 stride 10240, tiled     [  3264.048] (EE) intel(0): failed to set mode: Invalid argument     [  3264.080] (II) intel(0): Allocated new frame buffer 1920x1200 stride 7680, tiled      According to `lspci -v`, my video device is the following:               00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06) (prog-if 00 [VGA controller])         Subsystem: Fujitsu Technology Solutions Device 11e7         Flags: bus master, fast devsel, latency 0, IRQ 46         Memory at f7800000 (64-bit, non-prefetchable) [size=4M]         Memory at e0000000 (64-bit, prefetchable) [size=256M]         I/O ports at f000 [size=64]         Expansion ROM at <unassigned> [disabled]         Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-         Capabilities: [d0] Power Management version 2         Capabilities: [a4] PCI Advanced Features         Kernel driver in use: i915      Since I installed the full `xorg` dependency package, missing drivers is not a likely explanation. How to proceed?


How to correct fs size for logical volume

I decreased logical volume `lv_postgres` size for a 5G. then redistributed free space to other lv `lv_home`, but didn't do resize2fs for the decreased volume `lv_postgres'`. At the next boot i fall into emergence mode and `resize2fs lv_postgres` dont't do the task saying "Please run `e2fsck -f`" and the last one say "Either the superblock or pt is likely to be corrupt" if i continue then on pass 5 get "error reading block while reading inode and block bitmaps" the fs size according to superblock is 2564096 blocks the physical size of device is 1253376 blocks i want to reduce volume from 9.78G to 4.78G to match required size Which is a right way to correct size for volume?


remove a host from the completion list for ssh in zsh

I once had some hosts named 'myhost', 'myhost1', etc. And now all those except 'myhost3' become invalid. I removed those from `/etc/hosts` and `~/.ssh/known_hosts`, but zsh still completes them for me. Is there any other file I should edit to make zsh forget about those hosts? I haven't changed anything related to hosts in my zsh configuration; they come out by default. UPDATE: Some time later (after a hibernation but no reboot), those hosts disappear. Maybe zsh cleared some kind of cache? (But not `~/.zcompdump` as I checked that. I also tried start new instances of zsh but that doesn't make difference.) I'll try and test later. UPDATE #2: I tried again and successfully removed a newly-added host from the completion list. Maybe I did something wrong previously, sorry.


Physical layer header is not present in the data read from raw sockets?

i have read about RAW sockets that they are UNIX domain sockets and don't generally go over the wire unlike TCP or UDP. They are used for interprocess communication. Also they are used in the implementation of new transport layer protocols and are also used in ICMP(for ping).


How to install RPM based Packages on OpenFiler

We bought One SuperMicro Server that will be used for Storage purposes and then we install the openfiler on it. The thing is that we need to install RAID controller and Im not familiar with OpenFiler and there are packages in that are .rpm or .deb when i pass the command **rpm -ivh StorMan-7.30.i386.rpm** it say **-bash: rpm: command not found** So how to install .rpm packages on this Openfiler. So that I can remotely access the RAID controller using my machine.


mutt: color mesages with attachments differently

I tried this:               folder-hook . 'color index green black "~B \"Content-disposition: attachment;\""'      but got nothing except exceptionally slow rendering of the inbox. Is there any way to do this, or generally anything that will allow me to see messages with attachments in the index (flags etc..) that can be solved by configuration and not patching.


Restarting process via cron every 12 hours

I'm not familiar with cron at all, and I've looked it up and am still confused as to how specifically it works. I'm on CentOS 6.5, and I need to end a process and then start it again every 12 hours. It will have a different pid every time though, so I'm not sure how I would kill the process. Then I need to restart the process. I would like for this to happen at 7am and 7pm every day. How would I go about accomplishing this? **EDIT:** I need to do this because we're running crtmpserver and it seems to quit after 15 hours or so. If it's restarted it bypasses this problem. Instead of figuring out the root problem I'd rather implement this since it should be a quick fix.


What are the purposes of the different types of XWindows fonts?

In my `/usr/share/fonts/` I have four sub-directories categorizing types of fonts:   1. `cmap`   2. `truetype`   3. `type1`   4. `X11` The command `fc-list` produces a list of them. Are these different categories for specific purposes, or simply a result of the evolution of differing trends for designing fonts?


replacing backtick with $() not working

I have some old scripts that I try to update. Some of the code condenses to:                export X=`(echo "abc"; echo "def")`      echo $X      which gives the expected output:                abc def      Now the internet tells me backticks are out `$()` is what I need to use, but when I try:               export X=$((echo "abc"; echo "def"))      `X` is not set and I get the error:               bash: echo "abc"; echo "def": syntax error: invalid arithmetic operator (error token is ""abc"; echo "def"")      What am I doing wrong?


Filesystem content inspection GUI (like gconf-/dconf-editor)?

Within, for instance, `/sys/kernel/debug/tracing`, the kernel makes many settings available as files, whose contents should be read in order to see what that setting is. Of course, typing `cat /sys/kernel/debug/tracing/...` each time to see the setting is kind of tedious; so right now I'm using this function to traverse and inspect that part of the filesystem (needs to be called under `sudo`):               #!/usr/bin/env bash          function recourse_print() {       local LVL=$2       local IND="$(printf ' %.0s' $(seq 1 $LVL) )-"       for ix in $(ls --group-directories-first --reverse "$1" | tac); do         local FP="$1/$ix"         if [ -f "$FP" ]; then           echo "$IND $ix: $(timeout -s SIGALRM 1 cat $FP 2>&1 | awk 1 ORS=' ; ' | head -c 50) ... "         elif [ -d "$FP" ]; then           echo "$IND $ix [d]"           local NL=$((LVL+1))           if [ $((LVL < 3)) = 1 ] ; then             recourse_print "$FP" $NL           fi         fi       done     }          recourse_print /sys/kernel/debug/tracing 1      This is sort of OK, in the first run:                - available_events: i915:i915_gem_object_create ; i915:i915_gem_object ...       - available_filter_functions: cpumask_weight ; run_init_process ; init_post ; in ...       - available_tracers: blk function_graph mmiotrace wakeup_rt wakeup func ...       - buffer_size_kb: 8192 ;  ...       - current_tracer: function ;  ...      ...      - per_cpu [d]       - cpu0 [d]        - stats: entries: 0 ; overrun: 0 ; commit overrun: 0 ;  ...         - trace: # tracer: function ; # ; #           TASK-PID    C ...         - trace_pipe:  ...         - trace_pipe_raw:  ...        - cpu1 [d]        - stats: entries: 0 ; overrun: 0 ; commit overrun: 0 ;  ...         - trace: # tracer: function ; # ; #           TASK-PID    C ...         - trace_pipe:  ...         - trace_pipe_raw:  ...      ...      The problem is - there are so many entries, it becomes difficult to keep track and focus within this list in a terminal. One thing I wish for this, was that there was a filesystem GUI, that would do the same - that is, recursively traverse a directory, and open any files and display a one-line summary of the contents (timing out in case of pipes) - such that the directory hierarchy is displayed as GUI tree nodes, that can be expanded/compacted; examples for this are `dconf-editor`: ![dconf-editor](http://i.stack.imgur.com/V6JqJ.png) ... or `gconf-editor`: ![gconf-editor](http://i.stack.imgur.com/2NOAN.png) In this case, I imagine the left pane would show subfolders tree, and the "Name" in "Name/Value" would be the filename, and the "Value" would be one- line summary (truncated start) of the file's contents (where I'd expect the typical characters like `.�.�j�,�,{...` rendered in case the file has binary contents). I wouldn't expect such an app to render, say, checkboxes (even if a particular file has contents that can be set to either 0 or 1); but it would be awesome if it could open the entire file contents (for text-only files) in a new window upon doubleclick. Is there a standalone app that can do something like this - and if not, is there a plugin for, say, Nautilus, that could add an extra column in List View, that could be scripted to extract a one-line summary from the file contents?


get rid, Oh no ! Somethings Has Gone wrong window, Mint

I have updated my Mint using apt-get upgrade, after login I got Oh no! something Has gone wrong window but When I check all the log, it is fine, nothing gone wrong, after hit logout on the Oh no! window I can see the desktop, and it's all fine. I just want to get rid the Oh no window, what hot keys could I use, or what command ? anyway I'm using Mint 14


How does battery life on a laptop compare between GNOME 2 and GNOME 3 (GNOME Shell)?

Since GNOME 3 uses hardware acceleration by default, I assume that it will be worse for battery life on my laptop, but I can't actually find anything to back this up, and by how much. Has anyone done benchmarks of this yet? I really like the interface but I don't want to kill my battery life by upgrading (and I'm on a distro where it would be difficult to go back).


grep only subdirectories matching pattern

I have a directory tree consisting of several thousand subdirectories, but I frequently need to grep only a small subset of those directories. How can I `grep` only those subdirectories matching a pattern? For example, suppose I have these subdirectories which I want to grep in:               ...     ...     ...     /foo     /fooLib     /fooHandler     /fooGizmo     ...     ...     ...      The `...` entries above represent the thousands of other directories I _don't_ want to grep in. Supposing I'm looking for all instances of `bar`, if I do this:               grep -n --recursive bar *      I would find what I'm looking for, but in all of the directories. How can I search in only those subdirectories matching the pattern `foo*`?


Input freeze when X starts on other terminal

I have a Packard Bell F2011HC-125GE running a Debian Squeeze-based Linux. After a few days of usage i found the system freezes from time to time. It's obvious the freezes happen, when X starts while another terminal is active(e.g. tty1). Some scenarios are: -Suspending while in text-terminal (e.g. ctrl+alt+f2). This includes freezing when closing the lid. On resume the screensaver from tty7 is showing, but doesn't react to input. Sometimes it is still possible to switch to another terminal and do something like 'echo 1 > /dev/tty7' and switch back with ctrl+alt+f7. Then input is possible. Though, most of the time it's completely frozen. -Choosing to logout from KDE-session and switching instantly to ttyX < 7\. Then input works for a few seconds before it switches to the KDE-login-screen but doesn't react to input anymore. In that case the power-button does still work and i am able to shut down. When i logout and wait for the login-screen to be ready i am able to switch tty without problems. -X crashes while ttyX<7 is active. No switch-back. Can only hold power button and reset. I'm able to see crashes in log-file. Reasons are unimportant for this matter. Freezes occur whatever the reason is. This does not happen when tty7,8 is active while X crashes. Also, i can startx from terminal, wait and everything works fine. My chipset is HM77-7 Series (Intel) and some of my hardware is not supported by ACPI/ALSA from the debian-repo. I've backported 3.2 with the same issue, customized 3.6.6, which works better than both debian-repo kernels, but still with the issues mentioned above. I'm currently trying to use 3.7.1, but i have with problems with ath9k (wireless-module) being present in both kernel in userspace, same with ntfs. (I dont want to use FUSE). The X-problems seem to be the same with whatever kernel. How do i find what the source of the problem is? Where do i look? udev? X? I can't image it being the kernel, because somebody else must have noticed; Though, i'm sure it's some kind of problem with input-redirection. I am sorry for the long text, hope not to bother you too much with a rather specific problem and would really appreciate any kind of hint or help. Greetings


Grep of many keywords over many files: speeding it up

I am currently facing a "performance problem" while using grep. I am trying to locate the occurrences of many (10,000+) keywords in many (think Linux kernel repository size) files. The objective is to generate a kind of index for each keyword:               keyword: my_keyword     filepath 1     filepath 2     ------     keyword: my_keyword2     ...      Being fairly new to shell scripting, I have tried a few naive approaches:               while read LINE; do         echo "keyword: "$LINE >> $OUTPUT_FILE         grep -E -r --include='Makefile*' "($LINE)" . >> "$OUTPUT_FILE"         echo "-----"     done < $KEYWORD_FILE      This takes about 45 minutes to complete, with the expected results. Note: all they keywords I search for are located in a file ("KEYWORD_FILE", so fixed before anything starts), and the files in which to search can be determined before the search starts. I tried to stored the list of files to search in before the search like that:               file_set=( $(find . -name "Kbuild*" -o -name "Makefile*") )      and then replace the grep call by               echo {$file_set[*]} | parallel -k -j+0 -n 1000 -m grep -H -l -w "\($LINE\)" >> "$OUTPUT_FILE"      It takes about an hour to complete… Question: considering I can use whatever technique I want, provided it's sh compliant, how can this be done "faster" and/or more efficiently ? Perhaps `grep` is not the tool to use, and my use of `parallel` is wrong… any ideas are welcome!


Can I Install packages on live linux os?

I want to install some more software on sabayon live and they should be remained in USB for later use. Can I install packages on live Linux OS?


Copy file if no error was encountered, else delete copied portion

I am copying a folder in Linux with plenty of files. Some of the files give me error like this:               Error splicing file: Input/output error      The problem is that it keeps the file in new location though it doesn't open. I would like to write a Unix command that would simply skip the file if these type of error occur and don'delete it from the new location. My final directory should have only those files in which the error doesn't occur.


What type of Linux would need fewer updates?

I know how to put different Linuxes on a live persistent usb, but I have noticed that updating/upgrading a such system increases the risk of breaking it. From my experience it looks like the persistence feature is just an enhancement that provides some space for supplementary changes like installing an office suite, some multimedia players, internet browsers, and for the settings made inside applications. But persistence space is not meant for changes in the system files or in the important drivers. Attempting such changes seems useless (they are not remembered) or dangerous (the drive would not boot after a while). I have asked a specific question on this - here. I know I can disable updates but what type of distro would need them the least - that is - would be meant to update rarely and not need a lot of update- upgrade considering the purpose of being used on an usb flash drive?


A shell script to write selected fields to a single line

I have a log file `trace.log` which prints the time stamp, thread name and Transaction method and transaction ID as below.               2014-01-23 15:50:41,724 [catalina-exec-35] INFO  TRANSACTION getConnection REQUEST, ID=1308::     2014-01-23 15:50:41,725 [catalina-exec-33] INFO  TRANSACTION getConnection REQUEST, ID=1304::     2014-01-23 15:50:41,727 [catalina-exec-10] INFO  TRANSACTION getConnection REQUEST, ID=1298::     2014-01-23 15:50:41,727 [catalina-exec-24] INFO  TRANSACTION getConnection REQUEST, ID=1307::     2014-01-23 15:50:41,727 [catalina-exec-12] INFO  TRANSACTION getConnection DONE, ID=1305::     2014-01-23 15:50:41,733 [catalina-exec-10] INFO  TRANSACTION getConnection DONE, ID=1298::     2014-01-23 15:50:41,734 [catalina-exec-26] INFO  TRANSACTION getConnection REQUEST, ID=1313::     2014-01-23 15:50:41,734 [catalina-exec-26] INFO  TRANSACTION getConnection DONE, ID=1313::     2014-01-23 15:50:41,738 [catalina-exec-39] INFO  TRANSACTION getConnection REQUEST, ID=1311::     2014-01-23 15:50:41,733 [catalina-exec-35] INFO  TRANSACTION getConnection DONE, ID=1308::     2014-01-23 15:50:41,738 [catalina-exec-27] INFO  TRANSACTION getConnection REQUEST, ID=1309::     2014-01-23 15:50:41,737 [catalina-exec-22] INFO  TRANSACTION getConnection REQUEST, ID=1310::     2014-01-23 15:50:41,743 [catalina-exec-30] INFO  TRANSACTION getConnection REQUEST, ID=1315::     2014-01-23 15:50:41,744 [catalina-exec-39] INFO  TRANSACTION getConnection DONE, ID=1311::     2014-01-23 15:50:41,747 [catalina-exec-2] INFO  TRANSACTION getConnection REQUEST, ID=1318::      I want to `grep` and print the time stamp of the `getConnection REQUEST` and `getConnection DONE` for a particular ID in a single line into a file. I have a written a shell script that printing the time stamp in multiple lines as below. Here is my shell script               for i in {1..800}     do          echo "Welcome $i times"          echo "ID=$i, getConnection " >> time.log          grep ID=$i: trace.log | grep getConnection | cut -d'[' -s -f1 >> time.log     echo "      " >> time.log     done      The output is as shown below               ID=791, getConnection     2014-01-23 15:50:16,703     2014-01-23 15:50:16,706          ID=792, getConnection     2014-01-23 15:50:16,704     2014-01-23 15:50:16,704          ID=793, getConnection     2014-01-23 15:50:16,704     2014-01-23 15:50:16,709          ID=794, getConnection     2014-01-23 15:50:16,708     2014-01-23 15:50:16,712      How I can change that? I need output as shown below:               ID=792, getConnection 2014-01-23 15:50:16,703 2014-01-23 15:50:16,706          ID=792, getConnection 2014-01-23 15:50:16,704 2014-01-23 15:50:16,704          ID=793, getConnection 2014-01-23 15:50:16,704 2014-01-23 15:50:16,709          ID=794, getConnection 2014-01-23 15:50:16,708 2014-01-23 15:50:16,712


How to assign space-containing values to variables in bash using eval

I want to dynamically assign values to variables using `eval`. The following dummy example works:               var_name="fruit"     var_value="orange"     eval $(echo $var_name=$var_value)     echo $fruit     orange      However, when the variable value contains spaces, `eval` returns an error, even if `$var_value` is put between double quotes:               var_name="fruit"     var_value="blue orange"     eval $(echo $var_name="$var_value")     bash: orange : command not found      Any way to circumvent this ?


Check if $REPLY is in a range of numbers

I'm writing a shell script for Linux, using Bash, to translate any video-file into a MP4. For that, I'm using `avconv` with `libvorbis` for audio. Inside my script, I have a question for the user :               read -p "- Audio Quality [scale from -2 to 10] ? "         if [ -n "$REPLY" ] ; then         ABITRATE="-aq $REPLY"         fi      My "ABITRATE" string goes into the final `avconv` command-line. But I would like to give the user the opportunity to answer that question with a value in Kb (Kilobit), and translate it into the scale that `libvorbis` uses. The "scale from -2 to 10" is this :               Quality Kbit/s  Normalization     -----------------------------      -2      ~32        y      -1      ~48        y       0      ~64        y       1      ~80        y       2      ~96        y       3     ~112        y       4     ~128        n       5     ~160        n       6     ~192        n       7     ~224        n       8     ~256        n       9     ~320        n      10     ~500        n      I would like to know how to check if my $REPLY is in a range of number. For example, I would like my script to do something like this :               if [ $REPLY is a number between 1 and 32 ] ; then       REPLY="-2"     elif [ $REPLY is a number between 33 and 48 ] ; then       REPLY="-1"     fi      Is this possible (I'm willing to say 'yes of course, shouldn't be hard' but I don't know the syntax to use) ?


Restoring backup files

I have a directory in which are listed some `.py` files and some `.py.bak` files. I want to delete the `.py` files and restore the backup file renaming them `*.py`. Is there a shell script that can do this? Thank you,   rubik


Sublime Text 2 not detecting python library if installed in /opt

I am attempting to install Sublime Text 2 in /opt/sublime_text. Once all the files are in there, I believe the executable not detecting the python libraries and throwing the following error: ![enter image description here](http://i.stack.imgur.com/PC5xV.png)   * I have python installed on my system already (2.7.3).   * I am able to run Sublime Text 2 from my home directory. I've tried copying just the `__future__.pyo` file into the /opt/sublime_text folder but I get the same error message. Is there a solution which doesn't require me to extract all of the python libraries in the application folder?


Break write permission for non root user?

Can non root user edit files he/she doesn't have access to or create new a file in a directory he/she doesn't own? Is there a way to do that? **P.S :** I know if root user or file owner gives him write permission he would be able to. I'm asking if he can't be granted permission. In other words, can Linux permissions be hacked?


How to know which public key was used when someone used passwordless ssh login?

Say for some reason, there is only a "user" account on a `shhd` server. Everyone has his own private key to `ssh` to the server, as "user". Then, is there a way to see who is he (during or after his session)?


Installing a unix application?

I am trying to install depot_tools here are the instructions. I downloaded the file from this:               svn co http://src.chromium.org/svn/trunk/tools/depot_tools      I wanted to install it in `/usr/local` so I moved the download there via gui. The next part is:               export PATH="$PATH":`pwd`/depot_tools      So I went into `.bash_login` and changed this:               export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"      to this:               export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH:/usr/local/depot_tools"      Terminal wont recognize any of the commands `gclient, gcl, git-cl, repo`. What am I doing wrong?


How can I print the longest number in a string?

I am looking for a method to print the longest number in a string. E.g.: If I have the string               212334123434test233      how can I print               212334123434      ? Note: I am looking for the longest continuous sequence of numbers, not for the numerically higher value. * * * **Edit:** Thanks for the answers, everyone. The response to this question has been quite overwhelming. I marked @HaukeLaging's post as the accepted answer because it suited my specific case very well but I'd like to point out that all answers are equally valid. It's always great to have several different options to solve a problem.


What is the proper way to automate SSH/local command?

I have gitolite on a Centos 5.5 box - when a repository is updated, I need to send a command to my bug tracking appliance to get the new commands. Right now, I have the following command working: `ssh bugserver -f 'cd /etc/repos/gitrepo && git pull origin prod && exit'` This seems a little dirty, though. Is there a better way to execute this sync?


Does fork() immediately copy the entire process heap in Linux?

A `fork()` system call clones a child process from the running process. The two processes are identical except for their PID. Naturally, if the processes are just reading from their heaps rather than writing to it, copying the heap would be a huge waste of memory. Is the entire process heap copied? Is it optimized in a way that only writing triggers a heap copy?


Is there an easy way to list the number of unique values in a column in LibreOffice calc?

In LibreOffice calc I have a column with thousands of values. Is there an easy way to list the number of UNIQUE values? e.g. a column which had               red     red     red     green     green     blue     blue     blue      would return 3 because there are three unique entries. Thanks


Login to Skype from terminal or any other way

Please let me know if anybody knows how to login to Skype on Linux Mint from terminal or any other way? I have tried a lot but nothing found.               Desktop # ./skype.desktop     ./skype.desktop: line 1: [Desktop: command not found     ./skype.desktop: line 3: Internet: command not found     ./skype.desktop: line 4: fg: no job control     ./skype.desktop: line 9: Application: command not found     ./skype.desktop: line 11: X-KDE-Protocols=skype: command not found


traceroute gives only stars + how to fix

Please advise about the following problem. When I do:                 $ traceroute 8.8.8.8      I get in the output showing only stars, even though pinging to google.com ( 8.8.8.8) appears to be working.   1. Please advise what I need to fix in my files/conf in order to solve this issue?   2. what I need to check?  ### Ping command output                   $ ping 8.8.8.8         PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.         64 bytes from 8.8.8.8: icmp_seq=1 ttl=46 time=73.4 ms         64 bytes from 8.8.8.8: icmp_seq=2 ttl=46 time=69.6 ms      ### traceroute command output                $ traceroute 8.8.8.8      traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets      1  * * *      2  * * *      3  * * *      4  * * *      5  * * *      6  * * *      7  * * *      8  * * *      9  * * *      10  * * *      11  * * *      12  * * *      13  * * *       14  * * *      15  * * *      16  * * *      17  * * *      18  * * *      19  * * *      20  * * *      21  * * *      22  * * *      23  * * *      24  * * *      25  * * *      26  * * *      27  * * *      28  * * *      29  * * *      30  * * *


Remap Up and Down arrows to gj-gk in vim input mode without using <c-o>?

I have mapped my arrows keys to move in a visual-line mode, leaving the `hjkl` keys for normal, logic line movement:               " Visual movement with the arrows and End-Home      nnoremap <Down> gj     nnoremap <Up> gk     vnoremap <Down> gj     vnoremap <Up> gk     inoremap <Down> <C-o>gj     inoremap <Up> <C-o>gk     inoremap <Home> <C-o>g<Home>     inoremap <End>  <C-o>g<End>      This works, but for a minor problem. I have a bit of code in my status line to change color between input mode and normal mode, like this:               if version >= 700       highlight statusLine cterm=bold ctermfg=black ctermbg=red       au InsertLeave * highlight StatusLine cterm=bold ctermfg=black ctermbg=red gui=bold guifg=black guibg=red       au InsertEnter * highlight StatusLine cterm=bold ctermfg=black ctermbg=green   gui=bold guifg=black guibg=green     endif      ...and I noticed now (on a machine slower than the one I have at home) that every time I press one of the arrows, the temporary mode switch of `<ctrl>o` (at least, I think) make the status line flash rapidly red then green again. It is possible to redefine the keys to avoid the temporary jump to normal mode?


What are appropriate execution permissions for ~/bin?

I am putting some scripts in ~/bin and am wondering what appropriate file permissions are. To extend my question somewhat, what permissions make sense for */bin folders all over my system, and why?


How does init determine which devices to modprobe?

I'm building a totally custom initramfs for a netbooting project and in the process learning a lot about it, but I'm a little puzzled by the loading of modules. I know `modprobe` can be used to load modules, but how does it decide which modules to load? What I have right now is the initramfs booting up and running a shell in virtual box. But `lsmod` shows no modules loaded. What I need `init` to do is load the right modules for the networking so that I can get the networking up. If I `modprobe e1000` I actually get the correct module loaded. In looking through the Ubuntu boot process I can't see how Ubuntu decides it should load up `e1000`. I would've thought it'd just `modprobe` every available network card driver, but it doesn't appear to be doing that. I'm guessing that UDEV has something to do with it?


How can I use one network port for VPN and the other for everything else?

My Linux machine has two network ports with two IP addresses. I want to use one port for my VPN and accounting, and the other port for other usages. How can I tell Linux not to allow any requests from port 2 for Apache, MySQL, mailserver, ssh, etc. so it will use the VPN port, and likewise not allow port 1 to handle VPN traffic but allow everything else?


On Debian in fluxbox, GtkPod has no write permission, but does in GNOME

In fluxbox I manually mount my iPod, then run GtkPod as a normal user, unfortunately this doesn't give me write permissions as a normal user. (I can paste the error message in later when I am home if needs be, but it's a generic "Unable to write to /drive, permission denied") In GNOME however the iPod is automatically mounted and the normal user has write permissions. Please can someone explain how GNOME is mounting it so that write permission is enabled for normal user?


Can't access mail server through SMTP

I'm trying to send email from a server. Testing on my local machine works fine but on my production Ubuntu server, the webserver fails when trying to send email. I'm using GMail as my SMTP provider and it appears that the problem is that the production server does not allow access to the Google SMTP server. The following command established a successful connection on my own machine but fails on the server:               $ openssl s_client -crlf -connect smtp.gmail.com:465     connect: Connection refused     connect:errno=111      I've tried various combinations of `iptables` in case the ports where closed. I've also tried disabling the firewall with `ufw disable`. Neither has yielded any success for me. Update: `telnet smtp.gmail.com 465` outputs:               Trying 74.125.143.108...     Trying 74.125.143.109...     Trying 2a00:1450:4010:c04::6c...     telnet: Unable to connect to remote host: Network is unreachable      `openssl s_client -starttls smtp -crlf -connect smtp.gmail.com:465` gives me:               connect: Connection refused     connect:errno=111      Furthermore `iptables-save` outputs:               # Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014     *mangle     :PREROUTING ACCEPT [16698:11267219]     :INPUT ACCEPT [16698:11267219]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [13015:16282858]     :POSTROUTING ACCEPT [13015:16282858]     COMMIT     # Completed on Thu Aug 21 13:06:19 2014     # Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014     *nat     :PREROUTING ACCEPT [1421:163021]     :INPUT ACCEPT [678:92411]     :OUTPUT ACCEPT [1339:83461]     :POSTROUTING ACCEPT [1339:83461]     COMMIT     # Completed on Thu Aug 21 13:06:19 2014     # Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014     *filter     :INPUT ACCEPT [9933:3116585]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [12536:16243622]     -A INPUT -i lo -j ACCEPT     COMMIT     # Completed on Thu Aug 21 13:06:19 2014


How to see free disk space on SunOS?

It really makes me mad. SunOS 5.9               #format      Searching for disks...done     No disks found!     # mount     / on /dev/md/dsk/d0...(skip)     /var on /dev/md/dsk/d4 ...     /opt on /dev/md/dsk/d5 ...     /home on /dev/md/dsk/d9 ...     /usr/local on /dev/md/dsk/d10 ...     # fdisk -G /dev/md/dsk/d0     fdisk: /dev/md/dsk/d0 must be a raw device.     # fdisk -G /dev/md/dsk     fdisk: /dev/md/dsk must be a raw device.     # fdisk -G  /dev/rdsk/c0t0d0s0      fdisk: Cannot open device /dev/rdsk/c0t0d0s0.     # ls /dev/rdsk     c0t0d0s0   c0t0d0s6  ...(72 items total)     # ls /dev/md/     admin   dsk     rdsk    shared     # ls /dev/md/dsk     d0......d127      prtvtoc works, but I can see total space only and have to use calculator to get Mb/Gb :(               # prtvtoc /dev/md/dsk/d10     * /dev/md/dsk/d10 partition map     *     * Dimensions:     *     512 bytes/sector     *     424 sectors/track     *      24 tracks/cylinder     *   10176 sectors/cylinder     *   14087 cylinders     *   14087 accessible cylinders     *     * Flags:     *   1: unmountable     *  10: read-only     *     *                          First     Sector    Last     * Partition  Tag  Flags    Sector     Count    Sector  Mount Directory            0      0    00          0 143349312 143349311     # prtvtoc -f /dev/md/dsk/d0     FREE_START=0 FREE_SIZE=0 FREE_COUNT=0 FREE_PART=      Regardless FREE_SIZE=0 system is up and running quite well. moreover:               # df     df: cannot execute     # bdf     bdf: not found     # pkgadd     pkgadd: not found      Please help. P.S. this server is really in bad condition:               # ls /     (here some folders, including usr)     # ls /usr     (here some folders again, including apache)     #ls /usr/apache     /usr/apache: I/O error      Thanks @Nikhil and @MaxMackie. I think the trouble is out of this question.


Lose network connectivity when bringing up second NIC

I currently have a CentOS 6.5 box with 4 NICs. `eth0`, `eth2` and `eth3` all come up fine, however when I bring `eth1` up with an IP address, even on it's own, it causes complete network loss. If I remove the IP and bring `eth1` up with the other NICs it works fine. Then adding an IP and restarting network services causes the network to lose connection again and requires a console connection to bring the interface down. Is there anything that can be causing this on this particular NIC? Configs for each NIC as below: eth0               DEVICE=eth0     TYPE=Ethernet     ONBOOT=yes     NM_CONTROLLED=no     BOOTPROTO=none     HWADDR=3C:4A:92:11:11:11     IPADDR=192.168.228.225     PREFIX=24     GATEWAY=192.168.228.254     DNS1=192.168.224.201     IPV4_FAILURE_FATAL=yes     IPV6INIT=no     IPV6_AUTOCONF=no     NAME="Management"      eth1               DEVICE=eth1     TYPE=Ethernet     ONBOOT=no     NM_CONTROLLED=no     BOOTPROTO=none     HWADDR=3C:4A:92:00:00:00     IPADDR=192.168.223.225     PREFIX=24     GATEWAY=192.168.223.254     DNS1=192.168.223.201     IPV4_FAILURE_FATAL=yes     IPV6INIT=no     IPV6_AUTOCONF=no     NAME="Production"      eth2               DEVICE=eth2     TYPE=Ethernet     ONBOOT=yes     NM_CONTROLLED=no     BOOTPROTO=none     HWADDR=00:13:3B:00:00:00     NAME="Mirror Port Switch 1"      eth3               DEVICE=eth3     TYPE=Ethernet     ONBOOT=yes     NM_CONTROLLED=no     BOOTPROTO=none     HWADDR=00:13:3B:11:11:11     NAME="Mirror Port Switch 2"


Passing arguments from one command into the next

I'm trying to write a script to unify two separate commands I run by hand into a single bash script I can then cron. The first command is a simple find on files with a certain name and size               find /some/path -type f -name file.pl -size +10M      This will produce several matching files and their full path. I then copy these paths by hand into a for loop as arguments to the next script.               for path in /some/path/1/file.pl /some/path/2/file.pl /some/path/3/file.pl ; do perl /my/script.pl $path ; done      Seems like it should be easy to get this into a single shell script but finding it a struggle.