title: Activate iSight in Linux Mint Qiana on a Virtual Machine

text: I'm trying to get the built-in iSight cam of my MacBook Pro 5,1 (running OS X 10.5.8 ) to run under the just-downloaded Linux Mint Qiana edition, which I have installed in Virtual Box (v.4.1.18, for compatibility reasons) as a Virtual Machine. I have installed the firmware and followed the instructions on https://help.ubuntu.com/community/MactelSupportTeam/AppleiSight and the device is apparently recognized and associated with /dev/video0 as it should. I have also installed various libraries like libgcrypt20-dev and libusb-dev according to a suggestion on http://community.linuxmint.com/tutorial/view/669. Nonetheless, the iSight doesn't work under Linux, although it functions correctly under OS X. I have tried:   * Skype (the main purpose of the whole effort): device recognized, no image   * Cheese: device recognized, error msg: "There was an error playing video from the webcam"   * guvcview: device recognized and even switched on, but the captured image is just black   * gstreamer-properties: device recognized, error msg:              gstreamer-properties-Message: Skipping unavailable plugin 'artsdsink'     gstreamer-properties-Message: Skipping unavailable plugin 'esdsink'     gstreamer-properties-Message: Skipping unavailable plugin 'sunaudiosink'     gstreamer-properties-Message: Skipping unavailable plugin 'glimagesink'     gstreamer-properties-Message: Skipping unavailable plugin 'sdlvideosink'     gstreamer-properties-Message: Skipping unavailable plugin 'v4lmjpegsrc'     gstreamer-properties-Message: Skipping unavailable plugin 'qcamsrc'     gstreamer-properties-Message: Skipping unavailable plugin 'v4lsrc'     gstreamer-properties-Message: Skipping unavailable plugin 'esdmon'     gstreamer-properties-Message: Skipping unavailable plugin 'sunaudiosrc'     libv4l2: error turning on stream: Input/output error     gstreamer-properties-Message: Error running pipeline 'Video for Linux 2   (v4l2)': Error starting streaming on device '/dev/video0'. [gstv4l2object.c(2230): gst_v4l2_object_start_streaming (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src1:     system error: Input/output error]     libv4l2: error turning on stream: Input/output error     gstreamer-properties-Message: Error running pipeline 'Video for Linux 2 (v4l2)': Error starting streaming on device '/dev/video0'. [gstv4l2object.c(2230): gst_v4l2_object_start_streaming (): /GstPipeline:pipeline1/GstV4l2Src:v4l2src2:     system error: Input/output error]      I have also explicitly set my user permissions under Linux so I can access video (and audio) devices). Does anybody have an idea what is _still_ going wrong?


title: How to move file based on file name expression using shell script?

text: I want to achieve the following using a shell script. When a script is called with a file as a parameter, it should move the file based on a portion of its name. For example, "Car insurance quotations_zz21.pdf" to sort into 21.Car insurance (a sub-folder of FilingCab) "2012-09-01 Home insurance quote_zz20.pdf" to sort into 20.Home insurance (a sub-folder of FilingCab) Logically I think it should read something like this. I did programming long long time ago, so I think have the algorithm, but do not have the commands or the syntax. Thanks a bunch for help! * * *               FileToMove = $1     FolderNo = (The number after zz and before a .)     ParentFolder = (~/FilingCab)     FolderList = (List of all folders in ParentFolder)      TargetFolder = (Folder among FolderList that begins with FolderNo) - use grep?          if TargetFolder <> not empty              cd ParentFolder              mv FileToMove to TargetFolder     end with success     else              do nothing     endif          end script


title: Regarding .gvfs not letting delete a user's home directory

text: I am using Fedora 9. I removed the user using `userdel -r command`. The user is removed, but the home directory still remains. When I tried to remove the home directory (`rm -rf /home/user/`), I get the following message: > rm: cannot remove '/home/user/.gvfs': Permission denied This happens on random occasions. Which scenario does this occur? Why is this occurring?


title: Malloc and Paging

text: When a user process invokes malloc(n), are there any physical pages allocated to the process? I believe No since malloc allocates from the heap. Is this correct?


title: how to access homedir by root user

text: I want to access `root` user's home directory `/root/`. However following commands dont lead me to the root directory. > sudo -s > > cd ~ It leads to the home dir of regular user. How to access `/root` when using `sudo -s` to login as `root`. I am using `bash4` on `ubuntu12.04`.


title: Utilizing a newer standalone glibc

text: We're running RHEL6, which only officially supports glibc 2.12. A user is requesting that we install a newer version. I grabbed 2.18 from http://ftp.gnu.org/gnu/glibc/ and had no trouble running configure/make. However when I attempt a small program to test it, I don't get the desired result: **test.c**               #include <stdio.h>     #include </scratch/new-glibc-testing/include/gnu/libc-version.h>     int main (void) { puts (gnu_get_libc_version ()); return 0; }      I then compile and run with:               gcc test.c     ./a.out      And the output I get is:               2.12      when I was hoping to get:               2.18      I also tried:               gcc -I/scratch/new-glibc-testing/include test.c      and changed the define line to:               #include <gnu/libc-version.h>      which compiles, but gives the same result (2.12). I tried also using -nostdlib, ex:               gcc -nostdlib -I/scratch/new-glibc-testing test.c      This, however, throws errors:               /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400144     /tmp/cc6x03Do.o: In function `main':     test.c:(.text+0x5): undefined reference to `gnu_get_libc_version'     test.c:(.text+0xd): undefined reference to `puts'     collect2: ld returned 1 exit status      `gcc --version` results in: **gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)**


title: Recover from ext2 filesystem corruption

text: I have a TinyCore (3.6) Linux distribution on a device of mine, which uses disk-on-module or compact flash storage. The filesystem is ext2. I have a LAMP stack on this device and I'm playing with a MySQL database containing over 400 tables (myisam). Write operations occur systematically every 15 minutes. These tables are generated by my web application, according to my setup needs. Now, it happens that this device can be abruptly shut down, due to lack of power. What happens is that, if MySQL is performing some write operation (i.e. `update`, `delete`, `insert`) some of the data as well as index files can be corrupted. It's no big deal for sure, but performing a `repair table` operation is not that bad; tables are repaired and applications can continue running, even if unfortunately some data is lost (which in my case could be acceptable). The problem is that, often, when an abrupt shutdown occurs, several mysql table files (FRM or MYI or MYD) are in "Input/Output error" status and my MySQL front-end reports a "storage engine error 5" (I/O error) for those tables. Applications using the database are obviously unable to run correctly. Rather than to prevent events like those ones (which I think are unavoidable at some extent) I would like to think about something to correctly and possibly automatically recover from file I/O error situations deriving from scenarios described above. Any ideas? **EDIT:** Unfortunately I can't switch to ext3, I must stick with ext2, also due to the fact that ext3 would heavily affect solid state memory write cycles.


title: Where to find file transfer history from a SSH client (Debian/Linux)?

text: Help!! Have you ever tried dragging a folder to another folder by mistake in a graphical SSH client? Well, I did this morning, and since I wanted it to stop immediately (I could see it was about to move hundreds of files), I closed down the client by hitting X. Now, my problem is, I don't know which folder was accidentally moved (well, actually, the client didn't have time to move the folder, but my guess is 3-4 files in it were actually moved). So my question is: **how do I recall the "file transfer" history (or whatever history I need) on a Debian/Linux system?** I have google'd it to no avail. And, of course, I have tried the "history" command and the .bash_history file, but I guess they only cover commands issued from the command line. I don't know how my SSH client issues file commands (my guess is it has something to do with SFTP) so I have no clue where to find the history. My client, in case it matters, is SSH Secure Shell for Windows.


title: Firefox circular-dependency hell on Linux Mint 13

text: Having difficulty re-installing Firefox, after an installation to resolve `places.sqlite` issues. It appears that I'm trapped in _circular_ dependency hell. Need to resolve firefox dependency hell to attempt to resolve Tomcat6 project dependencies (don't ask), ASAP. Have been trying for hours. What I've done (brief)               sudo apt-get purge firefox firefox-globalmenu firefox-gnome-support     sudo apt-get update     sudo apt-get install firefox firefox-globalmenu firefox-gnome-support     sudo apt-get -f install      * * * **Potential error sources:** Found in `sudo apt-get install firefox firefox- globalmenu firefox-gnome-support` > dpkg: error processing > /var/cache/apt/archives/firefox_18.0~a2~hg20121027r113701-0ubuntu1~umd1~precise_amd64.deb > (--unpack): trying to overwrite '/usr/lib/firefox/extensions', which is also > in package mint-search-addon 2012.05.11 So, `/usr/lib/firefox/extensions` doesn't even EXIST! Deleted `/var/cache/apt/archives/firefox_18.0~a2~hg20121027r113701` as per recommendations.               Errors were encountered while processing:      /var/cache/apt/archives/firefox_18.0~a2~hg20121027r113701-0ubuntu1~umd1~precise_amd64.deb     E: Sub-process /usr/bin/dpkg returned an error code (1)      Outputs:   * `sudo apt-get purge firefox firefox-globalmenu firefox-gnome-support`              tyler@machine ~ $ sudo apt-get purge firefox firefox-globalmenu firefox-gnome-support     [sudo] password for tyler:      Reading package lists... Done     Building dependency tree            Reading state information... Done     Package firefox is not installed, so not removed     The following packages will be REMOVED:       firefox-globalmenu* firefox-gnome-support*     0 upgraded, 0 newly installed, 2 to remove and 38 not upgraded.     2 not fully installed or removed.     After this operation, 460 kB disk space will be freed.     Do you want to continue [Y/n]? y     (Reading database ...      dpkg: warning: files list file for package `mysqltuner' missing, assuming package has no files currently installed.     (Reading database ... 192642 files and directories currently installed.)     Removing firefox-globalmenu ...     Removing firefox-gnome-support ...        * `tyler@machine ~ $ sudo apt-get install firefox firefox-globalmenu firefox-gnome-support`              tyler@machine ~ $ sudo apt-get install firefox firefox-globalmenu firefox-gnome-support     Reading package lists... Done     Building dependency tree            Reading state information... Done     Suggested packages:       latex-xft-fonts     The following NEW packages will be installed:       firefox firefox-globalmenu firefox-gnome-support     0 upgraded, 3 newly installed, 0 to remove and 38 not upgraded.     Need to get 0 B/24.8 MB of archives.     After this operation, 54.3 MB of additional disk space will be used.     (Reading database ...      dpkg: warning: files list file for package `mysqltuner' missing, assuming package has no files currently installed.     (Reading database ... 192619 files and directories currently installed.)     Unpacking firefox (from .../firefox_18.0~a2~hg20121027r113701-0ubuntu1~umd1~precise_amd64.deb) ...     dpkg: error processing /var/cache/apt/archives/firefox_18.0~a2~hg20121027r113701-0ubuntu1~umd1~precise_amd64.deb (--unpack):      trying to overwrite '/usr/lib/firefox/extensions', which is also in package mint-search-addon 2012.05.11     Selecting previously unselected package firefox-globalmenu.     Unpacking firefox-globalmenu (from .../firefox-globalmenu_18.0~a2~hg20121027r113701-0ubuntu1~umd1~precise_amd64.deb) ...     Selecting previously unselected package firefox-gnome-support.     Unpacking firefox-gnome-support (from .../firefox-gnome-support_18.0~a2~hg20121027r113701-0ubuntu1~umd1~precise_amd64.deb) ...     Processing triggers for man-db ...     Processing triggers for desktop-file-utils ...     Processing triggers for bamfdaemon ...     Rebuilding /usr/share/applications/bamf.index...     Processing triggers for gnome-menus ...     Processing triggers for mintsystem ...     Errors were encountered while processing:      /var/cache/apt/archives/firefox_18.0~a2~hg20121027r113701-0ubuntu1~umd1~precise_amd64.deb     E: Sub-process /usr/bin/dpkg returned an error code (1)        * `sudo apt-get -f install`     * 0 upgraded, 0 newly installed, 0 to remove, and 38 not upgraded Ideas? Tomcat6 only deploys my web application successfully in Firefox, not Chrome, so I'm really hoping to resolve this dependency issue.


title: Can I change a shortcut key to Windows key?

text: I'm trying to change the shortcut key for "Run Application" ( `Alt`+`F2` ) to the Windows key. When I click "Show the panel's Run application dialog box" in Keyboard Shorcuts, it says "New Shortcut", waiting for my key combination. I press the Windows key… and nothing happens.


title: Why is Run Application (Alt-F2) very sluggish on a new computer?

text: I just got a new, strong ubuntu desktop. First time linux user. I'm trying the Run Application app ( `Alt`+`F2` ), try "Ch" for Chrome, and the app thinks for 2-3 seconds before displaying the list of apps starting with "ch". This is semi-consistent - some searches are a bit faster, then they're slower again afterwards. What's up with that?


title: Oneliner for slicing an image?

text: I'm looking for a oneliner command that would slice an image into given proportions. Say input would be filename and slice dimensions. Are there any standard command-line tools for this? I tried ImageMagick to no avail since it garbled my image immensely (it's big, mostly transparent, png).


