Printing evaluated prompt placeholders to screen

Is there a way to print interpreted PS1 variable placeholders to console? Something like               $ echo `%u`      for printing a username or               $ echo `%h`      for printing a host. I do know about environment variables I just want to know if there is a way to get same information through `PS1` variable.


How to check if a filesystem is mounted with a script

I am new at scripting ... I can do very basic stuff, but now I need a hand. I have a local filesystem that only will be mounted when I need to do a backup. I'm starting with this.               #!/bin/bash     export MOUNT=/myfilesystem          if grep -qs $MOUNT /proc/mounts; then       echo "It's mounted."     else       echo "It's not mounted."; then       mount $MOUNT;     fi      As I said, I'm very basic at scripting. I heard that you can check the status of the `mount` command by looking at the return codes.               RETURN CODES            mount has the following return codes (the bits can be ORed):            0      success            1      incorrect invocation or permissions            2      system error (out of memory, cannot fork, no more loop devices)            4      internal mount bug            8      user interrupt            16     problems writing or locking /etc/mtab            32     mount failure            64     some mount succeeded      I don't know how to check that. Any guidance?


Software for very simple editing of advanced .psd files

I need a Linux application for very simple editing of advanced `.psd` files in Linux. Turning on and off layers would be enough. Unfortunately, GIMP has way too many problems with it. It is unable to display image with few more advanced layers correctly. It renders little different picture. Is there any other solutions other than Photoshop in Wine? P.S.   I'm fine with GIMP interface and I don't know Photoshop. However it looks I have to work with `.psd` files.


Sending commands to dbx from Vim

Using this information, I've been able to debug code using `dbx` and display the code from within Vim. What would be really cool is if I could send commands (step, next, print, stop in ... etc) to `dbx` from within Vim. I am relatively new to Unix so do not know of any way to do this. Does anyone know how to send commands to `dbx` in this way? For example, sending commands to `dbx` from a separate process, or running `dbx` as a server?


USB Keyboard does not work with Grub

I am setting up Arcade Puppy http://scottjarvis.com/page105.htm on an old Dell GX50 PC. Instead of using a PS2 style keyboard which I don't have I opted for a low profile generic USB keyboard. The problem is that once installed to the hard disk the GRUB boot menu does not recognize the USB Keyboard so I cannot choose the boot option to start Linux, also there isn't the normal default timeout setup. The USB keyboard works the BIOS settings fine and worked okay when booting off the live CD to install Linux. Has anyone got any suggestions or will I be forced to find a PS2 keyboard?


Update yum offline

I've been looking around for a way to update an offline fedora box but haven't found anything. I only have a Windows computer connected to the Internet. I noticed that my yum config is pointed to http://download.fedoraproject.org/pub/fedora/linux/updates/14/i386. Is there a way I can download a list of packages and then those packages manually but still use yum? I've seen ways to do this with a second linux box that has Internet access, but I don't have that.


Which Red Hat Enterprise Linux packages for CentOS?

I want to use a Red Hat Enterprise Linux RPM software package on CentOS 5.6, but I don't know which version of RHEL works with CentOS 5.6. RHEL 4 = CentOS 4? RHEL 5 = CentOS 5? ...


ntfs external HD works read-only on Arch

I only have read-only access to my external hard-drive which is using NTFS filesystem. How do I fix this problem to get full access to my hard drive?


Piping tcpdump traffic via SSH - but no root ssh access

**The situation** I would like to use Wireshark to analyze traffic on one of our servers, but I don't want to install Wireshark on the server itself. I understand that I can pipe tcpdump traffic via SSH to my local machine (Ubuntu) which has Wireshark installed. **The problem** I cannot login to the server with a root account because that is disabled. I have sudo rights, but when logged in to the server the command `sudo tcpdump` does not work. The command below (with or without sudo) won't work:               $ ssh john@server-abc.com "sudo tcpdump -s 0 -U -n -w - -i eth0 not port 22" > /tmp/remote      **The question** Is there a way to get this working? If so - how?


Directory "diff"?

I have two directories which are different versions of the same software package. I'd like to list all the files/directories that have changed between the two then copy those differences to a new directory. I've been trying different scripts with `md5sum` and `diff -Nurq` but haven't been able to get the result I'm looking for. Any recommendations?


Detecting pattern at the end of a line with grep

If I do:               $ ls -R     .:     4Shared/  Cloud/          ./4Shared:     UFAIZLV2R7.part3.rar          ./Cloud:     UFAIZLV2R7.part2.rar.part     UFAIZLV2R7.part1.rar.part     UFAIZLV2R7.part4.rar.part      If I want to list the `.rar` files only, and I use **grep** , it will show me too the `.rar.part` files, what is not my wish.   I am solving this using `find` or `ls **/*.rar` as told in this thread and they work fine, but I would like to learn if it is possible to do it via `grep`. I have tried (thinking about `EOL`):               ls -R | grep ".rar\n"      with no results.   I think that the problem lies in discover if the greping is found **at the end of the line** , but I am not sure. Any help out here, please?


Limit on the number of btrfs snapshots?

I am considering using btrfs on my data drive so that I can use snapper, or something like snapper, to take time based snapshots. I believe this will let me browse old versions of my data. This would be in addition to my current off site backup since a drive failure would wipe out the data and the snapshots. Is there a limit to the number of snapshots I can take and store? From my understanding snapshots do not take up much space (meta data and the blocks that have changed, plus maybe some overhead), so space doesn't seem to be a constraint. If I have a million snapshots (e.g., a snapshot every minute for two years) would that cause havoc, assuming I have enough disk space for the data, the changed data, and the meta data? If there is a practical limit on the number of snapshots, does it depend on the number of files and/or size of files?


How does dispatcher work?

This is a general Operating Systems theory question but since I am learning OS theory through UNIX-like systems I wanted to ask it here. Today, after my OS lecture , I asked to our instructor that: 'Dispatcher is a thread , which is inside Process Manager process. Since PM is also a process, while a process called A is in the running state, how does PM take over the processor from it? Dispatcher is supposed to take processor away from processes and allocate it to another process. But while Process Manager is not running, how is that supposed to happen?' He said: 'Process Manager is "always" in the running state in CPU0'. I said: 'If there is only one CPU with one core, how does PM always in running state?" He said it is. Any one can light me out of that dilemma?


Equivalent of "truss -T" and "truss -U" on Linux?

Is there an equivalent of what the `-T` and `-U` option of the `truss` Solaris utility does on Linux. Those are to specify a system call (`-T`) or library function (`-U`) which when called by the traced application would cause it to stop. Or, said otherwise, I'd want any process started by a traced application to be stopped (as if killed by SIGSTOP) as soon as it makes a given system call or a given shared library function call. `strace` and `ltrace` on Linux provide with much of the featureset of Solaris `truss`, but they don't seem to be doing that. For instance:               truss -f -T open cmd      Would be like `strace -f cmd` except that if the process executing `cmd` or any of its descendants does any `open` system call, it would be stopped immediately (and I can resume it later on at my convenience) In some cases, I could use `gdb`'s `catch syscall`, but I was looking for a solution that can conveniently follow forks and continue doing it for all the forked processes and keep on doing it even after `execve`s. I seem to recall some utility giving the same functionality, even one (or options to that same utility) to single-step applications between some occurrences of some syscall remotely like that, but my memory is failing me, I can't even be sure that was on Linux.


Executing commands with ssh and shell script using variables on a remote machine

I'd like to execute a command and script located on a remote machine with a script on a local machine. I know it's possible to execute these kind of commands with `ssh`, so I made:               #!/bin/bash     ssh username@target 'cd locationOf/theScript/; ./myScript.sh'      It works perfectly. I'd like this script to be more generic, using variables. Now, it is:               #!/bin/bash     LOCATION=locationOf/theScript/     EXEC=myScript.sh     ssh username@target 'cd ${LOCATION}; ./${EXEC}'      And I get this error: `bash: ./: is a directory` I guess the remote machine doesn't know these variables. So is there a way to _export_ them to the target ?


Could ">" be included in a bash Variable?

**Current approach** :               sudo awk 'BEGIN{printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<hello>\n\t<world>\n";} {print "\t\t",$0}END{printf "\t </world>\n</hello>\n"}' hello > hello2      **Preferred approach does not work** : `hello > hello2` would like to be defined as a variable to avoid code duplication               $CURRENT_TO_OUT=hello > hello2          echo "CP1" $CURRENT_TO_OUT          sudo awk 'BEGIN{printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<hello>\n\t<world>\n";} {print "\t\t",$0}END{printf "\t </world>\n</hello>\n"}' $CURRENT_TO_OUT      **Output $CURRENT_TO_OUT:** `CP1 hello`


High memory (user space) and highmem (kernel space)

Each process has 2 memory area: User space (high memory) and kernel space (low memmory). In the kernel space, are the first 896 MB used for mapping kernel code (not fully 1 GB)? This means, when a user -space application performs a system call or anything related to the kernel, the kernel will refer to kernel space for the system call to execute, is it? The reserved 128MB in kernel space (for high memory (user space) access), is it all the references of user-space memory area? So, a kernel process can access any user space by refer to this area, is this true? That's why this area is called highmem in kernel space, isn't it?


Official tools to save/restore gnome settings

Is there an official tool that can save and restore gnome-specific settings ? I know several applications uses ~/.config, I don't care about them, just settings for gnome, e.g panel applets, keyboard shortcuts, and other application uses gconf. P.S: it's best for both gnome2/3


Ubuntu One in Fedora

I have an Ubuntu One account and want to be able to sync it to a folder in Fedora. Is this possible and what is the best way to do it?


su - user doesn't work for users without a password

I've created a user on CentOS with `useradd -M username`. Now, I want to become that user just like `su - username`. It asks me for a password for that user but I didn't set a password for that user. As a workaround, I have to become root then `su - username` works obviously. First, I thought it asks for a root password but it is not the case. Any ideas?


Best way to view scripted session logs

I have aliases set up for SSH and minicom to call simple wrapper scripts which just ensure that I get a log of the session. The logs are stored in a specified directory, and named with a tag and a time-stamp so that I can find them again later. For SSH the wrapper uses "script" to perform the session recording. For minicom the wrapper enabled the built-in session logging feature. This works well for capturing simple output. However terminal control codes, can cause havoc with the legibility of the logs. In particular if I enter into vi, run "top", start "screen" use less to page up and down or even when "editing" the command line control characters end up in the captured log. "top" and "screen" contend for being the worst culprits in making these captured logs hard to read. I've discovered that "more" is much better than "less" at viewing log files. More actually replays most of the control codes with a degree of success, resulting in something on screen which represents what was on screen originally. Additionally "strings" (piped to more or less) or even more piped to less (less is more), can help to restore some sense to the log. grep can find a command ... if it was entered correctly and not been edited. I'm looking for suggestions for viewing the logs, how to get rid of embedded control characters, and re-construct the terminal output as it was at the time it was captured as far as possible. GUI or CLI tools are both acceptable though I have a slight preference to using CLI tools. I've been dabbling with the idea of writing a pre-processor script which will cut out "top". I also unfortunately quite often use screen to multiplex the sessions and save long running commands from being interrupted by a lost connection, so maybe I can find a way to recognize and strip out screen specific codes too.


