How to switch tags via awesome API

I've been digging around in the API documentation, and I'm having limited sucess switching tags from within awesome-client. Basically, I can switch tags with:               awful.tag.viewidx(2)      But that is relative not absolute. From looking in my rc.lua, looks like what I need is:               local screen = mouse.screen     awful.tag.viewonly(tags[screen][2])      But I get the following error instead:               attempt to index field '?' (a nil value)      What is the most concise way of changing tags (preferably one command) to an absolute tag number. Alternatively, how can I find the current tag?


want the last line when duplicate awk?

I have the file:               key value          blah blah     blah blah     blahblah     man1 boy1     blah blah     man1 boy2     man1 boy1      I do this to remove duplicate lines:               awk '/man1/ { print $1,$2} ' file | awk '!x[$0]++'      and the command take the first line and ignore other lines               man1 boy1      man1 boy2      but I want to ignore all lines except the last line:               man1 boy2      man1 boy1      as ramesh said I want something like:               cat filename     blah blah     blah blah     blahblah     man1 boy1     blah blah     man1 boy2     man1 boy1     man1 boy2     man1 boy3     man1 boy4     man1 boy2      the desired output               man1 boy1     man1 boy3     man1 boy4     man1 boy2


DHCP server not responding to requests from KVM guest

I've setup a DHCP server on my Debian server (Proxmox) so that I can provision IPs to my KVM guests on the server automatically. For some reason the DHCP server (isc-dhcp-server) isn't responding to requests for an IP. The DHCP server is set to listen to a bridge interface I've created called vmbr1 and I know requests are getting through to the host from the KVM guest as I've tested it through `dhcpdump -i vmbr1`. I've obviously made a mistake somewhere, can anyone spot it? I've included my configuration files below. **dhcp.conf file:**               ddns-update-style none;     deny declines;     deny bootp;     default-lease-time 600;     max-lease-time 7200;     log-facility local7;     subnet 192.168.0.0 netmask 255.255.255.224 {          interface vmbr1;          option routers 192.168.0.5;          option broadcast-address 192.168.0.31;          option ntp-servers 192.168.0.101;          option domain-name-servers 192.168.0.101;          option netbios-name-servers 192.168.0.101;          option netbios-node-type 2;          default-lease-time 86400;          max-lease-time 86400;          #vmbr1ipv4           host 104 {hardware ethernet 1A:27:59:82:39:8E;fixed-address 95.141.36.124;}     }      **isc-dhcp-server file:**               # Defaults for isc-dhcp-server initscript     # sourced by /etc/init.d/isc-dhcp-server     # installed at /etc/default/isc-dhcp-server by the maintainer scripts          #     # This is a POSIX shell fragment     #          # Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).     #DHCPD_CONF=/etc/dhcp/dhcpd.conf          # Path to dhcpd's PID file (default: /var/run/dhcpd.pid).     #DHCPD_PID=/var/run/dhcpd.pid          # Additional options to start dhcpd with.     #       Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead     #OPTIONS=""          # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?     #       Separate multiple interfaces with spaces, e.g. "eth0 eth1".     INTERFACES="vmbr1"      **interfaces file on host:**               # network interface settings     auto lo     iface lo inet loopback          auto eth0     iface eth0 inet manual          auto vmbr0     iface vmbr0 inet static             address  95.141.36.188             netmask  255.255.255.0             gateway  95.141.36.1             broadcast  95.141.36.255             bridge_ports eth0             bridge_stp off             bridge_fd 0             network 95.141.36.0             bridge_maxwait 0          auto vmbr1     iface vmbr1 inet static             address  192.168.0.5             netmask  255.255.255.224             bridge_ports none             bridge_stp off             bridge_fd 0      **Example request from KVM guest to host server through vmbr1 using`dhcpdump -i vmbr1`:**                 TIME: 2014-05-28 21:40:14.232         IP: 0.0.0.0 (1a:27:59:82:39:8e) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)         OP: 1 (BOOTPREQUEST)      HTYPE: 1 (Ethernet)       HLEN: 6       HOPS: 0        XID: 599fa654       SECS: 0      FLAGS: 0     CIADDR: 0.0.0.0     YIADDR: 0.0.0.0     SIADDR: 0.0.0.0     GIADDR: 0.0.0.0     CHADDR: 1a:27:59:82:39:8e:00:00:00:00:00:00:00:00:00:00      SNAME: .      FNAME: .     OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)     OPTION:  55 (  8) Parameter Request List      1 (Subnet mask)                              28 (Broadcast address)                               2 (Time offset)                               3 (Routers)                              15 (Domainname)                               6 (DNS server)                              12 (Host name)                              42 (NTP servers)          OPTION:  60 (  3) Vendor class identifier   d-i     ---------------------------------------------------------------------------      Output from `dhcpd`               Internet Systems Consortium DHCP Server 4.2.2     Copyright 2004-2011 Internet Systems Consortium.     All rights reserved.     For info, please visit https://www.isc.org/software/dhcp/     WARNING: Host declarations are global.  They are not limited to the scope you declared them in.     Wrote 0 deleted host decls to leases file.     Wrote 0 new dynamic host decls to leases file.     Wrote 0 leases to leases file.     Listening on LPF/vmbr1/fa:98:02:e0:1c:28/192.168.0.0/27     Sending on   LPF/vmbr1/fa:98:02:e0:1c:28/192.168.0.0/27     Sending on   Socket/fallback/fallback-net     There's already a DHCP server running.      Hopefully I've included enough information to help aid in a resolution. Many thanks!


Samba instructions work on CentOS 6.5, but not CentOS 6.3 - permissions in Windows are different

I followed these instructions to install Samba on both a CentOS 6.3 OS and a CentOS 6.5 OS. http://rbgeek.wordpress.com/2012/05/25/how-to-install-samba-server-on- centos-6/ It only seemed to work on the 6.5. I've built 4 of these in 6.5, and am very familiar with the setup. When I did the exact same thing in 6.3, I wasn't able to view the files in Windows at UNC path \192.168.245.132\MyShare. But I am in all 4 of my 6.5 machines. What could be wrong? The only major difference on these OS's was the fact that the 6.3 had Selinux installed and it was set to "enforcing" (turned on). So I disabled it. In the 6.5 version, I installed it but it was disabled by default.               # DISABLE SELINUX (BEFORE ACCESSING UNC PATH ON WINDOWS)          [root@localhost i2b2-1.6]# sudo nano /etc/selinux/config          # OLD VALUE:          # This file controls the state of SELinux on the system.     # SELINUX= can take one of these three values:     #     enforcing - SELinux security policy is enforced.     #     permissive - SELinux prints warnings instead of enforcing.     #     disabled - No SELinux policy is loaded.     SELINUX=enforcing     # SELINUXTYPE= can take one of these two values:     #     targeted - Targeted processes are protected,     #     mls - Multi Level Security protection.     SELINUXTYPE=targeted          # NEW VALUE:          # This file controls the state of SELinux on the system.     # SELINUX= can take one of these three values:     #     enforcing - SELinux security policy is enforced.     #     permissive - SELinux prints warnings instead of enforcing.     #     disabled - No SELinux policy is loaded.     SELINUX=disabled     # SELINUXTYPE= can take one of these two values:     #     targeted - Targeted processes are protected,     #     mls - Multi Level Security protection.     SELINUXTYPE=targeted          [root@localhost i2b2-1.6]# sudo service smb restart     Shutting down SMB services:                                [  OK  ]     Starting SMB services:                                     [  OK  ]     [root@localhost i2b2-1.6]# sudo service nmb restart     Shutting down NMB services:                                [  OK  ]     Starting NMB services:                                     [  OK  ]     [root@localhost i2b2-1.6]#      This is a picture from the 6.5 security of the "MyShare" folder (aka /samba/share/). ![enter image description here](http://i.stack.imgur.com/BWzC4.jpg) Picture from 6.3 install. ![enter image description here](http://i.stack.imgur.com/GHIqD.jpg) # EDIT: Now this is interesting. My share directory (/samba/share/) has a "." (dot) at the end of the permissions on 6.3 (non-working OS), and has a 3 following the permissions bits.               [root@localhost share]# ls -la     total 12     drwsrwsrwx. 3 root root 4096 May 27 18:42 .     drwxrwxrwx. 3 root root 4096 May 27 17:48 ..     drwxrwxrwx. 6 root root 4096 May 27 19:03 quick_install      The share directory (/samba/share/) does not have a "." (dot) at the end of the permissions on 6.5 (working OS), and has a 4 (not a 3) following the permission bits.               [root@localhost share]# ls -la     total 16     drwxrwxrwx 4 root root 4096 May 22 01:02 .     drwxr-xr-x 3 root root 4096 May 19 00:28 ..     drwsrwsrwt 2 root root 4096 May 23 00:37 certs     drwxr-xr-x 6 root root 4096 May 19 01:05 quick_install      http://superuser.com/questions/230559/what-does-the-dot-mean-at-the-end-of-rw- r-r-how-do-you-set-it-with-chmod Question is, how do I remove it. I had to disable Selenix after this directory was created. How do I fix this? # EDIT #2: Getting closer. Here is a reference, which wasn't 100% helpful. http://superuser.com/questions/191903/how-do-i-remove-any-selinux-context-or- acl This is called a SELinux ACL, not to be confused with the ligament from a lot of football injuries. The only problem is that I might have to restart the samba file share and reboot. But not sure.               [root@localhost share]# setfacl --help     setfacl 2.2.49 -- set file access control lists     Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...       -m, --modify=acl        modify the current ACL(s) of file(s)       -M, --modify-file=file  read ACL entries to modify from file       -x, --remove=acl        remove entries from the ACL(s) of file(s)       -X, --remove-file=file  read ACL entries to remove from file       -b, --remove-all        remove all extended ACL entries       -k, --remove-default    remove the default ACL           --set=acl           set the ACL of file(s), replacing the current ACL           --set-file=file     read ACL entries to set from file           --mask              do recalculate the effective rights mask       -n, --no-mask           don't recalculate the effective rights mask       -d, --default           operations apply to the default ACL       -R, --recursive         recurse into subdirectories       -L, --logical           logical walk, follow symbolic links       -P, --physical          physical walk, do not follow symbolic links           --restore=file      restore ACLs (inverse of `getfacl -R')           --test              test mode (ACLs are not modified)       -v, --version           print version and exit       -h, --help              this help text     [root@localhost share]#


Can I Share Localhost With Other Users Of My Linux Box?

Firstly, I admit I am a Linux / Apache nOOb, so I would really appreciate it if your answers are in plain English (smile) Is the apache localhost server available to all Linux accounts? If I use my Linux admin account to set up a web app in the /var/www/ directory, can people logged into other Linux accounts use that web app too by just typing in http://www.localhost/ in their web browsers? (I am talking about people who are at that computer, not people trying to access it over the internet). **The Scenario:** I will be setting up a web-based Point Of Sale (pos) system on a computer at one of our brick and mortar retail stores. (There is not internet access there). There will be two LINUX user accounts on that computer. One for me (the administrator) and one for the Sales People ("Sales"). So how should I set up apache so that the sales people can login to the Linux "Sales" user account and use the web-based app? By default, if the web app files are in the /var/www/ directory, can all Linux user accounts browse them in their web browsers just by going to `http://localhost/` Or do I need to do something else? (like set up a public_html directory ???)


Driver not showing in /sys/bus tree

I'm trying to bind the "rt3572sta" to a USB device that previously had the "rt2800usb" driver bound to it. I ran this:               $ sudo sh -c "echo [device-bus-id] > /sys/bus/usb/drivers/rt2800usb/unbind"      Where `[device-bus-id]` was 1-7. I then went to bind it to the "rt3572sta" driver, but for some reason that was not in `/sys/bus/usb/drivers`. How do I make it show up?


How to find in Linux if mule is running

When I try to get the status of `Mule` service in linux by this:               service mule status      I get this:               Usage: /etc/init.d/mule {start|stop|restart}      Apparently, mule service doesn't support status. How can I see that Mule is running then?


Debian experimental package refuses to install?

I keep getting this error:               ./binary: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./binary)      I tried the instructions here: http://superuser.com/questions/537683/how-to-fix-lib-x86-64-linux-gnu-libc- so-6-version-glibc-2-14-not-found But when I run `sudo apt-get -t experimental install libc6` it says the newest version is already installed, even though it clearly isn't because a) I just added experimental, and b) I still get that same error every frigging time I try to do anything. Is there any way I can get it to install? EDIT: To confirm that the experimental version isn't installed:               libc6:       Installed: 2.13-38       Candidate: 2.13-38