title: postfix doesn't respond on 25 from external server

text: I am trying to set up postfix with dovecot. I can telnet to localhost 25 and send a message to accounts on the server. However, when I try to telnet to port 25 on this server from another server I get "421 Cannot connect to SMTP server" ... "connect error 10060". The firewall is open right now:               Chain INPUT (policy ACCEPT)     target     prot opt source               destination                   Chain FORWARD (policy ACCEPT)     target     prot opt source               destination                   Chain OUTPUT (policy ACCEPT)     target     prot opt source               destination      Is there some setting in main.cf which tells it whether or not it should listen on port 25 or 587 or whatever?


title: Enforce site-wide SSL on Debian LAMP

text: I have a Debian/Linux Lenny LAMP server w/Plesk Panel 10.2. I have a PHP/MySQL webapp deployed in a Plesk "webspace". I want to enforce SSL on site-wide. Do I just forward port 80 to 443? For my single domain cert, do I forward www.domain.com to domain.com or do I forward domain.com to www.domain.com? Should this happen with .htaccess or some vhost config file?


title: A Linux Distribution for Nintendo DS Lite

text: I want to use a linux OS on my Nintendo DS Lite. Tried to use the DSLinux, but it turned the device into white and non-responsive screens! Went on IRC channel and got the advice to learn C and solve the DSLinux problem!!!. So the question here is how I can peacefully get an operating system that I can run on my DS lite. The following steps created the error:   * Got the file dslinux.tgz from http://www.dslinux.org/builds/.   * Unzipped the file and moved its folder into a SD card.    * Inserted the SD within R4SDHC adaptor card and turned on the DS.    * Went to its folder and chose the Linux Logo.  Then both screen went white.


title: Remove window frame of a program

text: Is it possible to start a program without its window frame? For example: start flash standalone on a SUSE Linux Enterprise Server 11 sp2 machine without its window frame so it looks like when I start a browser and remove it's window- decoration and show the flash with the browser plugin. We could use the browser but the browser on SLES 11 sp2 is webkit 0.2 and is very bugy. I tried to remove the window with devilspie (http://rpm.pbone.net/index.php3/stat/4/idpl/15612342/dir/opensuse_11.x/com/devilspie-0.22-10.1.i586.rpm.html) but it does nothing. I was able to install it and set de .ds files but they have no effect. I started the program with:               devilspie -d -a     Devil's Pie 0.22 starting...     Loading /etc/devilspie     Loading /root/.devilspie     Loading /root/.devilspie/flashplayer.ds     1 s-expression loaded.      The "flashplayer.ds":               (if (is (application_name) "flashplayer")       (begin         (undecorate)       )     )      When I search for active windows with `xlsclients` it shows me that output:               # xlsclients     SLES11-SP2 xterm     SLES11-SP2 /usr/bin/xconsole -notify -nostdin -verbose -exitOnFail     SLES11-SP2 flashplayer      So the `application_name` must match. Any idea to resolv it with `devilspie` or an other "trick"?


title: What are the most secure cryptsetup parameters to create an Encrypted filesystem?

text: According to http://16s.us/Linux/dm-crypt.txt, it's better to use only dm- crypt, because LUKS leaves a trace. That's OK. But, what are the most secure cryptsetup parameters to use? E.g.: "aes-cbc-essiv:sha512" is better then the default. Also the default cryptsetup uses 256bit AES, but it could be (max?) 512bit. Which parameters create an encrypted partition with the most security?


title: Why Redhat is not installing using HTTP

text: Im trying to install Rehdat using HTTP and these are the steps I preformed to do it.   1. I copied the iso image in /var/www/rhel/5.9/   2. Then i made a HTTP YUM repo under /yum-repo.d/rhel-5.9.repo/Server Contents of rhel-5.9.repo               [rhel-5.9.repo]     name = Redhat 5.9 HTTP repo     baseurl=http://localhost/rhel/5.9/installmedia/Server/     enabled=1     gpgcheck=0      3.Run YUM REPO LIST 4.I'm installing Redhat using Virtual Box. And both Server and Client are on same subnet 5.And when I start the installation and after skipping Test the Media Dialog Box I eject the Media. And installation stops. What Im doing wrong here.


title: Need to change the mount Point of LVM /u001/app/oracle to /u001/

text: This is the situation.I installed the RHEL 5.5 on client's system and created LVM mount point at /u001/app/oracle and now he has installed DB on /u001/app/oracle. He is asked me to change the mount point of Existing LVM /u001/app/oracle to /u001/. And preserve the directories /app/oracle in /u001/. Problem is this if i change the mount point of LVM from /u001/app/oracle/ to /u001/ it will delete the directories /app/oracle and database will not be able to identify the NEW URL. Now this is what i need Change the mount point of /u001/app/oracle to /u001/ and preserve the /app/oracle/ directories (These two shouldn't be deleted after changing the mount point because these are the part of URL database is using) Directory Structure               FileSystem                            Size     Used     Mounted on      /dev/sda1                             100G     21G      /     /dev/mapper/VolGroup00-LogVol00       450G     83G      /u001/app/oracle     /dev/sda2                             487M     13M      /boot


title: Fedora in Oracle VM VirtualBox: installing guest additions

text: What are the pros and conses of two method of installing VirtualBox guest additions:   * via the `Devices -> Install Guest Additions...`;   * via `su -c 'yum install VirtualBox-guest'` from `rpmfusion` repository.


title: VirtualBox with a transparent drive

text: I want to create a virtualbox VM for experimenting with Linux that uses a directory or some device that is completely transparent to the outside. Further, I do not want networking to work on this VM. Essentially I want it to look very much like a chroot system, but it should be running in it's own emulated environment. Either that or I want the vdi or some other kind of emulation of a hardware I use to be mountable read/write on the host system.


title: Make gVim use last compiled version of vim

text: I've compiled the latest version of vim with some options. Is there a way to make gVim use the same vim as in the console ?


title: Display hostname in GDM3 on Fedora 19 at login screen

text: I'm managing almost 100 lab PC's running Fedora 19. It's difficult to manage because it seems like no where that I can display the hostname at the login screen. GDM version: gdm-3.8-3.2


title: Why does drive not enter standby mode when using hdparm -S

text: When reading the `hdparm` manual pages, it says that the `-S` value > is used by the drive to determine how long to wait (with no disk activity) > before turning off the spindle motor to save power When configuring my drives with `hdparm -B 1 -K 1 -S 120 /dev/sd[d-z]` the output is: > >      setting drive keep features to 1 (on) >      setting Advanced Power Management level to 0x01 (1) >      setting standby to 120 (10 minutes) >      APM_level    = 1 >   And initial drive state `hdparm -C /dev/sd[d-z]` is " _active/idle_ ". All these `/dev/sd[d-z]` drives are off the same make and model, not partitioned, not formatted and not mounted. After **waiting for 15 minutes** , the drive state is still " _active/idle_ ". Only when issuing a "Force an IDE drive to immediately enter the low power consumption standby mode" using `hdparm -y /dev/sd[d-z]` the drive go to a " _standby_ " state. **Why do my drives not enter the low power consumption standby state** after the hdparm specified timeout value? * * * Some more drive specs derived from `hdparm -I /dev/sdd`               /dev/sdd:          ATA device, with non-removable media         Model Number:       Hitachi HDS5C3020BLE630                          Firmware Revision:  MZ4OAAB0         Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8-AST T13 Project D1697 Revision 0b     Standards:         Used: unknown (minor revision code 0x0029)          Supported: 8 7 6 5          Likely used: 8     Configuration:         Logical     max current         cylinders   16383   16383         heads       16  16         sectors/track   63  63         --         CHS current addressable sectors:   16514064         LBA    user addressable sectors:  268435455         LBA48  user addressable sectors: 3907029168         Logical  Sector size:                   512 bytes         Physical Sector size:                  4096 bytes         Logical Sector-0 offset:                  0 bytes         device size with M = 1024*1024:     1907729 MBytes         device size with M = 1000*1000:     2000398 MBytes (2000 GB)         cache/buffer size  = 22756 KBytes (type=DualPortCache)         Form Factor: 3.5 inch         Nominal Media Rotation Rate: 5700     Capabilities:         LBA, IORDY(can be disabled)         Queue depth: 32         Standby timer values: spec'd by Standard, no device specific minimum         R/W multiple sector transfer: Max = 16  Current = 16         Advanced power management level: 1         DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6               Cycle time: min=120ns recommended=120ns         PIO: pio0 pio1 pio2 pio3 pio4               Cycle time: no flow control=120ns  IORDY flow control=120ns     Commands/features:         Enabled Supported:            *    SMART feature set                 Security Mode feature set            *    Power Management feature set            *    Write cache            *    Look-ahead            *    Host Protected Area feature set            *    WRITE_BUFFER command            *    READ_BUFFER command            *    NOP cmd            *    DOWNLOAD_MICROCODE            *    Advanced Power Management feature set                 Power-Up In Standby feature set            *    SET_FEATURES required to spinup after power up                 SET_MAX security extension            *    48-bit Address feature set            *    Device Configuration Overlay feature set            *    Mandatory FLUSH_CACHE            *    FLUSH_CACHE_EXT            *    SMART error logging            *    SMART self-test                 Media Card Pass-Through            *    General Purpose Logging feature set            *    WRITE_{DMA|MULTIPLE}_FUA_EXT            *    64-bit World wide name            *    URG for READ_STREAM[_DMA]_EXT            *    URG for WRITE_STREAM[_DMA]_EXT            *    WRITE_UNCORRECTABLE_EXT command            *    {READ,WRITE}_DMA_EXT_GPL commands            *    Segmented DOWNLOAD_MICROCODE                 unknown 119[7]            *    Gen1 signaling speed (1.5Gb/s)            *    Gen2 signaling speed (3.0Gb/s)            *    Gen3 signaling speed (6.0Gb/s)            *    Native Command Queueing (NCQ)            *    Host-initiated interface power management            *    Phy event counters            *    NCQ priority information                 Non-Zero buffer offsets in DMA Setup FIS                 DMA Setup Auto-Activate optimization                 Device-initiated interface power management                 In-order data delivery            *    Software settings preservation            *    SMART Command Transport (SCT) feature set            *    SCT Write Same (AC2)            *    SCT Error Recovery Control (AC3)            *    SCT Features Control (AC4)            *    SCT Data Tables (AC5)     Security:          Master password revision code = 65534             supported         not enabled         not locked             frozen         not expired: security count         not supported: enhanced erase         416min for SECURITY ERASE UNIT.      Logical Unit WWN Device Identifier: 5000cca37dc106a3         NAA     : 5         IEEE OUI    : 000cca         Unique ID   : 37dc106a3     Checksum: correct


