title: configure web server in RHEL

text: I have installed Request tracker in my RHEL 5.6 system. The RT installation succeeded and I have also installed apache web server, mysql, phpmyadmin that is required for running the request tracker tool. However, in the final step, it is mentioned as, for opening RT we have to enter `http://serveripaddress/rt`. I have apache web server installed in my system. So, I am just typing `http://localhost/rt` in my system. However, it gives me a 404 page not found error. I believe it has something to do with the **rt_siteconfig.pm** file. The file's contents are as below.               # Any configuration directives you include  here will override     # RT's default configuration file, RT_Config.pm     #     # To include a directive here, just copy the equivalent statement     # from RT_Config.pm and change the value. We've included a single     # sample value below.     #     # This file is actually a perl module, so you can include valid     # perl code, as well.     #     # The converse is also true, if this file isn't valid perl, you're     # going to run into trouble. To check your SiteConfig file, use     # this comamnd:     #     #   perl -c /path/to/your/etc/RT_SiteConfig.pm          Set($rtname , 'test');          Set($Organization , "www.uta.edu");     Set($Timezone , 'US/Central');               Set($WebPath , "/rt");     Set($WebPort , 80);# + ($< * 7274) % 32766 + ($< && 1024));          Set($DatabaseUser , 'rtuser');     Set($DatabasePassword , 'rtuser');     Set($DatabaseName , 'rtdb');               1;      I believe the webPath parameter has to be modified. But am not sure what to edit in it. Can someone please guide me in the right direction? Update: There is a file as **rt.conf** which sets the RT script path as below in this file.               AddDefaultCharset UTF-8     Alias /rt/NoAuth/images /usr/local/rt/share/html/NoAuth/images/     ScriptAlias /rt /usr/local/rt/sbin/rt-server.fcgi/          DocumentRoot /usr/local/rt/share/html     <location /rt>            Order allow,deny            Allow from all            Options +ExecCGI            AddHandler fcgid-script fcgi     </Location>      When I just run `localhost` I am getting the test page successfully and it specifies the **welcome.conf** file needs to be disabled, in case I do not want the test page. The **welcome.conf** file is present in the same path as the above **rt.conf** file. The path is `/etc/httpd/conf.d/` **Update 2:** The **error_log** file inside `/var/log/httpd` has the below line.               [error] [client 127.0.0.1] File does not exist: /usr/local/rt/sbin/rt-server.fcgi/      However, I do have the file rt-server.fcgi inside the above path. **Update 3:** The rt.conf file which is a configuration file for starting the RT is as below.               AddDefaultCharset UTF-8     #Alias /rt/NoAuth/images /usr/local/rt/share/html/NoAuth/images/     ScriptAlias /rt /usr/local/rt/sbin/rt-server.fcgi/          DocumentRoot "/usr/local/rt/share/html"     <Location /rt>            Order allow,deny            Allow from all            Options +ExecCGI            AddHandler fcgid-script fcgi     </Location>


title: How to uninstall omniORB 4.1.7 after installing from make?

text: I'd like to uninstall a copy of omniORB which I installed by running               make install      Any tips on how to do this operation? I tried               make uninstall      but the project does not have such a target. I googled for an answer and searched through the omniORB user's mailing list. The closest search results are               [omniORB] make clean     http://www.omniorb-support.com/pipermail/omniorb-list/2001-July/018714.html      in which David Byron (dbyron at coactive.com) in 2001 asked if anyone would be interested in a 'make uninstall' target.               [omniORB] omniORBpy-2.7 AttributeError     http://www.omniorb-support.com/pipermail/omniorb-list/2006-November/028191.html      in which the omniORB project maintainer Duncan Grisby (duncan at grisby.org) in 2006 had this interaction               > Would it be a good idea to add an 'uninstall' option to the Makefile?     Yes, but the makefiles are hairy and complex, and it's not trivial to     add an uninstall. If you want to produce a patch, I'll happily accept     it.


title: How to send command output to GNU Screen's copy mode buffer

text: Is there a way to send the output of a command to a GNU Screen's copy mode buffer. I'd like to type something like this:               $ echo 'this is an example' | screen_send_to_copy_mode      or, maybe `C`-`a` `Some key` and then, after that, when I pressed `C`-`]` I would get `this is an example` as an output. Is it even possible?


title: How to install Okular under SUSE (on a server)?

text: I would like to install the pdf viewer Okular on a SUSE Linux Enterprise Server 11. I am familiar with `apt` under Ubuntu, but on SUSE, I only found `rpm` to install `.rpm` files. I am wondering how Okular (or essentially any other program) can be installed? I know Okular is KDE, but I saw it here so I hope it is possible to install it (I hope this is not a ridiculous question).


title: Unable to get Gnome desktop after installing from CentOS 6.5 minimal

text: I have just installed CentOS 6.5 minimal. The reason I installed the minimal version is that the full version had ISOs of over 3GB each and my CD-RWs can only told about 750 MB. I would like a graphical desktop. I tried               sudo yum update     sudo yum groupinstall basic-desktop desktop-platform x11 fonts      and they both ran without any errors. However, when I tried to run the desktop using               sudo gdm      and it just hung in the command line. When I tried               gdm      I got               ** (gdm-binary:2164): WARNING **: Failed to acquire org.gnome.DisplayManager: Connection "1.37" is not allowed to own the service "org.gnome.DisplayManager" due to security policies in the configuration file           ** (gdm-binary:2164): WARNING **: Could not acquire name; bailing out


title: GNU Stow: How to stow only selected files/folders?

text: Let's assume the following structure of a folder called `scripts`.               ├── scripts     │   └── .scripts     │       ├── script1     │       ├── script2     │       └── script3     │   └── .config     │       ├── script4     │       ├── script5     │       └── script6      When using `stow scripts`, both folders within `scripts` will be symlinked to `~/.scripts` and `~/.config`. Can I use stow to only symlink `.scripts` without having to remove `.config` from the folder but just basically ignoring it?


title: Check compatibility with Linux before installing

text: I have a new computer, more precisely an _Asus N750J_ , and I would like to check the compatibility of the hardware with Linux before installing (dual boot is the plan), to be prepared and prevent problems and disappointments. I have already seen that I'll probably need to install _Bumblebee_ , but I don't have a specific checklist so that I can be sure I'm ready to go for the installation. I'd like to do this as fast and painlessly as possible. The plan is to install _Debian_ , I don't have a strong preference on _Debian Stable_ or _Testing_ (probably _testing_ will be a better option). The details in italics are specific for my case, but I think this is probably a fairly general question. Detailing the answer may be unfeasible for a site of short answers as SE, if so, please provide references or pointers to general guidelines. If there are details missing or the question has to be modified to suit better the format please tell me and I'll change whatever needs to be changed.


title: Ubuntu 14.04 login into desktop by single user mode

text: My OS is Ubuntu 14.04 64-bit, and kernel is 3.13.0-30-generic. I forget my user account password and now want to get into GUI desktop. I know from the Internet that we can reset password by single user mode. Usually this is done by editing grub2 items, like this "How do I boot into single-user mode from GRUB?", and this "Ubuntu 12.04 Grub to boot into single user mode " From the links, I can renew account password under shell, reboot, and login into desktop with the new password. But I don't want to renew the password, I simply want to login to the desktop. I have tried the command `startx` but it failed giving the following error:               error in locking authority file .Xauthority      I have searched the directory "root" and found no such file. How can I achieve my goal? Is it possible? * * * EDIT: Single user mode runs at level 1 which is text mode. If I need X window, Linux must run at level 5. So I cannot get into GUI desktop at single user mode. But why I cannot use command startx at single user mode, remains to be solved. * * * EDIT: I am at root text mode (at runlevel 1 of course) now through the reference link above. I can change any password now and reboot into GUI. But I would like to get into GUI by a "GEEK" way. That is bypassing the login screen of GUI and get there directly without password.


title: remove special character from files in directory

text: I need to remove special characters from all .htm files in a directory. Ideally I need to keep the file name but if I have to I can copy each file to 1 or something like that.   Here is the command I need to run on each file: tr '\015' '\n' < $filename > $filename.1


title: How to prevent users from renaming files while providing write permissions on Linux

text: For some special purpose, I want to prevent non-root users of the Linux Server from changing or renaming the filenames. However, they can modify and write to the contents of the file. How to do this from command line.


title: rsync on a very large directory

text: I'm trying to rsync a partial clone of mavencentral using rsync. The problem is, due to ridiculous network policies, I can only have the copy running during business hours. The process will be cut off before it has a chance to finish. When I run the same rsync command again, it will start from the top, looking for diff'd files, and never get to the end and actually start transferring files.               rsync -avP -e ssh user@server:/directory/for/maven .      It will start going through the tree no problem, but not transfer any files past the first attempt. It's just very slow to catch up to where it was. Any suggestions for resuming an rsync after it has closed?


title: How can I rewrite with apache mode_rewrite an entire directory?

text: I need this URL/directory `make/lores/some/` to point/map to `login/` I also need to rewrite `.php` extensions to `.html` ### Example When the client types in `example.com/make/lores/some/login.html` the server should `process example.com/login/login.php`. I have rule below but the issue is that the other files under the login directory ( e.g. `/login/images/one.png` etc.) are not handled/rewritten so I end-up with a 404 error.               RewriteRule     ^(.*)\.htm$     login/index.php [NC]


title: How do I start all shell sessions in a directory other than $HOME?

text: When I open my non-login shell in Ubuntu, my present working directory is `/home/user_name` (my `$HOME` environment variable), but I want to change this such that when I start my terminal I am in some other directory. I have read that when I start my terminal in Ubuntu a `.bashrc` file is sourced. So I added               export HOME=/home/user_name/Documents       to my `.bashrc` file. Now, when I open my terminal I am still in `/home/user_name` directory. How can I change this?


title: .profile is not sourced in Debian Wheezy LXDE

text: I add `$HOME/bin` to `$PATH` from `~/.profile`. However, it seems it is not sourced during login. I use a login manager - `lxdm` I think, and not `startx`. I know this matters as to which scripts are executed. To illustrate, see how the `$HOME/bin` is added after I explicitly source `~/.profile`. But shouldn't it have been sourced during the graphical login?               sashoalm@aspire:~$ echo $PATH      /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games     sashoalm@aspire:~$ source ~/.profile      sashoalm@aspire:~$ echo $PATH      /home/sashoalm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games     sashoalm@aspire:~$


title: Why whould xterm behave differently than x-terminal-emulator when it points to the same executable?

