How to check disk usage in ftp?

Is there a way to sum up the disk usage of a certain directory while in **ftp**? I was trying to create a script that will check what is the disk usage of the current directory and prints out the free space for the home directory. Example:               ftp> cd /home/directory/     drw-rw-rw-   1 user     group           0 Nov 16 /directory     drw-rw-rw-   1 user     group           0 Nov 16 next/directory     drw-rw-rw-   1 user     group           0 Nov 16 next/next/directory      For some reason, I cant see any size for directories. But inside them were files that I need to check the usage, so I have to get something like this:               total disk usage for /home/directory = "some count"     total disk usage for /next/directory = "some count"     total disk usage for /../directory = "some count"


Making the transition to multiple hard drives with dual boot

Hi I'm looking for tip or things to watch out for, while I make the following changes to my system: I currently have a dual boot setup on one hard drive (win7 and ubuntu), I am going to change to a 60gb ssd, and 2 hard drives. -SSD will have ubuntu / -"Hard drive 1" will have ubuntu /home (although some bits will go back to ssd) -"Hard drive 2" will have win7 Here is my initial thoughts on how to do it: (Assuming I currently have "hard drive 2" only) 1- Move important files from ubuntu partition onto windows partition. 2- log into windows and expand the windows partition to fill hard drive 2, wiping my ubuntu install. 3- Install SSD and "hard drive 1" into computer, turn on computer and hope the computer recognises them... or whatever is supposed to happen 4 - Insert Ubuntu live cd, and install ubuntu / on ssd and ubuntu /home on "hard drive 1" Does this sound like a good plan? My major concern is what is going to happen to grub and bootloading during this process, is it all going to go wrong (I have minimal experience with grub and bootloader) e.g. during step 2.


How to calculate in linux number of file inside nested directories?

I need to extract information how much files are in some directory tree:                 /.../testRoot/test1/test11/..../file1       /.../testRoot/test1/test11/file2       /.../testRoot/test1/test11/..../file3       /.../testRoot/test1/test11/file4     .....................................       /.../testRoot/test1/test1n/fileq       /.../testRoot/test1/test1n/..../filew       /.../testRoot/test1/test1n/filee       /.../testRoot/test1/test1n/.../.../ .../filer      How to calculate how many files are inside of testRoot? Thanks.


Move /tmp to RAM

I am trying to move `/tmp` to RAM and obey good practice:   * `/var/tmp` should NOT be placed in `tmpfs`, as it must survive reboots   * not mount `/tmp` as a stand-alone `tmpfs`, but rely on `/dev/shm` or `/run/shm` However, things have changed between 2.6 and 3.2 kernels : Changes to the configuration and defaults of tmpfs filesystems On 3.2 kernel, use `RAMTMP=yes` in `/etc/default/tmpfs`. My question is: how can I achieve this goal with older kernels ? My choice is nor to modify /etc/fstab neither this :               mkdir /dev/shm/tmp     chmod 1777 /dev/shm/tmp     mount --bind /dev/shm/tmp /tmp      Is there something like `RAMTMP` for 2.6 kernels ?


Fedora 19 livecd - doesn't work with any tools on VirtualBox

I want to create a custom live distribution of Fedora. I am using Fedora 19 live CD on VirtualBox on Windows (64bit Macbook Pro) to do this. I have tried following on Fedora 19 32 bit, Fedora 19 64 bit and Fedora 18 64 bit with same result: **Revisor** (Create Your Own Fedora Distribution with Revisor) - this freezes on "Loading Repositories". I have also tried using the following command and it got stuck in loading repositories at 18%:               revisor --cli --config=/etc/revisor/revisor.conf --model=f19-x86_64 \     --kickstart=/livecd/fedora-live-base.ks --respin \     --live-usb-thumb --live-shell         **livecd-creator** \- I used the following command and it just froze (I kept it running for half an hour but nothing happened)               livecd-creator --config=/root/fedora-live-base.ks --fslabel=Fedora-LiveCD --cache=/var/cache/live         **mock** (How to create a Fedora install ISO for testing) also freezes on "Start: yum update"    I have checked my internet connection and that is working fine. Can anyone please suggest any solutions or alternatives to this? * * * Update: I tried the command livecd-creator on Fedora 19 32-bit as follows:               livecd-creator --verbose --config =/livecd/fedora-live-desktop.ks --fslabel=Fedora-LiveCD --cache=/var/cache/live      I can see it is retrieving many packages but randomly (I tried 5 times) gets stuck at one of the packages like gnome-* (like gnome-calculator, gnome- keyring, etc.) Any idea what is happening???


CentOS 6 - nameserver entry in resolve.conf resetting after restarting network services?

In `/etc/resolv.conf`, I've changed the nameserver line to a new IP address. After saving and exiting, I run `service network restart`. I then go open `/etc/resolve.conf` again and see that the IP address I changed is now back to what it was prior to changing. Why is this happening?


In CentOS, what is the difference between yum update and yum upgrade?

What is the difference between `yum update` and `yum upgrade`, and when should I use one over the other?


FreeBSD 9.0 with GNOME 3

Is this possible , to install GNOME 3 on FreeBSD , at the moment ? I did not find a clear answer about this.


Is there a faster interface for info from /proc/net/tcp?

Given a linux TCP socket's inode (obtained via `/proc/<pid>/fd`), is there a faster way to look up the information that I can get from `/proc/net/tcp` about this socket? I have written a troubleshooting tool which monitors processes and prints realtime information about IO operations (`strace`-type info collected into higher level abstractions and presented in a less raw way), but on a heavily loaded network server, I am finding that the time it takes to look up socket info (e.g. the foreign address/port) is prohibitive simply due to the very large size of `/proc/net/tcp` (about 2MB on the server I'm currently looking at). I can manage this somewhat with caching, but this necessarily introduces latency and makes me wonder about the absurdity of an "API" that requires reading and parsing 2MB worth of ASCII text in order to find info on a socket.


GRUB error 17 booting USB disk

I have a USB disk with Grub 1 installed. I have 6 different Linux versions, all on different partitions, and one boot partition to hold the kernel images and grub. On some systems this works great, I get the boot menu and I can pick the linux distro. But on 2 systems I keep getting error 17 (and nothing else onscreen). I've confirmed the partition table ordering is correct, the partition table is valid, no errors on boot partition, etc. I've also reinstalled GRUB onto the MBR several times. Can someone explain why this is happening, and what I can do to fix?


Brace expression does not work in find regex

I have two folders, `CA01` and `CA02` under current folder, `foo`:               foo -+          |          +-CA01          |          +-CA02      When I type               find . -regex ".*CA[0-9]+" -exec echo {} +      Or               find . -regex ".*CA[0-9][0-9]" -exec echo {} +      I have the following output, which is expected:               ./CA01 ./CA02      But when I type in               find . -regex ".*CA[0-9]\{2\}" -exec echo {} +      **Nothing shows up, which is quite unexpected.** Because, by default, `find` uses emacs regex. I could use all the above to match the two folders. Am I missing something here?


Launch application as root user in GNOME

I've got CentOS 6 installed on my server. A few users want to have access to it via VNC, so I installed GNOME separately. Everything works okay, but I want to have possibility to run applications as the root user without providing the root password (just like `sudo` in the terminal). Where can I set this up in GNOME? I know that if I would install GNOME during the CentOS installation, I could just `visudo` and add certain users and that would be it. But when I installed GNOME separately it can't be done like this.


make google talk use the correct alsa sound device for input

I'm trying to make the Google Talk plugin accept sound. In other programs (e.g. Skype, Audacity) I did this by selecting the device for my sound input, hw:0.2 (see screenshots). Google Talk does not give me that option, shows instead only output devices and a default device. I tried to further configure the default capture device, but that did not help. Perhaps I did it the wrong way? Or maybe there is a way to create a device that Google Talk will pick up and allow me to select it? ![selected input in audacity](http://i.stack.imgur.com/pqUiP.png) ![selected input in skype](http://i.stack.imgur.com/ZVjQn.png) ![devices in Google Talk are very different](http://i.stack.imgur.com/sklbT.png) `.asoundrc`               pcm.!default {     type hw     card 0     }          ctl.!default {     type hw     card 0     }          # try to help Google Talk     pcm.!default {              type asym              capture.pcm {                      type plug                      slave.pcm "hw:0,2"              }      }      # end test for Google Talk          pcm.!default {         type plug         slave.pcm {             type asym             playback.pcm "dmix:SB"             capture.pcm "dsnoop:SB"         }     }          # Make OSS apps default to using dmix plugin too     pcm.dsp0 {         type plug         slave.pcm "dmix"     }


KDE apps look ugly over ssh

