Network locations like OSX

I couldn't find anything like that on Google, so I am asking it here. Is there a way to make multiple network configurations that can be activated with one click like OSX? Like for example, one that keeps DHCP, the other static etc, but I don't want to manually input the parameters every time. Using Debian Thanks


Compilation error on fedora 14

I installed fedora version 14 using virtual box but when I try to compile a program then displayed command not found. After that I tried to install g++ compiler using commands but, the way I followed               [firnas@localhost ~]g++ -op firnas.cpp     Command not found     [firnas@localhost ~]$ su     password     [root@localhost firnas]#yum install gcc gcc-c++     Loaded plugins:langpacks,presto,refresh-packagekit Adding en_US to language list Error:Cannot retrieve repository metadata(repomd.xml) for repositery :fedora Please verify its path and try again.      I have to compile a c++ program perfectly. So, what I have to do now? How do I solve this problem?


Columns for page subsections in Abiword?

Is there any way in Abiword to make columns apply to specified subsections of a page, instead of the entire document?


What keeps draining entropy?

If I do `watch cat /proc/sys/kernel/random/entropy_avail` I see that my systems entropy slowly increases over time, until it reaches the 180-190 range at which point it drops down to around 120-130. The drops in entropy seem to occur about every twenty seconds. I observe this even when `lsof` says that no process has `/dev/random` or `/dev/urandom` open. What is draining away the entropy? Does the kernel need entropy as well, or maybe it is reprocessing the larger pool into a smaller, better quality pool? This is on a bare-metal machine, with no SSL/SSH/WPA connections.


Combine two commands in .bash_profile

In my `.bash_profile` file, I'd like to setup a single command alias that is two commands that execute one after another. The first command takes an argument from the command line and the second is actually script (located in `~/bin` with execute permissions). My profile file has this:               alias pd='function pd2() { pushd "$@"; set_title_tab; }'      I attempt to execute it in the shell like so:               $ pd ~/Documents/      and I get an error: > -bash: syntax error near unexpected token `~/Documents/' `set_title_tab` is a shell script written by William Scott Is there a better way to accomplish this?


How to tell when a computer is idle?

I have a computer that is only used some of the time, and I was was wondering if there was a way to have it turn itself off after a period of inactivity. Here's the tricky part, if I was just thinking about having it turn itself off _when the GUI is idle_ then I think it would be significantly easier, but I'm trying to make sure I don't cut anyone off who is actively using the machine via SSH as well. The computer in question is Debian 5.0. Is there a way of detecting if the machine is idle, as in nobody using the GUI and nobody is using the machine via SSH? If an SSH connection is open, but is not actively being used, then the computer should consider that idle.


Is there a Linux distro compiled with clang/llvm? It looks like as of late 2010 the kernel was working. If not, would it be more likely to be a technical or licensing issue?


Delete until given character starting from given string

root@server:~/foo$ cat INPUT.txt     limit. Current u'^'ZO     limit. Current usage'^'FR     limit. Current us'^'AS     limit. Current usage 95 %.'^'FR     limit. Cur'^'AEW     root@server:~/foo$ sed "s/limit.SOMEMAGIC/limit./g" INPUT.txt     limit.'^'ZO     limit.'^'FR     limit.'^'AS     limit.'^'FR     limit.'^'AEW      **Question:** how can we delete the strings (" Cur......") after "limit." until the: " ' " ? Searching for "SOMEMAGIC" :)


install opensuse: Brightness is too low and keyboard fn keys do not work

I installed OpenSUSE 13.1 in dual boot on my Samsung ATIV Book 6 pre-installed with Windows 8 with a USB key (ultrabook, no DVD reader at the moment). **Brightness is too low and keyboard fn keys do not work** while volume and touchpad-enable keys work. but not brightness or keyboard backlight. I tried setting the brightness through command line with the commands `xrandr` and `xbacklight` but nothing happens, as advised in http://stackoverflow.com/questions/6625836/how-to-change-the-monitor- brightness-on-linux . I used this tutorial http://tr.opensuse.org/SDB:Using_the_Extra_Keys_on_the_Keyboard to assign the variables XF86MonBrightnessUp (and others for keyboard) on available keyboard keys but once again nothing happens.


Use of ^ as a shell metacharacter

I wrote a small script today which contained               grep -q ^local0 /etc/syslog.conf      During review, a coworker suggested that `^local0` be quoted because `^` means "pipe" in the Bourne shell. Surprised by this claim, I tried to track down any reference that mentioned this. Nothing I found on the internet suggested this was a problem. However, it turns out that the implementation of `bsh` (which claims to be the Bourne shell) on AIX 7 actually has this behaviour:               > bsh     $ ls ^ wc           23      23     183     $ ls | wc           23      23     183      None of the other "Bourne shell" implementations I tried behave this way (that is, `^` is not considered a shell metacharacter at all). I tried `sh` on CentOS (which is really bash), and `sh` on FreeBSD (which is not bash). I don't have many other systems to try. Is this behaviour expected? Which shells consider `^` to be a pipe metacharacter?


Printing conjunct unicode characters using single keystroke

I want to print a conjunct unicode characters (which do not have dedicated unicode value assigned to it, but which can be print using the combination of unicode characters) using a single key stroke by modifying the keyboard layout in Linux. I am modifying the /usr/share/X11/xkb/symbol/in file to modify the layout. Let me know if anything is possible.


no network device found after Kernel update

So I managed to install Debian 5 on an eBox 3300MX (an embedded type computer). I added a custom kernel after getting a basic install done. That was to get the network card to work. After that, I finished with installing, since I was doing a net install, and it worked fine. However, since then, I am unable to get the Debian to use the network card again. The only thing I can think of is that the Kernel updated during the install. I tried booting into the previous working kernel, and that did not work either. I get the error "No network devices found." However, I can open Network Tools and view devices, and I see the network card, with its MAC address and other info. I have it listed in etc/network/interfaces as auto. Thus, I don't understand why it does not want to work. I'm not really sure what other info is relevant, so please comment and let me know.


Monitor Blinking

I was a Debian user, but for some reason, after I installed Arch Linux, my monitor started to blink. It happens even on text terminals (C-F1 etc), but only after gdm starts. Any idea on what could be happening and how to fix it? I installed very few programs: vim, xorg, xf86-video-ati, gdm, xorg, fluxbox, vim, sudo and chromium. I installed xf86-video-ati based on the output of lspci:               [tata@spock ~]$ lspci | grep VGA     01:05.0 VGA compatible controller: ATI Technologies Inc RS690 [Radeon X1200 Series]


`login` from X session

I seem to remember it used to be possible to `login` via a GUI terminal. This was useful if (e.g.) you added yourself to a new group and want to use those privileges without stopping X to log in normally (since acquiring the new group requires a login).1 You can, of course, switch to a different VT, but this can be a hassle particularly if what you want to do requires an X display. But on my current Fedora 20 w/ kernel 3.11, `login` just hangs indefinitely. In the system logs:               login: FATAL: /dev/pts/3: change permissions failed: Operation not permitted      How can I get around this? * * * 1. As it turns out you can get around all that by via `su youself`, which performs a login...


how can i use sudo within a function?

i have written a function which acts in a similar way to `tee` but also pre- pends a datestamp. everything works fine except when i want to output to a file which is only root writeable (in my case a logfile within `/var/log`). i've simplified the following code snippet to just include the bits which are not working:               #!/bin/bash     #script ~/test_logger.sh     logfile=/var/log/test.log     logger()     {         while read data         do             echo $data >> $logfile         done         return 0     }     sudo ls ~ | logger      it works fine if i run the whole script like so `sudo ~/test_logger.sh` but i can't always do this since i want to use the logger function in files like `~/.bash_logout` which are run automatically. i've tried putting `sudo` in front of the echo in the while loop but this does not work. any ideas?


Horrible situation - file systems mounted simultaneously by multiple independent OS instances

How do I get out of this situation safely? Details are as follow: A xen server has got block devices allocated to VMs. But these devices have also been mounted inside Xen. In fact 44 of these block devices have been mounted like this. To make matters worse, each physical device is seen over 4 paths and each of those are mounted on a separate mountpoint. In other words the devices are actually mounted 5 times each. The VM guest OS sees the path via a PowerPath pseudo device (allocated as a phy: block device to the domU) Some of the devices are formatted as ext2 and reiserfs. **No need to explain to me the file system corruption risks involved here.** I am afraid that even just unmounting the file systems may cause corruption, and feel that **at this point pulling the power from the host, is the safest option**. Note that the applications, Oracle databases for the most part, in all the VMs are still running and in use. I discovered this when investigating high CPU usage on the dom0. There is an unkillable "find" process, with cwd -> /media/disk-12 which is mounted from /dev/sdf1, which belongs to /dev/emcpowerr Before anybody asks, the one time I've seen processes cannot be killed and continue to use CPU and RAM (unlike a defunct/zombie process), is when there is outstanding commited I/Os, eg sync returned but not physically on disk yet. More commonly this occurs on tape I/O. Suggestions!? P.S. I would have expected devices to be "reserved" once mounted, to prevent this kind of thing? Or is that not possible on Linux? EDIT: Firstly I am convinced that KDE within the hypervisor) is the culprit. It looks like KDE is mounting the devices it can on logging to create desktop icons. The same thing is however not happening on other Xen servers, but all the other servers are running a much older version of SLES and KDE ... V4 appears to be the offending one, with 3.4 behaving better). Furthermore two non-critical VMs have become hung. After shutting them down they would not boot up again due to file system corruption. The main/production VM is still running and the database on it still working, but clearly this is a time bomb. The customer is attempting to re-build the environment on another VM on another server but is stuck on issues configuring some of the components, so we are waiting... In any case I feel that none of the answers have so far been more than "best practice is always shut down gracefully" And I hope to get something more concrete... In any case, I feel that this situation may warrant some more careful thinking. Will shutting down cause outstanding IO, in particular file system meta data updates from the hypervisor, to be synced and cause potentially major file system corruption?


What characters in my printed boot scroll are artifacts?

I am a tech writer and I need to include a boot dump in a document. The dump the engineers gave me has some "bad characters" that I need to delete. What form does a "bad character" take? There are lines that look like: 14;1h 0m2J0m2Jm2J1 Is any line with number followed by a semi colon an artifact?


Suspending laptop fails ~50% of the time