title: How can I list all files and symlinks in a compact view?

text: This is my setup in `/tmp/test/` if I use `ls -l`               -rw-r--r--  1 rubo77 rubo77    0 Okt 21 04:15 a     -rw-r--r--  1 rubo77 rubo77    2 Okt 21 04:16 b     drwxr-xr-x  2 rubo77 rubo77 4,0K Okt 21 03:58 c     lrwxrwxrwx  1 rubo77 rubo77    1 Okt 21 03:57 d -> c     lrwxrwxrwx  1 rubo77 rubo77    1 Okt 21 03:58 e -> a     lrwxrwxrwx  1 rubo77 rubo77    2 Okt 21 03:59 f -> nofile      * * * If I use just `ls` I see only the files without details:               a b c d e f      * * * `ls -F` appends an indicator (one of */=>@|) to entries               a  b  c/  d@  e@  f@      * * * **How can I achieve this display?**               a  b  c/  d->c/  e->a  f->nofile


title: Open a port CentOS

text: I'm new in CentOS and I'm trying to create a little script in Python, something like:               $ python -m SimpleHTTPServer      If I try to access port 8000 in my web browser, I don't get access, however if I turn off the firewall with:               $ system-config-firewall-tui      I'm able to access the service. I just need to access port 3343 and 8880 but I don't want to disable the firewall.


title: How do I check if a file is a symbolic link to a directory?

text: I can check, if a file exists and is a symbolic link with -L               for file in *; do         if [[ -L "$file" ]]; then echo "$file is a symlink"; else echo "$file is not a symlink"; fi     done      and if it is a directory with -d:               for file in *; do         if [[ -d "$file" ]]; then echo "$file is a directory"; else echo "$file is a regular file"; fi     done      But how can I test for only links to directories? * * * I simulated all cases in a test folder:               /tmp/test# ls     a  b  c/  d@  e@  f@          /tmp/test# file *     a: ASCII text     b: ASCII text     c: directory     d: symbolic link to `c'     e: symbolic link to `a'     f: broken symbolic link to `nofile'


title: while loop is running only once?

text: I am trying to make a clip out of video file by playing it only for certain interval. make_mclip.sh               #!/bin/bash          mediafile=$@     mediafile_fullpath=$PWD/./$mediafile     tmpedlfile=$(mktemp)          mplayer -edlout $tmpedlfile "$mediafile" &> /dev/null          cat $tmpedlfile | while read f     do         startpos=$(echo $f | awk '{print $1}')         endpos=$(echo $f | awk '{print $2}')         length=$(echo "$endpos-$startpos" | bc)              tmpclip=$(mktemp --suffix='.mclip' --tmpdir=$PWD)         echo -e "$mediafile_fullpath\t$startpos\t$length" > $tmpclip              mplayer_clip.sh "$tmpclip" &>/dev/null              echo -n "clip name : "         read clipname < /dev/tty              mv -nv "$tmpclip" "$clipname.mclip"     done          echo doing rm "$tmpedlfile"      mplayer_mclip.sh               #!/bin/bash          mediafile=$(cat "$@" | awk -F'\t' '{print $1}')     startpos=$(cat "$@" | awk -F'\t' '{print $2}')     length=$(cat "$@" | awk -F'\t' '{print $3}')          mplayer -ss $startpos -endpos $length "$mediafile" &> /dev/null      But for some reason the while loop in make_mclip.sh is only run once even if $tempedlfile contains more than one line; the only exception is if the line                   mplayer_clip.sh "$tmpclip" &>/dev/null      is removed. Whats wrong ? ps. I would also like to know if there is already a program for this .


title: ranaming multiple file in unix