text: > lrwxrwxrwx 1 root root 14 Apr 19 14:36 /etc/alternatives/x-terminal-emulator > -> /usr/bin/xterm Running it using these 2 calls:   * `/usr/bin/xterm`   * `/etc/alternatives/x-terminal-emulator` First starts with black background and other starts with white. What are possible reasons that is it not the same configuration? How to debug it?


title: Find out a package's configure/compile options in Gentoo

text: On a Gentoo Linux box which I'm not administering (and to which I don't have root access), how can I find out the options which were used to compile the package? (Please note I've never worked with Gentoo before, but have good working knowledge of Debian-based distros)


title: python xml parsing

text: I have to delete particular tags from an xml file. Sample xml below.                      <data>               <tag:action/>             </data>      I want to delete all contents between data and /data. The XML tags are not displayed in the question after posting. I am able to do this by using remove() method in Python ElementTree xml parser. I am writing the modified contents to a new after the deletion of the element.               tree.write('new.xml');      The problem is that all the tag names in the original xml file are renamed to `ns0`, `ns1` and so on in `new.xml`. Is there any way to modify the XML file keeping all other contents in tact?


title: Encrypt multiple files at once

text: I'm writing a script which creates project archives and then creates 7z archives of them to make it easier on me to save specific versions and keep encrypted backups. After I've generated the archives and I get to the encryption phase, I'd like to encrypt the files with one call to `gpg` if possible, so as to only have the user input their passphrase once. Otherwise, we'd either have to cache the user's passphrase in memory (which I'd really like not to do) or have them input and confirm their passphrase for every single project that is archived (which is worse). Is there a way to pass multiple filenames to `gpg` to have it encrypt all of them in one go? If I try this:               $ gpg --cipher-algo AES256 --compression-algo BZIP2 -c project1.7z project2.7z      ...I see the following error in the shell:               usage: gpg [options] --symmetric [filename]      Is there a way to do what I'm looking to accomplish?


title: How to prevent atd from running past jobs?

text: The at daemon is a great tool! However, if a job is scheduled for 8:00 am and the machine is off at that time, at will run the job whenever the machine is booted. What I would like to do is stop it from running the job if the time is past. I have searched the man pages, and online, but either there is not an answer or I could not find one. I am using Arch, but as far as I know at is very similar across distributions. Any help is much appreciated!


title: Preparing USB drive for Kali Linux

text: I'm new to Kali Linux. I want to install it on my PC which is already running windows 8. I know how to dual boot a PC. I'll be booting Linux from a USB device, but while creating a bootable USB drive, which file system should I choose? NTFS or FAT32 for the Kali Linux ISO file?


title: How to create a "Turn Off Screen" Action?

