Get current Virtual Desktop - number/name/tag/id?

How to get number and/or name (or tag/id... etc) of currently used virtual desktop ? Command line, scripting, C/C++ solutions allowed (, while portable to C/C++ are preferred). ;) I'm mostly interested in `KDE` and `GNOME`, as well as `dwm`, `xmonad`, `awesome` - solutions for other desktop environments are welcome (I would love to support as much as I can, in order to provide as universal solution as possible). Btw. For those interested, To be more specific about usecase: I'm interested in timetracking oriented around desktop + windows focus + xevents + multiplescreen. Currently there exist separate solutions for this (`ktimetracker` tracks tasks depending on desktops, while it's app tracking is very poor - no regular expressions support, just exact window titles -> not very usefull. On the other hand, `workrave` tracks keyboard and mouse activity, but is unaware of desktop->task I work on.), I'd like to do something, that merges those information in order to achieve more precise picture (maybe incorporating Association rule learning or other Data mining technique) of activities I have (in order to achieve more precise information related with my habits, in order with "ant-RSI fight" ;) ). So if your desktop follows in different paradigm, than "Virtual Desktop + Windows (with Names and Titles)" please, show code/cli snippet, that shows information about currently used window/frame/app + currently selected desktop/task/tags (eventually screen).


How to remotely turn "up" sounds?

So I have to Skype with someone, but he is not...well let's just say not a "geek", so I have to log in via SSH to his Fedora machine, and turn on sound [because he can't hear me when using Skype, but I can hear him, so the sound is turned off/too quiet on his side]. How?


installing column unix utility on windows

I would like to be able to use the BSD unix utilities: column, join and paste in my Cygwin installation. It seems that they are not available, or I cannot find them. Is there a way to install them so I can use them on Windows?


No nvidia drivers show up under restricted drivers

I am running Linux Mint 16 (but my experience has been consistent across other Ubuntu derivates including Xubuntu) on a Lenovo W540. I know there have been issues with linux compatibility for this machine, but I have just now been able to run all three monitors by docking and running in "Standard" mode (BIOS setting). However, I am unable to see any options for my nvidia card. The output of `lspci | grep -i vga` is:               vivin@serenity ~ $ lspci | grep -i vga     00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)     01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1100M] (rev a1)      But I am unable to see any drivers. I tried installing the nvidia drivers manually (downloaded them from the NVIDIA site) but simply succeeded in ending up with a `640x480` screen and cinnamon crashing. I haven't tried `nvidia-current` because on a previous install that simply gave me a black screen on login. I am wondering if I should go ahead and do this anyway; I can simply change the `nvidia` driver to `nouveau` in `Xorg.conf`, right? Is there any other way to get the OS to recognize the fact that I _do_ have an NVIDIA card on my machine?


Are there any "scp -p" just like "cp -p"

So if I need to preserve the permissions/user/group infos of files then I can copy them with "cp -p foo fooo". But are there any "preserving" options in scp? When copying between servers.


What is the "Bootable flag" option when installing a distro?

Is the "bootable flag" needed in today's distributions? If not, then Why is it still in the installers? What is it exactly?


Giving non-admin users permissions ( to update, to access new wifi, but block DVD writing) in Ubuntu 12.04

Is there a way I can give a non sudoer the permissions necessary for them to update the system through Update Manager? I don't want the user to be able to `apt-get install` whatever like however, just updates. EDIT: I think something like               %someUser ALL=(root)NOPASSWD:/usr/bin/apt-get update,/usr/bin/apt-get      upgrade      added to the `sudoers` file via `visudo` may work? I would be grateful if someone could confirm as I have no experience of editing this. For the second part of my question I would like to know how to give the non- admin user privileges to join a WiFi network previously not joined, i.e. say at a hotel or cafe (This is distinct from just ticking the `available for all` box in edit connections for a previously established connection, I mean a genuinely new connection). Finally I want to remove the privileges for the user to burn to DVD (or CD) but still be able to read DVDs if possible (is this done by restricting permissions to `cdrecord` or would the user still be able to right-click an ISO and `write-to-disc`?)


Is port knocking good for a last chance when everything is locked out via the Firewall?

Based on this question: "Safe mode" on Linux? - So there is a configured knockd on a server, and a wrong firewall command was given out, so everybody got locked out from the server via layer3 (iptables). OK. Could this be resolved by knocking the ports as in the knockd, so then the knockd will open given ports? Could this be a last chance to get in to the server via layer3? Or it will not work, because if ex.: knockd configured to use port 5000 and port 5000 is blocked on all protocols, knockd will not work? Is knockd "before" the netfilter? (I mean INTERNET->KNOCKD->NETFILTER?)


How to output only given chars?

How can I crop unneeded chars, and only output what I need? For example: input:                   ASDFQWER      output:                   DFQ      I mean in this case I need only the 3.-4.-5. chars of the string. How do I do that?


curl url call in for loop?

I am working with bash and I am trying to make a curl url call in a for loop. Below is my simple curl call -               curl -v --header "Connection: keep-alive" "localhost:8080/user?userid=52010&client_id=20&attr=0"      And I am trying to make this curl call in for loop 100 times -               for ((i=1;i<=100;i++)); do   curl -v --header "Connection: keep-alive" "localhost:8080/user?uuid=52010&model_id=20&attr=0" done      I tried running above code as it is in the command line but it doesn't work and it gives me like this -               >      Any thoughts what wrong I am doing?


How can I run emacs with no shell?

I'm administrating an Arch Linux server. How can I securely add emacs to my `/etc/sudoers` editor variable? Currently I have "emacs" but that allows `M-x shell`. Basically, I want something like `rvim`, but for emacs.


How to install libltdl.so.3

I have Fedora 20, and am trying to install scanner software, 32-bit, for my Epson DX5000 printer. I get the messages:               [root@localhost:/home/Harry]$ rpm -Uvh iscan-2.29.3-1.usb0.1.ltdl3.i386.rpm      error: Failed dependencies:         libltdl.so.3 is needed by iscan-2.29.3-1.usb0.1.ltdl3.i386     [root@localhost:/home/Harry]$  yum install libltdl.so.3     Loaded plugins: langpacks, refresh-packagekit     No package libltdl.so.3 available.     Error: Nothing to do     [root@localhost:/home/Harry]$       I have tried searching on the Internet for `libltdl.so.3`, but I find the results very confusing. Is it perhaps part of another package? Please can anyone help me? * * * Thanks for the answers so far. I think this is another time when I asked X when I should have asked Y. I already have `libtool` installed (see the screen shot) So now the question is: why does it say `libltdl.so.3 is needed` when `libtool` is already installed? Unless I have misunderstood what is going on, again.               [root@localhost:/home/Harry]$ yum install libtool-ltdl     Loaded plugins: langpacks, refresh-packagekit     Package libtool-ltdl-2.4.2-23.fc20.i686 already installed and latest version     Nothing to do     [root@localhost:/home/Harry]$       Also:               [root@localhost:/home/Harry]$ yum install libltdl7     Loaded plugins: langpacks, refresh-packagekit     No package libltdl7 available.     Error: Nothing to do     [root@localhost:/home/Harry]$       Meta question: should I also change the title?


Customizing bash for many servers

I work with a few dozen servers. I'd really like to streamline my work, but at the same time I'm a bit reluctant, since it would be a lot of work synchronizing all servers. The servers are in different networks so there's little use setting up shared folders. What options do I have?


Convert Country List to Continent List in Bash

I am doing some geoip lookups using the `geoiplookup` command in Linux. This correctly returns the country codes for me but I need to break them down into continents instead of countries. I currently have a text file full of countries and am trying to determine the best way to convert these to continents using `bash`. I have a second text file called conversion and it looks like this:               United States:North America     Mexico:North America     Canada:North America     Argentina:South America     Bolivia:South America     Brazil:South America      Chile:South America     etc.      I was thinking of doing some sort of loop for the name in the `geo.txt` file and grep the conversion.txt file and then print out anything after the `:`. I highly doubt that is the easiest/best way so just wanted to get a few opinions on it.


Associative Arrays in Shell Scripts

I saw a trick for implementing associative arrays in a shell script. For example `print array["apples"]` could be scripted as `echo \$array$key` where key=apples. However, there was no mention of how to generate the keys to iterate over the array. The only way I could think of was to store the keys in a variable delimited by spaces so I could use a for-loop to iterate over the array. So, is there some other way to store the keys for later use?


Is there a way to make your process use less CPU?

I want my device to use less CPU to save battery. I have a program that uses a large amount of it. `nice` won't help as all it does is change scheduling when CPU is at %100, while I don't want it to get that high


Emulate horizontal scrolling with Shift key

I want to emulate horizontal scrolling when I use my (vertical) scroll wheel and pressing `Shift`. In some applications (Chrom{e,ium}) this already works, but I'm looking for a generic solution for X applications. The closest I got so far is `xbindkeys` + `xdotool`.               # ~/.xbindkeysrc     "xdotool click 6"       shift + b:4          "xdotool click 7"       shift + b:5      The Problem is that `xbindkeys` seems to miss some events, and occasionally a vertical scroll "gets through". This is very annoying. It looks like `xbindkeys` is using some kind of polling? Also I don't like spawning hundreds of shell commands per seconds. I got a small screen and have to scroll horizontally a lot. How can I achieve generic horizontal scrolling? **UPDATE:** There is another way that does mostly what I want with `xbindkeys` and `xmodmap`.               "xmodmap -e 'pointer = 1 2 3 6 7 4 5 8 9 10'"       c:50     "xmodmap -e 'pointer = default'"       release + shift + c:50      When `Shift` is held, the pointer buttons 4 and 5 are mapped to 6 and 7. (Buttons 4/5 are fore vertical scrolling and 6/7 for horizontal scrolling). `c:50` is the left `Shift` key. On key release the default pointer mapping is restored. This solves the "too many events" Problem nicely. However, the Shift key doesn't work as normal modifier anymore. I tried to re-issue the `Shift` press/release events with `xdotool` like this:               "xmodmap -e 'pointer = 1 2 3 6 7 4 5 8 9 10';  xdotool keydown Shift_L"       c:50     "xmodmap -e 'pointer = default';  xdotool keyup Shift_L"       release + shift + c:50      According to `xev` the `Shift` events get through, but I think it's not recognized as a modifier any more. For example, pressing `Shift`+`A` wouldn't produce an uppercase `A`.


Emacs soft line wrap at word boundary

How can I have emacs set to move the the last word at the 80 character mark? What I mean is this: Instead of               ran/     ge      I would like emacs to place the whole word range on the next line at the 80 character mark. Right now emacs will type past 80 characters and and cut the word at the terminal edge.


Difference between lib, lib32, lib64, libx32, and libexec

My 64 bit Ubuntu 13.04 system has the following directories in `/`:               lib     lib32     lib64     libx32     libexec      In the `/usr` directory there is:               lib     lib32     libx32     libexec      This seemed like something that could be easily answered with a search, but I found nothing online, other than that these directories store shared libraries (except libexec). But which shared libraries go in which folders (other than 32bit in lib32 and 64 bit in lib64)? Could someone explain the difference between all of these directories?