text: > **Possible Duplicate:**   >  Renaming multiple files in unix Rename all files within a folder with the first word of their content(remember all the files should be text files. For example if a.txt contains “Unix is an OS” in its first line then a.txt should be renamed to Unix.txt


I am trying to install OpenStack on Ubuntu 12.04.3 Desktop AMD 64 in VMware on a host Dell Inspiron15R 5521 with Windows 8 64-bit. I have followed the tutorial here but I'm getting error > Your system isn't configured to run KVM properly. Investigate this before > continuing. after I run the command as suggested in tutorial               ./openstack_networking.sh


title: Is there a OS/user-wide log to log to?

text: I'm using curl to dowload a jar from a TESTDRIVE script and for debugging purposes it helps to log the http headers returned to a log file. But logging them in the working dir (where the script is executed from) is inconvenient (for the user). I was wondering if there was a /logs/log in unix systems where applications could log their stuff. Console in the mac indeed seems to pickup logs from multiple applications, somehow.


title: why for loop doesn't raise "argument too long" error?

text: I found that this would raise the "argument too long" error:               ls *.*      And this would not raise it:               for file in *.*     do         echo $file     done      Why?


title: How to manipulate awk variable NF in zsh?

text: I have a simple command line:               uptime | awk '{print $(NF - 2)}'      In a bash shell, this works without a hitch, but when I run it in zsh, I get the following error:               title:5: command not found: NF      As usual this will be a pilot error (me not grokking how expansion works in zsh), but I cannot figure out what to do to get the same command to work in zsh. [Edit] The zsh version is 4.3.11 on OSX, and the output from `set -xv; uptime | awk '{print $(NF - 2)}'` is:               $ set -xv; uptime | awk '{print $(NF - 2)}'     title:5: command not found: NF     +zsh:3> uptime     +zsh:3> awk '{print $(NF - 2)}'     0.51     +precmd:1> title '%15<..<%~%<<' '%n@%m: %~'                                                                                +title:1> [ '' '!=' true ']'     +title:2> [[ xterm-256color == screen* ]]     +title:4> [[ xterm-256color == xterm* ]]     +title:5> print -Pn '\e]2;%n@%m:\ %~\a'     +title:6> print -Pn '\e]1;%15\<..\<%~%\<\<\a'     +zsh:4> git_prompt_info     +git_prompt_info:1> ref=+git_prompt_info:1> ref=''      +git_prompt_info:1> return     +zsh:4> vi_mode_prompt_info     +vi_mode_prompt_info:1> echo ''      So apparently the awk command works, but my terminal customization is borked.


title: BIND Server problem in Fedora

text: I am install the Bind Server in Fedora Linux.I configured the named.conf file.However, When I run "service named start" command,I am receive the following error.               starting named: /usr/sbin/named: symbol lookup error:      /usr/sbin/named: undefined    symbol:isc_stats_dump      What can happen? Here is my the named.conf file.               //          // named.conf          //           // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS          // server as a caching only nameserver (as a localhost DNS resolver only).          //          // See /usr/share/doc/bind*/sample/ for example named configuration files.          //               options {          listen-on port 53 { 127.0.0.1; };          listen-on-v6 port 53 { ::1; };          directory "/var/named";          dump-file "/var/named/data/cache_dump.db";              statistics-file "/var/named/data/named_stats.txt";              memstatistics-file "/var/named/data/named_mem_stats.txt";          allow-query     { localhost; };          recursion yes;          };               logging {              channel default_debug {                      file "data/named.run";                      severity dynamic;              };           };                zone "." IN {           type hint;           file "named.ca";           };                include "/etc/named.rfc1912.zones";               zone "ilker.net." {               type master;          allow-query{ any; };          file "/var/named/ilker.net";           };      I created the a file called ilker.net in the /var/named folder. Thanks in advance.


title: How to access flash site that is rejecting my plugin (64-bit)?

text: I am trying to buy tickets on stubhub.com but the site is telling that I need to install the flash plugin. I already have a 64-bit flash plugin (Adobe) installed on my Fedora 14 64-bit system. youtube and all other flash content I have tried has worked fine. Just stubhub.com is a problem. I have tried both Firefox 4 and Chrome 9 with no success, however the page loaded fine on Chrome in Windows 7. So I am not sure if it is my plugin or browser, or both that is to blame. I was thinking about trying a 32bit plugin but I am not sure if that would work. There was a thread at linuxquestions.org, but no solutions: http://www.linuxquestions.org/questions/slackware-14/flash-player-problem- sometimes-857110/ Is there anyway that I can diagnose and bypass the plugin check on stubhub.com? I am sorry if this isn't a very clear question, but I never thought Linux would come between me and a pair of Yankees tickets. **UPDATE** Using both a wrapped 32-bit flash plugin and leigh123linux's 64-bit Fedora RPM plugin worked fine.


title: Connecting fetchmail (or another MRA) to Exchange

text: I currently use fetchmail as my MRA, using IMAP to connect to my office's Exchange 2007 server. Unfortunately, IT is disabling POP3 and IMAP access soon. Does fetchmail support connecting to Exchange servers directly? If not (and I'm pretty convinced the answer is no), is there another MRA that does support Exchange?


title: Is possible to change X server without kill client?

text: My usecase: User opertes on `Server1` station. He can use ssh or whatever to connect with `Remote Station` and start some application on it and display it on his station (`Server1`). Now user has to change his place and operate on `Server2`. I know that he can start new instance of application and display it on `Server2`. But I want to dispaly the same running instane of application on `Server2`. Is it possible? How to do that? ![enter image description here](http://i.stack.imgur.com/0KnfJ.png)


title: How to move a window from one Window Manager to another running WM?

text: I use `libreoffice` on my `X11-server` and then I want to continue to work on the same text in the same window from another place using `VNC`. So, it would be nice if it is possible to detach a `X11-window` from one Window Manager and attach it to a different one (on a different DISPLAY running on a different X-server) which is already running. I'm using the `awesome window-manager`. Is this possible?


title: How can I make a script in /etc/init.d start at boot?

text: I think I read something a while back about this, but I can't remember how it's done. Essentially, I have a service in `/etc/init.d` which I'd like to start automatically at boot time. I remember it has something to do with symlinking the script into the `/etc/rc.d` directory, but I can't remember at the present. What is the command for this? I believe I'm on a Fedora/CentOS derivative.


title: rpc.statd running on system not using NFS

text: I have a Debian machine that gets warnings (via the Tiger automatic auditor) that `rcp.statd` is listening on such-and-such socket. Googling shows `rpc.statd` is a daemon used by NFS. As far as I know, I'm not using (and have not installed) anything related to NFS. What would have installed/started this service, and what do I need to do to disable the appropriate `rcp.statd` and NFS daemons?


title: Didn't have to specify a login name during installation, now it asks me for one?

text: So I only created a root account during the installation process (which comes down to me only providing a root password, no name or ID or anything). During my first boot it sends me to a black screen (tty1) where it asks me for a login: (computer name) login: which I clearly never specified. Using 'root' and my corresponding password doesn't work. Neither does leaving "login" blank. Is this possible? Or is it some stupid mistake like an actual wrong password or a keyboard layout differing? (please consider the latter as a final explanation, I'm pretty sure that my password is correct, as I tried both possible regional layouts (azerty & qwerty, caps and non-caps)). Thanks in advance


title: Problem when trying to cross-compile an ethernet driver on an old Linux kernel

text: I'm currently trying to cross-compile a network driver against an old Linux kernel, in version 2.6.27.7 but the compilation fails and prints:               make[1]: entering directory « /home/johann/Desktop/linux-2.6.27.7 »     Building modules, stage 2.     MODPOST 0 modules     make[1]: leaving directory « /home/johann/Desktop/linux-2.6.27.7 »      The command I ran to get this was taken from the readme found with the sources:               make KSRC=<source> KDIR=<build>      I'm no expert with makefiles, yet I think there's something wrong with the one provided by the driver source. Here's how it looks like:               #     # Makefile to build the be2net network driver     #          # find a source path that exists among the possible paths     ver = $(shell uname -r)     paths := /lib/modules/$(ver)/source /lib/modules/$(ver)/build     exists = $(shell [ -e $(path)/include/linux ] && echo $(path))     paths := $(foreach path, $(paths), $(exists))     ifeq (,$(KSRC))         KSRC := $(firstword $(paths))     endif          # ************** Header checks ********************     ifneq (,$(shell grep -o alloc_etherdev_mqs $(KSRC)/include/linux/etherdevice.h))         EXTRA_CFLAGS += -DALLOC_ETHDEV_MQS_defined     endif          ifneq (,$(shell grep -o alloc_etherdev_mq $(KSRC)/include/linux/etherdevice.h))         EXTRA_CFLAGS += -DALLOC_ETHDEV_MQ_defined     endif          ifneq (,$(shell grep -o netif_set_real_num_rx_queues $(KSRC)/include/linux/netdevice.h))         EXTRA_CFLAGS += -DNETIF_SET_REAL_NUM_RX_QS_defined     endif          ifneq (,$(shell grep -o PCI_DEV_FLAGS_ASSIGNED $(KSRC)/include/linux/pci.h))         EXTRA_CFLAGS += -DPCI_FLAGS_ASSIGNED_defined     endif          ifneq (,$(shell grep -o skb_frag_set_page $(KSRC)/include/linux/skbuff.h))         EXTRA_CFLAGS += -DSKB_FRAG_API_defined     endif          ifneq (,$(shell grep -o skb_frag_size $(KSRC)/include/linux/skbuff.h))         EXTRA_CFLAGS += -DSKB_FRAG_SIZE_defined     endif          ifneq (,$(shell grep -o netdev_alloc_skb_ip_align $(KSRC)/include/linux/skbuff.h))         EXTRA_CFLAGS += -DALLOC_SKB_IP_ALIGN_defined     endif          ifneq (,$(shell grep -o skb_record_rx_queue $(KSRC)/include/linux/skbuff.h))         EXTRA_CFLAGS += -DSKB_RECORD_RX_QUEUE_defined     endif          ifneq (,$(shell grep -o rxhash $(KSRC)/include/linux/skbuff.h))         EXTRA_CFLAGS += -DRXHASH_defined     endif          #GRO is usable only when full implementation is available     ifneq (,$(shell grep -o napi_get_frags $(KSRC)/include/linux/netdevice.h))         EXTRA_CFLAGS += -DGRO_defined     endif          ifneq (,$(shell grep -o netdev_alloc_skb $(KSRC)/include/linux/skbuff.h))         EXTRA_CFLAGS += -DALLOC_SKB_defined     endif          ifneq (,$(shell grep -o dev_mc_list $(KSRC)/include/linux/netdevice.h))         EXTRA_CFLAGS += -DDEV_MC_LIST_defined     endif          ifneq (,$(shell grep -o pcie_set_readrq $(KSRC)/include/linux/pci.h))         EXTRA_CFLAGS += -DPCIE_SET_READRQ_defined     endif          ifneq (,$(shell grep -so vlan_group_set_device $(KSRC)/include/linux/if_vlan.h $(KSRC)/net/8021q/vlan.h))         EXTRA_CFLAGS += -DVLAN_GRP_SET_DEV_defined     endif          ifneq (,$(shell grep -o "struct vlan_group" $(KSRC)/include/linux/if_vlan.h))         EXTRA_CFLAGS += -DVLAN_GRP_defined     endif          ifeq (,$(shell grep -o "vlan_hwaccel_receive_skb" $(KSRC)/include/linux/if_vlan.h))         EXTRA_CFLAGS += -DUSE_NEW_VLAN_MODEL     endif          ifneq (,$(shell grep -o ndo_set_vf_mac $(KSRC)/include/linux/netdevice.h))         EXTRA_CFLAGS += -DNDO_VF_CFG_defined     endif          ifneq (,$(shell grep -o ndo_set_features $(KSRC)/include/linux/netdevice.h))         EXTRA_CFLAGS += -DNDO_SET_FEATURES_defined     endif          ifneq (,$(shell grep -so "ethtool_cmd_speed_set" $(KSRC)/include/linux/ethtool.h \                             $(KSRC)/include/uapi/linux/ethtool.h))         EXTRA_CFLAGS += -DETHTOOL_CMD_SPEED_SET_defined     endif          ifneq (,$(shell grep -so "ethtool_cmd_speed" $(KSRC)/include/linux/ethtool.h \                         $(KSRC)/include/uapi/linux/ethtool.h))         EXTRA_CFLAGS += -DETHTOOL_CMD_SPEED_defined     endif          ifneq (,$(shell grep -o "ethtool_phys_id_state" $(KSRC)/include/linux/ethtool.h))         EXTRA_CFLAGS += -DPHYS_ID_STATE_defined     endif          ifneq (,$(shell grep -o "flash_device" $(KSRC)/include/linux/ethtool.h))         EXTRA_CFLAGS += -DETHTOOL_FLASH_defined     endif          ifneq (,$(shell grep -o "get_sset_count" $(KSRC)/include/linux/ethtool.h))         EXTRA_CFLAGS += -DETHTOOL_SSET_COUNT_defined     endif          ifneq (,$(shell grep -o "set_dump" $(KSRC)/include/linux/ethtool.h))         EXTRA_CFLAGS += -DETHTOOL_SET_DUMP_defined     endif          ifneq (,$(shell grep -o "ethtool_ops_ext" $(KSRC)/include/linux/ethtool.h))         EXTRA_CFLAGS += -DETHTOOL_OPS_EXT_defined     endif          ifneq (,$(shell grep -o "pci_enable_pcie_error_reporting" $(KSRC)/include/linux/aer.h))         EXTRA_CFLAGS += -DAER_REPORTING_defined     endif          ifneq (,$(shell grep -o "pci_physfn" $(KSRC)/include/linux/pci.h))         EXTRA_CFLAGS += -DPCI_PHYSFN_defined     endif          ifneq (,$(shell grep -o "set_rxnfc" $(KSRC)/include/linux/ethtool.h))         EXTRA_CFLAGS += -DETHTOOL_RXNFC_OPS_defined     endif          ifneq (,$(shell grep -o ndo_get_stats64 $(KSRC)/include/linux/netdevice.h))         EXTRA_CFLAGS += -DNDO_GET_STATS64_defined     endif          ifneq (,$(shell grep -o txq_trans_update $(KSRC)/include/linux/netdevice.h))         EXTRA_CFLAGS += -DTXQ_TRANS_UPDATE_defined     endif     # ************* End header checks *****************          # ************* Targets ***************************     ifeq ($(KERNELRELEASE),)     ifeq ($(KDIR),)         KDIR ?= /lib/modules/`uname -r`/build     endif        default:         @$(MAKE) -C$(KDIR) M=$$PWD     clean:         @$(MAKE) -C$(KDIR) M=$$PWD clean     else     obj-$(CONFIG_BE2NET) += be2net.o     be2net-y :=  be_main.o be_cmds.o be_ethtool.o be_compat.o be_misc.o inet_lro.o     endif     # ************* End Targets ************************      I didn't see any $(CONFIG_BE2NET) variable declared prior to its usage, for instance. I'm aware it's a specific issue... I've actually just started to learn how to produce makefile to help me understand this, but any help would be greatly appreciated :)


title: Prevent a subdirectory from getting deleted / enforce a directory structure

text: imagine the following folder structure > ../documents > > ../documents/templates I have two user groups:   * editors   * managers Users of both groups should be able to   * create new files   * modify any files   * delete any files in ../documents. Both groups should also be able to read any files in ../documents/templates. Only users in group "managers" should be able to   * create new files   * modify any files   * delete any files in ../documents/templates. The directory "../documents/templates" should be undeletable for both groups! How can I achieve that? I came to the conclusion, that this isn't possible with Linux (even with POSIX ACLs), because you need to set g=rwx for "documents", which will allow users of both groups to create/delete/modify **any** files in that directory... but +w also allows the deletion of the subdirectory "templates" and I don't know a way to deny that.


title: Best way to benchmark different encryption solutions on my system

text: I want to compare different encryption solutions for encrypting my system, possibly different solutions for different parts of the system such as `/usr` or `/home`. In particular I look at dm-crypt partitions, containers, truecrypt, ecryptfs and encfs with different parameters. For several reasons I think that just measuring raw seq read and write speeds using `dd` is not enough:   * seq read/write gives me different CPU loads, for example ecryptfs loads only one core (up to 100%) whereas dm-crypt is faster, but loads both cores, so in real use ecryptfs may be faster when the system is under load from other applications (maybe not, but how do I benchmark this?)   * it's all about an SSD so I want to have benchmark, which indicates for which option the system will feel more responsive, so I should include some random read write tests or something like that as well (but I don't know how to do so)   * benchmarking a solution for `/usr` may need other benchmarks than for `/home` since the i/o characteristics may be different I should add that my CPU doesn't support AES instructions, so it is a limiting factor in performance. I don't want to isolate a part of the system but compare the different encryption solutions for the SSD in my particular system. So what's the best way to benchmark in my case and how to do it in detail?


title: Creating a Vagrant box with Docker installed

text: I'm trying create a nice playground for Docker in Vagrant based on Vagrant's `precise64` box. (Code is available at GitHub: rfkrocktk/docker-vagrant- playground) Here's my Puppet provisioning dependencies for the instance:               # Puppet for Docker Vagrant Box     node default {         # apt         class { 'apt': }              apt::source { 'docker':             location => "http://get.docker.io/ubuntu",             key => "36A1D7869245C8950F966E92D8576A8BA88D21E9",             release => "docker",             repos => "main",             include_src => false         }              package { 'raring-kernel':             name => 'linux-image-generic-lts-raring',             ensure => present         }              package { 'lxc-docker':             require => [apt::source["docker"], Package["raring-kernel"]]         }     }      (This follows Docker's guide on installing on Ubuntu 12.04 LTS.) Unfortunately, I'm running into problems with this, as Docker more-or-less requires a later kernel (>=3.9), which is why the `linux-image-generic-lts- raring` package is declared as a dependency. It's also necessary to be _running_ this kernel to be able to use LXC (and by injunction, Docker) properly. After running `vagrant up` or `vagrant provision`, I restart the box to be able to boot into the new kernel. Unfortunately, the VirtualBox Guest Additions don't seem to be registered with DKMS properly:               Failed to mount folders in Linux guest. This is usually because     the "vboxsf" file system is not available. Please verify that     the guest additions are properly installed in the guest and     can work properly. The command attempted was:          mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant     mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant      Is there a simple way to get a box based on `precise64` with the Raring kernel running and installed properly? I'd like to be able to quickly get going with a virtualized environment ready for Docker experimentation.