What's the difference between pkill and killall?

I know that `pkill` has more filtering rules than `killall`. My question is, what is the difference between:               pkill [signal] name      and               killall [signal] name      I've read that `killall` is more effective and kill all processes and subprocesses (and recursively) that match with `name` program. `pkill` doesn't do this too?


Why is Mono 3.x available specifically for OpenSuse and not other Linux (like Ubuntu)

The Mono download page has a download for OpenSuse but not any other version of Linux. Why is that, is OpenSuse better suited for Mono for some reason than say Ubuntu? We're developing on Macs using 3.2.5 and currently deploying to an Ubuntu (12.04) server using Mono 2.10. And notice some differences, especially artifacts in ServiceStack's razor engine but otherwise mostly ok. I tried installing 3.2.4 the long way around however the site just cashes on Ubuntu so had to roll that back to 2.10. I now need to rebuild the server anyway and would like to know if OpenSuse is the better image for us to use this time...?


SSH proxy laptop

I run a simple ssh proxy and I am always on the move with my laptop. Having to restart it every time I open the lid and connect to the internet.               sshpass -p password ssh -D 9999 root@myvpsip      Is it possible to have it start when my internet does then stop when the internet connection is terminated?               Network Manger     Cinnamon DE     Arch Linux x64


Native linux installation on another drive, alongside Windows 7

I have Windows 7 on my `C:` (primary) drive. Can I install another hard drive, and put Linux on it to ensure that there will be no conflicts?


Edit tree to output in custom format?

I'd like to get a custom output from the `tree` command, but unlike this question, I don't have a fixed format. I'd like to be able to give the command the format in an argument (for instance perhaps `-f=y`, `-f=yaml`,`-f=xml`,`-f=~/myformat.fmt`). Obviously this is a huge undertaking, but I feel it would be a good way to get to explore how some of the linux commands work under the hood, along with stretching my programming skills. Where should I start if I want to edit (and I presume compile etc) 'native' Linux commands? Are they baked in?


Debian installer - customize busybox and live system/environment

I'm trying to reinstall Debian on a netbook and do it without sloppy tricks so that I can repeat the process if necessary. Specifically, I'm trying to customize the installer to include the wifi firmware for the network adapter (non-free, so I had to include it manually) which I did successfully (by placing the deb in the `firmware` folder in the iso's root) but I still need to have some way to limit the download speed while the installer runs. I normally use `wondershaper` for this, so I tried placing the deb in the `pool/main/w/wondershaper` folder but that obviously doesn't work (as that directory is for what gets installed in the final system). So I tried to see if I could somehow run it from the installer terminal, but busybox doesn't even include `ifconfig` in the standard debian build, so I need to replace that busybox. No searching so far has yielded any clues as to what goes into the live installer system ( **not** the _installed_ system but the one the installer runs on top of). I've googled and searched the debian wikis but they don't seem to have information on how to modify what gets loaded here. Searching the iso also yields no answers as the only `busybox` is the package that goes into the installed system. The instructions mention the `.disk` directory in the iso's root, which has inclusion and exclusion lists for packages, but they aren't for what gets loaded during installation. Searching SE also yields no specifics on this question. To be clear, I do **not** want to automate anything aka preseed the installer (which is what I understand preseeding is). Also, I know how to get the desired busybox build (their ftp has prebuilt binaries that include what I need), so no problems there, I just don't know where to put it. Here's some links I've read:   * DebianInstaller/Modify/CD   * installer hooks   * modifying the iso   * DebianCustomCD   * DebianInstaller Modify   * customize and pack a debian image   * Installation of my custom debian iso failed   * How to custom build debian's busybox?   * What packages are installed by default in Debian? Is there a term for that set? Why some of those packages are `automatically installed` and some not?   * How to create a custom debian liveCD (customize which packages are preinstalled)? **tl;dr: How does one customize the system/environment that gets loaded during the debian installation?**


Force Firefox to remember passwords on particular sites

Usually, when I log into a website with `username` and `password`, Firefox asks whether it should remember the login details. When I click yes, next time I visit the website, the username and password fields are pre-filled, so that I can just click "OK" But on some websites, I don't get the option to remember the password, and the `username` and `password` fields are empty. Alternatively, only the username field is pre-filled, while the password field is empty. Is there a way to override this, so that I can always choose to save the passwords? # UPDATE: Preferably, I would like to achieve this without having to install yet another addon. I don't understand how websites tell the browser to not remember passwords, but whatever it is, it should be configurable. Perhaps via `userContent.css` and `userChrome.css` ?


Is there a Microsoft Publisher equivalent for LMDE?

I am running Linux Mint Debian Edition (LMDE) and I need a program like Microsoft Publisher that I can make fliers and pamphlets with. Is there a program like that available? Is it free?


Bash globbing and argument passing

I have the following simplified bash script               #!/bin/bash          files=("$@")          if [ "X$files" = "X" ]; then       files=$HOME/print/*.pdf;     fi          for file in "${files[@]}"; do       ls "$file";     done      If I pass arguments (file names) as parameters this script will print the proper file names. On the other hand, if I don't pass arguments, it will print               /home/user/print/*.pdf: No such file or directory      Why are the file names not expanded in this case, and how do I fix it? Note that I use the `files=("$@")` and `"${files[@]}"` constructs because I read that it is to be preferred over the usual "files=$*".


Can't set background wallpaper in Gnome 3

I am using Debian Testing and Gnome Flashback (but it behaves the same in standard Gnome Shell). It gives me plain white background, and I can't set my own. Also, the settings dialog for background looks funny: ![enter image description here](http://i.stack.imgur.com/zvYB2.png) Any ideas? Edit: I have noticed I got background image back when I turned off "Nautilus controlling desktop". Of course, I no longer see desktop icons this way. Update: I have installed Ubuntu (with Unity), keeping my /home partition. The same problem appears in Unity! I can't set desktop background.


How to record an interactice socat TCP/TLS session?

Socat is great for interactively testing line based human readable protocols like HTTP or IMAP. For example:               $ socat -d -d READLINE,history=$HOME/s.hist openssl:host:port,crnl,cafile=some.ca      For better analyzing I need to capture such an interactive session - i.e. the bytes received and sent. Just hardcopying the terminal output via e.g. `tux` is not enough, because client/server parts are not marked and characters like '\t' are lost/silently converted. Using `tcpdump` to capture helps only for unencrypted connections. Thus my question. The answer does not have to be socat-based. If another tool is better suited for that use case I would like to read about it. Bonus points for a solution where   * time stamps are recorded as well   * one can chose between interleaved recording (client/server side) or logging to separate files


Configure sendmail to send only

I want to configure sendmail only to send emails – not to listen and receive. In `/etc/mail/sendmail.conf` I’ve got:               DAEMON_MODE="None";     QUEUE_MODE="Daemon";      Iptables are disabled (temporarily; only for this test) But in `/var/log/mail/mail.log`               Nov 18 13:40:04 novy sm-msp-queue[13548]: rAIC9RiF012445: to=user@mydomain.com, ctladdr=root (0/0), delay=00:30:37, xdelay=00:00:00, mailer=relay, pri=390130, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]      When I set in `/etc/mail/sendmail.conf` `DAEMON_MODE="Daemon";` e-mails are successfully sent. Is that needed – to listen?


How to kill all processes that don't have specific parent process?

A parent process should always be running with N children process. I would like to run a script which will show/kill all children processes that don't have a parent process.               $ ps faux | grep process.pl     root 37140  0.3  0.1  61160 724   /process.pl [child]     root 22079 10.2  0.3 127332 64620 /process.pl [master]     root 22081  0.3  0.1  84752 26084   \_ /process.pl [child]


Unable to SSH into Puppy Linux, even though SSHD is running

I installed OpenSSH client and server on my Puppy Linux computer. That computer is behind a router. I tried to `ssh` into it over the internet (outside the router) but it times out. Also doesn't work if I try to `ssh` from the computer itself. `telnet` didn't work either, but I can successfully ping the computer.               sh-4.1# ssh [ip address]      hangs for a minute, then shows:               sh-4.1# ssh: connect to host [ip address] port 22: Connection timed out      I know `sshd` is running:               sh-4.1# ps | grep -i sshd     sh-4.1# 24312 root      0:00 /usr/sbin/sshd      The firewall icon on the taskbar in Puppy says "Firewall OFF". How do I check if ports are in use or blocked?


Midnight Commander: file size format