Why is Gnome Shell sending data over my wireless network?

I have been checking which processes under my Fedora Linux 18 are using my upload bandwidth and I occasionally see that Gnome Shell is one of them. Why should it be sending data over my wireless network?


What privileges do I have (find out within bourne shell script)

I am hacking away on a remote helper for git. The script is in bourne shell. I wanted to create some temporary directory in the home dir. For some reason I get permission denied. From my shell directly I can run the same command without problems. All the Environment vars look normal, $HOME, $USER, ... The homedir has normal permissions set (eg. everything is owned an writable by the user). I'm using debian testing. This is the offending command:               mkdir --mode=600 --parents /home/<user>/.tmp/$$      The peculiar thing is also that the directory is effectively created, but the next line that tries to put a file in it has a permission denied again and this time the file is not created. The shell is running with:               set -e # errexit     set -u # nounset     set -f # noglob     set -C # noclobber          set -x      but without them I still get permission denied. ps: I just tried in the $GIT_DIR, to which the user has write privileges too, and also permission denied, but this time not on the directory creation, but on the file creation the next line. **So how do I find out who is denying me and why?**


How to colorize last window in status line?

I'd like to make the last selected window (the one to which `:last-window` takes you) to stand out visually. By default it's just marked with an inconspicuous `-` after the name. Is there a way to set the attributes for last window name in the status line, like `set-option window-status-current` does for the current window name? Update: Both Debian Wheezy (stable) and Ubuntu 12.04 have tmux 1.6 that lacks the necessary option. But there's a backport which is 1.9. The solution was to upgrade.


Removing unused init scripts

On my Debian server, I have no network shares (NFS, SMB, ...). I am trying to optimize and simplify my boot process. Is it OK to remove the following init scripts?               /etc/rcS.d/S12mountnfs.sh     /etc/rcS.d/S13mountnfs-bootclean.sh      AFAICT, these are only needed, when NFS is to be mounted. However, I am not sure what purpose the `mountnfs-bootclean.sh` script has. Anyway, Is it safe to remove both these scripts, i.e.:               chkconfig mountnfs-bootclean.sh off     chkconfig mountnfs.sh off


How can I install tcl/tk8.6 on Ubuntu 12.04? The default repositories for Ubuntu 12.04 include tcl/tk8.5 which I have installed but I need the latest version. Is there a PPA that I could add which includes tcl/tk8.6 or is there another way? Note: As far as I can tell the latest version of Ubuntu has 8.6 as default.


default wordsize in UNIX/Linux

I was inspecting the preprocessed output of my C program and happened to look at the header file `wordsize.h` It is located in `/usr/include/i386-linux-gnu/bits/wordsize.h` the file contains only one macro               #define __WORDSIZE   32      My question is, is the wordsize then being decided by the compiler that is installed or does it has something to do with the OS that I have installed (32 bit or 64 bit) or does it have something to do with the Hardware configuration of my machine. I am new to development under Linux.


How can we trace problems of crashing programs in Linux?

If an application crashes in Windows we can check the Event Viewer in the Administration tools to see what has crashed. Sometimes it has useful information others not, but it is a start.   In linux if an application (any) crashes how one starts to trace what happened?   Is there e.g. some central log or something similar?


Sendmail relay to dmz to another relay

We have two domains. One of which is isolated. We're trying to forward mail from one domain, through a DMZ to a relay on the other domain. Using EHLO through telnet works. Using the mail command and specifying the relay works:               mail -S smtp=myrelay.com -s test me@mycompany.com      Sendmail does not work though but claims that the mail would be deliverable:               sendmail -bv me@mycomapany.com     me@mycompany.com...deliverable: mailer relay, host myrelay.com, user me@mycompany.com          sendmail -v me@mycompany.com     mycompany.com: Name server timeout     me@mycomapany.com... Transient parse error -- message queued for future delivery      So what's the deal? It says it's deliverable to myrelay.com but then tries to send it to mycompany.com instead. Anyone have any advice where to look to fix this?


How to find files containing two strings in different lines