title: awk want to total by hour and variable

text: I am able to run this and it works fine - note: field $1 is a time/date stamped field..               gawk -F ":" "{ print $1 }" /cygdrive/c/counting/ourlog | sort | uniq -c | sort -r       57339 2014-03-21 09       54290 2014-03-21 08       54036 2014-03-21 10       53254 2014-03-21 11       52777 2014-03-21 12       50785 2014-03-21 07       49729 2014-03-21 16       44459 2014-03-21 15       43932 2014-03-21 13       43335 2014-03-21 06       40952 2014-03-21 14       40864 2014-03-21 17      Now, what I want to do is to suppress the first 10 rows (they are comments preceding with a #) - and this can vary. So, we want to look for the first xx rows that begin with a #. We change the script to:               gawk -F ":" "{ print $1 }" /cygdrive/c/counting/ourlog | sort | uniq -c | sort -r | gawk -v MyID="$id" '/#/{n++}; END {print n+0}' | gawk "NR> MyID "      but this does not work. If we make a couple more changes - we see the desired result:               gawk -F ":" "{ print $1 }" /cygdrive/c/counting/ourlog | gawk "NR>10" | sort | uniq -c | sort -r      I know I can physically type in 10 to skip the first 10 or 20 rows. However, I want that to be a calculated value.


title: Configuring the default timeout for the SSH agent

text: I use `ssh-add` to add my SSH keys to the SSH agent. By default, it adds them indefinitely. There's a command-line option to specify a timeout, but is there a configuration file option which will specify the default timeout? What I want is to be able to run `ssh-add` without any command-line parameters and have it default to a given amount of time for a timeout (as if I had called `ssh-add -t 1h`).


title: Booting into a kernel image

text: I have a recently-compiled Linux kernel image (vmlinuz file) and I want to boot into it. I am aware that this won't give me a familiar Linux system, but I am hoping to be able to at least run some basic "Hello world" program as the init process. Is this even possible, and if so, how? So far I have tried to do this by installing GRUB on a USB which had an ext2 filesystem with the vmlinuz file in /boot. It must have loaded the kernel image because it ended in a kernel panic message: "VFS: Unable to mount root fs on unknown-block(0,0)" Here is the entry in grub.cfg:               menuentry 'linux' --class os {         recordfail         gfxmode $linux_gfx_mode         insmod gzio         insmod part_msdos         insmod ext2         set root='(hd0)'         search --no-floppy --fs-uuid --set=root <my USB drive's UUID>         linux /boot/vmlinuz root=UUID=<my USB drive's UUID> ro $vt_handoff     }      Thanks for any help.


title: For what are disk signatures being used for by GNU/Linux (distributions) / grub?

text: I am talking about disk signatures in context of the MBR. The area from 441 to 445 bytes. For what does the GNU/Linux kernel, GNU/Linux distributions usually use disk signatures for? I only found wikipedia and this as reference, that (MBR) disk signatures are in context of Linux used for something at all.


title: Is there a way to make a Bash script enter a certain keystroke?

text: Is there any way to make a `bash` script enter a certain keystroke? What I'm trying to accomplish here is a script that will run `Ctrl`+`B` to exit `tmux`. EDIT: I see that several people are saying that it's better to use a program - specific command. What if I wanted to edit a text file (in this case the bash_aliases file) using a bash script?


title: Want Windows to boot instead of Grub

text: So when I turn my computer on, Grub rescue boots up. I have finally figured out how to get into Windows, but now I want to skip the step of entering the information into Grub to get into windows. How do I make Windows boot before Grub does?


title: mutt: rename IMAP folder

text: How does one interactively rename an IMAP folder within the `mutt` MUA? Currently, if I want to change a folder name, I use the gmail web browser interface, but this is rather inefficient. Is there an equivalent of the unix `mv` command in `mutt`? When I search for this topic on google, the search results pertain to renaming local mutt folders and files like `.muttrc`.


title: Suggest me an iscsi server which supports adding a target at runtime

text: Default iscsitarget requires to restart the whole server after editing the `/etc/iet/ietd.conf`. This is a problem as if, any iSCSI target is being read/wrote the server restart will make every operation fail. Moreover I would need to programmatically interact with this server (in java) and, from what I saw, iscsitarget doesn't provide any library/api to do so..and initiators don't contemplate this operation. So, I believe some other vendor created an iSCSI server more suited to my needs, do you know any?


title: Source path of loop-device

text: Out of curiosity, I would like to know is there any way to find out the source of mounted partition ? e.g. Output of `df -h` is : > /dev/loop1 3M 3M 0 100% /media/loop From this output, I know a loop device of 3M is mounted at `/media/loop` but I have no clue to determine the exact location of `/dev/loop1` device. **EDIT:**               root@SHW:~# mount -o loop /home/SHW/Downloads/TinyCore-current.iso     /mnt/loop mount: block device /home/SHW/Downloads/TinyCore-current.iso is write-protected, mounting read-only     root@SHW:~# tail -n1 /proc/mounts     /dev/loop1 /mnt/loop iso9660 ro,relatime 0 0      How do I find out the absolute path of `/dev/loop1` ? If I don't know who mounted those partitions (In this case the path is /home/SHW/Downloads/TinyCore-current.iso)


title: Security for a web server for multiple people?

text: I have an apache web server set up where multiple people have their websites hosted, mostly php based websites. The problem is, when these people upload their website files, it has read permissions for all, so everybody can read everybody's files, including files that include database user data which can be very dangerous. They ssh into the server and 'cat' other people's files, but even disabling SSH won't solve the problem because they can publish a php code that does something like this echo file_get_contents( '/home/someotheruser/public_html/config.php' ); What's the best approach for solving this?


title: Configure power button to shutdown on Debian

text: I use Debian and I want my power button to shutdown the PC. Currently it sleeps, when I press it. Is there any command for it to make it shutdown?


title: Persistent drive block usind udev

text: I have 8 hard disks on a home server. Sometimes I plug and unplug one or two, and if I restart the system all the drive letters are messed up. I would like to assign a block to each hard drive based on its serial number or other attributes that may identify each hard drive. The problem is that using `udevadm info --attribute-walk --path /sys/block/sda` I can't find any unique attribute that a `udev` rule can match! This is the output for `udevadm info --attribute-walk --path /sys/block/sda`:               looking at device '/devices/pci0000:00/0000:00:1c.6/0000:08:00.0/0000:09:00.0/host4/target4:0:0/4:0:0:0/block/sda':       KERNEL=="sda"       SUBSYSTEM=="block"       DRIVER==""       ATTR{range}=="16"       ATTR{ext_range}=="256"       ATTR{removable}=="0"       ATTR{ro}=="0"       ATTR{size}=="976773168"       ATTR{alignment_offset}=="0"       ATTR{discard_alignment}=="0"       ATTR{capability}=="50"       ATTR{stat}=="  303039  9092221 74569992  3246580    12765      996    11288  1415644        0  3250052  4661800"       ATTR{inflight}=="       0        0"       ATTR{events}==""       ATTR{events_async}==""       ATTR{events_poll_msecs}=="-1"          looking at parent device '/devices/pci0000:00/0000:00:1c.6/0000:08:00.0/0000:09:00.0/host4/target4:0:0/4:0:0:0':       KERNELS=="4:0:0:0"       SUBSYSTEMS=="scsi"       DRIVERS=="sd"       ATTRS{device_blocked}=="0"       ATTRS{type}=="0"       ATTRS{scsi_level}=="6"       ATTRS{vendor}=="ATA     "       ATTRS{model}=="ST3500630A      "       ATTRS{rev}=="3.AA"       ATTRS{state}=="running"       ATTRS{timeout}=="30"       ATTRS{iocounterbits}=="32"       ATTRS{iorequest_cnt}=="0xa39aa"       ATTRS{iodone_cnt}=="0xa39aa"       ATTRS{ioerr_cnt}=="0xfa0d"       ATTRS{evt_media_change}=="0"       ATTRS{queue_depth}=="1"       ATTRS{queue_type}=="none"      All the other hard drives have similar output, there isn't a way to identify them. ATTRS{model} is not suitable because I have 3 hard disks that are the same model.


title: Convert a lot of .tif files using imagemagick's mogrify command

text: I have a lot of tif images in a directory. So I try to convert them into jpg format. I use this command : `mogrify -format jpg *.tif` But I get an error... an error for each image in fact:               mogrify: 2281.tif: unknown field with tag 37724 (0x935c) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/746.      Maybe I am doing something wrong... Does anyone have an idea?


title: Printing selective fields following 1st column instructions

text: Suppose I have a file in which I'd like to simultaneously print different `awk` commands following the first column instuctions, without messing up the original file (as it would happen with two separate prints): File:               End 1st 2nd 3rd     Fin 1st 2nd 3rd      I'd like to combine the following commands into a one-liner:               awk '$1 ~ /^E/ {print $2}'     awk '$1 ~ /^F/ {print $3}'      To obtain the following output:               End 1st     Fin 2nd      **EDIT** What I meant by saying "messing up the original file": File 1:               E1   NAME1 LASTNAME1     FA   22   1992         #age, year     FC   UK   London       #country, city     FJ   IT   HP           #job, company     E2   NAME2 LASTNAME2     FA   25   1989             FC   CH   Geneva           FJ   CS   SIB          Now, if I run two separate awk prints, I won't be able to match the information in File 3 with the names of File 2 (especially if the number of `^F` fields are not of the same number): `awk '$1 ~ /^E/ {print $2}' File 1 > File 2` Output (File 2):               NAME1     NAME2      `awk '$1 ~ /^F/ {print $3}' File 1 > File 3` Output (File 3):               1992             London            HP                1989             Geneva           SIB        But, If I join them (as suggested in the answers) I'll be able to have something like this: Expected output:               NAME1     1992             London            HP       NAME2     1989             Geneva           SIB


title: How to decompress content of various archive types with one command

text: > **Possible Duplicate:**   >  Is there any program to provide a consistent interface across multiple > archive types? I have to handle files that come as uncompressed text files or in various archive types (`.gz`, `.zip`, `.tar.gz`, `bz2`...). I want to process their content piped to another command. Is there a tool that detects whether a file is compressed and prints it content uncompressed? The best I could find is a combination of `zcat` (some archive types) and `cat` (non-compressed files).


title: How does "top" command show live results?

text: How can I write a shell script that shows the results in real time? Something like the `top` command that updates the results after some fixed intervals of time. ![alt text](http://i.stack.imgur.com/ZGsik.gif)


title: Conversion from PNG to EPS

text: I would like to convert PNG images/graphs to EPS without losing even a bit on resolution. All the commands I tried (`potrace`, `autotrace`, `convert`, `gimp`) decrease the resolution quality.


title: ~/.xinitrc not being run

text: I am not able to run my `~/.xinitrc` (`~/.xsession`) scripts when logging into my computer. I'm using Xubuntu 12.10 with vanilla lightgm as the login manager. Both these files have the right permission (executable). I have in my `~/.xinitrc`, the following:               #!/usr/bin/env bash           # read ~/.Xmodmap if it exists     if [[ -f "${HOME}/.Xmodmap" ]]; then         xmodmap "${HOME}/.Xmodmap"     fi          # read ~/.Xresources if it exists     if [[ -f "${HOME}/.Xresources" ]]; then         xrdb -load "${HOME}/.Xresources"     fi          # use gnome-keyring-daemon to manage keys     /usr/bin/gnome-keyring-daemon --start --components=gpg     /usr/bin/gnome-keyring-daemon --start --components=ssh      Any other command (like `date >> "$HOME/did_start"`) is not also being executed. Now apparently, even if I delete my `~/.xinitrc` and `~/.xsession` files, `xmodmap` seems to be reading `~/.Xmodmap`, and `~/.Xresources` is also being partly read. I checked in `/etc/X11/Xsession` to see if there are any commands which makes it read these two files, and found none. What could be happening? **EDIT:** Since Gilles asked, I'm using a custom session while login in through lightdm (`/usr/share/xsessions/custom.desktop`):               [Desktop Entry]     Name=Xsession     Exec=/etc/X11/Xsession      But apparently this still starts XFCE via `startxfce4` even though I don't have it in my `~/.xinitrc`. And as Ulrich Dangel pointed out, there is a line in `/usr/xdg/xfce4/xinitrc` which reads `~/.Xmodmap` and `~/.Xresources`, and this script is executed by `startxfce4`. So that "mystery" is now resolved. But again, the colors (for `xterm`, `urxvt` etc.) from `~/.xinitrc` is still not being loaded.


title: How to switch from TTY to KDE in Oracle Linux

text: I had installed Oracle Linux. While installing I had selected KDE for the desktop. After finishing I assumed that I could login to KDE Desktop, but I got a TTY. It asked for login and I gave root and for password entered what I had given while installing. The thing is I want to go to KDE desktop from TTY. I got after logging in:               [root@techsunil ~]#      How can I switch to desktop of KDE?


title: How to redirect and use the framebuffer?

text: I need to work on the framebuffer to record what is being rendered. Now, I figure out how to convert the framebuffer in an image, I'm currently unable to obtain a constant stream of data from the fb to create a video.               /dev/fb > fb      When I do something like this my redirection just drops me and I honestly don't know how to work in another way with the framebuffer. How I can obtain a stream?


title: Command not found

text: I am trying to stop a syslog using **chkconfig** but bash says that command is not available. But when I do > man chkconfig it opens man page. This is the command i'm trying to execute.               **chkconfig syslog off && /etc/init.d/syslog stop**      ![Screen Cap](http://i.stack.imgur.com/u88Au.png)


title: How to fix a terminal after a binary file has been dumped inside it?

text: After having played with curl, a binary file has been dumped inside my terminal. For example, the horizontal lines: ─ I use to format my prompt are replaced by 'q', and it can be much worse. Why does this happen, and how can you fix it without having to close the terminal ?


title: Regular Expressions within a string in AWK using if/then control structure?

text: **PROBLEM** I want to specifically use AWK (GAWK, MAWK, whatever) in an AWK script to sum up the values in field 9 for every record that contains "runner__.jpx" (the underscores are placeholders for two digits 0-9) in field 6 and "good" in FIELD 7. **SAMPLE FILE**               Feb 14 11:33:16 ringer a[2388]: runner01.jpx good aa 3     Feb 14 11:33:32 ringer a[2388]: runner24.jpx good xx 1     Feb 14 11:33:39 ringer a[1894]: jogger02.jpx good aa 5     Feb 14 11:33:45 ringer a[2388]: runner99.jpx stop cc 1      **ATTEMPT** How could I do this? I tried using an if statement, like:               BEGIN {         sum = 0     }          {         if (($6 == "runner"[0-9][0-9]".jpx") && ($7 == "good"))             sum += $9     }          END {             printf sum     }      Is there way to do this by matching strings in fields using if statements? Am I allowed to use regular expressions within the if statement? What is an alternative method to do this? Thanks.


title: What is wrong with my cron job?

text: I'm new to linux, and was told I could use a feature called cron job to run a python script I made execute every 10 minutes. Problem is the the python script isn't running. There doesn't seem to be a clear cut way to know if I've formatted the job correctly, but in any case I've tried a number of paths to no avail. Because I'm so new I'll show you the steps I took. On my RasPi, I first typed "crontab -e" and get a field like this:               # Edit this file to introduce tasks to be run by cron.     #     # Each task to run has to be defined through a single line     # indicating with different fields when the task will be run     # and what command to run for the task      Skipping more help text               # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/          # m h  dom mon dow   command      and I add my line at the bottom, without removing the text above.               */10 * * * * ~/WeatherProject/HOURLY/windDirExtract.py      The above didn't work, and someone else did something similar to this but still no luck.               */10 * * * * /home/MyName/WeatherProject/HOURLY/windDirExtract.py      and then I tried different permutations but I've got nothing.               */10 * * * * /home/MyName/WeatherProject/HOURLY python windDirExtract.py     */10 * * * * /home/MyName/WeatherProject/HOURLY windDirExtract.py      I'll make any edits if I haven't been clear, but first big question is can I even run short little python scripts with Cron Job, or did I just get bad advice?


title: mknod of content in directory

text: I would like to create a virtual device from a directory i.e. you know, there's these cloud storage providers like dropbox and co and they generally have a software client and then give you access to files saved with them in a certain directory in your home directory. Now I would like to, instead being able to access the files in a directory, I would like to be able to mount it anywhere and access the files like as if they were on a device. How can I create a virtual device like this using mknod **edit 1** : I would like to mount multiple of these devices together in one directory using mhddfs (http://romanrm.ru/en/mhddfs) if possible **edit 2** : I am trying it out with Ubuntu One and Dropbox and I have created `~/virtcld` in my home and "mounted" both cloud directories like this: `mhddfs ~/Dropbox/ ~/Ubuntu\ One/ ~/virtcld/ -o allow_other` then I have created a bunch of test files in my virtualcd like `time dd if=/dev/zero of=test13.bin bs=1024 count=1000000` but once my Dropbbox is filled up, the files do not start to upload to the ubuntu One directory instead...


title: How to set up Linux for full AMD APU power management support: Turbo Core, Cool'n'Quiet, Dynamic Power Management?

text: My objective is to set up a mini server (not HTPC) with low power consumption in idle mode, yet offering nice performance when used. The focus is more on data safety than availability. In other words: quality parts, but redundancy only for storage. Not considering myself to be biased, after some research I felt that some AMD desktop APUs would offer good value. Questions remaining are:   * Will the idle state of the GPU lower power consumption and unleash resources for the CPU?   * Will Cool'n'Quiet and Turbo Core lead to the intended low power consumption in idle mode but performance under load?   * Will Linux support this scenario as intended? Quite a few questions and forum discussions seem to suggest that this is not necessarily the case.


title: running matlab command line in screen -- can't type after reattaching

text: I'm logging in via ssh to a more powerful computer, on this I start a screen session with `screen -S mine` and then open a matlab command line via `matlab -nodesktop -nodplash` and then run within matlab a long running script. After detaching from the screen and logging out from the computer the script is running using all the CPU power. Now if I wait quite a while (the matlab skripkt will in total need like 6-7 hours and I don't want to save the matlab session since I would need to load all 15GB to RAM again) and try to reattach to the screen this at first seeems to work. I get my screen `mine` back and see the matlab command line, which finished the job, but I can't type anything within the matlab command line? Why is this? I now can't continue and killed it. (I noticed using htop that matlab at first used 100% CPU, in the end still 100% were used but a major part was colored red so used for kernel tasks..)


title: Where is Xkb getting its configuration?

text: Is there a way to query where `xkb` is getting its configuration from? Under ArchLinux I have `/etc/X11/xorg.conf.d/00-keyboard.conf` with               Section "InputClass"         Identifier "system-keyboard"         MatchIsKeyboard "on"         Option "XkbLayout" "us,us"         Option "XkbVariant" "altgr-intl,colemak"         Option "XKbOptions" "ctrl:nocaps,grp:alt_shift_toggle"     EndSection                 but when I start up, if I do `setxkbmap -query`, I only get               rules:      evdev     model:      evdev     layout:     us,us     variant:    altgr-intl,      So neither the alternative variants nor options are recognized (needless to say, I cannot change layout). If I however run               setxkbmap -layout "us,us" -variant "altgr-intl,colemak" -option "ctrl:nocaps,grp:alt_shift_toggle"      I get the correct               rules:      evdev     model:      evdev     layout:     us,us     variant:    altgr-intl,colemak     options:    ctrl:nocaps,grp:alt_shift_toggle      So is there a possibility something is overwriting my configuration? I am running GNOME/Cinnamon


title: Is there anyway to set a readonly environment variable?

text: I am using the following in openssh/telnet code, which sets the user environment.               setenv("TEST_ENV", "testing", 1);      But this can be modified by the user, is there anyway to make it readonly env variable?


title: Sed - string substitution with groupings

text: I have a largish directory with filenames formatted like               Some_Folder-(FOL001)-clean      what I'm trying to do is display the pattern between the brackets at the start like               FOL001 Some_Folder-(FOL001)-clean      so it can be piped into sort * * * So far what I have is               ls | sed -n -e 's/.*\(\-([A-Z]\{3,4\}[0-9]\{3,4\})-\)\(.*\)/\1 \t \0/p' | sort      which produces               -(FOL001)- Some_Folder-(FOL001)-clean      However, I don't want the "-(" and ")-" on the output of the first pattern, just the contents. I know I can run this through `sed` again to replace those characters, but wondered if it's possible to include it in the original expression.


title: Does apt update manually installed packages

text: I'm trying to install bnx2 non free driver on Debian wheezy. The driver is in non free repositories. Since there is no network connectivity I should download .deb file and install it on the box. After installing Does `apt` update that package when new versions released or because it is manually installed it ignores it?


title: Join two files, matching on a column, with repetitions

text: How can I get two files A and B, and out put a result like this: File A:               001 Apple, CA     020 Banana, CN     023 Apple, LA     045 Orange, TT     101 Orange, OS     200 Kiwi, AA      File B:               01-Dec-2013 01.664  001     AAA CAC 1083     01-Dec-2013 01.664  020     AAA CAC 0513     01-Dec-2013 01.668  023     AAA CAC 1091     01-Dec-2013 01.668  101     AAA CAC 0183     01-Dec-2013 01.674  200     AAA CAC 0918     01-Dec-2013 01.674  045     AAA CAC 0918     01-Dec-2013 01.664  001     AAA CAC 2573     01-Dec-2013 01.668  101     AAA CAC 1091     01-Dec-2013 01.668  020     AAA CAC 6571     01-Dec-2013 01.668  023     AAA CAC 2148     01-Dec-2013 01.674  200     AAA CAC 0918     01-Dec-2013 01.668  045     AAA CAC 5135      Result:               01-Dec-2013 01.664  001     AAA CAC 1083    Apple, CA     01-Dec-2013 01.664  020     AAA CAC 0513    Banana, CN     01-Dec-2013 01.668  023     AAA CAC 1091    Apple, LA     01-Dec-2013 01.668  101     AAA CAC 0183    Orange, OS     01-Dec-2013 01.674  200     AAA CAC 0918    Kiwi, AA     01-Dec-2013 01.674  045     AAA CAC 0918    Orange, TT     01-Dec-2013 01.664  001     AAA CAC 2573    Apple, CA     01-Dec-2013 01.668  101     AAA CAC 1091    Orange, OS     01-Dec-2013 01.668  020     AAA CAC 6571    Banana, CN     01-Dec-2013 01.668  023     AAA CAC 2148    Apple, LA     01-Dec-2013 01.674  200     AAA CAC 0918    Kiwi, AA     01-Dec-2013 01.668  045     AAA CAC 5135    Orange, TT      (file A: the number should match to middle number from file B) Is there any possible way to doing this?


title: What is the Firefox repository with all dependencies solved?

text: I'm using Fedora Core 3, and Firefox needs to be upgraded from version 2.0 to some advanced version, such as 3.0 or 3.6. I used the `remi` repository for `yum` command, but that repository doesn't contain any other dependencies for Firefox v 3.6. What Fedora repositories can Firefox be installed from with all other dependencies?


title: Linux package manager architecture

text: I am looking for a guide on one of Linux Package manager architectures. For example **apt-get** (dpkg), or **yum** (rpm). I want to know how they manage the package list, file list, package versions and so on. I wonder if anyone could point me to some resource.


title: How to change default log location of SMF registered processes

text: I am trying to change default log location ( var/svc/logs/) of each and every SMF registered processes and append to particular file (/opt/smf.log).


title: Filesystem with 1Mb block?

text: I'd like to make a partition for keeping ISO images of nightly builds. Most of files will be bigger than 1Mb. Unfortunately ext2/ext3/ext4 supports only 4Kb blocks.               # mkfs.ext4 -b 1048576 -L DISTR -m 0 /dev/sdb1      mkfs.ext4: invalid block size - 1048576      Is there any other reliable filesystem that can be used in order to reduce fragmentation?


title: Change mailx mailbox location

text: On my computer, mail is stored in `~/Mailbox`, not in a centralized directory. Is there a way to get `bsd-mailx` to read mail from there, instead of looking in `/var/mail`?


title: use 'find' to search for directories !containing certain filetype foo

text: I have a few directories, some with a depth of 3, which contain mixed file types. What I need to do is to `rm -rf` all the subdirectories that do not contain filetype `foo`. Is this achievable with `find` somehow? I do know that I can use find like this:               find . ! -name '*.foo' -delete      to delete all files within the directories that do not contain any file of type `*.foo`. Now, how can I use this, to not only delete all unwanted files, but all directories and subdirectories which do not contain `*.foo`?


title: How to fix boot error UUID disk drive is not ready or not present where micro failed to load microcode_amd.bin and HDIO_GET_IDENTITY failed?

text: When I updated to the new Kernel 3.7.2, everything goes ok, but when it comes to powering on Linux Mint, it shows me two warnings: ![enter image description here](http://i.stack.imgur.com/mJmEw.png) ![enter image description here](http://i.stack.imgur.com/4GwMF.png) What's wrong and what can I do?


title: Constant prompt for WPA2 password in Fedora

text: I asked on the Fedora forums but no one responded so I am asking here. I am on Fedora 20 with Gnome 3. My machine is the Dell XPS 13 which has an Intel 7260 rev 6b wireless card. I connect to my home network with WPA2 just fine but after a few minutes I am prompted for my password (and the password is already filled in) so I hit connect and it goes away. Sometimes it will appear 4 or 5 times before going away for good (well until maybe 10 minutes later). It's extremely frustrating since I switched away from Ubuntu because of its issues with WPA enterprise and supposedly Fedora had no wireless issues at all. Apparently that isn't true. I'm not quite sure how to go about fixing this so if anyone can point me in the right direction that would be fantastic!


title: How to get portage to emerge in a FreeBSD Jail?

text: I am running FreeNAS 9.2.1.2 which allows you to install a Gentoo jail with a one click install that creates a jail on the Free BSD system. I then tried to run `emerge -avuDN world` and ran into some problems. After some Googling I have tried the following:   * `export TAR_OPTIONS='--touch'` (this got rid of most tar errors)   * `ln -s /bin/busybox /usr/bin/touch` etc as suggested in this post but I receive the error that the file has already been created I still get the following error when trying to `emerge --oneshot portage`:*               tar: Python-3.3.3/configure: Cannot utime: Invalid argument                                                                              tar: Exiting with failure status due to previous errors                                                                                * ERROR: dev-lang/python-3.3.3 failed (unpack phase):                                                                                *   failure unpacking Python-3.3.3.tar.xz        *I have followed the upgrade guide for EAPI 5 in `eselect news` and so I am trying to get the latest version of portage before proceeding to `emerge -avuDN world`


title: Debian partial Mirror - “debpartial-mirror” specific mirroring

text: i am using a Debian 7.3 with debpartial-mirror in order to create and maintain an offline mirror. Since i need only the basic packages (Packages needed for Installation via PXEboot and maybe the most common packages that are installed afterwards) i can't figure out, how to achiev this. Right now, the mirror is trying to clone the whole archive, but i don't need all Packages, neither do i have a good connection to the internet to maintain the Archive properly if it is that big. Any help is appreciated. my debpartial-mirrir.conf is :               ;;     ;; debpartial-mirror configuration file.     ;;          [GLOBAL]     ;; Show debug information?     ;;debug = DEBUG          ;; Mirror destination directory     mirror_dir = /install/debian/debpartial-mirror/          ;; Which architectures should I download?     architectures = amd64          ;; What should I look for, by default?     components = main contrib non-free     distributions = stable          ;; What should I get?     get_suggests = true     get_recommends = true     get_provides = true     get_sources = false     get_packages = true          [wheezy]     server = http://ftp.de.debian.org/debian     components = main contrib non-free     distributions = stable     ;;filter = subsection:base priority:important     get_sources =false          [wheezy-updates]     server = http://ftp.debian.org/debian     components = main contrib non-free     distributions = wheezy-updates     filter = subsection:base priority:important     resolve_deps_using = wheezy               [wheezy-security]     server = http://security.debian.org/     components = main contrib non-free     distributions = wheezy/updates     filter = subsection:base priority:important     resolve_deps_using = wheezy          [wheezy_debian-installer]     server = http://ftp.debian.org/debian     components = main/debian-installer     distributions = wheezy


title: Determine 2G or 3G connection

text: I am using WvDial to dial my USB modem up to my ISP. But how can I tell what network I am connected to: 2G or 3G?


title: Log every command typed in any shell: output (from logger function to syslog-ng/journald) contains duplicate entries for commands?

text: I installed `syslog-ng` to use on my desktop (Gentoo 64bit, upgraded to systemd i.e. was OpenRC before, with Openbox and Slim only) with my normal user to _log all commands_ I type in the shell (bash first, then eventually zsh). I've explored different solutions, and different ways of setting this up, old and new and often this is achieved using the `.bash_history` file. I'm trying to implement this solution from a few years ago, with reliance on the companion _trap_. First I've modified `.bashrc` and set some history variables because the solution relies on formatting the history data, then making sure it is saved to its file, then _pushing_ it to the log messaging system with `logger` in a function called in the shell environment. So first the variables:               export HISTCONTROL=     export HISTFILE=$HOME/.bash_history     export HISTFILESIZE=2000     export HISTIGNORE=     export HISTSIZE=1000     export HISTTIMEFORMAT="%a %b %Y %T %z "          typeset -r HISTCONTROL     typeset -r HISTFILE     typeset -r HISTFILESIZE     typeset -r HISTIGNORE     typeset -r HISTSIZE     typeset -r HISTTIMEFORMAT          shopt -s cmdhist     shopt -s histappend          PROMPT_COMMAND="history -a"     typeset -r PROMPT_COMMAND          ex. history command output with timestamps     860  Tue Jan 2014 10:33:50 -0900 exit     861  Tue Jan 2014 10:33:56 -0900 ls     862  Tue Jan 2014 10:33:58 -0900 history      Then, as explained in the linked article, you must add this _trap_ which uses `logger` in .bashrc (there is reference to /etc/profile, but here I want this for my regular user only and ~/.profile is not sourced by something like `lxterminal`):               function log2syslog     {        declare command        command=$(fc -ln -0)        logger -p local1.notice -t bash -i -- $USER : $command     }     trap log2syslog DEBUG      A single long hyphen was (mistakenly?) used in the original doc, followed by a space and $USER. I've replaced my original syslog-ng configuration file. I've tried the suggested config from Arch, but after some warnings, I've configured it like so explained for Gentoo which is what the Arch doc is based on anyway:               @version: 3.4     options {             chain_hostnames(no);                  # The default action of syslog-ng is to log a STATS line             # to the file every 10 minutes.  That's pretty ugly after a while.             # Change it to every 12 hours so you get a nice daily update of             # how many messages syslog-ng missed (0).             stats_freq(43200);     };          source src {         unix-dgram("/dev/log" max-connections(256));         internal();     };          source kernsrc { file("/proc/kmsg"); };          # define destinations     destination authlog { file("/var/log/auth.log"); };     destination syslog { file("/var/log/syslog"); };     destination cron { file("/var/log/cron.log"); };     destination daemon { file("/var/log/daemon.log"); };     destination kern { file("/var/log/kern.log"); };     destination lpr { file("/var/log/lpr.log"); };     destination user { file("/var/log/user.log"); };     destination mail { file("/var/log/mail.log"); };          destination mailinfo { file("/var/log/mail.info"); };     destination mailwarn { file("/var/log/mail.warn"); };     destination mailerr { file("/var/log/mail.err"); };          destination newscrit { file("/var/log/news/news.crit"); };     destination newserr { file("/var/log/news/news.err"); };     destination newsnotice { file("/var/log/news/news.notice"); };          destination debug { file("/var/log/debug"); };     destination messages { file("/var/log/messages"); };     destination console { usertty("root"); };          # By default messages are logged to tty12...     destination console_all { file("/dev/tty12"); };          # ...if you intend to use /dev/console for programs like xconsole     # you can comment out the destination line above that references /dev/tty12     # and uncomment the line below.     #destination console_all { file("/dev/console"); };          # create filters     filter f_authpriv { facility(auth, authpriv); };     filter f_syslog { not facility(authpriv, mail); };     filter f_cron { facility(cron); };     filter f_daemon { facility(daemon); };     filter f_kern { facility(kern); };     filter f_lpr { facility(lpr); };     filter f_mail { facility(mail); };     filter f_user { facility(user); };     filter f_debug { not facility(auth, authpriv, news, mail); };     filter f_messages { level(info..warn)             and not facility(auth, authpriv, mail, news); };     filter f_emergency { level(emerg); };          filter f_info { level(info); };     filter f_notice { level(notice); };     filter f_warn { level(warn); };     filter f_crit { level(crit); };     filter f_err { level(err); };     filter f_failed { message("failed"); };     filter f_denied { message("denied"); };          # connect filter and destination     log { source(src); filter(f_authpriv); destination(authlog); };     log { source(src); filter(f_syslog); destination(syslog); };     log { source(src); filter(f_cron); destination(cron); };     log { source(src); filter(f_daemon); destination(daemon); };     log { source(kernsrc); filter(f_kern); destination(kern); };     log { source(src); filter(f_lpr); destination(lpr); };     log { source(src); filter(f_mail); destination(mail); };     log { source(src); filter(f_user); destination(user); };     log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); };     log { source(src); filter(f_mail); filter(f_warn); destination(mailwarn); };     log { source(src); filter(f_mail); filter(f_err); destination(mailerr); };          log { source(src); filter(f_debug); destination(debug); };     log { source(src); filter(f_messages); destination(messages); };     log { source(src); filter(f_emergency); destination(console); };          # default log     log { source(src); destination(console_all); };      Of note is the comment from Arch wiki about the `unix-stream` reference misbehaving and prohibiting loading syslog-ng at startup. Changing the reference to unix-dgram takes care of that is basically the only change from the model used, except for providing a version number on the first line. After that you can do `systemctl enable syslog-ng` to have that available at boot. So it is up and running manually here:               # systemctl status syslog-ng     syslog-ng.service - System Logger Daemon        Loaded: loaded (/usr/lib64/systemd/system/syslog-ng.service; disabled)        Active: active (running) since Tue 2014-01-28 20:23:36 EST; 1s ago          Docs: man:syslog-ng(8)      Main PID: 9238 (syslog-ng)        CGroup: /system.slice/syslog-ng.service                \u2514\u25009238 /usr/sbin/syslog-ng -F          Jan 28 20:23:36 gentoouser3x86_64 systemd[1]: Starting System Logger Daemon...     Jan 28 20:23:36 gentoouser3x86_64 systemd[1]: Started System Logger Daemon.      And I get the desired basic ouput in /var/log/messages:               Jan 28 20:42:00 gentoouser3x86_64 bash[9878]: myuser : shopt     Jan 28 20:42:04 gentoouser3x86_64 bash[9880]: myuser : su -     ...     Jan 29 03:30:58 gentoouser3x86_64 bash[4386]: myuser : ls     Jan 29 03:30:58 gentoouser3x86_64 bash[4389]: myuser : ls  <--- duplicate     Jan 29 03:30:58 gentoouser3x86_64 bash[4391]: myuser : ls  <--- entries     Jan 29 04:36:31 gentoouser3x86_64 bash[4491]: myuser : cat .bashrc     Jan 29 04:37:14 gentoouser3x86_64 bash[4495]: myuser : cat .bashrc  <---     Jan 29 04:37:14 gentoouser3x86_64 bash[4497]: myuser : cat .bashrc  <---     Jan 29 04:37:35 gentoouser3x86_64 bash[4500]: myuser : nedit .bashrc     Jan 29 04:37:35 gentoouser3x86_64 bash[4503]: myuser : nedit .bashrc  <---     Jan 29 04:37:35 gentoouser3x86_64 bash[4505]: myuser : nedit .bashrc  <---      Or, if I disable syslog-ng with `systemctl stop syslog-ng`, I get the very same output from the journald binary log using `journalctl -f` (or `journalctl -f -o verbose` for the details) because systemd "takes over" in that case. Restarting `syslog-ng` and/or its socket reclaims the output immediately and sends it to its assorted files specified in its configuration. **Questions**   * Whether I use syslog-ng or journald, I get many duplicate lines in the logs whereas the commands were only executed once. Listing the contents of a directory for instance may show `ls` 2-3 times in the logs when I use many terminal windows. In particular, pressing enter in the CLI seems to echo the the last command in the log. Why? (Is it because the variable in the trap is still set to the last line of the history file? If so how can this be remedied?) The main source link indicates that since version 4.1, `bash` can write to syslog directly... the changelog says: > "There is a new configuration option (in config-top.h) that forces bash to > forward all history entries to syslog."   * So is the trap function used here still useful or is it obsolete? Is the a more modern/elegant way of doing this? Is that >4.1 option exposed somewhere or do you need to recompile bash to do that? What is it?   * Aside from built-in options that are native to bash, can we expect implementing a similar solution for `zsh`? Or again, is there a better and more integrated way of doing this?   * Is there lots of overhead generated from sending all the commands to the logs, and are journald and syslog-ng equal in this respect?


title: How to remove all software

text: How can I remove all software installed on my Linux distribution? I'm using Debian:               $ uname -a     Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux      I want to go back to the original installed software. Is there any built-in way to do it in a single command?


title: Opening a samba share in emacs

text: I am using emacs-snapshot, and I added an application shortcut to my `.local/share/applications/emacs-snapshot.desktop` :               [Desktop Entry]     Version=1.0     Name=Emacs Snapshot (GTK)     GenericName=Emacs     Comment=GNU Emacs Snapshot Text Editor     Exec=/usr/bin/emacs-snapshot-gtk     TryExec=emacs-snapshot     Terminal=false     Type=Application     Icon=emacs-snapshot     Categories=Development;Utility;TextEditor;     MimeType=text/plain;      When I browse my folders (Nautilus 3.4.2) and right click on files on my local disk, I can choose Open With -> Emacs Snapshot (GTK): ![emacs](http://i.stack.imgur.com/7ii92.png) However, when I browse to a samba share (`smb://data/mydata/`) and click on a file, I am not given an option to open it in Emacs - even if I click "Open with other application -> Show other applications": ![Open with other applications](http://i.stack.imgur.com/RVVDE.png) How do I fix it? Further info:   * OS: Debian Wheezy   * Emacs from http://emacs.naquadah.org/ : emacs-snapshot-gtk   * the output of `ldd /usr/bin/emacs-snapshot-gtk`: http://pastebin.com/0Rz9mKQA


title: How do I change working directories with KDialog?

text: Use-case: I am working in the terminal in /path/with/a/very/long/name and I want to change to some other directory that is deeply nested. But I don't know the path by memory. So I want to browse via a GUI to enable me to figure out where I need to navigate. I came up with this script:               #!/bin/sh     echo "change working directory"     MYDIRECTORY=$(kdialog --getexistingdirectory ::label1);     if [ "$?" = 0 ]; then         cd "$MYDIRECTORY"     elif [ "$?" = 1 ]; then         echo "action canceled";     else         echo "ERROR";     fi;     exit 0      Unfortunately, it does not work. When the script exits, I remain in the original directory in the terminal. I have learned that this is because my original directory was restored when the subshell that executed the cd command exits. So how can I accomplish my goal?


title: print parent directories full path of find output

text: what I want to do is to find all files based on some search query and get parents parent directory (`../..`) full path. For example `find . -name "__openerp__.py"` and then for each file execute something along the lines of `(cd ../..; pwd)`. Then pipe everything to `uniq`.


title: How can I create an SFTP user in CentOS?

text: I'd like to give temporary SFTP access to a support guy. How do I create an SFTP user? And how can I delete it once the job is done? Also, how do I specify a home directory for them? Can I prevent them from accessing certain subdirectories within their home directory? We use CentOS 6.3 and fzSftp


title: How can I access a NTFS filesystem from a live Linux CD

text: My Win XP SP3 registry is corrupted(my own fault) so I need to move windows/repair/system to `windows/system32/config/system`. I have tried DSL, Sliax? and tinycore. DSL give me a 'cannot - as readonly filesystem' So i try a chmod 777 /dev/hda1 and a `chown 777 /dev/hda1` and a `mount, -oremount, rw /mnt/hda1` none work although the remount rw does remove the readonly filesystem message but then just gives a cannot complete this operation. I am logged on as SU. Sliax however shows the hda1 drive but wont even mount it, 'error _org.freedesktop.hal. device.volume.unknownfairlure_ bracket' error I also have this error written done, can't remember what I did to cause this one, ' wrong fs type bad option bad superblock on /dev/hda1 or too many mounted filesystems unable to remove operatrion not permitted' So basically how do I move a file from a NTFS filesystem (Win XP) from a live CD?


title: What do the brackets around processes mean?

text: mark@mark-VirtualBox:~/auto/lib$ ps -Awwo pid,comm,args       PID COMMAND         COMMAND         1 init            /sbin/init         2 kthreadd        [kthreadd]         3 ksoftirqd/0     [ksoftirqd/0]         5 kworker/u:0     [kworker/u:0]         6 migration/0     [migration/0]         7 cpuset          [cpuset]         8 khelper         [khelper]         9 netns           [netns]        10 sync_supers     [sync_supers]        11 bdi-default     [bdi-default]        12 kintegrityd     [kintegrityd]        13 kblockd         [kblockd]        14 kacpid          [kacpid]        15 kacpi_notify    [kacpi_notify]        16 kacpi_hotplug   [kacpi_hotplug]        17 ata_sff         [ata_sff]        18 khubd           [khubd]      What do the brackets mean? Does args always return the full path to the process command (e.g. /bin/cat)


title: What is the meaning of ps process names printed in [] such as [cgroup]?

text: when I do a command such as ps -aux on CentOS 6 I get a bunch of processes whos command is listed in [] as shown below. What is the meaning of the [] in the name? I am assuming that these are special processes of some kind, what makes a process name show up with a [] around it?               [root@centos6 src]# ps -ef     UID        PID  PPID  C STIME TTY          TIME CMD     root         1     0  0 18:48 ?        00:00:01 /sbin/init     root         2     0  0 18:48 ?        00:00:00 [kthreadd]     root         3     2  0 18:48 ?        00:00:00 [migration/0]     root         4     2  0 18:48 ?        00:00:00 [ksoftirqd/0]     root         5     2  0 18:48 ?        00:00:00 [migration/0]     root         6     2  0 18:48 ?        00:00:00 [watchdog/0]     root         7     2  0 18:48 ?        00:00:02 [events/0]


title: AIX why does ps display the process name between square brackets?

text: On AIX 7 I have a process whose name appears between square brackets in the ps output:                     PID    TTY  TIME CMD       7798784  pts/2  0:00 [myproc]       9044154  pts/2  0:00 ps        10485770  pts/2  0:00 bash       I found that overwriting `argv[0][0]` leads to such a result. Is there any other reasons which could lead to this result?


title: vim avoid selecting underscore

text: So I know that an underscore (`_`) is considered part of a word in `vim`. Working with Python, I normally end up having a lot of underscores. Is there a way to select part of a word excluding the underscore? For example in `long_name`, I'd just love to quickly select `long`.


title: What is the meaning of "+" in wget progress bar?

text: I'm downloading with `wget` using a slow link.   Sometimes the progress bar looks like this:               15% [+++++++++++++++===>          ] 10,582,848  --.-K/s   in 82s         What is the meanig of "+"?


title: Understand `compgen` builtin command

text: From `help compgen`:               $ help compgen     compgen: compgen [-abcdefgjksuv] [-o option]  [-A action] [-G globpat] [-W wordlist]  [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word]         Display possible completions depending on the options.              Intended to be used from within a shell function generating possible         completions.  If the optional WORD argument is supplied, matches against         WORD are generated.              Exit Status:         Returns success unless an invalid option is supplied or an error occurs.      So, **What options`[-abcdefgjksuv]` stands for?** In other words I want to know use of `-a` to `-v` etc all (as mentioned above bolded) options. Help me to get knowledge about these options.


title: How to use Reiser4 on Debian Wheezy?

text: Is there an easy way to use Reiser4 on Debian Wheezy? I installed reiser4progs but obviously I need a patched Kernel as well to use it. Is there some semi-officially maintained kernel to install somewhere? Or which alternative filesystems (besides btrfs which I used before - it had severe CPU usage issues) for many small files can I use? **Edit:** I already found http://kernelnewbies.org/WhyReiser4IsNotIn (this is from 2006 so quite long ago, is it?) and http://sourceforge.net/projects/reiser4/files/reiser4-for-linux-3.x/ already, but I hoped there is a better way.