title: Establishing client VNC connection over SSH in one step (e.g., with the -via option)

text: How do I reduce these two commands to one? I am connecting from my client to an x11vnc server and the two commands below already work. I just wish to do it in one step: first command:               ssh -fNL 5901:localhost:5678 -i ~/.ssh/some_id_rsa rocky@example.com      and second:               vncviewer localhost:5901      From reading the man page, it seems like the -via option might do it. Unfortunately, the man page leaves me very confused. For reference (not that I understand it) here is what my man page says:                  -via gateway               Automatically create encrypted TCP tunnel to the gateway machine before con‐               nection, connect to the host through  that  tunnel  (TightVNC-specific).  By               default,  this  option  invokes SSH local port forwarding, assuming that SSH               client binary can be accessed as /usr/bin/ssh. Note that when using the -via               option,  the  host  machine name should be specified as known to the gateway               machine, e.g.  "localhost"  denotes  the  gateway,  not  the  machine  where               vncviewer  was  launched.  The environment variable VNC_VIA_CMD can override               the            default             tunnel             command             of               /usr/bin/ssh -f -L "$L":"$H":"$R" "$G" sleep 20.  The tunnel command is exe‐               cuted with the environment variables L, H, R, and G taken the values of  the               local  port number, the remote host, the port number on the remote host, and               the gateway machine respectively.


title: Building zsh without admin priv: No terminal handling library found

text: I am trying to install Zsh without root privileges on a Linux machine. I downloaded the source tarball and run:               ./configure --prefix=<my_installation_path>      but then I got: > configure: error: "No terminal handling library was found on your system. > This is probably a library called curses or ncurses. You may need to install > a package called 'curses-devel' or 'ncurses-devel' on your system" ## Installing ncurses: Since I am not root on this system, I downloaded `ncurses` and installed it manually (also using `./configure --prefix=<my_installation_path>`), which seems to have gone well. I then updated the following paths:               INSTALLATION_PATH='/path/to/installation'     export PATH=$INSTALLATION_PATH/bin/:$PATH     export LD_LIBRARY_PATH=$INSTALLATION_PATH/lib:$LD_LIBRARY_PATH     export CFLAGS=-I$INSTALLATION_PATH/include      and tried installing Zsh again, but got the same `ncurses` error. As far as I can tell, the path variables above point to the right locations, and I can check this on the shell. Why is Zsh not recognizing `ncurses?`


title: Running rsh command under the root account

text: I have two machines running Solaris 9 (192.168.2.9) and Windows XP (192.168.2.5). I need to run the following command on the Windows machine:               rsh 192.168.2.9 -l root pwd      To be able to run this command I've created the `/etc/hosts.equiv` file on the UNIX machine, which contains:               192.168.2.5 xp.user      where `xp.user` is the name of the active XP account, under which the `rsh` command connects. The command gives the following messages:               192.168.2.9: permission denied     rsh: can't establish connection      I tried to change the UNIX user to `notroot`:               rsh 192.168.2.9 -l notroot pwd      The command gave the same result:               192.168.2.9: permission denied     rsh: can't establish connection      But when I created the file `/home/notroot/.rhosts` with the same contents as `/etc/hosts.equiv` the result was OK:               /home/notroot      Both the `hosts.equiv` and `.rhosts` files are identical and were created in the UNIX `vi` editor. The empty lines are added at the end of each file. The properties of the files are: `/etc/hosts.equiv` \- group: root; owner: root; permissions: owner: RW `/home/notroot/.rhosts` \- group: other; owner: notroot; permissions: owner: RW The choice of `rsh` protocol and the root account doesn't depend on me. So, how can I run the `rsh` command under the root account?


title: SSH from osx to osx and then use agent

text: I have a mac at home and a mac at work. The work mac is setup for ssh to all work related servers. Sometimes I have to connect from my home mac and access the servers which are setup on my work mac. When I connect to VPN and ssh into my work mac, and try to ssh to any other servers which are set in the config of my work mac it's asking for my passphrase for the user of my work mac, which I don't have any, so I just hit enter and then it asks for the password for the server I want to connect to (keyless ssh setup). The ssh-agent is not running by default when I connect to my work mac via ssh. I have to start it manually. I also have a similar setup on my home mac, sshing into a linux virtualbox and then to an amazon ec2 instance using the ssh-agent from the box and it works fine without any problems. Could you tell me how to fix this issue? Or a workaround?


title: Loading module 8192cu fails

text: I 'm running Angstrom Linux (3.0.7) on embedded device BeagleBoard-xM. I want to load a module _(downloaded fromhere)_ and copied into: `/lib/modules/3.0.7/kernel/drivers/net/wireless/rtlwifi/8192cu.ko` on the BeagleBoard-xM SD card file system. However, loading the module fails:               root@beagleboard:/# modprobe 8192cu                                                  FATAL: Module 8192cu not found.      Any ideas?


title: Replacing string based on line number

text: I have a situation where i want to replace a particular string in many files Replace a string **AAA** with another string **BBB** but there are lot of strings starting with AAA or ending in AAA ,and i want to replace only one on line 34 and keep others intact. Is it possible to specify by line number,on all files this string is exactly on 34th line.


title: why isn't rsync copying files to the server

text: I'm following along with a Railscast that teaches how to set up Chef solo. It uses two interesting terminal commands that I had never seen before, only one of which I can get to work. When I do               scp -r root@198.xxx.xxx.xxx:/var/chef .      It copies the contents of the remote server directory to my local machine. The following command is supposed to sync the files back to the server after I change them on my machine               rsync -r . root@198.XXX.XXX.XXX:/var/chef      However, the changes aren't showing on the remote server, and when I run the chef commands that are supposed to apply the changes, it's not showing any changes that need to be made. Am I using rsync incorrectly? Update Running this command gave the following output. Still no changes are shown on the remote server               rsync -rvv . root@198.XXX.XXX.XXX:/var/chef               `building file list ...      done     delta-transmission enabled     chef/node.json     chef/solo.rb     chef/cache/chef-client-running.pid     chef/cache/chef-stacktrace.out     chef/chef/node.json     chef/chef/solo.rb     chef/chef/cache/chef-client-running.pid     chef/chef/cache/chef-stacktrace.out     chef/chef/cookbooks/main/recipes/default.rb     chef/cookbooks/main/recipes/default.rb     chef/cookbooks/main/templates/default/zshrc.erb     total: matches=17  hash_hits=17  false_alarms=0 data=0     sent 1167 bytes  received 442 bytes  643.60 bytes/sec     total size is 6236  speedup is 3.88`      Update You'll notice from the above update that a `templates` directory should be inside the `main` directory (along with a `recipes` directory), however, this is what's showing               root@Chef3:/var/chef/cookbooks# cd main     root@Chef3:/var/chef/cookbooks/main# ls     recipes


title: Why should I get linux?

text: Ok so I am student, about to get my degree in computer science. I have been programming for couple of years now on my Macbook pro on OS X and I havent had any problems. On the other hand, everyone around is telling me to install linux OS because its better, developers use it, programmers use it, etc. But no one told me why is linux better than OS X? What's the big deal about having programming and developing on Linux?


title: deleting a 'file' under /proc or /dev

text: I am using a cowdancer/debootstrap setup to generate a chroot. Of course, as I iterate, I generate some chroot configurations that are bad. I have found myself in an awkward situation where I have a slew of files under /proc that are refusing to be deleted. When I `sudo rm -rf z_needs_to_be_deleted`, I get a ton of messages that look analogous to this:               rm: cannot remove 'z_needs_to_be_deleted/var/cache/pbuilder/build/cow.13620/     proc/6352/task/6358/loginuid':  Permission denied      How do I kill off this chroot?


title: Generate random numbers in specific range

text: After googling a bit I couldn't find a simple way to generate with a shell command a random number included in a specific range, between a minimum and a maximum. I read about `/dev/random`, `/dev/urandom` and `$RANDOM`, but any of these can do what I need. Is there another useful command, or a way to use the previous data?


title: Finding the ID of a process and killing it

text: When ever I need to kill a background process I do `ps -e | grep <process_name>` Which prints something like this `1766 ? 00:00:13 conky` , Then I use the process ID to `kill` it like so `kill 1766` . Is there any way I can simplify this ? Make it quicker ? reduce the amount of typing ?


title: Aptitude: What is the filter for virtual packages that has been provided?

text: The `~v` flag will display all virtual packages, but even if they are already provided by installed packages, adding `~i` will make the list empty as virtual packages can never have `i` flag. So how do I find out what virtuals are installed?


title: How to install windows 7 after fedora 16

text: I have Fedora 16, but I want to play games, and I´m considering installing Windows 7. I need to be able to dual boot these two OS. Is there something special I´m supposed to do, or it will work like a charm (I put the DVD, install Windows 7 with x/3 disk space and voila, it works)?


title: Can 'nix handle NTFS ADS data streams?

