Fedora 20 dosen't accept correct PIN for mobile broadband

I have a problem with the WWAN (Qualcomm Gobi 2000) in my Lenovo ThinkPad W510. I can not unlock my SIM card with the correct PIN. I enter the PIN in this dialog and after this ![SIM PIN](http://i.stack.imgur.com/BSU57.png) I get immediately this dialog ![SIM PIN2](http://i.stack.imgur.com/VduwJ.png) After I enter the SIM PIN2 the only thing that happens is that I get a notification that says that the connection is disabled. I know that this is not a problem with the PIN or the SIM card because I checked both with my Windows 8 notebook. What I have to do to use the WWAN in my notebook. Update from 2014-04-29 Just found this via `journalctl`               Apr 29 17:43:32 NetworkManager[1022]: <info> Activation (cdc-wdm0) starting connection 'O2'     Apr 29 17:43:32 NetworkManager[1022]: <info> (cdc-wdm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]     Apr 29 17:43:32 NetworkManager[1022]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) scheduled...     Apr 29 17:43:32 NetworkManager[1022]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) started...     Apr 29 17:43:32 NetworkManager[1022]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) complete.     Apr 29 17:43:32 ModemManager[900]: <info>  Simple connect started...     Apr 29 17:43:32 ModemManager[900]: <info>  Simple connect state (3/8): Enable     Apr 29 17:43:32 ModemManager[900]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (disabled -> enabling)     Apr 29 17:43:32 NetworkManager[1022]: <info> (cdc-wdm0) modem state changed, 'disabled' --> 'enabling' (reason: user-requested)     Apr 29 17:43:32 ModemManager[900]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (enabling -> disabled)     Apr 29 17:43:32 NetworkManager[1022]: <info> (cdc-wdm0) modem state changed, 'enabling' --> 'disabled' (reason: unknown)     Apr 29 17:43:32 NetworkManager[1022]: <warn> (cdc-wdm0) failed to connect modem: Couldn't set operating mode: QMI protocol error (60): 'InvalidTransaction'     Apr 29 17:43:32 NetworkManager[1022]: <info> (cdc-wdm0): device state change: prepare -> failed (reason 'unknown') [40 120 1]     Apr 29 17:43:32 NetworkManager[1022]: <warn> Activation (cdc-wdm0) failed for connection 'O2'     Apr 29 17:43:32 NetworkManager[1022]: <info> (cdc-wdm0): device state change: failed -> disconnected (reason 'none') [120 30 0]     Apr 29 17:43:32 NetworkManager[1022]: <info> (cdc-wdm0): deactivating device (reason 'none') [0]     Apr 29 17:43:32 firewalld[887]: 2014-04-29 17:43:32 ERROR: UNKNOWN_INTERFACE: cdc-wdm0     Apr 29 17:43:32 NetworkManager[1022]: <warn> (cdc-wdm0) firewall zone remove failed: (32) UNKNOWN_INTERFACE: cdc-wdm0     Apr 29 17:45:52 PackageKit[2687]: daemon quit     Apr 29 17:46:40 dbus-daemon[928]: dbus[928]: [system] Activating via systemd: service name='org.freedesktop.PackageKit' unit='packagekit.service'     Apr 29 17:46:40 dbus[928]: [system] Activating via systemd: service name='org.freedesktop.PackageKit' unit='packagekit.service'     Apr 29 17:46:40 systemd[1]: Starting PackageKit Daemon...     Apr 29 17:46:40 PackageKit[3672]: daemon start     Apr 29 17:46:40 dbus-daemon[928]: dbus[928]: [system] Successfully activated service 'org.freedesktop.PackageKit'     Apr 29 17:46:40 dbus[928]: [system] Successfully activated service 'org.freedesktop.PackageKit'     Apr 29 17:46:40 systemd[1]: Started PackageKit Daemon.     Apr 29 17:46:44 PackageKit[3672]: get-updates transaction /395_dedbecee from uid 1000 finished with success after 4026ms      Update from 2014-05-02 AFAIK the WWAN firmware is loaded and the device is successfully initialized:               nmcli -p n     ============       Netzwerk     ============     NETZWERK       ------------     aktiviert      [root@uss-titan marceljanus]# nmcli -p d     ======================================               Status der Geräte     ======================================     GERÄT     TYP       STATUS               --------------------------------------     wlp3s0    wifi      verbunden            cdc-wdm0  gsm       nicht verbunden      em1       ethernet  nicht verfügbar      lo        loopback  nicht verwaltet           lsusb     Bus 002 Device 004: ID 05c6:9205 Qualcomm, Inc.      Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub     Bus 003 Device 004: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive     Bus 003 Device 002: ID 04b3:310d IBM Corp.      Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 005: ID 17ef:480f Lenovo Integrated Webcam [R5U877]     Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. BCM2045B (BDC-2.1)     Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor     Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub      Output from `/var/log/messages` after trying to enable the connection:               May  2 15:11:34 NetworkManager[889]: <info> Activation (cdc-wdm0) starting connection 'O2'     May  2 15:11:34 NetworkManager[889]: <info> (cdc-wdm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]     May  2 15:11:34 NetworkManager[889]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) scheduled...     May  2 15:11:34 NetworkManager[889]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) started...     May  2 15:11:34 NetworkManager[889]: <info> Activation (cdc-wdm0) Stage 1 of 5 (Device Prepare) complete.     May  2 15:11:34 ModemManager[793]: <info>  Simple connect started...     May  2 15:11:34 ModemManager[793]: <info>  Simple connect state (3/8): Enable     May  2 15:11:34 ModemManager[793]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (disabled -> enabling)     May  2 15:11:34 NetworkManager[889]: <info> (cdc-wdm0) modem state changed, 'disabled' --> 'enabling' (reason: user-requested)     May  2 15:11:34 ModemManager[793]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (enabling -> disabled)     May  2 15:11:34 NetworkManager[889]: <info> (cdc-wdm0) modem state changed, 'enabling' --> 'disabled' (reason: unknown)     May  2 15:11:34 NetworkManager[889]: <warn> (cdc-wdm0) failed to connect modem: Couldn't set operating mode: QMI protocol error (60): 'InvalidTransaction'     May  2 15:11:34 NetworkManager[889]: <info> (cdc-wdm0): device state change: prepare -> failed (reason 'unknown') [40 120 1]     May  2 15:11:34 NetworkManager[889]: <warn> Activation (cdc-wdm0) failed for connection 'O2'     May  2 15:11:34 NetworkManager[889]: <info> (cdc-wdm0): device state change: failed -> disconnected (reason 'none') [120 30 0]     May  2 15:11:34 NetworkManager[889]: <info> (cdc-wdm0): deactivating device (reason 'none') [0]     May  2 15:11:34 firewalld: 2014-05-02 15:11:34 ERROR: UNKNOWN_INTERFACE: cdc-wdm0     May  2 15:11:34 NetworkManager[889]: <warn> (cdc-wdm0) firewall zone remove failed: (32) UNKNOWN_INTERFACE: cdc-wdm0


Command 'uptime' returns 'average'

I wrote a simple bash script that checks the load average values using 'uptime' every 5 minutes and writes a result to the text file. Everything is OK except one thing: every day from 12:00 to 13:00 I see text value 'average' instead of regular integer values. How should I interpreter the 'average' as a result of 'uptime' command? And if I run 'uptime' from the command line everything is OK - I see regular integer values. The source code below:               #!/bin/bash          sCurrentUptime="$(uptime | awk '{print $10}')"     iLength="${#sCurrentUptime}"     sUptime="${sCurrentUptime:0:iLength-1}"     iUptime=${sUptime/.*}     now="$(date)"     echo $now';'$iUptime      And here are the outputs (last collumns contains load average value):               Thu Apr 17 08:40:01 MSK 2014;0     Thu Apr 17 09:00:01 MSK 2014;2     Thu Apr 17 09:20:02 MSK 2014;3     Thu Apr 17 09:40:02 MSK 2014;3     Thu Apr 17 10:00:01 MSK 2014;2     Thu Apr 17 10:20:01 MSK 2014;3     Thu Apr 17 10:40:01 MSK 2014;1     Thu Apr 17 11:00:02 MSK 2014;2     Thu Apr 17 11:20:01 MSK 2014;3     Thu Apr 17 11:40:01 MSK 2014;2     Thu Apr 17 12:00:02 MSK 2014;3     Thu Apr 17 12:20:02 MSK 2014;average     Thu Apr 17 12:40:01 MSK 2014;average     Thu Apr 17 13:00:01 MSK 2014;average     Thu Apr 17 13:20:01 MSK 2014;3     Thu Apr 17 13:40:01 MSK 2014;1     Thu Apr 17 14:00:01 MSK 2014;2     Thu Apr 17 14:20:01 MSK 2014;3     Thu Apr 17 14:40:01 MSK 2014;2     Thu Apr 17 15:00:01 MSK 2014;2     Thu Apr 17 15:20:01 MSK 2014;3     Thu Apr 17 15:40:01 MSK 2014;1


How do I make a tmpfs mountpoint persistent across reboots?

If I create a ram disk on cent os using tmpfs will it go away on restart? I know the data will go away (I would assume), but will it still survive a reboot? I am going to allocate a ram disk for use on mysql /tmp directory I just want to make sure it will work after reboot. (I don't have another server to try it on)


Can not start Oracle after installation

I'm using Lenovo G580 under intel i5 third generation with 4GB RAM. I'm trying to install Oracle 11g standard edition After completing all pre installation and post installation procedures, when I started sqlplus I got an error, something like this:               sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory      I've searched many websites, but I didn't get clear way to rectify this. What do I need to do to get rid of this error?


Fedora 3200x1800 resolution to small - can't see anything

I bought the a new notebook (Dell M3800) and installed Fedora 20 with KDE for the first time on it (actually my first Linux system ever). My problem is now, that my resolution is tooo big.. I can't see anything. And I can't even select a lower one, which should fit ( **16:9** ). So a friend of mine changed somehow manually the resolution to **1920x1080** , but somehow it doesn't looks like it's perfectly high resolution. He created somehow a file and a script (because when you run that file it takes effect, but after a restart it's on the QHD+ resolution again). Anybody knows why the resolution doesn't looks like that good. Maybe somebody has a cleaner solution for me? Here is the output of `xrandr`:               Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192         eDP1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 346mm x 194mm        3200x1800     59.98 +        2048x1536     60.00          1920x1440     60.00          1856x1392     60.01          1792x1344     60.01          1600x1200     60.00          1400x1050     59.98          1280x1024     60.02          1280x960      60.00          1024x768      60.00          800x600       60.32    56.25          640x480       59.94          1920x1080     59.96*      VGA1 disconnected (normal left inverted right x axis y axis)     HDMI1 disconnected (normal left inverted right x axis y axis)     DP1 disconnected (normal left inverted right x axis y axis)     HDMI2 disconnected (normal left inverted right x axis y axis)


Calling `source` from bash function

I'm trying to source a file whose name is passed from stdin. My plan is to create a function like this:               mySource() {         # get stdin and pass it as an argument to `source`         source $(cat)     }      to be called like this: `$ echo "file1.sh" | mySource` wherein `file1.sh` is:               FILE=success     export FILE      Assuming `$FILE` is initialized to `hello world`, when I run `$ echo "file1.sh" | mySource`, I expect `$ echo $FILE` to print `success`; however, instead it prints `hello world`. Is there some way to source a file from a function?


How do I access a web server behind NAT and proxy?

I have installed a local web server for an web application for a customer. Their server is behind NAT and uses proxy for access internet. Is there a way to access the web application remotely from my computer?


Identify lines that are out of order

I have a process that generates output _mostly_ in lexicographically sorted order according to a (timestamp) field, but occasionally the lines will be output in the wrong order:               2014-08-14 15:42:02.019220203 ok     2014-08-14 15:42:03.523164367 ok     2014-08-14 15:42:04.525655832 ok     2014-08-14 15:42:06.523324269 ok     2014-08-14 15:42:05.930966407 oops     2014-08-14 15:42:07.643347946 ok     2014-08-14 15:42:07.567283110 oops      How can I identify each location where the data are "unsorted"? Expected output (or similar):               2014-08-14 15:42:05.930966407 oops     2014-08-14 15:42:07.567283110 oops      I need a solution that works as the data are generated (e.g. in a pipeline); it's less useful if it only operates on complete files. `sort --check` would be ideal but it only outputs the _first_ point of disorder; I need a full listing.


remove a char string from a command output (sed, or maybe something else)

I'm trying to retrieve the distro name from the `lsb_release -i` output, but using               lsb_release -i | sed 's/Distributor ID: //g'      won't do the trick. What am I doing wrong? Or maybe should I change the tool?


Simpler processing of shell script options

I'm looking for way to process shell script arguments that is cleaner and more "self documenting" than getopt/getopts. It would need to provide...   * Full support of long options with or without a value after '=' or ' '(space).   * Proper handling of hyphenated option names (i.e. --ignore-case)   * Proper handling of quoted option values (i.e. --text "A text string") I would like to eliminate the overhead of the big loop with embedded case statement that getopt/getopts requires and reduce option processing to something like...               option=argumentparse "$@"     [[ option == ""           ]] && helpShow     [[ option =~ -h|--help    ]] && helpShow     [[ option =~ -v|--version ]] && versionShow     [[ option =~ -G|--GUI     ]] && GUI=$TRUE     [[ option =~ --title      ]] && TITLE=${option["--title"]}      Here, an argumentparse() function resolves the various syntax possibilities into a consistent format, perhaps an associative array. There must be something coded out there somewhere. Any ideas? _(updated and retitled)_


Enable udev and speex support for pulseaudio

I tried to install pulse audio, but after running `./configure` I got a warning message:               ===== WARNING WARNING WARNING WARNING WARNING WARNING WARNING =====     You do not have udev support enabled. It is strongly recommended     that you enable udev support if your platform supports it as it is     the primary method used to detect hardware audio devices (on Linux)     and is thus a critical part of PulseAudio on that platform.     ===== WARNING WARNING WARNING WARNING WARNING WARNING WARNING =====               ===== WARNING WARNING WARNING WARNING WARNING WARNING WARNING =====     You do not have speex support enabled. It is strongly recommended     that you enable speex support if your platform supports it as it is     the primary method used for audio resampling and is thus a critical     part of PulseAudio on that platform.     ===== WARNING WARNING WARNING WARNING WARNING WARNING WARNING =====      I tried to find information about enabling these two services, but I couldn't find anything. How can I enable them?


Video Gibberish (once every week or two)

Trying to track down an odd video problem. I was running Ubuntu (Precise Penguin) before and running Lucid before that. In both cases the video was running fine (over the last two years). However just less than two months ago I installed Linux Mint 13 and am returning to a mess of video gibberish on my computer about once every week or two. The last time it happened was this morning (Feb 18th). Since the VAR LOG MESSAGES log isn't enable in Mint by default, I don't have a lot of historical data to give. I just enabled it about a week and a half ago. VAR LOG MESSAGES http://pastebin.com/yjgtjhn1 XORG.0 LOG http://pastebin.com/Jy1acYu4 For further clarification, the "gibberish" looks like what would happen if you had an incorrect video driver. However attempting go switch to another TTY using CTRL ALT F* does nothing. I've also tried to restart X with CTRL+ALT+Backspace and that does nothing either. Oddly I end up just hard resetting the computer to get things back. Can anyone shed any light on this problem for me or give me further troubleshooting steps?


switching nvidia profiles

I have an old laptop with a nivdia card (360m) and I use powermizer to force it to run a very low clock. Heres my configuration at `/etc/X11/xorg.conf.d/20-nvidia.conf`                  Section "Device"           Identifier "Device0"                                                             Driver    "nvidia"                                                                           Option     "RegistryDwords" "PowerMizerLevelAC=0x3"                                                                                Option     "NoLogo" "1"        EndSection      Right now, whenever I watch movies or play a few games on Steam, I manually change the file so that gpu runs at a higher clock. Its a bit clumsy but it gets the job done. Are there better ways to do this? ( Like a different X profile for different users)


`ls` behavior on EACCES error for /root and /root/some-rubbish

I'm trying to code a clone of the `ls` command as part of a school exercise. I'm wondering why the following output is displayed by `ls`:               $> ls -- -test_dir  /root /root/some-rubbish     ls: /root/some-rubbish: Permission denied     -test_dir:     test.txt          /root:     ls: root: Permission denied      Specifically, I've noticed that when the searched folder has more than one "part", that is, when is it has at least one `/` between two alphanumerical parts, like `that/folder`, then `EACCES` errors get displayed at the top. Otherwise, they are displayed in alphabetical order like any other listed directory. I'm currently testing this on OSX 10.8, if that makes any difference. I hope the above is clear enough. If not, I'll try to clarify.


How to build a python egg for a TRAC plugin?

I'd like to install a mercurial plugin for Trac. The manual provides an svn path with the source code. I need to create an "egg" from that source code. Do I need to have SVN installed in order to do this, or can this be done in a different way? (I'm very new to Linux, I've been using it only for the past two weeks.)


Can I query which processes (if any) are currently accessing the microphone?

I'm running Debian (technically Raspbian), trying to get a Star-Trek style voice-command system. I've got it mostly up and running, but in the interests of privacy and all that jazz, I don't want my microphone always recording. I'm wondering, is there a way to poll which processes, if any, are currently accessing the microphone? The idea is that I'd make myself a little indicator to tell if the microphone was currently recording audio or not. My ultimate goal is to turn the microphone on and off using a TV-remote, and to have an LED indicator for if it's on or off. I've got all the hardware stuff working, I just need the software end now. I believe that right now I'm configured in pure ALSA i.e. not PulseAudio, though I could be wrong.


How to detect IP of given device in same network

I have a very typical situation in which I want to connect an (android) phone to a linux notebook in the same (wifi) network using ssh. The IP's are assigned by DHCP so I know only the one of the client in advance. Knowing the IP of the client I could in principle loop a ssh command over all possible IP's in the same net to see if a server is listening there. However this seems highly inefficient. So, how can I figure out the IP of my host (knowing it's MAC address) so I can connect to it using ssh? I know about other software which achieves something like this so it must be possible. Related: can I dynamically assign a hostname to this IP on the client (assuming it is Linux) so that I can use a static entry in the ssh config file?


One non-root user run jetty by port 512 which less that port1024

Customer asks us to create a non-root user to run our web system which bind port 512, less than 1024. When web server(jetty) runs, this is the exception:               2013-10-16 14:49:51.406:WARN::failed Server@2c2893ce: java.net.SocketException: Permission denied     2013-10-16 14:49:51.406:WARN::EXCEPTION     java.net.SocketException: Permission denied             at sun.nio.ch.Net.bind0(Native Method)             at sun.nio.ch.Net.bind(Net.java:444)             at sun.nio.ch.Net.bind(Net.java:436)             at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)      So I found out some solutions about how non-root user bind port less than 1024, at last the solution i used was set "cap_net_bind_service" to java, by set Capabilities, the command is:               sudo setcap cap_net_bind_service+eip /usr/lib/jvm/jdk1.7.0_25/bin/java      But when i start jetty again, another error happens:               [admin@VPRCEMSUSOFC04 bin]$ ./jetty.sh start     Starting Jetty: /usr/lib/jvm/jdk1.7.0_25/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory      Even when I execute `java -version`, it also causes an exception:               [admin@VPRCEMSUSOFC04 bin]$ java -version     java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory      But when I login with root, it`s fine:               [root@VPRCEMSUSOFC04 etc]# java -version     java version "1.7.0_25"     Java(TM) SE Runtime Environment (build 1.7.0_25-b15)     Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)      I can`t understand why this happen. Why there are two different results under root and non-root user. It seems that set Capabilities impact this. The Linux kernel is 2.6.32-220.el6.x86_64. OS is Red Hat Enterprise Linux Server release 6.2 (Santiago).


What is the best way to check if file has changed in Bash and keep 15 last copies of it?

What would be the best way to write a bash script and run it from `cron` (every hour) that:   1. Would see if a file in a directory has changed   2. If changed, make a copy with incrementing version number and date appended to filename   3. Keep last 15 versions of the file in the directory and delete the ones above 15th I kind of feel I could have a go at it, but this one is important for me so I would be very glad to have opinion from others as I don't know shell scripting that well. I use mostly Debian and fedora.


How to get lilbmp3lame encoding to work with ffmpeg?

When I am converting an FLV to an AVI one, I always get:               Unknown encoder 'libmp3lame'      But I've installed it with Ubuntu Software Center. I am using this command:               ffmpeg -i video.flv -acodec libmp3lame -vcodec msmpeg4 -ab 192kb -b 1000kb -s 640x480 -ar 44100 video.avi      How do I get this to work?


What's the difference between fdisk -l and df -h?

In my ubuntu system, I want to have a look about my system disk info. When I use `fdisk -l` without `sudo`, I get nothing. But with `sudo fdisk -l`, I only get a device /dev/sda1, but when I use `df -h`, I get so many devices, like `/dev/sda2`, `/dev/sda4` and so on. What is the difference between such disk operations?               # fdisk -l     WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use          Disk /dev/sda: 6000.1 GB, 60000069312512 bytes     255 heads, 63 sectors/track, 729466 cylinders, tatal 11718885376 sectars     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000        Device Boot     Start          End      Blocks   Id  System     /dev/sda1              1   4294967295  2147483647+  ee  GPT          # df -h     Filesystem     Size  Used Avail Use% Mounted on     /dev/sda2      457G  2.0G  432G   1% /     udev            16G  4.0K   16G   1% /dev     tmpfs          6.3G  236K  6.3G   1% /run     none           5.0M     0  5.0M   0% /run/lock     none            16G     0   16G   0% /run/shm     /dev/sda4      5.0T  604G  4.2T  13% /var


How to monitor user who using dropbear ssh tunneling?

I was used OpenSSH in my debian server. I can see who is using ssh tunneling using either nethogs or top command. When i change from openssh to dropbear i cant monitor user again. In nethogs or top command it only show root user. How to see if other user is using ssh tunneling ? Thanks.


What do $@ and $< in a makefile mean?

I am seeing a makefile and it has the symbols $@ and $< in it. I have never seen them, and Google does not show any results about them. Do you know what these commands do?


How to refresh the desktop background in various desktop environments?

In XFCE 4.10 I can refresh my desktop background with `xfdesktop --reload`. I would like to know how I can do the same for as many as possible other desktop environments (Unity, KDE, LXDE, Mate, Cinnamon, GNOME2, GNOME3,...).


Can I pipe stdout on one server to stdin on another server?

`stdout` on one CentOS server needs to be piped to `stdin` on another CentOS server. Is this possible? ## Update ScottPack, MikeyB and jofel all have valid answers. I awarded the answer to Scott because, even though my question didn't specify security as a requirement, it's always nice to be safe. However, the other two fellows' suggestions will also work.


How to automate configuration of the Linux kernel build

I'm compiling a flavor of the Linux kernel based on the default configuration (for an ODROID system), with some additional features enabled. I want to automate this process so that I don't have to reselect the features again if I want to build a newer version of the kernel. I could have saved the whole `.config` file, but if the default configuration changes in the future release, then my `.config` file will get outdated. Is there some alternative to `make menuconfig` that will just take a set of features and enable them in an unattended fashion?


usb / virtual com port - is it dead?

I have video gimbal that I am attempting to setup. The device, a Basecam 3 Axis unit, has a micro USB port interface. When I plug a USB cable from my Debian laptop to the gimbal and run "lsusb" I get no changes. Additionally dmesg shows nothing. Yet the board receives power (solid red light, solid green light and a high-pitched "chirp" confirms as much). If I don't see anything listed in lsusb and dmesg, is it a high probability that there is an issue the board itself?


How to play 720p video in Fedora 20 if necessary plugin not found?

I tried to play an 720p video in the default video player in Fedora 20, but it couldn't play it. It shows that a plugin is needed to play this file format and searches it online, and says that there is no such plugin. Is there any other way to configure the default player or suggest me another media player which can play 720p video mp4 format?


How to kill a process that says "Operation not permitted" when attempted?

I have a process I would like to kill:               computer@ubuntu:~$ ps aux | grep socat     root      2092  0.0  0.0   5564  1528 pts/1    T    14:37   0:00 sudo socat TCP:xxx.17.29.152:54321 PTY,link=/dev/ttyGPS0,raw,echo=0,mode=666     computer@ubuntu:~$ kill 2092     -bash: kill: (2092) - Operation not permitted   <--------------- How to kill ??


How to use ( yumdownloader --resolve <package name> ) on ( yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts" )?

As soon as I finish installing "centos-minimal" from the minimal ISO file, I need to install the GUI desktop. for this I simply run, `ifup eth0`, and then I run:               yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"      I would like to install all these from a local folder if possible. Here's what I know. For example to install `gcc` locally I can simply create a folder named `gcc` on my USB stick for example. Then go into that folder and then run this command:               yumdownloader --resolve gcc      This will download everything needed to install `gcc` on my system, assuming that system does not yet have `gcc` installed. It will download all of the dependencies and so on, into the folder: `gcc`. Then the next time around when I re-install CentOS minimal, I can just go into this folder and run:               yum --nogpgcheck localinstall *.rpm -y      It installs `gcc` as long as I'm in the "gcc" folder with all the files that were downloaded. The question is, how to apply this to this command:               yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"      Because I don't think there is such program as:                "Desktop" and so on..       What would the `yum install <package name> -y` equivalency be for:               yum -y groupinstall "Desktop" "Desktop Platform" "X Window System" "Fonts"      because if I knew that, then I could use this:               yumdownloader --resolve <package name>      To download all the necessary packages to a folder and then install the GUI from a folder without an internet connection the next time around, when I re- installed CentOS minimal Linux.


How to safely reverse dns lookup on ip in a shell script

I'm trying to find out how to take in a hostname and pop out an ip address (reverse dns lookup). I came up with this but I'm not too sure it's safe across different linux distros:               nslookup $ip|grep "name ="|sed 's/^.*name = //'| sed '$s/\.$//'      It appears to be okay. The call to nslookup gives:               $ nslookup 127.0.0.1     Server:     192.154.28.100     Address:    192.154.28.100#53          1.0.0.127.in-addr.arpa  name = localhost.      So we grep to remove the lines that don't give the hostname. Then we use said to remove everything before "name = " and remove the . at the end. If there are more than one line for whatever reason, then we just take the first one only. That gives 'localhost' There must be some better way to do this?


Alternate keyboard inputs: dwm on Debian

Currently my laptop's keyboard has some broken keys (`z`, `x`, `c`). When using my Windows partition I know I can just use `Alt`-codes to enter the keys or use alternate hotkeys for the respective keys (`Alt`- and `Shift``Insert` for copy and paste). I know that using GTK I can use `Shift``Alt``U`,"hex code". But what about dwm, how to I input `z`, `x`, `c`?


Copy files in different subdirectories that excludes a string

I'm trying to copy all files of a type in a given directory and subdirectories but excluding files of a different type. `find /var/ftp/pub/bs -iname "*foo*.foo" -exec cp {} /var/ftp/pub/bs1 \;` which works but I'd rather do the exclude which is more accurate. So I need to copy files with that end with `*.foo` but exclude files that contain `foo1` Something like this (which doesn't work)               find /var/ftp/pub/bs -iname "*.foo" | grep --exclude="*foo1*" -exec cp {} /var/ftp/pub/bs1


Copying to an external NTFS partition: slows down when I copy many files at once

I have made my peace with the fact that NTFS(-3g) on Linux will be slower than NTFS performance on Windows. I can write to my external NTFS-formatted USB 3.0 HDD at about 100+ MB/s on Windows while I have to settle for 30 MB/s (give or take) on my Debian (Wheezy) box. That's not the problem, however. I found (empirically) that if I want to copy, say, 20 files from my box to the HDD, the copying starts off at the "normal" 30 MB/s but gradually slows down to a miserly 4 MB/s!! Whereas, if I do the copy, say, 5 files at a time (serially) the copying speed remains at 30 MB/s for _all four_ copy processes. This is not specific to Debian, by the way. I've observed similar behavior on Fedora and Ubuntu. My question is, is this behavior normal or should I be concerned? If something is wrong, how should I go about debugging it/fixing it?


Proxmox Master Node crashes

I've inadvertently discovered a Proxmox bug. I run a personal cluster of 4 nodes (a technology lab for giggles and gags). Each node has a Dell Perc 5i and 4 HDDs in RAID 10. The standard Proxmox install uses the entire logical drive and puts in place 2 partitions, the system drive and a local drive (`/var/lib/vz`). I recently discovered that running QCOW2 allows me to take snapshots whereas running VMDK's does not. I also learned that I cannot migrate VMs unless they are on network storage. Not a problem, first I install NFS server on all the nodes, then created and export a NFS folder on `/var/lib/vz` file system (`/var/lib/vz/nfs`) then added this as network storage. Next I began to migrate my drives to the NFS folder on the local machine, and converting the images to QCOW2 using the web interface drive move command. This works, but here is how I can consistently crash the Proxmox cluster service:   1. If I try to copy more than one VM drive at a time on the master node.   2. If I try to copy a very large (250Gb) VM by itself on the master node. The master node seems to just go south. The web interface shows everything is down. Progress on the copy just halts. OS sync commands run at the shell never return, shutdown requests hang, init 0 commands hang. Eventually, I have to cycle the power on the node. So, some questions:   1. Is it because I'm copying to NFS? I'm using a bog standard nfs4 nfs-kernel-server.   2. Is it because I'm keeping the drive that hosts the master quorum too busy? After all, the RAID 10 setup is reading and writing these large files from local to a nfs share on the same machine - we are keeping the TCP stack and the drive itself very busy.   3. Is there some best practice I'm missing here? - I know I would never put this into production - keep in mind this is a home-made cluster running a lab of inexpensive servers.  Any help would be appreciated.


Is there a way to convert a zip to a tar without extracting it to the filesystem?

Is there a way to convert a `zip` archive to a `tar` archive without extracting to a temporary directory first? (and without writing my own implementation of `tar` or `unzip`)


When do jiffies increment? How a process runs in a jiffy?

I know that jiffies length is selected at kernel compile time and it is defaulted to 250 (4ms).   Source: man 7 time - The Software Clock, HZ, and Jiffies I wonder what happens inside a jiffy. What are the conditions to increase the value of `utime` or `stime` in `/proc/pid/stat`? When does it happens? I have some thoughts but I'm not sure they are true:   * When a process gets time to run, the jiffy count is incremented instantly.   * Linux can't tell how many operations have been executed in 1 jiffy.   * Furthermore Linux can't tell how much time has been used by the current process in 1 jiffy. (Has it used all the 4 milliseconds, or less?)   * Current process starts in the beginning of the jiffy and never starts later.   * When a process is done and there is remaining time from current jiffy nothing happens (nop).   * If a process with higher priority occurs it does not affect the current jiffy. It would help a lot to understand theese.


Updating PHP 5.3 to 5.4 in CentOS

I followed this tutorial to update PHP from 5.3 version to 5.4. My distro is CentOS 5.5. After running the following command:               yum --enablerepo=remi,remi-test install httpd php php-common        I get following error:                   --> Finished Dependency Resolution     php53-common-5.3.3-13.el5_8.i386 from updates has depsolving problems       --> php53-common conflicts with php-common     Error: php53-common conflicts with php-common      You could try using --skip-broken to work around the problem      You could try running: package-cleanup --problems                             package-cleanup --dupes                             rpm -Va --nofiles --nodigest      How can I solve this error?


Sample a few lines from an strace printout

I've got a process that I want to inspect with strace, but since it's printing out a lot of stuff, I would like to sample only a few lines every X seconds from it. Is there any way of doing that with bash or similar? For example:               strace -p 123456 | "print out most recent 80 lines every 2 seconds"


Restore Gnome Panel to Default Configuration

Is there any way to restore the gnome panel configuration back to default?


suse cannot install software

I just installed suse 11.3, but cannot update the system. Update Applet says: > PackageKit Error repo-not-available: Failed to download /media.1/media from > http://download.opensuse.org/distribution/11.3/repo/oss/ I filled in my details in yast->proxy, and Firefox works fine with the same details. My laptop is a Packard Bell with ATI graphics card which I am yet to install. Could it be the network card?


How do I connect to a pc through another pc using ssh

I have **three** Computers. **PC1** and **PC2** is on a private LAN, where **PC1** is known to **PC2** as `192.168.0.2` **PC2** and **PC3** is on a another LAN, where **PC2** is known to **PC3** as `192.168.123.101` How can I connect to **PC1** from **PC3** with SSH. Is there something like:               ssh user@192.168.0.2 -via user@192.168.123.101


Is it possible to have multiple SSH host aliases?

I have a laptop that can obviously be inside or outside of my home network at times. When I need to SSH into a machine inside of my network, the connection is fairly straightforward:               localhost $ ssh machinelearning      When I'm trying to access the machine from _outside_ of my network, I then need to connect to my router, then SSH from there:               localhost $ ssh router.mytotallyuniquedomain.com     router $ ssh machinelearning      I remember there being a shortcut for doing the latter command in `~/.ssh/config`, but at the moment I can't remember what it is. Is there a way for me to supply multiple hostnames or types of connections so that when I do this:               $ ssh machinelearning      SSH will first attempt to connect to the `machinelearning` host in the local network and then attempt to tunnel in through `router.mytotallyuniquedomain.com`, all without me having to type out the long hostname?


SSH Twice in bash alias/function

At work, we run a portal server to access all of our "real" servers. Essentially, anyone who needs to SSH into one of the "real" (web) servers would first SSH into the portal, so it looks like this:               mike@localhost#    ssh mike@portal     #ssh login notice stuff blah blah     mike@portal#    ssh mike@webserver      I'm trying to write a bash alias or function to combine these two steps into one. I'm not the sysadmin by any stretch, so keeping this as simple as possible without installing extra software would be nice. I've tried the following but it won't go through as I had hoped:               ssh mike@portal; ssh mike@webserver #terminates on terminal for portal     ssh mike@portal `ssh mike@webserver` #hangs     ssh mike@portal ssh mike@webserver #connects, but gives error "pseudo-terminal will not be allocated because stdin is not a terminal"      Any ideas or workarounds for this?


How can I find which process sends data to a specific port?

I have a service, keeping a certain port open. I'm getting data to it, that I neither expect nor want to get, and I'm trying to pin-point the source of this data. So how can I find which process that _sends_ data to a specific port, as opposed to which process is listening.


Black screen after changing primary monitor

I've just did a clean install of Linux Mint Maya x64. I am using two monitors (default screen of my laptop and external HP w2007v). The problem is that after I've changed my primary monitor to the external one (did it using control center), I get black screen on both after login and I can't do anything. Is there any way to make my computer work again? It doesn't matter now which one will be default, I just want it to work again.


Iptables: matching outgoing traffic with conntrack and owner. Works with strange drops

In my iptables script I have been experimenting with writing as finely grained rules as possible. I limit which users are allowed to use which services, partly for security and partly as a learning exercise. Using iptables v1.4.16.2 on Debian 6.0.6 running the 3.6.2 kernel. However I've hit an issue I don't quite understand yet.. . ### outgoing ports for all users This works perfectly fine. I do not have any generic state tracking rules.               ## Outgoing port 81     $IPTABLES -A OUTPUT -p tcp --dport 81 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT     $IPTABLES -A INPUT -p tcp --sport 81 -s $MYIP -m conntrack --ctstate ESTABLISHED -j ACCEPT      ### outgoing ports with user matching               ## outgoing port 80 for useraccount     $IPTABLES -A OUTPUT --match owner --uid-owner useraccount -p tcp --dport 80 -m conntrack --ctstate NEW,ESTABLISHED --sport 1024:65535 -j ACCEPT     $IPTABLES -A INPUT -p tcp --sport 80 --dport 1024:65535 -d $MYIP -m conntrack --ctstate ESTABLISHED -j ACCEPT      This allows port 80 out only for the account "useraccount", but rules like this for TCP traffic have issues.               ## Default outgoing log + block rules     $IPTABLES -A OUTPUT -j LOG --log-prefix "BAD OUTGOING " --log-ip-options --log-tcp-options --log-uid     $IPTABLES -A OUTPUT -j DROP      ## The Issue The above works, the user "useraccount" can get files perfectly fine. No other users on the system can make outgoing connections to port 80.               useraccount@host:$ wget http://cachefly.cachefly.net/10mb.test But the wget above leaves x7 dropped entries in my syslog:               Oct 18 02:00:35 xxxx kernel: BAD OUTGOING IN= OUT=eth0 SRC=xx.xx.xx.xx DST=205.234.175.175 LEN=40 TOS=0x00 PREC=0x00 TTL=64 ID=12170 DF PROTO=TCP SPT=37792 DPT=80 SEQ=164520678 ACK=3997126942 WINDOW=979 RES=0x00 ACK URGP=0        I don't get these drops for similar rules with UDP traffic. I already have rules in place that limit which users can make DNS requests. The dropped outgoing ACK packets seem to be coming from the root account (URGP=0) which I don't understand. Even when I swap useraccount for root. I believe that ACK packets are categorised as new because conntrack starts tracking connections after the 3rd step of the 3 way handshake, but why are the being dropped? Can these drops be safely ignored? ## Edit So I often see rules like these, which work fine for me:               $IPTABLES -A OUTPUT -s $MYIP -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT     $IPTABLES -A INPUT -p tcp -m tcp --sport 80 -d $MYIP -m state --state ESTABLISHED -j ACCEPT      I swapped "-m state --state" for "-m conntrack --ctstate" as state match is apparently obsolete. Is it best practice to have generic state tracking rules? Are the rules above not considered correct? For tight control over outgoing users connections would something like this be better?               $IPTABLES -A INPUT -m conntrack --ctstate ESTABLISHED -j ACCEPT     $IPTABLES -A OUTPUT -m conntrack --ctstate ESTABLISHED -j ACCEPT          $IPTABLES -A OUTPUT -p tcp --dport 80 -s $SERVER_IP_TUNNEL -m conntrack --ctstate NEW -m owner --uid-owner useraccount -j ACCEPT          $IPTABLES -A OUTPUT -p tcp --dport 80 -s $SERVER_IP_TUNNEL -m conntrack --ctstate NEW -m owner --uid-owner otheraccount -j ACCEPT


Set MAC address to default

Sometimes I need to spoof MAC address, I'm doing so with this command:               ip link set dev eth0 address XX:XX:XX:XX:XX:XX      Is there a way how to set MAC address back to default without reboot?


Which driver for Intel HD Graphics should I install?

Recently, I have replaced my old motherboard Giga G41M + Pentium 5500 CPU with the new Giga B75M + Celeron G540 CPU. The old motherboard has an on-board GPU, Intel GMA X4500. The new motherboard has no on-board GPU, but the new CPU has an on-die GPU, Intel HD Graphics. I'm running Debian testing, without reinstall after upgraded the hardware. Command `lspci -vk` shows the driver `i915` is in use for the video:               00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller])             Subsystem: Giga-byte Technology Device d000             Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+             Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-             Latency: 0             Interrupt: pin A routed to IRQ 43             Region 0: Memory at f7800000 (64-bit, non-prefetchable) [size=4M]             Region 2: Memory at e0000000 (64-bit, prefetchable) [size=256M]             Region 4: I/O ports at f000 [size=64]             Expansion ROM at <unassigned> [disabled]             Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-                     Address: fee0300c  Data: 4171             Capabilities: [d0] Power Management version 2                     Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)                     Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-             Capabilities: [a4] PCI Advanced Features                     AFCap: TP+ FLR+                     AFCtrl: FLR-                     AFStatus: TP-             Kernel driver in use: i915      Now the problems,   * Though `i915` works, but it seems a bit of too slow. For example, it can only play the video "Ducks take off 1080p" less than 1 fps.   * Is `2nd generation...` lspci reported the right generation? In the Wikipedia it shows my Intel HD Graphics is the **6th** generation.   * Is `i915` the right driver for my Intel HD Graphics? It seems the module name for HD Graphics is `intel` from some Ubuntu sites. If so, I can't find the `intel` driver for Debian. Should I use the ubuntu sources.list? Where to get the `intel` driver?   * Or, maybe I can simply let Xorg to rescan the hardware and re-pick the right driver for me?


What is the usage of pattern before substitute command in sed

There is an example in this link about `sed`: To delete the first number on all lines that start with a "#" use:               sed '/^#/ s/[0-9][0-9]*//'      What is the benefit of first pattern(`/^#/`)? It could be simply:               sed 's/^#[0-9][0-9]*//'


Recommendation for an eBook reader for Gnome

There are eBook readers for Android, there's Okular for KDE, and stuff like that, but what I want, is an eBook (ePub format) reader for my normal Linux desktop. I know there's Calibre, which goes way beyond being just an eBook reader, and theres FBReader, Which doesn't really work as of yet. Given that eBooks have been around for several years now, I'd assume, more software would've sprung up by now.


Pidgin will not disable the notifications

I'm using Pidgin 2.10.0-1.fc14 and libpurple 2.10.0. I have completely disabled all the notifications from _Plugins_ : _Libnotify Popups_ and _Message Notifications_. The problem is it still notifies every time someone is typing and a new message is received. I just want all the notifications to be shut off completely. What am I missing? **EDIT:** I've even removed `pidgin-libnotify` and still no effect.


zfs deduplication "low" ratio

In Solaris 11, in a pool named `mypool` I activated deduplication with               zfs set dedup=on mypool      Then I created two 100 MB file: `file1` and its copy `file1copy`. Only their names are different: their contents is the same. The mountpoint of `mypool` is `/mypool`. If I copy both `file1` and `file1copy` into `/mypool`, the output of               zpool list mypool      indicates a `DEDUP` ratio of barely `1.34x`. Why?? Then, following this guide I created a filesystem with               zfs create -o dedup=on -o mypool/archive      and then two users' filesystems `mypool/archive/a` and `mypool/archive/b` which inherited the deduplication from the parent filesystem. If now I copy `file1` into `mypool/archive/a` and `file1copy` into `mypool/archive/b` there is still a `DEDUP` ratio of `1.34x`. It becomes `2` only if I put the _same_ file, say `file1`, into _both_ `mypool/archive/a` and `mypool/archive/b`. Why?? Can a simple name difference strongly tear down deduplication? Shouldn't deduplication act at block level? * * * 1) Output of `zdb -S mypool`               Simulated DDT histogram:          bucket              allocated                       referenced               ______   ______________________________   ______________________________     refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE     ------   ------   -----   -----   -----   ------   -----   -----   -----          1    1.48K    189M    189M    189M    1.48K    189M    189M    189M          2      800    100M    100M   99.9M    1.56K    200M    200M    200M      Total    2.26K    289M    289M    288M    3.04K    389M    389M    388M          dedup = 1.35, compress = 1.00, copies = 1.00, dedup * compress / copies = 1.35      2) Output of `zdb -b mypool`               Traversing all blocks to verify nothing leaked ...              No leaks (block sum matches space maps exactly)              bp count:            3679         bp logical:     410970112      avg: 111707         bp physical:    408433664      avg: 111017     compression:   1.01         bp allocated:   615948288      avg: 167422     compression:   0.67         bp deduped:     157286400    ref>1:    800   deduplication:   1.26         SPA allocated:  458661888     used: 76.47%      In both `mypool/archive/a` and `mypool/archive/b` folders there was also another file.


Error trying to call find from perl

use warnings;     use File::Find;          my $srceDir = "//mnt/Share_Drive/Verizon PM&T/Capture Files/";     opendir(DIR, $srceDir) or die "Can't open $srceDir: $!";     my @files = (find -type f -newermt "12 Feb 2013", $srceDir);     closedir(DIR);      I can run the `find` command with the `-newermt` option in Linux just fine but when I put it in the perl script I got the errors below, could you help? Thanks               String found where operator expected at ./queryAlm.pl line 11, near "newermt "12 Feb 2013""       (Do you need to predeclare newermt?)     syntax error at ./queryAlm.pl line 11, near "newermt "12 Feb 2013""


glibc malloc() uses mmap() for small blocks of memory allocation?

I learned that on Linux the glibc’s malloc() uses mmap() for very big chunk of memories and brk() is used for small allocations. However that does not seem to be the case when I experiment the theory with a test program. First, I use a ‘for’ loop in my code to assign a big chunk of memory (80MB) implemented by an array with the condition Option1==TRUE, and each allocation is a multiple of a page size. The chunk of memory will be freed altogether when Option2==TRUE. Note Option1 and Option2 can be set from the command line where my process is running. Observation: when Option1 was satisfied, the RSS value of my process increased 80MB. After that I set Option2 to be TRUE (while Option1 is disatisfied), then about the same amount memory was reduded from the RSS value (given back to OS). Everything is good so far. After that, I modified the 'for' loop to assign _two_ big chunks of memory (80MB each) implemented by _chunk_ and _chunk1_ with Option1. Within each loop the same indexes of the two arrays are assigned with the same amount of memory, and each allocation is _smaller_ than one page. The chunk of memory for _chunk_ will be freed completely when Option2==TRUE. And the chunk of memory for _chunk1_ will be freed completely when Option3==TRUE. Observation: the RSS value of my process increased 160MB with Option1==TRUE, and the value remained after Option2==TRUE. And it also remained after Option3==TRUE. I use the Valgrind massif tool to check the memory usage and it reported there are about 160 MB pages mmap’ed by the two malloc() functions in the ‘for’ loop. I can understand that the memory blocks by small allocations are kept in the process so that they can be used for future allocations. But shouldn't those small allocations be implemented by brk() but not mmap()? Is it because valgrind does not provide the accurate report or because there are some other cases that use mmap() to implement malloc() ? My code for the second test is copied below:                       char *chunk[200000];             char *chunk1[200000];             int i = 0;             int j,k;     ......             if (<Option1 == TRUE>) {                 if (i < 100) {                     for (k=0; k<2000; k++) {                     chunk[i*2000+k] = (char *)malloc(400);                     chunk1[i*2000+k] = (char *)malloc(400);                     memset (chunk[i*2000+k], 0, 400);                     memset (chunk1[i*2000+k], 0, 400);                     }                 }             }             if (<Option2 == TRUE>) {                 for (j = 0; j < 200000; j++) {                     if (chunk[j] != NULL) {                         free(chunk[j]);                         chunk[j] = NULL;                     }                 }             }             if (<Option3 == TRUE>) {                 for (j = 0; j < 200000; j++) {                     if (chunk1[j] != NULL) {                         free(chunk1[j]);                         chunk1[j] = NULL;                     }                 }             }     ......


How many authorized_keys can/should be set up in SSHD?

I'm following a FreeNX install wiki page for ArchLinux. Right now I'm setting the SSHD parameter for "AuthorizedKeysfIle". And this brings up the question, How many authorized_keys can/should be set up in SSHD to support all the services that use SSH tunnel? More importantly, this FreeNX tutorial is instructing me to point SSHD to a NX directory, but then what about SSH? NFS? A quick search finds several files in different locations:               /root/.ssh/authorized_keys2     /var/lib/nxserver/home/.ssh/authorized_keys2     /root/.ssh/authorized_keys     /srv/nfs4/mrwizard_xtian/.ssh/authorized_keys     /home/mrwizard/xtian/.ssh/authorized_keys


How does "man" restore the screen when I quit the program?

If I open a man page of a program like `cat` or `ls`, it prints (may not be the appropriate word) the contents of the man page and when I press `q`, it shows the screen just like before invoking the `man` command. How does the restore happen? What erases everything and then prints the previous contents of the shell? Example:               [VAR121@Tesla Testing]$  man ls      Output:               LS(1)                                                        User Commands                                                        LS(1)          NAME            ls - list directory contents          SYNOPSIS            ls [OPTION]... [FILE]...           ............      When I press `q`, the screen goes back to shells default appearance, such as the prompt shown below.               [VAR121@Tesla Testing]$  man ls     [VAR121@Tesla Testing]$      How is the screen restored ?


How do I configure systemd to activate an encrypted swap file?

My previous question produced the commands to add an encrypted swap file:               # One-time setup:     fallocate -l 4G /root/swapfile.crypt     chmod 600 /root/swapfile.crypt          # On every boot:     loop=$(losetup -f)     losetup ${loop} /root/swapfile.crypt     cryptsetup open --type plain --key-file /dev/urandom ${loop} swapfile     mkswap /dev/mapper/swapfile     swapon /dev/mapper/swapfile      But Arch Linux uses systemd, and I'm having trouble figuring out how to best get systemd to activate my swap file automatically. systemd.swap suggests that I should have a `dev-mapper-swapfile.swap` unit that looks something like:               [Unit]     Description=Encrypted Swap File          [Swap]     What=/dev/mapper/swapfile      That would execute the `swapon` command. But I'm not sure how to execute the commands to prepare `/dev/mapper/swapfile`. I gather that `dev-mapper- swapfile.swap` should declare a dependency on some other unit, but I'm not sure what that unit should look like.


How do you properly install Steam on Elementary OS?

A week ago I tried to install Steam, I downloaded the .deb package and installed it, and played a game with it. In the next day, Steam prompted me with this: > Steam needs to install these additional packages:   >  libgl1-mesa-dri:i386, libgl1-mesa-glx:i386, libc6:i386 And then I did it, I installed those packages. But it broke my system. The next time I rebooted my system, it went straight to tty, no GUI. I tried a bunch of things to fix it but the only way (for me, a new guy to Linux) was to reinstall the system. Now I'm trying to install it again and I found on the internet that installing `ia32-libs` would fix Steam. When I was going to install it, apt-get said that it would need to **remove elementary-desktop**. This is bad. Right now I don't know how to install Steam without breaking my system. What's the proper way to install it? If it's relevant, I'm using integrated graphics with an Intel Core i3 processor, Linux 3.2.0-51, distro: elementary OS Luna 64bit.


vimdiff disable/enable color coding

Is there any way to quickly disable/enable color coding in `vimdiff` ? The problem is, I have colored text in `vim` and the text is invisible is the text-color is Red, and the `vimdiff` too tries to put a background color of Red, making it hard to read. So, I would like to disable the color coding for sometime, for verifying the text and re-enable it later. Any quick, easy way to do this?


RedHat server packages are never found

I set up a virtual server Red Hat machine but every time I try to use the "yum" command to install new packages, the command works properly but it is never been able to find any package even the simplest and most common ones. I have Red Hat Enterprise Linux Server release 5.5 Am I missing something here? I'm very new to Red Hat but I cannot seem to find anything about this in the internet. Thank you,


How to use cut command to get the first and last elements of a row?

I've asked almost the same question already, but this time, I want to retrieve the X **latest** elements of a row of a CSV file. For example, with an input file as this one:               1;foo;bar;baz;x;y;z     2;foo;bar;baz;x;y;z     3;foo;bar;baz;x;y;z      What would be the command (eventually using `cut`) to get the last 2 columns, so I get:               y;z     y;z     y;z      In fact, my real target is to retrieve the first 3 **and** the last 2 fields of each row, so I get:               1;foo;bar;y;z     2;foo;bar;y;z     3;foo;bar;y;z      Unfortunately, I cannot use a command like `cut -d \; -f 1-3,10-11` (if there are 11 elements in the row), because the CSV file does not respect the _real_ CSV format. Indeed, some fields in the middle of the rows are _encrypted_ , and their encrypted value may sometimes contains a `;` characters (and of course, they are not wrapped inside `"`). In others words, my lines may look like that:               1;foo;bar;#@$"é&^l#;baz;x;y;z     2;foo;bar;#¤=é;)o'#;baz;x;y;z     3;foo;bar;#]]'~é{{#;baz;x;y;z      and as you can see, on the second line, there is an additional `;` character, so I can't use here a command like `cut -d \; -f 1-3,7-8`, because if will return that, which is wrong:               1;foo;bar;y;z     2;foo;bar;x;y  (-> Wrong here, there is a shift)     3;foo;bar;y;z      So how can I use `cut` to solve my problem? Thanks ps: I am specially in love with the `cut` command, so if you have a command that does what I want but that is not `cut`, then it's fine too :) _Edit_ It seems important to note that the machine is quite old: `uname -a` give this message:               SunOS ###### 5.10 Generic_142900-05 sun4u sparc SUNW,Sun-Fire-V240      and some commands may not be present (like `rev`)


ldapsearch error "Invalid general option name" for every option

Whenever I try to use `ldapsearch` with a `-o` option I get the following error: > Invalid general option name: An example command I am trying to run (taken from redhat documentation):               ldapsearch -p 389 -h server.example.com -o "mech=GSSAPI"          -o "authid=dn:uid=jsmith,ou=people,dc=example,dc=com"          -o realm=EXAMPLE.COM      But it doesn't matter what option I try, I still get this error. I also made sure `openldap` was up to date on this computer.


Guide how to configure D-Bus safely?

Recently I have tried to improve the safety/security of my system by using Linux Security Modules LSM like (apparmor, grsecurity or NSA Selinux). In my case apparmor. Trying to limit untrusted binary BLOB "Microsoft Skype" software I run into the problem that Skype effectively uses D-Bus. I fear now that potential risk linked to opening access to D-Bus and privilege escalation, in short open door caused by D-Bus if not configured correctly. (i.e. Something of this sort http://www.websecuritywatch.com/privilege-escalation-via-a-dbus- vilnerabilitiy/) Is there a guide how I can configure D-Bus in a way that it limits the mischief and trouble a program can do? I would very much like to have a Guide that focuses on the safety configuration of D-Bus. The only thing I have found at present is http://www.redhat.com/magazine/003jan05/features/dbus/#security which is not very helpful and rather frustrating as to my understanding it suggests that the price for the D-Bus "functionality" is yet another extensive and overarching security setup in addition to the trouble to setup already the LSM. This is why I would appreciate if somebody could indicate me if and where there is information about configuring D-Bus safely.


How copy and rename files found in "find" function Linux?

I have a folder named `/home/user/temps` which has 487 folders. In each folder I have a file called thumb.png. I want to copy all files named thumb.png to a separate folder and rename them based on the folder they came from.


Single command to move a domain from cPanel's localdomains to remotedomains file?

I find myself needing to do this a few times daily and would love an easier way to do it. > The domain example.com's email is handled by a third party, so the server > needs to be told this by listing its domain in /etc/remotedomains. I then remove the domain from localdomains: > pico /etc/localdomains > > Search for "example.com" (being careful not to land on > "subdomain.example.com") > > Remote "example.com" from /etc/localdomains > > Save and close And place it within remotedomain: > pico /etc/remotedomains > > Goto end of file and add "example.com" > > Save and close A way to do this in one command would be great! :)


Disable autoscrolling in gnome 3.4

I've recently updated my gnome to 3.4 and a problem appears. When I start scrolling, scroll never ends and even continues to scroll when I switch to another window. How can I disable this annoying feature? I run gnome on ArchLinux with kernel 3.3


unrecognized --sysroot option.(Eclipse)

I'm trying arm cross compilation using `sysroot` for the `autotools` project.The options I'm using for `autogen` script is as follows.               CC=arm-linux-gnueabihf-gcc --with-sysroot=/opt/sysroot/dir \        --host=arm-linux-gnueabihf --sysroot=/opt/sysroot/dir --prefix=/some/dir      But in eclipse plugin it is showing that `\--sysroot` option is unrecognized but the same command is working fine in the terminal.               ERROR:     configure: error: unrecognized option: --sysroot=/opt/sysroot/dir     configure: error: unrecognized option: --sysroot=/opt/sysroot/dir     Try ./configure --help' for more information      And If I remove `\--sysroot` option in eclipse then the `autogen` works fine but I'm getting the following linker error.               /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/lib/../lib/libwebkit_clutter-0.so when searching for -lwebkit_clutter-0     /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible //usr/lib/libwebkit_clutter-0.so when searching for -lwebkit_clutter-0     make[2]: Leaving directory `/home/dir/workspace/Sharukh/sources/applications'     /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lwebkit_clutter-0     make[1]: Leaving directory `/home/dir/workspace/Sharukh/sources'     /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /usr/lib/../lib/libwebkit_clutter_mx.so when searching for -lwebkit_clutter_mx     /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible //usr/lib/libwebkit_clutter_mx.so when searching for -lwebkit_clutter_mx     /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lwebkit_clutter_mx     /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible /lib/../lib/libcgroup.so when searching for -lcgroup     /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: skipping incompatible //lib/libcgroup.so when searching for -lcgroup     /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcgroup     collect2: error: ld returned 1 exit status     make[2]: *** [bin_Sharukh] Error 1     make[1]: *** [install-recursive] Error 1     make: *** [install-recursive] Error 1      What am I missing?


Slow boot and slow desktop, along with indecipherable log messages

I am a Linux Mint 17 - Cinnamon user, and have been using it for the past 1 month. I am new to this OS, and trying to learn how to work in a linux environment. My system boots extremely slowly (takes about 20 minutes), and when it does boot the desktop is very unresponsive. Double clicks and keystrokes take way too long to register, though the mouse moves around normally. **The whole thing started yesterday after my system shut down because of a power cut. I was not upgrading or installing anything.** While looking for clues as to what went wrong, on rebooting, I pressed the arrow keys a bit and this took me to a logging screen (?) listing a bunch of (boot?) tasks and their status. There were a bunch of               * xyz task                                                      [ok]      followed by:               * Starting load fallback graphics devices                       [fail]      Followed by more [OK]s, followed by:               * Starting SMB/CIFS file and active directory server            [fail]        After a few more [OK]s the system boots, and there I have the slowdown problems described above. I am dual booting this on my desktop along with windows 7. The entire Linux mint system is on a different hard disk, as is my windows installation. My PC specifications include: a core i7 processor. 8GB RAM. a Nvidia GTX 670 Graphics Card.


Which Desktop Environments do not require D-Bus?

Are there Desktop Environments (i.e. something comparable to Gnome, KDE, Xfce etc.) which do not require D-Bus? An optimal answer would best give a comprising list or alternatively confirm that today Desktop Environments necessarily depend on D-Bus (possibly giving a reason why this is so?)


Bind key to a bash script

I'm trying to bind a key (now without function) to a bash script that I have made on Ubuntu. I'm using a clevo W150HNM/Sager NP5160 I want to use button 1 or 4 for this. (see photo) I don't get any output from `xev`, `getscancodes` or `cat /dev/input/eventX` when pressing this key. How can I use this key to run the script?


How to use kdialog progressbar from a Bash script when the bar was initialized in another script?

Here is an example of how to use the kdialog progressbar. It works.               dbusRef=`kdialog --progressbar "Press Cancel at Any time" 10`     qdbus $dbusRef showCancelButton true          until test "true" = `qdbus $dbusRef wasCancelled`; do      sleep 1      inc=$((`qdbus $dbusRef Get "" "value"` + 1))      qdbus $dbusRef Set "" "value" $inc;     done          qdbus $dbusRef close      However, I can't figure out how to make it work when the main script file calls a 2nd script file. I want to keep updating the same progress bar from the second script. The error is:   * qdbus Set '' value 53 Path '' is not a valid path name. The code to update the progressbar is exactly the same in the second script file as the first. Generically, it is this:               qdbus $dbusRef Set "" value "$PROGRESS"      Obviously, some variable values are not getting passed around. But none of the tutorials I have seen explain the variables. For example, what is `value`? What is `$dbusRef`? In short, how do I update the same progressbar from a second bash script file that is called by the first?


How can I list subversion's runtime configuration options?

Say I want to know the value of the `global-ignores` option. How can I find it out?


what is a background process?

Here is a common definition of a background process: "A background process is a program that is running without user input. A number of background processes can be running on a multitasking operating system, such as Linux, while the user is interacting with the foreground process Some background processes, such as daemons, for example, never require user input. Others are merely in the background temporarily while the user is busy with the program presently running in the foreground. So that other process can be sleeping and taking up swap space, until activated, which thus makes it currently a background process." Given that definition, wouldn't that make a process like apache2 a background process since it never interacts with user input in terminal? And wouldn't that consider most process background processes, since most processes running on a system do not deal with user input in the terminal? Oddly enough, I personally wouldn't consider apache2 a background process since a user does interact with it through http requests (just not a terminal).


Gnu Parted Error in HardDisk of Linux?

Anyone help me, why the error getting when excuting the fdisk -l command in linux.               # fdisk -l /dev/sdb           WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Emacs key problem

I am using Cygwin to connect to an Ubuntu installation, and for some reasons my `Ctrl``h` for the help has been remapped to `Ctrl``Del`. When I actually type `Ctrl``c`,`h` I get the error: > No operation mapped for Ctrl + c <DEL>. There was a key mapping for ctrl + h to ctrl + delete in the init.el, now I have deleted it but still ctrl + h acts as a ctrl + DEL. How can I reset this?


Why does my linux keep crashing?

I am running Debian 6.0 Squeeze. Every half hour or so a dialog pops up on the side of my screen with the message - > Kernel failure. A report has been sent to the developers to help them fix > the error. (Not the exact text but that's what it says) Occasionally, say once a day it freezes and then reboots completely causing me to loose all my work. I thought Linux was renowned for its stability. But here it seems to be worse than windows. What is happening? Note - I used a USB stick and a Live Usb maker to install the system. Could that be a reason for the problem?


How to upgrade my linux Debian installation?

I run the following command to upgrade my system -               aptitude update     aptitude dist-upgrade      However it gives me updates for the softwares and libraries that I have installed. This is not what I want. I want to upgrade the operating system itself, to apply any security patches or bug fixes. What is the way to do that? I am running Debian 6.0 Squeeze.


Unable to launch Fedora 18 LiveCD using USB device

I just bought a new motherboard which has BIOS and UEFI. I have a previously working LiveCD installed on my usb, created with LiveUSB Creator. I tried using it to boot but got stuck at the grub command line. Next, I followed the instructions here to create a new LiveCD using `livecd-iso-to-disk` command line method with the following options `\--format --reset-mbr --efi --overlay- size-mb 600`. I did the install on the second partition of my usb stick with 2GB allocated to this. Then I check that the partition is indeed bootable using `parted`. However, the boot process was again halted at grub with the following errors: > error: file `/isolinux/vmlinuz0' not found.   > error: you need to load the kernel first. Is this my problem or the motherboard problem? How do I go about solving it? **UPDATE:** This appears to be a file/folder naming issue with some motherboards not able to find the kernel. I did the following renaming:               /syslinux to /isolinux     /isolinux/syslinux.cfg to /isolinux/isolinux.cfg      I manage to get the kernel to load. But it got stuck at `dracut`, this time with the following warnings:               dracut-initqueue[229]: Warning: Could not boot.     dracut-initqueue[229]: Warning: /dev/disk/by-label/Fedora-18-x86_64-Live-Desktop.is does not exist     dracut-initqueue[229]: Warning: /dev/mapper/live-rw does not exist      I am wondering if this is again a naming issue. Why is it looking for `.is` instead of `.iso`? Anyone has any idea? Thanks.


Why isn't my environment variable visible from the command line?

I'm trying to run the James SMTP server on Lion (Mac OS X 10.7.2). When I do this:               sudo JAVA_HOME=/Library/Java/Home ./james-2.3.2/bin/run.sh      it works fine. However, I'd like to make JAVA_HOME an environment variable so it is visible to other applications too. I edited ~/.bash_profile to look like this:               export JAVA_HOME=/Library/Java/home      and the variable appears to be visible from the command line like so:               $ echo $JAVA_HOME     /Library/Java/home      But when I run james again like this, I get a warning about JAVA_HOME:               $ sudo ./james-2.3.2/bin/run.sh     ERROR: JAVA_HOME not found in your environment.          Please, set the JAVA_HOME variable in your environment to match the     location of the Java Virtual Machine you want to use.      Any ideas what I'm doing wrong? Why can't the command to run james see the JAVA_HOME environment variable? Any info is greatly appreciated, thanks!


How do I delete a folder but not the contents?

My directory (in Linux) looks like `com/com/{various,files}` where `com` and `com` are folders of the same name and the second `com` holds the various files. I want the first `com` removed, but the second and files in the second kept.


No valid sudoers sources

I've gone through the Google searches, but the results always have an extra clue that I'm not seeing. The error:               [testuser@testhost] $ sudo -ll     sudo: no valid sudoers sources found, quitting     sudo: unable to initialize policy plugin      That's it. No parse errors in /etc/sudoers, nothing.   * /etc/sudoers is owned by root:root and has 0440 permissions.   * I ran `visudo` to uncomment the included `%wheel` group privilege.   * My test user is a member of `wheel`.   * I've even removed and reinstalled `sudo-1.8.6p3-7.el6.x86_64` on this RHEL 6.4 test VM. What else can I look at? Answers to questions:   * The VM I'm testing on is secure; I can't copy/paste to an outside site. (I'm asking this question from a different host outside the firewall.) `stat /etc/sudoers` shows a regular file of `size 4000` and `access 0440`. The contents of the file are default (via the remove and reinstall) with the exception of the `%wheel` group being uncommented.   * `ls -ld /etc/sudo*` shows      * `/etc/sudo.conf` (0640, root:root)     * `/etc/sudoers` (0440, root:root)     * `/etc/sudoers.d` (0750, root:root, empty directory)     * `/etc/sudo-ldap.conf` (0640, root:root) The overall goal is privileges via ldap, which I've done before successfully. Thanks! [CORRECTION: The uncommented `%wheel` group is not password-free. The test user must enter a password for wheel privileges.] [UPDATE 1011h: Modifying `/etc/sudo-ldap.conf` with the correct `sudoers_base` got me access to the LDAP database (anonymous bind during testing) and a successful result to `sudo -ll`. That's a workaround for me, but doesn't solve the initial problem of whatever is preventing sudoers from working locally.]


Delete duplicate images. Need Software for computing average color of an image

I want to delete duplicates in a massive bunch of images. Well as I have dups of the same picture in a different resolution I will make the deletion myself. BUT I want to do this in linear time. So I thought it woud be smart to sort the images via renaming the images with an average color prefix with a little script. The problem is that I don't know any software that is able to compute the average color in the CLI. Is there any?


Why can't I login in as the ftp user?

After installing vsftpd I have the user ftp on my system. I assigned a password to this account. However, I still cannot login as the ftp user (on the command line, without any ftp-protocol involved).               su - ftp     password:     ... still the previous user is logged on      People will wonder why I want to do this. Well, I want to expose the whole file system via ftp. People will say, you should not do that, well...


How to target multiple selections with xclip

When copying text to the clipboard, xclip provides several selection targets:                -selection         specify which X selection to use, options are:         "primary" to use XA_PRIMARY (default),          "secondary" for XA_SECONDARY          "clipboard" for XA_CLIPBOARD      Is there a way to target multiple selections? I have tried the following options   1. `echo "Hello world" | xclip -i -selection primary -selection clipboard`   2. `echo "Hello world" | xclip -i selection primary | xclip -i selection clipboard`   3. `echo "Hello world" | xclip -i selection primary,clipboard` but none of them worked.


how to apply this patch

There is a patch fix for perl module net::ssh2 it fixes a seg fault error that happens on some machines. It's located here: https://rt.cpan.org/Public/Bug/Display.html?id=36614 I downloaded the patch but i'm not sure how to apply it. I removed the module i previously installed, went to the build folder and did patch ssh2.xs < p1 it asked me if the patch was in reverse. I wasn't sure so i hit yes. IT says patch succeed then tells me ok. modules installed. I don't think either the patch worked or i'm moving my patched version in correctly. I feel that way because i still get the seg fault and everyone say this fixes it. Can someone guide me here?


What are character special and block special files in a unix system?

How are character special files and block special files different from regular files in a Inix-like system? Why are they called “character special” and “block special” respectively?


Browser-based front-end to linux

I'd like to ask if anything like this exists. A browser-based tool for looking at a Linux system, managing it, and helping newbies diagnose problems. What I'm thinking of is something like this :   * it's a program that you install and run locally, but acts as a web-server so that the user interface is a browser   * it's a combination of documentation, sys-admin tool and tutorial. So that, of course, you can look at man pages through it, or run commands. But more interestingly, you might read a "HOW-TO" page that says "look at the apache config files at /etc/apache2/apache2.conf " and that becomes a link to the file itself, letting you open it up and read it.   * can be extended with plug-in editors / highlighters. Perhaps a log file will be easier to read if it can be syntax coloured and errors highlighted in red.   * plug-ins can be shell scripts. And can be used to write diagnostic tests. So, for example, if you need to look in one of 8 different places to find out what sort of audio setup your linux box has, someone could write a shell (or perl) script that looks in these places, extracts the relevant information and displays it on a page alongside tutorial information about how to solve a particular problem. I'm sure you can think of many similar scenarios. So, does anything like this exist? Unix is an awesome system with built-in man support, command-line tools and scriptability. But is an impenetrable jungle for the uninitiated. On the other hand, hypertexts with linked html pages are much easier to navigate and aid discovery. And the browser can display diagrams and documents more readably than the terminal or Emacs. Is there any project that tries to bring the best of these two worlds together?


Alias or Intercept complex bash command with args

How do you create a bash alias for a command with flags? ~~For example, if I run`ls -l`, I want that to alias to `ls -a`. This doesn't work: `alias "ls -l"="ls -a"` ~~ Another example: If I type `reboot now`, I want that to simply run `reboot`. Would bash functions be useful here? * * * EDIT: Sorry for the silly `ls -l` example. This is what I really want: if you executed `reboot now`, I want it to actually execute `reboot`. This is why.


Guess complete filename

I have some files with really long names lying around on my server and writing the complete names is kind of a pita so I'm asking if my Linux system (Debian 7) can guess the complete filename? I want to write something like               rm some_file_1      instead of               rm_some_file_1_very_long_information_bla_bla_foo_bar_meow      There is no other file than `some_file_1_very_long_information_bla_bla_foo_bar_meow` whose name contains `some_file_1`


echo bytes to a file

I'm trying to connect my rasberry Pi to some display using the i2c bus. To get started I wanted to manually write stuff, bytes in particular to a file. How do you write specific bytes to a file? I already read that one and I figured my problem should be solved by something like this               echo -n -e \x66\x6f\x6f > byteFileForNow      However, when I open up that file with nano, instead of **foo** I see: > x66x6fx6f So the backslashes were escaped, but not the bytes themselves. I also tried the same only without the **-e** this time, so I would've exepected to see **\x66\x6f\x6f** , but got the same as before. So echo is escaping backslashes, backslashes alone and backslashes regardless of if it is supposed to.   Any idea how to fix this?   According to the man-page that should've done what I'm looking for.


Fastest way to concatenate files

I've got 10k+ files totaling over 20GB that I need to concatenate into one file. Is there a faster way than               cat input_file* >> out      ? The preferred way would be a bash command, Python is acceptable too if not considerably slower.


Texlive fonts screwing up my truetype fonts

I have been running into this strange issue. When I install texlive fonts, they automatically register as system fonts. If I install the texlive variant of an already installed truetype font (for example Dejavu) it gets overridden by the texlive font and looks horrible. I'm using OpenSuSe 12.3 and 13.1


How to write text into the first line of a file?

I've been looking around `sed` command to add text into a file in a specific line. This works to add text after line 1:               sed '1 a\      But I want to add BEFORE line1. It would be:               sed '0 a\      but I get this: `invalid usage of line address 0`. Any suggestion achieve this?


Sharing variables across multiple shell scripts

I am trying to summarize multiple shell scripts within one large shell script, such as this:               #!/bin/sh     bash script1.sh     bash script2.sh     bash script3.sh      All scripts share the same variables "var" and "var2". I wanted to delete the variable definitions from the individual shell scripts and put it into the large shell script instead, so that when I change the value of the variables I only have to do that once. However, when I do               #!/bin/sh     var1="1"     var2="2"     bash script1.sh     bash script2.sh     bash script3.sh      the variables are not recognised by the references $var1 and $var2 in the individual shell scripts. Apologies if the question has been asked before, I am new to scripting in general and didn't know what to search for. It would also be nice to know how I could loop over the scripts with multiple variable inputs, such as               var1="1 2 3 4 5"     var2="a b c d e"     for i in $var1;do for j in $var2;do     script1.sh     script2.sh     done;done      Thanks in advance for any useful tips.


A script to identify whether a file descriptor has gone bad

**Problem** : I have a server program running which connects to a remote program using TCP sockets. There many of them (say 20). My problem is one of the socket descriptor has gone bad and has recieved EOF. But due to bug in program it never closes it but adds it back to select() set and causes unnecessary pain. **What I did to find it** : I attached to DDB, and called read(fd,..) to each of them. The bad descriptor returned 0 and I tapped it there. Though this worked for me, but had a cost of wasting bytes from other sockets and the other functions may behave wrongly. **What I am looking for** is to get an idea on a non-intrusive mechanism that solves my purpose without affecting the running programs. By the way my NetBSD system understands tcsh only.


Script to find the default Desktop Environment?

Assume a Linux Desktop Environment system is installed. When powered on and credentials entered, whatever Desktop Environment is started i would consider the default Desktop Environment. The user may pick another Desktop Environment such as KDE or XFCE, but that would not be the default. What is a distribution agnostic snippet of code to find the default Desktop Environment or better yet, the DE last used. The code must run from a remote SSH session or CTRL- ALT-F2 text only console. The impetus for this question is that i recently emailed the output of nvidia- bug-report.sh to NVIDIA. NVIDIA tech support replied back days later asking "What OS?", "GNOME or KDE?", "What Distribution?" - all meta data that could be automatically collected and catalogued by their own script. Since the Desktop Environment has crashed, nvidia-bug-report.sh needs to run from a CTRL-ALT-F2 text console or remote SSH session. Clearly, neither of these have the $DESKTOP_SESSION variable. Answer would return one or more items in order of confidence from a list similar to `"gnome|kde|mate|cinnamon|lx|xfce|jwm|none"`. ![Choosing between GNOME or KDE in Ubuntu.](http://i.stack.imgur.com/Ha4dj.jpg)   ![Choosing Desktop Environment Session Type in Fedora.](http://i.stack.imgur.com/XGMEd.jpg) ![Choosing between GNOME or KDE in CentOS.](http://i.stack.imgur.com/ZWNQq.png) Would like scripts similar to " How can I get distribution name and version number in a simple shell script? "


What does "3>&1 1>&2 2>&3" do in a script?

I saw this line in a script:               DEVICE=`dialog --inputbox "Festplatten-Laufzeit auslesen. Gebe Sie das      gewünschte Device an: " 0 70 "" 3>&1 1>&2 2>&3`      What is               3>&1 1>&2 2>&3      doing? I know that 1 = stdout and 2 = stderr, but what are the `3` and the `&` for?


List all dotfiles current directory using zsh

How can I list all dotfiles in a directory using zsh.?


luks single signon

I've got LUKS (Linux Unified Key Setup) running on a couple of my Linux boxes. I've looked online but haven't seen anyone document how to make it work in a single signon option, but was hoping someone could either point me in the right direction or give a definitive no that won't work (or more likely, no that won't work without writing some extra PAM etc. code). Specifically, what I would like to do is boot up my system (which has let's assume 4 user accounts). When I get prompted for my passphrase, it unlocks LUKS and boots up, and then tries that same passphrase to log in the user that's associated with that passphrase. (LUKS supports 8 different passphrases but I'd be fine if there was just a single user supported (my primary username) and if I wanted to log in to a different account, I could log out / switch user. Update: I'm encrypting the whole disk.


How can I install my webcam on Debian?

I'm trying to install the webcam driver for my Logitech C210. After some googling Linux UVC driver seems to be what I need. I followed their typical use in hope to get it installed:               git clone git://linuxtv.org/media_build.git      cd media_build      ./build      make install      Now, I get these errors when I try to `./build`:               make -C /home/pi/media_build/v4l allyesconfig     make[1]: Entering directory `/home/pi/media_build/v4l'     make[2]: Entering directory `/home/pi/media_build/linux'     Applying patches for kernel 3.1.9+     patch -s -f -N -p1 -i ../backports/api_version.patch     patch -s -f -N -p1 -i ../backports/pr_fmt.patch     patch -s -f -N -p1 -i ../backports/v3.1_no_export_h.patch     patch -s -f -N -p1 -i ../backports/v3.1_no_pm_qos.patch     Patched drivers/media/dvb/dvb-core/dvbdev.c     Patched drivers/media/video/v4l2-dev.c     Patched drivers/media/rc/rc-main.c     make[2]: Leaving directory `/home/pi/media_build/linux'     ./scripts/make_kconfig.pl /lib/modules/3.1.9+/build /lib/modules/3.1.9+/build 1     Preparing to compile for kernel version 3.1.9     File not found: /lib/modules/3.1.9+/build/.config at ./scripts/make_kconfig.pl line 33, <IN> line 4.     make[1]: *** [allyesconfig] Error 2     make[1]: Leaving directory `/home/pi/media_build/v4l'     make: *** [allyesconfig] Error 2     can't select all drivers at ./build line 451.      Btw im trying to do this on the Raspberry PI, architecture is ARM cpu.


linum auto-activation in .emacs fails

I added the following lines to my .emacs.d/init.el to auto-activate linum at startup:               (require 'linum)     (global-linum-mode 1)     (setq linum-format “%d “)      But no way, i still have to manually `M-x linum-mode` to make it display line numbers in my C buffers (and all other buffers).   Any idea? (GNU Emacs 23.2.1, modified by Debian)


Resizing root partition in LVM broke Grub

I'm using Debian Wheezy hosted on W7 in Virtualbox. I needed to enlarge root partition then added a new virtual disk to virtual machine. Doing the steps mentioned below brings me to grub prompt. I:   * Added new virtual disk   * Formatted and mounted   * Created PV   * Added to same VG with root partition   * Extended root partition LV with `lvextend`   * Resized the file system. Everything went well and I checked that with `df` command and `lvscan` but after reboot I couldn't boot the system. What point have I missed and how to recover the system?


How do I change the default text editor in the Debian (squeeze) distro

"Joe's own editor" does not come naturally to me. How do I change to using nano or vim? I've tried               export EDITOR=nano      but it doesn't seem to be respected. I'd like `visudo` to respect this as well.


X11 session environment

I want to run specific command in X11 session automatically, as soon as I take the session. e.g. If I do               Xephyr :2 -once -query <ip_address>      then post successful authentication, a command e.g. `export ABCD=small` need to get executed automatically.


How can I stop ssh from trying to create ~/.ssh?

I'm working on an rsync-based backup for a FreeNAS system. Part of the backup process involves logging into the remote system that serves as the backup storage. Whenever I do that, I get the message               Could not create directory '/root/.ssh'.      I'm assuming this is due to the fact that `/root` is read-only, because when I try to create `~/.ssh` manually, I receive:               mkdir: /root/.ssh: Read-only file system      Because of this, I have already moved the `known_hosts` file more appropriate for my backup process and am using `-o UserKnownHostsFile` to resolve any issues related to that. However, `ssh` still tries to create the `~/.ssh` folder when I invoke it. How can I get it to not try to create the folder?


Linux based internet file server

I am looking for a linux based file server that I can use to store all my files and access remotely through Internet. I have come across a few different alternatives, most promising amahi, but most of these servers prefer the server to manage DHCP, which I can not do as first of all, restarting all the devices on my network would be a seriously tedious task and the router currently managing the DHCP will have more up-time than my server. I also have a windows home server, which is connected to the Internet through my router, but I can't mount it when I'm not at the local network, I can only manage the files through a browser, which is really unpractical. So basically what I want is: A home file server that can be mounted as a disk, or viewed in finder in any other way, in OSX (and windows, but I'll mostly be using OSX) and I must be able to do this both at the local network and from any other location, without having to manage the DHCP from the server. I have thought of setting up openVPN (or another vpn connection if available) to access the local network remotely as if my machines was physically there, but I have no idea of how to setup the router to make this work, especially since I already have a server connected to the router.


How to stop waking all attached drives on reboot / deactivating swap?

A fresh install of Debian 6.0.6 for a system has 13 SATA drives attached. 12 refurbished WD-10EARS drives are yet unpartitioned. 1 WD1500BLFS drive is configured for OS and swap. Swap partition is configured on /dev/sda5 according /etc/fstab               root@debian:~# cat /etc/fstab | grep swap     # swap was on /dev/sda5 during installation     UUID=641cc8ad-838d-4e92-8c2c-0b73359a5aa3 none            swap    sw              0       0      Because the 12 drives have no disk activity, the drive state goes from "active/idle" to "standby" after a while.               root@debian:~# hdparm -C /dev/sdm          /dev/sda:      drive state is:  active/idle          root@debian:~# hdparm -C /dev/sdm          /dev/sda:      drive state is:  standby      When issueing a `reboot` command the console shows "`Deactivating swap...`" and then staggered all 12 drives start to spinup as verified by sound and power consumption. Having a drive state change from standby to active can take up to 30 seconds. In other words a reboot now takes between 3 and 7 minutes. How long would a reboot take when 70 drives are attached! _Update #1_ The issue is related to "sd" (storage device) that wishes to " **Synchronizing SCSI cache** " on each drive. How to stop changing all drives its state from "standby" to "active" on reboot (most likely caused by the "deactivating swap" process)?               # uname -mrsn     Linux debian 2.6.32-5-amd64 x86_64


ps output differs when run from command line and from script

I have to create list of PID's of the running processes. Here is the script               ps     echo "fields are "     ps | cut -d' ' -f1      `ps` is showing                 PID TTY          TIME CMD      2168 pts/4    00:00:00 sh      2177 pts/4    00:00:00 mailx      5191 pts/4    00:00:00 sh      6494 pts/4    00:00:00 sh      6495 pts/4    00:00:00 ps     12154 pts/4    00:00:00 sh     12172 pts/4    00:00:00 mailx     15618 pts/4    00:00:00 bash      But the output of cut pipeline is just               12154     12172     15618


Change the PS1 prompt in a subshell sh called from parent bash

When I am running an interactive `bash` session, I sometimes experiment with `sh`. I call `sh` directly from this `bash` session. My question is, how can I change the `PS1` prompt of this subshell? I would like the prompt to be something like `sh$`, notifying me that I am using `sh` and not `bash`. What I have tried so far is:   * I made a configuration file analogous to `.bashrc` named `.shrc`   * I put only one line in it: `export PS1='$(echo ${0})\$ '`   * I then modified `~/.profile` to say the following:              # if running bash     if [ -n "$BASH_VERSION" ]; then     # include .bashrc if it exists         if [ -f "$HOME/.bashrc" ]; then             . "$HOME/.bashrc"         fi     # if running another shell     else         if [ -f "$HOME/.shrc" ]; then             . "$HOME/.shrc"         fi     fi        * I restarted the terminal, but the changes are not being applied.   * If I run `. ~/.shrc` in `sh` manually, the changes _do_ get applied. What am I doing wrong?


Problems with Maple 16 GUI on Arch Linux

I have installed Maple 16 (computer algebra system) to the directory /opt/maple16/ and the installation and registration progress is finished succesfully. I am running Arch Linux. The terminal version of the program (maple) works fine, but when I start the GUI version (xmaple), the actual interface doesn't show up, however it does display the 'hint of day' window and it is possible to use, for instance, Ctrl + S for saving. The program also opens two windows, the actual empty maple document and an empty java window. I have tried runing it as both a normal user and as root, but that does not seem to change anything. I am using Awesome WM, but I'm not sure if that might be part of the problem. What might the problem be and have anyone experienced the same problems? How can I debug a problem like this?


diff reports two files differ, although they are the same!

I have two files which look identical to me (including trailing whitespaces and newlines) but diff still says they differ. Even when I do a `diff -y` side by side comparison the lines look exactly the same. The output from diff is the whole 2 files. Any idea what's causing it?


Why is `sudo pkill -HUP -f "nginx: master process"` returning code 129 and no output

I'm trying to trigger a reload of the Nginx master process by using `pkill` and `sudo`. The server reloads fine, but I was just curious if anyone knows why the command `sudo pkill -HUP -f "nginx: master process"` returns code 129?               # Running as root     $ pkill -HUP -f "nginx: master process"     $ echo $?          # Output is as expected:     0          # Running as a user (sudo is set to not prompt for a password)     % sudo pkill -HUP -f "nginx: master process     % echo $?          # Output is weird (considering sudo should be passing along the return     #                  code of the command it is executing):     129      Running on Ubuntu 12.04.1 LTS running on EC2 ... surprisingly Ubuntu 12.04.1 LTS running on a physical computer (not installed using cloud images) runs fine.