I am on a Kubuntu machine and sometimes reach another Xubuntu machine over ssh, and launch some KDE apps from there, these apps look really weird while the GTK apps look normal. Here are some screenshots: ![enter image description here](http://i.stack.imgur.com/lNxNh.png) ![enter image description here](http://i.stack.imgur.com/WI0Cv.png) ![enter image description here](http://i.stack.imgur.com/pcoei.png) ![enter image description here](http://i.stack.imgur.com/jZQie.png) For comparison, the kate editor launched locally looks like this: ![enter image description here](http://i.stack.imgur.com/1MeiF.png) A gtk app (ristretto image viewer) over ssh: ![enter image description here](http://i.stack.imgur.com/rk3JN.png)


comm not working to find unique words to file1 from two files

I have two text files in which I have to use the comm command to extract all unique words from file 1. So just those that are not in file 2. I was asked to use the `comm` command (not `diff` nor `join`). I have tried a lot of things such as `comm -32 file1 file2`, but this returns all the words in file 1.


Trying to form group with two users

I am trying to form a group with two users so that only those two users have access to a directory using               chmod g+r dir      I form a new group, www-OtagoHarbour, and try to add an existing user, OtagoHarbour, like this.               OtagoHarbour@WebServer:/var/www/executables$ sudo groupadd www-OtagoHarbour     OtagoHarbour@WebServer:/var/www/executables$ sudo useradd -G www-OtagoHarbour OtagoHarbour     useradd: user 'OtagoHarbour' already exists     OtagoHarbour@WebServer:/var/www/executables$ sudo useradd -g www-OtagoHarbour OtagoHarbour     useradd: user 'OtagoHarbour' already exists      Of course the user 'OtagoHarbour' exists but I want to add it to a group with another user.


how to put color variables in bash $'...'

I have defined in one file which I source from `.bashrc`, color constants.. like these.. > txtgrn='\e[0;32m' # Green   >  txtylw='\e[0;33m' # Yellow   >  txtblu='\e[0;34m' # Blue   >  txtpur='\e[0;35m' # Purple When I try to use them in my $PS1 variable I am getting strange results, in that everything looks fine till I press `CTRL-R` for recursive history search when few characters on the begining scramble, so I am able for example to delete them pressing `CTRL-D` in shell behind that -> pointer : I am using `$'..'` notation, to be able to insert unicode chars..               PS1=$'\xE2\x99\x94 [\\t][\u]->'        so now, what is the proper way of inserting variable like `$txtblu` from above, into `PS1` line..? EDIT: so line like this one:               PS1=$'\n\W\xe2\x98\x85 '$txtpur'\n\n[\t]'$txtrst'[\u]->'      makes rendering of symbols and colors ok, but when I press `Ctrl`+`R`, type few chars, and then `Ctrl`+`B` few(2 of them I think) characters appear on the beginning of resulting command search which are not belonging to that history line, and I am able to delete them.


sliding window of JPGs from thousands of files

My machine has a camera attached that can take thousands of jpgs a day. I am looking for a way of remotely looking at the last 30 to 60 mins of footage via a cloud storage site such as `box.com`. I thought that copying the last 5 mins of files to a mounted remote drive (davfs2) every min and then deleting files each 10 mins that were older than an hour would be a good solution; but it has caused big problems! It caused my machine not to be able to connect via SSH; thus requiring me to power it off. Now, even if I try and delete the files, it is still re-copying them to the mounted drive. I've had to un-mount the drive, but don't seem to be able to clear the davfs2 cache. Is there a fundamental problem with my approach? I put this in my crontab:               */1 * * * * sudo find /mnt/ -type f -cmin -5 -exec cp -pn '{}' /home/pi/box/street_pictures/ \;     */10 * * * *  sudo find /home/pi/box/street_pictures -cmin +60 -type f -exec rm '{}' \;      `/nmt` is the folder with the thousands of pictures. `/home/pi/box/street_pictures` is my mounted drive.


Download multiple URLs at once

I'm aware of `wget -i` as a way to download a list of URLs. The only trouble is that I need to pass some different POST data to each one, which works for single urls using `wget --post-data=` but not for lists. I'm open to any CLI downloader, or even something in JS or Python. I would however like to get either a progress bar for each download or a log file updated each time a dl finishes, or some other way of knowing when a dl finishes.


Huge UI elements in Crunchbang

I have just installed Crunchbang on my Desktop, and windows and menus appear incredibly enlarged. When I right click the context menu fills the screen, for example. My graphics card is the Radeon HD 7790. I'm sure this has something to do with AMD's shitty Linux support. I have the OS installed on a partition on an external HDD, so I booted the same install up on my Intel HD 4000 laptop and did not get this problem. I installed `fglrx-driver` through `apt` while it was booted on my laptop, but when I loaded it on the desktop this problem persisted. I managed to open a terminal on the desktop, and—with great difficulty—ran `xrandr`, which said it was running at a 1280x720 resolution (My monitor is 1080p). when I ran `aticonfig --initial` on the desktop it said it could not find a supported connector. ![Picture of monitor](https://photos-6.dropbox.com/t/0/AAD9ap2r9kN9bSO45kibIbYqYFvTZkX1CRNDUBhjwH- RzQ/12/127476718/jpeg/1024x768/3/1409036400/0/2/2014-08-25%2023.55.37.jpg/FhnmjYon5Ol4R98oADu8p79_1IolKs2AkYqxvQV7O8Y)


difference between /var/www and /usr/local

I don't understand the difference between `/var/www` path and `/usr/local` path on linux command because for instance at the moment I can see my red5 server folder is in the latter path and within that folder is `/webapps/root/demos` path and has me wondering why it is there and why red5 directory is not in the first path. What is the difference between these two paths? I mean one is clearly to place all your publicly viewed html files and then I can understand the `/etc/httpd` path for apache but does `/usr/local` always refer to things such as media and server connections- is that why? Then what would the `root` in webapps refer to, how is that implemented when demos can be accessed essentially by anyone if you have your server running.


Does ionice work with the deadline scheduler?

My Debian Wheezy systems use the `deadline` scheduler. I'm accustomed to using `ionice` to reschedule the I/O priority of disk-intensive jobs at busy times, and anecdotally this seems to help (but I don't have any hard evidence). The `ionice` manpage, kernel documentation and this OpenSUSE document all suggest that only the `cfq` scheduler takes into account `ionice` interventions. They don't explicitly state that other schedulers ignore it, but the only one they mention is `cfq`. Do other schedulers, in particular `deadline`, work with `ionice`?


Writing own daemon. systemd error: Failed to read PID from file: Invalid argument

I'm trying to write own daemon a la very simple MPD (it's operating systems laboratory work). I made it work: it starts like a daemon (output of ps):               1 14877 14877 14877 ?           -1 Ss       0   0:00 lab1_daemon      it plays, it gets signals. The problem is that I can't run it with systemd. I wrote very simple .service file:               [Unit]     Description=Operating systems lab 1 daemon          [Service]     Type=forking     PIDFile=/run/lab1_daemon.pid     ExecStart=/path/lab1_daemon          [Install]     WantedBy=multi-user.target      But when I run daemon with `systemctl start` it hangs for 0.5 min and then in logs I see:               Failed to read PID from file /run/lab1_daemon.pid: Invalid argument     lab1_daemon.service never wrote its PID file. Failing.      But it did! I checked it:               -rw-r--r-- 1 root root 13 Mar  5 00:13 /run/lab1_daemon.pid      What have I done wrong? PS: I even tried `daemon` function to check, that I did daemonizing correctly. But I got same results. Minimal source code (58 LOC, moved from pastebin):               #define _BSD_SOURCE     #define _GNU_SOURCE     #define _POSIX_C_SOURCE 199506L     #define _D_XOPEN_SOURCE 700          #define NAME "lab1_daemon"     #define PID_FILE_NAME "/run/" NAME ".pid"          #include <errno.h>     #include <fcntl.h>     #include <stdbool.h>     #include <stdio.h>     #include <stdlib.h>     #include <string.h>     #include <syslog.h>     #include <sys/stat.h>     #include <sys/types.h>     #include <unistd.h>          int lockfile(int fd)     {             struct flock fl;             fl.l_type = F_WRLCK;             fl.l_start = 0;             fl.l_whence = SEEK_SET;             fl.l_len = 0;             return fcntl(fd, F_SETLK, &fl);     }          bool is_already_running(char const *lock_file_name)     {             int lock_file = open(lock_file_name, O_RDWR | O_CREAT,                                  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);             if (lock_file < 0)                     exit(1);                  if (lockfile(lock_file) < 0) {                     if (errno == EACCES || errno == EAGAIN) {                             close(lock_file);                             return true;                     }                     exit(1);             }             ftruncate(lock_file, 0);             char buf[16];             sprintf(buf, "PPID: %ld\n", (long)getpid());             write(lock_file, buf, strlen(buf) + 1);             return false;     }          int main(void)     {             if (is_already_running(PID_FILE_NAME))                     exit(EXIT_FAILURE);             daemon(0, 0);             sleep(10);             exit(EXIT_SUCCESS);     }


specify PREFIX location when running make

I need to install redis 2.8.x into a specific directory so I can later use fpm to create an rpm. From my research, it seems that this should be possible by using `make PREFIX=`               mkdir /tmp/installdir     cd /tmp     wget http://download.redis.io/releases/redis-2.8.6.tar.gz     tar -xvf redis-*.tar.gz     cd redis-2.8.6     make PREFIX=/tmp/installdir     make install      I expect the binaries to be placed in /tmp/installdir, unfortunately that directory remains empty. It seems `PREFIX=/tmp/installdir` is being ignored. Normally I would run `./configure --prefix=/tmp/installdir` however because the download does not contain source code, there is no `configure` file. How can I install software to a non standard directory?


Two DNS servers, both incomplete

In my company we have 2 DNS servers: one for the internal hostnames and one for Internet. I tried to configure both in my Network Manager, who result in having the two DNS server IPs in my `/etc/resolv.conf`. If I put as primary DNS server the Internet one, when I try to resolve the name of one internal hostname, it fails, and the resolver doesn't try to found the IP using the secondary DNS server. In the other hand, if I put the internal DNS as primary, I cannot reach any Internet server from my computer. Is there a solution to make the resolver to query the seconday DNS when the first one answer with “no such name” or any other DNS lookup error?


What is "ALL ALL=!SUDOSUDO" for?

The last line of the /etc/sudoers file is:               grep -i sudosudo /etc/sudoers     Cmnd_Alias SUDOSUDO = /usr/bin/sudo     ALL ALL=!SUDOSUDO      why? What does it exactly do? UPDATE#1: Now I know that it prevents users to use the: "/usr/bin/sudo". UPDATE#2: not allowing "root ALL=(ALL) ALL" is not a solution. **Updated Question:** What is better besides this "SUDOSUDO"? (the problem with this that the sudo binary could be copied..)


Parameter expansion seems to be missing a piece

I'm currently learning how to write simple scripts and can't get my head around a very simple problem. I have the following command in my script...               touch ${DIRECTORY}/${FILE}      This command appears several times in my script and works fine in all instances except for one. For some reason, at one point only, it decides to include the slash in the filename that it's trying to create and I get the error...               cannot touch `/myfile.dat': Permission denied      At first I thought it was just probably down to my inexperience (which it probably is) but after doing a bit of research, I've seen this line used in countless examples working correctly. I can't understand - the same line is working fine in several other locations in my script! Anybody care to shed some light on this? It's the inconsistency that's really annoying me. Can the commands surrounding this particular command affect its outcome?


Substitute placeholders in template

Say I have a shell configuration file `config` like this:               HOST=localhost     PORT=8080      Now I have a template `template` like this:               The host is <%= @HOST %>     The port is <%= @PORT %>      How do I substitute placeholders in `template` with values in `config` file? I can certainly do it like this:               $ . config     $ sed -e "s/<%= @HOST %>/$HOST/" \     > -e "s/<%= @PORT %>/$PORT/" < template     The host is localhost     The port is 8080      But if there are many config values this becomes too cumbersome. How would I do this in more generic way? I would like to iterate over each placeholder and substitute it with a real value.


Memory usage caused by MySQL or Apache?

![my vps memory usage](http://www.fileden.com/files/2012/9/14/3347302/my%20usage.png) Here is a screenshot of my usage today on an idle unfinished cms drupal site with a maximum of 14 added modules besides core and no activity or users. As you can see I am at my limit which is crazy so I need to limit memory usage of apache and mysql and php because my VPS is smallest one which should suit my current needs. My system file my.cnf does not have a list of parameters as I've seen posted elsewhere but this is the file which apparently will lessen usage of memory amongst other things I've read like memory leaks and apache MPM workers vs apache prefork which seems to be what I have. So how can I significantly reduce memory usage without removing apache or php5? I am using mysql version 5.1.66 and looks like innodb and show variable yabbit.net/mysql.txt


Mail server installation in Cent OS 6.2

I have a server with a dedicated IP. I didn't take any domain yet. CentOS 6.2 is installed on this server. I tried to install mail server in it and followed these links exactly.   * The Perfect Server - CentOS 6.3 x86_64 (Apache2, Courier, ISPConfig 3)   * Postfix HOWTO - centos.org Everything is installed perfectly but my questions are:   1. How do I create mail id’s and where?    2. Where is my main mail panel?    3. How does the mail system work and how to manage it?    4. How to make mail system secure and customized?    5. How to make my IP address swap with a name e.g. mail.something.com not IP?    6. Can I use only IP to send or receive mail with this mail server? I need to install mail server for my small group of 50 people and this may increase in time. I need the full installing guide of mail server from A to Z procedure.


Unable to telnet public ip on port 80

We are facing a communication problem between the public and our private network. We have a Linux based web server behind a firewall and an internet router. As part of some integration, our web portal team is trying to Telnet the public IP of an another web portal from these Linux web servers on port 80, but the connection is closed by remote host just in time it says connected.   But same is successful while we try it from a Windows based web server in our network. Everything seems fine, the firewall is passing the traffic. Does it matter if one end server is running Linux and other end is a Windows server. Because the public IP application server is running Windows server. what are the key points to meet the requirement to make the communication succeed. Refer the below error logs.               ]$ telnet 220.226.190.180 80     Trying 220.226.190.180...     Connected to 220.226.190.180 (220.226.190.180).     Escape character is '^]'.     Connection closed by foreign host.