text: Two-three years ago, I experimented (in Windows) with NTFS ADS meta-data (Alternate Data Streams). It seemed like an interesting idea, but it is certainly not "portable". Is there an NTFS-ADS aware tool which can read and/or write this ADS data?   Also, do any of the `nix commonly used/preferred file-syystems support similar secondary streams"?


title: GRUB2 and EFI - File not found?

text: I'm running Linux on a 8,3 2011 MacBook Pro. It uses EFI/rEFIt to boot. I was able to install GRUB2 EFI support, and it shows up just fine in the rEFIt boot menu. Everything seems to be working there. What I did was this:               apt-get source grub2     sudo apt-get build-dep grub2     cd grub2-1.99     export EFI_ARCH=x86_64     ./configure --with-platform=efi --target=${EFI_ARCH} --program-prefix ""     make      This built everything required. Then, it was time to install the compiled `grub.efi` image:               cd grub-core     ../grub-mkimage -O ${EFI_ARCH}-efi -d . -o grub.efi -p "" part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot configfile linux multiboot     sudo mount -t vfat -o rw /dev/sda1 /mnt     sudo mkdir -p /mnt/EFI/grub     sudo cp grub.efi *.mod *.lst /mnt/EFI/grub     sudo touch /mnt/EFI/grub/grub.cfg      It's all looking good so far. When I rebooted into rEFIt, I could see the EFI GRUB menu entry in rEFIt and I was able to start it. Since I hadn't configured anything, I wasn't able to see anything, but I could have entered GRUB commands if I wanted to. I then tried defining my GRUB config file like this:               menuentry "Linux (BIOS)" {         search --file --no-floppy --set=root /vmlinuz         loadbios /boot/vbios.bin /boot/int10.bin         linux /vmlinuz root=/dev/sda4 video=efifb         initrd /initrd.img     }          menuentry "Linux (BIOS + Fix Video)" {         search --file --no-floppy --set=root /vmlinuz         fix_video         loadbios /boot/vbios.bin /boot/int10.bin         linux /vmlinuz root=/dev/sda4 video=efifb         initrd /initrd.img     }          menuentry "Linux (No BIOS)" {         search --file --no-floppy --set=root /vmlinuz         fakebios         linux /vmlinuz root=/dev/sda4 video=efifb         initrd /initrd.img     }      Then, when I booted into GRUB from rEFIt, I could definitely see these menu entries. The problem is that each one yielded a message like this:               error: file not found      I assume that this refers to the fact that it can't find `/vmlinuz`, `/boot/*`, and `/initrd.img`, since they're not present in the EFI partition. Where do I get these files from and how can I copy them to the EFI partition to get booting working? Additionally, how do I specify which kernel to load? Will this GRUB loader just load my main `/dev/sda4` GRUB menu after EFI has booted?


title: Combine input from multiple files/pipes without clobbering lines or blocking?

text: Is there a tool that will take input from multiple files or pipes and write it to stdout, without blocking on reads, such that individual input lines come out intact? I basically want to multiplex a bunch of inputs onto one output without clobbering lines.               $ combine file1 <(prog2) ... > nice-output.txt        1. I don't care about the order of the output   2. It should not block as long as some input has data   3. It should be efficient (i.e., I may downvote your Perl one-liner ;)


title: gvim -p limit of opened tabs?

text: When I run :               gvim -p *.xyz      I find that not all files are opened in tabs. It feels, like a kind of tab limit? But ! When I try to open unopened with :               :tabnew      it is opened next to previous tabs - it works ! How to make `gvim -p ...` to open all files without need of opening those above limit manually with `:tabnew` ? Btw. Is this limit somewhere written ? Possible to be configured?


title: FreeBSD: How to install Django with mod_wsgi?

text: Using FreeBSD 8.2-RELEASE. I want to mess around with Django and I want a working setup on my freebsd system. My understanding is I need to install python, apache, mod_wsgi, and django. The handbook section on Django talks about mod_python not mod_wsgi and I believe mod_wsgi is the recommended method. I have the following installed on my system already from packages:               apache-2.2.17_1      python26-2.6.6       What do I have to do get django working with apache? Any tutorials?


title: Running 32 bit app on a 64 bit Linux machine

text: Are there any performance drawbacks (CPU, Memory or IO) when running a 32-bit application on a 64-bit Linux? My main concern is inefficient utilization of pointers and memory blocks.


title: How to boot Debian into text mode without using GUI?

text: How can I boot Debian into text mode? My mouse and keyboard are working in GRUB, but when the login screen appears they don't, so I can't do anything.


title: Bactrack5 + VMWare + GNOME Fail

text: When I attempt to run any of the preinstalled GUI apps with `startx` it fails to run and terminates with the output `failed to load module "vmwgfx" (module does not exist, 0)"` Followed by `...xterm...` several times. Sorry I do not have the full output handy to copy and paste here. Apparently the GNOME GUI isn't going to run out-of-the-box here, and a VMWare tools installation is needed. So as I'm waiting on the next image to download, in a lengthy process of trial and error, installation, and VMWare tools patches, **can someone suggest whichconfiguration is most likely to succeed in running `gedit` with the least amount of hassle?** I have a Windows 7 64-bit host running Backtrack 5 RX with VMWare Workstation 9. Is there any reason one of either GNOME or KDE might be more compatible than the other with a VMWare + Backtrack?


title: Binding a particular IP to a port in apache2

text: In How to set-up a online SVN server on my laptop I asked to give access to my SVN server installed on my laptop to some of my friends siting in another part of country.I set-up a SVN server.I was able to access it locally but my friend wasn't. So i searched on Google and get to conclusion that i have to bind port 80 to my public IP so that when ever any request come to my public IP , it is redirected to port 80 which in turn is used by process apache2.(This is what i understand after search, kindly correct me if i am wrong.) But when I did port binding following a link I got following error when I restart my apache2 server.               service apache2 restart       * Restarting web server apache2                                                                          [Mon May 20 13:44:25 2013] [warn] NameVirtualHost *:80 has no VirtualHosts     [Mon May 20 13:44:25 2013] [warn] NameVirtualHost *:80 has no VirtualHosts     (99)Cannot assign requested address: make_sock: could not bind to address xyz.pqr.ad.ef:8010     no listening sockets available, shutting down     Unable to open logs     Action 'start' failed.     The Apache error log may have more information.      where xyz.pqr.ad.ef is my public IP and I added one more port 8010. Need help to resolve this error and get my SVN repo online for some specific users.


title: Accessing multiple wifi networks simultaneously from debian wheezy

text: I have got 2 wireless adapters on my machine (one built-in and the other a purchased USB wireless adapter) is there a way I can utilize different WiFi networks simultaneously? I have in mind something like having 2 workspaces on gnome3 each connected to a separate network or something similar to that.


title: Configuring Touchpad/Trackball for X

text: I have just installed my gentoo with X11/Gnome. It works fine with the USB- Mouse, but neither the touchpad nor the trackpoint works. The docs I found seemed to be outdated and were not mentioning the `/etc/X11/xorg.conf.d`. The laptop I am using is an Lenovo Thinkpad Edge E320. `synaptics` is in the `USE` and the driver is installed.


title: How to build a long command string?

text: I've a sequence of commands to be used along with lot of pipings, something like this:               awk '{ if ($8 ~ "isad") {print $2, $5, "SE"} else {print $2, $5, "ANT"} }' "/var/log/apache2/other_vhosts_access.log" | grep -v '127.0.0.1' | tr '[' '\0' | tr [:lower:] [:upper:] | sort -t' ' -s -k3      This basically filters the Apache log and prints three cols of info. First col is IP address, second is time, third is a string. The output could be sorted based on any column so, I need to use '-m' with sort for the time field. Sorting order could also be reversed. I want a string to store the arguments to sort, and let the combined strings get executed. Something like this:               $AWK_CMD | $SORT_CMD $SORT_KEY $SORT_REV      where               SORT_CMD="sort -t' '"     SORT_KEY="-k$1"      # $1 from cmd line arg     SORT_REV="$2"        # Either -r or blank      Am able to build such strings; when I echo it, it looks fine. Problem is, how to execute it? I get some errors like:               awk '{ if ($8 ~ "isad") {print $2, $5, "SE"} else {print $2, $5, "ANT"} }' "/var/log/apache2/other_vhosts_access.log" | grep -v '127.0.0.1' | tr '[' '\0' | tr [:lower:] [:upper:] | sort -t' ' -s -k3     Running ...     awk: '{     awk: ^ invalid char ''' in expression      Please ignore if 'sort' doesn't sort properly, that can be fixed. I wish to know how I can build the final command string in steps. The ways I tried to execute this command in the script is by:               $final_cmd     `$final_cmd`      Edit: The script that I'm trying to use               KEY=$1      # Values {1, 2, 3}     REVERSE=$2  # Values {0, 1}           SORT_CMD="sort -t' ' -s"     SORT_KEY="-k$KEY"     if [[ $KEY -eq 2 ]]     then         SORT_KEY="-m -k2"     fi          if [[ $REVERSE -eq 1 ]]     then         SORT_REV="-r"     else         SORT_REV=     fi          final_cmd="awk '{ if (\$8 ~ \"isad\") {print \$2, \$5, \"SE\"} else {print \$2, \$5, \"ANT\"} }' $LOG_FILE '|' grep -v '127.0.0.1' '|' tr '[' '\0' '|' tr [:lower:] [:upper:] '|' $SORT_CMD $SORT_KEY $SORT_REV"          echo $final_cmd     echo "Running ..."     $final_cmd


title: Edid information

text: I want to gather the Edid information of the monitor. I can get it from the `xorg.0.log` file when I run `X` with the `-logverbose` option. But the problem is that If I switch the monitor (unplug the current monitor and then plug-in another monitor), then there is no way to get this information. Is there any way to get the EDID dynamically (at runtime)? Or any utility/tool which will inform me as soon as monitor is connected and disconnected? I am using the LFS-6.4.


title: 7z command line add file to a flat directory 7z file

text: I would like to compress file "./data/x.txt" to path "./data/x.7z". When running               7z a ./data/x.txt.7z ./data/x.txt      The file "./data/x.txt" holds               data/x.txt      as opposed to just (what I want)               x.txt      However, I would like 7z to ignore the path "./data" directory inside of the x.7z file. To clarify, I would like 7z to flatten the directory structure in the 7z file when adding x.txt. Is this possible?


title: RPMDB broke after a yum update in fedora 19?

text: A `sudo yum update` operation got interrupted and after a `yum-complete- transaction` was tried again I got this message: > Transaction check error: file /usr/libexec/sssd/sssd_pac from install of > sssd-ipa-1.11.0-1.fc19.x86_64 conflicts with file from package sssd- > ad-1.11.0-0.2.beta2.fc19.x86_64 Does anyone know how to solve this problem?


title: Create MySQL database name using variable from date

text: for the variable               dbnya="echo $(date +%Y%m%d%H%M%S)"      When running below code, I will get an error (SQL syntax error)               mysql -u root -pthepass -e "CREATE DATABASE demo$dbnya CHARACTER SET utf8 COLLATE utf8_bin"      The second command will work if I'm using `dbnya=20120423230524` as first command


title: For each subfolder, sort files by name and rename them to sequential padded numbers (regardless of extension)

text: I have the following directory structure:               .     ├── event-a     │   ├── album-a     │   │   ├── a.jpg     │   │   └── x.png     │   └── album-b     │       ├── a.jpg     │       ├── x.png     │       └── y.gif     └── event-b         ├── album-x         │   ├── a.jpg         │   └── x.png         └── album-y             ├── a.jpg             ├── x.png             └── y.gif      For each second-level subfolder (named `album-foo` in the example), I want to sort the files by name and rename them to sequential padded numbers, regardless of their extension. The folders may contain JPG, PNG or GIF images, and any file extensions should be preserved. So, in this case, I’d like to get this result:               .     ├── event-a     │   ├── album-a     │   │   ├── 01.jpg     │   │   └── 02.png     │   └── album-b     │       ├── 01.jpg     │       ├── 02.png     │       └── 03.gif     └── event-b         ├── album-x         │   ├── 01.jpg         │   └── 02.png         └── album-y             ├── 01.jpg             ├── 02.png             └── 03.gif      The `rename` utility may be used if that makes anything easier. The main problem is getting figuring out the number each file should get. Do I need to use a nested `for` loop to iterate over the `event-x` and `album-x` subfolders, then for each inner loop, keep track of the number myself, or is there some clever solution that I’m missing?


title: VirtualBox: two network interfaces (NAT and host-only ones) in a Debian guest on Ubuntu

text: I created a Debian VM on VirtualBox with two interfaces: a NAT one (for accessing internet) and a host-only one. However, I do not know how to make both interfaces work at the same time. If I the define the host-only as the adapter 1, I can access my VM from the host but not the internet; if I define the NAT one as adapter 1, I can access the internet but cannot reach my guest Debian. So, how could I make both interfaces work together? **Note** : I am still trying to map some port from my host to the SSH port from my guest SO, so there is no need to suggest me to do it :) **EDIT** : This is the output of `ifconfig` when the first adapter is the **host-only** one:               eth0      Link encap:Ethernet  HWaddr 08:00:27:f6:b2:45                 inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fef6:b245/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:495 errors:0 dropped:0 overruns:0 frame:0               TX packets:206 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:48187 (47.0 KiB)  TX bytes:38222 (37.3 KiB)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:8 errors:0 dropped:0 overruns:0 frame:0               TX packets:8 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)      This is the output of `netstat -nr` when the first adapter is the **host- only** one:               Kernel IP routing table     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     192.168.56.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0      This is the output of `ifconfig` when the first adapter is the **NAT** one:               eth0      Link encap:Ethernet  HWaddr 08:00:27:f6:b2:45                 inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fef6:b245/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:53 errors:0 dropped:0 overruns:0 frame:0               TX packets:59 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:6076 (5.9 KiB)  TX bytes:5526 (5.3 KiB)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:16 errors:0 dropped:0 overruns:0 frame:0               TX packets:16 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:1664 (1.6 KiB)  TX bytes:1664 (1.6 KiB)      This is the output of `netstat -nr` when the first adapter is the **NAT** one:               Kernel IP routing table     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     10.0.2.0        0.0.0.0         255.255.255.0   U         0 0          0 eth0     0.0.0.0         10.0.2.2        0.0.0.0         UG        0 0          0 eth0


title: How can I autostart GDM on Fedora 15?

text: I am trying to load Compiz on my _Fedora 15_ desktop. When I finished installing the compiz packages, I restarted. However, it started in text terminal mode and the gui didn't load automatically. I executed following commands externally to load my gui (in root mode):               cd /etc/dconf/db     exec gdm      Though that is working perfectly, I want to load the GUI automatically.


title: Can't boot truecrypt's rescue.iso on usb using UNetBootin

text: I tried Unetbootin to put the `truecrypt rescue.iso` file on a USB stick, but the USB stick does not boot properly. It gets into an infinite loop with boot default in 10 seconds over and over again. The default setting is: `/ubnkern initrd=/ubninit`.


title: Why does the adduser command behave surprisingly?

text: I see various examples of how to add a user on Ubuntu server I have Ubuntu 10.04.2 LTS I was logged in as root and, when running `adduser`, my SSH command line asked me for both a 'new password' AND then a 'new UNIX password'. I was not quite sure what the difference is and wondering why it ask for two types of password. Why does the `adduser` command behave surprisingly and how do I go about investigating how and why it veers from the default Ubuntu behaviour?               --------     # adduser joe     Adding user `joe' ...     Adding new group `joe' (1007) ...     Adding new user `joe' (1003) with group `joe' ...     Creating home directory `/home/joe' ...     Copying files from `/etc/skel' ...     Enter new password:     Retype new password:     Enter new UNIX password:     ------      **Update:** Since gaining a better understanding of the issue from feedback from mattdm and AlexD, I have modified this question from its original form which was: "What's the difference between 'new UNIX password' and 'new password' on linux, when adding new user?"


title: How to change login screen size, Linux Mint

text: So I have been using linux mint for a little bit now. One thing that really bugs me is that the login screen size is always really small. I have used `xrandr --output VGA1 --primary 1600x900` to set to to the right size until the next reboot but is there a better way?


title: How to start a graphical session in Backtrack Linux

text: I just started looking at backtrack(i'm on a linux testing streak) and when I start it up I don't see a desktop. Help?


title: Remove oldest folders + files (50GB) from a folder when share/HD reaches 95% full capacity

text: I have a big share (~5TB) that is getting full. Now I want to make a script that deletes data from 2 specified folders. But this need to be the oldest files/folders and it need to stop when ~50GB has been removed, so it won't delete all folders. **Edit:** This need to work with Samba shares for my Synology DS-409. The script need to run on the Synology in /etc/crontab. Somewhere else they gave me this code:                   #!/opt/bin/bash     dir=/data/video     min_dirs=3     full=60     logfile=/var/tmp/removed.log          df=`df | grep data | awk '{print $5}' | sed s/%//g`     if [ $df -gt $full ]; then        [[ $(find "$dir" -type d | wc -l) -ge $min_dirs ]] &&        IFS= read -r -d $'\0' line < <(find "$dir" -printf '%T@ %p\0' 2>/dev/null | sort -z -n)        file="${line#* }"        ls -lLd "$file"        #rm -rf "$file"        date=`date`        if [ -f "$file" ]; then           echo "$date $file could not be removed!" >> $logfile        else           echo "$date $file removed" >> $logfile        fi        fi


title: Cannot connect to my Virtual Box Ubuntu system

text: I have a VirtualBox running an Ubuntu OS. I'd like to access this Ubuntu machine using `ssh` or `telnet`. In order to do that I've performed the following steps:   1. `sudo apt-get install telnetd`   2. `sudo /etc/init.d/openbsd-inetd restart` Then I tried to access this system using telnet from another machine but unfortunately the connection become timed out:               # telnet 10.125.31.176     Trying 10.125.31.176...     telnet: connect to address 10.125.31.176: Connection timed out     telnet: Unable to connect to remote host: Connection timed out      **Also I'd like to mention that I could easily ping this machine (both ways)** :               # ping 10.125.31.176     PING 10.125.31.176 (10.125.31.176) 56(84) bytes of data.     64 bytes from 10.125.31.176: icmp_seq=1 ttl=57 time=2.34 ms     64 bytes from 10.125.31.176: icmp_seq=2 ttl=57 time=1.81 ms      **EDIT** : I have also performed the open ports scan and it seems ok:               $ sudo nmap -p 20-2550 localhost           Starting Nmap 5.00 ( http://nmap.org ) at 2012-06-11 15:31 IDT     Warning: Hostname localhost resolves to 2 IPs. Using 127.0.0.1.     Interesting ports on localhost (127.0.0.1):     Not shown: 2526 closed ports     PORT    STATE SERVICE     22/tcp  open  ssh     23/tcp  open  telnet     25/tcp  open  smtp     587/tcp open  submission     631/tcp open  ipp          Nmap done: 1 IP address (1 host up) scanned in 1.54 seconds      **EDIT2** : _ifconfig from the VirtualBox Ubuntu_ :               eth0      Link encap:Ethernet  HWaddr 08:00:27:0d:43:7d                 inet addr:10.125.31.176  Bcast:10.125.31.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fe0d:437d/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:9247631 errors:0 dropped:0 overruns:0 frame:0               TX packets:10147 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:3145994247 (3.1 GB)  TX bytes:727714 (727.7 KB)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:30446 errors:0 dropped:0 overruns:0 frame:0               TX packets:30446 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:1280714 (1.2 MB)  TX bytes:1280714 (1.2 MB)      _Windows IP Configuration_               Ethernet adapter Local Area Connection:              Connection-specific DNS Suffix  . : xxx.com         IP Address. . . . . . . . . . . . : 10.125.31.170         Subnet Mask . . . . . . . . . . . : 255.255.255.0         Default Gateway . . . . . . . . . : 10.125.31.1          Ethernet adapter VirtualBox Host-Only Network:              Connection-specific DNS Suffix  . :         IP Address. . . . . . . . . . . . : 192.168.56.1         Subnet Mask . . . . . . . . . . . : 255.255.255.0         Default Gateway . . . . . . . . . :      Any ideas?


title: Trouble migrating from Yum to apt-get

text: I recently migrated from using Fedora to Debian. And I'm having some issues with the package manager. I used to be able to search for packages via yum using : `yum search <part_of_package_name_or_description>` Also while installing simple software such as VLC media player. I get the following when I try to run: `sudo apt-get install vlc`               Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:      vlc : Depends: fonts-freefont-ttf but it is not installable            Depends: vlc-nox (= 1:2.0.3-dmo1) but it is not going to be installed            Depends: libavcodec54 (>= 7:0.11.1) but it is not going to be installed            Depends: libavutil51 (>= 7:0.11.1) but it is not going to be installed            Depends: libqtcore4 (>= 4:4.8.0) but it is not going to be installed            Depends: libqtgui4 (>= 4:4.7.0~beta1) but it is not going to be installed            Depends: libstdc++6 (>= 4.6) but 4.4.5-8 is to be installed            Depends: libtar0 but it is not installable            Depends: libva-x11-1 (> 1.0.15~) but it is not going to be installed            Depends: libva1 (> 1.0.15~) but it is not going to be installed            Depends: libxcb-keysyms1 (>= 0.3.9) but it is not going to be installed            Recommends: vlc-plugin-notify (= 1:2.0.3-dmo1) but it is not going to be installed            Recommends: vlc-plugin-pulse (= 1:2.0.3-dmo1) but it is not going to be installed     E: Broken packages           Can someone tell me what I should do to search for packages via command line like yum search? And do I **_really_** have to install the dependencies manully in debian? Or am I missing something here? (Incorrect/incompatible repos perhaps?) I know I sound like a n00b but I don't see any aparent reason why apt-get isn't installing the dependencies on it's own. * * * /etc/apt/sources.list               deb http://http.us.debian.org/debian/ squeeze contrib non-free main     deb-src http://http.us.debian.org/debian/ squeeze main          deb http://security.debian.org/ squeeze/updates main     deb-src http://http.us.debian.org/debian/ squeeze/updates main          # squeeze-updates, previously known as 'volatile'     deb http://mirror.cse.iitk.ac.in/debian/ squeeze-updates main     deb-src http://mirror.cse.iitk.ac.in/debian/ squeeze-updates main     deb http://www.deb-multimedia.org squeeze main non-free     deb http://packages.dotdeb.org squeeze all     deb-src http://packages.dotdeb.org squeeze all     deb ftp://ftp.deb-multimedia.org squeeze main non-free     deb http://www.deb-multimedia.org wheezy main non-free     deb http://www.deb-multimedia.org sid main non-free     deb http://www.deb-multimedia.org squeeze main non-free     # deb http://www.deb-multimedia.org squeeze-backports main     # deb http://www.deb-multimedia.org experimental main           * * * Basic Install requirements right now are   * Firefox (not the IceWeasel derivative)   * VLC   * Gnome3 Desktop environment.   * Improving visuals/graphic display quality. (Gnome 3 should help with that too right?) * * * I migrated from Fedora to Debian simply because Fedora's repositories were causing trouble (outdated software etc.) But if Debian is going to be this challenging throughtout I might as well give up. :(


title: What is resume= used for in my grub boot settings?

text: I've always noticed the `resume=/dev/foo` entry in /boot/grub/menu.lst, and that it corresponds to the swap partition, but I've never questioned its use.               title SUSE Linux Enterprise Server 11 SP2 - 3.0.13-0.27 (default)         root (hd0,0)         kernel /boot/vmlinuz-3.0.13-0.27-default root=/dev/sda1 insmod=qla4xxx resume=/dev/sda2 crashkernel=256M-:128M showopts         initrd /boot/initrd-3.0.13-0.27-default      I was rebooting a server this morning and saw a boot message stating `Starting manual resume from disk`. Sounds like some sort of hibernate. So what exactly is resume? I'm trying to Google it, but all I'm seeing is resumes/CVs for Linux Admins :).


title: Strange behavior automating with "make -f"

text: I have a set of directories, some of which contain makefiles, and some of the makefiles have `clean` targets. In the parent directory, I have a simple script:               #!/bin/bash          for f in *; do             if [[ -d $f && -f $f/makefile ]]; then                     echo "Making clean in $f..."                     make -f $f/makefile clean             fi     done      This does a weird thing when it hits a directory with a makefile without a (defined) "clean" target. For example, given two directories, `one` and `two`, containing; **one/makefile**               clean:             -rm *.x      **two/makefile**               clean:      In the second case "clean" is present without directives, so if you ran "make clean" in `two` you'd get:               make: Nothing to be done for `clean'.      Versus if there were no "clean":               make: *** No rule to make target `clean'.  Stop.      However, for the problem I'm about to describe, the result is the same whether the target is present but undefined or just not present. Running `clean.sh` from the parent directory;               Making clean in one...     rm *.x     rm: cannot remove `*.x': No such file or directory     make: [clean] Error 1 (ignored)      So `one` did not need cleaning. No big deal, this is as expected. But then:               Making clean in two...     cat clean.sh >clean      chmod a+x clean      Why the `cat clean.sh>clean` etc.? Note I did create a minimal example exactly as shown above -- there are no other files or directories around (just clean.sh, directories one & two, and the very minimal makefiles). But after clean.sh runs, `make` has copied `clean.sh > clean` and made it executable. If I then run clean.sh again:               Making clean in one...     make: `clean' is up to date.     Making clean in two...     make: `clean' is up to date.     Press any key to continue...      Something even weirder, because now it is not using the specified makefiles at all -- it's using some "up to date" mystery target. I've noticed a perhaps related phenomenon: if remove one of the test clauses in clean.sh like this:               #       if [[ -d $f && -f $f/makefile ]]; then             if [[ -d $f ]]; then      And create a directory `three` with no makefile, part of the output includes:               Making clean in three...     make: three/makefile: No such file or directory     make: *** No rule to make target `three/makefile'.  Stop.      That there is no such file or directory I understand, but why does `make` then go on to look for a target with that name? The man page seems pretty straightforward: > -f file, --file=file, --makefile=FILE >   >   >       Use file as a makefile. >


title: Cloning a bootable USB stick to a different-sized stick

text: HARDWARE: 2 8GB USB flash drives   DISTRO: Mint 9 Xfce persistent Live Cd One USB flash drive has two partitions:   1) FAT32 700MB Mint 9 partition   2) ext3 7.3GB `casper-rw` partition GOAL:   I want to make a duplicate of that USB flash drive because I don't want to go through the time of installing and configuring from scratch again. EXPERIENCE:   1) I have found that `dd` does not work for this job because if one of my flash drives is even 1MB different in size, which sometimes they are, then the copy gets corrupted. 2) I have found that using `gparted` and preformatting the second drive like the first and then `rsync`'ing each partition individually does not work because for some reason some files do not get copied and the drive remains unbootable. I want to keep my working stick and just make copies of it and configure the sticks for my friends. This way if I goof up another stick I will always have my base stick just sitting around waiting.


title: _path_files and compadd ignore-files parameter

text: What is the format for the -F option of `_path_files` and `compadd`? I'm passing several directories to `_path_files`:               _path_files -W "($base_directories)" -/      But some of those directory trees I don't want to complete for this particular command. The documentation I can find for `_path_files` says it accepts a `-F` option-- just like `compadd`, but I can't find the format to pass them in. Twiddling around hasn't been very fruitful either. I've tried, for example,               _path_files -W "($base_directories)" -/ -F shared; # shared still shows up     _path_files -W "($base_directories)" -/ -F "(shared)"; # barfs on that guy


title: Increase font size in rxvt-unicode without editing ~/.Xdefaults

text: I am a loyal Linux fan who has been spending a lot of time using iTerm on a mac lately. One thing I _really_ like about the mac, and iTerm in particular, is the ability to use a keyboard shortcut to in/decrease the font size. I believe it's apple+ and apple- to do this. AFAIK this is also possible using gnome-terminal and possibly konqueror. However, I am an rxvt-unicode user. Period. I'm not willing to switch my terminal, but I would like to be able to have the ability to quickly resize the font. Currently, to resize the font I have to do this:   1. Detach tmux   2. $EDITOR ~/.Xdefaults   3. xrdb -all ~/.Xdefaults   4. close terminal   5. open a new terminal   6. Reattach tmux I'm thinking that it must be possible to script something that would reduce the above steps to one by perhaps binding to a keyboard shortcut, maybe with xbindkeys or something similar. Anyone have any thoughts on how this might best be accomplished? Note: I'm using awesome window manager and prefer to keep things ultra-simple (i.e., no Gnome/KDE-specific solutions, please). @Keith: I don't have enough rep to leave a comment, so an edit will have to do. I am familiar with the escape sequences and it's my fault for not saying so explicitly in my original question, but: I'm looking for a solution that will persist between sessions. Likely that will involve writing some code.


title: "Couldn't resolve host" when installing/updating yum packages

text: Whenever I try to install or update a package using `yum`, after it updates its DB these messages are shown:               Loaded plugins: langpacks, presto, refresh-packagekit, tidy-cache google64          http://download.fedora.redhat.com/pub/epel/6/i386/repodata/repomd.xml:     [Errno 14] curl#6 - "Couldn't resolve host" Trying other mirror.           http://download.fedora.redhat.com/pub/epel/6/i386/repodata/repomd.xml:     [Errno 14] curl#6 - "Couldn't resolve host" Trying other mirror.          Error: failure: repodata/repomd.xml from mypck: [Errno 256] No more mirrors to try.      I'm running Linux 3.4.3. What could be causing this problem? How do I fix it?


title: update mysql on debian

text: I'm trying to update Mysql on debian without success, and all tutorial on internet just fails.   I got Debian 6.0.6 squeeze, my mysql version is `mysql Ver 14.14 Distrib 5.1.63`.   I did `apt-get update` and `apt-get upgrade` it says that nothing is to upgrade.   So I downloaded the last version `wget --content-disposition http://www.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.28-debian6.0-x86_64.deb/from/http://cdn.mysql.com/` and installed it               # dpkg -i mysql-5.5.28-debian6.0-x86_64.deb      (Reading database ... 41264 files and directories currently installed.)     Preparing to replace mysql 5.5.28 (using mysql-5.5.28-debian6.0-x86_64.deb) ...     Unpacking replacement mysql ...     Setting up mysql (5.5.28) ...      And... Nothing... I deleted the previous package `apt-get --purge remove mysql-server` then reinstalled it like above, same message, and nothing was installed. when I do `mysql -V` I have `version mysql Ver 14.14 Distrib 5.1.63, for debian-linux-gnu (x86_64) using readline 6.1` and when I do `dpkg -l mysql` I get version `5.5.28`... on phpinfo I got `5.1.63` Is there a step missing to do this installation ? Thank you very much


title: Backup of local folder to multiple removable disks

text: I have a server running Debian 7.3, with two RAID1 disks as system/data disks. I also have a removable SATA bay, where I have a backup disk. I have a few different backup disks, so I can swap disk when the backup is complete, and store that disk at some other place. If my house burns down, then I still have a backup. I want to backup a local folder `/data`, that contains subfolders for photos, music and movies. What is a good way to backup this data. Using `rsync`, a simple script, or maybe a different solution?


title: Resolving unmet installation dependencies; file system problems

text: Somehow part of my ext3 file system got corrupted and large portions of my python installation got all sorts of messed up. The only thing I could notice immediately was Python raising a missing module error. If I tried to cd to the relevant directories I got this:               EXT3-fs error (device mmcblk0p2): htree_dirblock_to_tree: bad entry in directory #444159: directory entry across blocks - offset=0, inode=166100, rec_len=59284, name_len=255     EXT3-fs error (device mmcblk0p2): htree_dirblock_to_tree: bad entry in directory #444137: rec_len % 4 != 0 - offset=0, inode=290535, rec_len=39605, name_len=253      So I decided to just rm -rf those directories and reinstall NumPy. Not so fast:               root@napajohn:/usr/lib/pyshared/python2.6/numpy-1.6.0# python setup.py     Running from numpy source directory.Traceback (most recent call last):       File "setup.py", line 196, in <module>         setup_package()       File "setup.py", line 173, in setup_package         from numpy.distutils.core import setup       File "/usr/lib/pyshared/python2.6/numpy-1.6.0/numpy/distutils/__init__.py", line 7, in <module>         import ccompiler       File "/usr/lib/pyshared/python2.6/numpy-1.6.0/numpy/distutils/ccompiler.py", line 7, in <module>         from distutils.ccompiler import *       File "/usr/lib/python2.6/distutils/__init__.py", line 1         d__2);             ^     SyntaxError: invalid syntax      What that error said was true. The file /usr/lib/python2.6/distutils/__init__.py started mid-expression, as if the top half of the file got chopped off. So I go and check to see if I have any other versions of Python installed with `pyversions -i`:                 File "/usr/lib/python2.6/ConfigParser.py", line 1         .i,         ^     SyntaxError: invalid syntax      What is happening to all my files? I realize this question could hardly be answered without extra information, but before I go that route let me switch contexts to my first alternative solution which naively assumes that nothing else besides python has been affected. First, a question: where is the "proper" place to install additional software, or more specifically, Python? I've been choosing /opt for most of my unzipping & installing of things I don't download through apt. Next, the problem:               root@napajohn:/opt/python/Python-2.7.3# ./configure     checking for --enable-universalsdk... no     checking for --with-universal-archs... 32-bit     checking MACHDEP... linux2     checking EXTRAPLATDIR...     checking machine type as reported by uname -m... armv7l     checking for --without-gcc... no     checking for gcc... no     checking for cc... no     checking for cl.exe... no     configure: error: in `/opt/python/Python-2.7.3':     configure: error: no acceptable C compiler found in $PATH     See `config.log' for more details      I don't have gcc?? Okay, whatever, I'll go install it. I run an update and then               root@napajohn:/opt/python/Python-2.7.3# apt-get install gcc-4.4     Reading package lists... Done     Building dependency tree     Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:      gcc-4.4 : Depends: gcc-4.4-base (= 4.4.5-8) but 4.4.5-8em1 is to be installed                Depends: cpp-4.4 (= 4.4.5-8) but 4.4.5-8em1 is to be installed                Recommends: libc6-dev (>= 2.5) but it is not going to be installed     E: Broken packages      But I have gcc-4.4-base and cpp-4.4!               root@napajohn:/opt/python/Python-2.7.3# apt-get install gcc-4.4-base     Reading package lists... Done     Building dependency tree     Reading state information... Done     gcc-4.4-base is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.     root@napajohn:/opt/python/Python-2.7.3# apt-get install cpp-4.4     Reading package lists... Done     Building dependency tree     Reading state information... Done     cpp-4.4 is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.      After doing some searching, I think this could potentially be caused by a release mismatch (terminology?). I'm not really sure where to go from here. Also there is the bigger question of whether the file problems are isolated to Python. Should I run an `fsck` disk check on the rootfs? How would I do this on an embedded device?               root@napajohn:/opt/python/Python-2.7.3# cat /etc/debian_version     6.0.4     root@napajohn:/opt/python/Python-2.7.3# df     Filesystem           1K-blocks      Used Available Use% Mounted on     tmpfs                   250876         0    250876   0% /lib/init/rw     udev                     10240       156     10084   2% /dev     tmpfs                   250876         0    250876   0% /dev/shm     rootfs                 7597856   1722208   5489688  24% /


title: Is there is tool similar to ShiftIt on OS X?

text: I'm looking for a keyboard controlled window sizing utility similar to ShiftIt on Mac OS X: https://github.com/fikovnik/ShiftIt


title: Have Samba "proxy" for another server?

text: This might be a weird question, but can you have Samba "proxy" for another server? IE if mount a share on `\\server1\someshare` the server transparently proxies it to `\\otherserver\randomshare`. Note that redirection will not work since `\\otherserver` is not directly accessible. The servers run Ubuntu Server 12.04. Is there any way to do this?


title: Need help with understanding output of ps -ef on linux

text: When I do ps -ef on my Linux box, I get: UID PID PPID C STIME TTY TIME CMD Please help me with meaning of C,TIME. is the TIME , the actual cpu time allocated to the process?


title: Trouble creating symbolic link

text: I installed a software on OpenSUSE. However, to open it one has to type               /usr/local/software/start_software      everytime. I tried creating a symbolic link using               sudo ln -s /usr/local/software/start_software sw_cmd      This created an icon 'sw_cmd' in Root which upon double clicking opens the software. The intention is to create an alias for the path. I am expecting to not have to type the whole every time I want to start the software. I want to create a command sw_cmd should open/start the software.


title: Installing linux to run off USB

text: I have copied a Gnome distro to a USB drive which boots fine on my Mac, I want to install this to another USB drive I have so I can take the USB drive and use it on any PC. I partitioned the USB drive to have a main partition and a swap section then assigned the swap section and an ext4 to the main section then installed the boot loader to the ext4 partition. It installed fine and the Mac bootloader sees it, but when it goes into the boot it just flashes a cursor in the top left and doesn't boot into Linux. How can I make the USB drive ready to have the installation put on it and use it as a standalone Linux build?


title: Somehow managed to mute mplayer and can't figure out how to restore sound

text: I was randomly/experimentally pressing buttons while playing a video with mplayer. Something I did caused the video to mute. I then exited the video and tried a different one, but that one was muted too. I didn't think that mplayer saved its settings across invocations, except for the settings in `.mplayer`, and I certainly did not save any settings in there, nor do I see anything in there now that could be causing this. vlc and xine both still have sound, so it appears this problem is specific to mplayer. Any idea what the problem is? Rebooting will most likely fix it, and I'll do this if there is no option, but I'd like to know what the problem is for future reference.


title: Only one file name allowed error

text: Sometimes I forget to do `sudo vim` and open files to which I don't have write permission. I saw this post and it was really helpful. When I did `:w !sudo tee %` it asked me for a password and then the options `(O)K` and `(L)OAD`. This worked fine. But when I did `:wq !sudo tee %`, `vim` gave me an error -               E172: Only one file name allowed      Why didn't it let me go to the prompt after `wq`. I don't understand this error.


title: How do I view executables run by a program?

text: Is there a way to view or get a list of executables that a program uses? A particular example is file-roller. Is there a way to see which executables it uses, if there is more than one executable it could use for the same task, e.g. unrar and p7zip-rar. The program 'ldd' can be used to view the libraries a programs uses, though not in real-time. Is there an equivalent for executables, preferably in real- time? Or some other method?


title: How to create file links on a vfat filesystem of a mounted disk under Linux?

text: I have an external drive containing different pieces of music. The drive is a vfat formatted drive to be able to work with arbitrary devices. On the device I have music stored from different artists sorted according to their name. However, I would like to sort the single music pieces into other folders as well, without duplicating them. So, for example, the title 'Addicted to you' should be accessible from within a folder 'Avicii' but also from a different folder named e.g. 'dance'. Is there a way I can create some kind of link on the disk? I have tried to do this with `ln` but got an error:               ln: failed to create symbolic link     ln: failed to create hard link      Is there another way to link those files? And to make sure it works with EVERY USB hardware (radio, TV, media set, car radio, ...)?


title: CTRL C behavior in hierarchy of shells

text: First of all sorry about terminology errors, I'd try to be clear. I open a shell (like `sbt` or `node debug` from my bash). Then inside this shell, I open another one (using `scala` or `node repl` respectively). Now I want to close the last shell and come back to the first one I opened (e.g. the `sbt`), but when I use `CTRL` \+ `C`, all shell hierarchy is being closed and I come back to the original bash terminal. As I learnt from here, this behavior is not standard and is undesirable for me. **EDIT:** I'm struggling this issue with `node debug`, so actually the issue isn't about `sbt` and `scala`.I used them to perform an experiment that shows a general nonstandard behavior of my bash. I found a similar issue with windows here, but I use Ubuntu 14.04


title: Sharing serial device

text: I'm running Ubuntu and I need to share a serial device (`/dev/ttyUSB0`) using `socat` or something like it. Here is my diagram:                                             /--</dev/ttyUSB01>--[Process A]     [serial device]-/dev/ttyUSB0--                                   \--</dev/ttyUSB02>--[Process B]      Both process A and B need to read-write, no problem about concurrency. How can I create a two "virtual" devices like `/dev/ttyUSB01` and `/dev/ttyUSB02`?


title: Using sed to replace a line with many special characters?

text: I am writing a rather massive script for a project and one of the issues I am running into before I can complete it is using the sed command. I am trying to find a line that has (located in cache.php):               $cache_directory = './cache';       and replace the information in `'./cache'` with a variable named `$new_cache_directory`. One of the problems I am running into is the `./cache` exists multiple times. I only want to replace that one line, but I also don't want to "hard code" the line number to "future proof" it. How can I do that?


title: Image (having text-and-numbers) to text-file matching [:alnum:] nicely with some Unix -tool?

text: Suppose a photograph with text and numbers. I want to manage it in my editor with tools such as grep, standard text-processing things such as Vim's block- highlighting and also more advanced things such as Gimp's magic-wand-style pattern highlighting. How? **Analysis** > This puzzle breaks down at least to parts > >   1. OCR -- character recognization >   2. DSP -- proximity -algos, all puzzles not yet known >   3. Ascii-art -- creating fillers and _"decorators"_ (not technical term) > > > For the sake of simplicity, suppose the writing is line-wise so you do not > need to consider reprocessing multiple-lined documents. There is some > working-prototype that does pretty good job in small scale with LaTex here, > the multiple lined problem follows later.


title: Does optimizing for size reduce runtime memory usage as well as binary size?

text: Does optimizing for size with `gcc -Os` _only_ reduce the binary size of a program, or does it reduce its runtime memory usage as well? I know what _exactly_ the results are depend on the specific code, but in general is the result a lower memory usage?


title: Execute a specific command in a given directory without cd'ing to it?

text: Is there a way to execute a command in a different directory without having to `cd` to it? I know that I could simply `cd` in and `cd` out, but I'm just interested in the possibilities of forgoing the extra steps :)


title: Nicely close windows in xmonad?

text: Normally if I close Chrome by clicking on the "X" button on the upper right (in window managers other than `xmonad`, obviously), if I later reopen Chrome then it shows me all my tabs again. However in `xmonad`, if I close Chrome with `mod+shift+c` and then reopen it my previous tabs are gone and I have to re-open them using the recently closed tabs menu. This indicates to me that Chrome is not getting closed in the same way as when I click on the "X" button. Since `xmonad` hides said "X" button, how can I close windows in the same way that I would if I clicked on the "X" button?


title: How to extract logs between two time stamps

text: I want to extract all logs between two timestamps. Some lines may not have the timestamp, but I want those lines also. In short, I want every line that falls under two time stamps. My log structure looks like:               [2014-04-07 23:59:58] CheckForCallAction [ERROR] Exception caught in +CheckForCallAction :: null     --Checking user--     Post     [2014-04-08 00:00:03] MobileAppRequestFilter [DEBUG] Action requested checkforcall      Suppose I want to extract everything bewteen '2014-04-07 23:00' and '2014-04-08 02:00'. Please note the start time stamp or end time stamp may not be there in the log, but I want every line between these two time stamps.


title: Delete First line of a file

text: How can I delete the first line of a file and keep the changes? I tried this but it erases the whole content of the file.               $sed 1d file.txt > file.txt


title: How to install Sun/Oracle Java 1.6 onto centOS 6 using only textmode?

text: So, after a few days of struggle I have yet to be successful in installing Sun/Oracle java 1.6 onto my CentOS. The issues seem to be as follows   * No sun java 1.6 package available in repo due to license issues   * The alternative is to download an rpm from the oracle site      * Problem with that is, I'm using text mode only, so I tried to use lynx.     * Problem with lynx is, Oracle demands you accept the license prior to download, but the facility with which it presents the license prompt(JavaScript) does not function within lynx. So, the question remains, how do I get java 1.6 (sun) onto my CentOS system using only textmode?


title: How can I check which radeon driver are installed?

text: I am currently installing fglrx on my machine by following this tutorial https://fedoraproject.org/wiki/Fglrx In the finishing touches section, it mentions that I need to blacklist any current radeon or radeonhd drivers so that fglrx will run. How can I explicitly check if such a step is needed? My laptop has an amd E-350 processor and HD 6130m graphics card.


title: To what extent does LXC manage configuring the network interface in a container?

text: In the LXC config file we can specify an IP address for a container:               lxc.network.type=veth     lxc.network.link=br0     lxc.network.ipv4 = 10.1.0.35/16     lxc.network.flags=up     lxc.network.hwaddr= 00:16:3e:24:26:33      But if the container has the default configuration of DHCP, what's going to happen:               # The primary network interface     auto eth0     iface eth0 inet dhcp        * Does LXC act as a DHCP server for the container?   * Will the two configurations conflict with the container broadcasting requests for an IP before/after LXC attempts to manually configure the interface?   * Will LXC simply override whatever is in the containers configuration for eth0?


title: Tsocks with mail user agent mailx not working

text: I use a SOCKS proxy server to send mail using `sendmail` in Linux and `mailx` to send mails from the command line. To make use of the SOCKS server, I am using `tsocks` to send mails using `mailx`, for example like this               tsocks mailx -s "Test mail" valid_mail_address@gmail.com      But the mails I send are not going through the proxy. I don't know what I do wrong. Any help please.


title: curl and grep commands output into a new variable

text: I am extracting information from a website. I designed the code in VBA and found that it is taking too long to execute. So, I have decided to rewrite the code in Unix script. I am extracting a page information using `curl` command as below.               page="$(curl http://www.somesitename.com/)"      Now, the variable `$page` contains the entire page contents in a HTML format. I am looking for a particular div class in the web page. I use the grep command as below.               output=$("$page"|grep "div class=\"my_class_name\"")      If I just use `echo "$page"|grep "div class=\"my_class_name\""` I get the contents of div in the echo statement. However, as above when am trying to save it in a variable and printing, I am getting the entire HTML page contents as output. I just need to check if the pattern `"div class=\"my_class_name\"` occurs in the page.


title: Back up mysql server

text: I want to backup all databases, users and etc on our mysql sever. I have come across the command `mysqldump` and believe I can use it like this? (Trying to backup a REMOTE server to our LOCAL machine)               mysqldump -h web-server.com -u root -p root --all-databases > "/backups/mysql/`date +%Y%m%d`.sql"      However:   1. I'm scared to run this with little knowledge of whats happening (we have a lot of data on the mysql database and we can't afford to lose it!). So first question is: Will this do what I want? Log into the remote server (located at `web-server.com` for example) and backup all the mysql databases to the path `/backups/mysql` on the LOCAL machine?   2. I'm not convinced that this will also keep all the user information for each database in tact in the event of a mysql server failure. Is user information just stored as another database in the mysql databases? Or is it a function of the server itself? In this case is there a different way I can backup the database to include the user data too?


title: How can I make bash more readable?

text: As a linux user, I spend a lot of time mucking about in bash. I've always been a bit frustrated by how poor the readability is. Today this annoyed me enough to spur me into action. My immediate problem was solved by this snippet, which changes the directories colour to magenta. (Annoyingly, this caused me to lose all the other `ls` colours.) So I started wondering, what other tweaks exists to make bash a bit more readable?


title: Adding to path vs. linking from /bin

text: Our sys admin installed a software (Maven) on the server, and told everyone to add the "/usr/local/maven/bin/" folder to their path. I think it could be more convenient to just link the few programs in that folder from the "/bin" folder (or other folder that everyone has in their path) like this:               ln -s /usr/local/maven/bin/* /bin      Is this correct? Are there some hidden side-effects to my suggestion?


title: Error: File contains parsing errors: file://///etc/yum.repos.d/dag.repo

text: I read you have to be careful with repo files for security with third party ones added. Anyway I have simply been trying to install `ffmpeg` and I am stuck because yum doesn't like what it is reading from the repo files and since I don't have a real understanding of what these files do I can't make logical sense of it. At first I followed Linux blog which suggested create one repo file in `/etc/yum.repos.d/` and named it `ffmpeg.repo` and placed the following script in it:               [ffmpeg]        name=FFmpeg RPM Repository for Red Hat Enterprise Linux        baseurl=http://apt.sw.be/redhat/el6/en/x86_64/dag/  (64 Bit OS)        #baseurl=http://apt.sw.be/redhat/el6/en/i386/dag/   (32 Bit OS)        gpgcheck=1        enabled=1      I couldn't get to work so went back to the file and removed empty spaces at beginning which at least enabled yum to output the error. Then I tried renaming `ffmpeg.repo` to `dag.repo` and added following:               [dag]     name=Dag RPM Repository for Red Hat Enterprise Linux     baseurl=http://apt.sw.be/redhat/el6/en/x86_64/dag/     gpgcheck=1     gpgkey=http://apt.sw.be/RPM-GPG-KEY.dag.txt     enabled=1     includepkgs=ffmpeg ffmpeg-* faac a52dec x264 opencore-amr lame librtmp    schroedinger libva dirac orc      Then created a `centos.repo` file in same directory as suggested by another LINUX blog and added the following:               [centos]     name=CentOS-6 – Base     baseurl=http://mirror.centos.org/centos/6/os/x86_64/     gpgcheck=1     gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6     enabled=1     priority=1     protect=1     includepkgs=SDL libtheora gsm libdc1394 libdrm liboil mesa-dri-drivers mesa-     dri1-drivers mesa-dri-filesystem libraw1394 libpciaccess cppunit      Anyway the error repeats itself and I cannot install `ffmpeg`.               bash-4.1# ls     CentOS-Base.repo       CentOS-Vault.repo  mirrors-rpmforge-extras     CentOS-Debuginfo.repo  ffmpeg.repo        mirrors-rpmforge-testing     CentOS-Media.repo      mirrors-rpmforge   rpmforge.repo          bash-4.1# yum update     Loaded plugins: fastestmirror     Repository 'ffmpeg': Error parsing config: Error parsing "baseurl =     'http://apt.sw.be/redhat/el6/en/x86_64/dag/  (64 Bit OS)'": URL must be http,    ftp, file or https not ""       Loading mirror speeds from cached hostfile       * rpmforge: mirror.ventraip.net.au      rpmforge                                                 | 1.9 kB     00:00            rpmforge/primary_db                                      | 2.8 MB         00:04            Setting up Update Process


title: Install packages satisfying dependencies only in Fedora 20

text: I have a large number of packages which I want to install in Fedora 20. How can I install packages satisfying dependencies only?( I'm not connected to internet while installing)


title: Manage papers offline on a linux system

text: Is there any smart way to manage scientific papers for offline use in a linux system. For example:   * It should be possible to tag papers with customizable tags, sort them by tags and so on   * if I see a new paper on arxiv.org and want to read it if I have more time, there should be a nice way to put it to my "read it later list" of my paper manager   * the paper manager should allow me to store bibtex data   * it should give an easy way to write down notes and comments to individual papers (supporting math-formulas)   * support pdf and djvu   * should be easy to backup I don't need any integration to word-processing software.


title: Openshot-1.3.0 not working on Fedora 14

text: I am trying to install openshot 1.3 from yesterday. After doing everything I could do and searching the whole web. I am finally asking this. I downloaded the source and installed it from there and then installed the mlt libs too ( but not sure whether I have python binding or not). finally I found this debug script and I dont know what to do with it. So will just give you the output of that debug file. Help will be appreciated.                $ sudo python debug.py     -----------------------------------------------------------     OpenShot Debug File 0.0.2 - 2011-04-17 18:29:42.730477     -----------------------------------------------------------     This file contains a list of installed packages related to OpenShot,     locations of files, and a list of shared libraries used by python-mlt.               -----------------------------------------------------------     Distribution Version Info     -----------------------------------------------------------     LSB Version:    :core-4.0-amd64:core-4.0-noarch     Distributor ID: Fedora     Description:    Fedora release 14 (Laughlin)     Release:    14     Codename:   Laughlin                    Traceback (most recent call last):       File "debug.py", line 45, in <module>         process = subprocess.Popen(["dpkg","-l","openshot", "libmlt1", "libmlt2", "python-mlt", "python-mlt2", "openshot-mlt"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)       File "/usr/lib64/python2.7/subprocess.py", line 672, in __init__         errread, errwrite)       File "/usr/lib64/python2.7/subprocess.py", line 1201, in _execute_child         raise child_exception     OSError: [Errno 2] No such file or directory      Also here it seems like it was searching in /use/lib64, but i found the file in /usr/lib/...so i copied the openshot folder from lib to /usr/lib64/python2.7/site-packages but to no avail. Well hope someone can help soon.


title: How to tell wget where to fetch files passed via '--input-file'

text: I have a list of filenames (not urls) in a file, and I want to download them using `--input-file` option. How do I specify the url where those files will be fetched from?


title: Grep - ^(\s*$) vs ^\s*$

text: I want to search for a field that only has spaces. When counting, this two commands gave me different results:               grep "^\s*$" -E -c     grep "^(\s*$)" -E -c      Another thing. What is the correct way to say "spaces only or other thing":               grep "^(\s*$|STRING)" -E -c      or               grep "(^\s*$|^STRING)" -E -c      Or they are equivalent?


title: Best compression of similar files?

text: I've got a few full old backups of things like binary database dumps. Obviously, they don't differ much so doing full backups is not the smartest idea here. For now, I'm looking for a compression program capable of taking an advantage from the fact, that most of the files have a similar content.


title: How to use rsync with a remote remote host

text: I am a happy user of `rsync -e ssh` and use it to synchronize data between my machine and a remote host using               rsync -avz -e ssh me@hostA:~/folder ~/folder      And this did what I needed until now. I am now working with a configuration where the access is a bit more complicated. Suppose now `~/folder` is on `hostB`, but `hostB` is not directly accessible from my machine, but only indirectly via `hostA`. So if I only want to see the folder on `hostB`. I first need to ssh to `hostA`, then to `hostB` after which I can see my files in `~/folder` on the remote host. My question now is, what is the (best) method to use `rsync` directly between my machine and `hostB`? Unfortunately this is the configuration I need to work with. Assume there is no possibility to temporarily store the data on `hostA` itself.


title: Any CLI to validate URL?

text: I got a bunch of URLs (more than 1,000) and I am wondering if there is any CLI script to validate URL for http schema?


title: Is there a JVM daemon?

text: I'm curious, is there a JVM which runs as an OS daemon, and forks when a new process should be started in it ( i.e. like init, or zygote process on Android )? If no, why not? I am not talking about a daemon thread within the JVM. The reason why I'm asking, is because the JVM startup time is quite slow, and incurs a heavy toll on scripting.


title: understanding Debian dpkg package version numbers

text: When I type `dpkg -l | grep xserver-xorg`, I get list of installed packages and their versions:               ii  xserver-xorg               1:7.7+3~deb7u1     ii  xserver-xorg-core          2:1.12.4-6     ii  xserver-xorg-input-evdev   1:2.7.0-1+b1     ii  xserver-xorg-input-kbd     1:1.6.1-1+b1     ii  xserver-xorg-input-mouse   1:1.7.2-3     ii  xserver-xorg-video-radeon  1:6.14.4-8      I am wondering what the number infront of the colon means, ie the number `2` in `2:1.12.4-6`


title: How to insert both vimscript variable and string into vim search and replace

text: I've only just found out about Vimscript's existence as of today, so forgive me if this question is more basic than it seems, but I've been struggling to find an answer to this question for the better part of a day. I'm working on a file in vim where I have to do a large number of repeated actions. For instance, my file looks something like this:                   firstname         secondname         thirdname         fourthname         fifthname         sixthname         ...      The list keeps going, and what I'd like to do is append a fixed string to the end of each line such that each line ends with an increasing number, i.e.:                   firstname = _first1         secondname = _first2         thirdname = _first3         fourthname = _first4         fifthname = _first5         sixthname = _first6         ...      I know that I could write a short bash script to resolve this issue, but I've been enticed by the prospect of using vimscript to do it all within vim, and that's a skill I'd like to acquire. Thus far I've worked out a function as such to run in vim's command mode:                   :let i=1 | g/name/s//\=i/ | let i=i+1      Which seems promising, as the result is most of the way to what I want:                   first1         second2         third3         fourth4         fifth5         sixth6         ...      But no matter how I've tried to modify it, I can't get it to print a string ( = _first) followed by the incremented number. For instance this...                   :let i=1 | g/name/s//name = _first\=i/ | let i=i+1      Produces this.                   firstname = _first=i         secondname = _first=i         thirdname = _first=i         fourthname = _first=i         fifthname = _first=i         sixthname = _first=i         ...      and this...                   :let i=1 | execute 'g/name/s//name = _first' . i . '/' | let i=i+1      Produces this.                   firstname = _first1         secondname = _first1         thirdname = _first1         fourthname = _first1         fifthname = _first1         sixthname = _first1         ...      I've tried other combinations, but at this point I'm pretty much stabbing in the dark. Everything I try seems to either get an incrementing variable with no string, or a string with a static variable. How could I do this with vimscript? Edit: I'm giving the correct answer to Ingo Karkat since it led directly to me finding how to resolve my issue. For posterity, here is the code I wound up using:                   :let i=1 | 1156,1271g/$/s//\=' = _first' . i/ | let i=i+1      producing:                   firstname = _first1         secondname = _first2         thirdname = _first3         fourthname = _first4         fifthname = _first5         sixthname = _first6         ...      The only minor differences in my code (project specific) were that it operated only on lines 1156 through 1271, and it appended to the end of the line without replacing any text.


title: Is it possible to show mathematical symbols in the terminal?

text: I want to do some program that can help me to check scientific formulars via terminal. It is possible or not if i want to show mathematical symbols (e.g. integral, diff Greek's Alphabets) on Linux's terminal. And if not what is the best way to represent the mathematical symbols when you working on terminal?


title: How to specify special characters in djvused bookmarks

text: 1. In djvused bookmark format, to disable characters that have special meaning in djvused bookmark format: The format of `djvused` bookmark of a djvu file is for example:              (bookmarks      ("1 first chapter" "#10"       ("1.1 first section" "#11"       ("1.1.1 first subsection" "#12" ))      ("1.2 second section" "#13" ))      ("2 second chapter" "#14"       ("2.1 first section" "#16" )      ("2.2 second section" "#13" ))     )      ...where the main points are the paring of left and right parenthesis for tree-like organization of sections and chapters, double quote for each bookmark item and each page number is preceded by a `#`. How can I escape characters like `"`, `(` and `)` to not be interpreted as control characters in the titles of chapters and sections? e.g. The following examples will not be accepted by `djvused`:              ("2.2 "Hello!" " "#13" )     ("2.2 f(g)" "#13" )      The command I use to embed bookmarks into a djvu file is `djvused in.djvu -e 'set-outline bmks' -s`, where `bmks` is the text file for bookmarks.   2. In djvused bookmark format, to enable characters that have special meaning in general text files: The character `\n` means new line. But if using it directly in djvu bookmark format, it will be shown as it is, not be interpreted as new line. For example:              (bookmarks      ("long title part 1 \n long title part 2" "#10"      )      The long title will not be broken into two lines where `\n` is specified.


title: how to monitor up time and down time of a linux service

text: How to monitor up time and down time of a linux service. I have created a service for my application using chkconfig (RHEL 6.3). I want monitor when the service is turned started and stopped. I can monitor the service by writing to log file while giving `service test start/stop` but this wouldn't catch my application if it crashed or abnormally terminated.


title: Rosewill RC-212 and Fedora 15

text: I recently bought a Rosewill RC-212 and configured it in the BIOS for RAID0. Windows 7 recognizes the array without any extra drivers and installed to it without problems. I installed Fedora 15 on a separate hard drive, however, it does NOT recognize the RAID array and instead shows them as separate hard drives with invalid header information. Has anyone tried Fedora and the RC-212 or can steer me in the right direction? Thanks!


title: Change owner of own directory

text: I am fully aware that a non-root user cannot change the owner of a folder to another user even if the user owns it unless they use `sudo` or have the `CAP_CHOWN` capability. Is there a way to grant a specific non-root user permissions to change the owner of a directory which it owns via `sudo` or some other command but not allow the user to arbitrarily change the owner of directories it does not own? I have a server (running as the non-root "myserver" user) and want it to be able to create specific directories for local users, and when its done with a directory change the owner of it to the desired user.


title: Installing a new distribution of Linux over a Ubuntu partition

text: I currently have a partition with Windows 7 and Ubuntu 12.04, and was wondering if it is possible to install Mint/Debian over Ubuntu? Any help would be much appreciated.


title: How to find the device in a RAID1 under Linux?

text: besides:               head -2 /dev/dm-16 | strings | grep ^id       how can I find that which device belongs to a given MD RAID1 array?


title: How to Change User Authentication Banner Message?

text: I have created a new user with -e option to make it active for just 30 days. This user do ssh tunnel using Bitvise SSH Client for Windows. When the user account has expired bitvise shows a User Authentication Banner says "Your account has expired, Please contact your system administrator".The bitvise log says "User authentication banner received from the server". So i think this message come from server side. How to change this message ? I am using debian 6. ![User Authentication Banner](http://i.stack.imgur.com/zEpWP.png)


title: Missing "Run in terminal" in KDE

text: I switched to KDE from Gnome after seven years using the latter. I have everything configured already but I'm missing one option: the **run in terminal** prompt, when executing a script double clicking. A script which does not need interaction is ok, for example:               #!/bin/bash     mkdir abc      on double click, it creates the folder abc as expected. However if the script runs a script that need a terminal, it won't work. For example I got the following script:               #!/bin/bash     cd /path/to/python/script/     python init.py      That python script need the user to input some numbers, however as the bash script wasn't run on a terminal, the python script won't show anything.


title: UNIX: how to change group of read-only file system

text: I am trying to change the group of a file that I (`user123`) am an owner of but I am getting an error. It won't let me change the directory permissions, either. It keeps saying the file system is read-only. I don't understand why it won't let me change permissions of a directory of which I am the owner!               (user123) @ subdomain.example.org [/dev/sudo/app/prog/id]     $ ls -la     total 3     drwxr-sr-x 2 user app 1024 Jun 18 11:12 etc          (user123) @ subdomain.example.org [/dev/sudo/app/prog/id]     $ chgrp mygroup etc/     chgrp: changing group of `etc/': Read-only file system


title: Can fstab options uid and gid be the user-group name or must they be numeric?

text: I'm learning how to set up a tmpfs in fstab for my www-data user and I was wondering if I can use the actual user/group name instead if the numeric ids (personal preference)? I'm on Debian with ext4, formatted with "msdos" during setup. It seems to be working, but I'm wondering if this is a Debian-specific feature or will it work across platforms (I like portability)? Here's what I've got:               $ vim /etc/fstab          # PHP temporary files.     tmpfs /tmpfs/php-session tmpfs defaults,size=512M,mode=1700,uid=www-data,gid=www-data,noexec,nodev,nosuid 0 0     tmpfs /tmpfs/php-upload  tmpfs defaults,size=256M,mode=1700,uid=www-data,gid=www-data,noexec,nodev,nosuid 0 0


title: SSH to server, execute commands and give control back to user

text: How can I do something like this with one ssh command:               echo << EOF     echo "Choose a file:" *     read f     rm -r "$f"     EOF | ssh user@host      I can use the `-tt` (yes _two_ t's) with ssh to make ssh read from stdin, however it doesn't seem to allow `read` to work. Is there a way of doing this?


title: Virtualbox: Find Windows host DNS name on Debian guest

text: I have a Debian Squeeze guest system running on a Windows 7 Professional host, a notebook computer. As a web developer, I need to mount my Windows project root folder into the Debian system. VirtualBox offers a shared folders function, however it does not recognize windows-style symlinks ("junctions"). So I decided to run a Samba client in my Debian system and mount the project folders from the virtual network (NAT). I do that by using this command in `/etc/rc.local`:               mount -t cifs //192.168.178.62/Projekte/workspace /media/smb_workspace -o "user=Bill,password=XXXXXXX,domain=LOCALDOMAINNAME",uid=33,gid=33,ex$      This works fine, but as the name of the host machine couldn't be resolved, I had to use it's IP address. When I'm in a different WIFI, the IP address changes and I have to change the mounting command. Obviously I'd prefer to enter the name of my Windows machine, like that:               mount -t cifs //NOTEBOOKNAME/Projekte/workspace /media/smb_workspace -o "user=Bill,password=XXXXXXX,domain=LOCALDOMAINNAME",uid=33,gid=33,ex$      I tried switching off my Windows firewall and the antivirus software, to no avail. The samba packages I installed on Debian are those, and apart from entering the workgroup information I left the configuration unchanged:   * **libwbclient0** Samba winbind client library    * **samba** SMB/CIFS file, print, and login server for Unix    * **samba-common** common files used by both the Samba server and client    * **samba-common-bin** common files used by both the Samba server and client So how can I get this to work? Any suggestions?


title: BC not handling scale = 0 correctly

text: I defined the cbrt function to return a cube root. I need to get an integer back (even if it is close to the cube root, it will be acceptable in my case). However, when I put the scale as 0 to get an integer, I get numbers which are grossly incorrect. What is going on and how do I get an integer cube root out?               bc -l     define cbrt(x) { return e(l(x)/3) }     scale=1;cbrt(1000000)     99.4     scale=0;cbrt(1000000)     54


title: Behavior of `du` command with `-L` flag

text: I've noticed a strange behavior with `du` command when it's used with `-L` command line option. I'm using Slackware 14 and Coreutils 8.19. To reproduce the strange behavior, create two folders:               mkdir foo     mkdir bar      Create a file inside one of the folder: `perl -e 'print "A"x10000' > foo/text` And a symlink in the other folder: `ln -s ../foo/text bar/text` Now, if you type: `du -h -L bar` You'll get: `16k bar` Since the symlink was dereferenced. But if you type: `du -h -L *` You'll get:               16K     foo     4.0K    bar      And the symlink will not be dereferenced. Am I missing something?


title: Using iptables to block for specific services

text: I am using ipset in conjunction with iptables to create a list of IPs I want to block. I did this:               ipset -N blocking iphash     ipset -A blocking 124.205.11.230     // and repeated this line for all IPs I want to add to "blocking" list      now I have to add this rule to iptables if I do this               iptables -A INPUT -m set --set blocking src -j DROP      the IPs will be blocked for everything SSH, FTP, etc. I want just to block them from using my email system dovecot, exim. how do I do that?


title: List packages coming from a specific Codename or Suite

text: I already know how to list every package from a given "origin", thanks to `aptitude` awesome search features:               aptitude search "?origin(My Backports)"      However, in the repository `Release` file, there is not only `Origin:`, but also `Codename:` and `Suite:`. For example, the current Debian Release file has:               Origin: Debian     Suite: stable     Codename: wheezy      **How can I search for those`Codename` and `Suite`?**


title: /etc files on a different partition

text: My setup requires that some of my `/etc` files reside on a separate partition. For this purpose I've created a softlink:               ls -li /etc/group     956 lrwxrwxrwx 1 root root 21 May  7 15:48 /etc/group -> /var/common/etc/group          ls -li /var/common/etc/group     3145744 -rw-r--r-- 1 root root 668 May 11 11:02 /var/common/etc/group      My problem is when I try to execute commands using these files:               groupadd foo     groupadd: failure while writing changes to /etc/group      `strace` reports:               rename("/etc/group+", "/var/common/etc/group") = -1 EXDEV (Invalid cross-device link)     write(2, "groupadd: failure while writing "..., 54groupadd: failure while writing changes to /etc/group     ) = 54      Any ideas how I can get `groupadd` to work?


title: Concatenate multiple files with same header

text: I have multiple files with the same header and different vectors below that. I need to concatenate all of them but I want only the header of first file to be concatenated and I don't want other headers to be concatenated since they are all same. for example: file1.txt               <header>INFO=<ID=DP,Number=1,Type=Integer>     <header>INFO=<ID=DP4,Number=4,Type=Integer>     A     B      C      file2.txt               <header>INFO=<ID=DP,Number=1,Type=Integer>     <header>INFO=<ID=DP4,Number=4,Type=Integer>     D     E      F      I need the output to be               <header>INFO=<ID=DP,Number=1,Type=Integer>     <header>INFO=<ID=DP4,Number=4,Type=Integer>     A     B     C     D     E      F      I could write a script in R but I need it in shell?


title: A command line utility to visualize how fast a file is growing?

text: I want to grok how fast a particular file is growing. I could do               watch ls -l file      And deduce this information from the rate of change. Is there something similar that would directly output the rate of growth of the file over time?


title: How to safely replace one Linux distribution with another one via SSH?

text: I'm intending to replace a NAS's Custom Linux with Arch Linux (details at the bottom), of course wishing to preserve all user data and (due to the SSH-only headless access) attempting to be fool-proof since a mistake may require firmware reinstallation (or even brick the device). So instead of running the installation (downloading the appropriate Arch Linux ARM release and probably using the chroot into LiveCD approach) without appropriate preparations, what must I keep in mind? (Please feel free to answer without restriction to Arch Linux) More precisely: >   * Do I somehow have to bother with figuring out how a specific device's > boot process works (e.g. which parts of the bootloader reside on the flash > memory and which ones are on the harddisk) or can I rely on the > distribution's installer to handle this correctly? >   * How can I determine whether some (possibly proprietary) drivers are used > and how can I migrate them into the new setup? >   * Is the RAID configuration safe from accidental deletion? >   * Is there a way to fake the booting process so I can check for correct > installation while the original system remains accessible by simply > rebooting? E.g. using `chroot` and `kexec` somehow? >   * What else should I be aware of? > * * * The specific case is that I want to replace the custom Linux from a Buffalo LinkStation Pro Duo (armv5tel architecture, the nas-central description is a bit more helpful here and also provides instructions on how to gain SSH root access) with Arch Linux ARM. But a more general answer may be more helpful for others as well.


title: RHEL Installation issue with UEFI on HP Compaq Desktop

text: I have bought a new Desktop HP Compaq Elite 8300 SFF. It came with Windows 7 Pro installed. Now I want to install Linux (RHEL) by dual booting it. I have successfully shrinked the partition and rebooted the system. But, after booting through RHEL DVD, the system hangs after few initialization messages. Secondly, I rebooted, boot from cdrom, There are 3 options:   1. Red Hat Enterprise Linux 6.0   2. Install system with basic video drivers   3. Rescue If I press 'e' tab from to edit I got the following option               kernel /images/pxeboot/vmlinuz     initrd /image/pxeboot/initrd.img       But I don't know what to edit in this. I am getting the same error with some initial messages and system hangs after selecting any of above 3 options. Third option, `Startup Menu--> Run UEFI Application --> CDROM_DVD_RAM GH82N--> EFI --> BOOT --> BOOTX64.EFI` But here I got only blank grub menu               grub>      I don't know what to write in this. Or am I doing something wrong? The issue is not with DVD for sure, because I have original RHEL DVD and the same problem with other 2 DVDs as well.


title: Can't format external drive

text: I am trying to format an external drive, but getting the error               /dev/sdb1 is apparently in use by the system; will not make a filesystem here!      Based on the internet, I have to run `cat /proc/mounts`:               /dev/sda3 /media/backup fusebl w,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0     /dev/sdc1 /media/movies ext3 rw,relatime,user_xattr,barrier=1,nodelalloc,data=ordered 0 0      run `mount`:               /dev/sda3 on /media/backup type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)     /dev/sdc1 on /media/movies type ext3 (rw,relatime,user_xattr,barrier=1,nodelalloc,data=ordered)      Also `fuser -v dev/sdb1` and nothing is using it. I don't know what else to check to see why this is still in use. I was able to run cfdisk on it, and remove the old (NTFS) partition and add a new one, but still cannot format.


title: How to make "/home" partition after installation completed in Fedora 18?

text: I've installed Fedora 18 Spherical Cow with the new installer and I created 3 partitions from free space on the hard drive (`/`, `/boot` and swap). After I completed the installation, I figured out that there is 8G still free and I want to use it for a `/home` partition. Is that possible now? How I do it? Hard drive:   * primary partition (for windows system) NTFS   * logical partition ( for data ) NTFS   * `/boot` partition (ext4)   * LVM Volum group : [ -Fedora-root partition (ext4)& Fedora-Swap partition ] And 8G free space.


title: Why won't my binary run?

text: I have a binary that runs on my Debian Squeeze system, but then it doesn't do anything on my Debian Wheezy (kernel Linux 3.2.0-4-amd64) system. Both systems are 64 bit, while the executable is a 32 bit binary. Here's the output of:               me@myhost:~$ file myApp.run     myApp.run: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, stripped      How do I go about troubleshooting this? I get no output whatsoever, it just returns immediately. Running the binary with `strace`:               chadmichael@heraclitus: ~/dir$ sudo strace ./myApp.run      execve("./myApp.run", ["./myApp"...], [/* 17 vars */]) = 0     [ Process PID=24457 runs in 32 bit mode. ]     old_mmap(0xc6d000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0xc6d000) = 0xc6d000     readlink("/proc/self/exe", "/dir/myApp.run.run", 4096) = 129     old_mmap(0x8048000, 1108297, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x8048000     mprotect(0x8048000, 1108294, PROT_READ|PROT_EXEC) = 0     old_mmap(0x8157000, 42979, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0x10f000) = 0x8157000     mprotect(0x8157000, 42976, PROT_READ|PROT_WRITE) = 0     old_mmap(0x8162000, 15736, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x8162000     brk(0x8166000)                          = 0x866e000     open("/lib/ld-linux.so.2", O_RDONLY)    = -1 ENOENT (No such file or directory)     _exit(127)                                    = ?


title: DB Synchronization between main and DR site

text: I hope I am asking this question in the correct section. I have an environment setup for my application which consists of master / slave Postgresql databases. The master and slave are being replicated using streaming replication. Everything works good. Right now I am in the process of setting up a DR environment, which is a replica of my main site. What I would like to know is what would be the best way have synchronization setup for my main and DR site, so if one day I need to switch to my DR, the data in the database is the latest. Thanks in advance !


title: Are router firmware based on linux?

text: I was reading this book "the linux command line" and in the introduction it states that linux is internet backbone starting from servers to router infrastructure. That got me thinking to what extent this would be true. Yes I do have dd-wrt installed on my home router. But what about stock firmware of my belkin router? Is it linux based? I saw a list of distributions for routers: http://en.wikipedia.org/wiki/List_of_router_and_firewall_distributions Incredibly long one! I know cisco develops IOS, and some of their low end routers are linux, but what about IOS? is it unix derivative? or written from scratch?