title: creating simple command for sudo apt-get install?

text: I need to run these commands very often:               sudo apt-get install <package>     sudo apt-get remove <package>      Can I make it simple like:               install <package>     remove  <package>      I think I need to write a function like this:               function install(){     sudo apt-get install <package>     }      ...and then need to copy paste to some location i don't know. Can anyone tell me how can I make such an `install <package>` command available all the time after boot?


title: How can I share a shell with my colleague w/o using VNC?

text: Many a times, I want my colleague to have a look at some code on my system. He will mostly do it at his free time, and will need to login as me. Is there a way I can open a new shell as me, and then **_transfer_** the shell to him on his machine, so that he can use it whenever he wants to?


title: Using AWK to delete line and output result

text: I have a text file and manage to find the line through output comparison. With the book title and author name.               awk -F ':' '/KungFu Feet|Chuck Norris/'  test.txt          Kungfu Feet:Chuck Norris:12:1:1      Is there any way to delete the line using `awk` and return the output in a bash file? **EDIT** I would like to do a check for the following item before i do the deleting using awk                 If (( Book = KungFu Feet  && Author = Chuck Norris )); do         echo "Item is found unable to delete"        else          echo "Deleting.."


title: How can I find out what happened to my Debian box?

text: I have an old PC lying around which I've installed Debian 6.0 on. Last night I was trying to SSH in and it wouldn't respond so I pressed the reset button. How can I find out what happened to it? It seems fine now.


title: What OS should I install on old Sun Blade 1000 / Sun Blade 2000 workstations, and how should I do it?

text: I was given some nice old Sun UNIX workstations, Sun Blade 1000 and Sun Blade 2000. These are UltraSparc machines running Solaris 8 (which, with regard to all questions below, is useless because the former owner could not provide me with any passwords). I'd like to get them running again, and because I don't like computers on "static display", would prefer having some typical software on them. So,   1. what OS and application software would you suggest? I'm not too interested in 100% "historical" accuracy, but would like something that lends itself to demonstrating a "typical UNIX workstation". Bonus points if the OS you suggest can still be used to compile some useful modern software from source (like Chromium) without having to create an entire build environment from scratch.   2. How do I even boot these machines from a CD? Searching around some forums gives me the impression that I need a special Sun keyboard in order to press "Stop-A" during boot... can this be done on a regular PC-style keyboard?


title: How do I disable or change the caps lock key on my keyboard?

text: We have ergonomic keyboards at work which I'm not entirely used to. I seem to keep hitting the capslock key while I'm in `vim` and it's starting to annoy. How can I disable this key, and or change to to be another key?


title: Fedora unable to detect USB or wireless networks?

text: I installed Fedora(Gnome) 19 on a Dell Inspiron with Intel i3 processor, and a factory built-in Windows 7 home premium OS.   The installation process completed successfully. But now when I log into Fedora I don't have internet. There are no wireless networks available, although another laptop with Windows 8 detects about 10 wireless networks in range. I tried plugging in an ethernet cable, but nothing would happen and still no internet connection, and Bluetooth too does not have any networks.   I Googled and found a suggestion of installing `bluez-hid2hci`, but since I don't have internet, I downloaded the packages on a USB from another computer and came to install them on the laptop. **The Problem:**   Fedora couldn't detect USB devices.   I tried mounting the USB but couldn't find it anywhere. Not even in `/var/log/messages`.   I ran the command `tail -f /var/log/messages` to see life messages and I inserted and removed the USB but no changes. Here's the output I get: ![photo of the screen showing tail -f /var/log/messages output](http://i.stack.imgur.com/C13SV.jpg) **My Question:**   Why Can't Fedora detect wireless networks and USB drivers?


title: Proper way for setting general policy and firewall rules with libvirtd

text: I'm just struggling with the firewall configuration of our new KVM Host. I think by now I understand how libvirtd implements networking, but I'm missing a way to set some decent firewall rules. To the setup: the KVM Host is listening to multiple public IP's, from which one is used for management only, the others get forwarded to the corresponding vm. I know it's not ideal to expose the host like this, but currently it's not possible in a different way. On the host runs a SSH server, listening to a non-standard port of the management IP. Now I feel quite unrelaxed knowing that the default INPUT policy is set to ACCEPT, so I want to set it to DROP and only allow the ssh port. I had to do this manually by now as I noticed libvirtd is flushing any rules when I restart a virtual network, which is sometimes necessary. What's the proper way to tell `libvirtd` to imply my custom rules? I was consulting the manual and Google, but didn't find any proper advice (or maybe I missed it).


title: ssh can't connect to CentOS at login screen

text: I've a server that running CentOS 6.4 final, I tried putty to connect at login screen, it show Network error: Connection refused, but it works while I've logged in to server. Anyone know what's going wrong?


title: cron runs job at unexpected times

text: I have set up a cron job on my local Ubuntu 12.04 server to log on a remote server through a passwordless ssh connection and run `mysqldump` on a database on that server once a day. My problem is that, in addition to running `mysqldump` at 00:00 every day, it is for some reason also run at HH:17 at every hour, thereby filling up the disk fairly rapidly. The job in my crontab is set up as:               @daily  /bin/bash /home/backup/scripts/db_backup      The most important parts of the script db_backup looks like this:               #!/bin/bash          # Sets the properties and folders to be backed up     host_name=admin@the_host.com     db_name=the_db_name     db_backup_folder_at_host="~/db_backup"          # Dumps the mysql database     { # Try         ssh ${host_name} "mysqldump ${db_name} > ${db_backup_folder_at_host}/backup$(date +%F_%R).sql" &&         echo "$(date) SUCCESS! mysqldump of database"     } || { # Catch         echo "$(date) FAILURE! mysqldump of database"     }      At the remote server I have specified a `.my.cnf` file for the database (in the home folder) like this:               [mysqldump]     user=USERNAME     password=PASSWORD     host=MYSQLSERVER      and this works fine. The crontab is successfully installed for the super user of my local Ubuntu 12.04 server. I have tried rebooting the server, but that does not fix the problem. Running `sudo ps -A | grep cron` at the Ubuntu server produces `1166 ? 00:00:00 cron` as output, so only one process is running. Running `sudo crontab -l` shows the daily cron job above, while running `crontab -l` shows that no jobs are installed for the regular user. There are no cron jobs running on the remote server. Can anyone give me a hint on how this can be happening? Where can I search for clues? Note that I have also tried the following for the crontab, but `mysqldump` is still run every HH:17:               0 0 * * *   /bin/bash /home/backup/scripts/db_backup


title: Changing the date format of auth.log

text: I was looking to change the date format in which `auth.log` logs information. I could not find a way to do it. Is there a method to do this? My system uses rsyslog.


title: Do ext(4?) filesystems intrinsically store newer data in a fashion that is more prone to corruption?

text: I recently had a corrupted ext4 filesystem throwing these errors:               kubuntu@kubuntu:~$ sudo mount -t ext4 /dev/sdc2 c1     mount: wrong fs type, bad option, bad superblock on /dev/sdc2,       missing codepage or helper program, or other error       In some cases useful info is found in syslog - try       dmesg | tail  or so          kubuntu@kubuntu:~$ sudo fsck.ext4 -v /dev/sdc2     e2fsck 1.42.5 (29-Jul-2012)         fsck.ext4: Attempt to read block from filesystem resulted in short read while trying to open /dev/sdc2     Could this be a zero-length partition?          kubuntu@kubuntu:~$ dmesg | tail     [ 2684.532855] Descriptor sense data with sense descriptors (in hex):     [ 2684.532858]         72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00      [ 2684.532876]         05 3f c8 b0      [ 2684.532885] sd 5:0:0:0: [sdc]       [ 2684.532893] Add. Sense: Unrecovered read error - auto reallocate failed     [ 2684.532898] sd 5:0:0:0: [sdc] CDB:      [ 2684.532902] Read(10): 28 00 05 3f c8 b0 00 00 08 00     [ 2684.532917] end_request: I/O error, dev sdc, sector 88066224     [ 2684.532927] Buffer I/O error on device sdc2, logical block 22     [ 2684.532973] ata6: EH complete      After recovering the partition with `e2fsck -f -b 32768` I've noticed that the oldest files on the disk were mostly preserved, and that most of the unrecovered files were the newest files, and thus without backups. **Is the property of loosing the newest files and preserving the oldest files intrinsic to ext4, or was this just bad luck?** Are there any file systems which, upon corruption, tend to loose the older files and to preserve the newer files?


title: Make Trickle get the correct $PATH

text: Trickle is a bandwidth limiting program. I have the following script for trickle.               #!/bin/bash     echo $PATH     trickle -s -t 3 -u 200 -d 200 "$@"      I have a script in ~/bin/ that want to run the script with. I               $ my_trickle.sh new_script.sh     /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games:~/bin     trickle: exec(): No such file or directory      It works if I run `my_trickle.sh ~/bin/new_script.sh` Why isn't trickle recognizing the $PATH correctly? Can I get it to locate `new_script.sh` located in ~/bin/?


title: Detect open sockets manually (not using nc or similar)?

text: I'm trying to debug a network problem on a embedded system which has a very limited set of userspace applications. Meaning I can't use any of the following               sudo lsof -i     sudo netstat -lptu     sudo netstat -tulpn      How can i read which sockets are binded from `/sys` or `/proc`?


title: Udev Rule Isn't Used

text: I'm trying to write a udev rule on my Beaglebone White that runs when a Pantech UML 295 finishes booting. When using `udevadm monitor --environment` I get the following final output which I would like to base the rule on:               UDEV [3163.454297] add /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-     1:1.0/net/eth1 (net)     ACTION=add     DEVPATH=/devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/net/eth1     ID_BUS=usb     ID_MODEL=PANTECH_UML295     ID_MODEL_ENC=PANTECH\x20UML295     ID_MODEL_ID=6064     ID_REVISION=0228     ID_SERIAL=Pantech__Incorporated_PANTECH_UML295_UML295692146818     ID_SERIAL_SHORT=UML295692146818     ID_TYPE=generic     ID_USB_DRIVER=cdc_ether     ID_USB_INTERFACES=:020600:0a0000:030000:     ID_USB_INTERFACE_NUM=00     ID_VENDOR=Pantech__Incorporated     ID_VENDOR_ENC=Pantech\x2c\x20Incorporated     ID_VENDOR_ID=10a9     IFINDEX=6     INTERFACE=eth1     SEQNUM=1151     SUBSYSTEM=net     SYSTEMD_ALIAS=/sys/subsystem/net/devices/eth1     TAGS=:systemd:     USEC_INITIALIZED=3163023666      My udev rule version 1:               ENV{ID_BUS}=="usb", SUBSYSTEM=="net", RUN+="/home/root/rebootInternetConnection.sh", ENV{ID_MODEL}=="PANTECH_UML295", ACTION=="add", INTERFACE=="eth1", ENV{ID_USB_DRIVER}=="cdc_ether"      and version 2:               ACTION=="add", SUBSYSTEM=="net", RUN+="/home/root/rebootInternetConnection.sh"      Version 2 is a stripped down version which should be ran more than once, but doesn't get ran at all. Version 1 uses environment variables which I'm not sure whether or not the rule has access to. To clarify: the rule doesn't get ran at all, and the shell script has echos which should show up. My rule is in the /etc/udev/rules.d/ directory with name 10-local.rules. **EDIT** Here are some more non-functional rules, placed in /etc/udev/rules.d/81-pantech.rules:               ACTION=="add", SUBSYSTEM=="net", ATTR{idVendor}=="10a9", RUN+="/home/root/reboot     InternetConnection.sh"          SUBSYSTEM=="net", ATTR{idVendor}=="10a9", ATTR{idProduct}=="6064", RUN+="/home/ro     ot/rebootInternetConnection.sh"          ACTION=="add", SUBSYSTEM=="hid", RUN+="/home/root/rebootInternetConnection.sh"          ACTION=="add", SUBSYSTEM=="usb", RUN+="echo foo > /tmp/foo"          SUBSYSTEM=="usb", ATTR{product}=="PANTECH UML295", RUN +="echo foo > /tmp/foo"          ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="PANTECH UML295", RUN+="/home/ro     ot/rebootInternetConnection.sh"      When I run:               udevadm test /devices/platform/omap/musb-ti81xx/musb-hdrc.1/u       it returns the last couple of lines as:               run: 'echo foo > /tmp/foo'     run: 'echo foo > /tmp/foo'     run: 'echo foo > /tmp/foo'     run: '/home/root/rebootInternetConnection.sh'      Is there a case where the rules will add to the RUN+=, but don't get used?