Running ArchLinux and GNOME 3 on a Thinkpad X220. When I suspend my laptop it goes into sleep mode and the LED ring around the power button fades in and out. When a suspend fails, the LED ring and the screen is on but I can't do anything. My only recovery is to do a hard reset. This only happens 33 - 50% of the time within the last few months, but it never happened a year ago. How can I debug / fix this issue? Output from `sudo journalctl --since=today | tac | sed -n '/-- Reboot --/{n;:r;/-- Reboot --/q;p;n;b r}' | tac`:               Mar 17 15:10:49 noa systemd-logind[349]: Suspend key pressed.     Mar 17 15:10:49 noa NetworkManager[332]: <info> sleep requested (sleeping: no  enabled: yes)     Mar 17 15:10:49 noa NetworkManager[332]: <info> sleeping or disabling...     Mar 17 15:10:49 noa NetworkManager[332]: <info> (eth0): device state change: unavailable -> unmanaged (reason 'sleeping') [20 10 37]     Mar 17 15:10:49 noa NetworkManager[332]: <info> (eth0): cleaning up...     Mar 17 15:10:49 noa NetworkManager[332]: <info> (eth0): taking down device.     Mar 17 15:10:50 noa NetworkManager[332]: <info> (wlan0): device state change: disconnected -> unmanaged (reason 'sleeping') [30 10 37]     Mar 17 15:10:50 noa NetworkManager[332]: <info> (wlan0): cleaning up...     Mar 17 15:10:50 noa NetworkManager[332]: <info> (wlan0): taking down device.     Mar 17 15:10:50 noa systemd[1]: Starting Sleep.     Mar 17 15:10:50 noa systemd[1]: Reached target Sleep.     Mar 17 15:10:50 noa systemd[1]: Starting Suspend...     Mar 17 15:10:50 noa dbus-daemon[353]: dbus[353]: [system] Rejected send message, 2 matched rules; type="method_return", sender=":1.1" (uid=0 pid=349 comm="/usr/lib/systemd/systemd-logind ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.57" (uid=1000 pid=638 comm="gnome-session --session=xmonad ")     Mar 17 15:10:50 noa dbus[353]: [system] Rejected send message, 2 matched rules; type="method_return", sender=":1.1" (uid=0 pid=349 comm="/usr/lib/systemd/systemd-logind ") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.57" (uid=1000 pid=638 comm="gnome-session --session=xmonad ")


Free BSD/ Mac OS X Sed: Print regex match and the line 5 lines after the match

I thought it would be `sed -n /mymatch/,+5p` but I get expected context address. At this point I am just guessing commands, nothing works! I want to grab every line that matches the regex and print that line and the line which comes 5 lines after it, globally from a file.


OpenVZ: Many subdomains on a single IP for the VMs

Can I Use many sub domains that get assigned to OpenVZ containers with a single ip for a dedicated server? To elaborate further: I have one IP and one domain. I want to have two OpenVZ containers and do something like this: `Container1: 1.domain.com` `Container2: 2.domain.com` Is this possible?


Where are netstat's -t and -u flags documented?

I use the following command to find open ports on my servers:               $ netstat -ntulp      I've probably found that on some random website over the years. However, I cannot find where `-t` or `-u` are documented. It certainly isn't in the man page. The man page does allude the their existence, and possibly hints that they are synonyms for `-tcp` and `-udp` (also undocumented, though easy enough to infer meaning for) respectively. Though it _seems_ that `-t` and `-u` are synonyms for `-tcp` and `-udp`, **where is this documented?**


In Debian 7, which user does bind9 use to start the daemon?

I have a Debian 7 and a default installation of bind9, I manually changed permission of `/etc/bind/named.conf` to 000 and remove `-u bind` flag from `/etc/default/bind9` just to see what happens. As far as I know: when bind9 starts up as a run level 3 daemon, the init daemon invokes bind9 daemon script `/etc/init.d/bind9` as root. The bind9 daemon script does not switch user, neither does bind9 program itself - because `-u bind` flag has already been removed. But the problem is, bind9 fails to start and complains "permission denied" on `/etc/bind/named.conf` If bind9 startup script was invoked by root, how can the permission problem occur? To further clarify: there is no apparmor, selinux is disabled. The remainder of bind9 configuration is left at default.


Why doesn't docker container start at boot w/ upstart script on Ubuntu 12.04?

Using instructions for Docker auto-start on Linode VPS running Ubuntu 12.04 and Docker 0.8.1, the specified container does not start on reboot. Once booted, I am able to               ~$ sudo start [service-name]      and everything goes as planned, but I would also like to container to restart after a reboot. Is the script in the tutorial not designed to handle reboots? /etc/default/docker file contains one line:               DOCKER_OPTS="-r=false"      /etc/init/service-name.conf is straight from the docker page:               description "service description"                                                                                author "me"     start on filesystem and started docker     stop on runlevel [!2345]     respawn     script         # Wait for docker to finish starting up first.         FILE=/var/run/docker.sock         while [ ! -e $FILE ] ; do             inotifywait -t 2 -e create $(dirname $FILE)         done         /usr/bin/docker start -a db5e61a9afa8     end script


Create a booting external harddrive without formatting it

Ok so here's my situation: I have an external hard drive, but my pc recognizes it as a normal HDD (not USB). So I have three partitions, one for data storage, filled with (alot of) data, one with a bootable Kali-Linux installation, and one empty partition which I want to install Hiren's boot cd on. I have tried searching all kinds of methods but all of them apply for USB- ish HDDs. I have seen "rufus" but it says it will format the WHOLE drive and I want only one partition. Help? (PS. my E.HDD is a Transcend storejet a58263)


Installed a new NVidia graphics card and now I can't login

Running Linux Mint 14, I was using the integrated graphics from the i5 4670k processor. Now I've installed a NVidia graphics card (GTX 660 Ti) and now it doesn't login on normal mode. I tried _recovery mode_ , logged in and installed nvidia-current. After reboot, now the recovery mode does no longer work... Guess I'll have to login using a live cd, but I don't know what I should fix. Any clues? More info:   * Neither in recovery mode nor in normal mode was I able to jump to a TTY.   * There was no `xorg.conf`, that's the first thing I checked from the live cd.   * By _"does no longer work"_ I meant that it gets stuck at the last message, and does not jump to a shell or anything like that. Anyways, I eventually gave up and reinstalled Linux Mint. I was also forced to manually disable the integrated graphics card from the BIOS for the new installation to work, even though Windows, for instance, was able to detect what graphics card the screen was connected to.


Unknown entries in Kali Linux wtmp log file