When dealing with large files in MC, I have difficulties counting the digits to get the order of magnitude of the file size (hundreds of MB, or tens of GB, etc.). Sometimes, I use the trick to press `insert` key, which highlights the file and shows the file size in a nicely formatted way (i.e. 123,456,789), which makes it a thousand times more readable. I am wondering if/how I could set up MC to show the file size in this format by default, in the `size` column. I assume, this has nothing to do with `locale`


How to differentiate USB flash drive and CD-ROM?

I want to differentiate an USB flash drive and a CD-ROM. My requirement is when I connect to a system only the CD-ROM should work, but not the USB key.


How to complete a script to move selective files and directories in a filesystem to another (dump) path in a different filesystem?

1) There is a filesystem, say FS1, having below files and directories :               drwx------    2         256 Jun 20 05:47 recovery_scripts     drwx------    2         256 Jun 20 05:47 sqllib     -rw-------    1           1 Jun 20 05:47 dummy     drwx------    2         256 Jun 20 05:47 lost+found     -rw-------    1           1 Jun 20 05:48 test     -rw-------    1           1 Jun 20 07:38 LAES201D.LOG      2) I want to move specific files and directories to another filesystem, say FS2, viz. :               drwx------    2         256 Jun 20 05:47 recovery_scripts     drwx------    2         256 Jun 20 05:47 sqllib     -rw-------    1           1 Jun 20 05:47 dummy     -rw-------    1           1 Jun 20 07:38 LAES201D.LOG      3) Rest of the files should remain in FS1 itself :               drwx------    2         256 Jun 20 05:47 lost+found     -rw-------    1           1 Jun 20 05:48 test      4) I want to come up with a script for the same. Please help.


Error unzipping file through ksh, unzip works through bash

I have an auto-generated zipfile `foo.zip` on a Red Hat server that needs to be extracted to a particular location `/bar`. This is done through an install script using ksh. When the script executes `unzip foo.zip -d /bar`, the following error is logged:               caution: zipfile comment truncated     missing 3232546375 bytes in zipfile     attempt to seek before beginning of zipfile      Executing the same command in bash extracts the zipfile without errors. Running `unzip -t foo.zip` gives me zero errors. What can be causing this?


Count number of sessions and email as a body

I want to create a script to achieve followings : 1.login to Essbase MaxL               essmsh -l admin password on localhost;      2.Count the number of lines in the output of command display session all;               display session all; | wc -l  < /filepath/filename.ext       3.Email the the counted number of lines to a set of recipients as email-body like below : **Total number of Sessions = bla-number**               display session all; | wc -l   > file.tmp     mailx -s "Subject" emailaddresses < file.tmp     rm file.tmp      how we can get all 3 through a single script ? **EDIT** Based on Casey's answer, the single script now I have :               #!/bin/bash          #Maxl zone starts.....     essmsh -l admin password -s localhost -i << EOF          spool on to 'output.txt';     display session all;     spool off;          EOF     #Maxl zone ends.....          wc -l output.txt  > file.tmp           mailx -s "Subject" emailaddresses < file.tmp     rm file.tmp


Why lfs couldn't use original host environment variables?

From the lfs doc: > The exec env -i.../bin/bash command in the .bash_profile replaces the > running shell with a new one with a completely empty environment, except for > the HOME, TERM, and PS1 variables. This ensures that no unwanted and > potentially hazardous environment variables from the host system leak into > the build environment. The technique used here achieves the goal of ensuring > a clean environment. What case will cause that problem? Is there any simple example?


Why does terminal cursor flash briefly

I am using Fedora 20, and whenever a new line opens in the command line terminal, the cursor, which is a solid black rectangle, flashes on and off about ten times, then remains steady. I think I have read somewhere that I can do something useful during the flashing period, but I have forgotten what it was, or where to find the reference again; or am I just imagining it? Please can someone confirm or explain this? In response to @sim's query about the terminal emulator:               [Harry@localhost ~]$ echo $TERM     xterm-256color     [Harry@localhost ~]$


What's the difference between various $TERM variables?

I tried vt100, vt102, vt220, and xterm by using `top`. But I can't find their difference. Is there any other term type? What's their difference?


On the command line, can I redirect output to a file WITHOUT >, >>, or | operators?

I am attempting to run a command on a CentOS virtual machine, and the API that I am using to run this command does not seem to allow the >, >>, or | operators. Also, I must use fully qualified paths for commands (eg. /bin/ls instead of just ls). I want to be able to send the output of a certain command to a file. How can I do this under these conditions? I could in theory execute a script that will do the redirect in a "proper" shell, but that's a pretty inconvenient option here.


Convert a .jpg to a one page .pdf at a certain location

I'm looking to convert a .jpg into a .pdf, where the .jpg is positioned at a certain coordinate say 30 pixels and centered. Right now I'm just using: `convert image.jpg image.pdf`


Limiting write rate of a device

How does one go about limiting the write/read rate of a device, E.G., USB drive, SD card? Motivation behind this question is covered here (superuser.com).


GParted LiveCD: Is there a version with a 64-bit kernel?

I'm trying to chroot with the GParted LiveCD onto an existing 64-bit system, attempting to fix grub.


How to make system startup to not wait on particular systemd service start

I have few virtual machines running under libvirt, and they are stared on the host system startup. This is controlled by libvirtd.service systemd configuration. This delays the availability of the host system tty until all the virtual guests are started. How should I configure systemd to not wait on successful start of libvirtd, and leave it to start in the background?


How to Add rules to IP Filter (Firewall in SCO)

I need to add a rule ( **allow any to any port 22** ) to my firewall, so that I can `ssh` remotely into my machine. I have had a look in the SCO OSR600 Documentation and I cannot find anything in there that will help me. **Update** I have managed to enable `ipfstat`:               #ipfstat enable      And now my firewall is active, I just need to add rules now. But where do I find the rules text file?


Set alias which doesn't send specified text?

**EDIT** I set a alias task in `~/.bashrc`. The following:               alias join="clear; screen -ls; screen -rx [<ID_OF_THE_RUNNING_SCREEN> quit]"      If i the task `join` is executed, the following has to pre-fill my commandline: `screen -rx` I will add `[<ID_OF_THE_RUNNING_SCREEN>] quit`. -- How does I have to edit the alias, that this will be my result? --


Send Fax with GSM modem on hylafax?

I have a couple of questions related to using a GSM modem for faxing.   1. I wanted to know if it's possible to send faxes with the hylafax-server from a GSM modem?   2. If possible can you please explain how one would go about setting this up and demonstrating how it would work?   3. Does this work well? Is it robust or does it work sporadically?


I have problem with postfix on debian after upgrading from squeeze to wheezy. Postfix was configured to sign messages using dkim-filter. Before update, everything was working flawlessly, now it fails on connection with service (tcp or unix sockets). I thought that maybe it was because of debian switch to opendkim, so I removed dkim-filter and installed opendkim - same problem. I even tried setting unix file socket connection instead of tcp option - same problem: `postfix/smtpd: warning: connect to Milter service unix:/var/run/opendkim/opendkim.sock: No such file or directory` or (with tcp/ip): `postfix/cleanup: warning: connect to Milter service inet:localhost:8891: Connection refused` I checked twice - socket file exists and service was listening on port 8891. What can I do to fix this?


How to launch a program in text only mode if it support silent running

I have got a java program, which support text file input and auto running, can i put it in background running without GUI ? It prompt cannot set display. while there is no concern to view the display, it can just run the file input and finish the job. any idea?


Suspend and edit previous single line commands

Say I want to modify the latter of some concatenated command line options, is it possible without killing the first command? Specifically I have compile and run scripts executed thusly:               > compile ; run      The compile is in progress (half way through two hour duration), but new information tells me I don't really want the "run" command to run anymore (it launches a lot of background processes I don't want to go clean up). Is there a way to accomplish this adjustment or should I just be smarter about how I string together commands in the future?


Looking for App - Productivity measurement

I'm looking for an application which logs my productivity, i.e. logging how long I've been working using LibreOffice, Firefox, or whatever. My request is similar to this: https://productivity.stackexchange.com/questions/3803/time- tracking-software-to-measure-when-im-active-or-idle-on-my-computer-i-e But unfortunately none of them works completely offline ( no data being sent to company XYZ) and is available for scientific linux.


Audio CD source plugin for .wav files . Linux

I have a CD which contains a number of .wav files. When I try to open one I get: > The playback of this movie requires a Audio CD source plugin which is not > installed. Can someone please sent me a link to what I should download and install to play these files? My OS is Scientific Linux 32 bit .


Debian can't reboot and asking for root password (maintenance)

I'm experienced some file system errors on Debian (seems caused by RAID controller). Files system now seems fixed. I reinstalled broken packages with some broken config files. System boots normally. All services working. Problem is if try reboot machine last message is something "unmounting all file systems". And after this message system asking for root password (looks like maintenance mode). How to solve this ? Maybe something wrong with initscripts ? Any suggestions ? EDIT: For me it looks like software problem.


Wrong number of 'clicks' from mouse & drops click and hold, then picks it up again

The issue I am experiencing is the same as the one in this post. This is happening on two different machines, using two different models of mice. While both mice are Logitech, one is a wireless 2-button w/scroll wheel and the other is wired 4-button w/trackball. Both machines are running Ubuntu, though the one with the 2-button mouse has 12.04 on it and the one with the 4-button has 14.04. The big difference between the issue I have and the post I linked, is that his issue started after installing an Nvidia driver. The 12.04 machine uses and Nvidia driver, the 14.04 doesn't. The major strangeness is that the mouse behavior began (on both machines) seemingly without change to either system. I have intentionally NOT updated the 12.04 machine for many months now and have not installed any new software on it. On the 14.04 machine, the behavior began while 12.04 was still on it... I was hoping a distribution upgrade would fix things. No big surprise, it didn't. In fact it is now worse on the 14.04 machine. I tried adding an xorg.conf file, with configurations to enable 3-button emulation, and while 3-button, trackball scrolling, etc. now work, the click, double click, triple click, and 'dropping' the left click & hold are still present.               Section "InputClass"         Identifier  "Marble Mouse"         MatchProduct "Logitech USB Trackball"         MatchIsPointer "on"         MatchDevicePath "/dev/input/event*"         Driver "evdev"         Option "ButtonMapping" "1 2 3 4 5 6 7 8 9"         Option "EmulateWheel" "true"         Option "EmulateWheelButton" "8"         Option "ZAxisMapping" "4 5"         Option "XAxisMapping" "6 7"         Option "Emulate3Buttons" "true"     EndSection      The above is from the Ubuntu Wiki. I created an `xorg.conf` file because no `50-marblemouse.conf` file existed. Can anyone shed any new light on this issue? Thank you for your time!