title: Tracking my shell path in Emacs

text: Not a long time ago, I found the following precious snippet that allows Emacs to track my current directory on any `ansi-term` buffer. More specifically, if I `cd <some/path>` from within a terminal inside Emacs, and I then press `C-x C-f`, Emacs will run `find-file` from `<some/path>` directly, which is very, very handy.               if [ -n "$INSIDE_EMACS" ]; then       chpwd() { print -P "\033AnSiTc %d" }       print -P "\033AnSiTu %n"       print -P "\033AnSiTc %d"     fi      However, the above trick doesn't work if I `ssh` to a remote machine from the shell. Ideally in this case, if I press `C-x C-f` Emacs should recognize that I have sshed to some machine, and use tramp to run `find-file` on the corresponding machine and remote path. This takes me to the following two questions:   1. How and why does the snippet above work?    2. How can I extend it so that it can also track my remote paths after I ssh into another machine?


title: GUI message box in SLES 11

text: I am using SLES 11 and I often run long processes. I am looking for a method to flash an alert box or a message box when the work is done. In Ubuntu there is `zenity` which can flash an info box. I am looking for similar functionality for SUSE/SLES. I saw there is `dialog` but I dont think this opens a GUI box. Any ideas ? **ADDED INFO** I dont have `root` on the machine (neither do I want a clumsy $USER install). I want to use something that is native to SLES.


title: Can't open vim in zsh?

text: I recently decided to try out zsh, but for some reason I cannot open Vim in a zsh shell. Currently, my default shell is bash. If I open up a terminal window, then run `zsh` to enter a zsh shell, I have no problems opening up Vim. The problem comes when I run the `chsh -s /bin/zsh` command to try and change my default shell to zsh. Now, when I open up a terminal window, a zsh shell opens up, but I _cannot_ open Vim. When I try to run `vim <filename>`, the shell just hangs, and I cannot , , or even to quit. I've checked my $PATH variable while I'm in the zsh shell and everything is correct. Running `which vim` correctly shows that Vim is in `/usr/bin/vim`. Currently, my `.zshrc` is blank. I've tried running other commands like `ls`, `cd`, `less`, etc, and they all work properly. As far as I can tell, Vim is the only command giving me troubles. Any insight would be much appreciated.


title: Centos Linux no longer has " System ---> Administration ---> Printing " after re-install from "Minimal" iso file

text: Recently i installed centos linux minimal and then installed GUI over it. i noticed it no longer has               System ---> Administration ---> Printing      given that this is not a 'software' how can i go about bringing this fuctionality back ? can it be done via "yum" ?


title: gs can't find the proper font

text: I am running the following command to add bookmarks to a pdf file. The file `bookmarks.txt` contains bookmarks in Chinese characters and in pdfmarks format. The output of `gs` shows that there seem to be some problem with the font. Is there some way to solve the problem? Thanks in advance!               $ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf note.pdf  bookmarks.txt     GPL Ghostscript 9.05 (2012-02-08)     Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.     This software comes with NO WARRANTY: see the file PUBLIC for details.     Processing pages 1 through 102.     Page 1     Substituting font Times-Bold for Times New Roman,Bold.     Loading NimbusRomNo9L-Medi font from /usr/share/fonts/type1/gsfonts/n021004l.pfb... 2889932 1499918 3254752 1759198 3 done.     Substituting font Times-Roman for Times New Roman.     Loading NimbusRomNo9L-Regu font from /usr/share/fonts/type1/gsfonts/n021003l.pfb... 2993796 1627069 4166144 2692107 3 done.     Page 2     Substituting font Times-Roman for Times New Roman.     Page 3     Substituting font Times-Roman for Times New Roman.     Page 4     Can't find (or can't open) font file /usr/share/ghostscript/9.05/Resource/Font/Arial-BoldMT.     Can't find (or can't open) font file Arial-BoldMT.     Can't find (or can't open) font file /usr/share/ghostscript/9.05/Resource/Font/Arial-BoldMT.     Can't find (or can't open) font file Arial-BoldMT.     Querying operating system for font files...     Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3073992 1671962 5497244 3026723 3 done.     Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3074368 1692578 5853472 3515223 3 done.     Substituting font Times-Roman for Times New Roman.     Page 5     Substituting font Times-Roman for Times New Roman.     Page 6     Substituting font Times-Roman for Times New Roman.     Page 7     Page 8     Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3074180 1679830 4371296 2897061 3 done.     Substituting font Times-Roman for Times New Roman.     Page 9     Substituting font Times-Roman for Times New Roman.     Substituting font Times-Bold for Times New Roman,Bold.     Loading Arial-BoldMT font from /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf... 3073992 1671819 4631712 2938526 3 done.     Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3073992 1672099 4987940 3383317 3 done.     Page 10     Loading ArialMT font from /usr/share/fonts/truetype/msttcorefonts/Arial.ttf... 3094652 1711038 3749692 2384326 3 done.      The font map files of my GhostScript is under `/usr/share/ghostscript/9.05/Resource/Init`, and can be viewed here Fontmap and Fontmap.GS. I have installed `ttf-mscorefonts-installer`, and               $ ls /usr/share/fonts/truetype/msttcorefonts/     Andale_Mono.ttf              Georgia.ttf     andalemo.ttf                 georgiaz.ttf     arialbd.ttf                  impact.ttf     arialbi.ttf                  Impact.ttf     Arial_Black.ttf              timesbd.ttf     Arial_Bold_Italic.ttf        timesbi.ttf     Arial_Bold.ttf               timesi.ttf     Arial_Italic.ttf             Times_New_Roman_Bold_Italic.ttf     ariali.ttf                   Times_New_Roman_Bold.ttf     arial.ttf                    Times_New_Roman_Italic.ttf     Arial.ttf                    Times_New_Roman.ttf     ariblk.ttf                   times.ttf     comicbd.ttf                  trebucbd.ttf     Comic_Sans_MS_Bold.ttf       trebucbi.ttf     Comic_Sans_MS.ttf            Trebuchet_MS_Bold_Italic.ttf     comic.ttf                    Trebuchet_MS_Bold.ttf     courbd.ttf                   Trebuchet_MS_Italic.ttf     courbi.ttf                   Trebuchet_MS.ttf     Courier_New_Bold_Italic.ttf  trebucit.ttf     Courier_New_Bold.ttf         trebuc.ttf     Courier_New_Italic.ttf       Verdana_Bold_Italic.ttf     Courier_New.ttf              Verdana_Bold.ttf     couri.ttf                    verdanab.ttf     cour.ttf                     Verdana_Italic.ttf     Georgia_Bold_Italic.ttf      verdanai.ttf     Georgia_Bold.ttf             verdana.ttf     georgiab.ttf                 Verdana.ttf     Georgia_Italic.ttf           verdanaz.ttf     georgiai.ttf                 webdings.ttf     georgia.ttf                  Webdings.ttf      * * * updated The error is that in the generated pdf file, the bookmarks are not Chinese characters but unrecognizable (if you view it in evince, click side pane and then index). I suspect the substitution is the reason (or do I misunderstand the cause of the problem?) Here is the updated Fontmap.GS, after adding the font files for the four types of Times New Roman fonts Here is the output of running the above command using `gs`


title: Send all local mail to a single external e-mail

text: I am trying to send all local mail to a single external e-mail, using Google's SMTP servers. Using Google's SMTP servers work, as I am able to send mail to external addresses work using mail from mailutils. The redirection of local mail to the external e-mail does not work. When sending a mail to root from my account test using:               echo "Body" | mail -s "Test Postfix To Root" root        * I never recieve the message   * Nothing new turns up in /var/log/mail.err   * This turns up in /var/log/mail.log               Sep  4 18:48:06 desktop1204test postfix/pickup[5535]: C9326EE26: uid=1000 from=     Sep  4 18:48:06 desktop1204test postfix/cleanup[5702]: C9326EE26: message-id=     Sep  4 18:48:06 desktop1204test postfix/qmgr[5534]: C9326EE26: from=, size=401, nrcpt=1 (queue active)     Sep  4 18:48:06 desktop1204test postfix/local[5704]: C9326EE26: to=, orig_to=, relay=local, delay=0.03, delays=0.02/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)     Sep  4 18:48:06 desktop1204test postfix/qmgr[5534]: C9326EE26: removed      My `/etc/postfix/main.cf`: `               inet_interfaces = loopback-only     mynetworks = loopback-only     alias_maps = hash:/etc/aliases     alias_database = hash:/etc/aliases     virtual_alias_domains = localhost.localdomain     virtual_alias_maps = hash:/etc/postfix/virtual     relayhost = [smtp.gmail.com]:587     smtp_sasl_auth_enable = yes     smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd     smtp_sasl_security_options = noanonymous     smtp_tls_CAfile = /etc/postfix/cacert.pem     smtp_use_tls = yes      ` My `etc/aliases`:               # See man 5 aliases for format     postmaster:    root      My /etc/postfix/virtual:               @localhost.localdomain        someone@somewhere.com      How can I get it working? I don't want any local mail to arrive locally, they should all go to `someone@somewhere.com`. * * * I tried the solution suggested in a comment below: put `*: someone@somewhere.com` in `/etc/aliases`. But did not work:               test@desktop1204test:~$ sudo newaliases     test@desktop1204test:~$ cat /etc/aliases     # See man 5 aliases for format     postmaster:    root     *: someone@somewhere.com     test@desktop1204test:~$ sudo newaliases      test@desktop1204test:~$ sudo service postfix restart      * Stopping Postfix Mail Transport Agent postfix                                                     [ OK ]       * Starting Postfix Mail Transport Agent postfix                                                     [ OK ]      test@desktop1204test:~$ echo "Body" | mail -s "Test Postfix To Root $(date)" root     test@desktop1204test:~$ tail /var/log/mail.err      test@desktop1204test:~$ tail /var/log/mail.log      ......     Sep  4 22:46:12 desktop1204test postfix/master[7224]: daemon started -- version 2.9.6, configuration /etc/postfix     Sep  4 22:46:23 desktop1204test postfix/pickup[7227]: 859AFF6A8: uid=1000 from=<test>     Sep  4 22:46:23 desktop1204test postfix/cleanup[7235]: 859AFF6A8: message-id=<20130904204623.859AFF6A8@desktop1204test.localdomain>     Sep  4 22:46:23 desktop1204test postfix/qmgr[7228]: 859AFF6A8: from=<test@desktop1204test.localdomain>, size=431, nrcpt=1 (queue active)     Sep  4 22:46:23 desktop1204test postfix/local[7237]: 859AFF6A8: to=<root@desktop1204test.localdomain>, orig_to=<root@desktop1204test>, relay=local, delay=0.02, delays=0.02/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)     Sep  4 22:46:23 desktop1204test postfix/qmgr[7228]: 859AFF6A8: removed     test@desktop1204test:~$