I have installed Kali Linux and I found some puzzling entries in wtmp log file. Unknown user logs in for a short while when I boot my computer or switch accounts and most of the time when I shut down. Can you please explain what is the reason for these entries? I have used Ubuntu for a while and I have never seen this kind of entries. I also find it puzzling that it uses after each log out new console, which is one higher than the previous, i.e tty7 > tty8 > tty9 (see the entries from March 7th). This is a sample from my wtmp log file given by the command "last":               account  pts/0        :0.0             Fri Mar  7 18:50   still logged in        account  tty9         :0               Fri Mar  7 18:50   still logged in        (unknown tty9         :0               Fri Mar  7 18:50 - 18:50  (00:00)         root     pts/0        :0.0             Fri Mar  7 18:49 - 18:49  (00:00)         root     tty8         :0               Fri Mar  7 18:49 - 18:50  (00:00)         (unknown tty8         :0               Fri Mar  7 18:49 - 18:49  (00:00)         account  pts/0        :0.0             Fri Mar  7 18:48 - 18:49  (00:00)         account  tty7         :0               Fri Mar  7 18:48 - 18:49  (00:00)         (unknown tty7         :0               Fri Mar  7 18:48 - 18:48  (00:00)         reboot   system boot  3.12-kali1-amd64 Fri Mar  7 18:47 - 18:50  (00:02)     ...     (unknown tty8         :0               Thu Mar  6 10:25 - down   (00:00)         account  pts/1        :0.0             Wed Mar  5 20:51 - 09:42  (12:50)         account  pts/0        :0.0             Wed Mar  5 20:49 - 09:42  (12:52)         account  tty7         :0               Wed Mar  5 20:49 - 10:25  (13:35)         (unknown tty7         :0               Wed Mar  5 20:49 - 20:49  (00:00)         reboot   system boot  3.12-kali1-amd64 Wed Mar  5 20:49 - 10:25  (13:35)         account  pts/1        :0.0             Tue Mar  4 19:22 - 03:13  (07:50)         account  pts/0        :0.0             Tue Mar  4 19:21 - 03:13  (07:51)         account  tty8         :0               Tue Mar  4 19:11 - 03:14  (08:02)         (unknown tty8         :0               Tue Mar  4 19:11 - 19:11  (00:00)         root     pts/1        :0.0             Tue Mar  4 17:51 - 19:11  (01:19)         root     pts/0        :0.0             Tue Mar  4 17:50 - 19:11  (01:20)         root     tty7         :0               Tue Mar  4 17:50 - 19:11  (01:20)         (unknown tty7         :0               Tue Mar  4 17:49 - 17:50  (00:00)         reboot   system boot  3.12-kali1-amd64 Tue Mar  4 17:49 - 03:14  (09:24)


Changing a file's "Date Created" and "Last Modified" attributes to another file's

I'm using merge cap to create a merge pcap file from 15 files. For the merged file, I have changed the name to that of the first of the 15 files. But I would also like to change the merged file's attributes like "Date Created" and "Last Modified" to that of the first one. Is there anyway to do this?               FILES_dcn=($(find  $dir_dcn -maxdepth 1 -type f -name "*.pcap"  -print0 | xargs -0 ls -lt | tail -15 | awk '{print $9}'))     TAG1_dcn=$(basename "${FILES_dcn[14]}" | sed 's/.pcap//')     mergecap -w  "${dir_dcn}"/merge_dcn.pcap "${FILES_dcn[@]}"     mv  "${dir_dcn}"/merge_dcn.pcap  "${dir_dcn}"/"${TAG1_dcn}".pcap      I try to access the merged files over a samba server (Ubuntu). So that an extractor function can access auto extract the files to D folder. But as the created date will be changed for the merged file the extraction fails. Is there anyway to fix this?


What's the recommended way to run a service as a non-root user?

I have a simple init.d script which starts and stops a process. I call the init.d as root, but I'd like the process it controls to run as a specific user. The most common suggestion online seems to be to do               su myuser -c "my_process args"      However, this creates a second process space, new shell etc. and is somewhat inelegant. I'd prefer to use `exec()`, since it replaces the shell, but this doesn't take a user as argument. Is this a case where I should use `setuid()` first? What about setting the gid? Are there any gotchas to be aware of? Alternatively, are there distro-specific solutions to running the init.d as a different user? My environment is Centos 6.4.


Zsh completion for mounts (/run/media/DISK-LABEL)?

I am looking or `zsh` functionality to expand disk-labels into mountpoins: Example: I have disk with label `DISK-LABEL1` mounted on `/run/media/god/DISK- LABEL1`. Is there a plugin which expands input Like: `cat //DISK-LA<Tab>` to the `cat /run/media/god/DISK-LABEL1`? " **//** " was chosen as an example to trigger that type of autocompletion...


In a shell script... How do I capture stdin to a variable without stripping any trailing newlines? Right now I have tried:               var=`cat`     var=`tee`     var=$(tee)      In all cases `$var` will not have the trailing newline of the input stream. Thanks. ALSO: If there is _no_ trailing newline in the input, then the solution must not _add one_. **UPDATE IN LIGHT OF THE ACCEPTED ANSWER:** The final solution that I used in my code is as follows:               function filter() {         #do lots of sed operations         #see https://github.com/gistya/expandr for full code     }          GIT_INPUT=`cat; echo x`     FILTERED_OUTPUT=$(printf '%s' "$GIT_INPUT" | filter)     FILTERED_OUTPUT=${FILTERED_OUTPUT%x}     printf '%s' "$FILTERED_OUTPUT"      If you would like to see the full code, please see the github page for expandr, a little open-source git keyword-expansion filter shell script that I developed for information security purposes. According to rules set up in .gitattributes files (which can be branch-specific) and git config, git pipes each file through the **expandr.sh** shell script whenever checking it in or out of the repository. (That is why it was critical to preserve any trailing newlines, or lack thereof.) This lets you cleanse sensitive information, and swap in different sets of environment-specific values for test, staging, and live branches.


Fedora + KDE, ridiculously long delay starting applications after login

I'm running fedora 20 and installed KDE since I got sick of gnome 3. Everything's been fine but lately applications can get stuck launching. This is quite reproducible just after login for a few minutes but happens occasionally afterwards. Particularly google-chrome, sometimes I'll start it and it just shows a spinning icon in the task bar which may not even load eventually and disappear (waiting times on the order of 30 seconds). Running a terminal is similar, even when executed via shortcut keys. I'm not sure if KDE or something else is doing something at login and sucking _all_ my CPU (`top` shows krunner occasionally reach 6% ). Maybe what ever is launching my applications is just terrible at it.   1. How can I go about debugging this? Especially since most of the time I can't even open a terminal to type `top`. Are there KDE specific logs I can look at? Is there a list of KDE services somewhere?   2. What might be some possible causes? I'll accept that a fair amount of CPU time is needed at login, but I'd like some priority thrown my way.


What is a device tree and a device tree blob?

What exactly is a device tree, and a device tree blob? Where can I get its source code for a particular linux version? I found such name while running linux on xilinx chips (having ARM 9), for example: here


Difference between ulimit -n and /proc/$PID/limits

In Linux, there is open file limit. I can use `ulimit -n` to see open file limit, which is 1024 default. Then I also can see per process open file soft/hard limit by looking at /proc/$PID/limits. I see soft = 1024 and hard = 4096. I am wondering what is the difference between these two output? Also, do `setRlimit()` and `getRlimit()` apply to system-wide or per process?


Path variable not being set properly in zsh

For some reason, my $PATH variable is not being set properly which means I can't run a lot of commands I would like to. Here are the relevant lines from my `.zshrc` file:               if [[ -f ~/.profile]]; then         source ~/.profile     fi      Here is my `.profile` file:               pathdirs=(          ~/.rvm/bin         /usr/local/heroku/bin         /usr/local/shar/scala-2.10.0/bin     )          for dir in $pathdirs; do         if [[ -d $dir ]]; then             path+=$dir         fi     done      When I echo my $PATH variable, none of these three items shows up. All I get when I run `cat $PATH` is `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin: /usr/texbin`. Could anyone see if I'm doing something wrong?


Starting Bootlog daemon: bootlogd

Whenever I run linux on many ARM based systems, I see a message like this:               Starting Bootlog daemon: bootlogd.      As can be seen from the log messages below, it takes some finite time, close to 0.5 seconds. Can I stop this opeation from executing, so as to save this time? What changes will be required in Kerenel configuration (may be using menu config or something similar) to make sure that this operation never comes while booting?               Thu Feb 06 18:05:34.660 2014]      [Thu Feb 06 18:05:34.660 2014]      [Thu Feb 06 18:05:34.660 2014] U-Boot 2013.07 (Feb 04 2014 - 14:41:40)     [Thu Feb 06 18:05:34.660 2014]      [Thu Feb 06 18:05:34.660 2014] Memory: ECC disabled     [Thu Feb 06 18:05:34.660 2014] DRAM:  1 GiB     [Thu Feb 06 18:05:34.677 2014] MMC:   zynq_sdhci: 0     [Thu Feb 06 18:05:34.677 2014] SF: Detected N25Q128A with page size 64 KiB, total 16 MiB     [Thu Feb 06 18:05:34.708 2014] *** Warning - bad CRC, using default environment     [Thu Feb 06 18:05:34.708 2014]      [Thu Feb 06 18:05:34.708 2014] In:    serial     [Thu Feb 06 18:05:34.708 2014] Out:   serial     [Thu Feb 06 18:05:34.708 2014] Err:   serial     [Thu Feb 06 18:05:34.708 2014] U-BOOT for Xilinx-ZC702-14.7     [Thu Feb 06 18:05:34.708 2014]      [Thu Feb 06 18:05:34.708 2014]      [Thu Feb 06 18:05:34.708 2014] SF: Detected N25Q128A with page size 64 KiB, total 16 MiB     [Thu Feb 06 18:05:36.285 2014] SF: 11010048 bytes @ 0x520000 Read: OK     [Thu Feb 06 18:05:36.285 2014] ## Loading kernel from FIT Image at 01000000 ...     [Thu Feb 06 18:05:36.285 2014]    Using 'conf@1' configuration     [Thu Feb 06 18:05:36.285 2014]    Trying 'kernel@1' kernel subimage     [Thu Feb 06 18:05:36.285 2014]      Description:  PetaLinux Kernel     [Thu Feb 06 18:05:36.285 2014]      Type:         Kernel Image     [Thu Feb 06 18:05:36.285 2014]      Compression:  gzip compressed     [Thu Feb 06 18:05:36.285 2014]      Data Start:   0x010000f0     [Thu Feb 06 18:05:36.285 2014]      Data Size:    4997719 Bytes = 4.8 MiB     [Thu Feb 06 18:05:36.285 2014]      Architecture: ARM     [Thu Feb 06 18:05:36.285 2014]      OS:           Linux     [Thu Feb 06 18:05:36.285 2014]      Load Address: 0x00008000     [Thu Feb 06 18:05:36.285 2014]      Entry Point:  0x00008000     [Thu Feb 06 18:05:36.285 2014]      Hash algo:    crc32     [Thu Feb 06 18:05:36.285 2014]      Hash value:   db7d8248     [Thu Feb 06 18:05:36.285 2014]    Verifying Hash Integrity ... crc32+ OK     [Thu Feb 06 18:05:36.383 2014] ## Loading fdt from FIT Image at 01000000 ...     [Thu Feb 06 18:05:36.383 2014]    Using 'conf@1' configuration     [Thu Feb 06 18:05:36.383 2014]    Trying 'fdt@1' fdt subimage     [Thu Feb 06 18:05:36.383 2014]      Description:  Flattened Device Tree blob     [Thu Feb 06 18:05:36.383 2014]      Type:         Flat Device Tree     [Thu Feb 06 18:05:36.383 2014]      Compression:  uncompressed     [Thu Feb 06 18:05:36.383 2014]      Data Start:   0x014c442c     [Thu Feb 06 18:05:36.383 2014]      Data Size:    11161 Bytes = 10.9 KiB     [Thu Feb 06 18:05:36.383 2014]      Architecture: ARM     [Thu Feb 06 18:05:36.383 2014]      Hash algo:    crc32     [Thu Feb 06 18:05:36.383 2014]      Hash value:   8aee0d02     [Thu Feb 06 18:05:36.383 2014]      Hash algo:    sha1     [Thu Feb 06 18:05:36.383 2014]      Hash value:   266e39ed71a93229a26f0cf7e9f5317b64c2e407     [Thu Feb 06 18:05:36.383 2014]    Verifying Hash Integrity ... crc32+ sha1+ OK     [Thu Feb 06 18:05:36.387 2014]    Booting using the fdt blob at 0x14c442c     [Thu Feb 06 18:05:36.387 2014]    Uncompressing Kernel Image ... OK     [Thu Feb 06 18:05:36.782 2014]    Loading Device Tree to 07ffa000, end 07fffb98 ... OK     [Thu Feb 06 18:05:36.782 2014]      [Thu Feb 06 18:05:36.782 2014] Starting kernel ...     [Thu Feb 06 18:05:36.782 2014]      [Thu Feb 06 18:05:37.570 2014] INIT: version 2.88 booting     [Thu Feb 06 18:05:37.867 2014] Starting Bootlog daemon: bootlogd.     [Thu Feb 06 18:05:37.910 2014] Creating /dev/flash/* device nodes          .     .


Problems mounting a disk

I have a disk that has failed to mount on start up. I have commented out the line in fstab to try to diagnose the issue: `# /dev/sdc /media/bigdrive ext4 auto,exec,rw,user,async 0 0` Then rebooted. I then tried to mount the disk manually, but it claims to already mounted:               $ sudo mount /dev/sdc /media/bigdrive/     mount: /dev/sdc already mounted or /media/bigdrive/ busy      I also tried mounting to a new directory in `/media` but the same error occurred. So I tried to `umount`:               $ sudo umount -v /media/bigdrive     Could not find /media/bigdrive in mtab     umount: /media/bigdrive: not mounted      Trying to run `fsck` give me:               e2fsck 1.42 (29-Nov-2011)     fsck.ext2: Device or resource busy while trying to open /dev/sdc     Filesystem mounted or opened exclusively by another program?      So it seems the system can't make up its mind about if the drive is mounted or not. Is there any hope for the drive?


How does a bootloader and kernel interact after the kernel is loaded in memory?

I'm a little bit confused about the role of bootloader and its interaction with kernel, especially when talking wrt ARM Llnux. Once the Kernel is loaded into RAM, is there any job left for the bootloader? For example look at the log messages here:               Thu Feb 06 18:05:34.660 2014]      [Thu Feb 06 18:05:34.660 2014]      [Thu Feb 06 18:05:34.660 2014] U-Boot 2013.07 (Feb 04 2014 - 14:41:40)     [Thu Feb 06 18:05:34.660 2014]      [Thu Feb 06 18:05:34.660 2014] Memory: ECC disabled     [Thu Feb 06 18:05:34.660 2014] DRAM:  1 GiB     [Thu Feb 06 18:05:34.677 2014] MMC:   zynq_sdhci: 0     [Thu Feb 06 18:05:34.677 2014] SF: Detected N25Q128A with page size 64 KiB, total 16 MiB     [Thu Feb 06 18:05:34.708 2014] *** Warning - bad CRC, using default environment     [Thu Feb 06 18:05:34.708 2014]      [Thu Feb 06 18:05:34.708 2014] In:    serial     [Thu Feb 06 18:05:34.708 2014] Out:   serial     [Thu Feb 06 18:05:34.708 2014] Err:   serial     [Thu Feb 06 18:05:34.708 2014] U-BOOT for Xilinx-ZC702-14.7     [Thu Feb 06 18:05:34.708 2014]      [Thu Feb 06 18:05:34.708 2014]      [Thu Feb 06 18:05:34.708 2014] SF: Detected N25Q128A with page size 64 KiB, total 16 MiB     [Thu Feb 06 18:05:36.285 2014] SF: 11010048 bytes @ 0x520000 Read: OK     [Thu Feb 06 18:05:36.285 2014] ## Loading kernel from FIT Image at 01000000 ...     [Thu Feb 06 18:05:36.285 2014]    Using 'conf@1' configuration     [Thu Feb 06 18:05:36.285 2014]    Trying 'kernel@1' kernel subimage     [Thu Feb 06 18:05:36.285 2014]      Description:  PetaLinux Kernel     [Thu Feb 06 18:05:36.285 2014]      Type:         Kernel Image     [Thu Feb 06 18:05:36.285 2014]      Compression:  gzip compressed     [Thu Feb 06 18:05:36.285 2014]      Data Start:   0x010000f0     [Thu Feb 06 18:05:36.285 2014]      Data Size:    4997719 Bytes = 4.8 MiB     [Thu Feb 06 18:05:36.285 2014]      Architecture: ARM     [Thu Feb 06 18:05:36.285 2014]      OS:           Linux     [Thu Feb 06 18:05:36.285 2014]      Load Address: 0x00008000     [Thu Feb 06 18:05:36.285 2014]      Entry Point:  0x00008000     [Thu Feb 06 18:05:36.285 2014]      Hash algo:    crc32     [Thu Feb 06 18:05:36.285 2014]      Hash value:   db7d8248     [Thu Feb 06 18:05:36.285 2014]    Verifying Hash Integrity ... crc32+ OK     [Thu Feb 06 18:05:36.383 2014] ## Loading fdt from FIT Image at 01000000 ...     [Thu Feb 06 18:05:36.383 2014]    Using 'conf@1' configuration     [Thu Feb 06 18:05:36.383 2014]    Trying 'fdt@1' fdt subimage     [Thu Feb 06 18:05:36.383 2014]      Description:  Flattened Device Tree blob     [Thu Feb 06 18:05:36.383 2014]      Type:         Flat Device Tree     [Thu Feb 06 18:05:36.383 2014]      Compression:  uncompressed     [Thu Feb 06 18:05:36.383 2014]      Data Start:   0x014c442c     [Thu Feb 06 18:05:36.383 2014]      Data Size:    11161 Bytes = 10.9 KiB     [Thu Feb 06 18:05:36.383 2014]      Architecture: ARM     [Thu Feb 06 18:05:36.383 2014]      Hash algo:    crc32     [Thu Feb 06 18:05:36.383 2014]      Hash value:   8aee0d02     [Thu Feb 06 18:05:36.383 2014]      Hash algo:    sha1     [Thu Feb 06 18:05:36.383 2014]      Hash value:   266e39ed71a93229a26f0cf7e9f5317b64c2e407     [Thu Feb 06 18:05:36.383 2014]    Verifying Hash Integrity ... crc32+ sha1+ OK     [Thu Feb 06 18:05:36.387 2014]    Booting using the fdt blob at 0x14c442c     [Thu Feb 06 18:05:36.387 2014]    Uncompressing Kernel Image ... OK     [Thu Feb 06 18:05:36.782 2014]    Loading Device Tree to 07ffa000, end 07fffb98 ... OK     [Thu Feb 06 18:05:36.782 2014]      [Thu Feb 06 18:05:36.782 2014] Starting kernel ...     [Thu Feb 06 18:05:36.782 2014]      [Thu Feb 06 18:05:37.570 2014] INIT: version 2.88 booting     [Thu Feb 06 18:05:37.867 2014] Starting Bootlog daemon: bootlogd.     [Thu Feb 06 18:05:37.910 2014] Creating /dev/flash/* device nodes     .     .        .      Is there any role of bootloader after the lines `" Starting Kernel ...` above? Or the bootloader is always active occupying some memory and CPU resources? If it does remain active, then it makes sense to have a simpler bootloader for fast booting. Just a guess though?


How to copy only the files of a folder(including subfolder's files), but not the folder itself in shell

In Openssh, On the client, the content of path/to/file must be copied to Server. All files in /path/to/file on the client must be copied to /path/to/files on the server. Note: only copy files, no folders! and files of subfolders. please give the command.


How can I change the shutter speed of my webcam in Linux?

how can I change the shutter speed of my webcam in Linux? I'm using fedora 14


How to safely eject usb hardrive - udisks returns "detach failed: .."

I have a USB external hard drive with several partitions, and I cannot spin down the hard drive to get it to eject. Any suggestions? I unmounted all partitions through Nautilus, but the drive is still spinning. Nautilus does not seem to have other options besides `unmount` in Ubuntu 13.10. After ensuring that no drives are mounted, I tried the `udisks` to detach the drive, but I get the following error:               [lucas@lucas-ThinkPad-W520]~$ mount | grep ^'/dev'                                           /dev/sda5 on / type ext4 (rw,errors=remount-ro)     [lucas@lucas-ThinkPad-W520]~$ udisks --detach /dev/sdb     Detach failed: One or more partitions are busy on /dev/sdb     [lucas@lucas-ThinkPad-W520]~$       How can other partitions be busy if `mount | grep ^'/dev'` does not return any of my `/dev/sdb` partitions? Is there an easy way to detach my external hard drive? A simple solution would be nice... I am using Ubuntu 13.10 and my external hard drive is a backup my internal hard drive, setup via Clonezilla. **UPDATE** I tried `lsof`, results below:               [lucas@lucas-ThinkPad-W520]~$ lsof /dev/sdb     sdb   sdb1  sdb2  sdb3  sdb4  sdb5  sdb6       [lucas@lucas-ThinkPad-W520]~$ lsof /dev/sdb     [lucas@lucas-ThinkPad-W520]~$ lsof /dev/sdb1     [lucas@lucas-ThinkPad-W520]~$ lsof /dev/sdb2     [lucas@lucas-ThinkPad-W520]~$ lsof /dev/sdb3     [lucas@lucas-ThinkPad-W520]~$ lsof /dev/sdb4     [lucas@lucas-ThinkPad-W520]~$ lsof /dev/sdb5     [lucas@lucas-ThinkPad-W520]~$ lsof /dev/sdb6     [lucas@lucas-ThinkPad-W520]~$


ssh-add complains: Could not open a connection to your authentication agent

I've been trying to get ssh-add working on a RaspberryPi running Raspbian. I can start `ssh-agent`, when I do it gives the following output into the terminal:               SSH_AUTH_SOCK=/tmp/ssh-06TcpPflMg58/agent.2806; export SSH_AUTH_SOCK;     SSH_AGENT_PID=2807; export SSH_AGENT_PID;     echo Agent pid 2807;      If I run `ps aux | grep ssh` I can see it is running. Then I try to run `ssh-add` in order to add my key passphrase, and I get the following:               Could not open a connection to your authentication agent.      Any ideas?


How can I create an alias for a git [action] command (which includes spaces)?

Most of my my aliases are of this form: `alias p='pwd'` I want to alias `git commit` so that it does `git commit -v` But trying to create an alias with a space gives an error:               $ alias 'git commit'='git commit -v'     -bash: alias: `git commit': invalid alias name


configure not adding line-continuation characters to makefile

This is, perhaps, a bit of a bizarre one but I don't even know where to _start_ looking so if anyone can point me in the right direction, I'll be very grateful. I've just done a fresh install of my distribution, which included moving to the next release (yup, it's Ubuntu) and so am rebuilding/installing a load of stuff that I usually have in addition to whatever the distribution provides (latest versions and so forth). Anyway, I was merrily doing so with one (a slightly customised version of emacs) when I found `make` complaining a lot. Looking at the makefile(s), I found that the configure script hadn't put any "continuation line" characters in. The configure script is rather long (this is emacs, after all) and just searching for `\` is rather pointless! So does anyone have any idea why this might be happening? (As I said, it's a fresh install so maybe it's just some package that I forgot to install. But it's a bit bizarre.)


How to dump the icon of a running X program?

Is there a way to get the icon of a running X program? When you switch between windows, you could see the icon of it, e.g through xfwm4.


Generate GPG secret key from public key and passphrase

I've lost my key. Now I can't sign anything, and servers don't accept unsigned content. The key is uploaded to a keyserver. Now I have fingerprint, public key and I remember my passphrase. How can I re-generate same key on my Linux box?


Getty not starting in qemu

I'm trying to get running an ARM based Debian inside qemu. As a rootfs I'm using structure from embeddedarm 2gb sdcard image with versatile 2.6.24 kernel downloaded from fedora qemu tutorial site. At embededarm ftp there are also kernel images, but they keeps qemu window blank (I suppose output goes to serial console, because target device has no displaying device). So my kernel boots up, opens rootfs correctly and continues to runlevel 2 and ends with "starting apache" and stops there - nothing more to do. How can I achieve getty gets running after that? ![screenshot](http://i.stack.imgur.com/YJ4s0.png) My inittab is as follows. I tried to change getty invocations with no success.               # /etc/inittab: init(8) configuration.     # $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $          # The default runlevel.     id:2:initdefault:          # Boot-time system configuration/initialization script.     # This is run first except when booting in emergency (-b) mode.     si::sysinit:/etc/init.d/rcS          # What to do in single-user mode.     ~~:S:wait:/sbin/sulogin          # /etc/init.d executes the S and K scripts upon change     # of runlevel.     #     # Runlevel 0 is halt.     # Runlevel 1 is single-user.     # Runlevels 2-5 are multi-user.     # Runlevel 6 is reboot.          l0:0:wait:/etc/init.d/rc 0     l1:1:wait:/etc/init.d/rc 1     l2:2:wait:/etc/init.d/rc 2     l3:3:wait:/etc/init.d/rc 3     l4:4:wait:/etc/init.d/rc 4     l5:5:wait:/etc/init.d/rc 5     l6:6:wait:/etc/init.d/rc 6     # Normally not reached, but fallthrough in case of emergency.     z6:6:respawn:/sbin/sulogin          # What to do when CTRL-ALT-DEL is pressed.     ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now          # Action on special keypress (ALT-UpArrow).     #kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."          # What to do when the power fails/returns.     pf::powerwait:/etc/init.d/powerfail start     pn::powerfailnow:/etc/init.d/powerfail now     po::powerokwait:/etc/init.d/powerfail stop          # /sbin/getty invocations for the runlevels.     #     # The "id" field MUST be the same as the last     # characters of the device (after "tty").     #     # Format:     #  <id>:<runlevels>:<action>:<process>     #     # Note that on most Debian systems tty7 is used by the X Window System,     # so if you want to add more getty's go ahead but skip tty7 if you run X.     #     #1:2345:respawn:/sbin/getty 38400 tty1     #2:23:respawn:/sbin/getty 38400 tty2     #3:23:respawn:/sbin/getty 38400 tty3     #4:23:respawn:/sbin/getty 38400 tty4     #5:23:respawn:/sbin/getty 38400 tty5     #6:23:respawn:/sbin/getty 38400 tty6          # Example how to put a getty on a serial line (for a terminal)     #     T0:23:respawn:/sbin/getty -L tsconsole 115200 vt100     #T1:23:respawn:/sbin/getty -L ttyS0 115200 vt100          # Example how to put a getty on a modem line.     #     #T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3


"Kill the biggest process" button

This laptop has an SSD and therefore I decided to omit the swap. This works well in most cases, but sometimes the RAM gets a bit short and the computer gets really sluggish and tends to freeze up. Is there a way to implement a "kill the biggest process" button that goes straight to the kernel in case I notice the freeze fast enough? Or, because it's a computer, a heuristic for when it starts to freeze and shoot the biggest process itself would be fine too.


Configure external HDD for use with multiple linux PCs

I've got an external drive, and I'd like to have a linux partition on it. I formatted everything correctly on one machine with Fedora20 (I have one `ntfs` and one `ext4` partition), but when I plug it in my older machine with Fedora12, it doesn't automount the `ext4` partition. I have found a solution that involves putting something like the following in `/etc/fstab`:               UUID=0123-abcd  /media/MYEXTDISC  ext4  ...,umask=000,dmask=000,...      But this has two problems:   1. It doesn't help since the old machine with Fedora12 does not support `umask` and `dmask` for `ext4`.   2. I would have to do something like that on every linux computer I use, which is impossible, since some of them are at work where I can't modify `/etc/fstab`. My idea was that the the filesystem could provide some option like "treat all non-root files as non-root files" or "give all non-root files the rights `666` or `777`. However, I don't know if this is possible with `ext4`. I can change the filesystem to anything linuxy, the HDD is empty at this moment.


ps command not giving output in home directory

I am logging into a solaris server, switching to bash, then switching to another user "sruser" and switching to bash. `/home/batch/sruser/` is the home directory of the user "sruser". The issue is ps is not giving any output when run in the home directory -               # pwd      /home/batch/sruser/     # ps     # cd dir1      /home/batch/sruser/dir1     # ps         PID TTY      TIME CMD      17867 pts/1789 0:00 bash      17165 pts/1789 0:00 ksh      20435 pts/1789 0:00 ps     #      Don't know what could be the issue. Don't even know where to start looking for whatever could be the issue.


Output of the "last" command

Can anybody explain me what is the meaning of the last column of the output of the `last` command? I'm particularly interested in its meaning with respect to the `reboot` pseudo-user.               reboot   system boot  2.6.32-28-generi Sat Feb 12 08:31 - 18:09 (9+09:37)         What does that 9+09:37 mean?


Reading EDID from EEPROM

From the link: http://en.wikipedia.org/wiki/Extended_display_identification_data > The EDID is often stored in the monitor in a memory device called a serial > PROM (programmable read-only memory) or EEPROM (electrically erasable PROM) > and is accessible via the I²C bus at address 0x50.[1] The EDID PROM can > often be read by the host PC even if the display itself is turned off. How can I read that information?


Include / in symlink to a directory?

Symlinking to a directory gives to different results with `ls -l` depending on whether I `ln -s dir` or `ln -s dir/`. But what's the actual difference, and which one should I prefer why?


Unsure about java JDK for Centos 6.4

I have done a yum search java before installing anything to see if may have already. It comes back with the following:               libreadline-java-javadoc.i686 : Javadoc for libreadline-java     libvirt-java-devel.noarch : Compressed Java source files for libvirt-java     libvirt-java-javadoc.noarch : Java documentation for libvirt-java     lpg-java-compat.noarch : Compatibility Java runtime library for LPG 1.x     pki-java-tools.noarch : Certificate System - PKI Java-Based Tools     pki-java-tools-javadoc.noarch : Certificate System - PKI Java-Based Tools     ppl-java-javadoc.i686 : Javadocs for ppl-java     java-1.5.0-gcj.i686 : JPackage runtime compatibility layer for GCJ     java-1.5.0-gcj-devel.i686 : JPackage development compatibility layer for GCJ     java-1.5.0-gcj-javadoc.i686 : API documentation for libgcj     java-1.5.0-gcj-src.i686 : Source files for libgcj     java-1.6.0-openjdk.i686 : OpenJDK Runtime Environment     java-1.6.0-openjdk-demo.i686 : OpenJDK Demos     java-1.6.0-openjdk-devel.i686 : OpenJDK Development Environment     java-1.6.0-openjdk-javadoc.i686 : OpenJDK API Documentation     java-1.6.0-openjdk-src.i686 : OpenJDK Source Bundle     java-1.7.0-openjdk.i686 : OpenJDK Runtime Environment     java-1.7.0-openjdk-demo.i686 : OpenJDK Demos     java-1.7.0-openjdk-devel.i686 : OpenJDK Development Environment     java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation     java-1.7.0-openjdk-src.i686 : OpenJDK Source Bundle      So does this mean I have it installed or is this just some general information pertaining to what java can run on the system?


How to automate route commands

For some reason everytime I connect to my VM I have to manually launch these two commands for it to connect to the Internet.               route add 198.245.49.254 dev eth0     route add default gw 198.245.49.254      Is there a way I can automate this so that I don't have to do this manually every time?


How hardlink and softlink works in background?

I am looking for an explanation of the following:   * what happens in Linux when we create soft link and hardlink   * how are they accessible    * why do symlinks always display 777 permissions


Installing Ubuntu on HDD and Windows on SSD

I am new to Linux. I have a 60GB SSD + 1TB HDD on my laptop. I want to know if I could keep Windows 8 on my SSD and install Ubuntu on HDD. Can GRUB detect both operating systems?


What this thing is called and how to disable it? (Gnome-shell related)

![](http://i.imgur.com/1ztkF8R.png) The thing indicating current open application. I know there are some extensions concerning it but I'm yet to find a way to disable it, either by good ol' editing or an extension.


Creating a messagebox using commandline

How can I create a message box using command-line to show a text?


Confusion about group `cdrom` in linux system

When I type command `groups ubuntu`, the output would we like,               ubuntu : ubuntu adm dialout cdrom floppy audio dip video plugdev netdev admin      I am interested in the `cdrom` group. What does the group `cdrom` mean? It means user `ubuntu` can use `cdrom` device in the OS? If a user who is not in the group `cdrom`, can he/she use `cdrom` device in the OS?


Locking console when computer suspends/hibernates

In X I've used the following script (from here) to lock the computer with i3lock each time `pm-suspend` or `pm-hibernate` are invoked. /etc/pm/sleep.d/00screensaver-lock:               #!/bin/sh      # 00screensaver-lock: lock workstation on hibernate or suspend           username=andreas      userhome=/home/$username      export XAUTHORITY="$userhome/.Xauthority"      export DISPLAY=":0"            case "$1" in         hibernate|suspend)            su $username -c "/usr/bin/i3lock &             ;;         thaw|resume)            ;;         *) exit $NA            ;;       esac      Now I'm in the process of setting up a console-only laptop (a minimal Debian install without the X server installed.) I've tried using the above script on that machine to lock my session using vlock. (That is: I've switched out `i3lock` with `vlock` in the version of the script I'm using on the console machine.) I've also tried commenting out the two lines starting with `export XAUTHORITY` and `export DISPLAY=":0"` as they are X specific. The script doesn't work on the no-X machine. How should I call vlock each time the computer suspends/hibernates?


Remove Linux directories containing ONLY old files

We have numerous directories that each contain 2 files, one of which is a hidden file. We want to remove all those directories and their contents that contain ONLY files that have a modification date older than 180 days. So, for example, if we have the following:               Dir1   Jan 1 2000          File1A   Jan 1 2000          File1B   Jan 1 2000     Dir2   Jan 1 2000          File2A   Jan 1 2014          File2B   Jan 1 2014     Dir3   Jan 1 2000          File3A   Jan 1 2014          File3B   Jan 1 2000      I need a Linux command that will remove only Dir1 and all of its contents including the hidden file. Dir2 and Dir 3 would remain untouched because each contain at least one file that is newer than 180 days ago. I've played around with listing those directories that contain a newer file but I couldn't find an "inverse" command that would then remove all the "other" directories.


How can I keep *all* environment vars for a specific command in sudo?

I have a script that sets several environment variables and then finally calls another script using sudo. The script run with sudo must be able to pick up those variables, and I'm not always going to be certain what those variables are. Is there a way of configuring this sudoers entry to allow the command complete access to the callers env vars?               %deploy ALL=NOPASSWD: /bin/build.sh      When I run the sudo command from my script:               sudo -E build.sh "$@"      I get:               sudo: sorry, you are not allowed to preserve the environment      Googling around I've only found ways to preserve specific variables and not just everything.


Creating a User-less Distro

One of the popular programs I use is GParted, and it has its own custom distro, that boots straight to the desktop, and starts the program. I couldn't find any information on creating such a distro. I need it to be where I can install packages of my choosing, just without the user system. Is this possible to remove from a base installation of openSUSE or Ubuntu?


how to access root terminal in kali linux

I am currently using Kali Linux but I have a problem. In my Kali OS, when I open root terminal then it simply starts a normal terminal. I cannot access root terminal. When I update my root terminal by the following command               sudo apt-get update && install rootterminal      I get this error:               Reading package lists... Done     install: missing destination file operand after `rootterminal'     Try `install --help' for more information.      How can I solve this?


Unable to make touchpad work

I'm trying to find here a solution for my long-time touchpad problem. I tried one year ago at http://www.linuxquestions.org/questions/linux-laptop- and-netbook-25/touchpad-not-beign-recognized-probably-the-kernel- doesn%27t-load-it-918152/ I copy the question: * * * I have a laptop SONY VAIO VGN-NS21Z with a touchpad that is not beign loaded with the kernel. (Not appears at the Xorg log nor xinput list) My touchpad has not a function key to activate it or disabling it so that is not the problem. I've tried enabling i8042 parameters at kernel options as seen googling it and it doesn't work. Before someone asks yes, the touchpad works at my Windows 7 partition. This is what I've got from the device properties at Windows 7. NOTE: Titles are translated by me so may do not match with the Windows7 English version ones.               Hardware ID:         ACPI\SNY9008         *SNY9008     Compatible ID         *PNP0F13     Service         i8042prt     Name of device physic objet         \Device\0000005d     Access path to the instance of the device         ACPI\SNY9008\4&3290F976&0     Primary         PCI\VEN_8086&DEV_2919&SUBSYS_9045104D&REV_03\3&11583659&0&F8     Brothers     ACPI\PNP0200\4&3290f976&0     ACPI\INT0800\4&3290f976&0     ACPI\PNP0103\4&3290f976&0     ACPI\PNP0000\4&3290f976&0     ACPI\PNP0C04\4&3290f976&0     ACPI\PNP0C02\2     ACPI\PNP0B00\4&3290f976&0     ACPI\PNP0100\4&3290f976&0     ACPI\PNP0303\4&3290f976&0     ACPI\PNP0C09\4&3290f976&0     ACPI\SNY5001\4&3290f976&0     Node secure name of the controller         msmouse.inf:MSMfg.NTamd64:PS2_Inst:6.1.7600.16385:*pnp0f13     Id of the matching device         *pnp0f13      From that details I've found at the dmesg something related to PNP0F13 and SNY9008 which seems to be related to the touchpad as seen at Windows details: As I can see I think that the kernel detects the touchpad but when it has to assign it to wherever it has to be assigned to work it confounds the touchpad with the keyboard or whatever and then I have the keyboard "mounted" two times.               $ dmesg | grep PNP0f13     [    0.882985] pnp 00:08: Plug and Play ACPI device, IDs SNY9008 PNP0f13 (active)     [    1.776101] i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M] at 0x60,0x64 irq 1,12     $ dmesg | grep i8042     [    1.776101] i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M] at 0x60,0x64 irq 1,12     [    1.825321] serio: i8042 KBD port at 0x60,0x64 irq 1     [    1.846471] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input2      I've checked the ioports and it suggest me that I'm correct. You can see that I have two ports exactly at 0x60 and 0x64 at ioports that are a keyboard (maybe it is normal but I don't know). If we assume that SNY9008 PNP0F13 is the touchpad (Which I think it is as seen on Windows 7) that is the problem. /proc/ioports               0000-0cf7 : PCI Bus 0000:00       0000-001f : dma1       0020-0021 : pic1       0040-0043 : timer0       0050-0053 : timer1       0060-0060 : keyboard       0062-0062 : EC data       0064-0064 : keyboard       0066-0066 : EC cmd       0070-0077 : rtc0       0080-008f : dma page reg       00a0-00a1 : pic2       00c0-00df : dma2       00f0-00ff : fpu       03c0-03df : vga+       0400-047f : pnp 00:05         0400-0403 : ACPI PM1a_EVT_BLK         0404-0405 : ACPI PM1a_CNT_BLK         0408-040b : ACPI PM_TMR         0410-0415 : ACPI CPU throttle         0420-042f : ACPI GPE0_BLK         0430-0433 : iTCO_wdt         0450-0450 : ACPI PM2_CNT_BLK         0460-047f : iTCO_wdt       0500-053f : pnp 00:05       0680-069f : pnp 00:05       0800-0803 : pnp 00:05     0cf8-0cff : PCI conf1     0d00-ffff : PCI Bus 0000:00       1000-100f : pnp 00:05       164e-164f : pnp 00:05       a000-afff : PCI Bus 0000:05       b000-bfff : PCI Bus 0000:03       c000-cfff : PCI Bus 0000:02         c000-c0ff : 0000:02:00.0           c000-c0ff : sky2       d000-dfff : PCI Bus 0000:01         d000-d0ff : 0000:01:00.0       e000-e01f : 0000:00:1f.3         e000-e01f : i801_smbus       e020-e03f : 0000:00:1f.2         e020-e03f : ahci       e040-e05f : 0000:00:1d.2         e040-e05f : uhci_hcd       e060-e07f : 0000:00:1d.1         e060-e07f : uhci_hcd       e080-e09f : 0000:00:1d.0         e080-e09f : uhci_hcd       e0a0-e0bf : 0000:00:1a.2         e0a0-e0bf : uhci_hcd       e0c0-e0df : 0000:00:1a.1         e0c0-e0df : uhci_hcd       e0e0-e0ff : 0000:00:1a.0         e0e0-e0ff : uhci_hcd       e100-e103 : 0000:00:1f.2         e100-e103 : ahci       e110-e117 : 0000:00:1f.2         e110-e117 : ahci       e120-e123 : 0000:00:1f.2         e120-e123 : ahci       e130-e137 : 0000:00:1f.2         e130-e137 : ahci      Using: Fedora 16 KDE Spin kernel 3.1.4-1.fc16.i686.PAE Now 3.1.9-1.fc16.i686.PAE * * * Note that now I'm using Linux mint 13: Linux 3.2.0-54-generic #82-Ubuntu SMP Tue Sep 10 20:08:42 UTC 2013 x86_64 But the problem is the same. Note: I'm just a linux user, not a sysadmin, so please be specific when asking something. If more information is needed please ask me and I'll post it. Thank you.


recover partially overwritten tape from tar -c

I have a situation. I was supposed to run tar -x to recover a tar file from a tape but I pressed "c" and forgot to put the tape on readonly. The file was on fsf position 23, but the tape had 27 files. I know that file 23 is lost but since I pressed ctrl+c to cancel the tar command, can I still hope to somehow recover the other tar files? I tried fsf past file 23 and all I get is input/output error. I was thinking maybe do a dump from file 23 using dd and then get this file and use a signature file recovery tool, like photorec. Is this doable?


Tab autocompletion and history in tcsh

I use tcsh, and I'd like to set up the following behaviour, which I've seen on some systems in the past. If I type               !string TAB      then:   * If the history contains a unique entry beginning with `string`, autocompletion should take place, and I can edit the resulting command, or just press return to execute it.   * If the history contains multiple entries beginning with `string`, a list of possible completions is displayed, the command is partially completed as far as possible (without eliminating any possibilities from the list), and on the command line I should have an exclamation mark followed by the partially completed command, so that I can type more characters and press TAB again. How do I achieve this?


can't connect to mysql as admin from outside

I have a dedicated server (CentOS 5.3) but I can't log on to mysql as admin from outside, however I can do that when I'm on server's command line. I assume there's a setting somewhere that can give me the access I need, but I don't know where.


Why does the exclamation mark `!` sometimes upset bash?

I realize that `!` has special significance on the commandline in the context of the commandline history, but aside from that, in a runing script the exclamation mark can sometimes cause a parsing error.   I think it has something to do with an `event`, but I have no idea what an _event_ is or what it does. Even so, the same command can behave differently in different situations.   The last example, below, causes an error; but why, when the same code worked outside of the command substitution? .. using GNU bash 4.1.5               # This works, with or without a space between ! and p       { echo -e "foo\nbar" | sed -nre '/foo/! p'         echo -e "foo\nbar" | sed -nre '/foo/!p'; }     # bar     # bar          # This works, works when there is a space between ! and p       var="$(echo -e "foo\nbar" | sed -nre '/foo/! p')"; echo "$var"     # bar          # This causes an ERROR, with NO space between ! and p       var="$(echo -e "foo\nbar" | sed -nre '/foo/!p')"; echo "$var"     # bash: !p': event not found


Why people recommend the -j3 option for make when having a dual-core CPU?

In Gentoo Linux it is possible to set the `MAKEOPTS` variable in `/etc/portage/make.conf` to tell `make` how many jobs it should run in parallel when building packages. Since I have a dual-core CPU, I naively chose to use the `-j2` option: one job per core, so both have something to do. The "problem" is there are a lot of references that tell users having a dual-core CPU to set the `-j3` option instead. Some of them are:   * Gentoo handbook   * Gentoo wiki   * make.conf(5) man page For example, the Gentoo handbook says: > A good choice is the number of CPUs (or CPU cores) in your system plus one, > but this guideline isn't always perfect. But what is the rationale for "CPUs + 1" rule? Why the extra job? The make.conf(5) man page even says: > Suggested settings are between CPUs+1 and 2*CPUs+1. I also read section 5.4 (Parallel Execution) in the `make` info page and `make` man page explanation for the `-j` option, but it seems there's no answers there.


can't open transfered website from old DS to new DS

I have 2 dedicated servers both running CentOS 5.3/Plesk 10. I've transfered a website (domain) from old server to a new one via Plesk migration manager and the website (domain) shows in the domain list on Plesk, and it's files are in /var/www/vhosts/domain.com/httpdocs/ I tried to open the website like this: http://xx.xx.xx.xx/domain.com where xx.xx.xx.xx is a shared IP that I've assigned to the domain on a new server during transfer and domain.com is website's domain name. Instead of website loading I get a 404. How can I open the website and see if everything is ok? Essentially, what is the path (using IP) to the website until it gets DNS sorted out? UPDATE: apache error_log file shows:               [Tue Aug 23 11:05:15 2011] [error] [client xx.xx.xx.xx] File does not exist: /var/www/vhosts/default/htdocs/domain.com      This is where the problem exists, I've expected it to follow path like this:               /var/www/vhosts/domain.com/htdocs/      and instead the server apparently tries this:               /var/www/vhosts/default/httpdocs/domain.com      Note the difference - "htdocs" and "httpdocs", which is the actual folder on the server. I need to know that the website is running ok, otherwise I cannot assign DNS to make it live... UPDATE2: I am able to access the website if I edit hosts file on my PC with something like that: 1.2.3.4 domain.com So how come I can't load it like this: http://1.2.3.4/domain.com/ ?


What is the rationale for the bash shell not warning you of arithmetic overflow etc.?

There are limits set for the arithmetic evaluation capabilities of the `bash` shell. The manual is succinct about this aspect of shell arithmetic but states: > Evaluation is done in fixed-width integers with no check for overflow, > though division by 0 is trapped and flagged as an error. The operators and > their precedence, associativity, and values are the same as in the C > language. Which fixed-width integer this refers to is really about which _data type_ is used (and the specifics of why this is are beyond this) but the limit value is expressed in `/usr/include/limits.h` in this fashion:               #  if __WORDSIZE == 64     #   define ULONG_MAX     18446744073709551615UL     #  ifdef __USE_ISOC99     #  define LLONG_MAX       9223372036854775807LL     #  define ULLONG_MAX    18446744073709551615ULL      And once you know that, you can confirm this state of fact like so:               # getconf -a | grep 'long'     LONG_BIT                           64     ULONG_MAX                          18446744073709551615      This is a _64 bits integer_ and this translates directly in the shell in the context of arithmetic evaluation:               # echo $(((2**63)-1)); echo $((2**63)); echo $(((2**63)+1)); echo $((2**64))     9223372036854775807        //the practical usable limit for your everyday use     -9223372036854775808       //you're that much "away" from 2^64     -9223372036854775807          0     # echo $((9223372036854775808+9223372036854775807))     -1      So between 263 and 264-1, you get negative integers showing you how far off from ULONG_MAX you are1. When the evaluation reaches that limit and overflows, by whatever order that is, you get no warning and that part of the evaluation is reset to 0 which may yield some unusual behavior with something like _right-associative_ exponentiation for instance:               echo $((6**6**6))                      0   // 6^46656 overflows to 0     echo $((6**6**6**6))                   1   // 6^(6^46656) = 6^0 = 1     echo $((6**6**6**6**6))                6   // 6^(6(6^46656)) = 6^(6^0) = 6^1     echo $((6**6**6**6**6**6))         46656   // 6^(6^(6^(6^46656))) = 6^6     echo $((6**6**6**6**6**6**6))          0   // = 6^6^6^1 = 0     ...      Using `sh -c 'command'` doesn't change anything so I have to assume this is normal and compliant output. Now that I think I have a basic but concrete understanding of the arithmetic range and limit and what it means in the shell for expression evaluation, I thought I could quickly peek at what data types the other software in Linux use. I used some `bash` sources I had to complement the input of this command:               { shopt -s globstar; for i in /path/to/source_bash-4.2/include/**/*.h /usr/include/**/*.h; do grep -HE '\b(([UL])|(UL)|())LONG|\bFLOAT|\bDOUBLE|\bINT' $i; done; } | grep -iE 'bash.*max'          bash-4.2/include/typemax.h:#    define LLONG_MAX   TYPE_MAXIMUM(long long int)     bash-4.2/include/typemax.h:#    define ULLONG_MAX  TYPE_MAXIMUM(unsigned long long int)     bash-4.2/include/typemax.h:#    define INT_MAX     TYPE_MAXIMUM(int)      There's more output with the `if` statements and I can search for a command like `awk` too etc. I notice the regular expression I used doesn't catch anything about arbitrary precision tools I have such as `bc` and `dc`. * * * **Questions**   1. What is the rationale for not warning you (like `awk` does when evaluating 2^1024) when your arithmetic evaluation overflows? Why are the negative integers between 263 and 264-1 exposed to the end user when he's evaluating something?   2. I have read somewhere that some flavor of UNIX can interactively change ULONG_MAX? Has anyone heard of this?   3. If someone arbitrarily changes the value of the unsigned integer maximum in `limits.h`, then recompiles `bash`, what can we expect will happen? * * * Note 1. I wanted to illustrate more clearly what I saw, as it is very simple empirical stuff. What I noticed is that:   * (a)Any evaluation that gives < 2^63-1 is correct   * (b)Any evaluation that gives => 2^63 up to 2^64 gives a negative integer:     * The range of that integer is x to y. x = -9223372036854775808 and y = 0. Considering this, an evaluation which is like (b) can be expressed as 2^63-1 plus something within x..y. For instance if we're literally asked to evaluate (2^63-1)+100 002 (but could be any number smaller than in (a) ) we get -9223372036854675807. I'm just stating the obvious I guess but this also means that the two following expressions:   * (2^63-1) + 100 002 AND;   * (2^63-1) + (LLONG_MAX - {what the shell gives us for ((2^63-1) + 100 002), which is -9223372036854675807}) well, using positive values we have;     * (2^63-1) + (9223372036854775807 - 9223372036854675807 = 100 000)     * = 9223372036854775807 + 100 000 are very close indeed. The second expression is "2" apart from (2^63-1) + 100 002 i.e. what we're evaluating. This is what I mean by you get negative integers showing you how far off from 2^64 you are. I mean with those negative integers and knowledge of the limits, well you cannot finish the evaluation within the x..y range in the bash shell but you can elsewhere - the data is usable up to 2^64 in that sense (I could add it up on paper or use it in bc). Beyond that however the behavior is similar to that of 6^6^6 as the limit is reached as described below in the Q...


Is it possible to include file in config file of zsh? How?

I'd like to have a file eg. _f_ with only zsh aliases (pureness reasons). Then I'd like to include _f_ file in my _.zshrc_ file, so that the aliases defined in _f_ are visible in _.zshrc_. Is it possible? If it is, I could create a script eg. `my_alias` (`$my_alias ll 'ls -l'`) which appends alias to _f_ file. Of course I could do               $echo {alias command} >> ~/.zshrc      but this makes _.zshrc_ one big mess. Additionally how is it looks like in bash? **UPDATE** If someone share my idea this is solution, thanks to phunehehe:               # source aliases     ALIASFILE=~/.aliasesrc     source $ALIASFILE     function add_alias() {         if [[ -z $1 || -z $2 || $# -gt 2 ]]; then             echo usage:             echo "\t\$$0 ll 'ls -l'"         else             echo "alias $1='$2'" >> $ALIASFILE             echo "alias ADDED to $ALIASFILE"         fi     }


Unable to open X display when launching Cinnamon

I installed Arch Linux and I'm unable to start Cinnamon. I can use startx and it has that green-y interface. I've tried searching with not much luck. I try to start it with `cinnamon`               Failed to init server     Unable to open X display      There is not logs when I start cinnamon, only when I use startx (even though it works) `Failed to load module (module does not exist, 0)` for these: `nvidia`, `nv`, `modesetting`. So I used `pacman -S nvidia` and got: `Nvidia-libgl and mesa-libgl are in conflict (libgl). Remove mesa-libgl?` So I prompted with `y`. Then `error: failed to prepare transaction (could not satisfy dependencies)`


Adding a second hard disk CentOS

I'm running CentOS on my VMware server console, and I want to know how to make a second virtual hard disk on which I can expand the size of the primary logical volume AND and a third to hold two other file systems               # fdisk -l          Disk /dev/sda: 12.8 GB, 12884901888 bytes     255 heads, 63 sectors/track, 1566 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1          13      104391   83  Linux     /dev/sda2              14        1566    12474472+  8e  Linux LVM


Using getopts to parse options after a non-option argument

I have a bash script as below in a file `nepleaks_upd.sh`, that I want to run as `./nepleaks_upd.sh bootstrap --branch off`. Couldn't make it to take `\--branch` , but what it works with is `./nepleaks_upd.sh bootstrap -b off`.               usage() { echo "Usage: $0 [prepare | up | down]  [-b <on/off>]" 1>&2; exit 1; }                                                                                case "$1" in                                                                                bootstrap)                                                                                while getopts ":b:" o; do                                                                                case "${o}" in                                                                                b)                                                                                b=${OPTARG}                                                                                if [ ${b} == "off" ]; then                                                                                echo "git clone https://github.com/iPrayag/dotfiles.git"                                      ## logic                                                                                fi                                                                                ;;                                                                                *)                                                                                echo ${o}                                                                                usage                                                                                ;;                                                                                esac                                                                                done                                                                                shift $((OPTIND-1))                                                                                echo "option1 = ${o}"                        echo "option2 = ${b}"                                                                                if [ -z "${b}" ]; then                                                                                usage                                                                                fi                                                                                ;;                                                                                up)                                                                                echo "up"                               ##logic                                                                                ;;                                                                                down)                                                                                echo "down"                           ##logic                                                                                ;;                                                                                *)                                                                                echo "Usage: $0 {up | down} dev"                                                                         exit 1                                                                                ;;                                                                                esac               Without first `case .. in .... esac`, it works fine. With `case ... in ... esac`, it gives blank option for `-b`,               $ ./nepleaks_upd.sh bootstrap -b off     option1 = ?     option2 =      Usage: ./nepleaks_upd.sh [bootstrap | up | down]  [-b <on/off>]


Installing XBMC and X server on FreeBSD

I couldn't find how to install X server and XBMC on FreeNAS. So without any opinion if it's good or not, what are the steps to do it?


Gnome 3.8.4 can I upgrade to Gnome 3.10?

I'm using Centos 7.               gnome-shell --version     Gnome Shell 3.8.4        1. does this mean I'm using Gnome 3.8.4?    2. can I upgrade to Gnome 3.10?   3. Are there any how-tos?


Building GNU part of GNU/Linux

I have successfully built the `Linux Kernel 3.13.6` and ran it in `QEMU`. Since it is just the kernel, it will eventually complain that it cannot find `init` or `sh`, etc. Therefore, it is necessary to build the GNU utilities for Linux (which makes it GNU/Linux). However, how would someone do that? How do you build the utilities for Linux? Is it as simple as downloading & compiling w/ GCC and then copying onto a formatted disk?


Terminator interface inside tilda emulator?

Does anyone knows how to use Terminator inside Tilda? I use Tilda emulator a lot but sometimes I need to have different terminal windows open to check things out and I don't want to open Terminator separatedly. Does anyone knows?


How to dump memory image from linux system?

I know to dump memory images in Window. (eg-dumpit) But I don't know how to dump memory images in Linux. I wanna get memory images in Linux and from linux to linux with ssh connection or something. How can I get in linux ? please help me.


Solaris cron ignoring mail aliases?

As a Solaris user, I want cron jobs generated emails for the `localuser@server` to be forwarded to my `myuser@sample.com` email account, so that I read only one inbox. To resolve this I have forwarded `localuser` to `myuser@sample.com` and according to the aliases test it does work as expected:                $ sudo sendmail -v -bv localuser      Password:       localuser... aliased to myuser@sample.com      The `mconnect` command also confirms the alias is set. However any communication from cron seems to not use aliases: > `Mar 14 17:54:27 localuser sendmail[9249]: [ID 801593 mail.info] > s2ELsRC2009249: from=localuser, size=13, class=0, nrcpts=1, > msgid=<201403142154.s2ELsRC2009249@myserver.sample.com>, > relay=localuser@localhost` > > `Mar 14 17:54:28 localuser sendmail[9249]: [ID 801593 mail.info] > s2ELsRC2009249: to=localuser, ctladdr=localuser (100/1), delay=00:00:01, > xdelay=00:00:01, mailer=relay, pri=30013, relay=smtp.sample.com. > [192.168.0.2], dsn=2.0.0, stat=Sent ( > <201403142154.s2ELsRC2009249@myserver.sample.com> Queued mail for delivery)` This results in errors of course in `smtp.sample.com` as user `localuser` does not exist there. Any ideas how can I debug what is happening?


Combos with shift not working in emacs on console

I'm running emacs 24.3.1 on a system with a console-only minimal install of Debian Jessie. Non of the keybindings that involve the shift key works in emacs (except shift to modify upper case). These are the combos I'm missing (all important for editing tree structure in org-mode):               M-S-RET     C-S-RET     M-S-LEFT     M-S-RIGHT     M-S-UP     M-S-DOWM      Neither register as anything but RET (new line) or arrow movement. Tried running both `dpkg-reconfigure console-data` and `dpkg-reconfigure keyboard- configuration` but neither gives me relevant options to solve the problem. **EDIT:** found this from org manual. Turns out that it's a well known problem that the speed keys can take pretty good care of. To activate speed keys: (setq org-use-speed-commands t) Then when you're at the beginning of a headline:               M-S-LEFT = L      M-S-RIGHT = R     M-S-UP = U     M-S-DOWM = D      As for: M-S-RET C-S-RET Custom speed keys can quite easily be set for those. But workaround aside I would still like to hear from folks who knows how to get normal function for shift key outside of X. It is a text-based environment after all, I need all the keys I can get.


how to replace a value with a calculation in bash/sed

I used bash sed to replace ip address in a group of files, i.e 10.1.1.x => 10.2.2.x-19:               file1: 10.1.1.29 => 10.2.2.10,      file2: 10.1.1.30 => 10.2.2.11,      file3: 10.1.1.31 => 10.2.2.12,       etc. I almost managed with:               for file in ifcfg* ; do sed -e "s/10.1.1./10.2.2./" $file >tmp/$file ; done      but couldn't figure out how to calculate and replace the last address position (x => x-19) it's probably really easy...


How to postpone shutdown with systemd?

I run a desktop computer, which typically is shut down for the nights and often also during the day, when not in use or left unattended. I usually shut it down from GUI (KDE 4.10), sometimes - from KDM, and sometimes I also use a good, old /sbin/shutdown. **Now** : it happens that a task is running, which should not be interrupted, such as a backup, video recording, etc. For obvious reasons, in such cases I would prefer that the shutdown is postponed until the job is finished. Ideally a warning should be issued to the user, but that's not always possible. How to achieve this? Some time ago I wrote a script executed in a runlevels 0 and 6, which checked for existance of a flag file, and postponed the process until the file disappeared. It was not ideal, but efficient enough. But in recent versions of my distribution init was replaced with systemd, which runs /etc/init.d/ scripts in parallel, so the hack does not work any more. If it's of any importance, I use OpenSuse 12.3, kernel 3.7.10, KDE 4.10.


apt-get can not detect correct python version when using update-alternatives for python

I have installed different python versions on my Linux Mint DE. I used the `update-alternatives --set` statement to easily switch between the different versions. Unfortunately sometimes `apt-get install` or `upgrade` or something similar have problems recognizing the correct python path. It seems to want to use python2.7, although I have set the correct alternative. I guess `apt-get` can't find out that `/usr/bin/python` points to `/etc/alternatives/python` and that to `/usr/bin/python2.7`. If I manually create a symbolic link directly from `/usr/bin/python` to `/usr/bin/python2.7` `apt-get` finishes without an error. How can I use the alternatives option so that `apt-get` can correctly detect and use the configured python version?


Edit partition of disk part of a ZFS Raid

I've gota strange problem. Since a previous failure from one of my hard drive, I had to replace one of my 4 hdd running in RAIDZ. But since I changed this disk, the last partition of my disk appear on my dektop as a mountable device! But in gparted, has not a label set. ![Gparted drive /dev/sdf](http://i.stack.imgur.com/MGArA.png) How could I remove the "CDROM" "drive" displaying on my desktop and file browser? ![Error while trying to mount](http://i.stack.imgur.com/PA1Tb.png)


How does nickel-browser in Jolicloud launch apps, behind the scenes?

For the last few days I've been playing with nickel-browser, Jolicloud's Chromium mod in Ubuntu 10.10. I'm try to create a desktop similar to Jolicloud's, but I've hit a big problem: I can only make it open links. I can't find a way to run commands to launch applications such as Empathy, or a way to open links as a webapp, instead of in a normal browser window. If anyone could help me, I'd really appreciate it. Sorry if this is the wrong place to ask, but I've been unable to find a Jolicloud forum.


What makes the shell interpret these redirects as follows?

Can anyone help me understand this seemingly odd behavior of how the shell parses the redirects..?               $ cat > test.txt     Line 1     Line 2     $ ls -i dummy.txt dummy2.txt     ls: dummy.txt: No such file or directory     ls: dummy2.txt: No such file or directory     $      $ cat test.txt > dummy.txt > dummy2.txt     $ cat dummy2.txt     Line 1     Line 2     $ cat dummy.txt     $      Interesting! I would have expected the output from `cat test.txt` to be redirected into `dummy.txt` and then the shell would read `dummy.txt` as the input for `dummy2.txt`. But somehow the shell parses it differently... So how does the content of `test.txt` be taken as the input for `dummy2.txt`, by bypassing `dummy.txt` altogether? * * * **Note:** Same result in bash and ksh..


Compare strings

I have 2 txt files, in one i have alias lists and the other is the servers name. So what im trying to do is to loop from the alias txt file line by line and where it will find the name that is on the other txt file ( servers name ) will be echo or writhe in other file. For example: In this alias.txt file we have something like this               alias server1='ssh root@server1.com'     alias server2='ssh root@server2.com'     alias server3='ssh root@server3.com'     alias l='ls -CF'     alias la='ls -A'     alias ll='ls -alF'     alias ls='ls --color=auto'      and in the other file we have just:               server1     server2     server3      Now when i list the alias.txt i like to compear the other txt files with the alias names and to gave me just the alias value. If he find server1 write to file or echo ssh root@server1.com ... The main point is I have many alias that are like server1 ( ssh connections ) but i like some servers not all of them and i need just specific ones ( in this example the ones that i have in the server.txt file ) Any hints ? :)


Get size of sent curl request

Is there a way to get the size of a `curl` request programmatically? E.g. if I do               curl 'http://www.example.com/url' \     -H 'Cookie: cookie=cookiedata;' \     -H 'X-CSRFToken: csrffake' \     --data 'example=moredata \     --compressed      I want to know how big my sent request is?


Sync a local directory with a remote directory in Linux

I have a folder with a few files in it, and some space on a web server. I want to do a bi-directional sync between the local folder and the remote one in linux, just on modification time. How do I do this? btw I cannot install anything on the server, for all intents and purposes it is just space. Note: I already have rsa key-pairs set up, so that it can happen silently.


How to Install all the default packages by group Using the Local YUM repo

I created a Local HTTP YUM repo. I can install the individual packages. But is there a way to install packages in the available groups? When I tried to install using groups, it give me this message:               [root@mainserver ~]#  yum groupinstall "Development Tools"     Loaded plugins: product-id, security, subscription-manager     This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.     Setting up Group Process     Warning: Group Development Tools does not exist.


Issue with real-time log inspecting piping tail, grep and cut

I have to inspect a growing log in real time, and I found an issue that makes me _miss_ some lines (I can't understand exactly what lines) using `tail -f` or `tailf`, `grep` and `cut`. I use `grep` because I want to filter lines containing a specific word, and then `cut -c -NUM` because some lines are very long and I don't want them to wrap in my terminal window. Here is a minimal example, in which I'm watching a sample log made of _"Nth line"_ lines, filtering for word _"line"_ , missing all lines in this case (obviously `^C` is me killing the process):               $ tail -n 3 -f log          13th line     14th line     15th line     ^C          $ tail -n 3 -f log | grep --color=never 'line'          13th line     14th line     15th line     ^C          $ echo $COLUMNS          100          $ tail -n 3 -f log | grep --color=never 'line' | cut -c -$COLUMNS          ^C      Note that this issue occours **only with`tail -f` (or `tailf`), `grep` and `cut` combined**. If I do not use `grep` in the middle, or `cut` at the end of the pipe, there's no missing line. If I replace `tail -f` with `tail` or `cat`, no problem. You can see every possible case in this longer example. I'm on Ubuntu 13.04, _GNU coreutils_ (`tail`, `cut`) version 8.20 and _GNU grep_ 2.14.


How do you specify alternative script interpreters (shebangs)?

In an executable file, you specify the environment using a shebang:               #!/usr/bin/env ruby          # ruby code here      But what if you want to specify multiple possible environments? For example, if you have multiple versions of Ruby installed, you may want to do something like               #!/path/to/better/ruby/version     #!/path/to/alternative/ruby/version          # ruby code here      How can you specify multiple possible environments for a single executable file?


Can I convert an ext3 partition into ext4 without formatting?

my home directory is on a separate partition which still uses ext3. Is there a way to convert this partition into ext4 in a non-destructive way?


Where is the Ctrl+/ (^/) bash shortcut for undo defined?

I can not find the mapping in `bind -p` nor in `stty -a`. Also, it only works in the terminal emulators I've tried (xterm, konsole, gnome-terminal) and not in the linux system console. I think it's traditionally an emacs mapping. EDIT: When I enter `^V^/` bash prints `^_`, which is mapped to undo in bind. But where is `^/` mapped to `^_`?


What are other ways to share a tmux session between two users?

I'm looking for a clean and easy way to share a tmux session with another user on the same machine. I've tried the `-S socket-path` option, but it requires opening up all permissions of the socket-path before someone else can connect to the session. It works, but it's a little cumbersome. For example:               # Me     $ tmux -S /tmp/pair     $ chmod 777 /tmp/pair          # Another user     $ tmux -S /tmp/pair attach      This works, but both users now share the same tmux configuration (the configuration of the user who initiated the session). Is there a way to allow the two users to use their own tmux config and their own individual tmux key bindings? For bonus points, ideally, it would also be nice to give read-only access of the tmux session to other users.


How to detect the incoming httpd Connection Counts of each VHOSTS?

With RHEL and Apache (httpd), is there a way to:   * Detect which v.host (domain) is gaining how many incoming connections? Because in this few days, i got a lot of incoming connections on the Server being acknowledged by using:   * ps aux | grep httpd -c   734 That means i have `734` incoming connections currently being handled by Apache but the problem is i have (lets say) 10 Vhosts (domains).   * So which Domain is getting the high loads? Any sharp solutions please.


Automatic shut down of Ubuntu 13.04 along side Windows 8

Things with Ubuntu were working absolutely fine, but suddenly, the laptop started overheating whenever I logged into Ubuntu. And that lead to automatic shutdown. I realised that it was definitely due to heat. This overheat crossed a limit and it started affecting even when I logged into Windows. With appropriate service, the laptop fan was cleaned and things are absolutely back to normal in Windows 8. But, there are still problems with using Ubuntu.   1. After a while, it closes automatically. And, if the laptop is on battery, it doesn't switch on immediately, unless you connect to power. I tried without battery and the problem is still the same. So , battery problems are ruled out.   2. My laptop is HP- pavilion, g6-2313ax notebook. I would like to stress again, it was working really fine, but one fine day, this problem started to occur. When searchd over net, they said something about the kernel version and it being updated could be a reason.   3. I tried the one suggested in this link as well, but it did not work! link.   4. I got a small intuition as to the birth of this problem. I reinstalled Windows 8 once with ubuntu on it and thus it removed the grub. To retrieve it, I followed few online steps! link. Ever since the I got the grub back, I have been facing this issue. But I cleared my whole hard disk and properly installed Ubuntu and Windows again. Still, the problem exists. What can I do to solve this?


How can I set check interval for set autoread option in VIM? Is it possible?


shellcheck is advising not to use basename: why?

I am trying out shellcheck. I have something like that               basename "${OPENSSL}"       and I get the following suggestion               Use parameter expansion instead, such as ${var##*/}.      From the practical point of view I see no difference               $ export OPENSSL=/opt/local/bin/openssl     $ basename ${OPENSSL}     openssl     $ echo ${OPENSSL##*/}     openssl      Since `basename` is in the POSIX specs, I don't a reason why it should be best practice. Any hint?


Small inexpensive *nix box?

I'd like to learn more about Unix & Linux and would like to set up a little home test server/ headless box. (I'm thinking of compiling from scratch, to learn how that works; either Gentoo Stage II or Linux from scratch.) I'd likely only need a little bit of storage, a USB port, and a network connection. I've heard good things about the (no longer produced) NSLU2 and overheating issues with those "plug computers" made by Marvell and others. I'd like something low-powered and physically small, which is why I don't just buy/get an old box from craigslist, though I'm willing to be convinced that it's worth finding space next the couch and a few bucks more in electricity.


Getting all files that have been modified on a specific date

Is it possible to find all php files within a certain directory that have been modified on a certain date I'm using               find /var/www/html/dir/ -mtime -28 | grep '\.php'       to get files modified within the last 28 days, but I only need files that have been modified on the following date 2011-02-08


ffmpeg installation on Linux REHEL/CentOs 6.X

I had a static installation of `ffmpeg` but was running into trouble with config files not found so I have since just deleted it. Then I tried re- installing a more current static version just to see if it differs from first one I installed a week ago and it does. The first one had the `ffmpeg` script which I ended up placing in `/usr/bin` and a `ffmpeg-static` folder with `cache` in root. The latest static I just installed has no `static` folder and just two scripts, the `ffmpeg` and `ffprobe`. I have a few questions:   * Is it best to place these scripts in `usr/bin`, does it matter? Does `yum` update static versions?   * Is it much better practice to compile `ffmpeg` than use static versions?    * Has anyone tried this type of ffmpeg installation as stated in the following link?


How to write repeated free-form strings to a file, as fast as 'dd'?

`dd` can write repeating `\0` _bytes_ to a file very fast, but it can't write repeating arbitary strings.   Is there a _bash-shell_ method to write repeating arbitary **strings** equally as fast as 'dd' (including `\0` ) ? All the suggestions I've encountered in 6 months of linux are things like `printf "%${1}s" |sed -e "s/ /${2}/g"`, but this is painfully slow compared to `dd`, as shown bel402653184ow.. and `sed` crashes after approx 384 MB (on my box).. actually that's not bad for a single line-length :) but it did crash!   I suppose that wouldn't be an issue for 'sed', if the string contained a newline). Speed Comparison 'dd' vs 'printf+sed'                                           real        user        sys            WRITE 384 MB: 'dd'          0m03.833s   0m00.004s   0m00.548s     WRITE 384 MB: 'printf+sed'  1m39.551s   1m34.754s   0m02.968s          # the two commands used        dd if=/dev/zero bs=1024 count=$((1024*384))     printf "%$((1024*1024*384))s" |sed -e "s/ /x/g"      I have an idea how to do this in a _bash-shell_ script. but there's no point re-inventing the wheel :)


How can I use column to delimit on tabs and not spaces?

I'd like to use Unix `column` to format some text. I have fields delimited by tabs, but within each field there are also spaces. `column` delimits on white space (tabs and spaces). How can I make column only use tabs as the delimiter? I was trying to specify tab as the delimiter using:               cat myfile | column -t -s"\t"


Cannot understand chkrootkit's result

I couldn't understand the output of `chkrootkit` command:               $ chkrootkit -q -r /     /usr/lib/.libssl.so.10.hmac     /usr/lib/.libfipscheck.so.1.hmac     /usr/lib/firefox-3.6/.autoreg     /usr/lib/.libfipscheck.so.1.1.0.hmac     /usr/lib/.libssl.so.1.0.0d.hmac     /lib/.libcrypto.so.1.0.0d.hmac     /lib/.libgcrypt.so.11.hmac     /lib/.libcrypto.so.10.hmac     /proc/2980/fd/129: No such file or directory      What does this mean?


How to create a script, which runs another script in separate terminal window and does not wait?

I wrote the following               #!/bin/bash     cd ~/bin/red5-1.0.0     gnome-terminal --working-directory=. -x red5.sh      `red5.sh` is the script to run (this is java written media server). My script above opens new terminal but with error message               There was an error creating the child process for this terminal     Failed to execute child process "red5.sh" (No such file or directory)      What can be the cause? I am at Ubuntu 11.10


Replacement shortcuts for `screen`

Screen uses the shortcut `Ctrl``A` to activate. I find that this interferes with the Bash command for jumping to the start of the line, and the VIM command for incrementing an integer. Certainly I could just remap it, but I am interested to know how other screen users deal with the situation. I don't think that I use `Ctrl``Q` for anything. What drawbacks and gotchas have other screen users encountered when changing the default shortcut? Note that I was unsure if Unix.SE or SuperUser would be more appropriate a place to post this. This could be a "chatty, open-ended question" or it could be a very useful resource for other screen users who undoubtedly encounter this, depending on how disciplined the answers are. I suspect that other screen users will more likely stumble across the question on Unix.SE. If SuperUser is a more appropriate place then any mod is welcomed to move it. Thanks!