A real example is: I have a Python file `util.py`, and I changed one of the function name from `foo` to `bar`. There might be other files using `foo` as function name and they are irrelevant. I want to update all the Python files in the project from `foo` to `bar`. So I would like to do a search on files for imports such as:               import project.path.util      or               from project.path.util import foo      and any calls to `foo` such as one starting with:               foo(      The solution has to be whitespace tolerant. I can search each of them using `grep` but I am uncertain about the combined search. Any suggestions will be appreciated.


xinput - Ctrl+<Left> misbehaves if history-search-backward is mapped

I am using these lines in my `~/.inputrc`:               "\e[5~": history-search-backward     "\e[6~": history-search-forward      With these settings when I type `c` on the prompt and do a `PageUp`, bash only shows command starting with `c` from the history. `PageDown` does its inverse. I find this very much productive to me. Without those lines in my inputrc file when I do `Ctrl`+`Left`, The cursor use to go to one word left and `Ctrl`+`Left` does its opposite. But with those setting mentioned above when I do `Ctrl`+`Left` and `Ctrl`+`Right` it prints `;5D` and `;5C` instead. So how do I make `Ctrl`+`Left` & `Ctrl`+`Right` do the right stuff?


How to get extract/compress option on right clicking?

I am using Linux Mint 14 Nadia . Earlier whenever I right clicked any folder I got options like Extract it, Compress etc. But now I am not getting them . Probably I changed/deleted some of the utilities . I have nautilus installed on my system . Is there any way I can get those 2 features back in the options list when I right click any folder ?


Debian Live-CD user password

I am trying to use Debian live from an USB, however I do not succeed in logging in… **What is the standard user and password to get access?** I have tried searching this question on the internet and used combinations of standard user credentials that I found such as live/live, root/root, root/live, and combinations without a password. None of them worked. This problem applies to Gnome, KDE, Xfce for me.


postfix configuration to verify all recipients

I have a mail server that should receive all mails, even if no user is existing. my big problem is the: Postfix Address Verification like mentioned here: http://www.postfix.org/ADDRESS_VERIFICATION_README.html Servers that use that kind of recipients verification, wont send me mails if there is no user to receive these mails. As mentioned in the Postfix Readme, to verify a recipient, the server is sending a probe message to my server, to check if an user exists. My goal is now, to find a way to always reply to those probe messages with the right answer to tell all servers that the user they are looking for exists. is there anything special in the settings i can use for this? i really appreciate all kinds of help! thank you:)


vim flag to append a line and save

I'm trying to mock an editor as part of writing feature tests for a CLI that I'm working on. I need to mock an editor which is opened and quit directly without saving, as well as an editor which modifies content in some way, then saves and exits. For the first test, I'm doing this:               export EDITOR='vi -c :q!'      which seems to work. But I'm having a hard time writing the second test. I've tried something along these lines:               export EDITOR='vi -c ":Loremipsum" -c ":wq"'      _(I have the Loremipsum plugin installed, but any other command which appended text would be equally fine)._ The file that's opened in this way doesn't actually get modified, so I can tell I'm doing something wrong. I'm not wrapping my head around the documentation for the -c flag, and I can't find any clear examples of its syntax. What am I doing wrong?


Where is my /etc/init.d/skeleton on OpenSuse 12.3?

On a fresh install of OpenSuse 12.3, I want to "daemonize" a program. And, on all examples found on Internet, I see I have to create first a `/etc/init.d/myscript` based on the `/etc/init.d/skeleton`... But I have no `/etc/init.d/skeleton`... Is there another place for this file? Or maybe I need to install something? The system is up-to-date, I checked that first. I know I can try to copy another existing `/etc/init.d` script and modify it, or create a new one, but I would know if I am doing wrong, or if there is another special way to do that on OpenSuse.


Unable to remove the files from an usb drive (neither by dd /dev/zero nor by rm -r)

I have a flash usb drive and up till now it has worked well. Recently I recorded iso to it using dd. Now I want to delete it.               $ lsblk     NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT     .......     sdb      8:16   1  14.6G  0 disk      └─sdb1   8:17   1  14.5G  0 part /media/alex/ARCH_201404     sr0     11:0    1  1024M  0 rom            $ mount           /dev/sdb1 on /media/alex/ARCH_201404 type iso9660    (ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)      When I did this               $ sudo dd ibs=4096 count=1 if=/dev/zero of=/dev/sdb1     1+0 records in     8+0 records out     4096 bytes (4.1 kB) copied, 0.00053675 s, 7.6 MB/s      it seemed to succeed but when I explored the usb flash all the files were still there. When did this:               sudo rm -r /media/alex/ARCH_201404/*      and I got the error:               ..................     rm: cannot remove ‘/media/alex/ARCH_201404/loader/entries/uefi-shell-v1-x86_64.conf’: Read-only file system     rm: cannot remove ‘/media/alex/ARCH_201404/loader/entries/uefi-shell-v2-x86_64.conf’: Read-only file system     rm: cannot remove ‘/media/alex/ARCH_201404/loader/loader.conf’: Read-only file system     .....................      What can I do about it?


Is possible to have workspace switching via Ctl+Alt+Arrow NON CYCLIC?

After installing Linux Mint 16, and installing "Workspace grid (2D) and switcher", workspace switching started to work in a cyclic way. If you have many workspaces (4x4 in my case) navigating them in cyclic way feels like solving a Rubik's Cube. I.e. if you have 2x2 workspaces, pressing Ctrl+Alt+RightArrow moves you to workspace top-right workspace, pressing again moves you to top-left workspace, then top-right, then top-left and so on. Before version 2.0 pressing Ctl+Alt+RightArrow had taken you to top-right workspace and never moved you again from there. **Is there any way to return to the old behaviour?**


/dev/sdb: No such file or directory (but /dev/sdb1 etc. exist)

I'm not sure what is wrong here but when running `fdisk -l` I don't get an output, and when running                   fdisk /dev/sdb # I get this     fdisk: unable to open /dev/sdb: No such file or directory      I'm running Ubuntu 12.10 Server   Can someone please tell me what I'm doing wrong? I want to delete `/dev/sdb2-3` and just have one partition for `sdb`   The only thing I've done differently with the setup of this server is use ext4 instead of ext3, I figured the extra speed of ext4 would help since I am using SSDs now               root@sb8:~# ll /dev/sd*     brw-rw---- 1 root disk 8,  1 Nov 23 14:58 /dev/sda1     brw-rw---- 1 root disk 8,  2 Nov 23 14:55 /dev/sda2     brw-rw---- 1 root disk 8, 17 Nov 23 19:20 /dev/sdb1     brw-rw---- 1 root disk 8, 18 Nov 23 15:45 /dev/sdb2     brw-rw---- 1 root disk 8, 19 Nov 23 14:51 /dev/sdb3     brw-rw---- 1 root disk 8, 33 Nov 23 15:47 /dev/sdc1     brw-rw---- 1 root disk 8, 49 Nov 23 15:48 /dev/sdd1          root@sb8:~# cat /proc/partitions     major minor  #blocks  name             8        0  117220824 sda        8        1  112096256 sda1        8        2    5119968 sda2        8       16  117220824 sdb        8       17   20971520 sdb1        8       18   95718400 sdb2        8       19     526304 sdb3        8       48 1953514584 sdd        8       49 1863013655 sdd1        8       32 1953514584 sdc        8       33 1863013655 sdc1          root@sb8:~# ll /dev/disk/by-path/     total 8     drwxr-xr-x 2 root root 4096 Nov 23 15:48 ./     drwxr-xr-x 5 root root 4096 Nov 23 15:42 ../     lrwxrwxrwx 1 root root   10 Nov 23 14:58 pci-0000:00:1f.2-scsi-0:0:0:0-part1 -> ../../sda1     lrwxrwxrwx 1 root root   10 Nov 23 19:20 pci-0000:00:1f.2-scsi-1:0:0:0-part1 -> ../../sdb1     lrwxrwxrwx 1 root root   10 Nov 23 15:45 pci-0000:00:1f.2-scsi-1:0:0:0-part2 -> ../../sdb2     lrwxrwxrwx 1 root root   10 Nov 23 15:47 pci-0000:00:1f.2-scsi-2:0:0:0-part1 -> ../../sdc1     lrwxrwxrwx 1 root root   10 Nov 23 15:48 pci-0000:00:1f.2-scsi-3:0:0:0-part1 -> ../../sdd1          root@sb8:~# df -T /dev     Filesystem     Type 1K-blocks    Used Available Use% Mounted on     /dev/root      ext4 111986032 1993108 104388112   2% /


Kill a nohup mpi process

I have started a program in parallel using the command:                   nohup mpirun -7 mylongprogram.py &      I now want to terminate the program. When I want to kill the process by the command:                   kill -9 <PID>      I see that another process with a different PID is started. How do I kill the entire mpi program and prevent nohup from doing this?


ssh with sudo doesn't start services

I want to run command with sudo through ssh without disabling "requiretty" sudo option. According to /etc/sudoers:               #     # Disable "ssh hostname sudo <cmd>", because it will show the password in clear.      #         You have to run "ssh -t hostname sudo <cmd>".     #     Defaults    requiretty      Generally, "ssh -t" is working fine. I'm able to run commands like whoami:               ssh -t  'bnadmin@devgreg' 'sudo whoami'     root     Connection to hostname closed.      Besides the weird message "Connection to hostname closed" it's working fine. The problem comes when I'm trying to trigger services that supposed to be demonized. They are just not starting if I run it through ssh. For example tomcat:               ssh -t 'myuser@hostname' 'sudo /usr/local/tomcat/bin/startup.sh'     Using CATALINA_BASE:   /usr/local/tomcat     Using CATALINA_HOME:   /usr/local/tomcat     Using CATALINA_TMPDIR: /usr/local/tomcat/temp     Using JRE_HOME:        /usr/java/latest/     Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar     Connection to hostname closed.     $ ssh -t 'myuser@hostname' 'ps aux | grep java'     myuser  21177  0.0  0.1 106096  1380 pts/2    Ss+  17:25   0:00 bash -c ps aux | grep java     myuser  21185  0.0  0.0 103244   824 pts/2    S+   17:25   0:00 grep java     Connection to hostname closed.      Besides tomcat I have the problem with any init.d startup script. If I comment out requiretty in the sudoers file and don't use -t ssh option, then it's successfully starting.               $ ssh 'myuser@hostname' 'sudo /usr/local/tomcat/bin/startup.sh'     $ ssh 'myuser@hostname' 'ps aux | grep java'     root   21235 90.8 69.3 3706044 701956 ?      Sl   17:30   0:39 /usr/java/latest//bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -javaagent:/usr/local/tomcat/bin/../spring-instrument-3.1.1.RELEASE.jar -Xms1500m -Xmx2500m -XX:PermSize=256m -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start     myuser  21279  1.0  0.1 106096  1380 ?        Ss   17:30   0:00 bash -c ps aux | grep java     myuser  21287  0.0  0.0 103244   824 ?        S    17:30   0:00 grep java      So my question is how can trigger background processes with sudo through ssh without disabling requiretty sudo option?


rm -rf on vhosts directory, what should I do?

I was tired and unfortunately I did:               rm -rf * /var/www/vhosts repertory      on my CentOS 6.3 running with Parallel Plesk. I lost many websites, but worst: I've lost `chroot`, `default`, `fs` and `fs- passwd`. What were these folders? What did they do? What should I do now...? I have backups, but only for my websites. I miss every file and folder that were in the `vhosts` directory (`chroot`, `default`, `fs` and `fs-passwd`).


Get "Text Content" of Files

I was wondering if there is a tool to scrape text content of a file. Basically I would like to put in a pdf, word document, compressed file or anything else and get the text it contains out. There is `strings` which prints out sequences of printable characters but this doesn't work on many formats that are compressed. Its "dumb" nature also means that it often prints more than just the text. It would be a good fallback for an unknown file type though. There is the `pdftotext` command which does pretty much exactly what I want but it only works on pdfs. Is there a tool that works on multiple formats or that ties more of these tools together? ### Additional Information I lot of people has been mentioning that their tools are non-standard. I would just like to point out that this is fine.


How to add more /dev/loop* devices on Fedora 19? I do:               # uname -r     3.11.2-201.fc19.x86_64     # lsmod |grep loop          # ls /dev/loop*     /dev/loop0  /dev/loop1  /dev/loop2  /dev/loop3  /dev/loop4  /dev/loop5  /dev/loop6  /dev/loop7  /dev/loop-control     # modprobe loop max_loop=128     # ls /dev/loop*     /dev/loop0  /dev/loop1  /dev/loop2  /dev/loop3  /dev/loop4  /dev/loop5  /dev/loop6  /dev/loop7  /dev/loop-control      So nothing changes.


minicom showing offline

I am trying to use `minicom` in Ubuntu. To do this I first connect my USB to DB9 converter, then I type this command on terminal `dmesg | grep tty` to check if my USB to DB9 converter is connected properly. I got this output:               [    0.000000] console [tty0] enabled     [   54.200503] usb 2-1.2: pl2303 converter now attached to ttyUSB0     [   76.183173] cdc_acm 1-1.1:1.2: ttyACM0: USB ACM device     [  118.363275] cdc_acm 1-1.1:1.2: ttyACM0: USB ACM device     [  190.079494] cdc_acm 1-1.1:1.2: ttyACM0: USB ACM device      So, I know my USB to DB9 converter name is `ttyUSB0`. Following steps are executed in order:   * Open the `minicom` by using command `sudo minicom -o -s -w`.   * Open `serial port setup` and write `serial device` as `/dev/ttyUSB0` and write `Hardware Flow Control` to `NO`.   * Press `Enter` to exit to main menu then `Esc` to start `minicom`. After these steps it should work fine, but my `minicom` is showing "offline". Where is the mistake in my configuration? Thank you!


service command and non-root user

On the linux servers of our main customer our bash scripts were running under root for years. Now we want to change that for security reasons. Some of our scripts were triggered by the "service" command, for example "service filescontrol start". The main admin from our customer also wants these service triggered scripts to run under normal users. But is the concept of the "service" command not bound to the root user?


How can I get this script file's functions to load without having to source it every time? "command not found" (Bash/scripting basics)

How can I get this script file's functions to load without having to source it every time? I created a file `foo` with script functions I'd like to run. It's in `/usr/bin`, which is in the PATH. File **foo** :               #!/bin/bash     echo "Running foo"          function x {         echo "x"     }      However, when I type a function name like `x` in the terminal:   `x: command not found` When I type `foo`:   `Running foo` shows up (so the file is in PATH and is executable) After typing `source foo`, I can type `x` to run function x A pretty basic question, I know. I'm just trying to abstract my scripts so they're more manageable (compared to dumping everything in .profile or .bashrc).


Copy ssh public key to multiple Linux hosts

I am trying to copy .ssh/id_rsa.pub from our central server to multiple servers. I have the following script which I usually use to push changes to the different servers.               #!/bin/bash               for ip in $(<IPs); do         # Tell the remote server to start bash, but since its         # standard input is not a TTY it will start bash in         # noninteractive mode.         ssh -q "$ip" bash <<-'EOF'                    EOF          done      But in this case, I need to cat the public key on the local server and then add that to multiple servers. Is there a way by using the above here document script to execute the following.               cat .ssh/id_rsa.pub |ssh tony@0.0.0.0 'cat > .ssh/authorized_keys'


use mosh without giving up local scrollback / history?

Is there a way to use `mosh` without giving up the local scrollback? Basically, in some circumstances, IP-roaming is indeed useful and needed, but the extra terminal emulation and key prediction seems to only be getting rid of the local scrollback buffer lines and the session history.


Mint Linux 13 will not boot to splash screen after graphics driver enabling in hp dx2450:

I was trying to play some games on my computer and had graphics problems. I only have the on-board graphics (no graphics card added yet) but some of the games were extremely basic and still wouldn't run. I checked the drivers since I figured this may be the issue. Every single graphics driver in the listing was disabled, so I enabled a Nvidia one that was already installed on the machine, a HP dx2450. On rebooting, what would normally take 45 seconds ended up being a blank screen after passing the blue hp screen before getting to the splash login screen. My monitor timed out and went into sleep mode as a result. Restarting it I can get into grub via a series of keys I found online, but as this is my first time with this particular issue I'm not sure how to fix it. I'd rather not reinstall the system unless absolutely necessary, especially since this was an OEM install by HP. Don't know how this information could help, but as I already know from most tech forums that it will be asked: HP dx2450 2.3 GHz Dual-Core CPU 2 Gb DDR2 Ram 80 Gb Hard-Drive No PCI x16 Graphics Card in slot. On-Board graphics only at present.


awk separator preferences

I write ad hoc awk commands in cygwin to process tab delimited files. Pretty much every command starts with:               BEGIN {FS="\t";OFS="\t";ORS="\r\n";}        How can I make these separators the default to avoid typing them every time?


Pipe command to tail: when is the first command aborted?

In this example:               $ for i in {1..3}; do sleep 1; echo $i;  done | head -n 2      why is the first command (for loop) killed only just before the `3` is displayed ? I expected it to be killed right after the `2` is displayed. The problem I was trying to solve initially was this one:               $ for i in *(/); do c=`find "$i" -iname "*.ext" | wc -l`; echo "$c  $i"; done | head -n 3      I expected it to end as soon as three lines are on the screen, but it's running the loop four times, discarding the fourth line. What I thought would happen:               sleep 1     echo 1     sleep 1     echo 2      # 2 is printed and the for loop is killed      What actually happens:               sleep 1     echo 1     sleep 1     echo 2      sleep 1     echo 3     # 3 is not printed and the for loop is killed      Is there a way to abort the loop immediately after a given number of iterations without adding some logic inside the loop itself ?


Find all lines in a file with a certain character at a certain position

I have a lab question asking me to use `grep` with a regex pattern to match every word where the third letter from the beginning of the line is an "a" and save it with a redirect. How can I do that?


How can I get back into "normal" edit-mode after pressing esc in zsh (vi mode)?

I'm using `zsh` in `vi-mode`. When I go to normal mode with `ESC` and then back into insert mode (for example using `i`, `a` or `s`), the line editor kind of "protects" the part of the line in front of the char, at which I was when re-entering insert mode. I fixed it for the backspace char by rebinding it with               bindkey "^?" backward-delete-char      But there are still other bindings like `^W` that don't work out of the box (probably because they are bound to `vi-*`). If I understand it correctly, this behavior is normal to `vi`. Is there's a way to make `zle` behave like `vim` without having to rebind so many keys?


Problem configuring Access Control on Apache

I have a little Debian Server which runs Apache 2.2.22. I have configured, with WebMin, a Apache Webserver that listens on the port 83. Now, in the root directory of this Webserver I configured the Access Control with a password, and everything works fine. The thing that I seem unable to fully accomplish is to create a "whitelist" on my local network. Now my config file looks like this:               AuthType Basic     AuthName "Must Login"     AuthBasicProvider file     AuthUserFile /root/apache/password     require user root     allow from 192.168.1.0/255.255.255.0     allow from myname.dyndns.org     order allow,deny     Satisfy any      This works like a charm when accessing the server directly from its local address (192.168.1.9). But if I, still connected to my local network, try to access it by typing in the address bar "myname.dyndns.org", it asks me the password. In the log file I found that when I try to connect directly typing the local address it logs               [Fri Aug 29 23:22:44 2014] [debug] mod_deflate.c(700): [client 192.168.1.2] Zlib: Compressed 1880 to 527 : URL /      but when I connect using myname.dyndns.org it logs               [Fri Aug 29 23:20:14 2014] [debug] mod_deflate.c(700): [client 66.249.81.21] Zlib: Compressed 484 to 326 : URL /      How can I accomplish this and why the client from the second log line isn't my client local IP? Thanks in advance for your responses, Mauro.


Auto-Mounting CIFS Shares on Laptop

I've seen questions similar to this asked before in several variations, but I have yet to locate a satisfactory answer. Here's what I have:   * A highly mobile Debian laptop that switches networks frequently.   * A FreeNAS server at home with a bunch of CIFS shares on it. Here's what I want:   * If I access the CIFS share directory when I'm at home, auto-mount the CIFS share.   * If I access the CIFS share when I'm anywhere else, return an error immediately (i.e. don't contemplate the network for five minutes before figuring out the NAS isn't there).   * When I suspend or hibernate the machine, cleanly unmount the share so that the mount isn't pointing into thin air when the machine wakes back up again. If the share can't be cleanly unmounted (a process is using a directory), either:      * Abort the suspend/hibernate and tell me who's camping on the mount; or     * Force the unmount anyway and proceed with suspend/hibernate.   * Extra Credit: When the network connection drops (pull the plug or lose association with the WAP), attempt to cleanly unmount the share.   * Extra Credit: This magic should be independent of the network manager in use. None of the various options I've read about seem to be appropriate:   * `autofs` seems to be reliable, but doesn't appear to have any awareness of suspend/hibernate.   * The `_netdev` option in `mount` and `/etc/fstab` looks interesting, but appears to apply only to NFS shares.   * I have not yet been able to get `gvfs` to work, but then I haven't tried very hard. Any suggestions on how to approach this? ADDENDUM: Here's the short version of what I ended up doing so far. I installed `autofs`, and wrote a small shell script to force-expire all auto-mounted volumes, which gets called whenever a network interface goes down. I created an automounter map for my CIFS server, with the credentials stored in an external file (yuck). I then wrote the following shell script:               #!/bin/sh -e          # Expire everything in the automounter.     if [ -f /var/run/autofs.pid ]; then         kill -USR1 "$(cat /var/run/autofs.pid)"     fi      Sending the USR1 signal to the automount daemon causes it to force-expire all unused mounts. I then placed this script in `/etc/network/if-down.d/autofs`, with a softlink in `/etc/network/if-post-down.d/autofs`. NetworkManager invokes all the scripts in the latter directory when a connection drops, so any auto-mounted filesystems should be unmounted. I'm not terribly happy with the arrangement, however. For a start, `autofs` makes no distinction between auto-mounted volumes, and, upon receiving USR1, will unmount _all_ inactive volumes, including non-network volumes, which is rather heavy-handed. Further, the login password for the CIFS server has to be stored in a file. I would much prefer to be prompted for it. Anyway, that's what I've kluged together so far. It works, but I'll be happy to use something better...


How to use `smart-compile` without confirmation in Emacs

I'm using `smart-compile` in Emacs. It works fine, but if possible I want to omit the confirmation like `Compile command: ruby foo.rb`. How can I do it?


Sort based on the third column

I'm facing a huge 4-columns file. I'd like to display the sorted file in stdout based on its 3rd column:               cat myFile | sort -u -k3      Is that enough to perform the trick?


What is the meaning of "\_" in output of 'ps ef'?

When I executed `ps ef` command in a linux server, I saw that one of the command starts with `\\_`. For example,               \_ /bin/sh /usr/      Could any one please let me know what is the meaning of `\\_` in this command?


How to install Ruby 1.9.3 on Arch?

The wiki suggests using `$sudo pacman -S ruby1.9` but the package isn't there... I'd rather not compile it from source but I can if no one knows.


mdadm - Accidentally ran "mdadm --create" on an existing raid-1. The superblock is now corrupt and I am unable to recover data. Did I bork my data?

I have `/dev/sdb1` and `/dev/sdc2` that were previously setup into a RAID-1 with `mdadm`, but then I reinstalled and lost the old configuration. Out of idiocy, I ran               sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1      in an attempt to reconfigure the RAID. After I let the drives sync (oops?), now none of `/dev/md0`, `/dev/sdb1`, or `/dev/sdc2` will mount. For `/dev/md0`, it complains about a bad magic number in the super block. For the `/dev/sd{b,c}1`, it complains about missing inodes. In short, the question is this: Did I just bork all my data, or is it possible to recover the array still? The following is the output of `dumpe2fs` for those partitions:               brent@codpiece:~$ sudo dumpe2fs /dev/md0      dumpe2fs 1.42 (29-Nov-2011)     dumpe2fs: Bad magic number in super-block while trying to open /dev/md0     Couldn't find valid filesystem superblock.     brent@codpiece:~$ sudo dumpe2fs /dev/sdb1      dumpe2fs 1.42 (29-Nov-2011)     Filesystem volume name:   <none>     Last mounted on:          /var/media     Filesystem UUID:          1462d79f-8a10-4590-8d63-3fcc105b601d     Filesystem magic number:  0xEF53     Filesystem revision #:    1 (dynamic)     Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize     Filesystem flags:         signed_directory_hash      Default mount options:    (none)     Filesystem state:         clean     Errors behavior:          Continue     Filesystem OS type:       Linux     Inode count:              61054976     Block count:              244189984     Reserved block count:     12209499     Free blocks:              59069396     Free inodes:              60960671     First block:              0     Block size:               4096     Fragment size:            4096     Reserved GDT blocks:      965     Blocks per group:         32768     Fragments per group:      32768     Inodes per group:         8192     Inode blocks per group:   512     Flex block group size:    16     Filesystem created:       Wed Feb 10 21:04:42 2010     Last mount time:          Fri May 10 20:25:34 2013     Last write time:          Sun May 12 14:41:02 2013     Mount count:              189     Maximum mount count:      38     Last checked:             Wed Feb 10 21:04:42 2010     Check interval:           15552000 (6 months)     Next check after:         Mon Aug  9 22:04:42 2010     Lifetime writes:          250 GB     Reserved blocks uid:      0 (user root)     Reserved blocks gid:      0 (group root)     First inode:              11     Inode size:           256     Required extra isize:     28     Desired extra isize:      28     Journal inode:            8     Default directory hash:   half_md4     Directory Hash Seed:      7cd5ce46-b823-4453-aa66-00ddaff69952     Journal backup:           inode blocks     dumpe2fs: A block group is missing an inode table while reading journal inode      Edit: It seems like @hauke-laging was correct that I created a 1.2 metadata version RAID-1 over what used to be a 1.0 metadata raid. I've reran `mdadm --create` for the right version, but now my filesystem is corrupt. Do I need to mess with the partition table, or can I simply run `fsck /dev/md0`? The following is the new output of `fsck` and `dumpe2fs`:               brent@codpiece:~$ sudo fsck /dev/md0      fsck from util-linux 2.20.1     e2fsck 1.42 (29-Nov-2011)     The filesystem size (according to the superblock) is 244189984 blocks     The physical size of the device is 244189952 blocks     Either the superblock or the partition table is likely to be corrupt!          brent@codpiece:~$ sudo dumpe2fs /dev/md0     Filesystem volume name:   <none>     Last mounted on:          <not available>     Filesystem UUID:          1462d79f-8a10-4590-8d63-3fcc105b601d     Filesystem magic number:  0xEF53     Filesystem revision #:    1 (dynamic)     Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize     Filesystem flags:         signed_directory_hash      Default mount options:    (none)     Filesystem state:         not clean     Errors behavior:          Continue     Filesystem OS type:       Linux     Inode count:              61054976     Block count:              244189984     Reserved block count:     12209499     Free blocks:              240306893     Free inodes:              61054965     First block:              0     Block size:               4096     Fragment size:            4096     Reserved GDT blocks:      965     Blocks per group:         32768     Fragments per group:      32768     Inodes per group:         8192     Inode blocks per group:   512     Flex block group size:    16     Filesystem created:       Wed Feb 10 21:04:42 2010     Last mount time:          n/a     Last write time:          Mon May 13 10:38:58 2013     Mount count:              0     Maximum mount count:      38     Last checked:             Wed Feb 10 21:04:42 2010     Check interval:           15552000 (6 months)     Next check after:         Mon Aug  9 22:04:42 2010     Reserved blocks uid:      0 (user root)     Reserved blocks gid:      0 (group root)     First inode:              11     Inode size:           256     Required extra isize:     28     Desired extra isize:      28     Journal inode:            8     Default directory hash:   half_md4     Directory Hash Seed:      7cd5ce46-b823-4453-aa66-00ddaff69952     Journal backup:           inode blocks     Journal features:         journal_incompat_revoke     Journal size:             128M     Journal length:           32768     Journal sequence:         0x00215ad3     Journal start:            0               Group 0: (Blocks 0-32767) [ITABLE_ZEROED]       Checksum 0x4453, unused inodes 0       Primary superblock at 0, Group descriptors at 1-59       Reserved GDT blocks at 60-1024       Block bitmap at 1025 (+1025), Inode bitmap at 1041 (+1041)       Inode table at 1057-1568 (+1057)       23513 free blocks, 8181 free inodes, 2 directories       Free blocks: 12576-12591, 12864-12879, <...>       Free inodes:      Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]       Checksum 0x348a, unused inodes 0       Backup superblock at 32768, Group descriptors at 32769-32827       Reserved GDT blocks at 32828-33792       Block bitmap at 1026 (bg #0 + 1026), Inode bitmap at 1042 (bg #0 + 1042)       Inode table at 1569-2080 (bg #0 + 1569)       31743 free blocks, 8192 free inodes, 0 directories       Free blocks: 43232-43239, 43264-43271, <...>       Free inodes:      Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]       Checksum 0x2056, unused inodes 0       Block bitmap at 1027 (bg #0 + 1027), Inode bitmap at 1043 (bg #0 + 1043)       Inode table at 2081-2592 (bg #0 + 2081)       32768 free blocks, 8192 free inodes, 0 directories       Free blocks: 66417-66432, 66445-66456, 66891, <...>       Free inodes: 23921-24576     Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]       Checksum 0x4254, unused inodes 0       Backup superblock at 98304, Group descriptors at 98305-98363       Reserved GDT blocks at 98364-99328       Block bitmap at 1028 (bg #0 + 1028), Inode bitmap at 1044 (bg #0 + 1044)       Inode table at 2593-3104 (bg #0 + 2593)       31743 free blocks, 8192 free inodes, 0 directories       Free blocks: 99334-99339, 99438-99443, 99456-99459, <...>       Free inodes: 24585-32768     Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]       Checksum 0x6a00, unused inodes 0       Block bitmap at 1029 (bg #0 + 1029), Inode bitmap at 1045 (bg #0 + 1045)       Inode table at 3105-3616 (bg #0 + 3105)       32768 free blocks, 8192 free inodes, 0 directories       Free blocks: 131074-131075, 131124-131129, <...>       Free inodes: 32769-40960     Group 5: (Blocks 163840-196607) [ITABLE_ZEROED]       Checksum 0x37e0, unused inodes 0       Backup superblock at 163840, Group descriptors at 163841-163899       Reserved GDT blocks at 163900-164864       Block bitmap at 1030 (bg #0 + 1030), Inode bitmap at 1046 (bg #0 + 1046)       Inode table at 3617-4128 (bg #0 + 3617)       31743 free blocks, 8192 free inodes, 0 directories       Free blocks: 164968-164970, 164979, <...>       Free inodes: 40961-49152     Group 6: (Blocks 196608-229375) [ITABLE_ZEROED]       <...>


zsh refusing to accept new autocomplete script

I have a software project that I'm attempting to write zsh completions for. After installing a package that provided a number of pre-made completions, I found they were put here:               /usr/share/zsh/site-functions      So I wrote my completion script, and threw it in there too. ...and was frustrated by failure. I've tried the following:   1. Symlinking to the original script from the directory above.   2. Putting a copy of the script directly into the directory above.   3. Setting my login shell to zsh (instead of just switching to it from another shell)   4. (Probably) all permutations of `compinit` and `rehash`.   5. Dumbing-down my original script so that there's no way it could be wrong.   6. Changing the contents of another script. The changes worked, so the directory is correct and zsh is detecting completions scripts there. Here is the dumbed-down script:               #compdef aura          _arguments -s \       '-V[Version!]' \       '-h[Helpppp]'      And the current contents of my .zshrc. I'm not normally a zsh user.               autoload -U compinit     compinit     zstyle ':completion:*' rehash true      Please and thank you for any insight you can give. What am I missing? EDIT: Contents of /usr/share/zsh/site-functions is: `_ack _adb _android _attach _aura _baselayout _bpython _brew _bundle _cap _choc _coffee _cower _cpanm _debuild _dhcpcd _ditz _emulator _eselect _fab _gas _gcc-config _geany _gem _genlop _gentoolkit _gentoo_packages _git-flow _github _git-pulls _git-wtf _google _gradle _heroku _jmeter _jmeter-plugins _jonas _knife _language_codes _layman _lein _lunar _lunchy _manage.py _mosh _mvn _node _optirun _pacman _pactree _pear _perf _periscope _pgsql_utils _pip _pkcon _play _port _portage _portage_utils _pygmentize _redis-cli _rvm _sbt _scala _sdd _setup.py _showoff _smartmontools _srm _ssh-copy-id _subliminal _symfony _systemd _teamocil _thor _tmuxinator _vagrant _virtualbox _vnstat _vpnc _yaourt`


How can you pdfjoin smartly different sized pictures?

I'm running the default `pdfjoin` and getting results like this: ![enter image description here](http://i.stack.imgur.com/g0cMv.png) **How can you`pdfjoin` different sized pictures?** My first idea is to add an empty page in front of all things.


Freebsd equivalent build-essential

I'm already familiar with Debian and Ubuntu. At the moment I'm fiddling around with FreeBSD on a server, after installing it I'm wondering what the best way would be to install the 'essential' packages.


Why X server runs on TTY1 and not TTY7 on Arch Linux?

I've used Debian derivates (*buntu, CrunchBang), Mandriva, OpenSuSE, Fedora, name it.. all of them had X server at TTY7 (at least I think it was 7), accessed with:               Ctrl + Alt + F7      Now, I moved to Arch, and it's on TTY1 now -               Ctrl + Alt + F1      All the others are regular TTY's with login prompt. Why is that? Is it perhaps because Arch uses Systemd?


ncurses-devel problems in SuSE Linux Enterprise Desktop 11

Searching on the WEB, I found this tutorial (the only one that has convinced me) for installing a new kernel and I followed the steps provided. But, I got these problems: In the first step I tried to install the `ncurses-devel` via terminal using the `zypper` and the YaST Software Management, but in the first case I got this error:               No provider of 'ncurses-devel' found.      Using the YaST, I didn't find the source of the package listed. Then, I downloaded the application from the WEB site and I got the following error: Executing the `make` command               /bin/sh: -I../c++: No such file or directory     make[1]: *** [../objects/cursesf.o] Error 127     make[1]: Leaving directory `/home/nat64/Desktop/SW/ncurses-5.9/c++'     make: *** [all] Error 2      In the same way, when I execute the `make install`, the terminal showed me the same errors. Finally, I wrote in the terminal `yast -i ncurses-devel`, without success. It marked me that the source was not found. I need to install 7 kernels for the project that I'm doing in my virtual machine.


Setting icon theme for Qt based apps in non kde environment

How could I set icon theme for Qt based apps in a non-kde environment? In KDE I could specify a different one, otherwise it would go for the default gnome theme.


Monitor outgoing web requests as they’re happening

I want to see a list of all outgoing HTTP requests from my desktop. I think it should be possible to monitor HTTPS hostnames as well for local clients using Server Name Indication (SNI). OS X has a nice GUI utility called Little Snitch, which is a per-app HTTP monitor and firewall rule front-end. I would settle for a nice terminal utility. `tcpdump` is overkill as I just want to see where the traffic is going in real-time and not the transmitted data. Ideally, I would like to see what process made the request as well, but just seeing what dials home would be a nice start.


Invalid mail alert

When I log in to Unix, I get new mail alert:               [YOU HAVE NEW MAIL]      I checked my mail and I don't have any:               $ mail     Mail [5.2 UCB] [AIX 5.X]  Type ? for help.     "/var/spool/mail/userId": 0 messages     No mail      How to prevent invalid mail alerts?


Using sed to remove string from list of files fails

I'm on bash (Mac OS X). I have a list of files and there's a string I want to remove:               $ grep -l \</html\> *.html       21888601.html       21906283.html       21977081.html       ...      All matching files are named in this format (.html). Then I try this:               $ grep -l \</html\> 27776977.html | xargs -0 sed -i.back '/<\/html>/d'      The shell just prints out the list of files returned from grep and an error:               sed: 21888601.html       21906283.html       21977081.html       ...     : File name too long      These filenames are obviously not too long, so there is some other error here. Also, when I test this on files that have alpha names (not all numbers), I don't get the error. I also tried:               $ grep -l \</html\> 27776977.html | xargs -0 sed -i.back '/<\/html>/d'     sed: 27776977.html     : No such file or directory          $ grep -l \</html\> 27776977.html     27776977.html      Is sed unable to handle numerical filenames? Or is there some other problem here?


Bootable USB appearing as HDD not Removable Device

I have a unique problem with an older Toshiba satellite laptop that happens to be a LegacyFree laptop meaning you can't access the bios via the normal F2, Del, Esc, etc. I can only select a boot option in the beginning such as HDD, Removeable, CD, Floppy, etc. The problem I ran into is the bootable USB I created is appearing as a bootable HDD not as a removable device and thus it is booting from the HDD in the computer because I can't change the HDD device priority. Is there anyway when making the bootable USB to make it appear as a USB instead of HDD? I've been using unetbootin and LinuxLive to create these bootable USBs. **NOTE:** I am aware you can access LegacyFree Bios is through a program called Tsetup or HwSetup through windowsXP problem is that The laptop doesn't have any OS currently installed.


Finding out *what* is synchronizing two Linux servers

The last person to maintain these Red Hat servers somehow set it up so they stay in sync -- if I delete files on one it automatically deletes them on the other. I need to set up a new configuration on just one of them, so I need to disable the synchronization, but I don't know what's causing it. Where should I look?


mounting iso image: message "block device is write protected, mounting read-only"!

I want to delete a few files from my iso image on hard disk. So, I did:               ravbholua@ravbholua-Aspire-5315:/media/ravbholua/f34890dd-20d2-4d78-92c9-1de7c0957f00$ sudo mount -o loop check_bholua99.iso /media/iso2     mount: block device /media/ravbholua/f34890dd-20d2-4d78-92c9-1de7c0957f00/check_bholua99.iso is write-protected, mounting read-only          ravbholua@ravbholua-Aspire-5315:/media/ravbholua/f34890dd-20d2-4d78-92c9-1de7c0957f00$ cd /media/iso2     ravbholua@ravbholua-Aspire-5315:/media/iso2$ ls | tail     DSC00966.JPG     DSC00969.JPG     DSC00970.JPG     DSC00972.JPG     DSC00973.JPG     DSC00974.JPG     DSC00975.JPG     DSC00977.JPG     DSC00980.JPG     DSC00982.JPG     ravbholua@ravbholua-Aspire-5315:/media/iso2$ sudo rm DSC00982.JPG     rm: cannot remove ‘DSC00982.JPG’: Read-only file system      As it failed to delete for the said reason, I tried to remount with the option of `rw`               ravbholua@ravbholua-Aspire-5315:/media/ravbholua/f34890dd-20d2-4d78-92c9-1de7c0957f00$ sudo umount /media/iso2     ravbholua@ravbholua-Aspire-5315:/media/ravbholua/f34890dd-20d2-4d78-92c9-1de7c0957f00$ sudo mount -o loop,rw check_bholua99.iso /media/iso2     mount: block device /media/ravbholua/f34890dd-20d2-4d78-92c9-1de7c0957f00/check_bholua99.iso is write-protected, mounting read-only      Why it messages that the block device is write-protected? Please suggest how to mount it `rw` so that I can edit it. ( I know one way is to copy the files of the iso onto a diff. directory and edit/delete it; then make a new iso image. But this is not what I prefer. )


Why does Stackoverflow in Iceweasel cause high CPU usage for Xorg?

If I go to the front page of this site, and hit page down/page up repeatedly, it's pretty quick, and firefox-bin (iceweasel) uses maybe 50% CPU, Xorg uses maybe 40%. If I go to Stackoverflow's main page instead, though, each page down/up takes ~1.1s, and Xorg pegs an entire core (almost 100%), but Iceweasel uses almost no CPU. This only happens in Iceweasel (8.0-3). I have tested with a new profile (no difference). Chromium is fine. Konqueror (despite doing smooth scrolling!) is fine. Conkeror (which is based on XULRunner) also has the problem, but Iceape 2.0.14 (aka Mozilla Seamonkey) does not. I've never noticed this on other machines, even when they're fairly similar software-wise (also nVidia, also Debian testing/unstable). Though the other one is much more powerful, so maybe I just don't notice it. (Edit: Checked closer, it pegs Xorg, just not for as long.) I've put xtrace output of a page down on pastebin (at over 1300 lines, too long to inline here). I'm just watching these `top` in an xterm. CPU is an Athlon 4400+ (dual core); 4G of RAM; machine is not thrashing, and there is no disk activity during test (confirmed by `iostat -kx 10`). Video card is a GeForce 7600 GT using the nVidia drivers (290.10-1). OS is Debian testing/unstable; xorg 1:7.6+9. Window manager is Enlightenment DR16. Compositing is not in use. TwinView is in use, with two 1600x1200 LCDs (both DVI). `xorg.conf` doesn't really have anything interesting—most everything is autoprobed. How can I resolve this?


How can I "cat" a file and remove commented lines?

I'd like to know if there is a way that I could `cat` file like `php.ini` and remove all lines starting with `;` For example, if the file contained this:               ;   - Show all errors, except for notices     ;     ;error_reporting = E_ALL & ~E_NOTICE     ;     ;   - Show only errors     ;     ;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR     ;     ;   - Show all errors except for notices     ;     error_reporting  =  E_ALL & ~E_NOTICE      and I ran the correct command `cat | {remove comments command}`, then I would end up with:               error_reporting  =  E_ALL & ~E_NOTICE      **Note** - I assumed that `cat` would be the best way to do this but I'm actually fine with the answer using another utility like `awk`, `sed`, `egrep`, etc.


How to have tail -f show colored output

I'd like to be able to tail the output of a server log file that has messages like:               INFO     SEVERE      etc, and if it's `SEVERE`, show the line in red; if it's `INFO`, in green. What kind of alias can I setup for a `tail` command that would help me do this?


FLAC correctness using MD5 placed in STREAMINFO

I know from [Sources], that FLAC computes CRC and MD5. What I am afraid that `flac --test` only does CRC test - as stated in `man flac` : `same as -d except no decoded file is written` . How to check flac file correctness, using MD5 of raw PCM placed in STREAMINFO in given .flac file ? If `flac --test` makes job, are there any reliable (like in flac documentation) references that shows it? Sources: http://en.wikipedia.org/wiki/Free_Lossless_Audio_Codec we can find: > FLAC uses CRC checksums for identifying corrupted frames when used in a > streaming protocol, and also has a complete MD5 hash of the raw PCM audio > stored in its STREAMINFO metadata header. http://flac.sourceforge.net/comparison.html > By default when processing files, flac computes the MD5 sum while encoding > and decoding. To see md5sums in STEAMINFO we can use:               $ metaflac --show-md5sum *.flac


How to correct a weird bash prompt on a Debian (Squeeze) server?

I have never had to deal much with BASH setup under Debian Linux, but this time, somebody has given me a server that acts weird. When I log on as root, everything works as I am used to: I see a normal prompt telling me who/where I am, pressing the UP key displays previously typed commands, etc. But when I log on as a created user, the prompt is "$", the UP key displays the characters ^[[A and when I try to change the prompt by typing PS1="\u@\h:\w\$ " the prompt literally becomes \u@\h:\w\$ - i.e. \u is not replaced by user name, etc. Looking at the etc/profile and the etc/bash.bashrc files does not give me any clues. And I have I tried Google'ing to no avail. Can anybody point me in the right direction? A step-by-step guide to which files to look at and what they should could be helpful. Another approach could be to reset a user's bash settings (without having to delete and restore the user).


How to do a print screen or capture an area of the screen

Is there an equivalent of the Window's Print Screen + Paste (or better yet the Mac OS Cmd+Shift+4, Space) in gnome?


/etc/cron.daily/foo : Send email to a particular user instead of root?

I'm running CentOS 5.5. We have several cronjobs stored in /etc/cron.daily/ . We would like the email for some of these cronjobs to go to a particular email address, while the rest of the emails in /etc/cron.daily/ should go to the default email address (root@localhost). Cronjobs in /etc/cron.daily/ are run from the /etc/crontab file. /etc/crontab specifies a 'MAILTO' field. Can I override this by setting MAILTO in my /etc/cron.daily/foo cronjob? What's the best way to handle this?


Getting the number and names of windows in Xvfb

I am currently working with Xvfb to grab the screenshots of my programs. Is there a way to determine the number and the names of the windows that are currently "displayed" in Xvfb? Where can I find more documentation on this?


libvirt daemon doesn't start on Gentoo

I'm trying to use Xen with virt-manager on Gentoo system and I have some troubles with libvirt daemon. When it starts: > Starting libvirtd ... > > /usr/sbin/libvirtd: error: Unable to initialize network sockets. Check > /var/log/messages or run without --daemon for more info. > > start-stop-daemon: failed to start `/usr/sbin/libvirtd' [ !! ] > > ERROR: libvirtd failed to start But file ' _/var/log/messages_ ' doesn't exists! Libvirtd config file ( _/etc/libvirt/libvirtd.conf_ ): > listen_tls = 0 > > listen_tcp = 1 > > unix_sock_group = "libvirt" > > unix_sock_ro_perm = "0777" > > unix_sock_rw_perm = "0770" > > log_level = 3 > > log_filters = "3:remote 4:event" > > log_outputs = "3:syslog:libvirtd" Can anybody help me, what i'm doing wrong?) UPD: I'm so inattentive that I forgot install syslog-ng) I found in logs that daemon didn't start because there was no group with name libvirt - after this group was created libvirtd is ok


Leaking file descriptors

What does it mean if file descriptor leaking                File descriptor 6 (socket:[901758]) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 9 (/dev/pts/1) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 11 (/dev/pts/1) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 12 (/dev/pts/1) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 15 (/dev/pts/7) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 17 (/dev/pts/7) leaked on lvextend invocation. Parent PID 10035: /bin/zsh      File descriptor 18 (/dev/pts/7) leaked on lvextend invocation. Parent PID 10035: /bin/zsh        Extending logical volume usr to 30.00 GiB        Logical volume usr successfully resized      What does it mean?


Cryptsetup not finding libgcrypt.so after upgrade

I am running a Fedora Core 13 with dm-crypt + luks, all standard with fedora distos. After upgrading libgcrypt.so, cryptsetup moans at boot up that it can not find the library where it expects it to be ( `/lib` ). So I booted with a live cd, decrypted the root partition of that drive, and mounted my old hard drive, then I chroot'ed in there. I ran cryptsetup and as expected it bombed out with the same error as when booting up... I fixed the symlinks, and tested cryptsetup. It worked. When I rebooted the same error was there again... I thought that somehow my changes was not being saved. So I booted back into the live OS, mounted the hdd & chroot'ed again, and to my amazement I found my symlink where I left it and cryptsetup working. Can someone tell me why this is happening? Why is cryptsetup still looking for the file in /lib and not finding it when its obviously there?! P.S. I have also tried making duplicates of the libgcrypt library files in /lib as well as tried recompling cryptsetup from source, it all works 100% untill I reboot and then that error again! I am thinkin' of just rebuilding that box, but I thought I'd ask you guys first? Anyone come across a similar issue?


How do you bulk move files up one directory safely?

How can I move files up a directory where there might be hundreds or thousands of files in the directory, and you might not be sure about whether there are dupes in `..`. What method would you use? How to handle dupes will vary, sometimes we'll overwrite, sometimes we need to be safer. IO can be important because these are production servers. But given quantity a prompt for non duplicate files isn't an option. Preservation of permissions, and timestamps, etc, is important. We usually won't know what the data is. Oh and it using `mv` isn't required, `rsync`, `cp` solutions welcome. _note: we're running CentOS 5.5 so let me know if it won't work there due to it being a more recent... feature_


How to mount an OpenBSD hard disk image on Linux?

First, I'll start by explaining how I got my problem, this will help me get across what I need. A few months ago, my laptop hard disk broke. I had no quick replacement, but I needed that laptop the next day, so all I could do was to rip the 2.5" drive out from my router. The router was actually an ATX PC, running OpenBSD 4.9. Now, since I needed that drive very quickly, I created an image with `dd` on my desktop computer, put the drive into the laptop and installed Fedora. OK, now I have a replacement hard drive for my laptop, and before I start installing stuff on the hard drive that is going back into the router, I was asking myself, how I could mount the image that I made when I started... The point is, I could make a fresh install of the latest OpenBSD and then just use things like config files from the image. The only thing I know of that I can do now, is simply write the image back to the disk with `dd`. This should work and all that, but I'd like to use the opportunity to upgrade the system as well. I tried mounting the OpenBSD partitions before making the image, but it didn't work, and I had very little time (only a couple of hours on this one evening). Should I write back the image to disk, then try to mount it, recover the files I need and then install the latest OpenBSD?


How to create CronJob for running commands on reboot?

Via my host I have SSH access and a control panel. I installed Rails via SSH on a light weight server. I want to reboot the server when it goes down. I think I need to start it manually since I want to start two servers which run on different versions of Ruby. I was wondering if I can use the "Cronjob" area on my control panel for this, and if so, what command I need. Via SSH I would start the server as follows:               cd [app1path]      bundle exec thin -C /etc/thin/app2.yml start          cd [app2path]     bundle exec thin -C /etc/thin/app2.yml start      It is important that the steps are executed in sequence, since they seem to conflict with each other (running them as a service from `init.d` only starts one, strangely enough placing a `sleep 60` in one of the two does not make a diffrence, but anyway). Placing the code below in my control panel does not seem to do anything:               @reboot [app1path; bundle exec thin -C /etc/thin/app1.yml start; cd [app2path]; bundle exec thin -C /etc/thin/app2.yml start      What would work? I would be grateful for some tips and guidance.


How is it possible to do a live update while a program is running?

I wonder how killer applications such as Thunderbird or Firefox can be updated via the system's package manager while they are still running. What happens with the old code while they are being updated? What do I have to do when I want to write a program a.out that updates itself while it is running?


Create directory in /var/run/ at startup

I'm using apache2 and postgres running on Ubuntu Server 10.04.   I have removed the startup scripts for both of these apps and I'm using supervisor to monitor and control them. The problem I have run into is that both of these need directories in /var/run (with the correct permissions for the users they run under) for pid files. How do I create these during startup as they need to be created as root and then chown'd to the correct user? **Edit**   It seems the best way to so this is to creat the directories with custom init scripts. As I have no shell scripting skills at all how do I go about this?


How to suspend and resume processes

In the bash terminal I can hit `Control`+`Z` to suspend any running process... then I can type `fg` to resume the process. Is it possible to suspend a process if I only have it's PID? And if so, what command should I use? I'm looking for something like:               suspend-process $PID_OF_PROCESS      and then to resume it with               resume-process $PID_OF_PROCESS


Applications that run on Mono in Ubuntu

I think Mono, and the C# language, are a great, nay, fantastic project. My question is: how prevalent is Mono in Ubuntu? How much of a penetration is it getting, and what applications run on it?


I want to put an error checking solution to my script, it looks like this:               ! [ `echo $?` != 0 ] || echo "omg, st went wrong, CTRL+C? `read`"      My goal is when this line runs it check the "$?" - if it's not 0 then it says "omg, st went wrong, CTRL+C?" then it waits for enter, or CTRL+C from the user. But my one-liner isn't working, because it waits for an enter before printing the "omg, st went wrong, CTRL+C?" text. Can someone help me what am I missing? Thanks. UPDATE: it would be better to do it after the command st like in: Check that there was an error one-liner in script the "bad command" is "uname -k" the good command is "echo hi" - the uname gives non zero exit code, the echo gives 0


Can someone sniff NFS over internet?

I want to connect to my home server from work using NFS. I tried sshfs but some people say it's not as reliable as NFS. I know sshfs traffic is encrypted. But what about NFS? Can someone sniff my traffic and view the files I'm copying? I'm using NFSv4 in my LAN and it works great.


Issues compiling Tanuki Java Service wrapper version 3.1.2 under armv5tel architecture

Basically I need this specific version of the Tanuki Java Service Wrapper to run a specific Java application. I downloaded the source from the Tanuki website and I'm trying to compile it from source. This is under a Debian Linux system `armv5tel` architecture. It uses Ant, and there is a `build.sh` script that invokes a copy of Ant provided in the source. However, the compilation fails with this message:               home/build/wrapper_3.1.2_src/build.xml:263: Error starting javah: java.lang.NoSuchMethodException: com.sun.tools.javah.Main.<init>([Ljava.lang.String;)


Debian wake up from suspend password

I am using Debian Squeeze. When I suspend my laptop and wake it up again later, it doesn't ask for the system password. How do I fix this?


Are partition tables always required?

So I have a home server with 4 hdds: hdd1: 60Gb (SSD - OS drive)   hdd2: 4TB (data drive)   hdd3: 2TB (data drive)   hdd4: 1TB (data drive) So I intend installing ubuntu server onto hdd1 (ssd drive) with other drives simply being a data drives. So now I'm thinking about partitioning those data drives.... Do I even need to partition data drives? Can I just format them to ext4 and mount them? Is partitioning always needed?


Can I use a disk without partitioning it?

If I have a disk (whether a physical disk or a virtual disk managed by a some VM hypervisor) that I want to use as a single big partition, do I need to actually create a partition table with one big partition, or can I just create the filesystem on the raw disk? I.e. instead of partitioning /dev/sdg into one big /dev/sdg1 partition, can I just do `mkfs /dev/sdg` to create the filesystem on the entire disk and then mount it with `mount /dev/sdg /mount- point`? I tried it and it seems to work, but is there any reason not to do it if I know that I'm never going to want more than one partition on the disk?


When and why do block devices need to be partitioned?

> **Possible Duplicate:**   >  The merits of a partitionless filesystem So I've got a block device, say `/dev/sda` or `/dev/loop0`. Clearly if I want to boot from the former, or I want to subdivide it into segments with separate filesystems, I need to partition it. But suppose I don't have those needs. Instead, I just plan to use my entire block device as storage. Maybe I'll make it part of a raid volume, or maybe I'll encrypt it with cryptsetup, or maybe I'll make it a PV for LVM. Or maybe I just want to install a filesystem on it directly. In at least some of these cases, there doesn't seem to be any technical obstacle to using the device unpartitioned. That's what we generally do with block devices generated by losetup, and one can do it too with regular hard disks. I know because I've done it. Now, there are dangers to this. For instance, if you ever go on to run `fdisk /dev/sda`, you won't see anything sensible. And you might accidentally write a partition table or something like that to your device, and then the data you had on the unpartitioned device would be hosed. Maybe if you even boot into Windows with the device attached, it will get hosed. People tell scary stories. But I'd just like to understand, if the device is only ever connected to your Unix setup (and to keep things simple, let's stick to Linux only), and you never try to write a partition table or MBR to it or anything like that, are there any other downsides to using a storage device unpartitioned? I'm not proposing to do it; I just want to understand what the genuine reasons for not doing it are. On the flip side, is there any obstacle or downside to partitioning the block device `/dev/loop0`? Perhaps there'd be no advantage to doing so. But I expect it would work, wouldn't it? Here, too, I'm only asking because I want to understand the reasons behind our standard practices.


How to mirror two screens / nvidia graphic pilot / LMDE / Macbook 2008

I'm using LMDE on a MacBook 2008; it works perfectly (and my MacBook runs much more faster than with Mac OS X) I have one problem: when I plug in an external display, I can't get the two displays to display the same thing (mirror) — I always have two different screens. When I go into the System Configuration Tool, and then Display Tools, I'm not able to choose the "same image on both screens" (I can't click it). I'm also using the NVIDIA X Server tools, nothing like a mirror option in it — or perhaps, I don't understand how to switch it. The graphics pilot I use is the nvidia-310 one — my graphics card is a GeForce 9400M.


Will my MySQL query continue to run even if my ssh connection drops?

I've connected to a server over SSH and logged in to mysql, and asked it to run a query (the results of which are dumped into a CSV) that could take well over an hour. Although I have instructed my client to send null packets every 60 seconds to keep the session active, I am still paranoid the mysql query / process could terminate, so my questions are:   1. Will a cancelled ssh session (due to inactivity) kill the mysql query process?   2. How can I ensure this doesn't happen - are the null packet sends every 60 seconds enough?


How to restore default crontab file

I have recently lost my cronjobs. now when i do               crontab -e      i am presented with an empty file. i would like to get the default file back with the nifty comments and explanaitions at the top!


What does the `set $variable` do?

I know that `set` is used to manipulate environment variables, but I want to make myself sure - these alterations are not permanent, right? I mean once I close shell and reopen it, no changes will be preserved, won't they? And they are not inherited by the child processes, lest `export` is used, am I correct? I mean expressions like               set IFS ':'


log rotate, why creating a fresh log is called log rotate instead of log delete or log refresh

Why creating a fresh log file is called log rotate instead of log refresh or log delete? What does the word rotate emphasis?


Why does Alt+SysRq+B not always trigger while REISU do?

On many different machines, when I come across a lockup, I often use `Alt`+`SysRq`+`REISUB` to reboot without too much losses. But I often noticed that although `REISU` commands work even when I just hold `Alt`+`SysRq` and enter them without releasing `Alt`+`SysRq`, the last one, `B`, seems to be very "lazy": I have to repeat it many times, and in fact it doesn't trigger until I do the cycle "press `Alt`+`SysRq`, type B, release `Alt`+`SysRq`" multiple times (and not always the same number of times). At first occurrences of this problem I thought it's the kernel which has locked too hard that it doesn't "see" my `B` command, but when I realized that multiple repetitions of it do allow me to trigger reboot, it now seems that it's something general. Even on a working system (be it Debian, Ubuntu, LFS etc.), I can easily reproduce this. In fact, I can even load the kernel with `init=/bin/bash` and reproduce this from this bash prompt. Looking at serial console output, I see all the feedback on `REISU`, but only one feedback print on multiple `B` commands — when the kernel finally is convinced to do a reboot. Why is this? Is it some kernel feature which prevents unintended reset, or maybe it's just a bug (quite strange one)? Note that I'm using plain keyboard with no `Fn` or multimedia keys, so this question isn't a duplicate of this one.


using "ifne" in Bash pipe

In my script, I am using the `ifne` utility from the `moreutils` package. The line can be simplified to the following:               printf "asdf\n" | ifne cat - && echo "stream not empty"      `ifne` only executes, if the stream is non-emty. But how can I make the second command (echo "stream not empty") also execute only if non empty? As it is now, in following case echo is executed (but I don't want it to be executed):               printf "" | ifne cat - && echo "stream not empty"      using parenthesis gives me syntax error:               printf "" | ifne (cat - && echo "stream not empty")      How can I execute the last command only if stream is non-empty?


i3-wm not resizing screen resolution on login

I'm using Parallels for the Mac, but this may be relevant to other VMs too. Using Ubuntu 14.04, when I login using Unity it resizes the screen and uses all available screens (2 in my case), perfect. However, I'd rather use i3wm, but when I login, it doesn't resize the screen (it's stuck on 1024x768), and doesn't use my extra monitor. Not sure if this is a i3 thing or a Parallels/VM thing, or both.


Does root not require a password to log in as a user?

Does root not require a password to log in as a user even though a password has been set for that user? When I am logged in as "root", `su user` logs me in as "user". There is no prompt for a password. From there `su user` requires a password. Is this normal? Debian 6 here.


Count total number of lines before/after a pattern match

I am having a long list of IP addresses, which are not in sequence. I need to find how many IP addresses are there before/after a particular IP address. How can I achieve this?


Are zombie processes something I should be concerned about?

I run a server. Should I be concerned about zombie processes? Do they consume any system resources (RAM, process table entry, etc.) that I should be concerned about?


Hide parent directory but allow to view dir

I would like the following result on my UNIX system: `ls -l /users/test` -> permission denied, or any other way so I can't see the content of it. `ls -l /users/test/testdir/` -> shows all files in the directory Do you have any solutions for this?


How many rings does OpenBSD use?

Usually a Windows/Linux operating system uses afaik max 2 rings But how many rings does OpenBSD use?


Debian checkinstall ignores install=no; how to have it build, but NOT autoinstall a package?

Ok, here is one thing that puzzles me... I'm trying to build a package from source, and then use `checkinstall` to generate a .deb package. Note that I want to just create the .deb package, but I do NOT want to _install_ it. So, here's an example - I'm on Ubuntu 11.04, and first I install it's `feh` package from the default repositories; which has a version number apparently being 1.3.4.dfsg.1-3 Then I'm trying to build `feh` from source; got `make` to pass, and can run the new `feh` from the command line; splendid. Now finally, to create a deb package, I use the following command line:               sudo checkinstall -D -y \       --install=no \       --fstrans=no \       --reset-uids=yes \       --pkgname=feh \       --pkgversion=2.7 \       --pkgrelease="tar.bz2" \       --arch=i386 \       --pkglicense=GPL \       --maintainer="Debian PhotoTools Maintainers <pkg-phototools-devel@lists.alioth.debian.org>" \       --pakdir=../.. \       --requires=libc6,libice6,libsm6,libx11-6,libxaw7,libxext6,libxmu6,libxt6,dpkg,install-info      OK, notice that I've used **`\--install=no`** there? Even `man checkinstall` says: > --install Toggle installation of the created package. Well, this is what this `checkinstall` command replies:               checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran                This software is released under the GNU GPL.          /usr/bin/checkinstall: eval: line 598: syntax error near unexpected token `newline'     /usr/bin/checkinstall: eval: line 598: `echo Debian PhotoTools Maintainers <pkg-phototools-devel@lists.alioth.debian.org>'          The package documentation directory ./doc-pak does not exist.      Should I create a default set of package docs?  [y]: y          Preparing package documentation...OK          *****************************************     **** Debian package creation selected ***     *****************************************          This package will be built according to these values:           0 -  Maintainer: [ root@mypc ]     1 -  Summary: [ Package created with checkinstall 1.6.2 ]     2 -  Name:    [ feh ]     3 -  Version: [ 2.7 ]     4 -  Release: [ tar.bz2 ]     5 -  License: [ GPL ]     6 -  Group:   [ checkinstall ]     7 -  Architecture: [ i386 ]     8 -  Source location: [ feh-2.7 ]     9 -  Alternate source location: [  ]     10 - Requires: [ libc6,libice6,libsm6,libx11-6,libxaw7,libxext6,libxmu6,libxt6,dpkg,install-info ]     11 - Provides: [ feh ]     12 - Conflicts: [  ]     13 - Replaces: [  ]          Enter a number to change any of them or press ENTER to continue:           Installing with make install...          ========================= Installation results ===========================     installing manuals to /usr/local/share/man     installing docs to /usr/local/share/doc/feh     installing executables to /usr/local/bin     installing fonts to /usr/local/share/feh/fonts     installing images to /usr/local/share/feh/images     installing examples to /usr/local/share/doc/feh/examples          ======================== Installation successful ==========================      NOOOOOOOOOOOOOOOOO!!!!!!!!!! I did NOT want the damn package to INSTALL -- THAT IS WHY I USED `\--install=no` FOR CRYIN OUT LOUD!!! And then, apparently in an attempt to be sarcastic, the log continues:               Copying documentation directory...     ./     ./TODO     ./AUTHORS     ./COPYING     ./ChangeLog     ./README          Copying files to the temporary directory...OK          Stripping ELF binaries and libraries...OK          Compressing man pages...OK          Building file list...OK          Building Debian package...OK          NOTE: The package will not be installed      You must be kidding with this " _NOTE: The package will not be installed_ ", right, Mr. `checkinstall`? Sure you are; after this is done, note what I get:               $ apt-cache show feh | grep Version     Version: 1.10-1          $ feh --version     feh version 2.7     Compile-time switches: curl xinerama           $ which feh     /usr/local/bin/feh      Not sure where that `1.10-1` came from (it should have been at least `1.3.4`, as per above?) - but its damn obvious that the 2.7 DID get installed, IN SPITE of my instruction NOT to install... Surely, I can try to remove afterwards:               $ sudo dpkg -r feh     (Reading database ... 202193 files and directories currently installed.)     Removing feh ...     $ sudo dpkg --purge feh     (Reading database ... 202163 files and directories currently installed.)     Removing feh ...     Purging configuration files for feh ...     $ feh --version     feh version 2.7     Compile-time switches: curl xinerama      $ which feh     /usr/local/bin/feh      ... but not even `dpkg --purge` works (`apt-get remove` wouldn't work to begin with, since it's a manually installed .deb package). And besides `dpkg -r` not giving a version (so I'm not really sure what it is that should have been removed) - it in fact did NOT remove the bloody executable ?! But can anyone explain what is going here - and how to get `checkinstall` to _only_ generate a .deb, and NOT install it at the same time? Bonus question - how to remove ALL files, _including_ executables in `/usr/local/bin/`, that got installed in this way - since apparently `dpkg -r` doesn't work?


ServeRAID error in syslog, is it important?

I was checking the logs in server when i came across this message.               Nov 4 12:52:05 SERVERNAME ServeRAID Manager Agent: [338] Periodic scan     found one or more critical logical drives: controller 1. Repair as soon as     possible to avoid data loss.        1. What does this mean?   2. Is it Critical or can be ignored?   3. If critical how to solve it?


Registering a Standalong app in the Application Launcher of KDE

First off, I am using Kubuntu 12.04. I've just downloaded and unpacked a standalone installation of some software (Intellij's Phpstorm IDE, but I don't think it matters). I've copied the unpacked directory to my `/opt` directory using sudo. I am able to launch the main shell script from the commandline without using `sudo` with no issues. * * * I would like to run the app from my `Application Launcher` so, I ran the `Edit Applications...` app from the Launcher icon and added the path to the main shell script in a new entry (`/opt/PhpStorm-111.344/bin/phpstorm.sh`) and saved it. Whenever I click the newly added entry... nothing happens, the application does not launch. I have seen this question about registering applications in kde, and I dont think it applies to this situation since that is what the `Edit Applications...` dialog is supposed to do (I think). So what am I missing? Do I need to specify another way of running the command in the dialog entry? Is this a `.desktop` file issue? Something else? **EDIT:**   I ran the command `/opt/PhpStorm-111.344/bin/phpstorm.sh` from the `ALT+F2` _run_ box , invoking a terminal. I was returned with a message complaining that the `$JAVA_HOME` variable cannot be found. Now, I do indeed have a `$JAVA_HOME` environment variable setup in my `.bashrc` file, and it can be seen from an `echo $JAVA_HOME` command. Again, I am able to run the application with no problems if I simply open a terminal and run the shell script from there, so the `$JAVA_HOME` variable is seen in that context. I have logged out and back in and run `source ~/.bashrc`, and neither seem to help. I am thinking now it is some sort of user permission issue to the `$JAVA_HOME` variable that is preventing it from running. Any suggestions?


How to configure mounted FTP connection

I'm using latest CentOS with Gnome, and using bookmarked FTP connection, that connects to my server, and mounts remote directory. The thing is, I see no way to configure that FTP client, whatever that is. I get timeout's too often, and annoying popup of that, makes me do submit changes twice. So, question: how to configure integrated filesystem FTP connection/mounting tool, to set up some sort of connection keep-alive.


How can I populate a file with random data?

How can I create a new file and fill it with 1 Gigabyte worth of random data? I need this to test some software. I would prefer to use `/dev/random` or `/dev/urandom`.


What happened to my ext3 partition

I had an ext3 partition. I ran a dd command like this:               dd if=/dev/urandom of=/dev/part2 bs=1024 count=15000 seek="various values"      Where `various values` are basically 0, 15000K, 30000K etc. The point is I ran the dd command on the entire partition. Now the partition won't mount. I get an error "Can't find ext3 partition on ..." Questions:   1. What exactly happened to the partition? I know it got corrupted, but what exactly happened? As a clue `fsck /dev/part2` gives "The superblock could not be read or does not describe a correct ext2 filesystem."   2. How do I format it back to ext3?


RTC clock time sync with the Linux time on Startup

The RTC remembers its time set, and how does the linux kernel gets this time from dev/rtc and set it as the linux time. In other words on boot up - when does kernel reads the rtc and updates its linux time.


How to disable clicking in Seagate ST3000DM001?

Recently I bought this disk and I cannot get rid of funny clicking -- funny because normally not configured disk make dry click. This one make click like a sweet chirp. But besides this, this click occurs every several seconds, and it is annoying. I tried as usual: `hdparm -B 254` but it changed nothing. So does anyone know how to disable that clicking?


How to show full names on desktop in XFCE?

I am new to XFCE so forgive me if I am missing something dead simple, but... Let's say I have an icon on desktop "personal folder". What I actually see is the icon and "perso..." -- so **the question is** how to display full name, no matter how long it is. No shortening, however line breaks are fine (so for example it would be displayed in two lines "personal" and second "folder").


strace got message --- SIGIO (I/O possible) @ 0 (0) ---

I'm trying to monitor serial port communication using `strace -s9999 -o serialtrace.log -eread,write,ioctl` command. After few normal logging messages I got guge amount of message `\--- SIGIO (I/O possible) @ 0 (0) ---`. What does it means? How to get normal information instead of these lines?


Port Mirroring in Fedora?

I have set up an application that listens constantly to a port for network packets, and I would like to create another one that receives the same network packets ( for use as a test bed). Getting the packets sent to 2 different ports on the machine is not an option, so I was wondering if there is a way to set up a "port-mirror". Basically, is there an easy way to make all traffic received on port XXXXX also copy to port XXXXX + 1? I know there is a similar question here, but I don't quite understand the suggested solution. Barring that, is there another easy way to simulate network data to test some code with that I am overlooking? Any tips would be appreciated. Thanks!


How to clone a read-only portion of /proc file system

The problem with reading /proc file system is that it is not atomic. I tried using a library (procfs in Python) that wishes to read it, but it has glitches about 5% of the time because the process that I am after is now gone. So, I wish to copy everything in /proc to another location, say `/proc_clone/<GUID>/`. A GUID can be generated using the `uuidgen` command. The naive approach would be trying to use `cp -r`, but I am getting a whole bunch of 'permission denied' errors and it is taking more than a second. I am only after a subset `/proc/<pid>` and even then, only the read-only stuff that can be turned into a string (ultimately I wish to build a single JSON file that contains all of this). I am looking for a script that would do that for me and is also short, simple, very fast, **can deal with processes dying mid-flight by skipping them** , however, I would like to avoid writing C code - I would much rather stick to bash, existing utilities and maybe Perl / Python. The goal here is just to take a snapshot of a subset of `/proc`, not produce the JSON file itself. I have heard opinions that "one should not ever try to copy `/proc` but just read from it". Well, the non-atomic nature of it means that one has to throw a bunch of `try/catch` all over the code when trying to do very simple operations. Using a high level language like Python (what I ultimately want to use) to iterate over `/proc` is a slow method, which involves both IO and CPU time. This increases the risk of seeing a process die on you (I certainly see it often; I have a script that interrogates /proc every minute and I run into plenty of exceptions). I would like to build a library that outputs a single JSON file that contains cpu and memory usage information about processes in a human-readable format (e.g. using seconds and not jiffies, bytes and not pages, have units in addition to values. I am not concerned that it would take some time to create that file out of a directory dump; I just want to make sure that the snapshot is as accurate as possible. So. if I should not just copy /proc over, then which other method should I use?