title: Configure xmobar to show workspaces

text: What should my xmonad.hs file look like to correctly give workspace info to xmobar?


title: How do I install firmware on debian wheezy from command-line?

text: I have Ubuntu 14.04 and Debian-7.4-Standard on my Acer Aspire One laptop. I have Standard Debian OS which is command-line only. I am still a newbie and not too sure of myself on the command-line, so that is way I added Debian Standard to learn from. In the Debian OS I am not able to connect to the web through my wi-fi. I am missing the needed drivers. So far I have downloaded `firmware-nonfree_0.36+wheezy.1.tar.gz` in my Ubuntu OS and placed it into my home directory in my Debian OS. But now what? Any ideas on how I can install my needed driver from there? * * * **Update:** I managed to make some ground. What I did was to download from my Ubuntu system the `firmware-linux-nonfree_0.36+wheezy.1_all.deb` file and placed it into my home directory in my Debian system. Then I booted into my Debian OS and from my home directory as a superuser I ran the command `dpkg -i firmware-linux-nonfree_0.36+wheezy.1_all.deb` and then rebooted the system. Now my display looks much better, but I still am unable to connect the system to the web. As a result I am still unable to use `apt-get update`. At least the firmware problem is now solved.


title: Ubuntu: can't find ndbm.h

text: I need to compile an old apache version, 1.3 and compilation process fails because:               mod_auth_dbm.c:77:18: fatal error: ndbm.h: File or directory not found      where is it?


title: conky execi doesnt execute on startup

text: In my .conkyrc File I use some Shell-Scripts and call it via {execi}. The Problem is it doesn´t execute these scripts on startup, e.g. get_public_ip.sh doesn´t need to get called every 30 seconds like the get_cpu_temp.sh, so I use `{exceci 3600 get_public_ip.sh}` with this command I have to wait 1 Hour till I get my public IP because conky doesn´t call the script on startup! How can I configure conky so it will call all {execi} lines on startup?


title: Linux kernel development for multi core architecture

text: I am working on a project adapting system software like the Linux kernel. I read one paper titled "Experience on Comparison of Operating Systems Scalability on the Multi-core Architecture" that tells how to detect bottlenecks using benchmarking. I am following their experimental approach and am able to generate a profiling report using the profile tool, but I am not able to detect bottlenecks from this profiling report. Basically, I am not able to explore the no-vmlinux part, and I am not able to find those functions related to bottlenecks. Also I am not able to use `lockstat.txt` as there is no file in `/proc/sys/kernel/lock_stat`.


title: What is the difference between ./script and . ./script?

text: > **Possible Duplicate:**   >  Using ‘.’ to execute files in bash I was trying to figure out how to export my environmental via script instead of changing my .bashrc file. I found this old useful post that said: > Variables can only be exported to subordinate processes, you can't pass them > back up to the parent. If you really want your script to affect the parent > shell's environment, run the script as >   >   >     . ./yourprogram >   I just want to know what the difference is between `. ./script` and `./script`? When I look at it, they booth mean to me, run the script from the current directory?


title: Using '.' to execute files in bash

text: What's the difference between executing a script like this: `./test.sh` and executing a script like this: `. test.sh`? I tried a simple, two-line script to see if I could find if there was a difference:               #!/bin/bash     ls      But both `. test.sh` and `./test.sh` returned the same information. Thanks.


title: Whys is there extra dot at the start of some command I'm supposed to execute

text: I've downloaded an installation package of weblogic server and in the README, there's this command to execute:               Linux/Mac     $ . ./configure.sh      It's not the first time I see this. Why is there an extra dot at the start of the command? When I do only `./configure.sh`, the result is the same


title: Difference between ". myscript" and "./myscript"

text: I am confused by "one only dot - space - shell script name" (like `. myshellscript`) and "path to shell script" (like `./myshellscript`) commands. What for they are? I noticed the command `. myshellscript` executes shell script even with -rw-rw-r--. But `./myshellscript` doesn't. So I am confused.


title: Wrap lines to a specified number of fields

text: I have a text file which contains several vectors, as follows. The components of these vectors are separated with space and they are spanned in a few lines. This file is generated after I run a command in the Ubuntu terminal.               0 -1 -0.494 0.12 -0.919 0.112 0.914 -0.681 -0.067 -0.918 -0.443 -0.216 -0.48 0.55 0.701 0.429 0.699 -0.726 -0.39 0.172 0.61 -0.599 0.728 -0.883 -0.32 0.044 -0.189 -0.732 -0.309 -0.286 -0.859 0.107 0.298      0 0 0.869 0.641 -0.331 -0.631 -0.236 0.303 0.998 0.153 -0.89 -0.927 -0.671 -0.478 0.693 -0.007 -0.64 0.091 -0.249 -0.881 0.641 0.689 0.222 -0.398 0.548 -0.268 -0.877 -0.333 -0.55 0.858 0.504 0.215 -0.178      0 0 0 0.758 -0.214 0.768 0.329 0.667 -0.013 0.367 0.103 -0.307 -0.565 0.685 0.171 -0.903 0.32 -0.682 -0.887 -0.44 -0.467 0.409 -0.649 0.249 0.772 -0.962 0.443 -0.594 0.776 -0.427 0.088 -0.971 0.938       How can I convert this file into another file using shell commands with the following format, where each vector is in a separate line and the header of the file is the number of three-component vectors?               n     V1x V1y V1z     V2x V2y V2z     V3x V3y V3z     ...     Vnx Vny Vnz      where n is the number of three-component vectors in the file. In the file that I have: `V1x=0`, `V1y=-1`, `V1z=-0.494`. `V2x=0.12`, `V2y=-0.919`, `V2z=0.112` and so forth.


title: How can I setup a system immune to abrupt poweroffs?

text: I have a system that boots from a solid state disk. How can I make it immune to improper shutdowns? I can also switch to a distribution having this feature. I can choose between Ubuntu, Redhat, and Fedora (or derivatives of these distros).


title: Making the keyboard eject switch work

text: My keyboard switch for ejecting the CDROM does not work though it displays an eject button on the screen. I need to make it work. I know ejecting a cdrom using system call is as simple as               ioctl(cdromfd,CDROMEJECT,0)      But I don't know how to connect the an executable that contains the above system call and the event of pressing the eject key? Or shall I rely on kernel level? If then how?


title: Editing metadata with bash

text: I have a bunch of photos(jpeg, bmp, png) that I have arranged in such a manner that the metadata is in html form in a separate file. I would like create some script to read this html file and edit the photos "Tags" field if possible. My images are arranged like this: photo-"serial number".(jped/bmp/png). The metadata is in the same folder but the file name is only the serial number with no extension In this html file there is this line: `<meta name="keywords" content="tag1, tag2, tag3, etc" />` Note that some files dont have this extra file and some images may already have the tag s field populated. I want this done in a batch process. If you know a better way to do this(windows/linux)please let me know.


title: Batch renaming files

text: I have a directory full of images:               image0001.png     image0002.png     image0003.png     ...      And I would like a one-liner to rename them to (say).               0001.png     0002.png     0003.png     ...      How do I do this?


title: Batch renaming of files

text: I have a directory full of images:               DSCN4749.JPG     DSCN4750.JPG     DSCN4892.JPG     ...      And I would like a one-liner to rename them to (say).               dscn4749.jpg     dscn4750.jpg     dscn4892.jpg     ...      How do I do this? Alternatives/extenstions/caveats   * I want to recurse   * The directory contains a mix of file types I only want to rename DSCN*.JPG files.   * bash solution   * perl solution   * zsh solution   * I want a new directory tree with hard links existing files.   * I want to change name more than just a case change eg dscn5555.JPG to 05555.jpg ...


title: Bash Globbing Variable Substitution?

text: > **Possible Duplicate:**   >  Batch renaming files I want to rename files using their existing name as a base for the new one. So if I can `ls` these files with               ls blue*+(.png)      I'd want to rename them something like               mv blue$(*)+(.png) $(1).png      except that doesn't work obviously. Is there syntax for these kind of variables in bash globbing or is there an easier way?


title: Append to the name of each file in directory

text: How to append “.backup” to the name of each file in your current directory?


title: batch rename file names including spaces and patterns

text: I would like to rename a bunch of files which are named in a general form of, `text1 text2 [firstname.lastname] text3 ... textn.ext` I want to remove the text `[firstname.lastname]` from the name of a file. To simplify the task, assume that `[firstname.lastname]` is a fixed first and last name for all the files. I use Ubuntu 12.04, and I tried the following command, `$ find . -name "*.ext" -print | xargs sed -i 's/[firstname.lastname]//g'` but it doesn't work.


title: How to remove a specific string from file name

text: I have a report running in UNIX and creating a file named `xxxx_ddmmyy_hhmm_zzzzzz.txt`. I need to remove the `zzzzzz` from the file name. How do I do it?


title: batch rename a few files

text: > **Possible Duplicate:**   >  Batch renaming files I have some files that I wish to rename in a single command. The files are names thus. I want the E S Posthumus bit removed from the names and also the 01, 02 ...etc at the start of each file. How do I remove that?


title: Fedora 19 - Booting doesn't show login screen