Add new network interface to the kvm (Slackware is installed)

Installed slackware11 on KVM, which is controlled by virt-manager. I need one more network interface, so I added another one using the same model as was installed by default, and restarted the machine. But the `ifconfig` command just shows the `lo` and `eth0`. Should I do any job on Linux after adding interfaces to KVM?


How can I extract the hash value of a LUKS device?

For LUKS devices I know that hashes are stored somehow in the partition header (I don't really know what this means). But I don't know how to print the hash value in this case. For example in a standard unix system the user password hashes are stored in `/etc/shadow`. If I want to see a hash of a password I can just open this file and see it. So, how can I extract the hash value of a LUKS device?


Spamassassin blacklist_to testing

I have some rules in my local.cfg file with some addresses defined as `blacklist_to`. However, I keep getting spam for these addresses -- or rather any email whatsoever. How can I test spamassassin to see why it keeps accepting said emails?


Can't share an ssh connection with rsync

In my `.ssh/config` file I have the following:               Host xxx     User yyy     HostName zzzz     ControlMaster auto     ControlPath ~/.ssh/%r@%h:%p       This works great for multiplexing my ssh connections (i.e. login once, and share the connection with multiple sessions). I would like to multiplex (share) my ssh connection with **rsync** , so that I can do things like               rsync -arv -e ssh xxx:/source target      and not have to login through **rsync** (I have two-factor authentication system with XXX and it would be great if I can just skip that when I use rsync). **Update:** I learn that by default rsync would try to re-use the connection first. So I am not sure why it isn't working. Here is the verbose output of my attempt:               > rsync -arv -e 'ssh -v' XXX:~/file ~/temp/.     OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008     debug1: Reading configuration data /home/YYYY/.ssh/config     debug1: Applying options for XXX     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: Applying options for *     debug1: auto-mux: Trying existing master     Control socket connect(/home/YYY/.ssh/XXX@ZZZZ:22): Connection refused


How can I track virtual Disk device to physical slot?

I'm kind of new working with Unix (Ubuntu). I managed to install Ubuntu on RAID1 and mounted 3 RAID 0 drives. I have a 9271-8i storage controller:               RAID1 (sda) - Unix installed     RAID0 (sdb)     RAID0 (sdc)     RAID0 (sdd)      I'm trying to track virtual drives (sdb, sdc, sdd) to the actual physical slot. If I see sdb is bad, I need to know which drive it is exactly on the server (I only have chance to do with the Device Id/Slot Id). How to get the physical drive/Slot ID? Any guidance on this would be appreciated.


Switch off syslog on laptop?

Is there any point in keeping logs on my laptop? This is not a server to debug problems via syslog. I occassionally want to look at dmesg | tail but that does not mean I need anything on disk. Wastes space and also the SSD has a limited number of write cycles.


copy (to X clipboard) shortcut in .tmux.conf

In order to copy text to X clipboard in tmux, what I currently do is:   * go selection mode with `prefix``[`   * start selection with `space` (using `mode-keys vi` btw)   * select the text and press `enter`   * copy tmux buffer to X clipboard using `prefix``ctrl+c` (I have a mapping as `bind C-c run "tmux show-buffer | xclip -selection clipboard -i"` I'm trying to eliminate some of these steps by making a mapping for selection mode. I have tried:               bind-key -t vi-copy C-c run "tmux show-buffer | xclip -selection clipboard -i"      which gives me and error:               .. usage: bind-key [-cnr] [-t key-table] key command [arguments]      (I couldn't copy the error lol) how can I fix this? **EDIT:** I have realized I can select and copy to tmux buffer (first 3 steps) using mouse just like a regular selection (although highlighting doesn't last, it still selects the text) and then use the following bind to copy to x clipboard:               bind-key -n C-c run "tmux show-buffer | xclip -selection clipboard -i"      (I used this method to copy this text and it was easy ;) note that `-n` denotes "no prefix" therefore no escaping is needed. if you don't get confused by the vanishing highlight this is analogous to regular (common user interface) copying. this is the best I have come up with so far.. **EDIT2:** turned out `ctrl+c` overlaps with process interrupt thing so I changed to `ctrl+alt+c` for now. (didn't quite like it) **EDIT3:** tmux 1.8 or so added support to add keybindings in copy mode so now my first original intention is possible using something like:               bind-key -tvi-copy y copy-pipe "xclip -selection clipboard -i"     bind-key -tvi-copy enter copy-pipe "xclip -selection clipboard -i"      These two bindings make it possible to copy text to clipboard when I used `enter` or `y` to finish copying. I still keep this line in case I do the copying with mouse and decide to get the tmux buffer content to clipboard later on:               bind-key y run "tmux show-buffer | xclip -selection clipboard -i"


GSM modem does not create /dev/ttyUSB file

I installed Kannel in a server, and I want to use a GSM 3G USB modem to send/receive SMS messages, as described in section _SMS Centers > GSM Modem_ of the Kannel User Guide. I have already installed, configured and tested Kannel on my notebook successfully. When I plug the modem into my notebook, a device named `/dev/ttyUSB0` appears. It acts as a serial port to send commands to the modem. I have to put this device in the Kannel configuration file. After some testing, I decided to install Kannel in the production server. The server runs **Linux-VServer** , and my task is to install Kannel on the _host_ and PlaySMS in one of the _guests_ , which runs Apache. The problem is that I can't find any device analogous to the `ttyUSB0` that is created in my machine (and AFAIK, in all normal Linux boxes). Here are some diagnostic commands. The modems used are not the same model, but I have already tested Sierra 308 on my notebook and it works, too. ## My notebook - Arch Linux uname -a:               Linux twoflower 3.4.9-1-ARCH #1 SMP PREEMPT Wed Aug 15 18:11:01 UTC 2012 i686 GNU/Linux      dmesg when I plug the modem in (Huawei 156B):               [35328.849886] usb 1-2: new high-speed USB device number 12 using ehci_hcd     [35329.007281] scsi9 : usb-storage 1-2:1.2     [35329.010054] scsi10 : usb-storage 1-2:1.3     [35329.301153] usbcore: registered new interface driver usbserial     [35329.302155] usbcore: registered new interface driver usbserial_generic     [35329.303064] USB Serial support registered for generic     [35329.303221] usbserial: USB Serial Driver core     [35329.368043] usbcore: registered new interface driver option     [35329.368960] USB Serial support registered for GSM modem (1-port)     [35329.369332] option 1-2:1.0: GSM modem (1-port) converter detected     [35329.377484] usb 1-2: GSM modem (1-port) converter now attached to ttyUSB0     [35329.377567] option 1-2:1.1: GSM modem (1-port) converter detected     [35329.378930] usb 1-2: GSM modem (1-port) converter now attached to ttyUSB1     [35330.013635] scsi 9:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31     PQ: 0 ANSI: 2     [35330.019275] scsi 10:0:0:0: Direct-Access     HUAWEI   MMC Storage      2.31     PQ: 0 ANSI: 2     [35330.028997] sd 10:0:0:0: [sdb] Attached SCSI removable disk     [35330.214473] sr0: scsi-1 drive     [35330.214484] cdrom: Uniform CD-ROM driver Revision: 3.20     [35330.216603] sr 9:0:0:0: Attached scsi CD-ROM sr0      ## Server - Debian Lenny uname -a:               Linux macunaima 2.6.26-1-vserver-amd64 #1 SMP Fri Mar 13 20:19:13 UTC 2009 x86_64 GNU/Linux      dmesg when I plug the modem in (Sierra 308):                 [    3.246112] usb 8-4: new high speed USB device using ehci_hcd and address 2       [    3.381966] usb 8-4: config 1 has an invalid interface number: 9 but       max is 5       [    3.382076] usb 8-4: config 1 has an invalid interface number: 7 but       max is 5       [    3.382184] usb 8-4: config 1 has no interface number 2       [    3.382285] usb 8-4: config 1 has no interface number 5       [    3.384576] usb 8-4: configuration #1 chosen from 1 choice       [    3.389070] usb 8-4: New USB device found, idVendor=0f3d,       idProduct=68a3       [    3.389070] usb 8-4: New USB device strings: Mfr=3, Product=2,       SerialNumber=4       [    3.389070] usb 8-4: Product: USB 308       [    3.389070] usb 8-4: Manufacturer: Sierra Wireless, Incorporated       [    3.389070] usb 8-4: SerialNumber: 353354045586405      lsusb:               Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 008 Device 002: ID 0f3d:68a3 Airprime, Incorporated     Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub      ## Previous questions The only previous question with a similar problem that I found here was How do I access a USB serial port without an entry in /dev?. In his case, `dmesg` said that `ttyUSB0` was created, which does not occur in my case. Anyway, I have tried the solution posted there, using `mknod` to create devices manually:               for i in 0 1 2 3 4 5 6 7 8 9; do         sudo mknod /dev/ttyUSB$i c 188 $i     done      I created all these devices because `lsusb` says that the device is plugged in `Bus 008 Device 002`. It did not work. I tested it with `picocom`, and this it says (to all these devices, not only `ttyUSB0`):               $ picocom -     FATAL: cannot open /dev/ttyUSB0: No such device or address      While in my notebook, picocom works fine:               $ picocom -b 9600 /dev/ttyUSB0     Terminal ready     AT                      # my input     OK


Log file visualizer in a Terminal (UNIX) (terminal logging replay)

I need to log in to various servers via ssh, and its a useful thing to log the terminal (even things in smitty menus/AIX and with correct/exact date/time). I already have a solution for this:               0)     # with root:     apt-get install bsdutils          # with the given user:     mkdir ~/logs          1)     # append this to you're "~/.bashrc" - this must be the last line!!     STARTTIME=`date +%F-%Hh-%Mm-%Ss-%N`; script -q -t 2> /home/USERNAMEHERE/logs/$STARTTIME-timing.txt -c 'bash --rcfile /home/USERNAMEHERE/.bashrc-cp' -f /home/USERNAMEHERE/logs/$STARTTIME-log.txt; exit 0          2)     # make sure the 1) is the last line of bashrc, then [this is needed to avoid "fork bomb"..]:     sed -e '$d' /home/USERNAMEHERE/.bashrc > /home/USERNAMEHERE/.bashrc-cp      **And this works GREAT!** Now, the question is: how to replay these terminal loggings? This is the default way to do this:               REPLAY:     # rename the filenames to you're needs! - you can only play 1 file at one time..     scriptreplay "/home/USERNAMEHERE/logs/$STARTTIME-timing.txt" "/home/USERNAMEHERE/logs/$STARTTIME-log.txt"      Ok. It works. But it's not enough..: you can only start playing the recording. But what if you need the recording only from given time, or you need to know when exactly was a command excuted (you can see this in the terminal logfiles+timing files that "script" generates). Or better: you need terminal logging for educational purposes (so you need to stop the replay of the recording to write something down from it, etc.). For these replay problems, I still haven't found and good programs. So I though I should write my own program about this (but I have only bash scripting experience). I thought the best would be for this task is using ncurses (the replay solution needs to be used on several different OSes, like: OpenBSD, Ubuntu, Redhat). - the terminal logging could be an "auditing tool" to trace what the users done via SSH. So I'm thinking about this (this is a terminal window, ex.: gnome-terminal): http://i.imgur.com/cyeqf.png **Q** : What does unix.stackexchange think? Could this replay solution done with **ncurses** (or are there better->more portable/easy for a non programmer?)? Can you provide some hints/URL's how to do this? (can ncurses do this?) p.s.: a sample for the terminal logging files (I opened a terminal, typed "echo hi", then closed the terminal):               [USER@HOST ~/logs] cat -vte 2012-09-14-12h-46m-27s-509330863-log.txt      Script started on Fri 14 Sep 2012 12:46:27 PM CEST$     ^[[0;32m[USER@HOST ~]^[[m echo hi^M$     hi^M$     ^[[0;32m[USER@HOST ~]^[[m [USER@HOST ~/logs]      [USER@HOST ~/logs]      [USER@HOST ~/logs] cat -vte 2012-09-14-12h-46m-27s-509330863-timing.txt      0.512822 29$     0.179438 1$     0.925494 1$     0.254477 1$     0.065499 1$     0.075037 1$     0.139497 1$     0.136499 1$     0.039944 35$     [USER@HOST ~/logs]       UPDATE: I set a bounty on this question. :) (or are there any better logging solutions that can be replayed well? - ty!)


How to fix this eth0 and eth1, where traffic going out via eth0 is failing?

I have two public IPs. One's connected to eth0 and one to eth1, from 2 separate routers as complete DMZ towards the LAN IP. I added this following:               ip rule add from 10.0.0.108/32 table 1 # outbound     ip rule add to 10.0.0.108/32 table 1   # inbound     ip route add default via 10.0.0.1 dev eth0 table 1     ip rule add from 10.0.0.100/32 table 2 # outbound     ip rule add to 10.0.0.100/32 table 2   # inbound     ip route add default via 10.0.0.1 dev eth1 table 2      Since adding this above, I've been having problems sending traffic correctly for inbound and outbound. For example:               $ ping -I eth0 8.8.8.8     PING 8.8.8.8 (8.8.8.8) from 10.0.0.108 eth0: 56(84) bytes of data.     From 10.0.0.108 icmp_seq=2 Destination Host Unreachable     From 10.0.0.108 icmp_seq=3 Destination Host Unreachable     From 10.0.0.108 icmp_seq=4 Destination Host Unreachable          $ ping -I eth1 8.8.8.8     PING 8.8.8.8 (8.8.8.8) from 10.0.0.28 eth1: 56(84) bytes of data.     64 bytes from 8.8.8.8: icmp_seq=1 ttl=48 time=14.6 ms     64 bytes from 8.8.8.8: icmp_seq=2 ttl=48 time=14.6 ms     ^C     --- 8.8.8.8 ping statistics ---     2 packets transmitted, 2 received, 0% packet loss, time 1233ms     rtt min/avg/max/mdev = 14.611/14.639/14.667/0.028 ms      How do I use `ip rule add from/to` method to fix the eth0 (from/to), but without breaking the eth1 (eth1 is working perfect).


Multiple Sessions and 1 is slow

Setup is a Centos 6 x64 server and a Windows 7 client running putty. Multiple sessions are opened to this same server from the same client. Periodically, one of these sessions slows to a crawl and the other remains quite quick. If a new session is established, it sets up quite quickly and works well. Have checked server NICs, iostats and top and see no apparent issues. The problem appears to show up most often when large files are being listed on the screen or a large cut and paste operation is in progress. ie 'cat messages' The server has a "twin" setup at the same time with exact same hw/sw config and sessions to that server never exhibit the same issue. I was able to ssh into another server and then ssh over to the affected server while I had a putty session open that was experiencing a problem. I did a tcpdump from there and there is virtually nothing being sent to the putty client. The only traffic I see is when it is updating. Today the issue showed up during a yum install. This is what my putty session looks like:               Installing : ncurses-devel-5.7-3.20090208.el6.x86_64 [#####     Installing : ncurses-devel-5.7-3.20090208.el6.x86_64 [#######     Installing : ncurses-devel-5.7-3.20090208.el6.x86_64 [########     Installing : ncurses-devel-5.7-3.20090208.el6.x86_64 [##########     Installing : ncurses-devel-5.7-3.20090208.el6.x86_64 [############      This is what was captured in about a 10 minute period when this slows down. TCPdump showed no errors at all and very little traffic to the putty client. I just left it run and 30 minutes later, yum is done installing and the session has returned to normal. The issue in this case just showed up during a yum install, yesterday is was catting the maillog and the day before editing a file in vi. I am suspecting that this might be a hw issue on the box itself but I can't seem to put my finger on anything specific.


How can I change the terminal tmux info (lower right) called status-right to username or host?

I have 7 dashes (`\-------`) on the lower right.   Can I replace them with something like my name or my host name? This is not about the PS1 prompt. I already have time name host dir there.   I use tmux.   I am on Ubuntu13 but I'd like it to work in iterm2 on OSX if possible. In `.tmux.conf` I have it as               set -g status-right "-------"      How can I make it be user or host? I tried \u but that didn't work. Example: ![enter image description here](http://i.stack.imgur.com/E6oxq.png)**< --- here**


{exec} cause Conky to stop

I wanted to add mpd informations to my conky and therefore I created a script which role is to get the cover from ID3 tags This script is called using the {exec 'path'} command My probleme is that since I added this feature, my conky refuses to stand on his own : If I launch it from a terminal using               conky -c `path.conkyrc` &      it will stop when closing the terminal. I tried using the -d option as well I also tried to launch it at startup with a sh script run at startup : It works well at first but if I open a terminal, conky will close with the terminal i openned ... strange removing the call to {exec 'path'} solves everything so it is clearly the problem origin For the record, the script i am using is               #!/bin/sh     MPD_MUSIC_PATH="/media/Media/Music"     TMP_COVER_PATH="/tmp/mpd-track-cover"     exiftool -b -Picture "$MPD_MUSIC_PATH/$(mpc --format "%file%" current)" > "$TMP_COVER_PATH" &


Running my own dynamic DNS record hosting

I intend to run a debian server at home, it will host various websites, SSH server and email. I have a dynamic IP address and I am unwilling to pay the extra for a static IP. I was thinking I could probably get around the DNS issue if I ran my own name server and used something like no-ip to set auto-updated nameserver addresses for my registered domains, eg: On the registrar:               john-hunt.com (and my other domains) nameservers = johnns1.noip.com & johnns2.noip.com          johnns1.noip.com, johnns2.noip.com -> my dynamic IP      Which will make sure that the nameservers for my domains are always pointing to my machine at home. I will run BIND or something similar on the home machine to actually serve up the DNS records. The real problem I have is that I don't quite know how I'd configure BIND (or tinydns or whatever) to accept and apply updates when my IP address changes.. I can think of a way to bodge it (poll & ping johnns1.noip.com to get my IP address, then grep on the zonefiles and reload every 5 minutes..) but that doesn't feel very solid. Does anyone have any experience in this area? I had a look at no-ip's enhanced services but they want $25 for hosting records for every domain (and I have quite a few).


Cannot Boot New Linux From USB

Recently, I got a new laptop, the MSI gx60. I grabbed a usb and loaded the Linux Mint 16 Cinnamon image onto it, tested it on my old laptop and desktop, where it worked. However, when I try it on my laptop it fails in the strangest way: I put in the usb and turned on the laptop. Entered into the boot menu and selected my USB from the menu. I was then sent to a grub screen(I do NOT have grub installed on my laptop) with the following options: -Launch Linux Mint -Launch Linux Mint in compatibility mode When I run one of these options, the screen goes black, still on, just displaying black and stays like this forever, until I force a shut down. Now would be a good time to mention that the boot is set to UEFI. So the next thing I do, is go into BIOS and change the boot to Legacy Mode. Now, when I boot into the same USB device, instead of the grub menu, I get sent into the Linux Mint Menu, just as it should be. However, when I select an option, such as Launching Linux Mint, Instead of taking me the the desktop, as it did on the other computer I tested the USB on, I get a grey screen with a blinking cursor in the top left, followed by a black screen with the top left quarter white, and soon after this the computer goes to the very start of the boot sequence as if it had just turned on. When I attempted a different USB with a different Linux Image(Kali this time, I get very similar results).


Use start-stop-daemon for a PHP server

I'm working on a socket server written in PHP. This part of the work is done but now I need to run it as a daemon. For this I've tried to use `start-stop-daemon` but it doesn't work. My server is running Debian. To simplify, my question is why does the following command not run my daemon or how can I debug it?               start-stop-daemon --start --quiet --background --make-pidfile --pidfile /var/run/server-ticket.pid --exec /usr/local/zend/bin/php /var/www/server/consultpilot/ServerTicket.php >> /var/log/server-ticket.log 2>> /var/log/server-ticket.log </dev/null      The following is the full script, based on Till Klampaeckel's tutorial:               #! /bin/sh          ### BEGIN INIT INFO     # Provides: ServerTicket     # Required-Start: $all     # Required-Stop: $all     # Default-Start: 2 3 4 5     # Default-Stop: 0 1 6     # Short-Description: starts ServerTicket     # Description: starts ServerTicket using start-stop-daemon     ### END INIT INFO          # Load the VERBOSE setting and other rcS variables     . /lib/init/vars.sh          PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin     DAEMON=/usr/local/zend/bin/php     DAEMON_OPTS="/var/www/server/consultpilot/ServerTicket.php"     NAME=server-ticket     DESC="Daemon for the Server Ticket from DiffMed"     PIDFILE="/var/run/${NAME}.pid"     LOGFILE="/var/log/${NAME}.log"     QUIET="--quiet"     START_OPTS="--start ${QUIET} --background --make-pidfile --pidfile ${PIDFILE} --exec ${DAEMON} ${DAEMON_OPTS}"     STOP_OPTS="--stop --pidfile ${PIDFILE}"              test -x $DAEMON || exit 0          set -e          case "$1" in         start)             echo -n "Starting $DESC: "             start-stop-daemon $START_OPTS >> "${LOGFILE}" 2>> "${LOGFILE}" </dev/null             echo "$NAME."                    ;;         stop)             echo -n "Stopping $DESC: "             start-stop-daemon $STOP_OPTS             echo "$NAME."             rm -f $PIDFILE             ;;         restart|force-reload)             echo -n "Restarting $DESC: "             start-stop-daemon $STOP_OPTS             sleep 1             start-stop-daemon $START_OPTS             echo "$NAME."             ;;     *)         N=/etc/init.d/$NAME         echo "Usage: $N {start|stop|restart|force-reload}" >&2         exit 1         ;;     esac          exit 0      For information, when I start the process, there is no return. But when I finish it, it tells me that no process corresponds:               root:/var/run$ service server-ticket start     Starting Daemon for the Server Ticket from DiffMed: result : 0     server-ticket.     root:/var/run$ service server-ticket stop     Stopping Daemon for the Server Ticket from DiffMed: start-stop-daemon: warning: failed to kill 5772: No such process     1 pids were not killed     No process in pidfile '/var/run/server-ticket.pid' found running; none killed.


How to install mumbojumbo games on mint?

I heard there are some mumbojumbo games on ubuntu's software center. How can I install theme on linux mint?


udev set kdbrate settings on linux with console users issue

I have a kbdrate setting as a udev rule for usb devices(keyboards and scanners that re repluggd in). kdbrate needs to be set by someone with /dev/port access which is the console user. The udev rule works, and udev rule creates a lock file which the users .profile script reads then executes a kbdrate setting if the lock file exists. The thing is when its run from .profile it will tell me the user doesnt have /dev/port access. I cannot get the script to run in a mode that would work. The goal of this is to set the rate again after a device which sets rate is plugged in. If you force a kdbrate to be set in the rule it just gets overwritten (console users .profile script)               pi@raspberrypi /home/nrfwy60 $ cat checkrate     #!/bin/bash     while true     do         if [ -e "/tmp/setrate.lock" ]         then                 sleep 5                 sudo /sbin/kbdrate -d 1250 >> /tmp/setrate.lock                 rm -rf /tmp/setrate.lock         fi         sleep 1     done      udev script which gets run at the usb sub system.               root@raspberrypi:/home/nrfwy60# cat /root/scripts/setrate     #!/bin/bash     echo "file" > /tmp/setrate.lock     chown nrfwy60:nrfwy60 /tmp/setrate.lock      udev rule (which has been set to specific vendors or adds and did not make a difference) i settled with this               root@raspberrypi:/home/nrfwy60# cat /etc/udev/rules.d/80-usb-input.rules     SUBSYSTEM=="usb", RUN+="/root/scripts/setrate > /root/greg.error"  OWNER=="root"


Removing specific files recursively using rm or something simple?

I have a root folder with a text file in it called pairs.txt. Within that root folder are other folders with text files called pairs.txt in them. Is there a simple way to remove them using `rm`? I know that there I could use `find . -name 'pairs.txt' -exec rm {} \;` but I would like to know of other ways, perhaps using `*` or some other wildcard? I tried using `rm -rf pairs.txt` but it seems to only remove the `pairs.txt` in the current directory.


How to kill a script which starts new processes?

The following is a Python application which spans a few threads, then spawns a new process of itself and exits:               $ cat restart.py     import os     import random     import signal     import sys      import threading     import time               class Name(object):         def __init__(self, name):             self.name = name               class CallThreads(threading.Thread):         def __init__(self, target, *args):             self.target = target             self.args = args             threading.Thread.__init__(self)              def run (self):             self.target(*self.args)               def main(args):         print("Hello, world!")         letter = random.choice(['A', 'B', 'C', 'D', 'E', 'F'])         count = 0          while count<3:             count += 1             name = Name(letter+str(count))             t = CallThreads(provider_query, name)             t.daemon = True             t.start()             time.sleep(3)             print("------------")              print("Time to die!")         t = CallThreads(restart)         t.daemon = True         t.start()         time.sleep(0.1)         sys.exit(0)               def provider_query(name):         while name.name!='':             print(name.name)             time.sleep(1)               def restart():         os.system('python restart.py')               def signal_handler(signal, frame):         sys.exit()               if __name__ == '__main__':         signal.signal(signal.SIGINT, signal_handler)         main(sys.argv)      When I hit `^C` I do get a bash prompt, but the output still comes and I still see the script in the process table:               $ ps aux | grep restart.py     1000      5751  0.0  0.0   4396   616 pts/3    S    08:41   0:00 sh -c python restart.py     1000      5752  0.3  0.1 253184  5724 pts/3    Sl   08:41   0:00 python restart.py     1000      5786  0.0  0.0   9388   936 pts/4    S+   08:41   0:00 grep --color=auto restart.py      I've tried killing it with `kill 5751 && kill 5752`, but that doesn't help even if I'm fast enough to do so before the PID changes (on a new process when the script restarts). I've tried `pkill restart.py` but that does not help either. I'm wary of using `pkill python` as there are other Python processes running that I don't want to kill. Even closing the Konsole window in which the script is running does not help! **How can I kill the script?**


How can I create my own imagemagick binary releases?

I'm looking for a way to build ImageMagick binary distributions for deploying my app. I only need it for Kinux 64-bit (Ubuntu/Debian) and OSX. Actually building it is fine, but I have no idea how to include delegate libraries:   * png   * jpeg   * gif   * tiff   * webp Something similar is done with ffmpeg: http://ffmpeg.org/download.html#LinuxBuilds Are there instructions or guidelines as to how to do this?


Simple console text editor suited to python

I am looking for a light weight shell editor for Linux that a young child (eg 7-8 year old) can write python scripts in. The motivation is to find something that is helpful for a beginning programmer without the frustrations of a steep learning curve. It needs to accomplish the following:   1. Simple interface like joe, pico etc.    2. No complicated modes to think about like vim and emacs.    3. Can be configured to turn tabs into whitespace for python.   4. Ideally it should have some syntax colouring features.   5. Must have a way to configure a hotkey to run the current script. To clarify what I mean by the last point, my .vimrc file has these lines which allow me to press to execute the current script.               autocmd BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"     autocmd BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m     autocmd BufRead *.py nmap <F5> :!python %<CR>


apache, tomcat context path

I have Tomcat and Apache installed in CentOS 5. They're integrated with a help of mod_jk.so. They both display the same in http://www.tource.com/cms/admin and http://www.tource.com:8080/cms/admin But I'd like to make the context **cms** displayed only when I access with address below. **http://cms.tource.com/** How could the context "www.tource.com/cms" turn into "cms.tource.com" ?


How to get only filename using sed

How can I get only the filename using sed? I've this               out_file=$(echo $in_file|sed "s/\(.*\.\).*/\1mp4/g")      But I get the path too `/root/video.mp4`, and I want only `video.mp4`.


how to get data of ntfs to linux?

I have dual boot of Windows 2003 server and Cent-OS 6.X on my PC. I have files in windows environment, can I get those files using any utility to my Linux environment with out using any external drives?


LVM Mirrored Logical Volume Performance

I read that when mirroring a logical volume a log of some sort is used to keep the files in sync. You can either set it so this log is in a separate physical volume or in memory. I also read that if the log is in memory, the system has to resync the volumes. Is there a performance hit for using the log in memory? For example, does it take much longer to boot the machine? Is the data at risk while the resync is happening? I'm working with Ubuntu 10.04 in this case. I believe it's lvm2. The clearest documentation I've found is the CentOS document here. I was also looking at this description.


Is SCADA an RTOS?

Is SCADA one of the RTOS out there (it's used for real-time control and data acquisition)?


What causes various signals to be sent?

I sometimes get a little confused by all of the signals that an application can receive. As I understand it, an application has a default handler for each of these signals, but it can provide its own handler by calling `sigaction()`. So here is my question: what causes each of the signals to be sent? I realize that you can manually send signals to running applications via the `-s` parameter to `kill`, but what are the _natural_ circumstances under which these signals are sent? For example, when does `SIGINT` get sent? Also, are there any restrictions on which signals can be handled? Can even `SIGSEGV` signals be processed and control returned to the application?


Activate/deactivate WiFi on Lenovo B5400 under Ubuntu 14.04

I have a Lenovo B5400 with Ubuntu 14.04 x64. The Ethernet port works fine. How can I enable/disable the WiFi connection? I have no hardware button for this functionality. Under Windows I can press `Fn`+`F5` and a dialog window appears, but I cannot find this functionality under Linux. `lspci | grep Network` produces: > 04:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe > Wireless Network Adapter The answer from here is incomplete. Any other ideas? **EDIT #1:** The output of `rfkill list all` is:               0: tpacpi_bluetooth_sw: Bluetooth         Soft blocked: yes         Hard blocked: yes          1: hci0: Bluetooth         Soft blocked: yes         Hard blocked: no          2: phy0: Wireless LAN         Soft blocked: yes         Hard blocked: yes      PS: disclaimer: crossposting


Archlinux, move files to a different partition

During the installation I _thought_ I had generated the correct `fstab`, but now, after `cp` complains that the filesystem is full, I discover that `fstab` is **empty**. I have this configuration:               # lsblk      NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT     sda      8:0    0 232.9G  0 disk      ├─sda1   8:1    0   238M  0 part      ├─sda2   8:2    0   1.9G  0 part      ├─sda3   8:3    0  23.3G  0 part /     └─sda4   8:4    0 207.5G  0 part      But this is absolutely not what I want. I'd like to mount `/dev/sda1` as `/boot` and `/dev/sda4` as `/home/user`. `/dev/sda2` is swap. The **problem** is that I already added a ton of files in `/home/user`, all of which went in `/dev/sda3`, because that one was the only one mounted. How do I fix this? I could boot from a live cd, mount the partitions, run `genfstab`, but then? Where do my files under `/home/user` go? Is it safe? Should I move all my `home` content into a temporary directory, mount `/dev/sda4` and copy everything back?


How do I get my shell functions to make use of existing autocompletion in zsh?

I have a couple of shell functions defined in my `.zshrc` which save on typing and allow integration with screen. For example:               function s()     {          screen -t "$1" ssh "$@"     }      However, when I use these shell functions, I can't take advantage of zsh's built in command completion features. (In the case of SSH, automatically completing hostnames based on known_hosts and ssh_config). What's the preferred way to hook in to the existing completion mechanisms for commands I've created wrappers for? EDIT: Thanks to Gilles for his answer below. Using compdef appears to be the way to do this, but interestingly it doesn't seem to work uniformly. In this case, I have the following setup:               function s()     {         screen -t "$1" ssh "$@"     }          function m()     {         screen -t "man.$1" man "$1"     }          compdef $_comps[man] m     compdef $_comps[ssh] s      Completion for my wrapper function 'm' works as expected, however completion for my function 's' does not; rather than attempting to complete hostnames, it appears to fall back to default autocompletion by providing me a list of files when I hit 'tab'. Is there some oddity in the way that SSH completion is handled which means I need to do something further?


Capture web traffic grouped by individual TCP streams

As far as I know a HTTP request and response constructs one TCP connection. To debug a web application on a GUI-less server, I'd like to be able to capture these TCP streams in a single distinguishable entity (same color, file, db record, anything). `tcpdump` can only save IP packets as they arrive or leave, with no ordering or reassembling. `tcpflow` goes one step further to reassemble TCP connections in separate files, but puts send and receive streams in separate files, which makes quick debugging annoying. I'm sure I can write a script or even one- liner to merge related files, but I'm guessing a wrapper around `tcpflow` for this job could introduce complexities which wouldn't exist inside `tcpflow`. Also I'm lazy and looking for a cleaner solution. Any suggestions would be appreciated.


Can't ping first IP with dual NICs on different subnets with multiple gateways

I have two NICs assigned to a server.               eth0 - 10.199.10.0/24 w/ a GW of 10.199.10.1     eth1 - 10.199.20.0/24 w/ a GW of 10.199.20.1      From my desktop, I can ping the IP assigned to each NIC just fine (`10.199.10.100` and `10.199.20.100`). So I set up Apache to listen on ALL ips on said server. I tested this just fine from my desktop as well. Now, I went to create a new VM on the `10.199.20.0` subnet and I can access the RH test page by hitting `http://10.199.20.100` BUT I can't access it via `10.199.10.100`. This is troublesome since I have a bunch of services on this server that can only listen on one particular IP (the `10.199.10.100`). My network guy tells me the routes look fine and that it could be the routing table on the server itself.               #ip route     10.199.10.0/24 dev eth0  proto kernel  scope link src 10.199.10.100     10.199.20.0/24 dev eth1  proto kernel  scope link src 10.199.20.100     169.254.0.0/16 dev eth0  scope link  metric 1002     169.254.0.0/16 dev eth1  scope link  metric 1003     default via 10.199.10.1 dev eth0          # ip rule     0:      from all lookup local     32764:  from all to 10.199.20.100 lookup build     32765:  from 10.199.20.100 lookup build     32766:  from all lookup main     32767:  from all lookup default      _**Netowrk Layout_** These servers are Xen guests. We have four Xen servers with multiple NICs. The admin server with the two NICs have two virtual NICs assigned to them. One from `10.199.10.x` and one from the `10.199.20.x` subnet (two different NICs). The test server only has the `10.199.20.x` network assigned to it. I can ping the `10.199.30.x` network just fine.


SW-RAID 5 - how much CPU time and performance can it take?

I have Debian squeeze 6.0.4, 4x WD RE4 500Gb 7200RPM, Athlon II X4 600E and 24GB RAM DDR3. Since I work with SW raid 5, it takes much more CPU, than I think is enough. How can I get know, how much CPU performance and CPU time my Software RAID 5 takes? Do you think is there so big difference in performance between Phenom II X4 905e with L3 cache and Athlon II X4 600e without L3? Do you think it will consume more CPU time, when using more different disks instead of same type, mark and series? Is there difference between Raid 5 with 4 same disks from WD instead of RAID 5 with 4 different disks from hitachi, WD, samsung and seagate? True is, that 4 different disks could be maybe slower, than 4 same disks, but maybe more secure. (we are speaking about Software linux raid on debian squeeze) Thank you


KVM - Which Web Based management to use?

I would like to became an Expert of managing KVM on debian squeeze. I still use virt-manager. Yes, it is easy and quiet safe and quick for me. I tried a lot of web based management UI and non of them was good enough like virt-manager. You know, I'm one of those guys, who used to have VMware before, where 90% of managing is clicking. My questions : 1) Are there any CLI "interactive" utility like mc (midnight commander) or something how to control KVM ? (ON/OFF VMs, increasing memmory, reseting VMs, adding virtual hardware, adding new disks, and so on...) 2) Could you recommend me some Web based management UI for KVM on debian squeeze? Did you see VMware server 2? There is web management. I know it was slow, but it is fine, when you are somewhere without terminal. (for example on android with web browser) I tried a lots of them, but nothing i tried was working. 3) What tutorials could you recommend me to improve myself in commands to control virsh, kvm and so on? Google is full of low quality tutorials with mistakes and misunderstandings. I need something for debian. 4) Could you recommend me some tutorials how to improve performance for KVM? Google is full of a lot of tutorials, but I need some recommendations from real experts, who knows, how to improve it. 5) How to improve security of KVM? Can solve this problem some Web based UI? (for example accounting, user management ?) I know there is google, wiki, there is a long list of UI for kvm, but I need opinions, experiences from experts or users who use KVM. I hope this isn't any stupid question. Thank you all for answering my questions.


How to limit CPU performance for KVM VM?

imagine 1 Virtual machine with 2 shared cores on quad core CPU 2Ghz speed. Is it possible to limit this Virtual Machine for 500Mhz of CPU power on both cores? Or to reserve 1Ghz on 1 core for this one VM? Is it possible to limit for example to 1500Mhz for 2 VMs ? I mean to share 1500Mhz of power of 1 core for 2 VMs. For example VMware ESXI and Citrix Xenserver can do it easily by creating resource pool where you preshare for example 2x 1Ghz cores and 4GB ram and then you give there for example just only 2 or 10 VMs as you wish. Is it possible in KVM? How? If is, can it do some kind of web based interface for KVM? Thank you


how to check if ssh works without connecting to server

I just want to check whether following code will work or not. It is like a validation               su -oracle "ssh  oracle@$MY_IP -o 'BatchMode=yes' -o 'ConnectionAttempts=1'"     returnCode=$?          echo "$returnCode"      if [ $returnCode != 0 ]      then       echo "Configuration is not valid"       return 1;      else       echo "Configuration is  valid"       return 0;      fi      When I run my script, it just gives me empty prompt. I can not enter to if statement. it seems script is trying to connect MY_IP. How can I validate my statement without changing user and connecting to IP.


Bash option to get resolved executable path?

Bash is able to trace execution script commands with the `-x` command line option. Each command is then output to `stderr`, prefixed by `PS4` as stated in the man page. > >      -x      After expanding each simple command, for command,  case > command, >              select  command,  or arithmetic for command, display the > expanded >              value of PS4, followed by the command and its expanded > arguments >              or associated word list. >   Albeit useful, the resolved executable path of each command is not given. So I have to figure out which executable has been run by guessing shell aliases and `PATH` value while reading execution trace. For example, `ruby` has multiple command candidates on my workstation:               $ type -a ruby     ruby is /home/cbliard/.rvm/rubies/ruby-2.1.0/bin/ruby     ruby is /home/cbliard/.rvm/bin/ruby     ruby is /usr/bin/ruby     ruby is /home/cbliard/.rvm/bin/ruby      If executing this script with `/bin/bash -x`               #!/bin/bash     echo "compute"     ruby script/run_something.rb     echo "deploy"     bundle install     bundle exec cap deploy      Trace execution will be               + echo "compute"     compute     + ruby script/run_something.rb     [output of ruby script]     + bundle install     Using rake (10.1.0)     Using i18n (0.6.9)     [...]     Your bundle is complete!     Use `bundle show [gemname]` to see where a bundled gem is installed.     + bundle exec cap deploy         triggering load callbacks       * 2014-01-14 09:12:42 executing `deploy'       * 2014-01-14 09:12:42 executing `deploy:update'     [...]     Finished: SUCCESS      I had some oddities with resolved executables, mainly due to my usage of `rvm`. The output I would like is with fully resolved path, like this:               + [builtin] echo "compute"     compute     + /home/cbliard/.rvm/rubies/ruby-1.9.3-p484/bin/ruby script/run_something.rb     [output of ruby script]     + /home/cbliard/.rvm/gems/ruby-1.9.3-p484@global/bin/bundle install     Using rake (10.1.0)     Using i18n (0.6.9)     [...]     Your bundle is complete!     Use `bundle show [gemname]` to see where a bundled gem is installed.     + /home/cbliard/.rvm/gems/ruby-1.9.3-p484@global/bin/bundle exec cap deploy         triggering load callbacks       * 2014-01-14 09:12:42 executing `deploy'       * 2014-01-14 09:12:42 executing `deploy:update'     [...]     Finished: SUCCESS      Having the resolved command would really help me debugging weird `rvm`/`bundler` issues. The `-x` option helps a lot but sometimes it is not enough. **Is there any trick that helps knowing the full characteristics of the commands while running a`bash` script?**. It is better if the original script does not have to be modified.


Using awk to parse AIX's lsuser output in stanza format

I'm creating a simple awk script to parse AIX's `lsuser -f ALL` output and return information in one line. A sample of the output is something like this.               root:         id=0         pgrp=something         groups=something         home=/         shell=/usr/bin/csh         auditclasses=general         login=true         su=false      Here is my code so far:-               $1 ~ /[^=]:[ ]*$/ {sub(/:/,"",$1);printf $1" ";FS="="}     $1 ~ /login/         {printf $2" "}     $1 ~ /su/     {printf $2" "}     $1 ~ /account_locked/         {printf $2" "}     $1 ~ /time_last_login/     {print $2}      The script does not work well with fields that does not exist for certain ID such as `time_last_login` because some user may not have logged in before. Example as per below.               root something ALL false 1360813178     **daemon staff ALL true sysadm1 something ALL false 1352015794**     sysadm2 staff ALL true 1352015794      sysadm1 line should be in a new line. How do I fix this?


How would I automate sending highly similar emails with one word changed?

E.g. if I want to send a bunch of emails along the lines of "What does it feel like to X?" to ask@qr.ae (Quora allows and even somewhat encourages me to ask highly similar questions there). And then give a dictionary of words that I want to substitute for X? I know that the mailx readme has a small section on how to send mail with scripts, but I'm still a UNIX newbie so I'm not sure how I would be able to configure a script in conjunction with mailx just from that.


Correct way to document variable length options in man pages

Sometimes I see usage information like               some_utility [arg [arg [...]]]      or               some_utility [arg[, arg[...]]]      that indicates that you can pass more than one of the same argument. I've also seen it like               some_utility [args]      or               some_utility [arg][, arg][...]      Is there a standard way to do this?


Orphaned connections in CLOSE_WAIT state

I've got a SLES machine that accumulates TCP connections in a CLOSE_WAIT state for what appears to be forever. These descriptors eventually suck up all available memory. At the moment, I've got 3037 of them, but it was much higher before a hurry-up reboot recently. What's interesting is that they're not from connections to local ports that I expect to have listening processes. They have no associated PIDs, and their timers seem to have expired.               # netstat -ton | grep CLOSE_WAIT     tcp      176      0 10.0.0.60:54882     10.0.0.12:31663      CLOSE_WAIT  off (0.00/0/0)     tcp       54      0 10.0.0.60:60957     10.0.0.12:4503       CLOSE_WAIT  off (0.00/0/0)     tcp       89      0 10.0.0.60:50959     10.0.0.12:3518       CLOSE_WAIT  off (0.00/0/0)          # netstat -tonp | grep CLOSE_WAIT     tcp       89      0 10.0.0.59:45598     10.0.0.12:1998       CLOSE_WAIT  -                        tcp       15      0 10.0.0.59:60861     10.0.0.12:1938       CLOSE_WAIT  -                        tcp        5      0 10.0.0.59:56173     10.0.0.12:1700       CLOSE_WAIT  -           I'm not a black-belt when it comes to the TCP stack, or kernel networking, but the TCP config seems sane, since these values are default, per the man page:               # cat /proc/sys/net/ipv4/tcp_fin_timeout      60     # cat /proc/sys/net/ipv4/tcp_keepalive_time      7200      So what gives? If the timers have expired, shouldn't the stack automatically clear this stuff out? I'm effectively giving myself a long-term DoS as these things build up.


Best way to archive attachments?

My saved-messages and sent-mail "folders" (actually Unix MBX files) are huge because of attachments, most of which I've saved to disk anyway. I want to keep the messages, but replace the attachment w/ a text file saying "Attachment removed: /full/path/to/attach.txt". How do I do this? I'm using Alpine, but any tool that does this for Unix MBX is fine. Alpine _does_ let me delete attachments from emails, but I can't replace them w/ a text file. Notes:   * I realize I can save the message to a file and edit the file using emacs, but that's kludgey and probably messes up "Content-Length" headers and stuff.    * I also realize I can forward the message, with headers, to myself after removing the attachment. Again, kludgey.    * I don't think Alpine lets me add attachments to stored mail (unless I want to send it somewhere [which messes up headers]), so I can't delete the big attachment and add a smaller one.    * I realize I could write a Perl script to do this, but hoping for an existing well-tested solution.


Differences in package management between Debian and Arch

A discussion from this post made me curious of differences between Debian and Arch package management. Also, people tend to say that Arch is very light- weight, so I wonder what that has to do with package management. Is it maybe because Debian treats _Recommends_ as hard dependencies by default? Can you also mention the flexibility/power between the two package managers: which of the two lets you do more. I'm aware that some features available on a Debian package management system would be irrelevant on an Arch system, since Arch has a single Suite and Debian has multiple (e.g. APT pinning and advanced dependency handling come to mind), so please compare features that are applicable to both systems (i.e. assume that for Debian, I only use _unstable_ ).


Resetting password expiry date by number of days instead of specifying date

Is there a way with either commands passwd or chage to force the password to expire 90 days from the time of command execution? I know I can do it by date, such as:               chage -E "2014-07-31" userid      But I'm looking for a way to do it by with a number instead of a specific date. Thank you!


Character encoding of .netrc

Does anyone know which character encoding is used in `.netrc`? As a German user, I sometimes put umlauts in passwords. So my question is, are these treated as latin1 or may I assume that I am doing fine encoding the file in UTF-8?


Can I configure apache to limit access to a directory only from my ssh connection?

I have a virtual machine running a number of websites. All users have access these via the external IP address of the machine. I am running Debian Stable on this machine. I can access the machine via `ssh` and have organized it so I port forward my local `10080` port to `localhost:80` so I can connect my browser to localhost port `10080`/phpmyadmin and gain access to phpmyadmin. My machine is on a `192.168.0.0/24` network Trouble is, you can also access it via any of the external web sites - because Debian has placed it in the top level Apache config. I would like to limit access to only connections via the `ssh` port. But there doesn't appear to be the equivalent of a listen directive for a directory. However there is Allow from IP_address. What IP address does apache think I connected on when I come over the `ssh` tunnel.


To grep 20 characters after and before match

I have the problem that I get too much information after the match for               grep -RnisI --color=auto "pseudomonas" *      I want to get only like 20 characters or 10 words after and before the match. **What is the right tool to do such a thing?**


iptables: allow certain ips and block all other connection

How do I allow certain ips and block all other connection in iptables?


Trying to get vimpager (to replace less) working with nerdTREE

I'm trying to get switch over to vim as my primary editor and I've installed the nerdTree plugin, but now when I try and use vimpager to replace less I get               Error detected while processing VimEnter Auto commands for "*":     E492: Not an editor command: NERDTree        I've narrowed it down to this line in my `.vimrc`, but I don't know much about configuring vim, I got this `.vimrc` off the internet.               autocmd VimEnter * NERDTree       My best guess is that vimpager is trying to disable plugin, but the `.vimrc` is trying to load it, so they're getting an error. Any advise on resolving this?


sort but keep header line at the top

I am getting output from a program that first produces one line that is a bunch of column headers, and then a bunch of lines of data. I want to cut various columns of this output and view it sorted according to various columns. Without the headers, the cutting and sorting is easily accomplished via the `-k` option to `sort` along with `cut` or `awk` to view a subset of the columns. However, this method of sorting mixes the column headers in with the rest of the lines of output. Is there an easy way to keep the headers at the top?


How to share files between Linux and Windows?

I am wondering, is there any way to easily share a folder between Linux and Windows?


How to install b43-firmware on arch without internet access?

I currently don't have wire internet access in the PC I'm trying to install arch to, but my other PC (win7) can access the internet just fine. I tried downloading the b43 package from the AUR and copy it with a pendrive but when I run `makepkg -s --asroot` it goes and tries to download the source from "http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2" which doesn't work since I still don't have internet access. I manually downloaded the source on my other pc but I guess I have to modify the PKGBUILD file to reflect this so instead of trying to fetch it online it looks in my local folder? How can I do this?


CPU usage by kernel modules, routing and forwarding rules

I have a system with a loopback kernel module installed. Through a bunch of routing and iptable rules, packets coming out of the loopback interface are sent over an ipsec tunnel. I am seeing that under load, the kernel panics or dumps a lot of messages that say "BUG: soft lockup - CPU#0 stuck for X secs". The stack trace is always in an encryption function like crypto_cbc_encrypt or des3_ede_encrypt. There is a lot of traffic going over the ipsec tunnels and the system is spending lot of time in encryption+decryption. My concern is that it is always CPU 0. How do I ensure that other CPUs are also sharing the crypto load. I have seen sometimes when the ksoftirq0 thread is at 100%. Again it is always cpu0. This is mostly happening when packets are being forward from the loopback interface, go through the xfrm rules and into the tunnels. How do I also check the CPU mask for the loopback kernel module? Is there such a thing?


Method bzip2 has died unexpectedly -Unable to update /upgrade /installl Ubuntu 14.04

Unable to update/upgrade/install Ubuntu 14.04, and it shows the below:               Get:21 http://us.archive.ubuntu.com trusty/universe Translation-en [4,089 kB]      E: Method bzip2 has died unexpectedly!      E: Sub-process bzip2 received signal 25.      Also while upgrading - shows '0%': I was fixing as error ' sts...0% ' while upgrading Ubuntu. I tried creating a manual `sources.list`. I reverted the changes to the file, but the error is still there.


Problems running python script from motion

I'm trying to set up the raspberry pi with my webcam as a motion detecting cctv that uploads the videos to google drive using Jeremy Blythe's script I have motion working correctly and the python script runs when I test it from the terminal. However the script doesn't run when I add it to the on_movie_end option in motion.conf. The script I am using in the file is               On_Movie_End /etc/motion/uploader.py /etc/motion/uploader.cfg %f      I have also tried getting the on_movie_end to run a bash script that runs the python script and this doesn't work either. I am new to linux though so not entirely sure I have it correct. The script is:               #!/bin/bash     VIDEO=$1      /etc/motion/uploader.py /etc/motion/uploader.cfg VIDEO      In motion.conf /etc/motion/uploaderscript.sh %f


Why does Vi have multiple modes?

Why does Vi have multiple modes? I'm not interested in the functions of the modes unless that was a reason to have different modes. I'm only interested in the design / engineering reasons for multiple modes.


How can I turn the behavior of `gedit sOmEtHiNg & disown` into the default behavior when calling gedit from the command line?

When I `gedit` files from the command line, it's always locking the terminal, and I'm tired of explicitly commanding a detached process for it. I tried to alias `gedit` as something like `gedit $* & disown`, but either that's not the right syntax or you're not allowed to overload executable binary commands with aliases (tried using that in a .bash_aliases function,               alias gedit=editorz          function editorz()     {       gedit $* & disown     }      ), but it doesn't take. So how do I make the command `gedit test.txt` not lock the originating terminal window?


How to report back system installation progress

I'd like to do some reporting from the system setup progress for virtualised (libvirt/kvm) Ubuntu servers. I expected some kind of such system to already exist out there, but couldn't find anything. Is it possible that there's no such thing? For a custom solution I've found there's a good interface available via `virt- install`'s `\--channel` option. Essentially I can start a daemon listening for messages on the host and on the client pipe messages to either a virtio device or to a pre-configured address using `netcat`. Alternatively I could make sure kernel logging is done into a file on the host and send my messages that way. Are there some other reasonable / tried solutions?


Run autostart program in a terminal instead of having it run hidden in background

I have added to `sudo nano /etc/xdg/lxsession/LXDE/autostart` the line: `python /path/to/script.py` This launches `script.py` on boot. Which is what I want. However, I can't see the output from `script.py` about what it is doing. Autostart just runs it in the background. How can I get `script.py` to run in a terminal? I'm using debian.


Using awk, how to get desired output from multiple file sources

I have two files: file1:               A,D     B,E     C,F      file2:               G,H,I     J,K,L      Using `awk`, I want to print:               A,D     B,E,I     C,F,L      How can I use `awk` to achieve this?


C Shell Array Declaration Syntax, () vs. {}

In my C-shell script (tcsh specifically) I have been trying to declare an array with six values: x, nx, y, ny, z, nz. After some trial and error I discovered three different ways of declaring the array I want:               set arrname = ("x" "nx" "y" "ny" "z" "nz")     set arrname = (x,nx,y,ny,z,nz)     set arrname = {x,nx,y,ny,z,nz}      but the following line doesn't work:               set arrname = {"x" "nx" "y" "ny" "z" "nz"}      The above line produces the following error:               Missing }.      My question is what is different between () and {} that makes the fourth declaration I've listed not work?


/usr/bin/ld: cannot find -lcrypt (rhel 6 )

**System info**               [root@xilinx busybox-1.22.1]# uname -r     2.6.32-71.el6.x86_64      Following errors come when I make busybox on rhel 6:               /usr/bin/ld: cannot find -lcrypt     collect2: ld returned 1 exit status     make: *** [busybox_unstripped] Error 1      Also I can see the libraries are there in lib:               [root@xilinx busybox-1.22.1]# ls  -ld /lib/libcry*     -rwxr-xr-x. 1 root root 38380 Sep  7  2010 /lib/libcrypt-2.12.so     lrwxrwxrwx. 1 root root    16 Jan 25 16:48 /lib/libcrypt.so.1 -> libcrypt-2.12.so          [root@xilinx busybox-1.22.1]# ls -ld /usr/bin/ld*     -rwxr-xr-x. 1 root root  595192 May  5  2010 /usr/bin/ld     -rwxr-xr-x. 1 root root 1685416 Aug 24  2010 /usr/bin/ldb3add     -rwxr-xr-x. 1 root root 1685416 Aug 24  2010 /usr/bin/ldb3del     -rwxr-xr-x. 1 root root 1685416 Aug 24  2010 /usr/bin/ldb3edit     -rwxr-xr-x. 1 root root 1685424 Aug 24  2010 /usr/bin/ldb3modify     -rwxr-xr-x. 1 root root 1685424 Aug 24  2010 /usr/bin/ldb3rename     -rwxr-xr-x. 1 root root 1685424 Aug 24  2010 /usr/bin/ldb3search     -rwxr-xr-x. 1 root root    5656 Sep  7  2010 /usr/bin/ldd      Why this is happening ? **Additional Info:**               [root@xilinx busybox-1.22.1]# yum install glibc-*     Loaded plugins: refresh-packagekit, rhnplugin     There was an error parsing the RHN proxy settings.     RHN support will be disabled.     Setting up Install Process     Package glibc-devel-2.12-1.7.el6.x86_64 already installed and latest version     Package glibc-2.12-1.7.el6.x86_64 already installed and latest version     Package glibc-headers-2.12-1.7.el6.x86_64 already installed and latest version     Package glibc-utils-2.12-1.7.el6.x86_64 already installed and latest version     Package glibc-common-2.12-1.7.el6.x86_64 already installed and latest version     Nothing to do      Also these are the installed packages starting with glib*               [root@xilinx busybox-1.22.1]# yum list installed |grep glibc*     There was an error parsing the RHN proxy settings.     RHN support will be disabled.     NetworkManager-glib.x86_64          1:0.8.1-5.el6                      @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     PackageKit-glib.x86_64              0.5.8-13.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     avahi-glib.x86_64                   0.6.25-8.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     dbus-glib.x86_64                    0.86-5.el6                         @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     dbus-glib-devel.x86_64              0.86-5.el6                         @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     glib.x86_64                         1:1.2.10-33.el6                    @epel         glib-devel.x86_64                   1:1.2.10-33.el6                    @epel         glib2.x86_64                        2.22.5-5.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     glib2-devel.x86_64                  2.22.5-5.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     glibc.i686                          2.12-1.7.el6                       @server       glibc.x86_64                        2.12-1.7.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     glibc-common.x86_64                 2.12-1.7.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     glibc-devel.x86_64                  2.12-1.7.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     glibc-headers.x86_64                2.12-1.7.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     glibc-utils.x86_64                  2.12-1.7.el6                       @server       glibmm24.x86_64                     2.22.1-1.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     poppler-glib.x86_64                 0.12.4-3.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     pulseaudio-libs-glib2.x86_64        0.9.21-13.el6                      @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0     taglib.x86_64                       1.6.1-1.1.el6                      @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0      **glibc is installed:**               [root@xilinx busybox-1.22.1]# yum list installed glibc     Loaded plugins: refresh-packagekit, rhnplugin     There was an error parsing the RHN proxy settings.     RHN support will be disabled.     Installed Packages     glibc.i686                                              2.12-1.7.el6                                             @server                                                     glibc.x86_64                                            2.12-1.7.el6                                             @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0      **Tried RPM**               [root@xilinx Downloads]# rpm -ivh glibc-static-2.12-7.2.x86_64.rpm      warning: glibc-static-2.12-7.2.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 2ca06d46: NOKEY     error: Failed dependencies:         glibc-devel = 2.12-7.2 is needed by glibc-static-2.12-7.2.x86_64      **Now here is a chicken and egg problem**               [root@xilinx Downloads]# rpm -ivh glibc-2.12-7.2.x86_64.rpm      warning: glibc-2.12-7.2.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 2ca06d46: NOKEY     error: Failed dependencies:         glibc-common = 2.12-7.2 is needed by glibc-2.12-7.2.x86_64      Ok then I installed this dependency:               [root@xilinx Downloads]# rpm -ivh glibc-common-2.12-7.2.x86_64.rpm     warning: glibc-common-2.12-7.2.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 2ca06d46: NOKEY     error: Failed dependencies:         glibc = 2.12-7.2 is needed by glibc-common-2.12-7.2.x86_64      i.e when I install glibc-2.12-7.2 , it says I need glibc-common-2.12-7.2 but now when I install glibc-common-2.12-7.2, it says it need glibc-2.12-7.2 How do break this chicken-egg cycle? **But actually all required glibc are installed**               [root@xilinx busybox-1.22.1]# yum install glibc-*          Package glibc-devel-2.12-1.7.el6.x86_64 already installed and latest version     Package glibc-2.12-1.7.el6.x86_64 already installed and latest version     Package glibc-headers-2.12-1.7.el6.x86_64 already installed and latest version     Package glibc-utils-2.12-1.7.el6.x86_64 already installed and latest version     Package glibc-common-2.12-1.7.el6.x86_64 already installed and latest version     Nothing to do


Are there any command line utilities that can capture joystick button presses?

Here's my situation: I have a Raspberry Pi with Raspbian installed on it. I also have RetroArch installed and a simple USB gamepad hooked up. Everything works fine, but I wanted to set it up so that pressing a key combination (ex L1+L2+R1+R2) would gracefully exit the emulator so that I don't have to keep a keyboard around. RetroArch's default key to gracefully exit is ESC, and I can't remap it to a key combination due to a limitation in RetroArch (I could, however, remap it to a single gamepad key). So I was wondering if there were any utilities out there that could listen to the gamepad's key presses and, when a certain combination is pressed, performs an action (sending the ESC key to the emulator). Or is there an easier way to achieve what I want and I'm just being silly? EDIT: Now that I think about it, it would also be nice if I could have a different key combination execute a bash script that starts the emulator so that I could start it without a keyboard as well.


How can I get the version of the pgrep & pkill commands?

I looked at the manpages and there is no `-v` or `\--version` argument for pgrep or pkill. How can i get some info on the version? I'm asking because on my version of Ubuntu man `pgrep` is giving me a different manual then on my server. Ideally I would install the same version on my machine too.


Is there a one liner which can list public key fingerprints with authorised_keys as input?

I'd like to audit the `authorised_keys` file on a number of servers and match them with known AWS key fingerprints. Is there a one-liner which incorporates `ssh-keygen -lf` which will output the fingerprint of every key in an `authorised_keys` file in a nice list with line breaks?


How do I set Keyboard and profile preferences when connecting to Solaris via SSH?

I'm connecting to a Solaris box from Mac OS X. Whenever I have connected to linux boxes in the past it has been much easier to navigate around. How do I fix these configuration issues on Solaris?   1. Have to use `control+h` instead of backspace key   2. When in `man` the `escape` key does not quit the man page - how do I exit?   3. I didn't see a `.bash_profile` or `.profile` in the home directory, how do I set up things like `alias ll="ls -al"` on the remote machine?


NetworkManager Wi-Fi enablement button unselectable

I have a Gigabyte Q2532 laptop and `Enable Wi-Fi` of NetworkManager is not selectable. As for the device, here is the relevant entry from `lspci`:               03:00.0 Network controller: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) (rev 01)      I can see the driver is loaded:               $ lsmod | grep ath     ath9k                  83980  0      ath9k_common           12728  1 ath9k     ath9k_hw              345710  2 ath9k_common,ath9k     ath                    21417  3 ath9k_common,ath9k,ath9k_hw     mac80211              386825  1 ath9k     cfg80211              366201  3 ath,ath9k,mac80211      I also installed the firmware package, `firmware-atheros`, but I still get the same issue. Manually loading the driver gives me this on `/var/log/syslog`:               Jun 27 22:36:53 thome kernel: [ 5758.818796] ath: phy1: ASPM enabled: 0x42     Jun 27 22:36:53 thome kernel: [ 5758.818799] ath: EEPROM regdomain: 0x60     Jun 27 22:36:53 thome kernel: [ 5758.818801] ath: EEPROM indicates we should expect a direct regpair map     Jun 27 22:36:53 thome kernel: [ 5758.818803] ath: Country alpha2 being used: 00     Jun 27 22:36:53 thome kernel: [ 5758.818803] ath: Regpair used: 0x60     Jun 27 22:36:53 thome kernel: [ 5758.820362] ieee80211 phy1: Selected rate control algorithm 'ath9k_rate_control'     Jun 27 22:36:53 thome kernel: [ 5758.820686] ieee80211 phy1: Atheros AR9285 Rev:2 mem=0xffffc90004ec0000, irq=17     Jun 27 22:36:53 thome NetworkManager[1004]: <info> rfkill3: found WiFi radio killswitch (at /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy1/rfkill3) (driver ath9k)     Jun 27 22:36:53 thome NetworkManager[1004]: <info> WiFi now disabled by radio killswitch     Jun 27 22:36:53 thome NetworkManager[1004]: <info> (wlan0): using nl80211 for WiFi device control     Jun 27 22:36:53 thome NetworkManager[1004]: <info> (wlan0): driver supports Access Point (AP) mode     Jun 27 22:36:53 thome NetworkManager[1004]: <info> (wlan0): new 802.11 WiFi device (driver: 'ath9k' ifindex: 7)     Jun 27 22:36:53 thome NetworkManager[1004]: <info> (wlan0): exported as /org/freedesktop/NetworkManager/Devices/4     Jun 27 22:36:53 thome NetworkManager[1004]: <info> (wlan0): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]     Jun 27 22:36:53 thome NetworkManager[1004]: <info> (wlan0): bringing up device.     Jun 27 22:36:53 thome NetworkManager[1004]: <info> (wlan0): deactivating device (reason 'managed') [2]     Jun 27 22:36:53 thome NetworkManager[1004]:    SCPlugin-Ifupdown: devices added (path: /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0, iface: wlan0)     Jun 27 22:36:53 thome NetworkManager[1004]:    SCPlugin-Ifupdown: device added (path: /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0, iface: wlan0): no ifupdown configuration found.      NetworkManager config file:               $ cat /etc/NetworkManager/NetworkManager.conf      [main]     plugins=ifupdown,keyfile          [ifupdown]     managed=false      The other config file:               $ cat /etc/network/interfaces     auto lo     iface lo inet loopback      NetworkManager is at **0.9.8.0** , and...               $ uname --all     Linux thome 3.11-rc4-amd64 #1 SMP Debian 3.11~rc4-1~exp1 (2013-08-08) x86_64 GNU/Linux      It didn't work with Linux versions **3.9** and **3.10** as well. Also:               $ iwconfig wlan0      wlan0     IEEE 802.11bgn  ESSID:off/any                 Mode:Managed  Access Point: Not-Associated   Tx-Power=off                  Retry  long limit:7   RTS thr:off   Fragment thr:off               Power Management:on


Reserved space for root on a filesystem - why?

I understand that by default, newly created filesystems will be created with 5% of the space allocated for root. I also know you can change the defined space with:               tune2fs -m 1 /dev/sdXY      What I'm curious about though, is what the actual purpose for this reserved space is. Does it serve any practical purpose which would merit more than 5% space in some circumstances? The reason I've stumbled upon this question is that we recently built a 1TB filestore, and couldn't quite figure out why a df -h left us missing 5% of our capacity.


How do I stop KDE from changing my screen resolution?

I am running Linux Mint 17 with KDE and display drivers from Nvidia. I've configured the display settings using nvidia-settings, and when I first start up everything appears to work correctly. However, when I log in and KDE is loaded, it does something to my display setup which turns off one of my three connected screens. Using the KDE Display settings I am unable to turn the screen back on, but restarting the session and returning to the login screen shows the login dialog on this screen as intended. How do I stop KDE from messing with my screen setup? Alternatively, why is one of my monitors getting turned off? FWIW, the monitor affected by this is connected via HDMI while the other two that keep working are using DVI.


Encode directory with GnuPG

Is there any way to encrypt the whole directory using `gpg`? It accepts only file as input argument. But I need to encrypt a lot of files on external HDD.


How to override anaconda/kickstart package ordering?

I am building a bootable ISO to be used to install a Linux image (Oracle Linux, 5.8). This is using anaconda with a kickstart file to select the packages to be loaded. Some of these packages are failing with dependency problems in their %post section. Eg, this is seen in /root/install.log after the installation is complete:               Installing thirdparty-tools-1.00-09.noarch     /var/tmp/rpm-tmp.97891: line 1: ln: command not found     /var/tmp/rpm-tmp.97891: line 2: ln: command not found     /var/tmp/rpm-tmp.97891: line 3: ln: command not found     /var/tmp/rpm-tmp.97891: line 4: ln: command not found     error: %post(thirdparty-tools-1.00-09.noarch) scriptlet failed, exit status 127      I'm trying to find out if it is possible to control/override the package ordering, _without editing any RPMs to add dependencies_. I've been looking through the anaconda / kickstart documentation (https://fedoraproject.org/wiki/Anaconda/Kickstart#Chapter_3._Package_Selection), and searching extensively elsewhere, so I think that the answer is actually 'no, you can't do this', which would be a shame. The problem is that I am trying to include various _third-party_ RPMs, which are not under my control and which have been digitally signed. These include some processing in a %post section. This processing requires some standard Linux commands, eg 'ln', 'touch', etc, which are supplied within the coreutils package. The third-party package does not currently include a dependency on the coreutils package, though obviously it should really. Anaconda uses its own partial ordering algorithm to choose what order to install these packages, and the third-party packages are being installed _before_ the coreutils package. Obviously, the proper solution is to get these RPMs fixed by the third-party; however, this is likely to take too long. I was hoping that their might be some hidden / un-documented option for the kickstart file, which could add in extra dependencies. Ideally, I'd like to be able to add something like this to the %packages section:               %packages     @admin-tools     @base     @core     @system-tools     thirdparty-tools          # We would like to add some magic command to indicate a missing dependency     thirdparty-tools dependson coreutils      So, my question is: Is it possible to control or override the package ordering without editing any RPMs to add dependencies? [ I asked this same question on the main StackOverflow site, before I realised that this Unix StackExchange site existed, but received no answers yet; apologies to anyone who sees this twice. ]


How to share the clipboard betwen bash and X11

In this thread the top answer shows how to copy text that has been previously selected with the mouse on a gnome-terminal, to the clipboard in X11. My question is: Say I copy a piece of text from the terminal using bash set- mark and copy keyboard shortcuts (i.e. `set-mark` + `M-w`). Is it possible to share this clipboard with X11? **EDIT** : In the original question, I talked about sharing the clipboard with GNOME, but as Guilles points out below, GNOME doesn't specifically have a clipboard (it's general to X), so I have updated the question.


Is there way to sync the shell yank buffer and the clipboard?

In a terminal I copy a line by `Ctrl+a` and `Ctrl+k`. I want to copy the text into clipboard when another window become active so that I can use the text another application, like a text editor or a browser. Is there way to do it?


Humble Bundle 8, Capsized slow yet within system requirements

I just got the humble bundle 8, but when I tried to play Capsized, it was unplayably slow. Linux Mint 11.4. Here's my computer specs:               Processor: 2x Pentium(R) Dual-Core CPU E5200 @ 2.50GHz     Memory : 2051MB (700MB used)     OpenGL Renderer : Mesa DRI Intel(R) 945G GEM 20100330 DEVELOPMENT x86/MMX/SSE2      Looking at the hardware requirements for the bundle here: http://support.humblebundle.com/customer/portal/articles/1156426-humble-indie- bundle-8-system-requirements I thought I'd be able to play Capsized, which requires 2GHZ processor and 2GB of memory. No mention of graphics. Yeah, my graphics card is onboard intel, but is there something I'm missing here to make this game go at full speed?


Defragging an ext partition?

Why don't ext2/3/4 need to be defragmented? Is there no fragmentation at all?


Patching Linux kernel on-line (i.e. without rebooting)

Sorry - I don't remember the exact name. I know there is mechanism to patch the kernel at runtime by loading modules without need of the reboot as long as the structures involved are not affected. It is used by servers for security patches and recently by Ubuntu & Fedora.   1. What is the name of mechanism   2. Is there any how-to for hand-compiled kernels   3. Is it possible to automatically check if the change x.y.z.a -> x.y.z.a+1 changed any structure or not


Nested packages for different subdirectories in autoconf?

I have different subdirectories that need to be compiled in different ways. For example, some files needs to include some others using CFLAGS. However, CFLAGS can only be set in configuration files, so I guess I need multiple configure.ac's. Is it a good idea to use nested packages (as described on gnu.org) for this, or is this an overkill? Note: I call it overkill because the solution from gnu.org adds a README etc. into _every_ subdirectory. Can this be avoided?


What is a "kernel panic"?

What does it mean when your computer has a **"kernel panic"**? Does it equate to the windows BsoD? Also, what **methods, tips, tricks** are available to the user when a _kernel panic_ strikes?


Any other Linux application similar to Greyhole?

Is there any other Linux application similar to Greyhole? Preferably without relying on samba? I'm going to use it for a typical home server. The features that I want are what Greyhole has (from the link):   * JBOD concatenation storage pool   * Easily recoverable files I already tried LVM and RAID, but the drives aren't readable on their own.


Unable to 'make' anything.. Kernel-headers problem? Trying to get my RTL8723BE working

I'm a starting security/Linux student and I'm having headache-problems getting my wireless to work on Kali Linux. Recently I've bought a new laptop, to be specific the: **Lenovo IdeaPad Z50-70-01418NL** It comes with the wireless card: **Realtek RTL8723BE Wireless LAN 802.11n PCI-E** Lenovo only supports Windows, so I went searching for possibilities to get my wireless to work (After all, I've bought a laptop for a reason) I Really have googled everything, and because of that I'm losing track of what is relevant and what is not, what is the right way and what isn't. The https://github.com/lwfinger/rtl8723be shows the following line: _"Code for new variety of the 8723 PCI cards - temp until code added to kernel"_ So I assume that I must compile the driver and ultimately install the driver into my system as following:   1. command 'make' to compile the driver   2. get the driver in the right place   3. Profit! I try to 'make' the "rtl8723be" code but whatever I try it keeps giving me build errors. Since I have been trying almost anything in the hope it will work there is a long history of errors, but mostly the errors point at the line of:               $(MAKE) -C $(KSRC) M=$(PWD) modules      Ultimately I want to get my rtl8723be driver to work. If I use               ndiswrapper -i <.inf-file>'       It seems that ndiswrapper installs the .inf file and ndiswrapper -l is showing the driver. But I've red that you must use               modprobe ndiswrapper      This results in:               FATAL: Module ndiswrapper not found      ~~~~~~~~~~ EDIT ~~~~~~~~~~~~ So I have reinstalled the OS. (First tried to install kernel 3.15 but still no wifi adapter) Installed the needed kernel-headers. And I downloaded the new "rtl8723be" from https://github.com/lwfinger/rtlwifi_new (The new version fixes the bug in trx.c = Fix version number for _ieee80211_is_robust_mgmt_frame) When I try to use 'make' this results in the following:               root@Kratos:~/rtlwifi_new/rtl8723be# make     make -C /lib/modules/3.14-kali1-amd64/build M=/root/rtlwifi_new/rtl8723be modules     make[1]: Entering directory `/usr/src/linux-headers-3.14-kali1-amd64'       CC [M]  /root/rtlwifi_new/rtl8723be/dm.o       CC [M]  /root/rtlwifi_new/rtl8723be/fw.o       CC [M]  /root/rtlwifi_new/rtl8723be/hw.o       CC [M]  /root/rtlwifi_new/rtl8723be/led.o       CC [M]  /root/rtlwifi_new/rtl8723be/phy.o       CC [M]  /root/rtlwifi_new/rtl8723be/pwrseq.o       CC [M]  /root/rtlwifi_new/rtl8723be/pwrseqcmd.o       CC [M]  /root/rtlwifi_new/rtl8723be/rf.o       CC [M]  /root/rtlwifi_new/rtl8723be/sw.o       CC [M]  /root/rtlwifi_new/rtl8723be/table.o       CC [M]  /root/rtlwifi_new/rtl8723be/trx.o       LD [M]  /root/rtlwifi_new/rtl8723be/rtl8723be.o       Building modules, stage 2.       MODPOST 1 modules     WARNING: "rtl_btc_get_ops_pointer" [/root/rtlwifi_new/rtl8723be/rtl8723be.ko] undefined!       CC      /root/rtlwifi_new/rtl8723be/rtl8723be.mod.o       LD [M]  /root/rtlwifi_new/rtl8723be/rtl8723be.ko     make[1]: Leaving directory `/usr/src/linux-headers-3.14-kali1-amd64'      So what does this error mean? WARNING: "rtl_btc_get_ops_pointer" [/root/rtlwifi_new/rtl8723be I Have the feeling I'm almost there. I Even tried to copy both the driver and firmware to the following folders: /lib/modules/3.14-kali1-amd64/kernel/drivers/net/wireless/rtlwifi/rtl8723be/rtl8723be.ko /lib/firmware/rtlwifi/rtl8723befw.bin


apt-get returns strange error

I am on kali linux and when I run apt-get update it returns this:               W: Unknown flag value:  yes     W: You may want to run apt-get update to correct these problems      after running `apt-get update` several times it's still the same issue


Dual monitors + Parallels 8 + debian lxde

My system have two monitors (primary 1920 x 1080 and secondary 1680 x 1050) and on this runs Parallels 8 with Xubuntu 12.10 as guest system. Since old version of Xubuntu will not be maintained, I want to try Debian with LXDE environment. But I bounce to one problem, both monitors are merged into one. How can I configure debian to identificate two monitors.               xrandr: Failed to get size of gamma for output default     Screen 0: minimum 640 x 400, current 3600 x 1080, maximum 3840 x 1600     default connected 3600x1080+0+0 0mm x 0mm        1024x768       60.0          800x600        60.0          640x480        60.0          1024x640       60.0          1024x576       60.0          832x624        60.0          848x480        60.0          800x500        60.0          640x400        60.0          3840x1080      60.0          2560x1600      60.0          3600x1080      60.0*         2048x1536      60.0          1920x1200      60.0          1920x1080      60.0          1600x1200      60.0          1680x1050      60.0          1600x1000      60.0          1400x1050      60.0          1600x900       60.0          1344x1008      60.0          1280x1024      60.0          1440x900       60.0          1280x960       60.0          1344x840       60.0          1360x768       60.0          1280x800       60.0          1152x870       60.0