Download https pages

I can download few files from https site through web browser. By using the proper credentials, is it possible to download the https pages through command line ( that too non-interactively ) ? e.g. To download This image non-interactively through command line with proper credentials, I will search for lines with "png" extension PLEASE VOTE TO CLOSE THE QUESTION ( I am bit confuse, what to ask exactly )


How does the kernel store the virtual memory area?

I am trying to understand `do_page_fault` in `fault.c` (x86 architecture). I came across the method `access_error` where we compare the error code to the vm flags. As per my understanding, we are checking an error code passed on a page fault, i.e., we are comparing the flags of a page to those of its `vm_area`. Does this imply that `vm_area` is a group of pages whose flags are the same? Specifically, does linux store or organize `vm_area` so that all pages with similar properties are together?


Login when root filesystem is full

Will I be able to login into the system if the root filesystem is 100% full? Configuration: `home` is not a partition but is also placed on the `root` (i.e. `/home` is a directory on the partition holding root `/`), `var` and `tmp` are separate partitions and in good state.


Can a file that was originally sparse and expanded be made re-sparse

I know that copying or transferring what was originally a sparse file without using a utility that understands sparse files will cause the 'holes' to be filled out. Is there a method or utility to turn what was once a sparse file back to sparse? For Example:   create sparse file:               % dd if=/dev/zero of=TEST bs=1 count=0 seek=1G     # do some op that pads out the holes     % scp TEST localhost:~/TEST2     % ls -lhs TEST*        0 -rw-rw-r--. 1 tony tony 1.0G Oct 16 13:35 TEST     1.1G -rw-rw-r--. 1 tony tony 1.0G Oct 16 13:37 TEST2      Is there some way to:               % resparse TEST2     to get:        0 -rw-rw-r--. 1 tony tony 1.0G Oct 16 13:35 TEST       0G -rw-rw-r--. 1 tony tony 1.0G Oct 16 13:37 TEST2


For an init.d startup script, what is the ideal user to use as the owner of that process

Everyone says that running processes as root is bad, since it defeats the security and privileges model. But what user should be used to run a startup process? Is it really necessary to create a new user, just to own a single startup process?


Fetching user input while running in the background