text: I have done some common updates in my system, and now I have the following problem: It starts as usual, loading services, but when trying to launch the login screen (I use KDE), it stops and show me once more the starting services screen, where it blocks after some time. I could go to another tty, login as root and do the following commands:               init 3     init 5      And it starts as expected. But every time I restart, I have to do the same thing to see my desktop. I have seen my `/var/log/boot.log` file and I haven't seen anything unusual. There is it:               [  OK  ] Found device SAMSUNG_HD204UI.     [  OK  ] Found device SAMSUNG_HD204UI.     [  OK  ] Found device SAMSUNG_HD204UI.     [  OK  ] Started dracut initqueue hook.              Mounting /sysroot...     [  OK  ] Started Show Plymouth Boot Screen.     [  OK  ] Reached target Paths.     [  OK  ] Reached target Basic System.     [  OK  ] Mounted /sysroot.     [  OK  ] Reached target Initrd Root File System.              Starting Reload Configuration from the Real Root...     [  OK  ] Started Reload Configuration from the Real Root.     [  OK  ] Reached target Initrd File Systems.     [  OK  ] Reached target Initrd Default Target.          Welcome to [0;34mFedora 19 (Schrödinger’s Cat)!          [  OK  ] Stopped Switch Root.     [  OK  ] Stopped target Switch Root.     [  OK  ] Stopped target Initrd File Systems.     [  OK  ] Stopped target Initrd Root File System.              Starting Collect Read-Ahead Data...              Starting Replay Read-Ahead Data...     [  OK  ] Reached target Login Prompts.     [  OK  ] Reached target Remote File Systems.     [  OK  ] Listening on Syslog Socket.     [  OK  ] Listening on Delayed Shutdown Socket.     [  OK  ] Listening on /dev/initctl Compatibility Named Pipe.              Mounting Debug File System...              Starting Create static device nodes in /dev...     [  OK  ] Set up automount Arbitrary Executable File Formats F...utomount Point.              Mounting Huge Pages File System...              Mounting POSIX Message Queue File System...     [  OK  ] Listening on udev Kernel Socket.     [  OK  ] Listening on udev Control Socket.              Starting udev Coldplug all Devices...     [  OK  ] Listening on LVM2 metadata daemon socket.     [  OK  ] Listening on Device-mapper event daemon FIFOs.              Starting Monitoring of LVM2 mirrors, snapshots etc. ...ress polling...              Expecting device dev-disk-by\x2duuid-06995479\x2d888...de5ee.device...              Mounting Temporary Directory...              Expecting device dev-disk-by\x2duuid-f88e071f\x2ddb3...1d57c.device...              Expecting device dev-disk-by\x2duuid-5c6ae9c2\x2d610...c99fb.device...              Expecting device dev-disk-by\x2dlabel-Documentos.device...              Expecting device dev-disk-by\x2dlabel-Programas.device...              Expecting device dev-disk-by\x2dlabel-Extra.device...     [  OK  ] Stopped Trigger Flushing of Journal to Persistent Storage.              Stopping Journal Service...     [  OK  ] Stopped Journal Service.              Starting Journal Service...     [  OK  ] Started Journal Service.     [  OK  ] Started Collect Read-Ahead Data.     [  OK  ] Started Replay Read-Ahead Data.              Starting Load legacy module configuration...              Starting File System Check on Root Device...              Starting Apply Kernel Variables...              Mounting Configuration File System...              Starting Set Up Additional Binary Formats...              Starting LVM2 metadata daemon...     [  OK  ] Mounted Temporary Directory.     [  OK  ] Mounted Configuration File System.     [  OK  ] Mounted Debug File System.     [  OK  ] Mounted Huge Pages File System.     [  OK  ] Mounted POSIX Message Queue File System.     [  OK  ] Started udev Coldplug all Devices.              Starting udev Wait for Complete Device Initialization...              Mounting Arbitrary Executable File Formats File System...     [  OK  ] Started LVM2 metadata daemon.     [  OK  ] Started Apply Kernel Variables.     [  OK  ] Started Load legacy module configuration.     [    8.501835] systemd-fsck[261]: Fedora_19: clean, 964326/4825088 files, 8824281/19283456 blocks     [  OK  ] Started File System Check on Root Device.              Starting Remount Root and Kernel File Systems...     [  OK  ] Started Remount Root and Kernel File Systems.              Starting Configure read-only root support...     [  OK  ] Started Monitoring of LVM2 mirrors, snapshots etc. u...ogress polling.     [  OK  ] Mounted Arbitrary Executable File Formats File System.     [  OK  ] Started Set Up Additional Binary Formats.     [  OK  ] Started Create static device nodes in /dev.              Starting udev Kernel Device Manager...     [  OK  ] Started udev Kernel Device Manager.     [  OK  ] Reached target Local File Systems (Pre).     [  OK  ] Started Configure read-only root support.              Starting Load Random Seed...     [  OK  ] Started Load Random Seed.     [  OK  ] Started udev Wait for Complete Device Initialization.              Starting Activation of DM RAID sets...     [  OK  ] Reached target Sound Card.     [  OK  ] Started Activation of DM RAID sets.     [  OK  ] Reached target Encrypted Volumes.     [  OK  ] Found device SAMSUNG_HD204UI.              Activating swap /dev/disk/by-uuid/06995479-888f-4e3f...99fa3c5de5ee...     [  OK  ] Found device SAMSUNG_HD204UI.              Starting File System Check on /dev/disk/by-uuid/5c6a...d143aacc99fb...     [  OK  ] Found device SAMSUNG_HD204UI.              Starting File System Check on /dev/disk/by-uuid/f88e...fe923f01d57c...     [  OK  ] Activated swap /dev/disk/by-uuid/06995479-888f-4e3f-b62c-99fa3c5de5ee.     [  OK  ] Reached target Swap.     [   12.871604] systemd-fsck[375]: /dev/sda7: clean, 89896/2411920 files, 3370321/9640192 blocks     [  OK  ] Found device SAMSUNG_HD204UI.              Mounting /media/Documentos...     [  OK  ] Found device SAMSUNG_HD204UI.              Mounting /media/Extra...     [  OK  ] Started File System Check on /dev/disk/by-uuid/5c6ae...d-d143aacc99fb.              Mounting /home...     [   13.813950] systemd-fsck[379]: BOOT: clean, 374/64768 files, 28850/258822 blocks              Mounting FUSE Control File System...     [  OK  ] Mounted FUSE Control File System.     [  OK  ] Found device SAMSUNG_HD204UI.              Mounting /media/Programas...     [  OK  ] Started File System Check on /dev/disk/by-uuid/f88e0...4-fe923f01d57c.              Mounting /boot...     [  OK  ] Mounted /boot.     [  OK  ] Mounted /home.     [  OK  ] Mounted /media/Documentos.     [  OK  ] Mounted /media/Extra.     [  OK  ] Mounted /media/Programas.     [  OK  ] Reached target Local File Systems.              Starting Security Auditing Service...              Starting Recreate Volatile Files and Directories...              Starting Tell Plymouth To Write Out Runtime Data...              Starting Trigger Flushing of Journal to Persistent Storage...     [  OK  ] Started Security Auditing Service.     [  OK  ] Started Trigger Flushing of Journal to Persistent Storage.     [  OK  ] Started Tell Plymouth To Write Out Runtime Data.     [  OK  ] Started Recreate Volatile Files and Directories.     [  OK  ] Reached target System Initialization.     [  OK  ] Reached target Timers.              Starting Manage Sound Card State (restore and store)...     [  OK  ] Started Manage Sound Card State (restore and store).     [  OK  ] Reached target Paths.     [  OK  ] Listening on Open-iSCSI iscsiuio Socket.     [  OK  ] Listening on Open-iSCSI iscsid Socket.     [  OK  ] Listening on RPCbind Server Activation Socket.     [  OK  ] Listening on PC/SC Smart Card Daemon Activation Socket.     [  OK  ] Listening on CUPS Printing Service Sockets.     [  OK  ] Listening on D-Bus System Message Bus Socket.     [  OK  ] Reached target Sockets.     [  OK  ] Reached target Basic System.              Starting firewalld - dynamic firewall daemon...              Starting Network Manager Script Dispatcher Service...              Starting Hardware RNG Entropy Gatherer Daemon...     [  OK  ] Started Hardware RNG Entropy Gatherer Daemon.              Starting irqbalance daemon...     [  OK  ] Started irqbalance daemon.              Starting NTP client/server...              Starting ABRT Automated Bug Reporting Tool...     [  OK  ] Started ABRT Automated Bug Reporting Tool.              Starting ABRT Xorg log watcher...     [  OK  ] Started ABRT Xorg log watcher.              Starting Builds and install new kmods from akmod packages...              Starting ABRT kernel log watcher...     [  OK  ] Started ABRT kernel log watcher.              Starting Machine Check Exception Logging Daemon...              Starting Install ABRT coredump hook...              Starting Builds and install new kmods from akmod packages...              Starting Self Monitoring and Reporting Technology (SMART) Daemon...     [  OK  ] Started Self Monitoring and Reporting Technology (SMART) Daemon.              Starting Login Service...              Starting RealtimeKit Scheduling Policy Service...              Starting Accounts Service...              Starting Permit User Sessions...              Starting RPC bind service...              Starting CUPS Printing Service...     [  OK  ] Started CUPS Printing Service.              Starting System Logging Service...     [  OK  ] Started System Logging Service.              Starting D-Bus System Message Bus...     [  OK  ] Started D-Bus System Message Bus.     [  OK  ] Started Machine Check Exception Logging Daemon.     [  OK  ] Started Permit User Sessions.              Starting Command Scheduler...     [  OK  ] Started Command Scheduler.              Starting Job spooling tools...     [  OK  ] Started Job spooling tools.              Starting Wait for Plymouth Boot Screen to Quit...     [  OK  ] Started Install ABRT coredump hook.     [  OK  ] Started RPC bind service.     [  OK  ] Started NTP client/server.     [  OK  ] Started RealtimeKit Scheduling Policy Service.     [  OK  ] Started Network Manager Script Dispatcher Service.     [  OK  ] Started Login Service.     [  OK  ] Started Builds and install new kmods from akmod packages.     [  OK  ] Started Builds and install new kmods from akmod packages.              Starting The KDE login manager...     [  OK  ] Started The KDE login manager.     [  OK  ] Started Accounts Service.              Starting Authorization Manager...      What should I do to solve my problem? Sorry for my bad english. **Edit:** I can start without problems with GDM. The problem should be in KDM.


title: "install" command as script

text: I'm working on a heavily modified Linux based OS targeted for a really specific environment - easy-to-use NAS systems. It does not provide any GUI, apart from a web interface, but it at least has SSH. I'm trying to run a manual package build (as far as "./configure && make" is manual), but it fails at one specific point - it cannot find the install command. As the platform misses a multitude of otherwise essential and default Linux commands, I'm not surprised by this, but by the fact that a good half- hour search resulted in no hits about how to replace it. Seriously, nobody ever thought about having a simple bash script that has the same functionality? So question is - how to replace "install"? Is there any script or executable that does the exact same, on x86/bromolow platform (or platform- independently)?


title: Text processing for words connected by hyphen

text: I have text files (*.txt) which I process, I want to find words connected by hyphen such as "drug-associated" or "drug-linked", "drug-related". I need your help to convert the first one to "associated with drug" and the second one convert it to "linked with drug" instead. In one file I could have many of those, one time it is "associated", "linked", "related" and could have other terms.


title: Why is swappiness set to 60 by default?

text: I just read some stuff about swappiness on Linux. I don't understand why the default is set to 60. According to me this parameter should be set to 10 in order to reduce swap. Swap is on my hard drives so it us much slower than my memory. Why did they configure the kernel like that?


title: Can pf be used to modify HTTP Headers and Contents?

text: I'm looking at options to replace my router with something that offers me more options for content filtering and also content modification. One of the things that I want to do is to modify HTTP Requests, e.g. Add or Remove certain Headers or the contents of the body (e.g., to remove any references to `ga.js`). Also, I want to block access to certain sub-paths of a domain, e.g. block `twitter.com/widgets` without blocking the main `twitter.com` website (in which case a custom DNS that returns 0.0.0.0 would do the job) I'm wondering if PF on OpenBSD can do that, or if it's too low level and if I need a higher level tool like a proxy. The problem with using a proxy is that it's not transparent for clients and thus doesn't help e.g. protecting my phone while it's on my WiFi.


title: Supply input to a program with a password prompt