text: I recently moved to Elementary OS Luna. I especially use the Synapse Indicator launcher, because I like to work with my keyboard for everything. In Synapse and in the Synapse Indicator (and I believe, generally, in the Gnome dekstop and I'll dare saying in all Linux DEs) there are "actions". Among actions there is _Shut Down_ , _Restart_ , _Lock Screen_ etc. which can be run with Synapse and probably too from the command line. I would like to create an action for _Turn Off Screen_ (which is different from _Lock Screen_ ). How can I create this action and be able to launch it from Synapse?


title: How can I find out what options sudo is configured with?

text: Often when debugging issues with `sudo` I'll look at the options in the configuration file `/etc/sudoers`. However it can be difficult to know what options are enabled by default, since they're built into the executable, so they're typically absent from `sudo`'s config. How can I get a exhaustive list of all the options that `sudo` is going to use on a given system?


title: why cpulimit makes process STOPPED?

text: I'm running a python script which uses networkx package to run some algorithms on graphs. the script is               import networkx as nx     from networkx.algorithms.approximation import clique          G = nx.read_adjlist("newman_one_mode.adj")     print "the number of nodes in the graph is: " + str(G.number_of_nodes())     max_clique_nodes = clique.max_clique(G)     print "the clique nodes are: " + str(max_clique_nodes)      It takes a long time and has high cpu usage (99%), so I want to limit its cpu usage. I used cpulimit on this process to limit the cpu usage to 60%               cpulimit -p 29780 -l 60      however, when I use it, the process got STOPPED, as below               [lily@geland academic]$ python run.py     the number of nodes in the graph is: 16264          [1]+  Stopped                 python run.py      what is wrong and how to deal with such situations? thanks! **side information:** if I don't run cpulimit, the process runs for a long time and then got killed, I don't know why, maybe it is due to resource being used up.               [lily@geland academic]$ python run.py     the number of nodes in the graph is: 16264     [1]+  Terminated              python run.py     Killed


title: Using bash "double paren" arithmetic expansion, math fails with leading zero

text: I have a simple script that deals with hours and minutes. If I want to calculate number of minutes since midnight having a string s `hh:mm` I tried splitting string then doing `hh * 60 + mm` My problem is, while               $ (( tot = 12 * 60 + 30 ))     $ echo $tot     750      instead               $ (( tot = 09 * 60 + 30 ))     bash: ((: tot = 09: value too great for base (error token is "09")      As far as I understand string `09` is not to be intended as a base 10 number. Is there a better way than simply removing leading zeros in string?


title: US International Keyboard Layout not behaving as expected?

text: Perhaps my question is related to this one. I use to use the English US International Keyboard with Alt-Gr Dead Keys (as far as I remember. This layout allowed me to write _é_ by pressing _R-Alt+'_ and then _e_. I migrated to EOS Luna and now, no matter what English US International keyboard I may use, _R-Alt+'_ prints _'_ and to get _é_ I need to press _R- Alt+e_. Has the layout changed? Is it a bug in EOS? Or do I need another layout? Here below are the various layouts under English US available on eOS: ![enter image description here](http://i.stack.imgur.com/11HsZ.png) `xev`, on pressing AltGr+ ' returns:               KeyPress event, serial 29, synthetic NO, window 0x3600001,         root 0xac, subw 0x0, time 22275171, (752,335), root:(753,407),         state 0x0, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,         XKeysymToKeycode returns keycode: 92         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyPress event, serial 32, synthetic NO, window 0x3600001,         root 0xac, subw 0x0, time 22275456, (752,335), root:(753,407),         state 0x80, keycode 48 (keysym 0x27, apostrophe), same_screen YES,         XLookupString gives 1 bytes: (27) "'"         XmbLookupString gives 1 bytes: (27) "'"         XFilterEvent returns: False          KeyRelease event, serial 32, synthetic NO, window 0x3600001,         root 0xac, subw 0x0, time 22275527, (752,335), root:(753,407),         state 0x80, keycode 48 (keysym 0x27, apostrophe), same_screen YES,         XLookupString gives 1 bytes: (27) "'"         XFilterEvent returns: False          KeyRelease event, serial 32, synthetic NO, window 0x3600001,         root 0xac, subw 0x0, time 22275566, (752,335), root:(753,407),         state 0x80, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,         XKeysymToKeycode returns keycode: 92         XLookupString gives 0 bytes:          XFilterEvent returns: False


title: NAS OS that will sync to MS Sharepoint?

text: Right now I'm using FreeNAS for my NAS, but I want it to sync with Microsoft Sharepoint so that there are multiple points of access for my users. Is there an operating system I can put on my NAS that will sync nicely this way?


title: Is there any equivalent to the atempo ffmpeg audio filter but for avconv to speed up video(and audio)?

text: As noted here, we could speedup audio with `ffmpeg` using               ffmpeg -i input.mkv -filter:a "atempo=2.0" -vn output.mkv      But on `Ubuntu`, `ffmpeg` is replaced by `avconv`, and the `atempo` filter is not available in `avconv`. My question is:   1. Are there any alternatives to the `atempo` filter to use with `avconv`, or how to speed up audio AND video using `avconv`?   2. How to speed up a video file (if you have better ideas)?


title: Which filter configuration in kernel rate limit the outgoing packets to 1packet/sec?

text: Which net filter in kernel configuration other than iptables enable rate limiting on the outgoing packets on ethernet port?


title: Incorrect output from cp, rm, and so on

text: When I run, say, `cp`, I get output like the following:               # cp -v Foo Bar     âFooâ -> âBarâ      What's up with the weird `â` characters? Why is the shell doing this? It looks like some kind of strange encoding issue. When I use PuTTY, I get `â`. When I log into the actual machine locally, I get `?` in inverse-video. If I redirect `stdout` to a file, copy that to my Windows machine, and open it, I get some random combination of characters until I tell me text editor to pretend the file is UTF-8. And then I get propper open- and close-quotes.


title: Linux memory usage?

text: We have 1TB of memory on a server which hosts an SAP application. When the app is running the memory usage shown in `top` is around 700GB. When the app is stopped the memory usage shown in `top` comes down to 10GB. A reboot of the server gets the memory usage to 1GB.   * Even though no application is running, why does `top` show 10GB used and gains 9GB after reboot?   * Is it possible to gain that 9GB without a reboot? Output of `free -g`:               free -g                       total used   free shared buffers cached      Mem:              1009  567   442    0      0     152      -/+ buffers/cache:      415   594      Swap:              1     0     1


title: Background selection menu crashes in GNOME 3

text: I'm using Debian Jessie with GNOME 3. When I started using GNOME 3 I had no problem changing the background image, and I did it a few times. But one day the menu started crashing. When I open the menu (through the system settings or through right click on the desktop) it appears for about half a second and then it disappears again. No matter how I do it, the menu crashes. How can I fix it or change my background image?


title: Configuring VMware 7 Workstation on Fedora 20 x86_64 KDE

text: When I first time around installed VMware, it Installed successfully and when I ran the program it got me to where you have a dialog box to select the kernel module, now when I install it the program doesn't get past "Sorry - KDE su": ![enter image description here](http://i.stack.imgur.com/S6zZU.png) The error is:               Cannot execute command ' ''\''/usr/bin/vmware-modconfig'\'' --icon='\''vmware-workstation'\'' --appname='\''VMware'\'' --gcc='\''/usr/lib64/ccache/gcc'\'' --headers='\''/lib/modules/3.13.6-200.fc20.x86_64/build/include'\'' --gcc-ignore-minor ''.      ![enter image description here](http://i.stack.imgur.com/Py68c.png) I tried to take the extra symbols out and run the command in the Terminal but it didn't build. Here is the kernel:               ~]$ uname -r     3.13.6-200.fc20.x86_64      Here is kernel-devel               Installed Packages     kernel-devel.x86_64                   3.13.6-200.fc20                   @updates      ![enter image description here](http://i.stack.imgur.com/OVDsz.png) Anyone got any idea what to do, is there a patch that I am suppose to install?


title: What's the easiest way to set up a 2-hour alarm?

text: I want my computer to play some given .mp3 every 2 hours. I want it to run at startup, and be modifiable with a given .conf file. The choice of .mp3 will also be in the .conf file. The reason is, I need this to remind me to eat regularly. Now, I'm familiar with C, but I don't know anything about daemonising C programs. I'm also not very familiar with CRON, so if that's an option, I'd need further instruction. What is the easiest way to do this?


title: Rename multiples files using Bash scripting

text: I want to rename multiple files in the same directory using Bash scripting. Names of the files are as follows:               file2602201409853.p     file0901201437404.p       file0901201438761.p       file1003201410069.p       file2602201410180.p      I want to rename to the following format:               file2503201409853.p     file2503201437404.p       file2503201438761.p       file2503201410069.p       file2503201410180.p      I was reading about the rename command, and try to do it this way, but it does nothing, I think I have questions about the syntax. Then I read that you can make a loop using the mv command as follows:               for file in cmpsms*2014*.p; do         mv "$file" "${file/cmpsms*2014*.p/cmpsms25032014*.p}"     done      But I can not rename the files. What am I doing wrong?


title: Sanity check/cleanup for swap -- essentially mkfs.swap

text: Occasionally I'll have a system crash or be forced to do a cold reboot. Upon rebooting I will get a kernel crash. Get out a rescue disk, rebuild swap, then everything boots fine. The thing is that I use `mkswap` to to rebuild swap, which I feel makes my job so much harder and more dangerous. Is there a way to run a sanity check on swap space and clean it up similar to what `mkfs` does?


title: Export format of gpg

text: What is the binary _export / import_ format used by`gpg` for **public** and **private keys**?


title: Fedora "disk full", df, du (gui) confirm but gparted shows the partition is big enough

text: I am running a fedora Virtual machine and after much pain I managed to extend my virtual machines .vdi, from 20gb to 40gb. However it appears my pain is not over. The machine still complains of low disk space, still has many errors and the gui disk usage analyzer shows I am full and so does df. However gparted tells me I have 40gb on that partition. is it Virtual box weirdness? do i need to kick fedora in some way to refresh its known capacity? Please find attached a screen grab of all the relevant applications, let me know if you need more info. Thank you ![Sceengrab of info](http://i.stack.imgur.com/rMv7g.png)


title: Studio 12.3: language optional software package not installed

text: I installed the Solaris Studio 12.3 on Solaris 10 OS but when I check the version but it is showing below result. It is installed under `/opt/SolarisStudio12.3/bin` so why wrong path is coming. I defined the path in `.profile` after that I can see now the correct path when I check `$PATH` `/opt/SolarisStudio12.3/bin` but still it is showing same path for which `cc` and `cc -V` as below. Can anyone please tell me?               which cc     /usr/ucb/cc          cc -V     /usr/ucb/cc: language optional software package not installed


title: Debian user is not in the sudoers file

text: Accidentally removed my gnome desktop and am stuck in tty1. Trying to reinstall the desktop and keep getting the error "user is not in the sudoers file". Having trouble adding my user, new to debian and am not sure how to correctly open/edit sudoers from tty1 (or really how to edit files from cmd line for that matter if someone could please lend some specifics)!


title: sed couldn't flush stdout no space left on device?

text: What could be the reason for this error :               sed couldn't flush stdout no space left on device      This is come of the stuff that i am doing at last in my code               sed -n '/.*needs to be executed manually.*/{n;p}' "$ERR_LOG"*          sed -n '/.*have.*latest.*/{n;p}' "$ERR_LOG"* >> "$ERR_LOG"final.log               sed -n '/.*Phone type not recognised.*/p' "$ERR_LOG"* >> "$ERR_LOG"final.log               sed '/.*#/!{H;d;}     x;/\n.*Error/!d' "$ERR_LOG"* >> "$ERR_LOG"final.log               sed '/.*#/!{H;d;}     x;/\n%/!d' "$ERR_LOG"* >> "$ERR_LOG"final.log      sed is seraching through around 10 - 15 files of size=50-69 kb (approx) **EDIT 1** : This is the exact error :               sed: couldn't write 166 items to stdout: No space left on device     sed: couldn't write 201 items to stdout: No space left on device     All the hostnames processed     sed: couldn't flush /home/gocs1/LOG//sed6hkHBu: No space left on device     sed: couldn't flush /home/gocs1/LOG//sedM2dr4u: No space left on device     sed: couldn't flush /home/gocs1/LOG//sed6A8NWu: No space left on device     sed: couldn't flush /home/gocs1/LOG//sedbmkv3x: No space left on device     sed: couldn't flush /home/gocs1/LOG//sed42pjSx: No space left on device     sed: couldn't flush /home/gocs1/LOG//sedMKxrHy: No space left on device     Time Taken :     0 hour(s) 58 minute(s) 33 second(s)      what does this mean.                 /home/gocs1/LOG//sed6hkHBu      i have created the directory upto `/home/gocs1/LOG/` but the rest(`/sed6hkHBu`) is not created by me. **EDIT 2** : does `sed` or `sed -i` option creates files in tmp directory i had many files created in `/tmp/LOG` directory with one file of huge size(800 MB) also while the script was running.


title: Using kornshell or Perl to circumvent permissions needed by root

text: I have a problem where I need to change the ownership and permissions of one file that exists on more than 200 servers. I belong to 2 different groups and need to change the ownership from one group to another. I also need the permissions to be 644. This could be easily done if I had root access, but I don't. So instead I need to copy the file as one user and then remove the old file and then rename the recently copied file to the name of the old file. This becomes rather tedious, so I wanted to create a script to automate these tasks. I thought kornshell would do the trick but my script doesn't seem to be doing anything. Here is what I have so far: **lockhosts.sh**               #!/usr/bin/ksh     sudo su - oradba     cd config     chmod 644 hostenv.cfg     chown orainst hostenv.cfg     exit     sudo su - orainst     cd config     cp -p hostenv.cfg hostenv.cfgnew     rm hostenv.cfg     mv hostenv.cfgnew hostenv.cfg      I figured this would work because those are all the commands I need to run to successfully change the ownership/permissions of the file. All I need to do is change the hostenv.cfg file **from this** :               -rwxrw---- 1 oradba  dba  4433 May  1 21:43 hostenv.cfg      **To this** :               -rw-r--r-- 1 orainst dba  4433 May  1 21:43 hostenv.cfg      What can I do to fix my script? Also, if I need to build user prompts into my script to ask for passwords that is fine, but I thought the system would ask for me. Here is what happens when I try to run my script:               lockhost.sh      **My user is changed to oradba and nothing else happens...** Until I type exit...               exit          logout     chmod: changing permissions of `hostenv.cfg': Operation not permitted     chown: changing ownership of `hostenv.cfg': Operation not permitted


title: How do I create a RAM disk on Linux Mint?

text: I am running a package that adds data to the end of 140–300 files each time through the process. I'm thinking of moving the process to a RAM disk, and using `rsync` to copy it back when done. My goal is to reduce wear by eliminating disk head seeks. Will this work? If so, how do I go about creating the RAM disk?


title: avconv: converting raw mjpeg video to a viewable format

text: I'm using a Beaglebone Black (BBB) with a USB Webcam attached to it. The BBB is running the latest Angstrom release. At the moment, it is proving difficult for me to convert video that I capture to some playable video format (like mp4). My raw video is "output.raw", my command is:               avconv -f mjpeg -i output.raw -vcodec copy output.mp4      However I get an error:               output.raw: could not find codec parameters      I've tried other approaches, like using a raw YUV stream to convert but it fails on me as well.


title: Return to directory location prior to cd-ing to home directory

text: As is well known, `cd` without an argument changes one's current directory to their home directory. I am wondering if there is any way, after using the `cd` command like this, to return to the directory location one was at prior to running `cd`? Generalizing, is there any way of returning to a previous directory after one has `cd`-ed to another directory? It seems very possible that the answer to these two questions will be the same but in case it isn't I kept them both separate, because the first question is the main one I would like answered.


title: Remove only given strings from given column?

text:
INPUT:
FOOBAAR	FOOO	BAAR	2014-02-14 13:34	2014-02-17 13:34	2014-03-07 13:34
      OUTPUT:
FOOBAAR	FOOO	BAAR	2014-02-14 13:34	2014-02-17 13:34	2014-03-07 13:34
      Difference: the:                     and                     was removed only from the fourth column. **My question:** How can I remove only given strings from given column?               	      is the delimiter


title: OS X/Linux one-liner/script to find the largest recurring group of lines in a text file?

text: I have a log containing an execution trace where there is infinite recursion eventually terminating when the stack is too deep. There are enough lines and valid included recursion within the larger block of lines that it is difficult to identify the largest block that is recurring. There is nothing unique that would require me to filter out part of the line to make this determination. What is a good one-liner/script (in POSIX/OS X, but best if it can work in Linux and OS X) that, given a filename/pathname, could output only the largest set of lines that recur sequentially more than once? _Clarification: in my case the log file is 432003 lines and 80M:_               $ wc -l long_log.txt      432003 long_log.txt     $ du -sm long_log.txt     80  long_log.txt      _To create a similar input file, try this, thanks to the posthere for the method to create a file containing random words._               ruby -e 'a=STDIN.readlines;200000.times do;b=[];22.times do; b << a[rand(a.size)].chomp end; puts b.join(" "); end' < /usr/share/dict/words > head.txt     ruby -e 'a=STDIN.readlines;2.times do;b=[];22.times do; b << a[rand(a.size)].chomp end; puts b.join(" "); end' < /usr/share/dict/words > recurrence1.txt     ruby -e 'a=STDIN.readlines;20.times do;b=[];22.times do; b << a[rand(a.size)].chomp end; puts b.join(" "); end' < /usr/share/dict/words > recurrence2.txt     ruby -e 'a=STDIN.readlines;200000.times do;b=[];22.times do; b << a[rand(a.size)].chomp end; puts b.join(" "); end' < /usr/share/dict/words > tail.txt     cat head.txt recurrence1.txt recurrence1.txt recurrence2.txt recurrence1.txt recurrence1.txt recurrence2.txt recurrence1.txt tail.txt > log.txt     cat recurrence1.txt recurrence1.txt recurrence2.txt > expected.txt      _To result in:_               $ wc -l log.txt      400050 log.txt     $ du -sm log.txt     89  log.txt      _Then you should be able to do:_               $ recurrence log.txt > actual.txt     $ diff actual.txt expected.txt     $      _It is also ok if it recognizes the other same-length block instead, i.e._               $ cat recurrence1.txt recurrence2.txt recurrence1.txt recurrence1.txt recurrence2.txt recurrence1.txt > expected2.txt     $ diff actual.txt expected2.txt     $      _Would really like it to find the expected result in < 10 sec in OS X/Linux w/ a 2.6GHz quad-core Intel Core i7 and 16 GB memory._


title: Set a screen session name at the command prompt

text: I am trying to create a simple alias that will allow me to create a new screen and set its name simple by typing `newscreen {screenname}` where `{screenname}` is set at the prompt. For example, I would like to be able to create the following alias: `alias newscreen='screen -D -R -S {screenname}'` Then at the command prompt, type: `$ newscreen client` This would then start a new screen for me, and give it a name of `client` That way, I could resume the screen with `screen -r client`. Can someone point out to me the best way to do that. Thanks.


title: log file: only process entries older than "MMM DD HH:MM:SS"

text: I need to process my logfile `/var/log/mylogs.log`. I am only interested in the new entries, lets say, since `Jul 20 15:00:00` but the log contains older entries as well. Is there any simple way, how I could `cat` only entries older than certain date?


title: scp and file owner

text: What are the reasons that could make a change in a file ownership after `scp`'ing it from one server to another? The file ownership changed from ' _owner_ ' to ' _apache_ '. I used `scp -p` . The user ' _owner_ ' exists on both servers and has the same UID.


title: How to properly automatically/manually rotate log files for production Rails App

text: I am taking over administration for a server which has a custom made 3rd party Rails app. The app developer informed me that the ruby log files are getting large and pointed me to the following link: - http://stackoverflow.com/questions/4883891/ruby-on-rails-production-log- rotation The logs are located in /root/production/app/log. This folder contains several files which end in .log. The current log files are about 2GB in size and the folder also has archived log files with the format of "logname.log.2013_01_18.bz2". I tried searching the ssh command history to see if I can see which command was used to create the archive files, but the commands don't go back that far. I also ran "cat /var/lib/logrotate/status" but it doesn't look like logrotate did not rotate any logs from the above folder. Basically:   1. I would like to be able to run a command to rotate the logs manually and/or have the logs rotate automatically every Sunday night.    2. If I need to shutdown my rails app to rotate the logs, I have no problem with this as I have a maintenance window every Sunday night to perform this.    3. Finally, I am not sure if I should compress the log files weekly into bz2 or only compress the logs on a monthly basis for any rotated logs related to the previous month. This is mainly because I am not sure exactly how this app utilizes the logs and I have never utilized rails apps nor have I had to configure log rotation manually. At this moment I do need to keep all log files and not discard any. Any information on concerns related to rotating logs, such as backing up logs before attempting to rotate are welcome.


title: Poweroff or Reboot as normal User

text: To run the command `poweroff` or `reboot` one needs to be super user. Is there anyway I can run this as a normal user? I just don't want to `sudo` and enter my password every time I reboot or power off.


title: Automatically insert fold tags around visually selected text in vim

text: I have started to use `set foldmethod=marker`, because I find it more convenient to use rather than `syntax`. But it has the disadvantage of needing to write `// {{{ my title` and `// }}}` around any folding code candidate. It would be nice if I could select a part of code in visual mode, and call a command ( or some commands) that would insert the two markers before and after the selected code. Are there any way to do that in vim ?


title: Having Wirless adapter problems in BackTrack 5 R3

text: I am trying to get a wireless connection on BackTrack 5 R3, but as soon as I boot up the BackTrack VM, the light on the adapter turns off. Drivers are installed and the VM detects the USB device. I am using an Asus N-13 wireless adapter to connect. It works fine on Ubuntu 12.10 (my host), and Windows 7. However, when I boot the BackTrack VM the adapter light goes off. Here is proof of drivers and USB detection. lsusb               Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 002: ID 0b05:17ab ASUSTek Computer, Inc.      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root h      ifconfig               eth0      Link encap:Ethernet  HWaddr 08:00:27:9c:d5:dc                 inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fe9c:d5dc/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:758 errors:0 dropped:0 overruns:0 frame:0               TX packets:609 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:381917 (381.9 KB)  TX bytes:159317 (159.3 KB)               Interrupt:10 Base address:0xd020           lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:853 errors:0 dropped:0 overruns:0 frame:0               TX packets:853 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:299027 (299.0 KB)  TX bytes:299027 (299.0 KB)          wlan0     Link encap:Ethernet  HWaddr 08:60:6e:cd:f8:2c                 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)      lsmod               Module                  Size  Used by     nls_utf8               12493  1      isofs                  39187  1      vboxvideo              12511  1      drm                   183453  2 vboxvideo     vboxsf                 38096  0      dm_crypt               22236  0      snd_intel8x0           33017  0      8192cu                503302  0      snd_ac97_codec        104623  1 snd_intel8x0     ac97_bus               12602  1 snd_ac97_codec     snd_pcm                72878  2 snd_intel8x0,snd_ac97_codec     snd_seq_midi           13132  0      i2c_piix4              12983  0      snd_rawmidi            24215  1 snd_seq_midi     snd_seq_midi_event     14076  1 snd_seq_midi     snd_seq                50403  2 snd_seq_midi,snd_seq_midi_event     snd_timer              23911  2 snd_pcm,snd_seq     snd_seq_device         13817  3 snd_seq_midi,snd_rawmidi,snd_seq     ppdev                  12840  0      snd                    52787  7 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device     psmouse                72465  0      serio_raw              13027  0      joydev                 17161  0      lp                     13321  0      parport_pc             31867  0      soundcore              12534  1 snd     snd_page_alloc         13709  2 snd_intel8x0,snd_pcm     vboxguest             190596  5 vboxsf     mac_hid                13037  0      parport                34960  3 ppdev,lp,parport_pc     dm_mirror              21585  0      dm_region_hash         15035  1 dm_mirror     dm_log                 17871  2 dm_mirror,dm_region_hash     aufs                  162169  0      usbhid                 41119  0      hid                    79842  1 usbhid     pcnet32                40553  0       iwconfig               lo        no wireless extensions.          wlan0     unassociated  Nickname:"<WIFI@REALTEK>"               Mode:Auto  Frequency=2.412 GHz  Access Point: Not-Associated                  Sensitivity:0/0                 Retry:off   RTS thr:off   Fragment thr:off               Encryption key:off               Power Management:off               Link Quality:0  Signal level:0  Noise level:0               Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0               Tx excessive retries:0  Invalid misc:0   Missed beacon:0          eth0      no wireless extensions.


title: enable/disable NTP service on Ubuntu 12.04

text: Our application runs on Ubuntu 12.04 precise. On this server, we have both `ntpdate` and `ntp`. How to enable and disable `ntp` service on-demand? I tried               sudo update-rc.d -f ntp remove/default      and               sudo update-rc.d ntp enable/disable      , but when I reboot the server the `ntp` service starts running! I suspect `ntpdate` to start the `ntp` service on reboot. I removed the `ntpdate` package from one of my experimental server- then `ntp` didn't starts on reboot after issuing the command `update-rc.d ntp disable`. Is there a way to control this or is there way to permanently disable `ntpdate`?


title: Remote syslog command line Client

text: I use `logger` pretty regularly, but is there a FOSS command line tool for remote submission of syslog messages over the network? Right now, I have to configure a facility/priority pair to submit to a remote server on the `rsyslogd` side. I'd like to cut out the middleman and not have to modify my local syslog daemon's configuration. Does such a tool exist?


title: Openvpn clients can not access to LAN

text: Openvpn: clients connected to server = firewall; but can not access database in LAN I have 5 vlan:               vlan 2: 192.168.12.0/24     vlan 3: 192.168.13.0/24     vlan 4: 192.168.14.0/24     vlan 5: 192.168.15.0/24     vlan 6: 192.168.100.0/24 All are LAN had been connected to Switch cisco 3650 layer3. Switch Layer3 is connected to Firewall (CentOS 6.2 installed squid and shorewall 4); Firewall have eth0: 172.16.1.101 connected to modem:172.16.1.1; eth1: 192.168.99.99 connect to switch layer 3: 192.168.99.100 no switchport. VPN client connect and have IP class: 192.168.10.0/24. Now all traffic from LAN to Internet is normal, no trouble. When clients use openvpn connect to server successfull but cannot ping or access any computers in LAN. What have I done wrong?


title: Non-English Font

text: After changing keyboard layout by `setxkbmap`,If I typing something in an GUI apps, then it results in blank squares or dotted circle. Is there anything I am missing in LFS OS


title: Best way to upgrade vim/gvim to 7.3 in Ubuntu 10.04?

text: I have to use Ubuntu 10.04 at work, and cant upgrade it. I'm using Vim/gVim 7.2. I want to upgrade it to 7.3 (with Python and Ruby extension support). Which is the best way? Add an entry in `sources.lists` and install a 7.3 vim/gvim package from it, or build from source? What disadvantages would I have from each approach?


title: extracting "tag" information from git with a shell script

text: The vc bundle is a neat little package that extracts information about a git repo for easy insertion into a LaTeX document. It doesn't currently extract information about whether the current commit is tagged and what the tag name is. How would I edit the `vc` script to do this? And then how would I edit the `vc-git.awk` script to add an extra line to the generated vc.tex file? Presumably I want a line that looks like:               print "\\gdef\\GITTag{" Tag "}%"      but I need an earlier line that tells awk what `" Tag "` means? This isn't a question about LaTeX, it is about git, awk and bash...


title: Why doesn't dm-crypt handle write barriers properly?

text: One of the well-known properties of `dm-crypt` is that it does not handle write barriers properly and hence it requires turning off on-drive write cache to prevent corruption of filesystems. As far as I understand it is not shared by all other dm devices (like LVM w/out snapshoting). My question is whether it is an inherent property of `dm-crypt` for any reason (I cannot find any but it is possible) or is it simply not implemented (yet)?


title: How to change file permissions for newly generated files in largefiles directory of Mercurial?

text: I got some Mercurial repositories which are served by Apache over HTTP. But there is a dedicated user performing some automated tests, which needs to check out the repositories locally. Recently this started to fail, seemingly due to lacking rights for files in the largefiles subdirectory in `.hg`:               -rw------- 2 www-data www-data 6.3M 2012-01-02 17:23 9358b828fb64feb37d3599a8735320687fa8a3b2      Default umask should be 022. And I used the setgid settings for the directories in `.hg` according to the multiple committers wiki page, which does not cover `.hg/largefiles` though. However, as far as I understand it, setting the gid for this directory wouldn't solve the problem, that `hg` sets such restrictive rights on those files. My other user trying to access this repositories via the filesystem is also in the `www-data` group, thus an additional read right for group would be sufficient to solve my problem. How can I convince Mercurial, or the system to grant this right properly for new files? I am using: Mercurial Distributed SCM (version 2.1)


title: Gentoo default application for opening files

text: On my Gentoo box running without a desktop environment, every time I try to open a file the system tries to open it with Firefox. I understand that without a desktop environment "open file" cannot function correctly, but why is everything opened with Firefox? If I want to, can I change it to something else?


title: keyboard shortcuts only work with left super-key

text: I recently had to change the keyboard-shortcuts after updating my system. I had to use `dconf-editor` to manually set the shortcut from `<Super>+R` to `<Mod4>+R` in order to get them to work (see here). This does work when I press the right super-key together with the specified alphabetic key, but it does not work when using the left super-key. Also, the gnome-shell menu is set to show up when I press just the super-key, but it only shows up when pressing the left one. I'd like to have gnome-shell accept both the left and the right super-key for the shortcut, but I don't want to remap the menu-key (which is `<Super>` by default).


title: Unicode characters in uxterm and dwm statusbar

text: I would like to display Chinese characters in dwm's status bar. More specifically I would like the symbols to represent the different tags in dwm. Using an online converter, I found that the unicode representation for the symbols I want is:               憤怒     unicode: 憤怒      Putting the unicode characters directly into my `config.h` doesn't work, they don't even show up in `vim`. My locale is set to `ISO-8859-1` and I'm using the Liberation Mono font for dwm. What can I do to get those symbols up there? **EDIT** Following Mat's instructions and patching dwm, the patch command hangs. Running `strace`:               [max@prometheus dwm-6.0]$ strace patch -Np1 ../dwm-pango/dwm-pango/dwm-6.0-pango.patch      execve("/usr/bin/patch", ["patch", "-Np1", "../dwm-pango/dwm-pango/dwm-6.0-p"...], [/* 30 vars */]) = 0     brk(0)                                  = 0x1d52000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4713000     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=92801, ...}) = 0     mmap(NULL, 92801, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9dc46fc000     close(3)                                = 0     open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3     read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\25\2\0\0\0\0\0"..., 832) = 832     fstat(3, {st_mode=S_IFREG|0755, st_size=1983446, ...}) = 0     mmap(NULL, 3804112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9dc4152000     mprotect(0x7f9dc42e9000, 2097152, PROT_NONE) = 0     mmap(0x7f9dc44e9000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x197000) = 0x7f9dc44e9000     mmap(0x7f9dc44ef000, 15312, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9dc44ef000     close(3)                                = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46fb000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46fa000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc46f9000     arch_prctl(ARCH_SET_FS, 0x7f9dc46fa700) = 0     mprotect(0x7f9dc44e9000, 16384, PROT_READ) = 0     mprotect(0x61a000, 4096, PROT_READ)     = 0     mprotect(0x7f9dc4714000, 4096, PROT_READ) = 0     munmap(0x7f9dc46fc000, 92801)           = 0     brk(0)                                  = 0x1d52000     brk(0x1d75000)                          = 0x1d75000     getpid()                                = 10412     lstat("/tmp/po8GP02f", 0x7fffdc075210)  = -1 ENOENT (No such file or directory)     lstat("/tmp/pikSWXEs", 0x7fffdc075210)  = -1 ENOENT (No such file or directory)     lstat("/tmp/prB1wVgF", 0x7fffdc075210)  = -1 ENOENT (No such file or directory)     lstat("/tmp/pp27ATSR", 0x7fffdc075210)  = -1 ENOENT (No such file or directory)     rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTORER|SA_RESTART, 0x7f9dc4186cb0}, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGHUP, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGHUP, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGPIPE, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGPIPE, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGTERM, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGXCPU, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGXCPU, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGXFSZ, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGXFSZ, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGINT, {0x40cd90, [], SA_RESTORER, 0x7f9dc4186cb0}, NULL, 8) = 0     fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0     open("/tmp/pp27ATSR", O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600) = 3     fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)     fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4712000     lseek(3, 0, SEEK_CUR)                   = 0     fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9dc4711000     read(0,       Could I be missing something?


title: Locked out by pamd. Help!

text: I recently changed some `pamd` settings because I wanted my ssh keys unlocked at login. I followed the instructions at this wiki page. Ignoring the warning, I have become locked out (cannot log in with user account or even root also in safe mode). How can this be fixed? I have a live CD for arch linux, but I`m hoping a reinstall is not necessary.


title: Using google DNS in netcfg

text: how can I set up my netcfg profiles to use the google DNS servers? I've tried               IP = 'dhcp'     DNS = '8.8.8.8'      but that didn't cut it.


title: How to execute applications in existing X window from virtual console?

text: I run Debian Wheezy and have Xfce as my X-Window Manager on virtual console 7, which starts up automatically. Once I've logged on and I'm using the xfce interface, is it possible for me to press `Ctrl`+`Alt`+`F2` and move to another virtual console (non-X, console 2), and start an application in my, already running, x-session on console 7? Also, can I do this remotely: say I have a laptop running Linux with Xfce running at home. Can I start an application on that instance of Xfce over `ssh` from work?


title: Convert numeric string from file to exit code in shell

text: I'd like to grep /etc/password for a username and return the last two digits of a user-id number as the return code. This is because I have an application whose main way of interacting with other programs is something like `integer_variable = run("some command")` which picks up the byte value of the exit code of the command. I can do this using something like the following command               perl -n -e 'exit $1%100 if /^username:x:(\d+):/' /etc/passwd      Is there an equivalent using `awk` or some other standard utility?


title: Using a variable inside a sequence of commands in bash to supplement an existing string - syntax error or flawed design?

text: I'm using the following sequence of commands in my .bashrc file to alter the appearance of my linux terminal. It fills the screen line by line with a pattern made out of characters. There is no abstraction, the characters are from a **set** within the command itself:               for i in $(seq 1 $(expr $(tput lines))); do echo -en '\E[0;32m'$(tr -dc '",.o;:~' < /dev/urandom | head -c $(tput cols)); done; tput cup 1                                                                            -->the set      The main idea is to read 80 cols (bytes) from some random characters from the set, and to print that * number of lines. Now, I've run the following contributed script in order to explore adding new characters to the set. To maintain compatibility with the linux terminal I'm using, I've run this outside of X etc, with the following result: ![enter image description here](http://i.stack.imgur.com/QhKAm.jpg) I'd like to to use the available characters in the sequence above. So I took many of them and did the following, for instance with ◘:               echo -n ◘ | hexdump     0000000 97e2 0098     0000003     so the UTF-8 sequence is \xE2\x97\x98     I build all the sequences I need: \xE2\x95\x99, \xE2\x95\x9a to f, \xE2\x96\x90 to 93      So I simply add to my .bashrc file `A=$(echo -e '\xE2\x97\x98')` and `B=$(echo -e ',.o;:~')` and I modify my command sequence like this (i.e. `echo $A$B`):               for i in $(seq 1 $(expr $(tput lines))); do echo -en '\E[0;32m'$(tr -dc $(echo $A$B) < /dev/urandom | head -c $(tput cols)); done; tput cup 1       If I `echo` $A or $B at the prompt, it prints the char(s). But when the sequence is called in .bashrc this mostly doesn't work at all. On an entire screen ◘ appears 3-5 times total along with many placeholder chars meaning the output is not supported by the term. The other characters from the set are there. Of interest is that if I kept the original syntax with no $B variable and simply tried to add $A to the set i.e. `tr -dc '",.o'$A';:~'` I get the exact same sort of output, suggesting it's something else than syntax - because of /dev/urandom. Other variations on the syntax using quotations introduce more unrelated echo. As a side note, in xterm, the result is similar with different placeholder chars, and a few ☗ and ◗. Is there a way to bring the variable in the set like that or does this need to be redesigned from scratch to account for this case?


title: Software RAID 1 with dissimilar size and performance drives

text: _Background_ I was experimenting with a home server setup in a small box I had that was supposed to be a media centre but never found much use. I installed CentOS 6.5 in a software RAID1 configuration accross two similarly specced laptop hard drives I had salvaged from an old device. Both are 320GB and both run at 7200rpm with the same sized cache. The install went ahead perfectly and I was happy with everything however now one of the drives is reporting S.M.A.R.T errors. The only spare drive I have is a 5400rpm 1TB laptop drive. I dont need to rebuild the array and I will happily reinstall from scratch as the system hasnt been put to use yet but I dont wish to purchase a relatively expensive replacement 7200rpm 320GB drive. _Question_ Is there anything inherently wrong/dangerous/unreliable about setting up software RAID 1 across the non-faulty 320GB drive and a 320GB partition of the 1TB drive then using the remainder of the 1TB drive as an additional non- redundant storage partition, bearing in mind the different sizes and spindle speeds? Will the partioner let me do this? Note: I have browsed https://raid.wiki.kernel.org/index.php and it constantly refers to devices "of roughly the same size."


title: Install php_http on Arch Linux

text: First I installed the curl extension for PHP:               $ sudo pacman -S php-curl      and               $ grep curl /etc/php/php.ini     extension=curl.so      Then I installed the PHP PEAR               $ sudo pacman -S php-pear      Having now installed pear, I have also installed PECL, and should now be able to install the php_http extension.               $ pecl install php_http      and               $ grep http.so /etc/php/php.ini     extension=http.so      The http.so is found in the folder /usr/lib/php/moduels/ and latter copied to the folder /usr/lib/http/modules/ . Now, as far as I know, this should have installed the php_http extension, but when I try to               $req = new HttpRequest();      I get the error               Fatal error: Class 'HttpRequest' not found in /srv/http/webcrawler/nettocrawl.php on line 4


title: Why is `while IFS= read` used so often, instead of `IFS=; while read..`?

text: It seems that normal practice would put the setting of IFS outside the while loop in order to not repeat setting it for each iteration... Is this just a habitual "monkey see, monkey do" style, as it has been for this monkey until I read _man read_ , or am I missing some subtle (or blatantly obvious) trap here?


How can I print out information about a Wireless Access Point in range? Can I for example get the MAC address?


title: How to prevent my screens from dimming (going black) from the command line

text: In KDE, there was a system setting where you could specifically set the monitors to never go black. Now I've switched to dwm and (it might not be related) my screens dim after about 10 minutes. How do I change this setting directly from the command line? I'm guessing this has to do with X?


title: Grub not starting on recently Debian install

text: i recently install Debian 7.4.0 on my laptop. The problem is when i reboot my system it start on Windows 7 by default, i tried to boot again the Debian installer and my surprise was the boot USB load the grub screen, with the option to load Debian and Windows 7. But if i try without the USB it starts on Windows 7. What could i do here? Thanks!


title: How do I tell what program is asking for a password?

text: I'm getting an occasional "Authentication request" dialog from Gnome, and I don't know what program is asking or even which account it's talking about. ![enter image description here](http://i.stack.imgur.com/kkfQJ.png) [email redacted] is an email address of mine, but I've used that address for more than one account, and they all have different passwords. I don't know what it's asking for. This dialog tends to pop up when I unlock the computer after having been away for a while. I just click Cancel, and the dialog goes away for a while. I don't get any other message when I do that. I'm running Gnome 3.8.3 on Arch Linux. Note: After writing this question, I thought of checking Online Accounts in Gnome Settings. I noticed that it showed my Google account (under that email) as "credential expired". Is that what was causing it? I signed back in to my Google account, but it's too soon to tell if that fixed the problem. And I still want to know how to tell who's asking for my password (and for which account).


title: Journal commit I/O error for Seagate Expansion external USB hard drive

text: I am using Debian 7.6 (amd64) and for some reason when I am trying to read or write to my Seagate Expansion 1TB external USB drive, I am getting input/output errors ... Here is what the output of dmesg says:               [ 1761.587087] kjournald starting.  Commit interval 5 seconds     [ 1761.588775] EXT3-fs (sdd1): using internal journal     [ 1761.588788] EXT3-fs (sdd1): mounted filesystem with ordered data mode     [ 1797.015606] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.015641] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=23560211, block=94240771     [ 1797.015652] journal commit I/O error     [ 1797.018883] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.018938] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=23560249, block=94240773     [ 1797.020660] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.020722] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=22208553, block=88834052     [ 1797.020735] journal commit I/O error     [ 1797.022350] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.022399] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=1794049, block=7176194     [ 1797.022412] journal commit I/O error     [ 1797.024165] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.024211] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=17481746, block=69926915     [ 1797.024223] journal commit I/O error     [ 1797.024475] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.024524] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=17481747, block=69926915     [ 1797.024534] journal commit I/O error     [ 1797.025274] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.025314] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=17080585, block=68321298     [ 1797.025324] journal commit I/O error     [ 1797.025509] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.025544] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=17080589, block=68321298     [ 1797.025554] journal commit I/O error     [ 1797.026203] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.026247] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=122881, block=491522     [ 1797.026260] journal commit I/O error     [ 1797.027246] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.027295] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=7766017, block=31064066     [ 1797.032984] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.033043] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=4170273, block=16678948     [ 1797.033382] sd 6:0:0:0: rejecting I/O to offline device     [ 1797.033427] EXT3-fs error (device sdb3): ext3_get_inode_loc: unable to read inode block - inode=4170274, block=16678948     [ 1797.038642] sd 6:0:0:0: rejecting I/O to offline device      This happened both when it was formatted as ext4 and now as ext3. I'm worried that something with the new kernel 3.2.0-4-amd64 might be causing it, because the hard drive was working fine before, and is still readable/writable from other computers. Do any of you have suggestions on what might be causing this, or how I can go about debugging this?


title: Why do wmaker icons shrink?

text: I find myself spending too much time getting the wmakers icons right. When I start an application from the commandline I get an Icon, which I can attach to the dock or the clip. Good. However, when the application is not running, the icon shrinks to about half the size. The tile keeps its original size (48x48) but the image in it gets smaller. This small image does not look good. I can work around this, by explicitly specifying an icon (rightClick -> settings). But it just takes too much time to browse through all the available icons (unless there is a fast way I am not aware of). I would be happy if wmaker just kept the icon it originally displayed. Seems like I do not fully understand, how wmaker can display an icon of a running application just fine, but sometimes requires configuration, when the application is not running. So why do wmaker icons shrink and what can be done to avoid spending too much time in getting the icons right?


title: how to share environment variables between shells like globals related to a master pid?

text: So, I need to share environment variables between shells, and that the changes on the variables be promptly recognized by all shells, like global variables. But they must be related to a master pid, so I can have 2 shell scripts running, each being a master with same global variable name, and it childs will only change the variable related to their master pid. I use bash for scripting. _My current researches are these:_ **Modules**   I read I could use modules project for that: http://modules.sourceforge.net/, but I am having huge trouble trying to do it, it seems to lack examples? also "modules" is a too generic word, very hard to google about because mixes with many other things... after some weeks my hands are still empty.. **Simple text source file**   I read also I should use a simple text file to store/update/read variables from, as a source script file, using `flock` too to avoid concurrent writing. But there are problems related to doing that, like concurrent change of variable simultaneously by 2 shells. **Alternatively**   I am aware that after a "global" variable is read by the shell, it will keep that value until another read is made; and another shell may change it in the mean while too...   May be a very fast external application could provide such storage and we would not try to use environment variables as globals then? but my guess is any sql solution will be too slow..


title: Checking if Apache requires SSL pass-phrase

text: I'm thinking about restarting a client's Apache server, but I'm reluctant to do so because I know he's currently running HTTPS and I don't want to get stuck with the server prompting me for the SSL Passphrase (which I don't have and he's not sure if there is one or not). Is there a quick/easy way to check whether Apache will require the SSL pass phrase **before** restarting it?


title: Problem on running Script on host after connecting

text: I am new to linux scripting. Please help. I searched on below a lot but was not able to find appropriate answer : I am trying to make a script which I will later schedule as cronjob, so that it keeps running on backend and stores results in a file say test.txt Main points of script are below : it connects to a host through ssh and then runs a few commands on that host and saves the results in a file.The script is connecting to host successfully but not running commands automatically on host. Script is as below :                   #!/usr/bin/expect -f          spawn ssh aspen          expect "password: "          send "PASSWORD\r"          expect "$ "          send "/bin/sh /home/target/Script.sh >>test.txt"          expect "$ "          send "exit\r"      But when I run this script it doesn't save complete output on test.txt Second thing is I want this output file on my own system not on host . Any help will be appreciable.


title: Migrate socat init script to systemd

text: I use socat with following init script on debian 7.2 with sysVinit. It works perfectly:               #!/bin/bash     DESC=socat     DAEMON=/usr/bin/socat     LIB=/usr/lib/socat     SOCAT_ARGS="-d -d -lf /var/log/socat.log"          [ ! -f /etc/default/socat.conf ] || . /etc/default/socat.conf          . /lib/lsb/init-functions          PATH=/bin:/usr/bin:/sbin:/usr/sbin          [ -x $DAEMON ] || exit 0          #     #       Try to increase the # of filedescriptors we can open.     #     maxfds () {             [ -n "$SOCAT_MAXFD" ] || return             [ -f /proc/sys/fs/file-max ] || return 0             [ $SOCAT_MAXFD -le 4096 ] || SQUID_MAXFD=4096             global_file_max=`cat /proc/sys/fs/file-max`             minimal_file_max=$(($SOCAT_MAXFD + 4096))             if [ "$global_file_max" -lt $minimal_file_max ]             then                     echo $minimal_file_max > /proc/sys/fs/file-max             fi             ulimit -n $SOCAT_MAXFD     }          start_socat() {             start-stop-daemon --quiet --start \                     --pidfile /var/run/socat.$NAME.pid \                     --background --make-pidfile \                     --exec $DAEMON -- $SOCAT_ARGS $ARGS < /dev/null     }          stop_socat() {             start-stop-daemon --stop --quiet --pidfile /var/run/socat.$NAME.pid --exec $DAEMON             rm -f /var/run/socat.$NAME.pid     }          start () {             echo "Starting $DESC:"                  maxfds             umask 027             cd /tmp             if test "x$AUTOSTART" = "xnone" -o -z "x$AUTOSTART" ; then                     echo "Autostart disabled."                     exit 0             fi             for NAME in $AUTOSTART ; do                     ARGS=`eval echo \\\$SOCAT_$NAME`                     echo $ARGS                     start_socat                     echo " $NAME $ARGS"             done             return $?     }          stop () {             echo -n "Stopping $DESC:"                  for PIDFILE in `ls /var/run/socat.*.pid 2> /dev/null`; do                     NAME=`echo $PIDFILE | cut -c16-`                     NAME=${NAME%%.pid}                     stop_socat                     echo -n " $NAME"             done     }          case "$1" in         start)             log_daemon_msg "Starting socat" "socat"             if start ; then                     log_end_msg $?             else                     log_end_msg $?             fi             ;;         stop)             log_daemon_msg "Stopping socat" "socat"             if stop ; then                     log_end_msg $?             else                     log_end_msg $?             fi             ;;         reload|force-reload|restart)             log_daemon_msg "Restarting socat" "socat"             stop             if start ; then                     log_end_msg $?             else                     log_end_msg $?             fi             ;;             *)             echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart}"             exit 3             ;;     esac          exit 0      However after an upgrade to debian 7.4 the system changed to systemd. So to run the same script on systemd I added a service that wrappes the /etc/init.d/socat script:               [Unit]     Description=Socat          [Service]     ExecStart=/etc/init.d/socat start     ExecStop=/etc/init.d/socat stop          [Install]     WantedBy=multi-user.target      When I start the service it is started but stops directly: > Loaded: loaded (/usr/lib/systemd/system/socat.service; enabled)   >  Active: inactive (dead) since Fri, 18 Apr 2014 14:09:46 +0200; 4s ago > Process: 5334 ExecStart=/etc/init.d/socat start (code=exited, > status=0/SUCCESS) CGroup: name=systemd:/system/socat.service Am I missing something?


title: Clear unused space with zeros (ext3,ext4)

text: How to clear unused space with zeros ? (ext3,ext4) I'm looking for something smarter than               cat /dev/zero > /mnt/X/big_zero ; sync; rm /mnt/X/big_zero      Like FSArchiver is looking for "used space" and ignores unused, but opposite site. Purpose: I'd like to compress partition images, so filling unused space with zeros is highly recommended. Btw. For btrfs : Clear unused space with zeros (btrfs)


title: Check if a drive has been Zeroed with xxd and uniq?

text: I'm looking for a way to check if the entire binary contents of a USB device are purely 0s. I'm trying this command: `sudo xxd /dev/sdb | uniq` but it has no output and just runs forever. I've considered the Sort command, but my understanding is that it requires a file to read rather than just the standard terminal output. update: I realised I could check with `sudo xxd -a /dev/sdb`, but my question still stands: is there a way to uniquely sort output of the terminal without saving it to a file first?


title: Set terminal title within expect script

text: I use zsh as my shell, and I wrote an expect script to automate passing my password to ssh; it works perfectly, exept that the terminal window's title is set to the name of my script. I would like to set it to the name of the host I'm logging into, but haven't had any luck so far. I've tried, the following command within my expect script, but it doesn't work:               exec echo "\033]0;" $hostname "\007"      Any suggestions? Please do not suggest I setup ssh keys or that I download some other application to do this for me. I have my reasons for choosing this approach.


title: hunspell: add word to dictionary from command line

text: From hunspell man page:               ...         When in the -a mode, hunspell will also accept lines  of  single         words  prefixed  with  any of '*', '&', '@', '+', '-', '~', '#',         '!', '%', '`', or '^'.  A line starting with '*' tells  hunspell         to  insert the word into the user's dictionary (similar to the I         command).     ...      I tried something like: `echo "* my_word" | hunspell -a` but the word is not in my dictionary as parsing sample file again shows it as misspelled word How does this work, how can I add custom word?   Or with Aspell, or any "common" program that writes to compatible dictionaries read by Hunspell/Aspell?


title: Wiki for emacs users

text: I am looking for a new wiki software for a small private network. Since all users are very addicted to emacs, it would be nice to make everything "emacs compatible". What wiki software is most suitable for emacs users? In particular it should be possible to navigate in the wiki inside of emacs (follow links etc.) and have a good mode which supports the wiki syntax perfectly. It's also important to be able to save changes in emacs easily (perhaps even save changes before committing it to the wiki). The wiki software should also meet other requirements, so it woul be nice if you could give multiple suggestions for a good emacs integration.


title: Incoming Spam Mail to my mail id's in my website

text: I am getting lot's of incoming spam mail's to mail id's in my websites such as (info@domain.com, infouk@domain.com) mostly to info pages not to user's mail account. How to stop mail from such mail id's. I have exim mail server with `cpanel` and `whm` account.


title: phpcurl not able to install on terminal

text: I am not able to install packages `php` and `curl`. But its gives dependencies error, please check below               curl : Depends: libcurl3 (= 7.29.0-1ubuntu3.4) but 7.32.0-1ubuntu1 is to be installed     libcurl4-openssl-dev : Depends: libcurl3 (= 7.29.0-1ubuntu3.4) but 7.32.0-1ubuntu1 is to be installed                         Depends: libidn11-dev but it is not going to be installed                         Depends: libkrb5-dev but it is not going to be installed                         Depends: libldap2-dev but it is not going to be installed                         Depends: librtmp-dev but it is not going to be installed                         Depends: libssl-dev but it is not going to be installed                         Depends: zlib1g-dev but it is not going to be installed     E: Unable to correct problems, you have held broken packages.


title: What's wrong with this xargs command?

text: Consider the output:               % { echo one; echo two; echo three; } | xargs -I{} -L1 echo test-{}      test-{} one     test-{} two     test-{} three      Why doesn't `{}` get substituted as per the manual page (and my memory, too)? How to change the command line to get `test-one`, `test-two`, `test-three` lines as output?


title: VIM map not working

text: I'm trying to map `<c-y>,` (from zencoding-vim) to `<c-m>`. I tried:               map <C-m> <C-y>,     map <C-m> <C-y>,<cr>      But doesn't seems to be working. Maybe it's something with the comma?


title: rsync pattern copy: dotfiles

text: I followed the advice given in the question Rsync filter: copying one pattern only to setup a command line I need to backup only the dotfiles `.inF*` Yet with the command:               rsync -av --include='.inF*' --include='*/' --exclude='*' /0ale/ \        root@lambda2:/0ale/      I obtain that the directory structure gets mirrored, but no dotfile is copied. The same command with a test pattern               rsync -av --include='test*' --include='*/' --exclude='*' /0ale/ \         root@lambda2:/0ale/      correctly copies the `test1.txt` file so it is a problem with dotfiles only. Any hints?


title: What is the max partition supported in linux?

text: May i know the max partition size supported by an Linux system. And how much logical and primary Partition as we can create in an disk installed by linux system?


title: How to construct a read-only compressed modular filesystem

text: I am designing a Linux distro and was toying with the idea of creating pre- packaged compressed bits of the filesystem that are merged with a read-only file system, and from there stacked under a ramdisk via a UnionFS mount point. The bits would be like packages in a sense, except instead of being installed, they would be mounted as part of the filesystem in RAM and are read _directly_ from the read-only disk (vs. copied into memory). I was wondering how this might be done without creating a ton of mount points, copying more than is necessary into RAM, or creating a lot of overhead by stacking a whole bunch of tiny filesystems. ...or if it's even possible. I'm using UnionFS-FUSE and Cloop.


title: Hamachi for Web Surfing

text: I recently installed Hamachi on my FreeBSD 9 and I want to know how can I browse web anonymously by this software?


title: How to quickly create a local apt repository for random packages using a Debian based linux distribution?

text: Some situations call for manually installing a local package using `dpkg -i <packagename>`. Sometimes it may be further useful to leverage the functionality of `apt` with that package so the question is: How do you quickly create a local repository for random packages using a Debian based linux distribution - like Xubuntu 13.04/Ubuntu?


title: mysql database dump script adding fuctionality to skip dumped database

text: I'm using the following script to dump my database. it works great. I want to add functionality that it first checks if a database table is already dumped or not, if a dump exists then it should be skipped and move to the next table.               DB_host=127.0.0.1     DB_user=root     DB=mydb     DB_pass=mydbpassword     DIR=/          [ -n "$DIR" ] || DIR=.     test -d $DIR || mkdir -p $DIR          echo "Dumping tables into separate SQL command files for database '$DB' into dir=$DIR"          tbl_count=0          for t in $(mysql -NBA -h $DB_host -u $DB_user -p$DB_pass -D $DB -e 'show tables')     do         echo "DUMPING TABLE: $t"         mysqldump -h $DB_host -u $DB_user -p$DB_pass $DB $t  > $DIR/$t.sql         (( tbl_count++ ))     done          echo "$tbl_count tables dumped from database '$DB' into dir=$DIR"


title: Text file look-up by column

text: I have a file in this format:               [#]   OWNER_NAME     NAME                       SIZE     [6]   Robottinosino  Software                   200     [42]  Robottinosino  Ideas worth zero           188     [12]  Robottinosino  Ideas worth zero or more   111     [13]  I am Batman    Hardware                   180     [25]  Robottinosino  Profile Pictures           170      and I would like to be able to do the following using command line tools:               my_command "Ideas worth zero"      and get this result:               42      and not risk getting this result:               12      I have thought of using grep to identify the line, awk to get the 1st field but I am not sure how to reliably and efficiently match on the whole 'NAME' field short of counting at which column the text 'OWNER_NAME' and 'SIZE' appear in the header and get everything in-between with some whitespace trimming. Notice 'OWNER_NAME' could be more than one word: e.g. 'OWNER_NAME' = "I am Batman". Any ideas with accompanying implementation? What I have to go by here, is just the old family of cat, head, tail, awk, sed, grep, cut, etc.


title: Problem with booting using nosmp

text: I tried to install RHEL 5.1 in an i3 processor machine with 2gb ram. So after installation I tried to boot up, but unfortunately the machine got freezed showing `Starting udev.` I dont know exactly what the reason is. For finding that I rebooted with disabling the quite mode. I was not able to find any problems. I made a lot of googling and found a solution from a forum. `Boot using nosmp`. This worked well, but I just want to know that whether is it a good practise, and also will it make any problems. I will be running Oracle 11g in that particular machine. The machine will be a middleware which lies between the Data Centre and Main server for data synching purpose.


title: ssh tunnelling explanation

text: I have a question regarding ssh tunneling. I've read this article   * http://www.popcornfarmer.com/2009/01/ssh-tunneling-tutorial/ I would like to make X forwarding work and run some X applications at home and have them displayed on a remote system:                ssh -X -R 5555:localhost:22 user@remoteserver.com -N      On remote:                ssh -X -p 5555 user@192.168.1.2      Then on home:                //configure sshd to listen on 5555      ssh user@remoteserver.com      //here run some app      Should it work?


title: No permission on external drive

text: > **Possible Duplicate:**   >  can't change file permission On my hard drive everything is fine, but when I go onto my external drive I can't chmod. I get no error message but the changing simply doesn't take place. I have tested it and it works fine when I'm on my laptops hard drive. The same goes for creating symbolic links, I can create symbolic links on my hard drive but when I try to do it on my external drive I get: `failed to create symbolic link, Operation not permitted` What is the problem?


title: vim.googlecode.com SSL certificate change

text: I am building vim from source and keep having to update the SSL hostfingerprints of my `~/.hgrc` file. It's getting a little silly and large - see below. The pattern is the same: run update, find SSL finger print has changed, update fingerprint… Anyone knows of a simpler way to keep this updated?               ### openssl s_client -connect  vim.googlecode.com:443 < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout -in /dev/stdin     [hostfingerprints]     vim.googlecode.com = CB:F1:C8:AC:28:D5:61:B7:C1:9C:73:7E:3A:B6:BB:E2:E6:55:95:2A      vim.googlecode.com = 52:BC:6F:6A:D5:86:38:B1:F5:FE:07:B3:A5:88:72:DC:EB:49:BF:5D     vim.googlecode.com = FD:02:92:B1:B3:32:27:F4:7B:40:3D:0A:CA:9E:DD:EE:22:17:52:02     vim.googlecode.com = F6:21:3F:1D:BA:DC:6A:0D:7C:AF:00:E4:C4:12:87:DC:1B:7C:1D:11     vim.googlecode.com = A0:60:E5:C3:DB:27:FB:31:B5:B2:D2:79:8E:24:4D:70:0E:E0:4B:EE     vim.googlecode.com = 65:A0:A7:8D:8F:48:EB:13:5C:81:3C:47:2D:6B:73:C4:7E:EA:61:5F


title: Find the total size of certain files within a directory branch

text: Assume there's an image storage directory, say, `./photos/john_doe`, within which there are multiple subdirectories, where many certain files reside (say, `*.jpg`). How can I calculate a summary size of those files below the `john_doe` branch? I tried `du -hs ./photos/john_doe/*/*.jpg`, but this shows individual files only. Also, this tracks only the first nest level of the `john_doe` directory, like `john_doe/june/`, but skips `john_doe/june/outrageous/`. So, how could I traverse the entire branch, summing up the size of the certain files?


**The developer says:http://comments.gmane.org/gmane.linux.real- time.rtnet.user/2546** > > > Now how can I tell the Makefile to look for headers in > /usr/local/rtnet/include respectively how could I set my CFLAGS? > > EXTRA_CFLAGS := -I ... > >> Sorry for that not really RTnet dependent question, but I couldn't find a Makefile-howto covering this question. > > Maybe this helps, though it a bit more complicated due to serving 2.4 and > 2.6 kernels: **So, I took the makefile from here:http://svn.gna.org/viewcvs/xenomai/trunk/examples/rtdm/driver-api/ and added `-I /usr/local/rtnet/include` corresponding to **EXTRA_CFLAGS****               ###### CONFIGURATION ######     ### List of applications to be build     APPLICATIONS = hello          ### Note: to override the search path for the xeno-config script, use "make XENO=..."               ### List of modules to be build     MODULES = hello          ### Note: to override the kernel source path, use "make KSRC=..."                    ###### USER SPACE BUILD (no change required normally) ######     ifeq ($(KERNELRELEASE),)     ifneq ($(APPLICATIONS),)          ### Default Xenomai installation path     XENO ?= /usr/xenomai          XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which xeno-config 2>/dev/null)          ### Sanity check     ifeq ($(XENOCONFIG),)     all::     @echo ">>> Invoke make like this: \"make XENO=/path/to/xeno-config\" <<<"     @echo     endif               CC=$(shell $(XENOCONFIG) --cc)          CFLAGS=$(shell $(XENOCONFIG) --skin=native --cflags) $(MY_CFLAGS)          LDFLAGS=$(shell $(XENOCONFIG) --xeno-ldflags) $(MY_LDFLAGS) -lnative -lrtdm          # This includes the library path of given Xenomai into the binary to make live     # easier for beginners if Xenomai's libs are not in any default search path.     LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)          all:: $(APPLICATIONS)          clean::         $(RM) $(APPLICATIONS) *.o          endif     endif                    ###### KERNEL MODULE BUILD (no change required normally) ######     ifneq ($(MODULES),)          ### Default to sources of currently running kernel     KSRC ?= /lib/modules/$(shell uname -r)/build          OBJS := ${patsubst %, %.o, $(MODULES)}     CLEANMOD := ${patsubst %, .%*, $(MODULES)}     PWD := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)          ### Kernel 2.6     ifeq ($(findstring 2.6,$(KSRC)),2.6)          obj-m := $(OBJS)     EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix $(ADD_CFLAGS) \     -I /usr/local/rtnet/include           all::         $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules          ### Kernel 2.4     else          ARCH ?= $(shell uname -i)     INCLUDE := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/compat -I$(KSRC)/include/xenomai/posix     CFLAGS += $(shell $(MAKE) -s -C $(KSRC) CC=$(CC) ARCH=$(ARCH) SUBDIRS=$(PWD) modules) $(INCLUDE)          all:: $(OBJS)          endif          ## Target for capturing 2.4 module CFLAGS     modules:         @echo "$(CFLAGS)"          clean::         $(RM) $(CLEANMOD) *.o *.ko *.mod.c Module*.symvers Module.markers modules.order         $(RM) -R .tmp*          endif      **Now, when I do make, I get the error:`error: implicit declaration of function ‘rt_dev_socket’` for the following `hello.c`.**               #include <stdio.h>     #include <signal.h>     #include <unistd.h>     #include <sys/mman.h>          #include <native/task.h>     #include <native/timer.h>          #include  <rtdk.h>          RT_TASK demo_task;          void demo(void *arg)     {       RT_TASK *curtask;       RT_TASK_INFO curtaskinfo;            printf("Hello World!\n");            curtask=rt_task_self();       rt_task_inquire(curtask,&curtaskinfo);            printf("Task name : %s \n", curtaskinfo.name);            ********int sockfd = rt_dev_socket(AF_INET, SOCK_DGRAM, 0);********     }          int main(int argc, char* argv[])     {       char  str[10] ;            rt_print_auto_init(1);            mlockall(MCL_CURRENT|MCL_FUTURE);            printf("start task\n");            sprintf(str,"hello");            rt_task_create(&demo_task, str, 0, 50, 0);            rt_task_start(&demo_task, &demo, 0);          }


title: Logical volume missing after reboot

text: Centos- 6, LVM2 after a system hang and hard reboot. `lvdisplay` and `lvscan` return no volumes. It had volumes earlier...how to recover? there is data on LV (logical volume) - shared as NFS export.. VG is listed under /etc/lvm/backup/datastore1. any ideas to restore the LV?               vgdisplay         -- Volume group --         VG Name               datastore1         System ID         Format                lvm2         Metadata Areas        1         Metadata Sequence No  1         VG Access             read/write         VG Status             resizable         MAX LV                0         Cur LV                0         Open LV               0         Max PV                0         Cur PV                1         Act PV                1         VG Size               10.92 TiB         PE Size               4.00 MiB         Total PE              2861467         Alloc PE / Size       0 / 0         Free  PE / Size       2861467 / 10.92 TiB         VG UUID               7uq001-dUxd-I1WS-PPu2-ljT3-FybY-D9ddx2 cat /etc/lvm/backup/datastore1 datastore1 { id = "7uq001-dUxd-I1WS-PPu2-ljT3-FybY-D9ddx2" seqno = 2 status = ["RESIZEABLE", "READ", "WRITE"] flags = [] extent_size = 8192 # 4 Megabytes max_lv = 0 max_pv = 0 metadata_copies = 0                   physical_volumes {                      pv0 {                         id = "kRGDrz-YFyf-EIKk-0om6-9H78-jgle-9z0B27"                         device = "/dev/cciss/c0d1p1"    # Hint only                              status = ["ALLOCATABLE"]                         flags = []                         dev_size = 23441142637  # 10.9156 Terabytes                         pe_start = 2048                         pe_count = 2861467      # 10.9156 Terabytes                 }         }      }


title: On Mac OS X, how to encrypt a small folder and copy that to Google Drive or DropBox?

text: On Mac OS X, right now I use the following to back up a small project folder to a USB Flash drive:               alias a='alias'     a dateseq='date "+%Y-%m-%d %H:%M:%S"'     a backup_proj='cp -a ~/code/MyProj "/Volumes/KINGSTON/MyProj `dateseq`"      so each time I type `backup_proj`, the folder is backed up from the hard drive to the USB drive, and each project is also internally version controlled using Git. Each folder is only about 500kb so it takes a long time to even fill up 1GB (the Flash Drive is 16GB). The folder is backed up as:               $ ls -1 /Volumes/KINGSTON/     MyProj 2012-05-27 08:20:50/     MyProj 2012-05-27 10:27:56/     MyProj 2012-05-27 14:53:01/      But I get paranoid and also want to back up to Google Drive or Dropbox so it will get uploaded to their server automatically, just by encrypting the whole folder and copying the single resulting file to Google Drive or DropBox's folder, and the password can be `apple234321pineapple` and specified on the command line. I wonder what is a good way to encrypt the folder into a single file so that it takes a non-practical time to crack? (can you please give the command line that will do it).


title: Execute remote programs and completely detaching it

text: I need to execute a remote application (named ConnectionManager), which uses the ncurses library, on the remote server launching it from a local pc. ConnectionManager is a program wich use ncurses and forks another process (itself) and waits for incoming tcp/ip connection. On a:               Distributor ID: ScientificSL     Description:    Scientific Linux SL release 5.5 (Boron)     Release:        5.5     Codename:       Boron     (Like Centos5.5)      I use this script:               #!/bin/bash     INFORMIXDIR=/opt/informix     INFORMIXSERVER=server1_on     ONCONFIG=onconfig.eda     PATH=$PATH:$INFORMIXDIR/bin     export INFORMIXDIR INFORMIXSERVER ONCONFIG PATH     echo $INFORMIXSERVER     echo $ONCONFIG     echo "Launch ConnectionManager"     export DISPLAY=:0.0 && xterm -e 'sudo -E /opt/informix/server /ConnectionManager'       and it all works. The previous script doesn't work on               Distributor ID: Scientific     Description:    Scientific Linux release 6.4 (Carbon)     Release:        6.4     Codename:       Carbon      The ConnectionManager doesn't allow an IP connection. I want to leave the ConnectionManager program running in a remote machine, also when I launch it from a local machine. What's wrong? I have tried `screen -d -m ./ConnectionManager`. The application works, but I don't see it on remote machine. I need to see the ConnectionManager within an xterm window. Is it possible that sudo is blocking ConnectionManager tcp/ip connections ? Update: When I use this command: sudo './ConnectionManager' I have immediately the following message: [1]+ Stopped sudo './ConnectionManager' I have check the code and the problem is the instruction `int setpgrp(void)` in ConnectionManager. Why ?


title: Curly Brace glob order?

text: If I have two files (in a folder with similarly numbered files) such as               foo.18     foo.19      And I want to use a glob on them, do I do it like so:               cp -r /folder1/*.{19,20} /folder2/      or like so?               cp -r /folder1/{*.19,*.20} /folder2/      Neither seem to expand out when I tap `tab`. Is one 'better than the other? What order does it expand in? Will it ever matter?


title: Trap, ERR, and echoing the error line

text: I'm trying to create some error reporting using a Trap to call a function on all errors:               Trap "_func" ERR      Is it possible to get what line the ERR signal was sent from? The shell is bash. If I do that, I can read and report what command was used and log/perform some actions. Or maybe I'm going at this all wrong? I tested with the following:               #!/bin/bash     trap "ECHO $LINENO" ERR          echo hello | grep "asdf"      And `$LINENO` is returning 2. Not working.


Is there a shell one-liner to convert JSON to BSON? Something suitable for one-off execution, or a shell script? `bsondump` from MongoDB goes the inverse way, but I'm clueless as to what I can use to go from JSON to BSON. There's no `bsonundump`, e.g.


title: Can I route through interface instead of IP?

text: I know I can route to another computer by setting its IP as the gateway. Can I also do this by just specifying the interface the packets should take. Like instead of doing `route add gw`, if I say `route add -net X dev interface`, it doesn't work.