rtorrent: 'Tracker Timeout' caused by IPtables

I'm trying to secure my rtorrent-running-homeserver with IPtables. With the aim to allow only incoming connections to the rtorrent port 6890 and 5292 for ftp (both are forwarded by the router), I wrote the following rules:               # Allows all Connections from localhost (necessary for scgi port 5000 of rtorrent):     iptables -A INPUT -s 127.0.0.1 -p tcp -j ACCEPT      iptables -A INPUT -s 127.0.0.1 -p udp -j ACCEPT               # Allows all Connections from 192.168.2.* (local network) and 192.168.10.* (local vpn network)     iptables -A INPUT -s 192.168.2.0/24 -p tcp -j ACCEPT     iptables -A INPUT -s 192.168.10.0/24 -p tcp -j ACCEPT               # Allows all input-Connections on port 6890 (rtorrent) and 5292 (ftp)     iptables -A INPUT -p tcp --dport 6890 -j ACCEPT     iptables -A INPUT -p tcp --dport 5292 -j ACCEPT               # Blocks everything else     iptables -A INPUT -p tcp -j DROP      If the rules are active, I get the error `'Tracker: Timeout was reached'`. Without everything is running like a charm. So it seems to blame on my iptables-rules. Is there anyone who may help?


How to do integer & float calculations, in bash or other languages/frameworks?

Using `echo "20+5"` literally produces the text "`20+5`" What command can I use to get the numeric sum, e.g. `25` in this case. Also, what's the easiest way to do it just using bash for floating point, e.g.   `echo $((3224/3807.0))` gives `0` :( Using either the basic command shell ('command line') itself or through using languages that are available at the command line.


Multiply 2 array index variables shell programming

How do i multiply 2 array index variables given the following               foo=(1 2)     bar=(0.1 0.2)          foobar=$((foo[1]*price[1])) # this is wrong          echo "$foobar"      Current output : `0` Correct/Expected output : `0.4`


Divide a variable by a number?

Basically I need to convert centimetres to inches which I am trying to do by diving the area in centimetres by 2.54. But I just cannot get this to work.               echo "please enter width and then height"          read width     read height          area=$(($width * $height))     inchesarea=$((area / 2.54))          echo $area     echo $inchesarea      Should I be using `bc` for this?


Reading package lists...Error!

When I run `sudo apt-get update` I get this error:               Reading package lists... Error!     E: Unable to parse package file /var/lib/dpkg/status (1)     E: The package lists or status file could not be parsed or opened.      What each line is saying and how to solve it? I'm running Linux Mint 17 Qiana Cinnamon in VMWare Workstation 10.0.2.


"mount: / is busy" when trying to mount as read-only so that I can run zerofree

I am trying to run `zerofree` on Ubuntu 11.04 so that I can compact the VirtualBox vdi image using:               VBoxManage modifyhd Ubuntu.vdi --compact      In order to run `zerofree` the disk image has be mounted as read-only. I'm following these instructions which says to use this to remount as read-only from the recovery mode (Drop to root shell prompt):               mount -n -o remount,ro -t ext2 /dev/sda1 /      But when I do this I get the error:               mount: / is busy      Any ideas on how to do this? **Follow up** : Following Jari's answer and this post by running these commands resolves the issue.               service rsyslog stop     service network-manager stop     killall dhclient


Starting at a runlevel with no networking, but networking starts

I am running LMDE, a distro based on debian testing. First, neither upstart nor systemd is installed on my computer. I run sysv-rc-conf and uncheck all the services. I then shutdown, reboot and during boot set the runlevel to 5 ( via grub menu ) When boot finishes I check the runlevel what is printed is : N 5. I try to ping google, and it succeeds. ifconfig shows eth0 and lo. The contents of /etc/rc5.d is:               K01anacron         K01fancontrol     K01minidlna           K01rmnologin          K01sudo             K02xdm     K01atd             K01fetchmail      K01minissdpd          K01rsync              K01timidity         K03acpid     K01autokey         K01gdomap         K01motd               K01samba              K01virtualbox       K03dbus     K01binfmt-support  K01gpm            K01nethack-common     K01samba-ad-dc        K01webmin           K03postgresql     K01bluetooth       K01gpsd           K01nfs-kernel-server  K01saned              K01xinetd           K05rsyslog     K01bootlogs        K01hddtemp        K01nmbd               K01sendmail           K02avahi-daemon     K07nfs-common     K01cgroupfs-mount  K01hyperestraier  K01ntp                K01slashem-common     K02cups             K07portmap     K01cpufrequtils    K01irkerhook-lxc  K01openvpn            K01smartmontools      K02exim4            README     K01cron            K01jetty          K01pcscd              K01smbd               K02gdm3     K01cups-browsed    K01lirc           K01plymouth           K01speech-dispatcher  K02kdm     K01dirmngr         K01loadcpufreq    K01pulseaudio         K01ssh                K02network-manager     K01dovecot         K01lxc            K01rc.local           K01stunnel4           K02winbind      So why does networking start for me?


How can I add Mageia 2 to my YUMI MultiBoot USB Drive?

After a bit of googling I read that YUMI can handle Mageia from the Mageia forums.   Unfortunately after trying YUMI there doesn't seem to be any support for Mageia.   I asked on the official Mageia forums and received no reply, so I thought I'd ask here! My YUMI USB drive has:               Ubuntu 12.4.1 x86_64 DVD     Linux Mint 13 x86_64 DVD (Cinnamon)     Fedora 17 x86_64 Live (KDE)      All working correctly. I really want to add Mageia 2 to this list! A bit unsure where to start though? I've tried XBoot which after bringing up the boot menu, refused to load any of the distributions (halted at `cmain()` - even though they worked in VirtualBox?). MultiSystem refuses to recognize my FAT32 formatted USB drive mounted in /media within Ubuntu.   So I'm left with YUMI and trying to get Mageia 2 working with it! Can anybody point me in the right direction please?


Sending binary data to gets()

I have a victim program (with a buffer overrun vulnerability): it uses gets() to write into a fixed-sized buffer. Suppose I put shellcode into a file SC. Then I run               $ ./victim < SC     Input your data:      $      The reason the shellcode does not seem to work is this: SC is redirected to the victim, injects the shellcode, causes a shell to spawn, but the spawned shell finds its stdin is closed, so immediately exits. I tried `expect` for the injection, but `expect` bombs after the shell spawns. It seems like the only practical way is to get the shellcode into my mouse's paste buffer so I can inject it while retaining the keyboard as the input device. But I have no idea how to get binary data into my paste buffer. Any ideas on how to get around this issue?


spawning multiple Background processes

I have a file which has `2,000,000` lines in it. I am running some commands for each line. I was trying to achieve some parallelism using `GNU-parallel` and `swift` as discussed here. However, I got an interesting idea from one of my friends. He was suggesting to spawn multiple processes in the server since the server is pretty powerful. I was thinking if I use an index for each line of file, I could spawn multiple processes based on the `totallines mod number_of_processes`. For example, **if line_numbers are 1,11 and 21, it will be sent to first process and if line numbers are 2,12 and 22 it will be sent to second process so on.** To achieve the above, I was going through background processes in shell scripting. In most of the tutorials/links, they are appending an `&` to the command and telling that a background process will be spawned by the computer. I am finding it little difficult to understand this concept.


how to get the return value of wpa_supplicant?

My question is really simple I want to get the return value of the command `wpa_supplicant`, when connected to the internet, to know that I am connected or not with a shell script.


Cron job not executing

I'm trying to use `cron` for the first time, and I'm stuck. I'm using Ubuntu 10.10, and the following is my `/etc/crontab` file. The only modification that I've made is appending the last line. I've verified that `cron` is running, and the other jobs here run, but the last one does not.               # /etc/crontab: system-wide crontab     # Unlike any other crontab you don't have to run the `crontab'     # command to install the new version when you edit this file     # and files in /etc/cron.d. These files also have username fields,     # that none of the other crontabs do.          SHELL=/bin/sh     PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin          # m h dom mon dow user  command     17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly     25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )     47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )     52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )     #     21 22   * * *   root    /etc/mycron/myscript.sh > /home/me/stuff/log/cron.log      I've checked `$ sudo grep CRON /var/log/syslog` and found evidence of the hourly jobs, but nothing for the new job. I've looked for `cron.allow` and `cron.deny` files, but they don't seem to exist on my machine. Being fairly new to Linux, and completely new to `cron` and `crontab` there are so many things that I might be doing wrong, I appreciate any suggestions.


How do I unset a variable in bash

I have tried the following command to set Proxy on `yaourt`:               export ALL_PROXY=http://proxy.example.com:8080      The question is how to unset the proxy on `yaourt`? In general how can I unset the value of a variable in current bash shell?


How to run the EDKnrc code

I have installed the EGSnrc code on a LINUX system and want to use the EDKnrc code for a "dose distribution" in the spherical Phantom, how can I run this code? can this code is run by the GUI similar to BEAMnrc?


IPTables 1.4.7 dropped allowed packet

When looking in the `/var/log/messages` file I found this line: > May 23 10:56:02 localhost kernel: IP4T Invalid TCP flags IN=eth0 OUT= > MAC=70:5a:b6:ec:95:6b:00:23:48:ad:b0:a4:08:00 SRC=A.B.C.D DST=192.168.1.27 > LEN=40 TOS=0x00 PREC=0x00 TTL=116 ID=27653 DF PROTO=TCP SPT=443 DPT=58520 > WINDOW=0 RES=0x00 ACK RST URGP=0 I have these `iptables` rules in the `filter` table:               Chain INPUT (policy DROP 0 packets, 0 bytes)     num      pkts      bytes target     prot opt in     out     source               destination     1           0        0 TCPFlagsCheck  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0     2           0        0 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            192.168.1.27        tcp spt:80 state ESTABLISHED     3           0        0 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            192.168.1.27        tcp spt:443 state ESTABLISHED     4           0        0 ACCEPT     udp  --  eth0   *       192.168.1.1          192.168.1.27        udp spt:53     5           0        0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4          Chain FORWARD (policy DROP 0 packets, 0 bytes)     num      pkts      bytes target     prot opt in     out     source               destination          Chain OUTPUT (policy DROP 0 packets, 0 bytes)     num      pkts      bytes target     prot opt in     out     source               destination     1           0        0 TCPFlagsCheck  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0     2           0        0 ACCEPT     tcp  --  *      eth0    192.168.1.27         0.0.0.0/0           tcp dpt:80 state NEW,ESTABLISHED     3           0        0 ACCEPT     tcp  --  *      eth0    192.168.1.27         0.0.0.0/0           tcp dpt:443 state NEW,ESTABLISHED     4           0        0 ACCEPT     udp  --  *      eth0    192.168.1.27         192.168.1.1         udp dpt:53     5           0        0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4          Chain TCPFlagsCheck (2 references)     num      pkts      bytes target     prot opt in     out     source               destination     1           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x10 /* R ACK */     2           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x18 /* R ACK PSH */     3           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x12 /* R SYN ACK */     4           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x02 /* R SYN */     5           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x04 /* R RST */     6           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x11 /* R ACK FIN */     7           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x19 /* R ACK PSH FIN */     8           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x14 /* R ACK RST */     9           0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x01 /* R FIN */     10          0        0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4 prefix `IP4T Invalid TCP flags '     11          0        0 DROP       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0      I had doubts so I wrote the same command to check if the rule is correct:               $ iptables -A TCPFlagsCheck -j RETURN -p tcp --tcp-flags ALL ACK,RST \         -m comment --comment "R ACK RST"      and this creates:               12          0        0 RETURN     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x14 /* R ACK RST */      Why was this packet dropped?