text: Is there any Linux command which supplies multiple enter keys to another process which is running in a terminal till the other process dies? For example consider the command `yes ' ' | ./ssr-sim prepare`. I need a command on the LHS side of the pipe(`|`). For example instead of `yes ' '` on the left of `|`, another command which supplies multiple enter keys to the `./ssr-sim prepare` on the right side. I wanted to automate enter keys inside a shell script and the command `./ssr- sim prepare` produces output which asks for password multiple number of times and the user needs to manually press the `Enter` key every time (no need to give password here, only press `Enter` each time when it asks for password). I need to automate that pressing of enter key part.   The command `yes ' ' | ./ssr-sim prepare` is not working.


title: What exactly is the lwp and threads in solaris?

text: The book "Solaris Internals" says Solaris executes kernel threads for kernel-related tasks, such as interrupt handling, memory page management, device drivers, etc. For user-process execution, kernel threads have a corresponding LWP; these kernel threads are scheduled for execution by the kernel on behalf of the user processes I am a little confused about the words and below is my understanding In solaris, the " **real thread** " is the " **kernel thread** ". The kernel threads can execute kernel-related tasks and user-related tasks. When execute user-related tasks, the kernel thread needs a data structure called LWP to provide the environment. So, the **user thread** and **LWP** are not the execution unit or thread at all. They are just data structres in the system. The **user thread** is just the user task needed to be executed which includes the user data and code. The LWP is the kernel data structure providing the kernel infomation. The real execution unit or flow is **kernel thread**. Provided my understanding is correct, in the early solaris where two-level thread model exists, many user threads can be bound to one lwp which means that in the underlying implementation of solaris the " **many user thread** " are really one thread(kernel thread) to the kernel or CPU and the only kernel thread executes the tasks in each user thread in turn. If the user thread is unbound it can not be executed. Am I right?


title: Phusion Passenger not working with Apache while installing redmine