I am writing a script that prompts the user for input and does some processing afterwards. I was using `read` to get the data, but then I noticed that when the script is ran with a keyboard shortcut (I added an entry in Ubuntu's Keyboard Shortcut list) it ignores the `read` and continues with the rest of the code. How can I read user input with a script running in the background like this?


Openswan connecting to multiple right subnets not working

I'm trying to use Openswan (version 2.6.37) to connect an IPsec VPN from my local network to a remote site. Everything works fine when I just want to connect to a single subnet on the remote site. However, the remote site also has an extra subnet that I want to access. This is my configuration:               conn myConn             type=tunnel             left=192.168.139.14             leftsubnet=192.168.139.0/24             leftxauthclient=yes             right=X.X.X.X             rightsubnet=172.16.1.0/24             keyexchange=ike             auth=esp             authby=secret             phase2alg=3des-sha1             pfs=yes      When I replace `rightsubnet` with `rightsubnets`, like so:               rightsubnets={172.16.1.0/24 192.168.3.0/24}      ...then the connection is created successfully but only the last subnet in the list is available. Any attempts to ping anything on the `172.16.1.0` subnet fails. If I swap the order of the subnets around then I can ping `172.16.1.X` but can't ping anything on the other subnet. It's as if Openswan is only using the last subnet in the list to create a connection. Am I doing something wrong here? A little bit of extra information that I neglected to mention (although I'm not sure it's relevant): My Openswan client is behind a router using NAT and I have `nat_traversal=yes` in my `ipsec.conf` file.


Fastest way to determine if two sorted lists contain unique elements

I have two sorted files `A` and `B` where the size of `A` is much greater than `B`, e.g. A is 100GB while B is 50MB. I want to _quickly_ determine if there are any lines in `B` that are contained in `A`, stopping once a match is made. I currently have a python script for this but it runs slowly when the process has to be repeated thousands of times for different `B`'s.


Fix sound stuttering from snd-hda-intel

When I play mp3s on my openSUSE 12.3 (x586) Compal JFL92 laptop with codec Realtek ALC268 and sound driver `snd-hda-intel` the sound will skip forward and backwards a few times every minute at random places. It did work well in 2009 with an Ubuntu load, but broke after that, and was also broken with a Fedora load. I have tried adding `tsched=0` in `/etc/pulse/default.pa` (`load-module module-udev-detect tsched=0`), specifying in `/etc/modprobe.d/50-sound.conf` various options `snd-hda-intel` variants, including `enable_msi=0` and `postion_fix=1` or 2, disabling or removing `pulseaudio` entirely, etc. Flash plays similarly poorly, jumping forwards and back in chrome. I'd love just the simple fix for it, but if there are debugging steps I can do to get more information those are great, too.


What is the most efficient way to move a large number of files that reside in a single directory?

CentOS 5.x I apologize if this is a repeat question. I've seen a lot of similar questions (regarding deleting files) but not exactly the same scenario. I have a directory containing hundreds of thousands of files (possibly over a million) and as a short-term fix to a different issue, I need to move these files to another location. For the purpose of discussion, let's say the these files originally reside in `/home/foo/bulk/` and I want to move them to `/home/foo2/bulk2/` If I try `mv /home/foo/bulk/* /home/foo2/bulk2/` I get a "too many arguments" error. Mr. Google tells me that an alternative for deleting files in bulk would be to run find. Something like: `find . -name "*.pdf" -maxdepth 1 -print0 | xargs -0 rm` That would be fine if I was deleting stuff but in this case I want to move the files... If I type something like `find . -name "*" -maxdepth 1 -print0 | xargs -0 mv /home/foo2/bulk2/` bash complains about the file not being a directory. What's the best command to use here for moving the files in bulk from one directory to another?


Problem accessing an Apache-hosted folder

I'm running Centos 6.2, and Apache. I'm running into an error to do with access rights/permissions when trying to navigate to a webpage. I'm trying to go to the URL `http://localhost/repos`, but I get the error: > You don't have permission to access /repos on this server Am I missing something essential? I've tried running `chmod 775`, which I believe should have given me the correct access rights, but to no avail.


in Shell Scirpt I want to use ::ssu <USERNAME>

I want to `ssu` or alternate command in shell script. However it's asking for password in middle of shell script. I don't want to do that. Any alternate command or suggestion? E.g.               ssu <username>     cp -r /path/     ksh wrapper.ksh      after finish `wrapper.ksh`, exit from `ssu` mode.


Setting up LS colors with a human-readable script in tcsh

I have a shell script (`set_up_my_ls_colors.sh`) that, if I call from my shell, it configures my color scheme for `ls`. The nice thing about the script is that it allows me to configure colors in a human-readable format. The file works well under zsh and bash, but it does not work well in `tcsh`. If I call it as:               . ~/.set_up_my_ls_colors.sh      I get:               .: Permission denied       even though the file has `u+x` permissions. I have also tried with               /bin/tcsh ~/.set_up_ls_colors.sh      which returns               Illegal variable name      Below is the file `set_up_my_ls_colors.sh` in question:               # Call this script as . ~/path_to_this_file.sh          export LS_COLORS=$( \     ( grep '\w' | grep -v '^#' | sed 's/#.\+//' | perl -lane 'printf "%s=%s:", shift @F, join ";", @F;' ) <<< "          # HUMAN_FORMATTED_DATA     # list one per line          # these are basic filesystem items     no 00          # normal     fi 00          # file     di 01 34       # directory     ln 00 36       # link     pi 40 33       # pipe     so 00 35       #     bd 40 33 01     cd 40 33 01     or 01 05 37 41     mi 01 05 37 41     ex 00 91       # executable     ow 01 34       # other writables               *.cmd 00 32     *.exe 00 32          # archive, compressed things etc     *.gz  00 90     *.bz2 00 90     *.bz  00 90     *.tz  00 90     *.rpm 00 90     *.rar 00 90     *.zip 00 90     *.iso 00 90               *.cpio 00 31                    # perl & CODE     *.c      33     *.h      33     *.sh     33     *.t      33     *.pm     33     *.pl     33     *.cgi    33     *.pod    33     *.PL     33     *.js     33     *.php    33     #*.xs          # strikethrough     *.off 00 9     *.bak 00 9     *.old 00 9               # documents misc, html webstuff     # really TEXT     *.htm    94     *.html   94     *.txt    94     *.text   94     *.css    94               # MOVIE     *.avi    96     *.wmv    96     *.mpeg   96     *.mpg    96     *.mov    96     *.AVI    96     *.WMV    96     *.mkv    96          # images & pdf     *.jpg    96     *.jpeg   96     *.png    96     *.xcf    96     *.JPG    96     *.gif    96     *.svg    96     *.eps 00 96     *.pdf 00 96     *.PDF 00 96     *.ps  00 96          *.ai  00 91 # adobe ill     *.doc 00 91 # msword shit          # data, such as .db, .csv     *.csv    95     *.dsv    95     *.db     95     *.sql    95     *.meta   95     # CONFS     *.xml    95     *.yaml   95     *.yml    95     *.conf   95     # [a-z0-9]*rc     ")          #echo GOT: $LS_COLORS     #export LS_COLORS          # The codes are:     # code  0 = default colour     # code  1 = bold     # code  4 = underlined     # code  5 = flashing text     # code  6 = no change     # code  7  = reverse field     # code  8 = black     # code  9 = strikethrough (cool!)     # code  10 - 29= no change     # code  30  = light green     # code  31  = red     # code  32  = green     # code  33  = orange     # code  34  = blue     # code  35  = purple     # code  36  = cyan     # code  37  = grey     # code  38 = underline     # code  39 = no change     # code  40  = black background     # code  41  = red background     # code  42  = green background     # code  43  = orange background     # code  44  = blue background     # code  45  = purple background     # code  46  = cyan background     # code  47  = grey background     # code  90  = dark grey     # code  91  = light red     # code  92  = light green     # code  93  = yellow     # code  94  = light blue     # code  95  = light purple     # code  96  = turquoise     # code  100 = dark grey background     # code  101 = light red background     # code  102 = light green background     # code  103 = yellow background     # code  104 = light blue background     # code  105 = light purple background     # code  106 = turquoise background


I am trying to install Google Chrome on Linux Mint 7

It seems like Jaunty is not being maintained anymore. When trying to install the chrome package:               steven@steven-desktop ~/Desktop $ sudo dpkg -i google-chrome-stable_current_i386.deb      Selecting previously deselected package google-chrome-stable.     (Reading database ... 106471 files and directories currently installed.)     Unpacking google-chrome-stable (from google-chrome-stable_current_i386.deb) ...     dpkg: dependency problems prevent configuration of google-chrome-stable:      google-chrome-stable depends on libasound2 (>> 1.0.22); however:       Version of libasound2 on system is 1.0.18-1ubuntu9.      google-chrome-stable depends on libc6 (>= 2.11); however:       Version of libc6 on system is 2.9-4ubuntu6.      google-chrome-stable depends on libcups2 (>= 1.4.0); however:       Version of libcups2 on system is 1.3.9-17ubuntu1.      google-chrome-stable depends on libdbus-1-3 (>= 1.2.14); however:       Version of libdbus-1-3 on system is 1.2.12-0ubuntu2.      google-chrome-stable depends on libfontconfig1 (>= 2.8.0); however:       Version of libfontconfig1 on system is 2.6.0-1ubuntu12.      google-chrome-stable depends on libgconf2-4 (>= 2.27.0); however:       Version of libgconf2-4 on system is 2.26.0-0ubuntu1.      google-chrome-stable depends on libgcrypt11 (>= 1.4.2); however:       Version of libgcrypt11 on system is 1.4.1-2ubuntu1.      google-chrome-stable depends on libgtk2.0-0 (>= 2.18.0); however:       Version of libgtk2.0-0 on system is 2.16.1-0ubuntu2.      google-chrome-stable depends on libnss3-1d (>= 3.12.3); however:       Version of libnss3-1d on system is 3.12.2~rc1-0ubuntu2.      google-chrome-stable depends on libstdc++6 (>= 4.4.0); however:       Version of libstdc++6 on system is 4.3.3-5ubuntu4.      google-chrome-stable depends on libatk1.0-0 (>= 1.30.0); however:       Version of libatk1.0-0 on system is 1.26.0-0ubuntu2.     dpkg: error processing google-chrome-stable (--install):      dependency problems - leaving unconfigured     Processing triggers for man-db ...     Errors were encountered while processing:      google-chrome-stable      It seems like there is no way for me to update all of these libraries to the correct versions anymore because they all report being already updated.               steven@steven-desktop ~/Desktop $ sudo apt-get install libasound2     Reading package lists... Done     Building dependency tree            Reading state information... Done     libasound2 is already the newest version.     You might want to run `apt-get -f install' to correct these:     The following packages have unmet dependencies:       google-chrome-stable: Depends: libasound2 (> 1.0.22) but 1.0.18-1ubuntu9 is to be installed                             Depends: libc6 (>= 2.11) but 2.9-4ubuntu6 is to be installed     ...      What can I do? Try to dig up a .deb of the most recent version of Chrome which does not require dependencies more recent than what is available on Jaunty? Am i likely to ever succeed with this? The reason I chose a distro based on Jaunty is because Jaunty is nice and stable. I figured that would help me succeed in getting `npm`, node.js package manager, working. I'll want an updated Chrome to test that... This is an awful bit of catch-22...


Why is my graphical desktop running on TTY1

I recently installed gnome-shell on my new Archlinux and X is running on TTY1. Is this is a normal behaviour?               screenfetch                                 -`                           .o+`                 rkmax@satellite                          `ooo/                 OS: Arch Linux                          `+oooo:                Kernel: x86_64 Linux 3.9.9-1-ARCH                        `+oooooo:               Uptime: 13m                        -+oooooo+:              Packages: 785                      `/:-:++oooo+:             Shell: bash                     `/++++/+++++++:            Resolution: 2726x768                    `/++++++++++++++:           DE: Gnome 3.8.2                   `/+++ooooooooooooo/`         WM: Not Found                  ./ooosssso++osssssso+`        WM Theme: Not Found                 .oossssso-````/ossssss+`       GTK2 Theme: Adwaita                -osssssso.      :ssssssso.      GTK3 Theme: Adwaita               :osssssss/        osssso+++.     Icon Theme: gnome              /ossssssss/        +ssssooo/-     Font: Ubuntu 11            `/ossssso+/:-        -:/+osssso+-   CPU: Intel Core i3 CPU M 380 @ 2.533GHz           `+sso+:-`                 `.-/+oso:  RAM: 1312MB / 2808MB          `++:.                           `-/+/            .`                                 `/


Cannot echo colored text when inserting in status bar in dwm

I'm using Fedora 18. I'm trying to create a custom status bar in dwm. Now what I'm thinking of is to check if the battery is under a certain level, the background of the battery region in the status bar will be red. The problem is, when this condition is true, I get a different result. What I expected this to be shown inside the status bar with a red background:               (red bg: Discharging, 50%) | 04:21:20 AM 29/06/2013      But I get : ![ss of taskbar](http://i.stack.imgur.com/MUiSJ.png) Here's my startup script :               #!/bin/bash       2        3 # Created By Rafael Adel       4        5 # This script is to start dwm with customizations needed       6        7        8 while true;do       9         datestr=`date +"%r %d/%m/%Y"`      10         batterystr=`acpi | grep -oP "([a-zA-Z]*), ([0-9]*)%"`      11         batterystate=`echo $batterystr | grep -oP "[a-zA-Z]*"`      12         batterypercent=`echo $batterystr | grep -oP "[0-9]*"`      13       14       15         if [ $batterypercent -le 90 ]      16         then      17                 finalstr="`echo -e "\033[41m${batterystr}\033[0m | $datestr"`"      18         else      19                 finalstr="$batterystr | $datestr"      20         fi      21                 xsetroot -name "$finalstr"      22         sleep 1      23 done &      24       25 xbindkeys -f /etc/xbindkeysrc      26       27 exec dwm      Any help will be appreciated. Thanks.


How to fix bash looking for a program in the wrong dir (Issues setting up NPM on Ubuntu 11.10)

This time I ran the "trusting" install script `curl http://npmjs.org/install.sh | sudo sh` from the dir `/`.               $ which npm     /usr/local/bin/npm     $ npm     bash: /home/steven/local/bin/npm: No such file or directory     $ echo $PATH     /home/steven/local/bin:/home/steven/local/bin:/home/steven/local/bin:/home/steven/local/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games     $ ls /home/steven/local/bin     node  node-waf     $ ls /usr/local/bin     node  node-waf  npm  npm_g  npm-g      It seems like some script somewhere is polluting my `$PATH`. What I wonder is, if `bash` can't find the program in the first dir it looks in, doesn't it keep looking through `$PATH`? It should be able to find it in `/usr/local/bin`! `npm` really, really doesn't seem to want to just work. I think I'm gonna go load up a slightly older Ubuntu and give this another go...


How does this sed command work?

I've come across this solution for printing a specific line from a text file:               sed '123!d;q' file      Why doesn't sed quit after the first line of input in this case?


Disable bold font in urxvt

I want to disable the bold font in my urxvt config (`.Xresources`). xterm has the option allowBoldFonts. Is there a similar option for urxvt? I can't find anything similar.


Why is there a mismatch between size reported by LVM and the size reported by df -h?

I'm new to LVM and have been very confused by this: I am transfering a large file to a partition that I thought had about 1.5 terabytes of space on it. Near the end of the transfer, rsync exits with an error claiming that the partition is full. I investigate and find the following:               $ sudo lvm lvs       LV        VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert       home      system -wi-ao  97.66G                                             log       system -wi-ao  48.81G                                             log.audit system -wi-ao   9.75G                                             root      system -wi-ao 341.59G                                             swap      system -wi-ao   4.88G                                             temp      system -wi-ao  97.66G                                             var       system -wi-ao   1.46T        This seems to imply that /var (the partition that I'm transfering to, has the amount of storage I expect. However, then I see:               $ sudo df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/mapper/system-root                           331G  1.3G  313G   1% /     /dev/mapper/system-temp                            95G  188M   90G   1% /tmp     /dev/mapper/system-var                            95G   90G     0 100% /var     /dev/mapper/system-home                            95G  188M   90G   1% /home     /dev/mapper/system-log                            48G  264M   45G   1% /var/log     /dev/mapper/system-log.audit                           9.5G  340M  8.7G   4% /var/log/audit     /dev/sda1              99M   25M   70M  26% /boot     tmpfs                 8.0G     0  8.0G   0% /dev/shm      I'm guessing this has something to do with the volume being resized at some point. While I have reliable backups, I'd rather not interrupt services for the time it will take to get the backup and restore. Thus, is there anyway to make the filesystem seen by the OS match the space available according to lvm without losing data?


Connect to KVM instance using virsh when image launched through Eucalyptus?

I'm using Eucalyptus on Ubuntu 10.04 to set up a private cloud. Sometimes I'm not able to ssh into the VM instances, and I'd like to be able to connect directly to the console of the VM instance. However, by default, that doesn't seem to work through virsh:               $ sudo virsh -c qemu:///system console i-486B085E     No console available for domain      Is there some way to enable this, for example, by changing the way Eucalyptus generates the XML file that gets passed to libvirt? Here's the libvirt.xml file that Eucalyptus generates:               $ cat /var/lib/eucalyptus/instances/admin/i-486B085E/libvirt.xml     <domain type='kvm'>         <name>i-486B085E</name>         <os>         <type>hvm</type>             <kernel>/var/lib/eucalyptus/instances//admin/i-486B085E/kernel</kernel>             <initrd>/var/lib/eucalyptus/instances//admin/i-486B085E/ramdisk</initrd>             <cmdline>root=/dev/sda1 console=ttyS0</cmdline>         </os>         <features>             <acpi/>         </features>         <memory>262144</memory>         <vcpu>1</vcpu>         <devices>             <disk type='file'>                 <source file='/var/lib/eucalyptus/instances//admin/i-486B085E/disk'/>                 <target dev='sda'/>             </disk>             <interface type='bridge'>                 <source bridge='eucabr10'/>                 <mac address='d0:0d:48:6B:08:5E'/>                 <model type='e1000'/>             </interface>             <serial type="file">                 <source path='/var/lib/eucalyptus/instances//admin/i-486B085E/console.log'/>                 <target port='1'/>             </serial>         </devices>     </domain>      Here's the output of virsh dumpxml:               $ sudo virsh dumpxml i-486B085E     <domain type='kvm' id='3'>       <name>i-486B085E</name>       <uuid>3b762376-4de1-f6ac-7327-9df520fa4862</uuid>       <memory>262144</memory>       <currentMemory>262144</currentMemory>       <vcpu>1</vcpu>       <os>         <type arch='x86_64' machine='pc-0.12'>hvm</type>         <kernel>/var/lib/eucalyptus/instances//admin/i-486B085E/kernel</kernel>         <initrd>/var/lib/eucalyptus/instances//admin/i-486B085E/ramdisk</initrd>         <cmdline>root=/dev/sda1 console=ttyS0</cmdline>         <boot dev='hd'/>       </os>       <features>         <acpi/>       </features>       <clock offset='utc'/>       <on_poweroff>destroy</on_poweroff>       <on_reboot>restart</on_reboot>       <on_crash>destroy</on_crash>       <devices>         <emulator>/usr/bin/kvm</emulator>         <disk type='file' device='disk'>           <source file='/var/lib/eucalyptus/instances//admin/i-486B085E/disk'/>           <target dev='sda' bus='scsi'/>         </disk>         <interface type='bridge'>           <mac address='d0:0d:48:6b:08:5e'/>           <source bridge='eucabr10'/>           <target dev='vnet0'/>           <model type='e1000'/>         </interface>         <serial type='file'>           <source path='/var/lib/eucalyptus/instances//admin/i-486B085E/console.log'/>           <target port='0'/>         </serial>         <console type='file'>           <source path='/var/lib/eucalyptus/instances//admin/i-486B085E/console.log'/>           <target port='0'/>         </console>       </devices>       <seclabel type='dynamic' model='apparmor'>         <label>libvirt-3b762376-4de1-f6ac-7327-9df520fa4862</label>         <imagelabel>libvirt-3b762376-4de1-f6ac-7327-9df520fa4862</imagelabel>       </seclabel>     </domain>      Here's the full KVM command-line that ends up being invoked:               /usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 256 -smp 1 -name i-486B085E -uuid 3b762376-4de1-f6ac-7327-9df520fa4862 -nographic -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/i-486B085E.monitor,server,nowait -monitor chardev:monitor -boot c -kernel /var/lib/eucalyptus/instances//admin/i-486B085E/kernel -initrd /var/lib/eucalyptus/instances//admin/i-486B085E/ramdisk -append root=/dev/sda1 console=ttyS0 -drive file=/var/lib/eucalyptus/instances//admin/i-486B085E/disk,if=scsi,index=0,boot=on -net nic,macaddr=d0:0d:48:6b:08:5e,vlan=0,model=e1000,name=e1000.0 -net tap,fd=55,vlan=0,name=tap.0 -chardev file,id=serial0,path=/var/lib/eucalyptus/instances//admin/i-486B085E/console.log -serial chardev:serial0 -parallel none -usb      _Note: Cross-posted fromserverfault since question migration isn't supported yet._


Removing blank spaces and tabs from line without messing with line endings

I am trying to remove all spaces on a file without messing with line endings. This is to be run from inside a bash script. I have tried all the solutions here: http://stackoverflow.com/questions/9953448/how-to-remove-all-white-spaces- from-a-given-text-file They work from the command line but when I try them from the bash script the final file is a mess, completely destroyed. File is using UNIX file endings. Any clues?


What is the mknod command used for?

I just started using Ubuntu as my main OS and I wanted to learn about things I should not do, and learn by the bad things people have done in the past. I came across these email about horror stories that UNIX & Linux sys admins had done on their own system when they where new. Many of them involved the use of the mknod command to both distory and fix a problem. I've never heard of this command before and the man page within Ubuntu is not very helpful. So my question is, what is this command used for, and what are some examples where it is useful in day to day use?


Unable to access page with https

I have configured https on my server with apache2 which is in cloud. The below Listen directives are enabled in it.               Listen 80     Listen 443      The port 80 is firewalled in cloud. So I used port 443 to access it. But the problem is that if both of the above Directives are enabled then only I am able to access the page with https. If I remove `Listen 80`, then httpd started with 443 but I am not able to access the page and the log is showing giving               "GET /portal HTTP/1.1" 302 -      Can anyone help me understanding why this is happening. I have used the below rewrite rules:               RewriteEngine On     RewriteCond %{SERVER_PORT} !^443$     RewriteRule ^/(.*)$ https://myxenvm/$1 [NE]


How do I emulate a USB stick with an external CDROM drive?

I am working with a Linux-based high-security network appliance (hereon: device) and do not have access to the user space so I can't log in. The only thing I can do is send it commands to upgrade through the USB port. It then reads the USB stick and starts the upgrade. I have been tasked to attempt to upgrade it without a USB stick but an external CDROM drive instead.      The USB stick must be less than 4GB and formatted with FAT32. Here is an example of a USB stick that the device recognizes:               [root@pitfall ~]# fdisk -l /dev/sdc          Disk /dev/sdc: 15.6 GB, 15606349824 bytes     64 heads, 32 sectors/track, 14883 cylinders     Units = cylinders of 2048 * 512 = 1048576 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x23ff8244             Device Boot      Start         End      Blocks   Id  System     /dev/sdc1               2         257      262144    b  W95 FAT32      I thought I could dd this USB partition and then manipulate the output in some way and burn it to a CD. Here is the file that resulted in that dd:               [root@pitfall ~]# file /tmp/dd_output     /tmp/dd_output: x86 boot sector, mkdosfs boot message display, code offset 0x3c, OEM-ID " mkdosfs", sectors/cluster 8, root entries 512, Media descriptor 0xf8, sectors/FAT 256, heads 64, sectors 524288 (volumes > 32 MB) , serial number 0xa740f5a9, label: "           ", FAT (16 bit)      I am not sure how to trick the device into thinking that the external CDROM drive is a USB stick. I imagine it will involve mkisofs in someway, but from what I can tell this command doesn't support vfat.      Here is the dmesg output for the external CDROM drive:               ISO 9660 Extensions: Microsoft Joliet Level 1     ISOFS: changing to secondary root     usb 2-2: USB disconnect, address 5     usb 2-2: new high speed USB device using ehci_hcd and address 7     usb 2-2: New USB device found, idVendor=1bcf, idProduct=0c31     usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1     usb 2-2: Product: USB to Serial-ATA bridge     usb 2-2: Manufacturer: Sunplus Innovation Technology.     usb 2-2: SerialNumber: FFFFFFFEDF102230086505     usb 2-2: configuration #1 chosen from 1 choice     scsi7 : SCSI emulation for USB Mass Storage devices     usb-storage: device found at 7     usb-storage: waiting for device to settle before scanning     usb-storage: device scan complete     scsi 7:0:0:0: CD-ROM            Slimtype DVD A  DS8A5S    WX13 PQ: 0 ANSI: 0     sr1: scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray     sr 7:0:0:0: Attached scsi CD-ROM sr1     sr 7:0:0:0: Attached scsi generic sg2 type 5


Bash script to signal a concurrently running instance (same script) about a condition and increment counter

### Background Here's what I want to achieve. I have a (potentially) long-running process. Now I have locking in place just fine and all is generally in order. However, since this is a scheduled job, the script will be executed again and again and again. In the real script I have, a file keeps track of that failure count. When it reaches a threshold a mail gets sent off to the admin, in case the original script became zombie or otherwise stuck. If the threshold is reached and the initial process that claims to have the lock doesn't live anymore, the lock is broken and an alternative text is sent to the admin informing about the condition. All of this is probably not really relevant to the problem, but I want to give the complete picture here. Whenever the threshold is reached, the failure count in the file gets reset and starts over from there. The original instance thus may or may _not_ get to see the failure count file. The original script instance that held the lock will (hopefully) eventually finish its job and exit. ### Question How can I implement a scheme whereby the "failed" instances that encounter the lock send a signal (I tried `SIGUSR1`) to the original instance and the original instance keeps track of how many times it was "pinged"? Here's the test script I came up with so far:               #!/usr/bin/env bash     LOCKFILE=/tmp/$(basename $0).lock     let COUNTER=0          function concurrent_run     {         let COUNTER=COUNTER+1         echo -e "\ncaught SIGUSR1 (counter = $COUNTER)"     }          if ( set -o noclobber; echo "$$" > "$LOCKFILE" ) 2> /dev/null; then         trap 'rm -f "$LOCKFILE"; exit $?' INT TERM EXIT         trap concurrent_run USR1         echo "I was first, going to sleep"         sleep 100000         trap - INT TERM EXIT USR1     else         LOCKPID=$(cat "$LOCKFILE")         echo "Lock already held by $LOCKPID"         [[ -n "$LOCKPID" ]] && kill -0 $LOCKPID && { kill -USR1 $LOCKPID; echo "... knock knock? ($LOCKPID)"; }         exit 1     fi     echo "End: $COUNTER"     exit 0      (the `sleep` is mimicking the long-running job the real script performs) I am testing on Linux and I have tried the name for the signal as `USR1` and `SIGUSR1`, both giving the same result (i.e. none).               builtin trap -l      gave me 10 as `SIGUSR1`, so I also tried a manual `kill -10 PID` on the `PID` of the original instance. Unfortunately I cannot get it to see the signal. What am I doing wrong? * * * ### How to test Start one instance of the script (I named it `sigtest`):               $ ./sigtest     I was first, going to sleep      Start a second instance of the script in another terminal, window, pane (same user!):               $ ./sigtest     Lock already held by 15360     ... knock knock? (15360)      Repeat ... Expected outcome in the first terminal (skipping empty lines):               caught SIGUSR1 (counter = 1)     caught SIGUSR1 (counter = 2)     caught SIGUSR1 (counter = 3)     caught SIGUSR1 (counter = 4)      * * * ### Bash version               $ echo $BASH_VERSION     4.1.5(1)-release


understanding lsof -i output with web browsing

Sorry, if my question is nooby, but i don't understand some output lsof command. I try to run lsof -i on my home machine(debian linux) and what i obtain (showed one line; my browser chromium was running)               # lsof -i     COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME     chromium- 2379   brenta   70u  IPv4  45006      0t0  TCP brenta.local:44023->stackoverflow.com:www (ESTABLISHED)      the man page explains about column NAME:               the local and remote Internet addresses of a network file;     the local host name or IP number is followed by a colon (':'), the port,     ``->'', and the two-part remote address.      I try to run this comman on the other machine (linux mint):               COMMAND    PID     USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME     firefox   2778   brenta  59u   IPv4 68476917      0t0  TCP NOT_MY_HOST:39812->stackoverflow.com:http (ESTABLISHED)      Why column NAME contains not my host, but the other machine in local network?


`git remote add` to home dir by `~` expression

I created git bare repository in my home directory like `~/git-repos/foo.git`. To add a remote repository I typed like `git remote add origin ssh://username@hostname:10022~/git-repo/foo.git`. But it fails with error `ssh: Could not resolve hostname hostname:10022~: Name or service not known`. If I replace `~` to `/home/username`, then it works fine. Is there way to use `~` expression for `git remote` with ssh protocols?


How to check if an USB device is present without lsusb?

I want to see if an USB device is present but I don't have lsusb. Is there another way to check if an USB device is present without having to use lsusb?


How to override configuration of a logrotate by another configuration

There is a log folder on my disk, whose rotation policy is as follows               "/mnt/foo/shared/log/*.log" {       # rotate the files daily       daily       # Save the last 7 days worth of logs before deleting       rotate 7       # missing file is not an error case - just ignore.       missingok       # this is important for the logs       copytruncate     }      There is a set of logfiles in the `/mnt/foo/shared/log` folder named `indexer_cron_1.log`to `indexer_cron_4.log` I want only these 4 files to be rotated for 14 days. How do I override this configuration? I thought of creating another configuration but the thought of duplicate rotations occured and I stopped this. I do not have a machine where I can test this before, hence asking here.


"debuild -S" changes debian/control

I'm trying to modify an nvidia-related package from the Ubuntu Saucy repositories. I change the Build-Depends: line, I run `debuild -S` to generate a source upload for my PPA, and... surprise, the Build-Depends line in debian/control reverts to the original. How is this possible and how do I prevent this insanity? I mean, in general, how can a package affect the input to its build process? This is similar to `gcc -o prog prog.c` being able to change prog.c. I don't know why Debian made source building so Turing complete -- or why anyone would take advantage of such misguided features.               dget http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-319-updates/nvidia-graphics-drivers-319-updates_319.60-0ubuntu1.dsc     dpkg-source -x nvidia-graphics-drivers-319-updates_319.60-0ubuntu1.dsc     # change the Build-Depends line     perl -pi.bak -e 's/(xserver-xorg-dev)/xserver-xorg-dev-lts-raring | $1/' debian/control     cp debian/control /tmp     debuild -S     diff debian/control /tmp/control # proving debuild changed debian/control


Odd behavior of software sources GUI in Ubuntu-based eOS (sources selected in the background)

Oddly enough, they all look unselected - I do not know that this is really true, but they look like they are not selected. ![enter image description here](http://i.stack.imgur.com/bgMj7.png) But most odd is that selecting them is impossible - as seen HERE. For a while this seemed to me like having something to do with this error (update duplicate source):               W: Duplicate sources.list entry http://security.ubuntu.com/ubuntu/ precise-security/restricted i386 Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_precise-security_restricted_binary-i386_Packages)     W: Duplicate sources.list entry http://security.ubuntu.com/ubuntu/ precise-security/main i386 Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_precise-security_main_binary-i386_Packages)      I have commented the entries involved in /etc/apt/sources.list and now `sudo apt-get update` gives no errors anymore. But the odd behavior continues. **In fact the cause>effect relation was the other way around: it was not the duplicates that created that behavior, but with each click on that check-boxes a source was added and in this way duplicates were created.** \- Eliminating them from the sources list through the GUI seemed inefficient because I was re-creating the duplicates in this way. Now I have eliminated all duplicates and the odd behavior is there. A vicious circle.


Fast access to often used document

For several applications I maintain my personal cheatsheets. I use them mostly for vim, latex, vim latex-suite and bash. For example, when I forget a key combination in vim, I browse to the directory where I the keep the PDF of my cheatsheet, and then I open it with Acrobat Reader. I have two monitors. I always work on the left, so I use the mouse to drag Acrobat Reader with the cheatsheet to the right screen. Then I close the file browser. This I do many times a day. Opening an extra window (the file browser) and dragging the window around is distractive and time consuming. How can I access my cheatsheets more efficiently? I suppose there are several ways, but I'm not that familiar with the features of GNOME 3. All suggestions are appreciated. Please also provide some clue of how to implement your solution.


~/.mysql_history size limit

My .mysql_history file size is limited to 300 lines. I would like to keep the mysql history unlimited. However, I couldn't find any way to do it (in man page, and in google) Can somebody please advise how to increase the size limitof .mysql_history from the default 300 to more (or unlimited) I am using Debian Wheezy


How to boot FreeBSD system with broken bootcode?

I have an HDD (or SSD, or flash drive) with FreeBSD installed on it, and somehow I broke the bootcode (first 446 bytes of MBR). How could I boot into this FreeBSD?


Launching nautilus file browser launches gnome desktop, how to suppress it

Currently I'm using `i3` window manager (but I guess that this applies to other non-standard window managers as well). Whenever I run nautilus it also starts a full screen desktop, which I have to close. Possible solution is to start nautilus with: `nautilus --browser --no- desktop`, which solves this problem only partially, as sometimes nautilus is launched automatically by other applications and in this case it would be launched without `--browser --no-desktop` options. Is there any gnome3 config option that allows me to suppress desktop launching?


Is there a Linux file permission that allows the app to read a file but not a user?

I need `/var/www/config/config.json` to be read by my app but not by users calling `myapp.com/config/config.json`. How would I do that?


USB keyboard doesn't work with Debian installer

I have a wired USB keyboard. I've written the latest netinstall Wheezy image on my USB pendrive (using `dd`). It boots but the installer doesn't recognize the keyboard! (The same pendrive works on my laptop) I am guessing my motherboard is no longer supported by this installer. How can I make the keyboard work with the installer?


Sequence of errors leads to init failure and subsequent kernel panic

We have one Redhat test server installed on Vmware ESXI. And when I boot the server it gave this error. ![enter image description here](http://i.stack.imgur.com/4b0Fo.png) How to solve this issue because due to this error it doesn't boot.


Using "preseed" to specify partitions in an ubiquity install

For some reason every time I start ubiquity and get to the manual partitioning, ubi-partman abruptly exits and drags ubiquity with it. ( Off a USB stick. ) I've read that there is a mechanism for specifying the partitions, formats and layout ahead of time using "preseed" files. Unfortunately I can't make head or tails of the documentation I have found. Can some please describe the process for and format for making and using preseed files to do an ubiquity install with the partioning scheme already described?


Thinkpad T420s Intel HD 3000 poor performance

just installed crunchbang, and find it a bit laggy so checked glxinfo and it seems that i have no OpenGL-Support:               OpenGL vendor string: Tungsten Graphics, Inc     OpenGL renderer string:      Mesa DRI Intel(R) Sandybridge Mobile      OpenGL version string: 3.0 Mesa 8.0.5     OpenGL shading language version string: 1.30     OpenGL extensions:`      could somebody please help me out, I googled but just don't get it, and don't know whats causing the Problem, or how to fix it...               sudo lshw -C video     PCI (sysfs)         *-display                           description: VGA compatible controller            product: 2nd Generation Core Processor Family Integrated Graphics Controller            vendor: Intel Corporation            physical id: 2            bus info: pci@0000:00:02.0            version: 09            width: 64 bits            clock: 33MHz            capabilities: msi pm vga_controller bus_master cap_list rom            configuration: driver=i915 latency=0            resources: irq:49 memory:f0000000-f03fffff memory:e0000000-efffffff ioport:4000(size=64)


Ubuntu 10.10 network connection cut down after few minutes of starting

Ubuntu 10.10 network connection works fine at the start, but few minutes later the network manager pops up a message saying `disconnected you are offline` and Chrome browser returns an error message like `name not resolved`. This works fine in Windows 7. It was fine too in Ubuntu, until I updated it with 300 MB worth of updates.


Remap keys on GNOME3.8 using xmodmap?

I want to remap some keys on my keyboard, specifically: page up key to home and page down to end. On previous versions of GNOME 3 I just created a `.xinitrc` file that contained:               cat .xinitrc      xmodmap -e "keycode  117 = End"     xmodmap -e "keycode  112 = Home"      and that was all. On GNOME 3.8.4 this file takes no effect, and I have to manually: `bash .xinitrc`, moreover `xmodmap` settings are lost when I restart gnome shell (which I do sometimes because of a GNOME 3 bug), and also are lost spuriously from time to time. What is the proper way to remap keys when using GNOME 3.8?


How can I find and replace with a new line?

I have a CSV delimited by commas and I want to delimit it by newlines instead. Input:               a, b, c      Output:               a     b     c      I've written Java parsers that do this stuff, but couldn't this be done with `vim` or some other tool? `sed` isn't working for me:               #!/bin/sh          # Start     cat > infile.csv << __EOF__     a, b, c     __EOF__     cat infile.csv     sed 's/, /\n/g' infile.csv > outfile.csv          cat outfile.csv


Fedora 18 VirtualBox Resolution Guest Additions

I've installed Fedora 18 64-bit guest into a VirtualBox VM running on a Max OS X host. Previously I've installed Fedora 17 and after installing guest additions from the RPM Fusion repo full screen mode worked by resizing to the same resolution as the host machine. However on Fedora 18 after installing guest additions and running in full screen mode the guest runs at 1024x768. The host is running at 1366x768. This results in two large black bars on the left and right of the guest when in full screen mode. Is there a way to alleviate this? Perhaps to get Fedora to run a custom resolution? **Edit** The root of the problem was that GuestAdditions was failing to install. After trying to build it manually and using the version from RPM Fusion I was unable to solve this. I've downloaded Fedora 17 and the version of GuestAdditions from RPM Fusion works fine with it.


how can I install flash plugin in Fedora core 3 machine?

Latest flash rpm and tarball has forsaken my machine with fedora core 3 OS. There are two browsers currently installed in the System. Firefox 2.0.x and Opera 10.11. Those two browsers do not display flash content. I tried to install the latest FlashPlayer plugin in the browsers. But Installing RPM displayed a list of missing dependencies. And even after I copied the libflashplayer.so file into the plugin path of the browsers they wont show me flash content. Since I am not permitted to upgrade the OS, which would result in loss of important data, I only want the earlier version of Flash player rpm or tarball for Linux(fedora Core 3).   1. From where can I find oldest FlashPlayer rpm or tarball, for Linux?   2. If it is not possible to install the flash plugin, then what are the other alternatives? Thanks.


how to make system service out of .jar file? (linux)

i wrote a little java server which i'm running on my CentOS 5 VPS server. currently i just ssh onto the server and start the jar through commandline. How an i turn this jar into a system service and set it such that it starts automatically when the system starts and also that it restarts automatically if it crashes?


Zenity refuses to work in background

I'm trying to create a background bash script which creates a popup in certain circumstances, however, my code only works when run manually in a terminal (e.g. not in the background). I've tried various things such as; `screen env DISPLAY=:0.0 su $USER -c 'zenity --warning --text "Warning message here"'` `screen zenity --warning --text "Warning message here"` I've spent hours trying various different things, and I feel like there must be a simple solution and I'm just missing something. Nothing I've tried works while the script is run in the background with cron. I'm running Lubuntu 12.04, LXDE. Any ideas to why I can't get it working?


What is the "mintsystem" service setting and when would I want to activate it?

In hunting around my GUI for a place to enable sshd I clicked on "Services" from the Administration section of the Linux Mint (16) menu. It opened a window titled "Service Settings" and inside it I came across a service called "mintsystem". Googling / Duck Duck Going produced references to the package, but no good descriptions of function. What does this service do? When would I want to enable it?


Is CDPATH behavior broken in bourne shell (/bin/sh)

I have the following script:               #!/bin/sh          mkdir -p /tmp/test/foo          cd /tmp/test          unset CDPATH     echo "TEST1: Current working directory: ${PWD}"     echo "TEST1: attempting to 'cd foo'"     cd foo     echo "TEST1: Current working directory: ${PWD}"          cd /tmp/test     CDPATH=/tmp     echo "TEST2: Current working directory: ${PWD}"     echo "TEST2: attempting to 'cd foo'"     cd foo     echo "TEST2: Current working directory: ${PWD}"      Which prints out:               $ ./cdpath.sh     TEST1: Current working directory: /tmp/test     TEST1: attempting to 'cd foo'     TEST1: Current working directory: /tmp/test/foo     TEST2: Current working directory: /tmp/test     TEST2: attempting to 'cd foo'     ./cdpath.sh: line 17: cd: foo: No such file or directory     TEST2: Current working directory: /tmp/test      However, if I run it as `/bin/bash cdpath.sh` there is no error, and the `TEST2` output is identical to `TEST1`. The error only occurs if I run it with `/bin/sh`. I haven't found any documentation about bourne and bourne again shells interpreting CDPATH differently: http://tldp.org/LDP/abs/html/internalvariables.html#CDPATHREF http://tldp.org/LDP/abs/html/internal.html#CDREF


My gnuplot-pdflatex plot script produces a pdf with a bug

I have written a script in bash to easily make gnuplot multiplots via the epslatex terminal and then automatically make a pdf file via pdflatex. However when I open the pdf file with evince (on Ubuntu 12.04) I get the follow error               In pixman_region32_init_rect: Invalid rectangle passed     Set a breakpoint on '_pixman_log_error' to debug      although the pdf is looking perfect. When I open the same pdf on Fedora with Okular no error pops up. When I keep the terminal open which I used to open the file, this error keeps popping up every 30 seconds or something which is extremely annoying. Could anybody point me out which might cause this error or how I can find it? I have no idea how to debug a pdf file, like the error message tells me. Nor have I any clue if this is coming from the gnuplot part of the script, or the conversion with pdflatex, or simply from evince itself. The script I used to make the plots is the following               filename=$(basename "$0")     file="${filename%.*}"          basedir=`pwd`          echo $file          gnuplot << ??          mpl_top    = 0.1     #inch  outer top margin, title goes here     mpl_bot    = 0.60    #inch  outer bottom margin, x label goes here     mpl_left   = 0.9     #inch  outer left margin, y label goes here     mpl_right  = 0.25    #inch  outer right margin, y2 label goes here     mpl_height = 1.5*2.4 #inch  height of individual plots     mpl_width  = 1.5*3.2 #inch  width of individual plots     mpl_dx     = 0.7     #inch  inter-plot horizontal spacing     mpl_dy     = 0.4     #inch  inter-plot vertical spacing     mpl_ny     = 2       #number of rows     mpl_nx     = 2       #number of columns          # calculate full dimensions     xsize = mpl_left+mpl_right+(mpl_width*mpl_nx)+(mpl_nx-1)*mpl_dx     ysize = mpl_top+mpl_bot+(mpl_ny*mpl_height)+(mpl_ny-1)*mpl_dy          # placement functions     #   rows are numbered from bottom to top     bot(n) = (mpl_bot+(n-1)*mpl_height+(n-1)*mpl_dy)/ysize     top(n) = 1-((mpl_top+(mpl_ny-n)*(mpl_height+mpl_dy))/ysize)     #   columns are numbered from left to right     left(n)  = (mpl_left+(n-1)*mpl_width+(n-1)*mpl_dx)/xsize     right(n) = 1-((mpl_right+(mpl_nx-n)*(mpl_width+mpl_dx))/xsize)          set term epslatex standalone color  ",bx," 17 dl 3  size xsize,ysize header '\usepackage{bm}'     set output "$file".".tex"          # General settings     set offsets     set autoscale     set size 1,1     set border lw 4     set tics scale 2,1     set macros          # define axis setting for all subplots     #set xr[0:600]     #set xtics 0,100,600 offset 0,0.3     set mxtics 2          XXX = "set xtics offset -0.3,0.3; set xlabel '\$\\\bm{\\\omega \\\textrm{(MeV)}}\$' offset 0.0,0.6"     NOX = "set xtics offset -0.3,0.3; unset xlabel"          # define y-axis setting for all subplots     set ytics offset 0.5,0.0     set mytics 2          YYY = "set ytics offset 0.5,0.0; set ylabel '\$\\\bm{\\\textrm{d}\\\sigma/\\\textrm{d}E_e \\\textrm{d}\\\Omega_e } \\\bm{(10^{-33}\\\textrm{cm}^2/\\\textrm{MeV})}\$' offset 1.5"     NOY = "set ytics offset 0.5,0.0; unset ylabel"          set multiplot           #--------------------------------------------------     #  set horizontal margins for first column     set lmargin at screen left(1)     set rmargin at screen right(1)     #  set horizontal margins for lasts row (top)     set tmargin at screen top(2)     set bmargin at screen bot(2)          unset label     set title "\$\\\bm{E_e=680 \\\textrm{ MeV, } \\\theta_e=60^\\\circ}\$" offset 6.0,-15.5          @NOX ; @YYY          set xr[0:550]          p "$basedir/fort.652" u 1:9 w l t "Shift",\       "$basedir/fort.652" u 1:10 w l t "Shift+CVC",\       "$basedir/elec_680_36.dat" u (1000*(\$5)):(0.001*(\$6)):(0.001*(\$7)) w yerrorbars lt 15 notitle          #--------------------------------------------------     #  set horizontal margins for first column     set lmargin at screen left(1)     set rmargin at screen right(1)     #  set horizontal margins for lasts row (top)     set tmargin at screen top(1)     set bmargin at screen bot(1)          unset label     set title "\$\\\bm{E_e=730 \\\textrm{ MeV, } \\\theta_e=37^\\\circ}\$" offset 6.0,-15.5          @XXX ; @YYY          set xr[0:600]          p "$basedir/fort.652" u 1:9 w l t "Shift",\       "$basedir/fort.652" u 1:10 w l t "Shift+CVC",\       "$basedir/elec_680_36.dat" u (1000*(\$5)):(0.001*(\$6)):(0.001*(\$7)) w yerrorbars lt 15 notitle          #--------------------------------------------------     #  set horizontal margins for first column     set lmargin at screen left(2)     set rmargin at screen right(2)     #  set horizontal margins for lasts row (top)     set tmargin at screen top(2)     set bmargin at screen bot(2)          unset label     set title "\$\\\bm{E_e=1108 \\\textrm{ MeV, } \\\theta_e=37^\\\circ}\$" offset 6.0,-15.5          @NOX ; @NOY          p "$basedir/fort.652" u 1:9 w l t "Shift",\       "$basedir/fort.652" u 1:10 w l t "Shift+CVC",\       "$basedir/elec_680_36.dat" u (1000*(\$5)):(0.001*(\$6)):(0.001*(\$7)) w yerrorbars lt 15 notitle          #--------------------------------------------------     #  set horizontal margins for first column     set lmargin at screen left(2)     set rmargin at screen right(2)     #  set horizontal margins for lasts row (top)     set tmargin at screen top(1)     set bmargin at screen bot(1)          unset label     set title "\$\\\bm{E_e=1299 \\\textrm{ MeV, } \\\theta_e=37^\\\circ}\$" offset 6.0,-15.5          @XXX ; @NOY          p "$basedir/fort.652" u 1:9 w l t "Shift",\       "$basedir/fort.652" u 1:10 w l t "Shift+CVC",\       "$basedir/elec_680_36.dat" u (1000*(\$5)):(0.001*(\$6)):(0.001*(\$7)) w yerrorbars lt 15 notitle          unset multiplot          ??          pdflatex -synctex=1 -interaction=nonstopmode -shell-escape $file     rm $file-inc-eps-converted-to.pdf     rm $file-inc.eps     rm $file.{tex,aux,log,synctex.gz}      And this should produce the following result (sadly I had to convert to .png) ![enter image description here](http://i.stack.imgur.com/U9lgu.png) PS: Any other tips to improve this script are always welcome!


Lose gnome3 wallpaper

My wallpaper is now white, the icons are displayed, but the app in parameters/background does not launch. In gconf, /desktop/gnome/background/picture_filename is set to a valid image (I can see my wallpaper when I'm under the Activity mode) I'm using debian testing updated today. Any clue? Need other Infos? See the ![screenshot](http://i.stack.imgur.com/0soMX.png)


How to completely hide stuff from a user?

I want to let some of my friends access my computer by making them user accounts. They will mostly access my computer by sftp and ssh, but they could also sometimes access it at my home. However I don't want them to be able to see all my file (not my personal files from my home directory, I mean files that reside outside of the user directory, like etc, lib...) I asked the question recently: OpenSSH, chroot user: Root need to own the user directory, is there any consequence? And the awnser that was given to me was that if I chroot the user, I will need to create a complete environment for every user. Is there a way to actually prevent users from going outside of their home directory and preventing them from an passing argument to a program like `cp` that would point outside of their home directory, or any way to actually keep my system private? What is the best solution? I want them to be able to fully use all my programs, but unable to copy or read files, or use programs to read or copy file outside of their home directory.


Can you change timestamp format for history command on tcsh

When I run `history` command (on tcsh), it only prints the TIME portion of the timestamp and omits the date:                3  15:07   echo $PATH      4  15:07   ls -la      In bash, you can use `HISTTIMEFORMAT` environmental variable to affect the timestamp forman printed by `history` command. E.g. `set HISTTIMEFORMAT="[%F %T %Z] "` Is there a way to do this in tcsh and if so, which version of tcsh is required? We have tcsh 6.17.00. Environment: Red Har Linux 4.4, but I assume the answer shouldn't be affected since `history` is a shell built-in and not OS-supplied binary.


Safenet Authentication Client Tools error when Reboot or restart the eTSrv- and pcscd-services

Command: sudo /etc/init.d/eTSrv start   * Starting eTSrv daemon eTSrv /usr/bin/eTSrv:  error while loading shared libraries: libeToken.so.8: cannot open shared object file: No such file or directory


How to use Caja (file manager) to organize files and folders online?

The default file manager of `Linux Mint 15 (Mate)` is `Caja`. In the about screen of `Caja`, it says: > Caja lets you organize files and folders, both on your computer and > **online**. My question is, how could `Caja` be used to organize files and folders online? Does it mean it can be used as an FTP client? ![enter image description here](http://i.stack.imgur.com/dvSEA.png)


Is the "computer:///" address only something symbolic, or can it be used somewhere?

I am using `Linux Mint 15 (Mate)`. When I double click the `Computer` icon on my desktop to see the available drives, the address bar of file manager (Caja 1.6.1) shows this address: `computer:///`. Is this address just something symbolic, or can it be used somewhere? (like in the command line, or whatever). And why does this address have three `/` characters? Why not two? Any specific reason behind that? ![enter image description here](http://i.stack.imgur.com/xSFcW.png)


Exposing NFS mount via USB

I know enough linux to be dangerous - apologies if my terminology is incorrect. I have an electronic drumkit that has USB into which I can plug a flash drive with MP3s on it. The drumkit has no network connectivity. This means whenever I want to play along to a new song, I have to unplug the flash drive, plug it into a computer on my network, copy the MP3 from my NAS to the thumb drive, and plug it back into the drumkit. This is clearly a hassle. I was thinking of getting a raspberry pi with wifi and mounting my music via NFS. I could then run a USB cord from the pi to the drumkit and....somehow have the drumkit "see" the contents of the NFS mount (would need to be FAT32, I'd imagine). Thing is, I don't really know how to do this bit. I'd imagine being able to mount the NFS at the USB mount point, so to speak, but that's probably naive. Can anyone explain what I'd need to be able to pull this off?


Is it safe to resize a partition while writing to it?

I'm working on a script for automatically setting up Amazon Linux servers. I create them with 100gb virtual disks, but the main partition is always 8gb. No problem, I call `sudo resize2fs /dev/sda1` at the start of the script to expand it to the full 100gb. The process is fairly slow, though. Later on in my script I download various tools and components and set them up. I was wondering if it's safe to do that in parallel with the resize. Intuitively it seems like it would not be safe to write to a partition that's in the process of getting resized, but I thought I'd ask in case there's some clever magic Linux does that makes this ok.


Configure port 1935 in iptables for media

On CentOs 6.4 I cannot connect to the media server from port 1935 only 5080. I have read you can edit the `iptables` files with following.   1. Open flle /etc/sysconfig/iptables:              $ sudo vi /etc/sysconfig/iptables        2. Append rule as follows:              -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport XY -j    ACCEPT        3. Save and close the file. Restart iptables:              $ sudo /etc/init.d/iptables restart      How would I specifically configure port 1935? The above seems to be open to all ports, is this correct? Do I replace XY with 1935?


What is "userdel --root?" supposed to do

On a GNU/Linux system, I found the following, (for me very confusing seeming entry) about an option for `userdel` in the German version of its man page: ![found this in the German version of man 8 userdelbut can't find this option in, say, English ](http://i.stack.imgur.com/3IO4D.png) I'm truly sorry, but I can't really provide you with a translation because a) I don't understand what it means (even with German as mother-tongue) and b) I don't understand what this option is supposed to do. I couldn't find anything on this option and begin to wonder it this really exists. How come?


When I type vim in terminal my bodhi linux complains emacs is not installed (bodhi linux)

jcress@jcress$  vim     The program 'emacs' can be found in the following packages:      * emacs23      * emacs23-nox      * e3      * emacs23-lucid      * jove     Try: sudo apt-get install <selected package>      I can't figure out why. I assumed something was wrong with .vimrc or ~/.vim so I moved these away from ~/ and still cant run vim. I'm running bodhi linux               jcress@jcress$  uname -r     3.8.0-19-generic               jcress@jcress$  type vim     vim is aliased to `emacs'


How to redirect HTTP request to different local web servers

I have a Linux machine and some applications are running web interfaces. I'd like to create a web server, opened to the Internet, in order to access these local web interfaces (or web interface on others local machines). Example, from the Internet:               http(s)://mywebserver/webmin  --> redirects to localhost:10000  (webmin interface)     http(s)://mywebserver/bitt   --> redirects to localhost:1234  (bittorrent client interface)     http(s)://mywebserver/httpd   --> redirects to localhost:88  (mini http server)     http(s)://mywebserver/ddwrt  --> redirects to 192.168.0.254:80  (dd-wrt interface) etc... Do you know a way to do this? I tried "pound" reverse proxy, but it doesn't work.


Installing video driver on Arch Linux

I have Arch Linux installed in console mode on an Intel-PC machine. My task is to write and run an OpenGL display program on the machine to check whether it meets the following conditions:   * It would take at most 10% of total CPU usage   * It would take at most 20% of total RAM Here are more info about the device:               uname -a          3.6.5-1-ARCH #1 SMP PREEMPT Wed Oct 31 .. x86_64 GNU/Linux      cpu MHz: 1866.717 RAM: 2GB Preemptible: YES               lspci -v | grep -i graphic*          VGA compatible controller: intel corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07) (prog-if 00 [VGA controller])     (same for Subsystem and Graphics Controller)      Now, what I want if to install the relevant graphics driver. However, I cannot do anything as it is run in console mode. It has no X window. I try ALT+F8 but it does not start X window. also tried startx,but I get               -bash:startx: command not found      Could anyone guide me how to install the graphics driver please. Considering that I think the kernel is compiled in preemptive mode.


why gentoo livecd can not detect the linked network card?

The original os is Ubuntu 12.04, machine has 4 network cards, and the first netcard is linked. If use `ethtool`, will get `Link detected: yes`. When I use `gentoo livecd` to start, and config network, I found in gentoo livecd, the network card is `Link detected: no` by ethtool, so I can't up the network, I have tried all the four network cards. I don't know why in gentoo livecd, the first network card is deteched not linked? Does it related to the network driver?


Is it possible to manually manage a Solid State Hybrid Drive?

I'm about to buy a new laptop which has a SSHD. It stands for Solid State Hybrid Drive, which means it has a big, regular HDD with a small, usually 8GB SSD to cache frequently accessed files. Now since I'm a Linux user and I want pure SSD speed, so I thought it would be awesome if I could detach the SSD from the HDD and use it completely separate. I've googled for this topic, but could not find anything useful. According to Wikipedia there is a standard to communicate with the drives separately, but I may have misunderstood. Does anyone know anything about this topic?


How do I create a bash script that sums any number of command line arguments?

How would I create a bash script that the user can use to sum any amount of command line arguments? For example, say my script is called sum:               sum 3      3               sum 3 5      8               sum 9 8 21      38 And so on.. I realize that I will have to loop through the command line arguments and increment them to the total, but I am not really sure how to do that. I am not sure how to reference say the 2nd command line argument to a specific variable or how to get the number of total command line arguments.


Insert a space before the first comma in a csv file

I have a huge CSV file which contains 100000 rows. However, I need to do some processing and so for that I need to have a single space before the first comma. My current data is something like below.               123456,5,4,3,2,1      I need a space before the first comma for some internal processing. So, after the command execution, I need the file to be like below.               123456 ,5,4,3,2,1      I tried the gawk command to get the first column alone using $1. However, $1 gives me the entire row. Is there another way to do the above task?


Can't create a minimal chroot jail

Was trying to create a minimal `chroot` jail. The steps followed was:   1. Created a folder `chroot`   2. Copied bash to the folder `chroot`   3. Run `ldd bash` to know the dependencies              ldd /bin/bash   linux-vdso.so.1 =>  (0x00007fff645e2000)         libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f9155f75000)         libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9155d71000)         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f91559e6000)         /lib64/ld-linux-x86-64.so.2 (0x00007f91561bb000)        4. Then I created folder like               ls chroot/          bash  lib  lib64          ls chroot/lib          x86_64-linux-gnu        5. When I run               chroot chroot/          chroot: failed to run command `/bin/bash': No such file or directory


Open file from particular position?

I was wondering, if you had a particularly large file, saying 64 MB, is it possible to figure out the physical hard drive location of the file, and then read bytes from a particular offset into the file? Let's say I'm interested in 100 bytes with an offset of 60 MB from the start of the file. I don't want the inefficiencies of the hundreds of disk seeks it would take to get from the start of the file to the end of the file if I used some application level seek() function. Is there a solution? Thanks so much!


Bugzilla email_in.pl script will take 111 hours to complete - how can I change that?

I have an old Bug tracking system, with about 20k bugs. We have installed a new bugzilla system, and part of the initiation will be to import all the bugs from the old system to the new. I am able to use the email_in.pl process to read a file from an NFS shared folder (where I can save my CSV-->single files. email_in.pl format http://www.bugzilla.org/docs/3.0/html/api/email_in.html bug fields format http://www.bugzilla.org/docs/3.0/html/api/Bugzilla/WebService/Bug.html#Create However, while testing, each execution of the script takes rouglhy 20 seconds - rough estimation will be 111 hours for the entire database to import. I am not very familiar with perl, and want to know is there a way I can actually make this happen in less time?   Has anyone had experiance with such? *to note: i see that bugzilla is NOT a known tag here. Bugzilla is NOT the main issue. It's pure perl


Trouble Installing APT on Centos 6 64 bit

Can someone help me get apt-get installed? I followed these instructions to try and install APT on Centos 6 64 bit:   1. wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm   2. rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt   3. rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm   4. rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm   5. **yum install apt** On step 5 I get this output and error:               Loaded plugins: fastestmirror, priorities, security     Loading mirror speeds from cached hostfile      * rpmforge: mirror.team-cymru.org     27 packages excluded due to repository priority protections     Setting up Install Process     No package apt available.     Error: Nothing to do      I'm a Linux newb, but I think I looked at the listing of packages here: http://pkgs.repoforge.org/apt/ and there is no Centos 6 64 bit package. Looking at their build logs it seems there is an error building for Centos 6.


Installing AMD GPU drivers on Fedora 18

How can I install the AMD graphics drivers on Fedora 18? I downloaded the driver from the amd website. I unpacked the driver and ran the "amd-driver- installer-catalyst-13.1-linux-x86.x86_64.run" script. But that gives me an error. During the installation I get this error:               Supported adapter detected.     Check if system has the tools required for installation.     fglrx installation requires that the system have kernel headers.  /lib/modules/3.6.10-4.fc18.x86_64/build/include/linux/version.h cannot be found on this system.     One or more tools required for installation cannot be found on the system. Install the required tools before installing the fglrx driver.     Optionally, run the installer with --force option to install without the tools.     Forcing install will disable AMD hardware acceleration and may make your system unstable. Not recommended.      Where can I find the kernel headers? I already did a yum install kernel- headers (kernel-headers.x86_64), but that doesn't solve the problem.


Running multiple nohup commands in background

Got two commands cmd1 and cmd2. Of the two, cmd2 takes longer to finish. Need to run cmd2 and then cmd1. Tried to run them in following way:               bash$ (nohup ./cmd2>result2 &) && nohup ./cmd1>result1 &      or               bash$ (nohup ./cmd2>result2 &) ; nohup ./cmd1>result1 &      But both time I can see cmd1 is not waiting for cmd2 to finish and result1 gets filled. How to make cmd1 run after cmd2 when both should be nohup process and run in background?


Variable expansion did not happen in /etc/environment

I changed the `/etc/environment` to add more directories to the `PATH` variable. But looks like `$PATH` in double quotes were not expanded and I could find any command from the shell and `/usr/bin/command-not-found` is run.               $ cat /etc/environment      PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"     PATH="$PATH:/home/user/technical/java/maven/bin"     JAVA_HOME="/home/user/technical/java/jdk7"      so from the tty,               $ echo $PATH     $PATH:/home/user/technical/java/maven/bin      why did not the expansion happen?


xrandr --pos doesn't do anything

I hooked up a tv to my linux computer. I noticed the screen was offset by about 200px to the right, leaving behind a black vertical strip on the left of the screen and cutting off a portion of the right of hte screen. So I executed the command `sudo xrandr --output VGA1 --pos -200x0` but all that did was blink the tv for a split second without changing anything. I tried repeating the xrandr with the --pos option on another computer. I noticed that the screen reposition as expected for just a fraction of a second before returning to it's original position. How do I get xrandr to re-position screens ? What's wrong with my commands?