linux + perl + replace any WORD in file with special characters with condition

Example1 work fine when I want to replace OLD_TEXT with NEW_TEXT ( its replace also all special characters as $@^%)(_+`:; etc ..)                 example1            export OLD_TEXT='$$OLD_WORD$$'       export NEW_TEXT='$$NEW_WORD$$'                 perl -pe 'next if /^#/; s/\Q$ENV{OLD_TEXT}\E/$1$ENV{NEW_TEXT}$2/g' file       on example2 I add the "[[:^alnum:]]" in the perl syntax in order to ignore TEXT that start with alpha numeric characters or end with alpha numric characters but as all see it doesn't work why? remark: alpha numric characters means numbers OR [a-z][A-Z] Real Example                #example2 on LINUX machine:                 more file            ABC$$OLD_WORD$$ABC       $$OLD_WORD$$      .                  perl -pe 'next if /^#/; s/(\Q|[[:^alnum:]])$ENV{OLD_TEXT}(\E|[[:^alnum:]])/$1$ENV{NEW_TEXT}$2/g' file               $$NEW_WORD$$ABC$$$NEW_WORD$$$$$NEW_WORD$$OLD_$$NEW_WORD$$WORD$$$NEW_WORD$$$$$NEW_WORD$$ABC      . Example what I should get:                 more file                 ABC$$OLD_WORD$$ABC       $$NEW_WORD$$


What -A INPUT -j REJECT --reject-with icmp-host-prohibited Iptables line does exactly?

What do the following lines do? I have been reading redhat iptables documentation but can't figure it out. ... -j REJECT **--reject-with icmp-host-prohibited**   ... -j REJECT **--reject-with icmp-host-prohibited**


What's the difference between LPIC-1 version 3.5 with version 4.0.0?

Can someone please explain to me what's difference in chapter headings on _LPIC-1_ version 3.5 and LPIC-1 version 4.0.0 ? May introduce me some good and comprehensive book relate to LPIC-1 version 4.0.0 or any other recent version.


How to restore a system?

I have a disk image from Acronis True Image 2011. My original disk, of 40 GBs, had 2 partitions, 1 for FS and 1 for swap, but it started to fail. I've tried to make a backup, which finished with some read errors. Then, I've tried to restore it in a 160 GB disk, selecting the 2 partitions, and MBR and track 0. The thing is that it is not booting, I only see a `_` in the screen and nothing happens. The question is if it is possible to re-install Debian, and then copy ALL the `/*` files, to get my programs and data back, or is more difficult than that.


Change Initramfs script

I made RAID 0 by `mdadm'`ing partition located on dmraid VIA VT6421 and Western Digital hdd. Installed Ubuntu on that RAID. Now, when I boot, I get `(initramfs)` ash prompt. There, I have to write               mdadm --stop /dev/md1     mdadm --assemble --scan      And hit `Ctrl`+`D` to resume. Then Ubuntu loads normally. I'd like to change that behavior to save my time. So, I need to change some script located in `/scripts` directory of initial ramdisk. But everything I know about `initramfs` is that it is gzipped. I looked into `update-initramfs` but didn't find the clue yet. Also, I'm afraid doing something there unless I know what I'm doing. How do I change my initramfs script? UPD: Now I know I should               gunzip -c initrd.img-3.13.0-24-generic | cpio -id      Then make my changes and recreate it with               find . | cpio -o | gzip -c >/boot/initrd.new.img-3.13.0-24-generic      But I still don't know which scripts I should edit. UPD2: `sudo parted -l`               $ sudo parted -l     Model: JetFlash Transcend 32GB (scsi)     Disk /dev/sda: 32,1GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start  End     Size    Type     File system  Flags      1      131kB  32,1GB  32,1GB  primary  fat32        boot, lba               Model: WD My Passport 074A (scsi)     Disk /dev/sdb: 1000GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start   End     Size    Type     File system  Flags      1      1049kB  1000GB  1000GB  primary  ntfs               Model: ATA WDC WD1600JS-22M (scsi)     Disk /dev/sdc: 160GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start   End    Size   Type     File system     Flags      1      1049kB  160GB  160GB  primary  linux-swap(v1)               Error: Can't have a partition outside the disk!                                     Model: ATA WDC WD5000AAKS-0 (scsi)     Disk /dev/sde: 500GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start  End  Size  Type  File system  Flags               Error: /dev/mapper/via_ecedbfaihb6: unrecognised disk label                         Model: Linux device-mapper (linear) (dm)     Disk /dev/mapper/via_ecedbfaihb5: 524MB     Sector size (logical/physical): 512B/512B     Partition Table: loop          Number  Start  End    Size   File system  Flags      1      0,00B  524MB  524MB  ext4               Error: Can't have a partition outside the disk!                                     Model: Linux device-mapper (linear) (dm)     Disk /dev/mapper/via_ecedbfaihb2: 167GB     Sector size (logical/physical): 512B/512B     Partition Table: loop          Number  Start  End    Size   File system  Flags      1      0,00B  167GB  167GB  ntfs               Model: Linux device-mapper (linear) (dm)     Disk /dev/mapper/via_ecedbfaihb1: 367MB     Sector size (logical/physical): 512B/512B     Partition Table: loop          Number  Start  End    Size   File system  Flags      1      0,00B  367MB  367MB  ntfs               Error: Can't have a partition outside the disk!                                     Model: Linux Software RAID Array (md)     Disk /dev/md1: 320GB     Sector size (logical/physical): 512B/512B     Partition Table: msdos          Number  Start   End     Size    Type     File system     Flags      1      1049kB  6494MB  6493MB  primary  linux-swap(v1)      2      6494MB  27,5GB  21,0GB  primary  ext4      3      27,5GB  320GB   293GB   primary  ext4      Transcription:   * `/dev/sda` & `/dev/sdb` each of 500GB is fakeraid named `via_ecedbfaihb`,    * Win8.1 reserved partition on `via_ecedbfaihb1` (390MB),    * Win 8.1 system partition on `via_ecedbfaihb2` (160GB),    * extended partition `via_ecedbfaihb3`,    * linux boot partition `via_ecedbfaihb5` (500MB),    * mdadm 1st partition `via_ecedbfaihb6` (159GB),    * data partition `via_ecedbfaihb7` with the rest of space   * `/dev/sdc1` mdadm second partition (159GB),    * `/dev/md1` made of via_ecedbfaihb6 and sdc1,    * `/dev/md1p1` swap (6GB),    * `/dev/md1p2` extended,    * `/dev/md1p5` root (20GB),    * `/dev/md1p6` home (~300GB)


X11 forwarding over ssh

I used to log into a remote server on our corporate network using Xephyr and ssh using the following command               Xephyr :0 -ac -br -screen 950x540 | xterm -bg black -fg white -display :0 -e ssh -Yf jidicula@lxsim gnome-session &      where :0 is the display from ENV. This used to work for me, however I got upgraded to a new mac pro machine and this no longer works for me. Would someone be able to help me with this. I understand what this is doing and I made sure to have Xephyr and XQuartz on my new machine so I am kinda baffled as to why this no longer works.


how to escape unusual/uniq characters from expect scripts?

in expect script I can set any command or character to run it on remote machine but the sad thing is that expect cant send the same character as they defined in the expect script for example I want to run this line from expect script in order to change IP address from **10.10.10.10** to **1.1.1.1**                   expect #  {send "perl -i -pe 's/\Q10.10.10.10\E/1.1.1.1/' /etc/hosts\r"}      but when I run the expect screen actually I see this line runing on the console:                  [root@localhost ~]# perl -i -pe 's/Q10.10.10.10E/1.1.1.1/' /etc/hosts      pay attention that the backslash before Q and before E was Disappeared so I wonder hoW to escape those characters from expect script? so expect will run the same line on the console as following                  [root@localhost ~]# perl -i -pe 's/\Q10.10.10.10\E/1.1.1.1/' /etc/hosts        * REMARK set a backslash "\" before backslash doesn’t help!!! my script:                #!/bin/ksh           #      expect=`cat << EOF      set timeout -1      spawn  ssh  192.9.200.10             expect {                      ")?"   { send "yes\r"  ; exp_continue  }                           word:  {send secret1\r}                   }       expect #  {send "perl -i -pe 's/\\Q10.10.10.10\\E/1.1.1.1/' /etc/hosts\r"}       expect #    {send exit\r}       expect eof       EOF`                 expect -c  "$expect"       RESULTS ( after I run my script: )                  spawn ssh 192.9.200.10         root@'192.9.200.10 s password:         Last login: Sun Aug  4 22:46:53 2013 from 192.9.200.10          [root@localhost ~]# perl -i -pe 's/Q10.10.10.10E/1.1.1.1/' /etc/hosts         [root@localhost ~]# exit         logout              Connection to 192.9.200.10  closed.


Restricting who can send to an email address

I'd like to do so that only certain From: addresses can send to an email address (mailing list) on an Ubuntu system running Postfix. Understanding the Postfix the manuals are requires a lot of knowledge, so I'm hoping to get a complete recipe I can use. Currently this is what I have:               /etc/postfix/main.cf:     smtpd_recipient_restrictions =       check_recipient_access hash:/etc/postfix/protected_destinations     smtpd_restriction_classes = insiders_only     insiders_only = check_sender_access hash:/etc/postfix/insiders, reject          /etc/postfix/protected_destinations:     protected.list@example.com insiders_only          /etc/postfix/insiders:     allowed.user@example.com OK     another.allowed.user@example.com OK      This gives:               fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit      I am open to any suggestions. It doesn't have to be Postfix. It can be procmail or any other standard solution. Note: the recipient is a mailing list, and thus does not have a user account on the system account. So any solution must work without an account. **Edit: The mailing list is currently implemented like below. (By the way, is there a way to put all the recipients of the list in a separate newline- separated file, because they are many.)**               /etc/postfix/virtual:     protected.list@example.com user1@example.com, user2.example.com, ...


Lazy regex using Bash

I'm trying to match just the text contained within the HTML tags using Bash's built-in regex function:               string=' foo'     regex=' (.+?)'     [[ $string =~ $regex ]]     echo "${BASH_REMATCH[1]}"      But the match keeps capturing `foo</span>`. The internet is so crowded with examples of sed and grep that I haven't found much documentation on Bash's own regex.


Linux Mint 15 does not Hibernate

I just did an install of Linux Mint 15 Olivia with Cinnamon, and it's been running fine so far. However, I just tried to hibernate the system by doing Menu -> Quit -> Hibernate, and it just brings me to the lock screen. When I log back in however, I think I can tell it's trying to hibernate as it disconnects from my wireless. Has anyone else had/solved this issue? Edit: It's a Lenovo X201t, and `uname -r` gives `3.8.0-19-generic`. Edit2: Using integrated graphics, Intel HD 3000. 6GB of RAM and SWAP.


kdm.log getting filled with odd errors

So for some reason when kdm is started, or a user log outs kdm will put 30,000+ lines of errors like this into /var/log/kdm.log. It trys to read every file in / and will but a error in the log for every line in those files. I'm not sure what is telling it to read files in / but as you can imagine this is getting rather out of hand. I know I could just logrotate them out but I would rather fix the core of the problem. Here is the kdm version info               # yum info kdm.x86_64      Loaded plugins: langpacks, puppetverify     Installed Packages     Name        : kdm     Arch        : x86_64     Version     : 4.11.3     Release     : 1.fc19     Size        : 1.5 M     Repo        : installed     From repo   : BASE_REPO     Summary     : The KDE login manager     URL         : https://projects.kde.org/projects/kde/kde-workspace     License     : GPLv2     Description : KDM provides the graphical login screen, shown shortly after boot up,                 : log out, and when user switching.      Here is parts of the log file.               "KConfigIni: In file /jmxsh-R5.jar, line 3722: " Invalid entry (missing '=')      "KConfigIni: In file /jmxsh-R5.jar, line 3723: " Invalid entry (missing ']')      "KConfigIni: In file /jmxsh-R5.jar, line 3724: " "Invalid escape sequence "\K"."      "KConfigIni: In file /jmxsh-R5.jar, line 3724: " "Invalid escape sequence "\b"."      "KConfigIni: In file /jmxsh-R5.jar, line 3726: " Invalid entry (empty key)      "KConfigIni: In file /jmxsh-R5.jar, line 3727: " Invalid entry (missing '=')      "KConfigIni: In file /jmxsh-R5.jar, line 3728: " Invalid entry (missing '=')      "KConfigIni: In file /jmxsh-R5.jar, line 3729: " Invalid entry (missing '=')      "KConfigIni: In file /jmxsh-R5.jar, line 3730: " Invalid entry (missing '=')      "KConfigIni: In file /jmxsh-R5.jar, line 3731: " "Invalid escape sequence "\%"."      "KConfigIni: In file /.readahead, line 893: " Invalid entry (missing '=')      "KConfigIni: In file /.readahead, line 894: " Invalid group header.      "KConfigIni: In file /.readahead, line 895: " Invalid entry (missing '=')      "KConfigIni: In file /.readahead, line 896: " Invalid entry (missing '=')      "KConfigIni: In file /.readahead, line 897: " Invalid entry (missing '=')      "KConfigIni: In file /.readahead, line 898: " Invalid entry (missing '=')      "KConfigIni: In file /.readahead, line 899: " Invalid entry (missing '=')      "KConfigIni: In file /.readahead, line 900: " Invalid entry (missing '=')       I have also already tried to update it to the latest version and I get the same results.


F20 Unable to hibernate, /sys/power/disk disabled

When I try to hibernate with `systemctl hibernate`, the unit `systemd- hibernate.service` enters failed state and I get the following entries in my journal:               Feb 09 14:18:14 pike systemd[1]: Starting Sleep.     Feb 09 14:18:14 pike systemd[1]: Reached target Sleep.     Feb 09 14:18:14 pike systemd[1]: Starting Hibernate...     Feb 09 14:18:14 pike systemd-sleep[2284]: Failed to write mode to /sys/power/disk: Operation not permitted     Feb 09 14:18:14 pike systemd[1]: systemd-hibernate.service: main process exited, code=exited, status=1/FAILURE     Feb 09 14:18:14 pike systemd[1]: Failed to start Hibernate.     Feb 09 14:18:14 pike systemd[1]: Dependency failed for Hibernate.     Feb 09 14:18:14 pike systemd[1]: Service sleep.target is not needed anymore. Stopping.     Feb 09 14:18:14 pike systemd[1]: Unit systemd-hibernate.service entered failed state.     Feb 09 14:18:14 pike systemd[1]: Stopping Sleep.     Feb 09 14:18:14 pike systemd[1]: Stopped target Sleep.      Indeed `cat /sys/power/disk` tells me:               [root@pike ~]# cat /sys/power/disk     [disabled]      My swap looks like this:               [root@pike ~]# swapon -s     Filename                Type        Size    Used    Priority     /dev/dm-0                               partition   16383996    0   -1      It is on the LVM and is called `/dev/fedora/swap`. My RAM size is 16248756 bytes, so the image should fit into swap. Suspend-to-RAM works as expected, and with other distros (Ubuntu, Arch) I was able to hibernate previously. How can I find out why `/sys/power/disk` is [disabled]?


SSH into servers each with different subdomain over one IP

I have several Ubuntu VMs (bridged) behind a router that I want to access remotely. I've also got an nginx reverse proxy that handles the port 80 traffic like this: sub1.example.com -> server1 via 192.1.168.1:81 sub2.example.com -> server2 via 192.1.168.2:82 sub3.example.com -> server3 via 192.1.168.3:83 Is there some kind of server that can proxy ssh sessions to each of these servers so that I could use only `ssh user@sub1.example.com`, `ssh user@sub2.example.com`, etc.? I'm aware of the alternative of specifying the port `ssh -p2022 user@sub1.example.com` to access the correct server but I would prefer the succinctness that a proxy could provide. **Edit:** Each of my servers can be listening on different ports.


How do I make find follow most, but not all, symbolic links?

My OS and home directory are on an SSD. I store some large files on a hard disk, and symlink from my home directory to the hard disk (eg. ~/Videos/Films is a symlink to /mnt/hdd/Films). I also have a number of Wine prefixes, each of which has dosdevices/z: symlinked to /. So, if I used find without -L, it will miss everything that's on the hard disk. But if I use find with -L, it ends up in a loop due to Wine's symlink to /. Is there any sensible way of resolving this, so that find searches where I want it to? Intuitively, I'm wanting something along the lines of "follow symlinks, unless they're under a directory called dosdevices". "Follow symlinks that are to something on the hard disk" would work too.


Boot Repair taking a very long time, stuck on "Create a BootInfo summary"

I moved my Linux Mint installation to a new HD since the old one was becoming a little unstable. I'm running Boot Repair from a live CD to get Grub configured, and everything else finished very quickly. But now it's been on "Create a BootInfo summary (url)" for like 45 minutes. Is this normal? If not, what can I do about it?


Does "rpm --test" verifies the dependencies too?

The manual only says "--test" only checks for conflicts:               hostname:~/foo# rpm -ivh --test jdk-6u2-linux-i586.rpm     Preparing...                ################# [100%]     hostname:~/foo #      **Our question:** does it checks for dependencies too?


sed first n occurrences result set between 2 tags / patterns

I have a big XML file and I get all occurrences between 2 tags: Here is what I do:               sed -n '/<tag>/,/<\/tag>/p' file.xml      And I need to filter to get only first N occurrences. I've tried with l param but it was not enough :( So any one knows how to get N matched occurrences from all resultset? For Example. Here the xml file content :               <?xml version="1.0" encoding="UTF-8"?>     <root>     <tag>      <t1>john</t1>      <t2>john</t2>      <t3>john</t3>     </tag>     <tag>      <t1>john</t1>      <t2>john</t2>      <t3>john</t3>     </tag>     <tag>      <t1>john</t1>      <t2>john</t2>      <t3>john</t3>     </tag>     <tag>      <t1>john</t1>      <t2>john</t2>      <t3>john</t3>     </tag>     </root>           sed -n '/<tag>/,/<\/tag>/p' file.xml       returns all elements. So the goal is to filter to get the First n matched patterns ( Elements are multi-line) If n = 2 then result =:               <tag>      <t1>john</t1>      <t2>john</t2>      <t3>john</t3>     </tag>     <tag>      <t1>john</t1>      <t2>john</t2>      <t3>john</t3>     </tag>


Trying to load file to device via serial to USB adapter

So I have this device, and it's pretty old. It only has a serial interface. I have a cord that connects to it, and then to the serial port of a computer. This cord is plugged into a serial to usb adapter. I'm fairly certain it is attached, as I can use `picocom` to talk to it. Or, at least, I can listen to it. dmesg gives:               dmesg | grep tty     [    0.000000] console [tty0] enabled     [15037.544085] usb 3-3: pl2303 converter now attached to ttyUSB0      What I need to do is this: In my browser (and unfortunately, there's no way around this) there's a java applet which will connect to it and write the file appropriately. Unfortunately, it looks mainly for USB connections, and for whatever reason isn't seeing the device. I'll be honest: I know very little about serial ports and how they work, especially within a linux setting. So my question is: How do I hook this up and what do I do to it to make firefox/the java applet within firefox see it properly?


How To Convert .run Installer to .deb Installer?

I'm running Ubuntu 14.04. I have many 3rd party system libraries which I use for projects, but managing library installation is difficult. Some libraries are .deb files, some are built from source (which I then create a .deb from), and some are .run files. My goal is to have my own personal repository which hosts these 3rd party system libraries in the form of .deb files. My issue is converting .run files into .deb files. I've tried using checkinstall to run the .deb file (specifically the UEye camera drivers found here ), hoping that checkinstall would capture the modifications to my filesystem, but unfortunately that was a disaster. Are there any clean ways to turn .run files into .deb files?


A layman's explanation for "Everything is a file" — what differs from Windows?

I know that "Everything is a file" means that even devices have their filename and path in Unix and Unix-like systems, and that this allows for common tools to be used on a variety of resources regardless of their nature. But I can't contrast that to Windows, the only other OS I have worked with. I have read some articles about the concept, but I think they are somewhat uneasy to grasp for non-developers. A layman's explanation is what people need! For example, when I want to copy a file to CF card that is attached to a card reader, I will use something like               zcat name_of_file > /dev/sdb      In Windows, I think the card reader will appear as a driver, and we will do something similar, I think. So, how does the "Everything is a file" philosophy make a difference here?


Move boot disk on SAN storage on Solaris 10

I'm looking for some infos/official docs/howto for migrating boot disks in a production enviroment server from internal disks to SAN on Solaris 10. It's possible for every kind of hw? It's also possible in a Sun Cluster enviroment?


Can't boot Debian with windows installed first

I have Windows XP already installed on my HD and I had some space left to install Debian. After I've installed Debian, I answered yes to the Grub bootloader but when booting the computer nothing appears; no menu, only Windows automatically starts.. Why and what to do? This the second install and the problem still occurs. (Windows is new too but always installed first) Debian is still installed now. Edit1: -Grub was installed on the MBR of the first hard disk. -I can access Debian only when bootable usb is plugged in. Edit2: problem is solved now, by reinstalling -and for the third time Debian- but with a hd image installation method(the previous installations were done by netiso method)- But still I want to know Why this problem occurs with the netiso method? Why grub is not working when installed with netiso?


LAMP Hardening, Transparent Proxy with iptables

I'm running a LAMP server with FTP(S) and several users. The users have only access to uploading PHP files and other web content. Some are running Drupal and Wordpress, but also a few home made stuff. I already disabled all shell access attempts from php. But in order to fully protect myself, my server and my users from downtime, script kiddies and other nasty things I want to disallow RFI. Actually I don't want to allow any traffic (TCP & UDP) going out from my server that I don't allow to. For this task I want to make a transparent proxy that retrieves all packages before they are sent, making decisions if the packages should be allowed or not. I want to use Python for the task of making the decisions as it is easy to fetch allowed URL's from the local database. Like I want to allow certain API's / OAuth sources. How do I configure iptables to send all data (including destination ip and port), to my python application? Or is there any better way of doing this? My thought was just that if I can disable shell access and unauthorized network traffic I can sleep at night. Then no one can use my server as a bot in a botnet. And they can't email spam. What do you think? I don't want to rely upon Suhosin, since I'm using PHP 5.4 and later.


What's the best way to have uwsgi create a '/run/uwsgi' folder on reboot?

I have set up a Django project to run with uwsgi and nginx and it's all running as expected, except that when I reboot uwsgi will not launch correctly until the /run/ folder is recreated on the fs. /run is mapped to 'tmpfs' so it needs to be recreated at each boot. I have a systemd service file that I created for uwsgi:               [Unit]     Description=uWSGI Module     After=syslog.target          [Service]     ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi.ini     Restart=always     KillSignal=SIGQUIT     Type=notify     StandardError=syslog     NotifyAccess=main          [Install]     WantedBy=multi-user.target      And the `/etc/uwsgi.ini` file looks like this:               [uwsgi]     uid = uwsgi     gid = uwsgi     pidfile = /run/uwsgi/uwsgi.pid     stats = /run/uwsgi/stats.sock     socket = /run/uwsgi/uwsgi.sock     master = true     processes = 1     chdir = /path/to/our/django/app     module = icscada     max-requests = 100     daemonize = /var/log/uwsgi.log      **What is the recommended way for the`/run/uwsgi` folder to be recreated at each boot?** I would've also added the tag `uwsgi` but don't have enough rep yet.


How to make sure OpenVPN is connected?

I need some sort of "safeguard" for my VPN connection. If the connection drops, the machine shouldn't even reach the internet. (I can reach the machine by other means.) Is it possible somehow?   If I remember correctly, there are some "safeguards" for Windows, but I never heard about such a solution for Linux. Not to mention for cli.


zcat a file line by line?

I have written a C++ application that reads files line by line. It reads one line, does processing, then reads the next line. I would like to add support for gzipped files, and am looking to an alternative to using C++ decompression libraries. One solution is to decompress the entire file, then read it as usual. However, I'm dealing with very large files and I prefer the quick start-up time `zcat` provides by immediately decompressing the first lines of the file. The problem is that, left unchecked, `zcat` would decompress too much of the file too quickly for my application to keep up and the output buffer from the system command would quickly fill with a decompressed 10GB file while my application is still processing the first few lines. Is it possible to pause `zcat`, or tell it to only read one line at a time, only advancing when the user indicates?


Where is the bash feature to open a command in $EDITOR documented?

I have recently discovered that if we press `Ctrl`+`X` `Ctrl`+`E`, bash opens the current command in an editor (set in `$VISUAL` or `$EDITOR`) and executes it when the editor is closed. But it doesen't seem to be documented in the `man` pages.


How do I perform a reverse history search in ZSH's vi-mode?

I use `vim` for essentially all my editing needs, so I decided to once again try vi-mode for my shell (currently ZSH w/ oh-my-zsh on OS X), but I find myself trying (and failing) to use `Ctrl-R` constantly. What's the equivalent key-binding? And for future reference, how would I figure this out myself? I'm pretty sure I could use `bind -P` in bash.


How can I shrink a LUKS partition, what does `cryptsetup resize` do?

I am in progress of resizing a LUKS encrypted partition that contains a single ext4 filesystem (no LVM or something). The cryptsetup FAQ recommends to remove the old partition and recreate it, but that sounds like wasting a lot time. Therefore I want to proceeed by manually, carefully resizing the partition. So far, I think that I need to do:   1. **Create an (encrypted) backup of the filesystem. Important! You won't be the first to lose your data while performing the following tasks.**   2. Unmount the existing ext4 filesystem (e.g. by booting into a Live CD). If booting from a Live CD, mount the encrypted partition using `cryptsetup luksOpen /dev/sdXY ExistingExt4`   3. Resize the existing ext4 filesystem.   4. `cryptsetup resize /dev/mapper/ExistingExt4 -b $SECTORS`   5. Close/ "unmount" the LUKS partition using `cryptsetup luksClose ExistingExt4`   6. Shrink the partition size. **Are the above steps correct?** In step 4, **what should I choose for`$SECTORS`? Is this step even necessary?** The `cryptsetup` manual page is not really descriptive on the `resize` option:               resize <name>         resizes an active mapping <name>.         If --size (in sectors) is not specified, the size of the underlying         block device is used.      Finally, if I shrink the ext4 partition by 15 GiB, can I safely assume that 15 GiB can be removed from the existing partition using `parted`? If yes, how to do so? My disk is GPT partitioned, if that matters.


Open a specific application in a *new* workspace with i3wm

My question is something like this - but I don't want to open a given application on a specific workspace, I want each instance to open on a new workspace each time. The OP in the linked-to question wants to open Firefox on workspace 2, Chromium on workspace 1, etc... I want to open new instances of a text-editor (Sublime Text) in a new workspace for every new instance. Is this possible? _solution_ : I used the accepted answer in a modified form:               # .bashrc     ...     function sublime {       i3-msg workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))       /usr/bin/sublime_text_3/sublime_text $1     }      so that I can use it like this:               $ sublime /path/to/file      and also because I'm using my dotfiles across several computers, so it's nicer to include everything in one place!


Takeover delay in Heartbeat HA cluster

I have set up a heartbeat HA two node cluster. And both of server have same configuration of ha.cf               #cat /etc/ha.cf     logfile /var/log/ha-log     autojoin none     bcast eth1     warntime 20ms     deadtime 40ms     initdead 30     keepalive 5ms     node server1.com     node server2.com      I set keepalive and deadtime in milliseconds hoping failover will take place in less than second or deadtime value. But expected behaviour is not met. With this configuration if I stop heartbeat in one server another server will take only after about 20 seconds(rough estimate by a stopwatch). I was wondering is what heartbeat can only do or am I missing something?


What does “magic tests” mean for the file command?

I was reading about the `file` command and I came across something I don't quite understand: > file is designed to determine the kind of file being queried.... file > accomplishes this by performing **three** sets of tests on the file in > question: > >   * filesystem tests, >   * **magic** tests, >   * language tests > What are **magic** tests?


Raspberry pi running owncloud not reachable using no-ip URL

I have a problem reaching my raspberry pi from outside of my LAN and I don't remember having changed anything. It was working previously, but I don't know what changed. I've installed `owncloud` with `nginx` and `mysql` over HTTPS. If I try to access the server using it's local IP address everything works fine. Using the official URL with no-ip.biz spins for a while but ends in a blank page without any error. Do you have any ideas how to solve the issue? I recently updated the system but can't remember what might have changed since then.


How to change the default version of Python in Debian 7.5?

I'm using Debian 7.5, and I've installed Python 3.3 and 3.2. How do I make 3.3 the default for when someone types `python` in the command line?


Elementary OS dual boot with Windows 7

I just deleted a partition from my RAID 0 2x HDD, installed Elementary OS from a SD card USB adaptor (while doing it, I created a Root, a Home and a Swap partition) but I never saw the bootloader when I restarted my computer. So I installed EasyBCD and tried adding a Linux entry to the bootloader. It asked me the drive, I gave it the Root one. It also asked me the method to load the OS with. I tried it with GRUB and all I saw after trying to select Elementary OS was a black screen with a blinking _ (underscore). Then I tried with GRUB 2 and after rebooting and selecting the Elementary OS, it looked through all drives (I believe, the names were something like hd0 hd1 hd2) to find the OS. Not able to find it, I had a black screen with some things written and in the end a blinking _:               try hd0 blablabla     try hd1 blablabla      something like this. It also said while trying them what their file system was. Some were NTFS, some FAT and some EXT2 (although I used ext4 to install eOS). After all this, I'm stuck. Does anyone know anything that might help me? If needed, I can get the exact text in this GRUB2 screen.


Setting only of background or text color back to default

Is it possible to only reset the background color or text color back to default (not both!) Example:               echo -e "\033[32;41mFoo bar\033[30m baz" # Doesn't reset background color     echo -e "\033[32;41mFoo bar\033[0m baz" # Resets the background color and text color      Is there anyway to do this? I know I can assign the background color in the second statement, but the color will be unknown. (`echo -e "\033[32;41mFoo bar\033[0m baz"`)


What does "video output" mean in media players?

What does "video output" mean in the context of media players? Possible values are: `x11`, `xv`, `vdpau` etc. Are these drivers?


How to unset the positional parameters?

How do I do this:               set foo bar baz     unset # Something else here     echo $# # Should ouput 0      By doing `set ""`, `$#` will still be 1 and not 0.


Only output errors / warnings when compile kernel?

When you compile kernel you normally see lines like `CC XX.o` or `LD XX` So, can I skip these messages? Only output errors or warnings generated by gcc


What is the difference between console-data, console-setup, console-common and console-tools?

The debian packages `console-data`, `console-setup`, `console-common` and `console-tools` (maybe even more) all seem to do the same thing. What are the differences and which ones should I use?


Apache won't start on Fedora 15

I can't get Apache to start on Fedora 15. I downloaded a project into `/var/www/html` and changed myself to the owner (recursively), though I don't think I changed any SELinux contexts or anything like that. When I run `service httpd start` I get: > Starting httpd (via systemctl): Job failed. See system logs and 'systemctl > status' for details.   >  [FAILED] And when I run `httpd -k start` as root I get: > (98)Address already in use: make_sock: could not bind to address > 127.0.0.1:80 I'm not sure why but I think it has something to do with SELinux. Any ideas?


FTP download problems with iptables -- Port 21 connection is allowed but "Network is unreachable"

I'm trying to connect to an FTP site but with, e.g., `wget`:               Logging in as anonymous ... Logged in!     ==> SYST ... done.    ==> PWD ... done.     ==> TYPE I ... done.  ==> CWD (1) /gcrypt/gnutls ... done.     ==> SIZE v3.2 ... done.     ==> PASV ... couldn't connect to 217.69.76.55 port 40258: Network is unreachable      If I disable iptables, it works, so obviously that is the problem. Yet I'm sure I have everything set up properly:               # Accept related, established...     -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT     -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT          # ftp/http(s) clients     -A OUTPUT -p tcp -m multiport --dports 21,80,443,8080 -j ACCEPT     -A OUTPUT -p udp --dport 21 -j ACCEPT      What's wrong?


What are shmpages in laymans terms?

What exactly are `shmpages` in the grand scheme of kernel and memory terminology. If I'm hitting a `shmpages` limit, what does that mean? _I'm also curious if this applies to more than linux_


How to change what Alt+F2 calls in GNOME?

I saw something that made me salivate and I want it to be the program that is run when I do `Alt`-`F2`.


Why are newly created users assigned to primary groups of their usernames?

I've noticed that on a number of linux distributions that whenever a new user is created, it is assigned to a primary group of its own name. eg. If i create a user called "testuser", by default it is assigned to the "testuser" primary group. This causes all users to have their own unique primary groups. All these groups would also only ever have 1 user as it wouldn't really make sense to add other users to these groups. This is somewhat counter inituitive as "group" generally means "more than 1". These user primary groups are also generally useless when attempting to assign permissions to files/folders. Is there any reason this is the default behaviour on distros ? And any use cases where this behaviour is actually useful ? Why not assign all new users to a "users" primary group ?


Bash Conditional Statements

What are the three formats of conditional statements used in bash scripting?


Count how many times each line appears in a file

Say I have a file which contains:               A     A     A     B     CC      I want to have the output like this:               A 3     B 1     CC 1


Why store program code in /var/cache?

I have inherited a Java / Tomcat stack, running on Ubuntu. It has crashed and I am trying to restart it. The program code seems to be using a config file which I have found on the file system. The issue is I found this note in the handover:               the app code is in /var/lib/tomcat6/webapps/PCRTiler     config and helping files are in /var/cache/tomcat6/work/PCRTiler     /work/PCRTiler is a symlink for /var/cache/tomcat6/work/PCRTiler      There is no tomcat6 directory under /var/cache. I also cannot find a symbolic link in / called work. Would the link be destroyed if the underlying directory was removed? Is it standard practice to keep program-specific code in /var/cache, and is this directory in any way permanent? **EDIT** Found an install.sh script that seems to be copying to /var/cache and /var/lib               #!/bin/bash     rm -rf /var/lib/tomcat6/webapps/PCRTiler     rm -rf /var/cache/tomcat6/work/PCRTiler     mkdir -p /var/lib/tomcat6/webapps/PCRTiler     mkdir -p /var/cache/tomcat6/work/PCRTiler     cp -r * /var/lib/tomcat6/webapps/PCRTiler     cp -r /var/lib/tomcat6/webapps/PCRTiler/cache_skel/* /var/cache/tomcat6/work/PCRTiler     chown -R tomcat:tomcat /var/cache/tomcat6/work/PCRTiler     chown -R root:root /var/lib/tomcat6/webapps/PCRTiler     service tomcat6 restart


Cannot open shared object file when using D compiler

I had ldc2 and gdc compiled from source and working up until a month ago. Nothing has changed, except I can't remember the variable(s) I would set in the terminal to get ldc2 and gdc to work. I get the following errors when trying to compile D source code; with gdc (`$ /home/Code/D/gdc/Bin/usr/local/bin/gdc -o t4 t4.d`):   `/home/Code/D/gdc/Bin/usr/local/bin/../libexec/gcc/x86_64-unknown-linux- gnu/4.4.5/cc1d: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory` With ldc2 (`/home/Code/D/ldc2/bin/ldc2 -o t4 t4.d`):   `/home/Code/D/ldc2/bin/ldc2: error while loading shared libraries: libconfig++.so.8: cannot open shared object file: No such file or directory` I can't remember if it was just an addition to PATH or something to DFLAGS. Any ideas?


Tell autoconf to use different version of gcc

OpenBSD installs newer version of gcc as egcc. I am trying to compile some software that requires gcc 4.4+ and can't seem to convince autoconf to use the newer versions of gcc... I have tried:               # export CC=egcc     # $CC --version     #   egcc (GCC) 4.7.2     #   ...      and               # export CC=/usr/local/bin/egcc     # $CC --version     #   egcc (GCC) 4.7.2     #   ...      I even tried making symlinks to ~/bin and adding that to my PATH:               # cc --version     #   egcc (GCC) 4.7.2     #   ...          # gcc --version     #   egcc (GCC) 4.7.2     #   ...      and also:               # ./configure CC=egcc     # ./configure CC=/usr/local/bin/egcc     # CC=egcc ./configure     # CC=/usr/local/bin/egcc ./configure      But no matter what I still get:               configure: error: Only GCC 4.4 or newer supported      Will someone please show me the error of my ways!


How to take advantage of gnuplot internal functions by column reference at shell

I want to do something like:               echo "p 'myfile.txt' u 1:(exp($2))" | gnuplot -p      but need the shell to pass the `$2` as a literal into gnuplot.


sed with auto escape character

CommentAppend() {         # Comment line and append line below commented line          local comment="$1"      # search this line and comment it          local append="$2"       # Append this line below commented line          local InputFile="$3"                  sed -i "s/${comment}/#${comment}/g ; s/#${comment}/& \n${append}/" $InputFile     }      This function working fine for non escape character but when escape character available then it fail.. So We can build function, for escap character ?


Undoing specific iptables ip/port restriction

Say I add the following iptables rules:               iptables -A INPUT -p tcp -s localhost --dport 4444 -j ACCEPT     iptables -A INPUT -p tcp --dport 4444 -j DROP      This allows localhost to access port 4444 then blocks all other IPs from accessing port 4444... I now want to undo these previous iptables commands. What is the easiest way to "undo" that? e.g. allow all ips to access port 4444 again.


How to upgrade Magic Box?

I'm running Magic Box on Virtualbox. Magic Box is a portuguese Linux System, based off of SuSE. At least, that's what it said on the Linux Family Tree. The version I have is V.12. There's the most up-to-date versions, like version 20. How do i upgrade my system, though? Any suggestions would be great. :) The system has apt-get, but some commands or options aren't there. It uses KDE 3.5. It was updated as well. It has Synaptic Package Manager too.


Making proxies on Debian

Hi guys I am trying to create SOCKS Proxies on my VPS and currently am not getting too far so any help is well appreciated. Here's a few details on my VPS: It is running Debian linux, has 512mb ram as I figured that would be all I would need. I have 9 IP Addresses which all need to be make into SOCKS Proxies. I have tried Dante, but as far as I can see, it does not support multiple IP Addresses so I need a solution that will. I have also tried creating the proxies via SSH but any proxies made not on the Main IP Address of the VPS, will show up as the Main IP anyway. E.g if I connect to one of my proxies with the IP: `123.123.123.26` And go onto http://www.whatismyip.com/ , it will show up as the Main IP which is different like `123.123.123.94` Does anyone know a solution I could use to get multiple IP's running on my VPS which will show up as the actual IP that I connected to?


Could not commit to disk during OS Installation

I've tried several times to load Fedora 20 onto an Acer 5750z laptop, but during the installation I get an error message of "Could not commit to disk", switched the OS disk to Ubuntu 14.04 and received man error message that says "Input/ output error during read on /dev/sda". Is this telling me that the hard drive is bad?


Is it okay to run my system off a flash drive?

I've been running my main system off a Linux persistent LiveCD flash drive for a couple months. The drive has a 2 GiB fat32 boot partition, and a 12.91 GiB ext2 casper-rw partition. I'm running Linux Mint 16 Cinnamon 64-bit, and it's meeting all my (minimal) performance needs. Is this okay for my flash drive and for my computer? My RAM hovers around 40%-65% usage, and never needs swap (no thrashing), and it seems pretty fast for the most part. What, if anything, do I need to worry about here?


Is the $HOME environment variable always set on a Linux system?

Assuming the machine is running a Linux kernel, sessions make use of the Bash shell and everything is using default configurations (no user has made any changes to config files), can we assume that the `$HOME` environment variable is always set?


How to get differences between different distributions of linux

I tried out Red Hat, Ubuntu, Kali Linux. While working on them I searched for the difference between the distributions of Linux. One thing I got was the difference in **Package Management** , (.rpm and .deb). But I don't think it's only the difference. Secondly, while trying some commands on Kali Linux (like `quotacheck`), it's giving no results. So how can I know which distribution support which commands and also how to enable them? Thirdly, I read that Kali OS is based on Debian. So what does **based on** really mean?