text: I am trying to install redmine (which is a ruby app ) in my arch system. But I am not able to fire up the app as it gives me the error for phusion passenger. ![enter image description here](http://i.stack.imgur.com/as0Ko.jpg)


title: Postfix - unable to send mails to Internet (i.e. Gmail)

text: I've set up postfix (Debian) and it works fine. I can recieve mail and I can send them, but I can only send them to local (and local virtual) adresses. But when I try to send the mail for example to my Gmail account, I get this in syslog:               Jun 30 18:34:44 vps postfix/smtpd[9087]: NOQUEUE: reject: RCPT from vps[77.93.223.122]: 554 5.7.1 <hrdina.pavel@gmail.com>: Relay access denied; from=<info@w-cms.cz> to=<hrdina.pavel@gmail.com> proto=ESMTP helo=<localhost.localdomain>      I've googled a lot but I did figure it out thought. I think that something is wrong with my* directives. Here are mine:               myhostname = mail.xxx.cz     alias_maps = hash:/etc/aliases     alias_database = hash:/etc/aliases     myorigin = /etc/mailname     mydestination = xxx.cz, vps, localhost.localdomain, localhost     relayhost =     mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128


title: Count distinct values of a field in a file

text: I have a file contains around million number of lines. In the lines I have a field called transactionid, which has repeatitive values. What I need to do is to count them distinctly. No matter of how many times a value is repeated, it should be counted only once. Can you help with a way.


title: Substring failing in shell script

text: for file in *.csv     do       split -n 5 -d -a 1  "$file" "$file"       for each in $(seq -w 2 3)       do             echo $each             filestem="$file$each"             len_filestem=${#filestem}             subs=substr(len_filestem,3,4)             echo $subs             echo $filestem       #awk '{filename = "wrd." int((NR-1)/10000) ".txt"; print >> filename}' $file--$each       awk -v filestem= "{$filestem}" '{filename = substr(filestem,3,5};  print >> filename}' $filestem            done     done      Im trying to find the substring of a string but my script is failing in substr(len_filestem,3,4)


title: Sort a text file according to a character within a field

text: I have a file named : `newfile` which consist of the following data               1 AC BB CC     2 AB CC DD     3 CA BB CC     4 BE DD EE     5 BD AA AA      I type the following command in bash to sort the data according to the second character, second field > sort -k3 newfile I expected the following results               3 CA BB CC     2 AB CC DD     1 AC BB CC     5 BD AA AA     4 BE DD EE      why am i getting the following results and how am i suppose to solve according to the third character (ignoring the blank)               5 BD AA AA     1 AC BB CC     3 CA BB CC     2 AB CC DD     4 BE DD EE


title: Mint Linux Wireless Issues

text: as I understand it LMDE is built based upon Ubuntu; and I did not receive much help from the official Linux Mint forum, so I've decided to post here. My problem started yesterday, when I installed LMDE for the first time. Everything ran smoothly, up until I got to configuring my wireless. The first wireless network was a breeze to configure. I was able to join and it worked fine. That day, when I went to school... I found I was unable to actually join any other networks. If I selected a network in the list, it would unselect itself. I eventually diagnosed the problem as the fact that it was always trying to join my home network. The file at etc/NetworkManager/system-connections was labeled "AUTO (My home network's name)"... so, using 'sudo rm etc/NetworkManager/system-connections/"Auto (My home network's name)" ', I removed that file hoping it would fix my issue. What I found, however is that the problem has persisted through this "fix", and I can still not join any networks. I found the Network Connections app, and when I went to the "Wireless" tab, then hit the "Add network" button... all the options are blanked out. If I use the "echo $UID" prompt, I am told I am the first user (user 1000) on the disk... so I'm at a loss. Is there any way of reconfiguring my wireless files all over again, or regaining control of my Network Connections application?


title: Commercial support for CentOS

text: As you know CentOS is taken over by RedHat, so i boils out couple of points as mentioned here.   * Will CentOS remain complete free as it was(is) before(now)?   * Can we expect upgrades of CentOS in future, as and when RHEL new version is released.?   * Will RHEL make it enterprise version? What are the organizations that provide commercial support for CentOS? Redhat has said they are not going to provide commercial support for CentOS.


title: Which is the real PATH variable

text: On my office computer it seems like I've have two PATH variables. > $path : This is delimited by " " (Space) > > $PATH : This is delimited by ":" (Colon) Though when I update one, the other one gets updated as well. Is this the normal behavior in Linux or is there something wierd going on in my machine? Should I keep them both, or delete one of them? **Edit:** I'm using csh, I found this because some of my colleagues were updating the "path" variable, while others did it with "PATH". Though I deleted all occurences of updating "PATH" in my .cshrc, it still appears when I try to echo them.


title: Systemd Unit for reconnecting wireless on failure

text: I have a systemd service called conWlan0.service which establishes WiFi connection. Now I want to create another Unit which periodically checks the connection. Is this a reasonable start?               [Unit]     Description=...     After=conWlan0.service     OnFailure=conWlan0.service          [Service]     Type=simple     ExecStart=/usr/bin/checkWiFi     RestartSec=120     Restart=always      The checkWifi script exits 0 if everything is correct and an error code otherwise. Any suggestions?


title: How to extract a list of user accounts deleted from the system over a period of 1 year?

text: I'm auditing a Unix system and I would like to know how many user accounts were created and deleted over a 1 year period. Is there some way of getting this data from the Unix system?


title: Redirect SSH user server side

text: I know that I can create shortcuts for specific users/servers on the client side via `~/.ssh/config` or `/etc/ssh/ssh_config`, but I would like to do something similar but on the server side. That is, when I issue on the client:                ssh pub@name.server.top      I am actually chrooted to               /home/jon/pub      on `name.server.top` where I will use sftp. In `/etc/ssh/sshd_config` I have seen examples as the following:               Subsystem sftp internal-sftp     Match user pub         ChrootDirectory %h         ForceCommand internal-sftp         AllowTcpForwarding no      Will also the following work?                   ChrootDirectory /home/jon/pub      Is it possible to create the `pub` as a sort of virtual user? That is, the remote user logs as `pub` and his public key is in `/home/jon/.ssh/authorized_keys`, so without the hassle of creating a separate `/home/pub/.ssh/authorized_keys` or the `/home/pub` directory at all.


title: NOR flash CFI MTD driver troubles with JFFS2 mtdblock

text: ## Context I'm developing a linux 2.6.32 MTD driver for a NOR flash S29GL064N compatible with CFI command set 0002. My driver has the same mapping than the SBC_GXX but with only one partition used as data. Actually, the hardware contains two 8MB NOR flashs accessed through a 8 bits ISA bus via a CPLD that provides a physical addresses 16 KiB window (0xdc000-0xdffff) and two registers bytes (14 bits) for page selection. So the flashes are seen as a unique one in addressing.               S29GL064N flash: IO:0x258-0x259 MEM:0xdc000-0xdffff     S29GL064N flash: Found 1 x16 devices at 0x0 in 8-bit bank     S29GL064N flash: Found 1 x16 devices at 0x800000 in 8-bit bank     S29GL064N flash: CFI does not contain boot bank location. Assuming top.     Creating 1 MTD partitions on "S29GL064N flash":     0x000000000000-0x000001000000 : "S29GL64N flash partition"      As the flash should be used with JFFS2 file system, I have activated block device access. So I see the devices `/dev/mtd0` and `/dev/mtdblock0`. I can format in JFFS2 `flash_eraseall -j /dev/mtd0` and mount the device block `mount /dev/mtdblock0 /mnt/mtd -t jffs2`. Then I can use the partition to copy data to/from it. ## Problems:   1. **Half space taken into account using`df`** For instance, when copying a file of 2MB, the `df` sees 1MB used space while `du` proides the good size.               # du -h /mnt/mtd/     1.0M    /mnt/mtd/     # df -h     /dev/mtdblock0         16M  1.1M   15M   7% /mnt/mtd     # cp tstfile_2M /mnt     # du -h /mnt/mtd/     3.0M    /mnt/mtd/     # df -h     /dev/mtdblock0         16M  2.1M   14M  13% /mnt/mtd        2. **Copying big file accross the two flashes crashes the system** If I copy small files (1 or 2 MB) while crossing the 8MB, there is no problem. If a big file, let's say 6MB is copied and crosses the two flashs, the system will crash:               # du -h /mnt/mtd/     5.0M    /mnt/mtd/     # cp tstfile_6M /mnt/mtd     BUG: unable to handle kernel paging request at 840f2c40     IP: [<c01408a3>] __rmqueue+0xe3/0x2c0     *pde = 00000000      Oops: 0002 [#1]      last sysfs file: /sys/devices/virtual/net/lo/operstate     Modules linked in:          Pid: 3601, comm: cp Not tainted (2.6.32.63-custom #16)      EIP: 0060:[<c01408a3>] EFLAGS: 00000083 CPU: 0     EIP is at __rmqueue+0xe3/0x2c0     EAX: c1398018 EBX: 0000000a ECX: 840f2c3c EDX: c045ca28     ESI: c045ca18 EDI: c13a7ff8 EBP: df9bfcc8 ESP: df9bfc90      DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068     Process cp (pid: 3601, ti=df9be000 task=df950000 task.ti=df9be000)     Stack:      00000000 00000002 00000000 c045c820 c1398000 00000001 df9bfd1c c0230a4d     <0> 00000001 df9ac1d8 00000368 00000015 c045c820 c13a7ff8 df9bfd2c c0141a5c     <0> 00000001 00000041 df185540 c045c83c 00000001 00000000 00000000 000201da     Call Trace:      [<c0230a4d>] ? deflate_fast+0x23d/0x270      [<c0141a5c>] ? get_page_from_freelist+0xdc/0x3a0      [<c0141df0>] ? __alloc_pages_nodemask+0xd0/0x4f0      [<c0143db2>] ? __do_page_cache_readahead+0xb2/0x1c0      [<c0143ee8>] ? ra_submit+0x28/0x40      [<c01440cd>] ? ondemand_readahead+0xed/0x1b0      [<c01441f3>] ? page_cache_async_readahead+0x63/0xa0      [<c013ea2a>] ? generic_file_aio_read+0x37a/0x620      [<c01629cc>] ? do_sync_read+0xcc/0x110      [<c013c169>] ? __rcu_process_callbacks+0x69/0x350      [<c01274a0>] ? autoremove_wake_function+0x0/0x50      [<c011b00a>] ? irq_exit+0x2a/0x40      [<c01630f0>] ? vfs_read+0x90/0x120      [<c0162900>] ? do_sync_read+0x0/0x110      [<c016347d>] ? sys_read+0x3d/0x70      [<c0102c25>] ? syscall_call+0x7/0xb     Code: 04 75 d5 ff 4d e0 8b 45 e0 39 45 d0 7e ba c7 45 cc 03 00 00 00 e9 4c ff ff ff 8b 55 cc 8b 04 d6 8d 48 e8 89 4d d8 8b 08 8b 50 04 <89> 51 04 89 0a c7 40 04 00 02 20 00 c7 00 00 01 10 00 0f ba 70      EIP: [<c01408a3>] __rmqueue+0xe3/0x2c0 SS:ESP 0068:df9bfc90     CR2: 00000000840f2c40     ---[ end trace dfe13b27303ff46a ]---          Message from syslogd@debian at Fri Aug  8 02:13:57 2008 ...     debian kernel: last sysfs file: /sys/devices/virtual/net/lo/operstate          Message from syslogd@debian at Fri Aug  8 02:13:57 2008 ...     debian kernel: Oops: 0002 [#1]           Message from syslogd@debian at Fri Aug  8 02:13:57 2008 ...     debian kernel: Process cp (pid: 3601, ti=df9be000 task=df950000 task.ti=df9be000)          Message from syslogd@debian at Fri Aug  8 02:13:57 2008 ...     debian kernel: Stack:          Message from syslogd@debian at Fri Aug  8 02:13:57 2008 ...     debian kernel: Call Trace:          Message from syslogd@debian at Fri Aug  8 02:13:57 2008 ...     debian kernel: Code: 04 75 d5 ff 4d e0 8b 45 e0 39 45 d0 7e ba c7 45 cc 03 00 00 00 e9 4c ff ff ff 8b 55 cc 8b 04 d6 8d 48 e8 89 4d d8 8b 08 8b 50 04 <89> 51 04 89 0a c7 40 04 00 02 20 00 c7 00 00 01 10 00 0f ba 70           Message from syslogd@debian at Fri Aug  8 02:13:57 2008 ...     debian kernel: EIP: [<c01408a3>] __rmqueue+0xe3/0x2c0 SS:ESP 0068:df9bfc90          Message from syslogd@debian at Fri Aug  8 02:13:57 2008 ...     debian kernel: CR2: 00000000840f2c40     Killed      ## Request I don't know how to validate my driver, the `mtd_test` module works only with NAND flashes. I didn't find why the system crashes on that kind of copy and not in other way. I am looking for advices to know how to address my problems.


title: Vim Copy to System Clipboard without overwriting the defualt register(")

text: When I use `"+y` to copy to the system clipboard, the selected content is copied to the `+` register as well as the default(") register. How can I ensure that the content is copied only to the `+` register without modifying the `"` register? EDIT: I now understand that this is the intended behavior and any yanking will modify the default register. I still want to know whether there's a workaround for this. I have come with a naive solution for visual mode `vnoremap <Leader>y :<C-u>let @+=@*<CR>` and for single line in `nnoremap <Leader>yy :<C-u>let @+=getline('.') . "\n"<CR>` But we will be missing many yank features. I hope someone provides a better solution.


title: Find files in multiple directories taken from list in a file?

text: FreeBSD 9.2 RELEASE p2      I have a file `dirs.txt`. In this file is a new line separated directory list like so:               /etc     /home     /home/goods/      I need to first find in all directory's files which have names like "good" or contain string "(NODES_'TASK')" and then copy all these files into the directory `/tmp`. I think must be something like:               $ find $fromDirs.txt -type f -name 'good' | \         grep -lr '\(NODES_\'TASK\'\)' $fromDirs.txt | > /tmp


title: Is it harmful to close a terminal window without properly exiting an application?

text: Using Ubuntu 12.04 LTS, my question is that if I started an application in a terminal window, then is there anything bad about just closing the terminal window without exiting the application properly first. For example, I use MATLAB. I open up a terminal and type               matlab -nodisplay -nodesktop -nosplash      and then run a bunch of scripts. Then I can either               exit      to end MATLAB and then close the terminal window or just close the terminal window. What really is the difference between these two methods? Does the second method somehow "harm" anything? Is the first method preferred? Why?


title: Is it possible assigning an separate LAN IP to service/daemon?

text: I'm using `pfsense` for prioritizing traffic around LAN. It works well for specified port, IP, network, but I'm having a problem with torrent (transmission bittorrent) outbound connections. The outbound connections are random and no filter can be specified to slow them down if needed. So I was thinking was it possible to specify a virtual IP just for the transmission daemon so I could use separate rules just for that IP? The example would be:               Machine IP:          192.168.0.1     Transmission Daemon: 192.168.0.2      If not, what are the other solutions?


title: Netbeans has no display on my computer

text: I installed netbeans using `zypper install netbeans`. Trying to run it, I get the "loading" splash screen which is proceeded by a small popup which asks me if I want to register my copy and receive some benefits. Once that popup is gone, I'm left with a big beige screen and nothing else. It's almost like netbeans can't be displayed. Running `netbeans` from the command line does not give me any output or error messages. I also had this same issue when I was trying to install it using the `.sh` file found on their website. I'm running opensuse 11.4 with dwm as my window manager. I'm also using the AMD's fglrx graphics driver (I have also experienced this issue using the default open source driver shipped with opensuse). **EDIT** When trying to run `sudo netbeans`, I get:               /usr/share/netbeans/6.8/bin/../platform11/lib/nbexec: WARNING: environment variable DISPLAY is not set      And no display. This is not same behavior as when I launch as a regular user.


title: How can I wrap text at a certain column size?

text: I know that I can use something like `cat test.txt | pr -w 80` to wrap lines to 80 characters wide, but that puts a lot of space on the top and bottom of the printed lines and it does not work right on some systems What's the best way to force a text file with long lines to be wrapped at a certain width? Bonus points if you can keep it from breaking words.


title: Mount points in a chroot

text: I have some device (say `/dev/sda1`) mounted at `/home/user1`. I also have a full Linux system under `/tmp/chroot`, and the directory `/tmp/chroot/home` contains only one directory named `user2`. If I `chroot` inside `/tmp/chroot`, mount `/dev`, `/sys` and `/proc` there and issue the `mount` command (or `cat /proc/mounts`), I can still see `/dev/sda1` mounted at `/home/user1` whereas the directory `/home/user1` does not even exist anymore (in the chroot). I also tried with `jchroot` instead of `chroot` (this is a program with an interface similar to `chroot` but creating a new mount namespace and a new PID namespace), but the results are the same. Is this normal behaviour? It sounds weird that I can access information about mount points outside the chroot.   Is there a way to make them disappear from `/proc/mounts`?


When I try to run a cracked Call of Duty 2 server (I must mention here I HAVE BOUGHT the game, only my friends not) on my Ubuntu 12.04 instance I get the following error:               Inconsistency detected by ld.so: dl-version.c: 230: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed!      I use this cod2_lnxded: http://www.gamecopyworld.com/games/pc_call_of_duty_2.shtml#Call of Duty 2 v1.3 PRIVATE LINUX SERVER + NO-WAIT PATCH The way I am trying to start the server:               ./cod2_lnxded +set fs_homepath srv +set fs_game fs +exec default_mp.cfg +set net_port 30126 +set dedicated 2 +set sv_maxclients 32 +set sv_punkbuster 1 +map_rotate      I googled few hours and I found that ld.so handles dynamic directories. What does this exactly mean? The other thing I found a lot of bugs have reported about ld.so and adviced somewhere one should downgrade it, but I did not managed to do this yet because I don't really want to crash my system... In addition I must mention I successfully started an original CoD2 server, only cracked not working.


title: Network connecting trouble shooting

text: I am trying to connect to the network of my school. With Windows 7 + IE it is not problem at all. I connect to it, no matter what web-page I try to reach, I get forwarded to               http://94.245.115.209:8000/index.php      then, have to login with a username/password and can navigate the web after login. Using Ubuntu 12 + Firefox or Konqueror I do not manage the second step. I think there is some security measure there that blocks me when the page tries to forward me after I input my username/password. There is no pop-up blocker or pop-ups at all and the browsers are configured to run any javascript. What else can I set to get rid of this problem?


title: xtightvnc through ssh gateway -- connection refused

text: Following setup: homepc -> gateway -> workpc               workpc:~$ tightvncserver :12          homepc:~$ ssh -N gatewayuser@gateway -L 1212:workpc:5912      Now I try to connect via               homepc:~$ xtightvncviewer localhost:1212     xtightvncviewer: VNC server closed connection      I also get the output for the tunnel               channel 2: open failed: connect failed: Connection refused      Any ideas? I searched the web, but didn't get it working with those as I didn't find the very same setup..


title: getting "//" after the URL

text: I'm running nginx web server. I have not written any rule to redirect abc.com to www.abc.com, I have just added both in server_name directive which looks like, server_name abc.com www.abc.com; My doubt is, when I hit the URL in browser, like abc.com it redirect to www.abc.com//. What does this "//" means ? Do I need to change anything in my nginx conf file ?


title: How do I write a retry logic in script to keep retrying to run it upto 5 times?

text: I want to write logic in shell script which will retry it to run again after 15 sec upto 5 times based on **_"status code=FAIL"_** if it fails due to some issue.


title: System proxy settings not taking effect on Kali (debian 6)

text: I'm in the process of trying to configure TOR on a Kali installation, as a system-wide SOCKS proxy. I just did this successfully on Ubuntu, and it worked like a charm. I installed TOR & Vidalia from the Debian repositories, started the TOR service using `service tor start`, and checked to see that my computer was listening on the default port, `9050`, for SOCKS connections to be routed through the TOR service; which it was. Vidalia tells me I'm connected to the TOR network. The problem is the Network -> Proxy section of the settings manager in Kali. I can enter in the necessary information to connect to the local SOCKS proxy, but there is no 'apply' button or anything to that effect. I have entered the information, hit enter, exited out (and when I go back, it is still there) of the settings manager, restarted the `networking` service, etc., but I have not been able to get the proxy settings to take effect. This worked beautifully in Ubuntu, I entered the SOCKS settings in the settings manager and hit 'apply', and all traffic was being routed through the TOR network. Any ideas?


title: Where does Firefox store its cookies on Linux?

text: Where does Firefox store cookies in Linux? I searched everywhere but did not find anything.


title: install a kernel module into BeagleBoard (BB)

text: I want to install a kernel module (For example "Hello world") on the BeagleBoard(BB). (The installed OS on the BB is an Ubuntu Linux). If anybody already worked on this could you suggest me a step by step instruction? Any suggestions are also welcome.


title: How to configure DHCP so that boot is completed even without a DHCP server?

text: I have configured /etc/network/interface like this:               auto lo eth0     iface lo inet loopback     iface eth0 inet dhcp      But when a lease cannot be obtained, the booting is not completed. Is it possible to leave DHCP enabled but, in case a DHCP lease is not achieved, still complete the boot (so that a new network configuration can be performed)?


title: Module Stacking in Linux device drivers

text: I am trying my hand with Linux, just come across the concept of module stacking. It can be used to use symbol exported by other Modules. Means we can use something already made in some module so we do not have to do something that is already done. But still I am not getting where in real-time we see this type of concept with Linux. I am following the same link from the o'reilly book - http://www.makelinux.net/ldd3/chp-2-sect-5.shtml Stacking in the parallel port subsystem is shown in Figure 2-2; I am not able to understand this figure? Can you just give SOME REALTIME EXAMPLE APPLICATION where we can use concept of module stacking, which will increase my vision horizon?


title: Character encoding issue with my linux install?

text: I just installed Ubuntu 12.04.4 64 bits, all seemed to be ok, when I started to work on console I noticed:   * that I couldn't get some accented characters typed in to the console, for example, if I tried to type _é_ I would get a _?_   * That neither a `ls` or any other unix commands output would display such characters properly.   * _ANSIX3.4-1968_ appeared as default character encoding in terminal, so:      * I changed the character encoding to UTF-8 at _Set Character Encoding_ option in Terminal menu. I can type these special characters properly but can't get other commands to output in a correct way. And I have to change this every time I open a new console. When I install anything I see this among the outputs and log info:               perl: warning: Setting locale failed.     perl: warning: Please check that your locale settings:         LANGUAGE = "en_US:en",         LC_ALL = (unset),         LC_TIME = "es_MX.UTF-8",         LC_MONETARY = "es_MX.UTF-8",         LC_ADDRESS = "es_MX.UTF-8",         LC_TELEPHONE = "es_MX.UTF-8",         LC_NAME = "es_MX.UTF-8",         LC_MEASUREMENT = "es_MX.UTF-8",         LC_IDENTIFICATION = "es_MX.UTF-8",         LC_NUMERIC = "es_MX.UTF-8",         LC_PAPER = "es_MX.UTF-8",         LANG = "en_US.UTF-8"         are supported and installed on your system.     perl: warning: Falling back to the standard locale ("C").     locale: Cannot set LC_ALL to default locale: No such file or directory      Also if I do a typo at any command working from console I get:               Sorry, command-not-found has crashed! Please file a bug report at:     https://bugs.launchpad.net/command-not-found/+filebug     Please include the following information with the report:          command-not-found version: 0.2.44      My settings at install were only English language and Spanish Keyboard layout. What could it have happened? And how can I fix it _permanently_?


title: "lsmod |grep audio" doesn't return anything?

text: I am running Debian Squeeze. I installed and removed Gnome3 and reinstalled Gnome2.x (epic fail and stupidity) and in the process I have lost audio, `lspci` returns following               # lspci | grep Audio     00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)         But lsmod doesn't return any thing.               $ lsmod |grep audio      Any idea what could be wrong? Here is an update, I tried to install whatever possible package was removed by studying `/var/log/dpkg.log`. This fixed my other issues like no right click on desktop and blunt looking buttons etc. Now I have everything in order but sound is missing. I don't see sound section in `gnome-control-center`. Here are some findings:               kumar@debian-box:/$ lspci | grep Audio     00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)     kumar@debian-box:/$ lsmod |grep audio     kumar@debian-box:/$ lsmod |grep snd       kumar@debian-box:/$ lsmod |grep sound     kumar@debian-box:/$ cat alsa-base.conf     # autoloader aliases     install sound-slot-0 /sbin/modprobe snd-card-0     install sound-slot-1 /sbin/modprobe snd-card-1     install sound-slot-2 /sbin/modprobe snd-card-2     install sound-slot-3 /sbin/modprobe snd-card-3     install sound-slot-4 /sbin/modprobe snd-card-4     install sound-slot-5 /sbin/modprobe snd-card-5     install sound-slot-6 /sbin/modprobe snd-card-6     install sound-slot-7 /sbin/modprobe snd-card-7     # Cause optional modules to be loaded above generic modules     install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; }     install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }     install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }          # Prevent abnormal drivers from grabbing index 0     options bt87x index=-2     options cx88_alsa index=-2     options snd-atiixp-modem index=-2     options snd-intel8x0m index=-2     options snd-via82xx-modem index=-2     # Keep snd-pcsp from beeing loaded as first soundcard     options snd-pcsp index=-2     # Keep snd-usb-audio from beeing loaded as first soundcard     options snd-usb-audio index=-2      Hope this helps in helping me. Its really hard for me to concentrate w/out headphones :( Last update, I fixed it using `sudo modprobe snd-hda-intel`, it seems I messed up kernel headers.


title: Server won't boot, kernel panic - not syncing

text: After a reboot of a CentOS 6.2 server we are getting a kernel panic with the following error:               Kernel panic - not syncing: Attempted to kill init!     Panic occurred, switching back to text console      When passing **init=option selinux=0** to the kernel at boot the server will boot without a problem. I have tried searching for what init=option does but I have not been able to find any recourses explaining it.   * Could someone explain what this parameter does?    * Also, as this is a production server are there any negatives/risks in running with the init=option? I have tried to remake the initramfs via dracut which did not work and received the above error upon boot. As this is a clustered server and the primary server should be identical I have copied the /boot drive from the other server but this did not solve the problem either. (The other server does not have this behavior) Restoring /boot from backup did not work either. Could you please help me investigate this problem   * What causes this kernel panic?   * How would you go about resolving this issue?    * What logs (if any) would tell you more information?   * As this is an older install, would an update/upgrade potentially fix this issue? I would also like to add that the only other possible related issue was that the root disk which was raid mirrored failed and was replaced before this happened. Thanks for your help!


title: "which" command difference

text: What is the difference between `(unix-system “which [name])` and `which [name]` commands. For example when I use the `(unix-system “which visual_elite)` command I get the following result:               /home/vhdl/edatools/mentor/visualelite/VisualElite-4.2.1/Linux2.4/bin/visual_elite      When I do the same on the command line using `which visual_elite` I get               enidl-atlas-schur <76> # which visual_elite     visual_elite is /home/vhdl/edatools/mentor/visualelite/VisualElite-4.2.1/visual_elite      Why do I have this difference?


title: What is the "/usr/local/src" folder meant for?

text: I wanted to put my work files (code) in `/usr/local/src`, but I think it's already a folder that has some other semantic meaning. What is that? Should I put source code there, or is there a better place? **Edit** - I am the sole user and admin of the machine, and I don't want to use my home directory because it's on an NFS drive.


title: How to execute a shell command from a "starter"?

text: I would like to execute a command by double-clicking on a _starter_ on my Ubuntu Lucid desktop. More specifically, I would like to start a `rdesktop` session. I have thus entered `rdesktop -u user -d domain address.to.remote.server` into the _Command_ field of the starter. However, double clicking does nothing, even though the starter is set to _executable_. What am I doing wrong?


title: redirect web server with no-ip and port forwarding in livebox

text: I want my Apache web server running on a Livebox (home router appliance running Linux) to be accessible from the Internet (WAN). I installed and configured the application noip2 on my Ubuntu PC. When I ping my hostname, it redirects me to my WAN ip, which is what I wanted. But I cannot access my Apache web server. I tried this:   * Disabling the `iptables` firewall configuration or the firewall of my Sagem modem.   * Port forwarding on sagem modem (NAT).   * Configuration of Apache. What else can I try? How can I make my web server accessible from the WAN side?


title: Sourcing a shell script from within Emacs

text: I would like to **source** a shell script that changes my environment variables from within Emacs. That is, I would like the shell script to change the environment in which Emacs runs, and I would like to do this from within a running Emacs session. In other words:   1. I start Emacs from `zsh`   2. I would like to source a `zsh` script from within Emacs that changes environment variables such as `LD_LIBRARY_PATH` ### Background: This is an attempt to circumvent the problem that I described here, where I need to **set** `LD_LIBRARY_PATH` to run Emacs, but I need to **unset** it to run a specific Python distribution (Anaconda). Specifically, I want to use an Emacs package (emacs-jedi) that requires access to this Python distribution, but currently I need to **unset** `LD_LIBRARY_PATH` first to start Emacs, so I would need to **set** it later so that I can use `emacs-jedi` from within Emacs. Is this at all possible?


title: How can I use variables when doing a sed?

text: I want to do:               cat update_via_sed.sh | sed 's/old_name/new_name/' > new_update_via_sed.sh      in my program. But I want to use variables, e.g.               old_run='old_name_952'     new_run='old_name_953'      I have tried using them but the substitution doesn't happen (no error). I have tried:               cat update_via_sed.sh | sed 's/old_run/new_run/'     cat update_via_sed.sh | sed 's/$old_run/$new_run/'     cat update_via_sed.sh | sed 's/${old_run}/${new_run}/'


title: Is it best practice to update mysql , php and apache on linux regularly to current version?

text: I have a VPS unmanaged and have installed CentOS 6.3, mysql 5.1.69, php 5.3.3 and apache 2.2.15 No formal or otherwise education in computer programming so trying to follow as many documented guidelines as I can to close any obvious security holes. Is it is best practice to use only current versions of each ? Are the ones I am using now too out dated?


title: How to install PostgreSQL 9.3 in FreeBSD jail?

text: I configured virtual NICS using `pf`, and a jail for FreeBSD using `qjail create pgsql-jail 192.168.0.3`. When I tried to install PostgreSQL 9.3 using port collection, it shows strange message at first.               pgsql-jail /usr/ports/databases/postgresql93-server >make install     ===> Building/installing dialog4ports as it is required for the config dialog     ===>  Cleaning for dialog4ports-0.1.5_1     ===> Skipping 'config' as NO_DIALOG is defined     ====> You must select one and only one option from the KRB5 single     *** [check-config] Error code 1          Stop in /basejail/usr/ports/ports-mgmt/dialog4ports.     *** [install] Error code 1          Stop in /basejail/usr/ports/ports-mgmt/dialog4ports.     ===> Options unchanged     => postgresql-9.3.0.tar.bz2 doesn't seem to exist in /var/ports/distfiles/postgresql.     => Attempting to fetch ftp://ftp.se.postgresql.org/pub/databases/relational/postgresql/source/v9.3.0/postgresql-9.3.0.tar.bz2     postgresql-9.3.0.tar.bz2                        1% of   16 MB   71 kBps      Anyway, installation continues, so I waited. I chose all default options for all option dialogs. And at the end of the process, I saw it finally failed with this message.               ====> Compressing man pages     ===>  Building package for pkgconf-0.9.3     Creating package /basejail/usr/ports/devel/pkgconf/pkgconf-0.9.3.tbz     Registering depends:.     Registering conflicts: pkg-config-*.     Creating bzip'd tar ball in '/basejail/usr/ports/devel/pkgconf/pkgconf-0.9.3.tbz'     tar: Failed to open '/basejail/usr/ports/devel/pkgconf/pkgconf-0.9.3.tbz'     pkg_create: make_dist: tar command failed with code 256     *** [do-package] Error code 1          Stop in /basejail/usr/ports/devel/pkgconf.     *** [build-depends] Error code 1          Stop in /basejail/usr/ports/textproc/libxml2.     *** [install] Error code 1          Stop in /basejail/usr/ports/textproc/libxml2.     *** [lib-depends] Error code 1          Stop in /basejail/usr/ports/databases/postgresql93-server.     *** [install] Error code 1          Stop in /basejail/usr/ports/databases/postgresql93-server.      I have no idea why this fails. Errors at beginning seems I have something wrong with `dialog4ports`. And errors at last seems installer cannot write to ports file tree. AFAIK, the ports files are read-only shared from host system. What's wrong with my jail? How can install PostgreSQL 9.3 in my jail?


title: Appending values to environment variables from within Emacs

text: I am new to Elisp. I would like to do the following in my init file:               ; Retrieve the value of LD_LIBRARY_PATH     ; Append '/path/to/some/lib/:'to it     ; Save the new value of LD_LIBRARY_PATH      So far I know that I can use:               (getenv "LD_LIBRARY_PATH")      to retrieve the value, and:               (setenv "LD_LIBRARY_PATH" "foo")      to set a new value, but my knowledge of Elisp is extremely rudimentary so I don't know to proceed from this point. ### Background: This question is inspired by the fact that it is not be possible to source a shell script to manipulate this environment from within Emacs, so I would need to do this using Elisp.


title: How to make sense of an iptables chain configuration

text: This is about how to make sense of the _chains_ found in the `iptables` default configuration on a typical home router running OpenWrt (a stripped down Linux for router devices), but which ultimately may not be specific to that particular system. Let's focus on the `INPUT` main chain here, and disregard `FORWARD` and `OUTPUT` from the same _table_, as well as `PREROUTING` and `POSTROUTING` from the `nat` table. Doing an `iptables -L -t filter` shows a large number of rules. I have rearranged the output below to make it less intimidating, and in an attempt to pinpoint the parts that hamper my understanding. There are three built-in chains in the `filter` table, which appear at the top of the output. (I specified `-v` because I find it less confusing.)               Chain INPUT (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination      1260  133K ACCEPT     all  --  any    any     anywhere             anywhere            ctstate RELATED,ESTABLISHED         8   544 ACCEPT     all  --  lo     any     anywhere             anywhere       787 41632 syn_flood  tcp  --  any    any     anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN     13012 1249K input_rule  all  --  any    any     anywhere             anywhere     13012 1249K input      all  --  any    any     anywhere             anywhere          Chain FORWARD … # not considering this chain here     Chain OUTPUT …  # not considering either      As you can see, I snipped the chains referenced from `FORWARD` and `OUTPUT` in order to focus on `INPUT`. (I could have chosen any of the other two as they are built up in a similiar manner.) `INPUT` has a policy of `ACCEPT`, and it specifies five rules. The first three ones are clear to me. First, accept stuff that is "established" or "related". (For example, accept the response from an HTTP or DNS request I made.) Seconds, accept everything going to the loopback device (`127.0.0.1`). (This may only come from localhost itself, and I do want that to work. Wouldn't make sense otherwise.) Third, have a synflood protection. (Which protects against a certain kind of attack.)               Chain syn_flood (1 references)      pkts bytes target     prot opt in     out     source               destination       787 41632 RETURN     tcp  --  any    any     anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN limit: avg 25/sec burst 50         0     0 DROP       all  --  any    any     anywhere             anywhere      But then, there are two rules branching into two chains called `input` and `input_rule`, and the question is, why are there two of them, and which one are you supposed to use for what? Let's drill down the jump stack of those rules.               Chain input_rule (1 references)      pkts bytes target     prot opt in     out     source               destination      There's nothing in here yet. It is meant for me to add rules. But what kind of rules?               Chain input (1 references)      pkts bytes target     prot opt in     out     source               destination      6315  482K zone_lan   all  --  br-lan any     anywhere             anywhere      6697  767K zone_wan   all  --  pppoe-wan any     anywhere             anywhere      Okay, this one does have stuff, jumping further down into LAN and WAN, which makes sense for a home router.               Chain zone_lan (1 references)      pkts bytes target     prot opt in     out     source               destination      6315  482K input_lan  all  --  any    any     anywhere             anywhere      6315  482K zone_lan_ACCEPT  all  --  any    any     anywhere             anywhere          Chain zone_wan (1 references)      pkts bytes target     prot opt in     out     source               destination         0     0 ACCEPT     udp  --  any    any     anywhere             anywhere            udp dpt:bootpc         0     0 ACCEPT     icmp --  any    any     anywhere             anywhere            icmp echo-request      6697  767K input_wan  all  --  any    any     anywhere             anywhere      6697  767K zone_wan_REJECT  all  --  any    any     anywhere             anywhere      As you can see, each one of those rules jumps further down the stack to more user-defined rules.               Chain input_lan (1 references)      pkts bytes target     prot opt in     out     source               destination          Chain zone_lan_ACCEPT (2 references)      pkts bytes target     prot opt in     out     source               destination         4  1322 ACCEPT     all  --  any    br-lan  anywhere             anywhere      6315  482K ACCEPT     all  --  br-lan any     anywhere             anywhere      What is the purpose of `input_lan`? The other one is probably to accept packets, but it makes me wonder … the policy for `INPUT` is `ACCEPT`, so why repeat `ACCEPT` here? Now, input from WAN. If you scroll up you can see that some UDP and ICMP stuff is accepted. This is for DHCP and, basically, `ping`. That much is clear. What is less clear, again, is the partially empty stuff following those rules:               Chain input_wan (1 references)      pkts bytes target     prot opt in     out     source               destination      Same question as for `input_lan`.               Chain zone_wan_REJECT (2 references)      pkts bytes target     prot opt in     out     source               destination         0     0 reject     all  --  any    pppoe-wan  anywhere             anywhere      6697  767K reject     all  --  pppoe-wan any     anywhere             anywhere      Okay, that is input from WAN (not established or related), and yes, we probably want to reject it, and now there are two kinds of rejection here, one closing the socket (`tcp-reset`) for TCP connection attempts, and another one via ICMP reply (`icmp-port-unreachable`) for ICMP messages (think `ping`).               Chain reject (5 references)      pkts bytes target     prot opt in     out     source               destination       595 31817 REJECT     tcp  --  any    any     anywhere             anywhere            reject-with tcp-reset      4858  582K REJECT     all  --  any    any     anywhere             anywhere            reject-with icmp-port-unreachable      This last one is a catch-all. So nothing will get accepted here. Finally, here's a list of other chains found in the `filter` table that aren't referenced from the built-in `INPUT` chain in the `net` table. Just for completeness, and to see that they seem to have analogous constructs.               # other chains, not reached from the INPUT chain, so truncated and moved here     Chain forward (1 references)     Chain forwarding_lan (1 references)     Chain forwarding_rule (1 references)     Chain forwarding_wan (1 references)     Chain nat_reflection_fwd (1 references)     Chain output (1 references)     Chain output_rule (1 references)     Chain reject (5 references)     Chain zone_lan_DROP (0 references)     Chain zone_lan_REJECT (1 references)     Chain zone_lan_forward (1 references)     Chain zone_wan_ACCEPT (2 references)     Chain zone_wan_DROP (0 references)     Chain zone_wan_forward (1 references)      So, well. Sorry for this long post. There were a couple questions along the way. I don't know how to put this in an easier or shorter way. This `iptables` configuration is not exactly easy to grasp because there are unclear details spread about here and there. Hope you can clarify this and explain the underlying rationale. Thanks for your attention.


title: Remove newline from unix variable

text: I have a variable whose value is found using sql query. I want to remove the new line charcater from that variable since I want to concatenate this variable with the other. Below is the code:               dt=`sqlplus -s user/pwd@servicename <<EOF     set feedback off;     set head off;     select  replace(to_char((sysdate-7),'YYYYMonDD')||'_'||to_char((sysdate-1),'YYYYMonDD'),chr(10), '') from dual;     exit;     EOF`          echo "test $dt"


title: How do I use a serial port on Linux like a pipe or netcat?

text: I have two computers with two serial ports: ttyS0 and ttyUSB0. (Actually they are on the same computer but that's just for testing). The ports are connected via null modem cable. I want to be able to simply send bytes into one end and come out the other end, and vice versa. Why doesn't the below work?:               # set both serial ports to 9600 8n1     # `-parenb` means no parity,     # `-cstopb` means 1 stop bit     # cs8 means 8 bits at a time      stty -F /dev/ttyUSB0 cs8 -cstopb -parenb 9600     stty -F /dev/ttyS0 cs8 -cstopb -parenb 9600          # in one terminal:     echo "asdf" > /dev/ttyUSB0          # in another terminal, this hangs and does nothing     cat < /dev/ttyS0      I can do similar things with `netcat` and pipes very easily (below), so I feel something like the above should be possible as well.               mkfifo mypipe          # in one terminal     cat < mypipe          # in another. works as expected     echo "asdf" > mypipe


title: Home directory vs Working directory

text: In unix like systems what is the difference between a `home directory` and `working directory` ?


title: Discovering possible RAID configuration of a bunch of disks

text: I have a stack of 8 disks which were at one point all inside of one host. That host no longer exists, but it's been requested that I retrieve data from these disks. No one can tell me anything about their configuration. At first I was hoping they were JBOD, but after looking at the results of various disk checking utilities, I can only conclude that they are in some sort of RAID configuration, and/or possibly corrupt. Here are my findings. I'm hoping someone can give me a sliver of a hint as to how to actually access the data on them. =========================================== **Disk #1 (250 GB)** : primary disk with the OS. /boot and / partitions exist, which contain your typical layout of RHEL5 config files, etc. There is no problem mounting and accessing this drive. **Disk #2 (1 TB)** : gdisk reports that this one has a "damaged" GPT. It then says in more detail that the "backup GPT" is damaged, and that the primary GPT is fine. As such, I can type "p" to view the partitions, and it shows one: /dev/sdc1 at 5.5 TB. This is what tipped me off that we got some RAID action going on somewhere, as this disk itself is 1 TB. **Disk #3 (1 TB)** : gdisk shows no partition table nor any partitions, but curiously fdisk -l shows two partitions (/dev/sdc1: GPT and /dev/sdc3: empty). **Disk #4 (1 TB)** : gdisk/fdisk shows no partition table nor any partitions. **Disk #5 (1 TB)** : gdisk/fdisk shows no partition table nor any partitions. **Disk #6 (1 TB)** : gdisk/fdisk shows no partition table nor any partitions. **Disk #7 (1 TB)** : gdisk/fdisk shows no partition table nor any partitions. **Disk #8 (1 TB)** : gdisk/fdisk shows no partition table nor any partitions. But the difference with this one is that my computer actually makes an attempt to mount an ext3 filesystem automatically upon plugging it in, and fails with the error message "Block bitmap for group 1920 not in group (block 398460416)!" =========================================== How does one go about figuring this out or getting the data off of these disks? I was hoping that I could look at the primary ( **Disk #1** )'s /etc/ files to try to find some mdadm.conf or something that would indicate RAID setup, but I couldn't find anything relevant.