title: Is there a flag corresponding to x/X, but for s with chmod on Linux?

text: When using `chmod` (in my case part of `coreutils` 8.12), and recursively setting the `x` bit, there exists the convenient `X` (uppercase letter x), to set the bit only on directories. So if you wanted to remove the `x` from all files and only leave it on folders you could squeeze that into a single invocation like this:               chmod -R a-x,a+X /path/to/folder      That's especially useful if you work with someone whose conception of unixoid systems originates in the 1980s and octal `755` is all they know. However, I have not found such a thing for the `s` bit, despite the fact that a similar duality in the meaning of the bit exists on files versus folders. I'm referring to `chmod(1)`, in particular the `setgid` behavior. So if I do:               chmod -R g+ws /path/to/folder      I end up with files _and_ folders alike having the bit set, when all I want is to set it on folders so that files created there are always owned by the owning group automagically. Is there a convenient way, short of:               find /path/to/folder -type d -exec chmod g+s {} \;      ???


title: How to emulate Windows network for `ntlm_auth`?

text: I want to host a Squid proxy that demands NTLM auth `proxy-authenticate: NTLM`. (It's to a test server--I'm developing a HTTP client that needs to cope proxies demanding this protocol--it's popular in Windows offices). Anyway, the Squid setup is all done. This question isn't about Squid. Squid delegates authentication to `ntlm_auth` per http://www.squid- cache.org/Versions/v3/3.HEAD/cfgman/auth_param.html . > ntlm_auth - tool to allow external access to Winbind's NTLM authentication > function The problem is I don't have a Windows domain around. Is it possible to make Winbind (Samba) act like a Windows domain for the sake of `ntlm_auth` ? I just want one account with a given username and password. Someone with these credentials should be to authenticate to the proxy, but not do anything else on my computer. -Matt


title: "--noprofile" or "--norc" functionality in zsh?

text: Short and sweet: Is there a way to accomplish what **--noprofile** and **--norc** bash switches do using zsh?


title: AppArmor and bind-mounts

text: Can someone outline the semantics of AppArmor with respect to bind-mounted folders? As I understand after reading the documentation (1, 2, 3, 4) - yes, I am using Ubuntu 12.04 with the 3.8 kernel - the policies are "attached to paths" (i.e. paths of programs that become processes when invoked). So assume I have the folder `/home/joe/Public` and that has the location `/var/www/html/joe` bind-mounted to it. Will I have to create a profile that covers the original _and_ the bind- mounted, one of them (which) or is there something else I'd have to do or to consider? Let's say there is a program `/var/www/html/joe/foo`, will the confinement still work when the profile/rule only mentions `/var/www/html/joe/foo`, but Joe decides to run it as `/home/joe/Public/foo`? Links and other pointers will also be appreciated.


title: ERROR: could not find driver after changing from mysql to mariadb

text: mysql was working fine but I wanted to give mariadb a try on a new server I have going. However I am having an issue where all my php websites seem to have issues communicating with mariadb. Webmin works for me, but I get this warning for mysql. > Warning: The Perl module DBD::mysql is not installed on your system, so > Webmin will not be able to reliably access your MySQL database. Click here > to install it now. One possible solution I keep finding is to try to install php-mysql, but I get the following error               ~]# yum install php-mysql     Failed to set locale, defaulting to C     Loaded plugins: fastestmirror, security     Loading mirror speeds from cached hostfile      * base: ftp.sunet.se      * extras: ftp.sunet.se      * updates: ftp.sunet.se     Setting up Install Process     Resolving Dependencies     --> Running transaction check     ---> Package php-mysql.x86_64 0:5.3.3-23.el6_4 will be installed     --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: php-mysql-5.3.3-23.el6_4.x86_64     Package mysql-libs-5.1.69-1.el6_4.x86_64 is obsoleted by MariaDB-shared-5.5.33a-1.i686 which is already installed     --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: php-mysql-5.3.3-23.el6_4.x86_64     Package mysql-libs-5.1.69-1.el6_4.x86_64 is obsoleted by MariaDB-shared-5.5.33a-1.i686 which is already installed     --> Finished Dependency Resolution     Error: Package: php-mysql-5.3.3-23.el6_4.x86_64 (updates)                Requires: libmysqlclient.so.16(libmysqlclient_16)(64bit)                Available: mysql-libs-5.1.66-2.el6_3.x86_64 (base)                    libmysqlclient.so.16(libmysqlclient_16)(64bit)                Available: mysql-libs-5.1.67-1.el6_3.x86_64 (updates)                    libmysqlclient.so.16(libmysqlclient_16)(64bit)                Available: mysql-libs-5.1.69-1.el6_4.x86_64 (updates)                    libmysqlclient.so.16(libmysqlclient_16)(64bit)     Error: Package: php-mysql-5.3.3-23.el6_4.x86_64 (updates)                Requires: libmysqlclient.so.16()(64bit)                Available: mysql-libs-5.1.66-2.el6_3.x86_64 (base)                    libmysqlclient.so.16()(64bit)                Available: mysql-libs-5.1.67-1.el6_3.x86_64 (updates)                    libmysqlclient.so.16()(64bit)                Available: mysql-libs-5.1.69-1.el6_4.x86_64 (updates)                    libmysqlclient.so.16()(64bit)      You could try using --skip-broken to work around the problem      You could try running: rpm -Va --nofiles --nodigest      Here is the full error for my php script which works with mysql but not mariadb > ERROR: could not find driver Notice: Undefined offset: 0 in > /var/www/html/index.php on line 137 Fatal error: Call to a member function > prepare() on a non-object in /var/www/html/classes/DB.class.php on line 75 5.5.33a-MariaDB MariaDB Server Centos 6.4 The I can log in to mysql in terminal where it shows the mariadb version, I can also see and manage tables in webmin but none of my php scripts work, including wordpress.


title: Why does the "w" command report a wrong number of logged in users?

text: I have logged in from tty6, then logged out, now executing the "w" command from a terminal inside unity gives the following output               mark@mark-Latitude-D620:~$ w     19:27:19 up  2:40,  3 users,  load average: 0.41, 0.61, 0.46     USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT     mark     tty7                      16:47    2:39m  5:06   0.22s gnome-session -     mark     pts/2    :0.0             19:13    7.00s  0.30s  0.00s w      isn't the command suppose to list only the logged in users? I am using ubuntu 12.10 **Edit** Note that the `w` command reports that 3 users are logged in (in the header) but only shows 2 entries.


title: Do symbolic links actually make a difference in disk usage?

text: I've read in so many websites that, in Linux, symbolic links (soft links, symlinks) are just like _pointers_ that reference another file, which may be located anywhere (like Windows shortcuts). However, when I check the disk usage of a folder in which there are symbolic links, there's a mismatch between what my file manager says and what `du` reports. However, if I type `du -L` (`-L, --dereference; dereference all symbolic links` from the man page), **the output of`du -L` and the size that my file manager reports are the same**. _**My question is_** : if I have a softlink to a big file in, for example, my separate `home` partition, will I have any problems? **Example** : My `/var/tmp` folder is now plain empty. Let's create a file:               $ cat /some/file.txt > file.txt     $ du -ac     164 ./file.txt     168 .     168 total      And my file manager (Thunar, in this case) reports > Size: 1 item, totalling 163.0 kB All right. Now, lets create a really big file in `/tmp` and a symlink to it:               $ cat /dir/really_big.txt > /tmp/heavy.txt     $ du -a | grep heavy.txt     408 ./heavy.txt     $ ln -s /tmp/heavy.txt heavy.txt     $ du -ac     164 ./file.txt     0   ./heavy.txt     168 .     168 total      Everything is fine for now. But if I open my file manager: > Size: 2 items, totalling 570.3 kB And, finally:               $ du -acL     164 ./file.txt     408 ./heavy.txt     576 .     576 total      If the partition in which `/var/tmp` is located is 1 GiB big, and I create a link in it to a 1 GiB file, ¿will my hard disk die? I know that `du` will output 168 and Thunar 1 GiB, but I don't know which is right.


title: How can I enforce quotas on roaming user profiles using samba?

text: I am using a custom configuration of webmin from www.turnkeylinux.org to run a domain controller (basically Ubuntu Server 8.04/Hardy with Samba installed from the repositories). I've set things up so that my users have roaming profiles that they can use at any of the windows clients that are joined to the domain. I'd like to set a disk quota for each user that the windows client would enforce, one way or another. That is, when they login and Samba downloads the users profile information the client, Samba would also send information about disk quota limits. This way, if the user tries to download too many mp3s for example, windows will complain and prevent the user from using any more space. I've tried setting a quota on the samba server with the quotas package, but that only creates log off problems when the user goes over their limit. I think I can use the smbcquotas command in conjunction with windows' own quota tools, but I don't have the foggiest notion on how I might do this. So my question is, can I get windows to enforce quotas on a per user basis using the samba server?


title: Are there alternatives for `dd`?

text: What other tools should I use to read and write files with truncation, seeking and skipping. dd's command line options seem inconvenient and foreign and I don't like choosing between slow, but precise seeking mode (`bs=1`) and fast, but inflexible mode (`bs=4k` or whatever). Are there more modern tools to read 555 bytes from one file (or pipe or socket or dev) from position 31337 and write them to the other file at position 128205 (using blocks 512+43), with or without truncation?


title: Best options for mounting Mac OS X hard drive on my Linux box?

text: I have a new 3 terabyte external USB hard drive (Seagate ST3000DM001 in an enclosure). I hope to use it on both my iMac (OS X 10.6.8) and my Linux machines (Kubuntu). Right now this drive will probably be used primarily on the Mac, but that could change in the future; I don't use my Mac that much. I have not formatted or partitioned the drive yet. What are my best options? Should I format the drive with the Mac HFS+ **case-sensitive** option? Given that I am not familiar with OS X, I would rather do standard stuff on the Mac and non-standard stuff on Linux where I'm more comfortable. That leads me to slightly prefer formatting this drive in a native Mac format. On the other hand, I have several Linux boxes where I could use this drive, so if I do non-standard stuff to mount it, I'll have to do that on each Linux machine. However, for this question, assume a 50/50 split between use on the two operating systems. I don't want to purchase any proprietary or commercial software to accomplish this task. And I need read & write access.


title: What's the meaning of output of lsattr

text: I'm wondering what the output of `lsattr` means.It prints so oddly as follows,when I have tried: `lsattr /usr`.               $ lsattr /usr     -----------------e- /usr/local     -----------------e- /usr/src     -----------------e- /usr/games     --------------I--e- /usr/include     --------------I--e- /usr/share     --------------I--e- /usr/lib     -----------------e- /usr/lib32     --------------I--e- /usr/bin     --------------I--e- /usr/sbin      I've read the man page of `chattr` and `lsattr` but still have no idea.


title: Parsing columnized data

text: I have some columnized data which I would like to format a little further. It looks like this:               $ getStats | grep ESTABLISHED | column -t     all  tcp  117.54.56.131:80       <-  10.42.100.211:63752   ESTABLISHED:ESTABLISHED     all  tcp  10.42.120.201:63752    ->  219.224.67.112:31180  ->                       137.51.59.141:80       ESTABLISHED:ESTABLISHED     all  tcp  77.221.237.24:443      <-  10.42.100.117:59999   ESTABLISHED:ESTABLISHED      Essentially before I call `column -t` I want to move the TCP state, 'ESTABLISHED:ESTABLISHED' further on the first and third line so that it is correctly placed with the second line. How would I go about this? Using awk and printf seem a bit messy here. Essentially I want to align all columns and right-align just the last column.


title: Connecting to the file systems of networked computers

text: At work, I am able to connect to all networked servers within the LAN simply by going to windows explorer and typing in the servers name or ip address, i.e. `\\\ip_address_here\c$` (can't remember if i use forward or back slashes) that gets me straight into the c: drive of that server. At home I have linux computers on the LAN. All computers can ping each other without a problem. How do I go about setting things up so I can do a similar thing as I do at work. i.e. I want to simply be able to load nautilus and type in the ip address in the location bar **UPDATE:** I have Ubuntu and Debian computers on my LAN.


title: Bonded Interface Pair Performance Difference b/w CentOS 6 and RHEL 6

text: I have two new dell servers, both pretty close to the same hardware. One has RHEL6 installed and one has CentOS 6 installed. I have the machines configured identically from a network-scripts, modprobe.d and sysctl.conf settings (did a diff on sysctl.conf to confirm). All four physical ports are on a Cisco 3750X Stacked Switch and are configured identically except for each server pair has their own channel. With the command `dd if=/dev/zero bs=4k count=262140 | ssh {host} 'cat > /dev/null'` I get roughly 100MB/s from the RHEL6 box, but only about 35MB/s on the CentOS6 box. Any ideas? I can post the various configs but there are a lot of them, don't want to have a huge post unnecessarily...


title: Stream Video using Netcat and VLC

text: I'm trying to use `netcat` on Linux server to stream video to my windows client using VLC I started running `netcat` on Linux:                cat /media/HD1/myMovie.mkv | nc -l 8668      In VLC Windows Client I tried to:               Open VLC > Open network stream vlc > rtp://@serverIP:8668      Without success.


title: How can I print text using any one of the 256 colors that the terminal allows?

text: I would like to write a program that utilizes all 256 of the Linux terminal's text colors. To date, however, I have only found a handful of color codes, which are in the format "\033[1;NUMmNUM\033[1;m". However, these escape codes only allow for two or three dozen colors, _not_ the 256 that the Linux terminal supposedly allows for. How can I display those other colors in my `curses` application?


title: How to let `ls` display the results order in row first?

text: I type `ls` in my terminal,               A0001  A0004  A0007  A0010  A0015  A0018  A0021  A0024  A0028  A0031  A0034  A0037  A0040  A0043  A0046  A0049  A0052  A0055  A0058  A0061  A0064  A0067     A0002  A0005  A0008  A0013  A0016  A0019  A0022  A0025  A0029  A0032  A0035  A0038  A0041  A0044  A0047  A0050  A0053  A0056  A0059  A0062  A0065  A0068     A0003  A0006  A0009  A0014  A0017  A0020  A0023  A0027  A0030  A0033  A0036  A0039  A0042  A0045  A0048  A0051  A0054  A0057  A0060  A0063  A0066  A0069      You see, A0001, A0002, A0003, etc is ordered in the column first then the next column and next. I wang to know how to let the display, have something like,               A0001 A0002 A0003 A0004 ....     A0024 A0025 A0026 A0027 ....      Any ideas?


title: How to generate jpg thumbnails and browsable html pages from command line?

text: I am searching for a simple command line tool that takes a bunch of jpg files as input, copies them to some destination and generates some browsable html for it (including index page, preview thumbnails etc.), such that I can upload the results to some static webserver and people can conveniently browse them.


title: How specify IPv6 server address on hosts file?

text: I have configured a server with Gentoo 64 bits that it has IPv4 and IPv6 and they are working well. But I don't know how specify the IPv6 of the server in `/etc/hosts` file:               ...     ipv4.XXX.XXX.XXX nsXXXXXXX.ip-XXX-XXX-XXX.eu      ipv6:XXxX:XX:xxxX::/64 nsXXXXXXX.ip-XXX-XXX-XXX.eu     ....      or               ....     ipv4.XXX.XXX.XXX nsXXXXXXX.ip-XXX-XXX-XXX.eu      ipv6:XXxX:XX:xxxX:: nsXXXXXXX.ip-XXX-XXX-XXX.eu     ....      ?


title: ntpd installed to local directory, now have two versions

text: I got the latest version of ntpd because the binary releases have vulnerabilities. Unfortunately, after I built it and ran `make install`, it was installed to /usr/local/sbin, but the system is running the old version of ntpd which is located in /usr/sbin. I have three questions: (1) How can I fix this, so I am running the version that I built? (2) Why does `make install` put it in a different directory than its normal location in the Debian distribution (I am running Wheezy)? (3) It seems like a bad idea to have two different versions on my computer. Should I delete the original version or replace it with the new version somehow?


title: Multiple Windows 7 installations from Grub

text: I have the following disk configuration:               Disk /dev/sda: 750.2 GB, 750156374016 bytes     255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x28ec8922          Device Boot      Start         End      Blocks   Id  System          Disk /dev/sdb: 256.1 GB, 256060514304 bytes     255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x72654d40          Device     Boot      Start         End      Blocks   Id  System     /dev/sdb1   *        2048      206847      102400    7  HPFS/NTFS/exFAT     /dev/sdb2          206848    62914559    31353856    7  HPFS/NTFS/exFAT     /dev/sdb3        62914560   167772159    52428800    7  HPFS/NTFS/exFAT     /dev/sdb4       167774206   284358655    58292225    5  Extended     /dev/sdb5       167774208   168357887      291840   83  Linux     /dev/sdb6       168359936   218357759    24998912   83  Linux     /dev/sdb7       218359808   268357631    24998912   83  Linux     /dev/sdb8       268359680   284358655     7999488   82  Linux swap / Solaris          Disk /dev/sdc: 24.0 GB, 24015495168 bytes     255 heads, 63 sectors/track, 2919 cylinders, total 46905264 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x28ec8923          Device Boot      Start         End      Blocks   Id  System      On `/dev/sdb`, I have two windows 7 installations, /dev/sdb1 is the Windows System Partition, `/dev/sdb2` is the first Windows 7 installation, `/dev/sdb3` is the second Windows 7 installation. The rest of the partitions are Ubuntu 14.04, and I am using Grub. The grub menu lists the windows loader only, and I have to go into the windows loader to select one of the Windows installations to boot from. Is it possible to list both the windows installations in the grub menu? I tried with the following Grub Custom Menu, but when I run grub-update, it does not detect any of the operating systems:               #!/bin/sh     exec tail -n +3 $0          menuentry "Ubuntu" {     recordfail     load_video     insmod gzio     insmod part_msdos     insmod ext2     set root='hd1,msdos5'     search --no-floppy --fs-uuid --set=root /dev/sdb5     linux /vmlinuz-3.13.0-24-generic root=UUID=/dev/sdb5 ro recovery nomodeset     initrd  /initrd.img-3.13.0-24-generic     }          menuentry "Windows Lab" {     insmod ntfs     set root='hd1,1'     search --no-floppy --fs-uuid --set=root /dev/sdb2     chainloader+1     }          menuentry "Windows Personal" {     insmod ntfs     set root='hd1,1'     search --no-floppy --fs-uuid --set-root /dev/sdb3     chainloader+1     }      How do I get the `grub` menu to list both the Windows 7 installations?


title: What is the significance of the dot in bash commands and how is it different from an asterisk?

text: I'm trying to understand the significance of the dot in bash and how it differs from an asterisk. Can someone please elaborate? For example, what's the difference between `cp -ar /foo/. /foo2/` and `cp -pr /foo/* /foo2/`


title: New Server: What things to take care of when setting up a webserver to host multiple websites?

text: I am setting up my first webserver. On this machine, I want to run a couple of websites. Let xyz.com and abc.com and they will not be on seperate virtual machines. I have a few queries:   * What should be the configuration values for FQDN so that I don't face problems with both websites?   * I will be sending out customer emails from these 2 sites. Since both hosted on the same machine with a single IP, can a single PTR value cause problems with emails?   * In Postfix, there is `myhostname` which is typically set to the FQDN. If I prefer to setup only a single Postfix instance, how do I handle this `myhostname` when sending emails for both of these sites? Are there any other things related to the setup that I need to take care of for proper functionality of both sites?


title: "Fill columns before rows" option in unix column command

text: According to `man column`:                -x      Fill columns before filling rows.      This option doesn't seem to do anything. Any idea how to use it?


title: Intel 82845G Integrated Graphics hanging in Fedora 18 i686 desktop

text: The first sign of this was that on startup gnome started up in safe mode and I can't access system settings from the gui menu.               $ uname -a     Linux mymachine 3.7.2-204.fc18.i686.PAE #1 SMP Wed Jan 16 16:31:26 UTC 2013 i686 i686 i386 GNU/Linux      dmesg               [   54.190910] SELinux: initialized (dev fuse, type fuse), uses genfs_contexts     [   54.280239] SELinux: initialized (dev fusectl, type fusectl), uses genfs_contexts     [  973.080049] [drm:i915_hangcheck_hung] *ERROR* Hangcheck timer elapsed... GPU hung     [  973.085561] i915: render error detected, EIR: 0x00000010     [  973.085572] [drm:i915_report_and_clear_eir] *ERROR* EIR stuck: 0x00000010, masking     [  973.085587] i915: render error detected, EIR: 0x00000010     [ 1027.080050] [drm:i915_hangcheck_hung] *ERROR* Hangcheck timer elapsed... GPU hung     [ 1027.084135] i915: render error detected, EIR: 0x00000010     [ 1027.084149] [drm:i915_report_and_clear_eir] *ERROR* EIR stuck: 0x00000010, masking     [ 1027.084162] i915: render error detected, EIR: 0x00000010     [ 1030.084053] [drm:i915_hangcheck_hung] *ERROR* Hangcheck timer elapsed... GPU hung     [ 1030.084241] [drm:i915_reset] *ERROR* GPU hanging too fast, declaring wedged!     [ 1030.084246] [drm:i915_reset] *ERROR* Failed to reset chip.     [ 3049.196863] nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.      from /var/log/Xorg.0.log               [    28.112] (II) intel: Driver for Intel Integrated Graphics Chipsets: i810,     i810-dc100, i810e, i815, i830M, 845G, 854, 852GM/855GM, 865G, 915G,     E7221 (i915), 915GM, 945G, 945GM, 945GME, Pineview GM, Pineview G,     965G, G35, 965Q, 946GZ, 965GM, 965GME/GLE, G33, Q35, Q33, GM45,     4 Series, G45/G43, Q45/Q43, G41, B43, B43, Clarkdale, Arrandale,     Sandybridge Desktop (GT1), Sandybridge Desktop (GT2),     Sandybridge Desktop (GT2+), Sandybridge Mobile (GT1),     Sandybridge Mobile (GT2), Sandybridge Mobile (GT2+),     Sandybridge Server, Ivybridge Mobile (GT1), Ivybridge Mobile (GT2),     Ivybridge Desktop (GT1), Ivybridge Desktop (GT2), Ivybridge Server,     Ivybridge Server (GT2), Haswell Desktop (GT1), Haswell Desktop (GT2),     Haswell Desktop (GT2+), Haswell Mobile (GT1), Haswell Mobile (GT2),     Haswell Mobile (GT2+), Haswell Server (GT1), Haswell Server (GT2),     Haswell Server (GT2+), Haswell SDV Desktop (GT1),     Haswell SDV Desktop (GT2), Haswell SDV Desktop (GT2+),     Haswell SDV Mobile (GT1), Haswell SDV Mobile (GT2),     Haswell SDV Mobile (GT2+), Haswell SDV Server (GT1),     Haswell SDV Server (GT2), Haswell SDV Server (GT2+),     Haswell ULT Desktop (GT1), Haswell ULT Desktop (GT2),     Haswell ULT Desktop (GT2+), Haswell ULT Mobile (GT1),     Haswell ULT Mobile (GT2), Haswell ULT Mobile (GT2+),     Haswell ULT Server (GT1), Haswell ULT Server (GT2),     Haswell ULT Server (GT2+), Haswell CRW Desktop (GT1),     Haswell CRW Desktop (GT2), Haswell CRW Desktop (GT2+),     Haswell CRW Mobile (GT1), Haswell CRW Mobile (GT2),     Haswell CRW Mobile (GT2+), Haswell CRW Server (GT1),     Haswell CRW Server (GT2), Haswell CRW Server (GT2+),     ValleyView PO board     [    28.122] (II) VESA: driver for VESA chipsets: vesa      I assume the intel driver above is the right one for this graphics card? How do I stop the built-in graphics card from hanging?


title: What is an equivalent of rm `find lib/ -name *.swp` without find?

text: As in the title, I would like to remove all files in the `lib` directory with `.swp` in the end. How can I do this without `find` in:               rm `find lib/ -name *.swp`


title: Is there a line-by-line bash pipe?

text: I remember reading somewhere (then I forgot where) about a rarely used type of bash pipe that could redirect output line-by-line. In other words, rather than redirecting the output once at the end, the output would be redirected for every newline, and run the receiving process multiple times. I've looked in all the bash docs I can get my hands on, but I can't figure out if this 'pipe' really exists. Is there such a thing as a line-by-line pipe? Of course the task could easily be accomplished other ways, but I'm curious if there is a more elegant way.


title: Where to obtain Broadcom DW1530 wireless-n wlan half-mini driver?

text: I am running Fedora 15 x86_64 on Dell Latitude E5420 which is using Broadcom DW1530 wlan card, have been looking around the web but couldn't find a driver, anyone can help?


title: Is there a linux distro that uses Jack audio server all the time?

text: By this I mean a distro that does not use pulse audio at all. So when you are runing programs like `miro` or `mumbles` you do not lose audio playback becuase Jack took over the audio stack.


title: How can I write to the second line of a file from the command line?

text: I have an external program that produces an output file (largish, 20K lines possible). I need to insert a new line between the existing line 1 and line 2. I've been looking at awk and sed - I use one liners in each fairly regularly - but I haven't been able to come up with the right switches to do this.


title: How to auto-start my bash_profile?

text: When I open a new terminal, it doesn't execute auto-start my bash_profile. I need to do "source .bash_profile". When I use Screen, it happens again.


title: Why is it a security problem to have /usr/sbin owned by bin?

text: The Sendmail Installation and Operation Guide (§1.3.1) asserts: > For security reasons, /, /usr, and /usr/sbin should be owned by root, mode > 07552   > [...]   >  2Some vendors ship them owned by bin; this creates a security hole that is > not actually related to _sendmail_. [...] Why is this a security hole? Are there systems that run processes as user bin?


title: Set up a portable development environment

text: **My Goal** Have a USB drive (4GB) live boot to DSL (for size) with some extra software (git, hg, .vimrc + plugins, etc...) and also reserve a portion of the drive as writable (maybe symlink my home folder, etc...) Ultimately have a portable development environment. Ideas / Suggestions on how to accomplish this?


title: OpenBox autostart in OpenSUSE?

text: How can I use autostart with OpenBox (in OpenSUSE)? Previously xfce was installed to run in the first place. I have added               xfce4-panel &       to `autostart` in `/etc/xdg/openbox/` and `autostart` `~/.config/openbox/` to no avail. `xfce4-panel &` from terminal works. My autostart looks like this:                  #        # These things are run when an Openbox X Session is started.        # You may place a similar script in $HOME/.config/openbox/autostart        # to run user-specific things.        #             # If you want to use GNOME config tools...        #        #if test -x /usr/lib/gnome-settings-daemon >/dev/null; then        #  /usr/lib/gnome-settings-daemon &        #elif which gnome-settings-daemon >/dev/null; then        #  gnome-settings-daemon &        #fi              # If you want to use XFCE config tools...        #        #xfce-mcs-manager &        xfce4-panel &


title: Is it possible to list open SysV queues on certain files?

text: I have a suite of applications that communicate with each other using SysV queues. However, when I stop the application there are sometimes queues left open, which in turn causes problems next time I start the application. To resolve this I want to delete the queues left open, but to know which queues to delete I would like to be able to list which queues are associated with a specific file. Is this possible to do? The queue is created using the following (simplified) code:                   key_t key;         int q_id;              key = ftok("/some/file/name", 42);         q_id = msgget(key, 0666 | IPC_CREAT);      So by associated with a file a mean the path used in the `ftok` call.


title: Export a m3u playlist to a directory in order they appear in the playlist

text: There is a way to rsync a m3u playlist into a destination directory. How can I process the list and number the output so it orders the files to match the playlist order? For example the m3u:               /music/song-yellow.mp3     /music/song-red.mp3     /music/song-blue.mp3      would copy/rsync the playlist contents, renaming the files to:               /dest-path/01-song-yellow.mp3     /dest-path/02-song-red.mp3     /dest-path/03-song-blue.mp3      _This is so I can build mixtape playlists and copy them for people._ Any advice appreciated.


title: SSH client side problem: hanging and timing out on some hosts

text: From my laptop I'm trying to connect to HOST1 and I get:               $ ssh -vvv user@HOST1     OpenSSH_6.0p1 Debian-3ubuntu1, OpenSSL 1.0.1c 10 May 2012     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: /etc/ssh/ssh_config line 19: Applying options for *     debug2: ssh_connect: needpriv 0     debug1: Connecting to HOST1 [x.x.x.x] port 22.     ssh: connect to host HOST1 port 22: Connection timed out      The ssh daemon on the server is working fine as I'm able to connect to it from other machine.   For instance from my laptop I'm able to ssh into HOST2 and from there I'm able to ssh into HOST1 but it's annoying. HOST1 is some host I have control of, but it's happening also with github and bitbucket. This lead me to believe the problem is client side only, but I ran out of ideas. Any suggestion?


title: Why need drivers for both x server and the linux kernel?

text: Can someone explain why two sets of drivers are needed, one in the Linux kernel and one in X? I understand that the device drivers are in the kernel, but what is the role of those in the xserver? Does wayland require such drivers to run?


title: why do background jobs hang depending on the size of the output?

text: I had some stress-testing scripts that were running in parallel and they would hang after finishing and would wait for a RETURN keystroke to exit. After investigating I discovered that it is not peculiar to my scripts but to all sorts of scripts ran on bash and that it depends on the size of the output produced (at least in my system: Ubuntu precise) For instance the following:               find . &      hangs and waits for a RETURN keystroke if sufficient output is produced (try .. or ../.. to get more output), otherwise (i.e. if "little" output is produced) exits without hanging. Since I find this kind of feature annoying in my particular case is there a way around it?


title: Start an installed Debian Package from Konsole

text: i have installed teamviewer from dpkg and when i list it:                   dpkg-query -l      it shows up, but how can i run it? Its not under "Applications" thanks!


title: Linux : See CPU usage by a process for the last second

text: vmstat 1      Above will print virtual memory statistics each seconds. It will also show the CPU utilization for last second. I have a web server at hand which runs httpd and MySQL. I need to find how much CPU httpd consumed in last second. Like vmstat particularly for httpd. I tried this :               ps -e -o %mem,%cpu,cmd | grep mysql | awk '{memory+=$1;cpu+=$2} END {print memory,cpu}'      But it will show me the ratio of CPU used since the start of the process. So, with above, if my process caused a spike and then went to sleep for long time, I wont know it. Its like windows process manager, which shows which process is using how much CPU. I hope I am making my question understandable. I will clarify if anything is missing.


title: Can I use a Logitech M505 wireless mouse with Fedora?

text: It's a nice mouse, but Fedora 15 doesn't recognize it. In /proc/bus/input/devices, I see a "PS/2 Generic Mouse". I've tried booting into Fedora with the USB device still plugged in, and it hangs. I found instructions that might work for Ubuntu, but they involve editing a file I just don't have in Fedora (/etc/X11/xorg.conf).


title: libX11.so.6 Not found

text: I tried to `make && make install package`, but I get an error: > libX11.so.6 not found Where can i get this lib?


title: Understanding Linux executable formats and software distribution packages

text: This kind of question might've already been beaten to death. If so, I'm sorry for beating it some more. I am having trouble understanding Linux executable formats and software distribution packages. There are so many different distributions of Linux itself, and it seems like every software package has been compiled separately for each distro. Why is this? I understand that some "packages" are made to install on different distros, but is the executable format for the software different? Also, why do many Linux users prefer the command prompt versions of applications vs GUI versions? I can understand the need for small footprints, but even GUI apps can have small footprints if they're coded right. These might be moot observations, but they get on my nerves.


title: How can I split a large text file into chunks of 500 words or so?

text: I know there's the command `split` which can split a file into several chunks based on file size, and then there's the command `wc` which can count words. I just don't know how to use the two together.


title: core dump help-- linux

text: I'm trying to understand the core dump generation. Is the core dump generated separately for a user space application process crash and the kernel level crash? Is the `ulimit -c` for both kinds? Can you please clarify?


title: sun.jdbc.odbc.JdbcOdbcDriver not found

text: I'm configuring a Business Intelligence tool `Yellowfin BI` on my Debian Linux server and I get this error:               Error Message:     java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver      I cannot figure out why the `JDBC-ODBC` driver is not found. These are the software versions:               java version "1.6.0_31"     OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1~deb7u1)     OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)      Server: Linux biserver 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux How do I troubleshoot this problem and where do I need to look for `sun.jdbc.odbc.JdbcOdbcDriver`?


title: How do I select all the hidden files in the console?

text: How do I select all hidden files in a directory? `ls .*` selects the current folder - `.`, as well as it's parent `..`. I just want the hidden files


title: Changing the defult directory structure

text: If I start a new distro (e.g. LFS):   1. How can I change the directory structure?   2. What should I expect after it's ready? (probably can't install most of the packages without modification, right? But, before you down vote: I've been asked to make a new distro for a specific project which they need (actually, want) a new directory structure with a few changes, for example remove the `var` and `bin` directories, but without halting the system. The application of this distro is so limited, so i think it shouldn't be a big deal as they need just a few packages to be installed.


title: routing wget --recursive to stdout (as in -O -) rather than a file

text: I want to "scan" a website content, recursively, and pipe it to another program. When I run:               wget -r -O - $SITE      I get               WARNING: combining -O with -r or -p will mean that all downloaded content     will be placed in the single file you specified.      Then, "download" process starts, but hangs after the first page is done. By "hangs" I mean, nothing seems to be going on, nor do I get back the command prompt until I hit `Ctrl+C`. I would prefer avoiding the option outputting `wget` to a temporary folder and scan file by file, as well as writing my own scrapper which seems to be the most redundant act one can think of at the end of 2012.


title: Delta rpms and presto with yum

text: When you use delta rpm's with presto or without even, do they rely on you having the original rpm on hand, or do they download both the original and the difference between the original and then construct it? (specifically with yum) Does presto or any other system need to be keeping a cache of all installed rpm's for delta rpms to work? Do delta rpms work without presto, or are the integrated? Thanks in advance :-)


title: Device node LVM

text: There is mention of a device node, when I was reading about LVM. I can't find anything useful as to what it is or functions as. Any help or suggestion of where to look would be appreciated.


title: Giving SSH users read-only access to a directory

text: I'm running Fedora 17 and I want to give several users access to files on my secondary hard drives on /run/media/haukur/. This is what I initially did:               chmod -R 755 /run/media/      But every time I turn the computer off these permissions are reset to:               ls -l /run/media/     drwxr-x---+ 4 root root 80 Jul  5 17:42 haukur      The same applies to /run/media/haukur/. I made a symbolic link in every user's home directory pointing to /run/media/haukur/ but they stop working (permission errors) all the time. What can I do to make these changes permanent? Edit: I solved the problem by adding the devices to `/etc/fstab`:               /dev/sdc1   /media/a                               ext4    defaults        0 0     /dev/sdb1   /media/b                               ext4    defaults        0 0


title: How to setup trap in bash functions?

text: I can setup `trap` in bash scripts but not bash functions. For example, `source` the code below and run `f`, now try `Ctrl`+`C`, it's not been trapped! How to setup `trap` in bash functions?                 4 trap ctrl_c INT       5        6 ctrl_c () {       7  echo "** Trapped CTRL-C"       8 }       9       10       11 f () {      12   for i in `seq 1 100`; do      13     sleep 1      14     echo -n "."      15   done      16 }


title: NFS File Sync on Mount

text: I have an ext4 hard drive mounted and working correctly except, if I add a file/folder to the mount on the server side, I can't see the changes on the client side unless I reboot the client. i.e. The client doesn't know/see the changes to the mount. `fstab`:               server:/mnt/hdd     /home/jesse/mnt/hdd nfs4    _netdev,auto    0   0      `etc/exports`:               /mnt/hdd 1.2.3.4(rw,sync,no_subtree_check)      Files permission are good as I can r&w without any problems. Any ideas?


title: Display Issues in KDE on laptop at startup (it happens when I plug and unplug the AC adapter)

text: I have a display problem in KDE, sometimes at startup everything goes black except the mouse. It only happens in the Login screen or in the boot screen. Lilo displays correctly and once I have loaded KDE there is no problem. I think it happens because Linux detects something else as a secondary monitor. Also I have noticed that this happens only when I Shutdown the computer with the AC adapter unplugged and I turn on with the adapter plugged. My Laptop is Toshiba and my Os is Linux Slackware 14. Any hint is helpful, for example how can I diagnose by myself the exact problem. Thanks


title: Installing Linux on an Android netbook

text: Is it possible to boot Puppy Linux using an USB stick on a netbook running Android, specifically this one: http://amzn.to/VSEJTf? Is the right kind of BIOS in place that it can boot from USB?


title: Squid cache problem

text: If I put in my `test_site acl` (deny access policy) a site (i.e, www.aaabbbccc.com) which nobody ever accessed and do a `squid -k reconfigure`, Squid then appears to correctly log the site. I then comment out the www.aaabbbccc.com URL in the test_site acl and run `squid -k reconfigure` again. So Squid allows the access to the site, correctly, doing a cache. But, here's the problem. If I remove the comment in the test_site acl, run again `squid -k reconfigure`, and I'm still able to access the URL www.aaabbbccc.com (I clean my machine cache already). My conclusion is that squid can deny a site which is stored in the squid cache. But it doesn't make any sense. Am I right? Here´s my `squid.conf`               *#####################################################################################     ie_refresh on     #####################################################################################     acl all src 0.0.0.0/0.0.0.0     acl manager proto cache_object     acl localhost src 127.0.0.1/255.255.255.255     acl to_localhost dst 127.0.0.0/8     acl SSL_ports   port    443     acl Safe_ports  port    21     acl Safe_ports  port    443     acl Safe_ports  port    1025-65535          ####################################################################################     acl NOCACHE url_regex "/etc/squid/regras/nocachesites"     ####################################################################################     acl liberar_mac_x                arp "/etc/squid/regras/liberar_mac_x"     ####################################################################################     # Regras de Controle     ####################################################################################     acl test_site               url_regex -i "/etc/squid/regras/teste_lucas"     acl redelocal   src     192.168.0.0/255.255.255.0     acl purge method PURGE     acl CONNECT method CONNECT          ####################################################################################     no_cache deny NOCACHE          http_access allow liberar_mac_x     http_access deny teste_lucas     http_access allow redelocal          http_access allow manager localhost     http_access deny manager     http_access allow purge localhost     http_access deny purge     http_access deny !Safe_ports     http_access deny CONNECT !SSL_ports     http_access allow localhost     http_access deny all          icp_access allow all     ####################################################################################     http_port       3128    transparent     ####################################################################################     cache_mem       256     MB     ####################################################################################     #cache_dir      ufs     /var/spool/squid 2000 32 512     cache_dir       ufs     /home/squid 5000 32 256     ####################################################################################     access_log      /var/log/squid/access.log squid     log_fqdn        on     ####################################################################################     acl QUERY urlpath_regex cgi-bin \?     cache deny QUERY     refresh_pattern ^ftp:           1440    20%     10080     refresh_pattern ^gopher:        1440    0%      1440     refresh_pattern .               0       20%     4320     ####################################################################################     acl apache rep_header Server ^Apache     broken_vary_encoding allow apache          ####################################################################################     cache_effective_user    proxy     cache_effective_group   proxy     visible_hostname        Servidor_de_Proxy     ####################################################################################     error_directory /usr/share/squid/errors/Portuguese     ####################################################################################     ignore_expect_100 on     ####################################################################################     always_direct allow all     ####################################################################################     *


title: shell script to append ID for newusers command

text: I am in the process of creating 60 users locally in a linux machine. I wanted to do it automatically and so I found I can use the newusers command to add the users in batch. I have the users and password list a text file. Currently, I have the text file in the below format.               user1:password1     user2:password2     user3:password3      However, for the newusers command, I need to have the file in the following format.               user1:password1:1011:1000:user1:/home/user1:/bin/bash      I need to modify the text file to append the UID, group ID and the user home path and the user shell. Is there an easier way than this?


title: Postponing ntpd

text: I am currently trying to cut boot time for an embedded Linux system. One way we figured we could do that is by postponing the ntp init.d script. The daemon tried to synchronize with the server via the ethernet connection. But we don't always have that connection up and it takes a long time to boot while it tries to synchronize. In our system, ntp is not crucial, so it can be started in a later time. What I wanted to do was to make the ntpd init.d script to wait for like 5 minutes but without blocking the rest of the boot operation. This is the S49 in the init.d folder I'm using:                   #! /bin/sh         #         # System-V init script for the openntp daemon         #              PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin         DESC="network time protocol daemon"         NAME=ntpd         DAEMON=/usr/sbin/$NAME         NTPDATE_BIN=/usr/bin/ntpdate              # Gracefully exit if the package has been removed.         test -x $DAEMON || exit 0              # Read config file if it is present.         if [ -r /etc/default/$NAME ]         then             . /etc/default/$NAME         fi              case "$1" in         start)             if [ -x $NTPDATE_BIN ] ; then                 echo -n "Getting initial time via ntp"                 $NTPDATE_BIN $NTPDATE_OPTS $NTPSERVERS > /dev/null 2>&1                 echo "."             fi                  echo -n "Starting $DESC: $NAME"             start-stop-daemon -S -q -x $DAEMON             echo "."             ;;         stop) echo -n "Stopping $DESC: $NAME"             start-stop-daemon -K -q -n $NAME             echo "."             ;;         reload|force-reload) echo -n "Reloading $DESC configuration..."             start-stop-daemon -K -q -n $NAME -s 1             echo "done."                 ;;         restart) echo "Restarting $DESC: $NAME"             $0 stop             sleep 1             $0 start             ;;         *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2             exit 1             ;;         esac              exit 0


title: Replace output occurrences

text: Let's say I have this output:               0001     0002     0003     0004     0005      and I want to replace the first two zeros (`00`) with (`01`). What is the simplest way to achieve this?


title: Why are the grsecurity patches not included in the Vanilla Kernel?

text: What are the reasons that `grsecurity` patches (or the security features it brings) are not included in the kernel by default. When looking at the benefits for security it seems the vanilla kernel is quite insecure as it is. If this is a trade-off (some applications where you want to avoid the security measures), it seems that `grsecurity` could be an option to enable in the vanilla kernel. With so many things in the mainstream vanilla kernel, I have a hard time understanding the reasons why the community does not want to include `grsecurity`.


title: Installing IPSEC on FreeBSD

text: how to install IPSEC on two FreeBSD 9.0 machines to can send an encrypted packets between them , and let them read the encrypted packets .


title: How does one indent code blocks in `ed`?

text: I like using `ed` for small edits. Currently I just press the spacebar manually to indent blocks of code in `ed`. Is this how the authors of UNIX indented their code in `ed`? Or is there some shortcut they used I don't know about?


title: USB Ports stopped working

text: After I locked my screen with `Ctrl``Alt``L` (KDE keyboard shortcut that locks the screen) and went away for 5 minutes all the USB devices stopped working (mouse, keyboard & headset). The devices are still disabled after reboot and I now get a load of error messages in my syslog:               Jun 13 09:30:04 robin-debian kernel: [  338.288104] hub 7-0:1.0: unable to enumerate USB device on port 1     Jun 13 09:30:04 robin-debian kernel: [  338.560074] hub 8-0:1.0: unable to enumerate USB device on port 4     Jun 13 09:30:05 robin-debian kernel: [  383.832047] usb 7-1: new full-speed USB device number 100 using uhci_hcd     Jun 13 09:30:05 robin-debian kernel: [  383.956034] usb 7-1: device descriptor read/64, error -71      These error messages keep popping up when my system is running. I've googled and searched on here and there weren't any working solutions in the results. I'm running Debian Wheezy and using KDE.


title: How can I tweak the kernel for total swap out?

text: I would like to deploy the following swapping policy:   * By default all pages in memory should also be in swap space.   * When a page in memory is changed (i.e. dirty), the page should be written out as soon as possible, but with lower priority than other processes.   * if a certain configurable watermark is reached, (let's say 80% of pages are dirty), the priority will be equal as other processes. Is this kind of swapping policy possible with the linux kernel? If so, how do I set the kernel settings to achieve this? **Edit:** Obviously the reason for this is to reduce the number of pages that need to be swapped out. Only dirty pages need to be written to disk, and this happens in the background over time. Therefore when page misses occur (i.e. the page is not in memory), there is no need to write any pages from memory to disk, but only from disk to memory. Therefore it reduced the probability of i/o bottlenecks because both swapping in and swapping out try to access the disk simultaneously.


title: What is the state of the Linux Standard Base?

text: In learning some assembly programming I have found the documents of the Linux Standard Base very useful. It seems they tell me how things are supposed to be (on standard based systems), not just how they are in the implementation I have in front of me. On the wikipedia article there are two 2005 articles linked that suggest there is contention around this standard. 2005 is a long time ago, what is the current view? (Note: just this year the linux foundation certified many distributions for LSB 4.0, so they are still in the game working with some distributions. Their press release of course does not mention any possible contention around it.)


title: How does one capture traffic on virtual interfaces?

text: I would like to capture traffic on Linux virtual interfaces, for debugging purposes. I have been experimenting with `veth`, `tun` and `dummy` interface types; on all three, I am having trouble getting `tcpdump` to show anything. Here is how I set up the dummy interface:               ip link add dummy10 type dummy     ip addr add 99.99.99.1 dev dummy10     ip link set dummy10 up      In one terminal, watch it with `tcpdump`:               tcpdump -i dummy10      In a second, listen on it with `nc`:               nc -l 99.99.99.1 2048      In a third, make an HTTP request with `curl`:               curl http://99.99.99.1:2048/      Although in terminal 2 we can see the data from the `curl` request, nothing shows up from `tcpdump`. A Tun/Tap tutorial clarifies some situations where the kernel may not actually send any packets when one is operating on a local interface: > Looking at the output of tshark, we see...nothing. There is no traffic going > through the interface. This is correct: since we're pinging the interface's > IP address, the operating system correctly decides that no packet needs to > be sent "on the wire", and the kernel itself is replying to these pings. If > you think about it, it's exactly what would happen if you pinged another > interface's IP address (for example eth0): no packets would be sent out. > This might sound obvious, but could be a source of confusion at first (it > was for me). However, it is hard to see how this could apply to TCP data packets. Maybe `tcpdump` should be bound to the interface a different way?


title: How do I set the password of a new user after the account has already been created?

text: I used the 'useradd' command to create a new account, but I did so without specifying the password. Now, when the user tries to log in, it asks him for a password. If I didn't set it up initially, how do I set the password now?


title: htop: Using Ctrl + n & Ctrl + p to move between processes

text: I'm running the latest version of `htop` through Homebrew on the latest OSX. `htop` seems to work well on my terminal (either Terminal or iTerm), but: I'm unable to use `Ctrl`+`n` and `Ctrl`+`p` to move up and down between processes.


title: gVim opening a tab pushes status line out of window

text: When opening a new tab in gVim (with `:tabe`), the status line at the bottom of the screen disappears. If I press `:` and start typing a command I can no longer see the command on the status line. When the gVim window is maximized, opening a tab pushes the status line below the screen. When the gVim window is not maximized, the window will increase in height. This problem happens in Gnome and in Xmonad. I'm looking for a way to get around this issue. Is there a way to force the window to redraw such that the status line fits inside the window?


title: Preventing use of `cd ..` in bash?

text: I have set up an alias in my .bashrc as follows: `alias u='cd ..'` All is well in my world... until I type `cd ..` and cringe that I did not use my incredible new alias. In fact, with this particular thing, it's very ingrained. Hard to change my behavior - I need serious intervention. So, I naturally tried to set up another alias to keep me from using `cd ..`: `alias 'cd ..'='echo "Use your alias!"'` But that apparently doesn't work. My thought is that this also might somehow conflict with the `u` alias, in some sort of infinite loop of aliasing. Any ideas?


title: rm -rf failing if deleting in parallel

text: `rm -rf` will fail if something tries to delete the same file tree (I think because `rm` enumerates the files first, then deletes). A simple test:               # Terminal 1     for i in `seq 1 1000`; do mkdir -p /tmp/dirtest/$i; done          # Now at teh same time in terminal 1 and 2     rm -rf /tmp/dirtest      There will be some output into stderr, e.g.:               ...     rm: cannot remove directory `/tmp/dirtest/294': No such file or directory     rm: cannot remove directory `/tmp/dirtest/297': No such file or directory     rm: cannot remove directory `/tmp/dirtest/304': No such file or directory      I can ignore all the stderr output by redirecting it to `/dev/null`, but removing of `/tmp/dirtest` actually fails! After both commands are finished, `/tmp/dirtest` is still there. How can I make `rm` delete the directory tree properly and really ignore all the errors?


title: Root password not working to log in to Gnome with gdm

text: I have a weird issue going on. I have a user account and I can login to Gnome normally. From a terminal there I can use `su root` and switch to root with my root password. However, when I try to login to Gnome as root, the same password does not work. I'm using Fedora 13 on a Dell Inspiron 6400


title: How to find out the content of a XML file using Unix Sed/Awk?

text: I have a XML file(MyXML.xml) like this :               <?xml version="1.0" encoding="UTF-8"?>     <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">         <S:Body>             <ns3:GetAllInfoFromRest xmlns:ns2="http://com.lanuk.cfe/b2_7/service/objects" xmlns:ns3="http://com.lanuk.cfe/b2_7/service/operations">                 1111,GH43567,Hamburger,GET,278598655,\n000001,                    ,Kunal,Bhyuo,Ramond,856 K. 98 Rd,                                        ,                                        ,Tripura,AGT,INDIA,856987,                    ,S,S,S,8956,\666666             </ns3:GetAllInfoFromRest>         </S:Body>     </S:Envelope>      Now i need to strip out the SOAP content and all the tag attributes from this xml and get only the string response `1111,GH43567,Hamburger,GET,278598655,\n000001, ,Kunal,Bhyuo,Ramond,856 K. 98 Rd, , ,Tripura,AGT,INDIA,856987, ,S,S,S,8956,\666666`. How can i do it with `awk` or `sed` ? I tried it in this way :               $ xgawk -lxml 'XMLATTR["xmlns:ns3"]=="http://com.lanuk.cfe/b2_7/service/operations"{print $2}' MyXML.xml      But obviously I am making some mistake due to which it is not working. Can some one suggest any other way around this ?


title: Building 32-Bit on a 64-Bit system

text: I'm trying to build the PHP memcache extension (v2.2.6) for i386 (32bit) on my x86_64 Ubuntu 11.04. `./configure` uses config.guess by default (which outputs `x86_64-unknown- linux-gnu` on my system) but I want to override that. How would I have to proceed?


title: Problems with a Read-Only Root Filesystem

text: I was creating a read-only root filesystem for use in an embedded system. I successfully got the system to boot after setting it to read-only initially, but then I needed write access to another file (/etc/hostname). I tried creating a symbolic link, like I did with /etc/fstab and /etc/resolv.conf, but the system fails to boot all the way - I have to boot into recovery mode and undo the change. Does anyone know an alternative to a symbolic link or why the link causes these problems? Edit: When I boot into recovery mode, I can see two errors right at the end before it allows me to use the command-line:               startpar: service(s) returned failure: hostname.sh udev-mtab ... failed!     sulogin: root account is locked, starting shell      I tried editing /etc/init.d/hostname.sh to read hostname from /var/network/hostname (new location of the actual file), and now it boots to a login screen. This is running CrunchBang Linux, if that makes a difference. Does this help at all?


title: Mount a file collection in a linux environment

text: I am presently working as a summer intern. My first objective is, given a collection of files, recover and identify the file types present in it. To download sample pseudo-forensics data I have been using: Digital Corpora for pseudo corpus. I am trying to mount the disk images provided in this site, they are of type E01 ,E02 etc. I have tried using the **_mount_** command in linux. I have not been successful so far. Please provide methods to mount such pseudo corpus in a linux environment.


title: What are the differences between the major Linux distributions?

text: Newbies to Linux like me often find it puzzling when there are so many different distributions like Debian, Fedora or Ubuntu. I've tried to Google some documents describing the differences between these distributions but failed to grasp the key ideas. So I'd like to know:   1. What are the major differences between these distributions?   2. Are there a specific target for each distribution? For example, which distribution would you recommend to a novice for learning the basics of Linux? Which one would you recommend to someone who really wants to learn the essences of Linux? I'm not sure whether there are duplicates of my question but I haven't found one based on a cursory Google search.


title: How does kernel swapping / INT 13h interrupts work?

text: I'm looking for a way to learn about and understand this technique. Here's what I'm talking about:   * Slax boots, {does stuff, like copy itself to RAM}, then `transitions control to the kernel/file system it just made`   * SYSLINUX boots off a FAT32/NTFS system, {does stuff}, then `boots into a kernel`   * ISOLINUX boots off a CD/DVD, {does stuff} then `boots into a kernel` Is there a name for this? Is it similar in GRUB when using chainloading?   * GRUB boots, loads selection menu, does selection. If it's a chainloading selection, it `passes control to something else`. I'm looking for how I can use one kernel to extract an .iso (from a FAT32/NTFS partition) into RAM, then boot off the RAM drive as if it had been there at startup. For more details as to why I want to do this, see this question. Here, however, I'm just asking for details about how a kernel "transitions" to another. Is there a name for this? I've heard of `INT13h` which I believe is used in GRUB/chainloading. Is this a technique to 'reboot into a different kernel'? If not, how is this done?


title: How to plot the output of a command

text: How can I plot the output of this command line with GNUPlot? What should the diagram script look like? I want a histogram.               wget -O - -o /dev/null http://www.stackoverflow.com/ |     cat | cat | sed "s/</\n</g" |     grep '<\/\{0,1\}[a-zA-Z][a-zA-Z\:\._\-]\{0,\}' |     cut -f 2 -d"<" | cut -f 1 -d">" | cut -f 1 -d" " |     sed "s/\//\\n/g" |     sort | uniq -c |     tail -n +2 |     cut -c5-


title: mke2fs/fsck has left mounted NTFS(hda1) drive with only a lost+found folder

text: I had a messed up win XP (NTFS) HD on laptop due to some registry settings being deleted. So I thought I would just boot in a live Linux CD and move repair/system to config/system. Try DSL, hda1 mounted but only with 'ro' permissions, tried loads of things but couldn't get 'rw' perms. Then tried sliax, hda1 would not mount, so googled (bad superblocks)error and found mke2fs -n or fsck (can't remember which). I ran mke2fs -n. So it ran through some procedure but I could mount hda1 in sliax but now all I can see if I mount hda1 is a lost+found folder. Have I lost all the info on the laptops HD? When I mount in DSL it's also a lost+found folder, before in DSL I could see all the contents?


title: How to execute a shellscript when I plug-in a USB-device

text: I want to execute a script when I plug in a device in my Linux machine. For example, run `xinput` on mouse or a backupscript on a certain drive. I have seen a lot of articles on this, most recently here and here. But I just can't get it to work. Here's some simple examples trying to get at least some kind of response. **/etc/udev/rules.d/test.rules**               #KERNEL=="sd*", ATTRS{vendor}=="*", ATTRS{model}=="*", ATTRS{serial}=="*", RUN+="/usr/local/bin/test.sh"     #KERNEL=="sd*", ACTION=="add", "SUBSYSTEM=="usb", ATTRS{model}=="My Book 1140    ", ATTRS{serial}=="0841752394756103457194857249", RUN+="/usr/local/bin/test.sh"     #ACTION=="add", "SUBSYSTEM=="usb", RUN+="/usr/local/bin/test.sh"     #KERNEL=="sd*", ACTION=={add}, RUN+="/usr/local/bin/test.sh"     KERNEL=="sd*", RUN+="/usr/local/bin/test.sh"     KERNEL=="*", RUN+="/usr/local/bin/test.sh"      **/usr/local/bin/test.sh**               #!/usr/bin/env bash     echo touched >> /var/log/test.log          if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]     then         echo ${DEVICE} >> /var/log/test.log     fi      The rules folder is watched by `inotify` and should be active immediately. I keep replugging my keyboard, mouse, tablet, memorystick and usb-drive, but nothing. No log file touched. Now, what would be the most simple way to at least know something is working? It's easier to work from something that's working than from something that's not.


title: Linux user security

text: When a user is created in Linux, their username can be seen publicly in the `passwd` file. Is there a hash set for that?


title: Chrooted sftp gives "Permission denied" error

text: I have configured sshd_conf on my centos box as below:               Match group pilots     ChrootDirectory /home/pilots     ForceCommand internal-sftp     X11Forwarding no     AllowTcpForwarding no      and the directory /home/pilots like this:               # ls -al /home/pilots     total 12     drwxr-x---. 3 root pilots 4096 Mar 10 14:20 .     drwxr-xr-x. 7 root root     4096 Mar 10 14:10 ..     drwxrwxr-x. 2 root pilots 4096 Mar 10 15:21 data     -rwxrwxrwx. 1 root root        0 Mar 10 14:20 topLevel     #       If I sftp in as a user in the pilots group WITHOUT the ChrootDirectory Directive enabled, I can cd to the /home/pilots folder (or a subdirectory thereof) and do a ls or get without difficulty. However, if I enable the ChrootDirectory directive, while I can still sftp in, and can cd to data, I can not do a ls or get in either directory. Trying ls, for example, gives a `remote readdir("/"): Permission denied` error, and trying to get topLevel gives `File "/topLevel" not found`. I was thinking maybe I wasn't in the directory I was expecting, but the ability to cd data would appear to indicate the chroot did work as intended. What might I be doing wrong? Couple of potentially important notes:   * The users in question exist on a remote LDAP server, accessed via sssd   * Access control must be by group, as many users will need read access to this same folder. Thus the ownership remaining root. Edit: I just noticed this in the messages log:               type=1400 audit(1394494944.504:50): avc:  denied  { read } for  pid=22758 comm="sshd" name="pilots" dev=dm-0 ino=400504 scontext=unconfined_u:system_r:chroot_user_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:home_root_t:s0 tclass=dir      So there's a record of the denial. Still doesn't tell me why though.


title: How to tape a video running on the screen? (screen capture)

text: I am trying to capture video and audio from the screen, loudspeakers and microphone. I would like to do that with a command-line command. So far, `ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg` records video, and `ffmpeg -f alsa -ac 2 -i pulse -acodec libmp3lame -ab 128k ~/Videos/outpulse.mp3` records the audio of the microphone. Both commands can be combined in: `ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 -f alsa -ac 2 -i pulse -acodec libmp3lame -ab 128k /tmp/outputFile.mpg` which records the screen and the microphone in the same file. This can be useful for tutorials. How can I adapt the command above to record from the loudspeakers? Or to record microphone + loudspeaker at the same time? For example for a VoIP session. Obviously, the audio from the loudspeakers gets taped by the microphone, but that results in a very poor sound quality. `avconv` options are also welcome, but I don't want any tool that's not standard in Linux, GUI based, or not in the repositories.


title: Setting up a cron for every 30 hours in Debian

text: */30 */30 * * * python /root/get_top.py      I'm trying to run a script every 30 hours and 30 minutes. Is the syntax above proper for that? I've had multiple people tell me that */30 is not a valid value for the hour column, since it's greater than 24. If that's true, how do I make a cron for a job that should run every 30 hours?


title: Have to run partprobe at every boot

text: I created an LVM logical volume. I partitioned it manually. I ran `partprobe`. I found the new device in `/dev/mapper`, then I mounted it where I needed it. Everything works. ...except on reboot, obviously, the mount point is gone since I didn't update /etc/fstab. On the other hand, however, I can't just do that because the device files do not show up under /dev until I actually run `partprobe` again. How can I fix this?


title: Why is there a mix of symlinks and hardlinks in /bin?

text: I understand the technical difference between symlinks and hardlinks, this is a question about their use in practice, particularly I'm curious to know why both are used in seemingly similar conditions: the `/bin` directory. Here's a fragment its listing on my system:               ~$ ls -lai /bin     total 10508     32770 drwxr-xr-x  2 root root    4096 Jun 14 11:47 .         2 drwxr-xr-x 28 root root    4096 Sep  6 13:15 ..       119 -rwxr-xr-x  1 root root  959120 Mar 28 22:02 bash        2820 -rwxr-xr-x  3 root root   31112 Dec 15  2011 bunzip2       127 -rwxr-xr-x  1 root root 1832016 Nov 16  2012 busybox        2820 -rwxr-xr-x  3 root root   31112 Dec 15  2011 bzcat      6191 lrwxrwxrwx  1 root root       6 Dec 15  2011 bzcmp -> bzdiff      5640 -rwxr-xr-x  1 root root    2140 Dec 15  2011 bzdiff      5872 lrwxrwxrwx  1 root root       6 Dec 15  2011 bzegrep -> bzgrep      3520 -rwxr-xr-x  1 root root    4877 Dec 15  2011 bzexe      6184 lrwxrwxrwx  1 root root       6 Dec 15  2011 bzfgrep -> bzgrep      5397 -rwxr-xr-x  1 root root    3642 Dec 15  2011 bzgrep        2820 -rwxr-xr-x  3 root root   31112 Dec 15  2011 bzip2      2851 -rwxr-xr-x  1 root root   10336 Dec 15  2011 bzip2recover      6189 lrwxrwxrwx  1 root root       6 Dec 15  2011 bzless -> bzmore      5606 -rwxr-xr-x  1 root root    1297 Dec 15  2011 bzmore      I indented the hardlinks to the same inode for better visibility. So are symlinks used in case of `bzcmp`, `bzegrep`, `bzfgrep`, `bzless` and hardlinks in case of `bzip2`, `bzcat`, `bunzip2`? They are all regular files (not directories), reside inside one filesystem, are system utilities and are even made for working with the same thing: bzip archives. Are the reasons for use of hardlinks/symlinks in this particular case purely historical or am I missing something? **Clarification of my question:** I'm **not** asking about:   * The technical differences between symlinks and hardlinks   * The theoretical advantages and disadvantages each of them These questions have been addressed in other threads on SO. I'm trying to understand why different decisions were made in a specific case: for a group of related system utilities. Technically, they all could've been symlinks or they all could've been hardlinks, both options would work (and in both cases a program can still figure out how it's been invoked via `argv[0]`). I want to understand the intent here if there is any. **Related:**   * Why do hard links exist?


title: Location of Xorg headers on FreeBSD 10

text: I'm running FreeBSD 10 and I'd like to build dwm. I've installed Xorg using `pkg install`. Where are the headers located? Maybe I'm just old fashioned but I first looked in `/usr/X11R6` ... not there. Anyone has any idea where Xorg will install its headers files in FreeBSD?


title: Invalid signatures and packages authentication issue

text: I'm using LMDE 201303 and i have two issues which i need to resolve as soon as possible. I need to install certain libraries: libopus0 libopus0 The apt-get install yells the following message:               WARNING: The following packages cannot be authenticated!     libopus0 libopus0      Second issue is that once i want to do apt-get update i get the following message:               W: GPG error: http://packages.linuxmint.com debian Release: The following signatures were invalid: BADSIG 3EE67F3D0FF405B2 Clement Lefebvre (Linux Mint Package Repository v1) <root@linuxmint.com>       this is my source list:               deb http://packages.linuxmint.com/ debian main upstream import     deb http://debian.linuxmint.com/latest testing main contrib non-free     deb http://debian.linuxmint.com/latest/security testing/updates main contrib non-free     deb http://debian.linuxmint.com/latest/multimedia testing main non-freee      could anyone help a poor soul?


title: Linux Mint Debian quits on boot

text: I just upgraded Linux Mint Debian Edition with the up7 package. The update manager failed initially (can't remember where...) so I ran `sudo apt update`, `sudo apt dist-upgrade`, `sudo apt upgrade` and `sudo dpkg --configure -a`. Situation now: when I reboot and select the new kernel (3.10-2-amd64) from the grub menu, the following happens:   * This: `early console in decompress_kernel` `Decompressing kernel... Parsing ELF ... done.` `Booting the kernel.` `[<...> Could not configure common clock.`   * Linux Mint splash screen appears.   * The NVIDIA Screen appears.   * I get this error message: `FAIL: startpar: service(s) returned failure: plymouth ... failed!`   * The system quits. Sometimes the first message will be shown twice with a login prompt in between, after which the system will quit. Any ideas? I will be happy to boot into the old kernel and provide any output!


title: XFCE hangs with hand cursor

text: I am using Xubuntu 12.04 in a remote environment. Off late, I am observing that sometimes the cursor turns into a hand and stops responding. I cannot do anything to fix it. The only solution seems to be to terminate the XFCE session and re-login. I am observing this when using a remote connection. Anyone seen this or know a solution or workaround ? I am just frustrated with this problem coming up every so often. ------------- EDIT ---------------- The LD_PRELOAD method doesnt seem to work for me. Is there a command line way to generate `AllowDeactivateHold` ? ------------- EDIT ---------------- Can we use `xinput` to create the effect of `AllowDeactivateHold` ?


title: How to pkill from a script?

text: How can I write a script that basically just runs `pkill -HUP inetd`? I want to restart `inetd` via a script so I can schedule it to run at a particular time. I tried to write it myself, but I'm getting a "Hangup" error.


title: wubi pros and cons

text: Do you have experience using Wubi and if so, what are the major pros and cons ? I am of course particularly interested in potential problems.


title: How do you hide "Generic USB SD Reader" in nemo file manager when a card is not present?

text: I'm running Linux Mint 16. I have a external card reader that has CF, MS, SD, and SM readers in it as well as 3 USB ports. Is there a way to hide the card reader ports from nemo's my computer when there's no cards inserted? I know it's easy to do in windows but i don't know if it's possible in mint.


title: Can I mount NTFS flash drive on linux

text: Hi I'm using RHEL 6 an WIN 7. I have a flash drive of 16GB. To copy the files which are above 4GB size I changed it to NTFS(FAT32 is allowing only file size below 4GB). But now I am not able to use in my Linux machine. Can I mount it with out loosing data on it.


title: How to find which files contain mentions of a wildcard image name?

text: What I am trying to do is do a search on my server to find which files contain mentions of images with a certain keyword in the filename but all I can figure out is how to find the filenams (not image specific), and not the files that contain references to them. What I have tried is:               find -name *nasa*      but that's so far off what I'm looking for, any ideas?


title: Find largest files recursively

text: There seem to be a lot of entries about how to use `du` to recursively find the largest dir and files at the same time, but none on how to only recursively find the largest files in a set of directories. Basically, I am looking for a command to find the largest .mp3 files in my music library, not the directory containing the most amount of data. I'm using bash on an OSX 10.8 system.


title: Run ssh login command without modifying remote .bashrc

text: We have a bunch of servers set up with `set -o vi` in their `~/.bashrc`. It would be nice to be able to ssh into these boxes and automagically run `set -o emacs` as a timesave. I've seen a solution indicating that such additions should be made on the remote host `~/.bashrc` but we cannot modify these for various reasons. Another solution suggests using: `spawn ssh -t user@host "set -o emacs; /bin/bash -i"` ..but I understand this requires running the `expect` shell instead of plain `bash`. Is there a simple way to achieve this goal? Any suggestions would be very much appreciated.


title: UDEV assign ATTRS{variable} to ENV{variable}

text: I am writing my first udev rule. I read many how tos but can't find a way to assign `ATTRS{variable}` to `ENV{variable}` in order to have access to that variable from RUN like `RUN+="/bin/mkdir/%E{variable}"` because with `RUN+="/bin/mkdir/ATTRS{variable}"` it doesn't work. I tried to use `$ATTRS{variable}`, `%ATTRS{variable}`, `ATTR{serial}`, `$ATTR{serial}`, `%ATTR{serial}` with no success. The variable itself exists 100% thank you...


title: Make that only members of a group can access a specific disk

text: All members of group `vip` should be allowed to read,write,execute to a specific disk. Currently, only the logged in user is allowed to access such disk. What is the correct way to allow members of group `vip` to read,write,execute to a specific disk?


title: How to exclude given lines in syslog-ng?

text: I need to exclude a given line in the messages file:               Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.4 DST=192.168.202.255 LEN=238 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32776 DPT=705 LEN=218      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.6 DST=192.168.202.255 LEN=183 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32770 DPT=700 LEN=163      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.8 DST=192.168.202.255 LEN=176 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32768 DPT=714 LEN=156      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.10 DST=192.168.202.255 LEN=175 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=33628 DPT=715 LEN=155      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.30 DST=192.168.202.255 LEN=185 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32770 DPT=713 LEN=165      Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.34 DST=192.168.202.255 LEN=237 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32781 DPT=704 LEN=217       they are afaik heartbeat udp messages, but they aren't needed in the logs.               # rpm -qa | grep -i syslog-ng     Security.syslog-ng-1.6.8.0-1     # uname -a     Linux SERVERNAME 2.6.5-7.325-bigsmp #1 SMP Tue Jan 18 23:36:49 UTC 2011 i686 i686 i386 GNU/Linux     # cat /etc/SuSE-release      SUSE LINUX Enterprise Server 9 (i586)     VERSION = 9     PATCHLEVEL = 4      **Q:** How can I exclude these kind of messages from the /var/log/messages?


title: regex find and replace 0x0D, 0x0A characters

text: I have a text file of a database dump with some line break characters (`0x0A0x0D`) in the middle of lines. I want to replace them with commas, but I can't do it simply, because those characters are the actual line break characters where I _do_ want line breaks! But I noticed that the line break sequences I want to keep are surrouned by space characters ( `0x20`), so I was thinking a regex to find and replace any `0x0A0x0D` sequence without a leading or trailing space. How can I do this?


title: Find common elements in a given column from two files and output the column values from each file

text: I have two files with tab-seperated values that look like this: file1:               A    1     B    3     C    1     D    4      file2:               E    1     B    3     C    2     A    9      I would like to find rows between files 1 and 2 where the string in column 1 is the same, then get the corresponding values. The desired ouput is a single file that looks like this:               B    3    3     C    1    2     A    1    9      Can this be done with a Unix one-liner?


title: Route HTTP traffic thorugh different interface

text: I have my normal `eth0` interface and an setup `ppp0` interface, the problem I have is that I want to exclusively route all HTTP/HTTPS traffic through the `ppp0` interface and everything else through the default `eth0`. I tried adding a route rule `route add default dev ppp0` but of course this will route everything through the `ppp0` interface, I might need iptables but I have no idea how.


title: Getting Samba on suse to work with NTFS drives

text: For a server with samba. I've just added (to the server, just shoved it in) an ntfs drive with some stuff and I want to access it through win7 (home edition). After a small struggle I've managed to access the server files from win7 but not the aforementioned ntfs drive. It works with but I can't log with any of the samba users. When I try to change from `%S` to a specific user or force one it just doesn't connect. Any ideas?                [NTFS drive]     comment = Samba server's NTFS disk     path = /media/sdc1     valid users = %S     read only = No     create mask = 0775     directory mask = 0775     guest ok = No


title: Why is '.' a hard link in Unix?

text: I've seen many explanations for why the link count for an empty directory in Unix based OSes is 2 instead of 1. They all say that it's because of the '.' directory, which every directory has pointing back to itself. I understand why having some concept of '.' is useful for specifying relative paths, but what is gained by implementing it at the filesystem level? Why not just have shells or the system calls that take paths know how to interpret it? That '..' is a real link makes much more sense to me -- the filesystem needs to store a pointer back to the parent directory in order to navigate to it. But I don't see why '.' being a real link is necessary. It also seems like it leads to an ugly special case in the implementation -- you would think you could only free the space used by inodes that have a link count less than 1, but if they're directories, you actually need to check for a link count less than 2. Why the inconsistency?


title: How to copy two files in expect script?

text: please advice why               spawn  scp  $FILE1   $FILE2  $LOGIN@$IP:/tmp      in my expect script copy only FILE1 and not copy FILE2 ? I try to to transfer both files by scp as                scp file1.csv file2.crt 192.8.200.1:/tmp       without expect and they transferred successfully to /tmp so why VIA expect the only file that copied is **FILE1** ?? what wrong in my syntax ? example of my expect script:                #!/usr/bin/expect -f      set FILE1  file1.csv      set FILE2  file2.crt      set multiPrompt {[#>$]}      spawn  scp  $FILE1   $FILE2  $LOGIN@$IP:/tmp                expect {                          ")?"   { send "yes\r"  ; exp_continue  }                              word:  {send $PASS\r}                        }      I also try this:               spawn  scp  "$FILE1   $FILE2"   $LOGIN@$IP:/tmp      OR               spawn  scp  '$FILE1   $FILE2'   $LOGIN@$IP:/tmp      but I get the same problem


title: Can I pass files between commands?

text: I am looking for a way to send the resulting file from one comamnd to another, So I dont have to save a copy on disk inbetween. For example, if I have `rar`ed files on disk and want to open them I would like to be able to run something like:               unrar x file.rar | kplayer          unrar x file.rar | gpg -c          gpg file.gpg | kplayer       I am sure you see what I am looking for. I have tried to get `unrar` to send to standard output with `-p` but it will just send it to screen even when I think it should be connected with a `|` to kplayer. I suppose that is because kplayer can't get it's data from stdin. But is there a way to pass files without saving them on disk? Is the best I can get to create a filesystem in memory and use that, I don't like the idea to reserve that much memory though.


title: How do I share stdout between multiple processes?

text: I want to receive live TCP stream, and make it readable by another processes at the same time, without saving it. For example, 111.222.233.244:1234 streams actual time. Server supports only one connection. TTY1:               $ nc 111.222.233.244 1234 | (do something here) /tmp/tcpstream &     $ sleep 5 # stream is received even if there is no process that reads it     $ cat /tmp/tcpstream # it can also be like `(some command) | cat -`     17:00:06     17:00:07     17:00:08     17:00:09     17:00:10     17:00:11      TTY2 (second `cat` executed 9 seconds after executing `nc`):               $ cat /tmp/tcpstream     17:00:09     17:00:10     17:00:11


title: Previous login notification

text: I am using CentOS 6. How can I configure it so the system notifies the user, upon successful login, of the date and time of the last login? Is that possible?


title: getting "bad init string" when dialing with wvdial

text: I'm trying to dial-up with my Huawei modem EM680 using wvdial. My modem is found properly on `/dev/ttyUSB1` but when I execute wvdial I get this:               # wvdial     --> WvDial: Internet dialer version 1.61     --> Cannot get information for serial port.     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 +FCLASS=0     ATQ0 V1 E1 +FCLASS=0     OK     --> Sending: AT+CGDCONT=1,"IP","m2mstatic.apn"     AT+CGDCONT=1,"IP","m2mstatic.apn"     ERROR     --> Bad init string.     --> Cannot get information for serial port.     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 +FCLASS=0     ATQ0 V1 E1 +FCLASS=0     OK     --> Sending: AT+CGDCONT=1,"IP","m2mstatic.apn"     AT+CGDCONT=1,"IP","m2mstatic.apn"     ERROR     --> Bad init string.     --> Cannot get information for serial port.     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 +FCLASS=0     ATQ0 V1 E1 +FCLASS=0     OK     --> Sending: AT+CGDCONT=1,"IP","m2mstatic.apn"     AT+CGDCONT=1,"IP","m2mstatic.apn"     ERROR     --> Bad init string.     #       Why does it say `bad init string.`? My `/etc/wvdial.conf` looks like this:               [Dialer Defaults]     Init1 = ATZ     Init2 = ATQ0 V1 E1 +FCLASS=0     Init3 = AT+CGDCONT=1,"IP","m2mstatic.apn"     Stupid Mode = yes     Modem Type = Analog Modem     ISDN = 0     New PPPD = yes     Phone = *99#     Modem = /dev/ttyUSB1     Username = ;     Password = ;     Baud = 9600


title: How do I correct a directory incorrectly copied into itself?

text: Given the following situation...               <path>/mydir1/mydir2      ...where mydir2 _should have_ overwritten mydir1, but was instead placed inside, and both directories actually have the same filename. How is that fixed? Attempting to do `mv <path>/mydir/mydir/* <path>/mydir/` or `mv <path>/mydir <path>/` results in:               mv: cannot move `<path>/mydir/mydir` to a subdirectory of itself, `<path>/mydir`      This seems stupidly simple, but it's late here and I can't figure it out. There are seventeen such directories to fix (path differs for each, but same mydir name).    To confirm, the error message can be caused with this:               # cd /path/to/directory     # mv mydir/mydir ./     mv: cannot move `mydir/mydir' to a subdirectory of itself, `./mydir'      Also tried:               # mv mydir/mydir/* mydir/     mv: cannot move `mydir/mydir/otherdir1' to a subdirectory of itself, `mydir/otherdir1'     mv: cannot move `mydir/mydir/otherdir2' to a subdirectory of itself, `mydir/otherdir2'      and...               # mv /path/to/directory/mydir/mydir/otherdir1 /path/to/directory/mydir/     mv: cannot move `/path/to/directory/mydir/mydir/otherdir1' to a subdirectory of itself, `/path/to/directory/mydir/otherdir1'      and using a temporary directory:               # mv mydir/mydir ./mydir-temp     # mv mydir-temp/* mydir/     mv: cannot move `mydir-temp/otherdir1' to a subdirectory of itself, `mydir/otherdir1'     mv: cannot move `mydir-temp/otherdir2' to a subdirectory of itself, `mydir/otherdir2'         I found a similar question "How to recursively move all files (including hidden) in a subfolder into a parent folder in *nix?" which suggested that `mv bar/{,.}* .` would do this. But this also gives the same errors, as well as confusingly picking up `.` and `..` from somewhere.               # cd mydir     # mv mydir/{,.}* .     mv: cannot move `mydir/otherdir1' to a subdirectory of itself, `./otherdir1'     mv: cannot move `mydir/otherdir2' to a subdirectory of itself, `./otherdir2'     mv: cannot move `mydir/.' to `./.': Device or resource busy     mv: cannot move `mydir/..' to `./..': Device or resource busy     mv: overwrite `./.file'? y         Another similar question "linux mv command weirdness" suggests that `mv` doesn't overwrite and a copy is required.               # cd mydir     # cp -rf ./mydir/* ./     cp: overwrite `./otherdir1/file1'? y     cp: overwrite `./otherdir1/file2'? y     cp: overwrite `./otherdir1/file3'?      This appears to be working... except there's a lot of files (and dirs) - I don't want to confirm every one! Isn't the `f` there supposed to prevent this? Ok, so `cp` was aliased to `cp -i` (which I found out with `type cp`), and bypassed by using `\cp -rf ./mydir/* ./` which seems to have worked. **Although I've solved the problem of getting dirs/files from one place to another, I'm still curious as to what's going on with the`mv` stuff - is this really a deliberate feature as suggested by Warner?**


title: How to delete line with echo?

text: I know that I could delete the last three chars with:               echo -ne '\b\b\b'      But how can I delete a full line? I mean I dont want to use:               echo -ne '\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b'      ...etc... to delete a long line..


title: How to create reverse-lookup file for BIND that points to some networks?

text: I am try to create a reverse-lookup file in BIND, but I need it to point to many networks not just one. I have three networks that connected to the same bind server, `192.168.3` and `192.168.4` and `192.168.1`. I would like that in one reverse-lookup file I could refer to all of the clients at the three networks. Currently I have no idea on how to write that zone file, what I have is:               168.192.in-addr.arpa. SOA dns1.mynetwork.unix admin.mynetwork.unix     1.4.168.192 IN PTR  dns1.mynetwork.unix      11.3  IN PTR client.mynetwork.unix      When I start the bind server, it gives me an error message on the log file at `/var/log/messeges/` that says: `loading from master file named.168.192 faild: not a valid number` I have omitted the other unrelated (IMO) stuff from the configuration file. To sum it up, i would concise the question to be, is it possible to create a reverse dns file (in bind) that can point to a different networks ? if yes what do i need to change in the example above ?


title: Creating Menu list and Executing the Task

text: I was given the the Task to create a menu in Linux but it appears it's not coming out great. When I select something I want to be able to perform that task then go back to the main menu when I finish.               #!/bin/bash          PS3='What do you want to do day: '     options=("Create Group" "Delete Group" "Create User 3" "Delete User" "Quit")     select opt in "${options[@]}"     do         case $opt in             "Create Group")                 echo "You chose Create Group 1"                 ;;             "Delete Group")                 echo "You chose to Delete Group"                 ;;             "Create User")                 echo "You chose to Create User"                 ;;             "Delete User")                 echo "You choose to Delete User"                 ;;             "Quit")                 break                 ;;             *) echo invalid option;;         esac     done


title: python == python2 OR python == python3 ? How to package, distribute python py2k scripts?

text: Depending on system, `python`==`python2` or `python`==`python3`. Executable Python scripts, starts with:               #!/usr/bin/env python     #!/usr/bin/env python2     #!/usr/bin/env python3...      For python py3k it is provided in documentation I should/can use it with version number, so I do this:               #!/usr/bin/env python3      But I've found a problem with py2k scripts. While in py2k documentation it is written to use : `#! /usr/bin/env python` , on some *nix-es python py3k is default, so python==python3. (For example ArchLinux python package , here python package files). **How to package (configure,make) and/or prepare python scripts for distribution to handle that ?** _I ask about making software packages that can be run easily by users (without modyfing their environment)_ Can I do the same trick for python py2k scripts as for python py3k scripts and set it as : `#!/usr/bin/env python2` ? Can I be sure that each python py2k distribution contains `python2` file, so `#!/usr/bin/env python2` will work ? If yes, why it is not proposed as standard, for example in python py2k documentation ?


title: Creating UDF image in Linux

text: It's embarrassing to imagine that there are no intelligent tools on Linux to create UDF images, similar to `makeisofs`, but I have yet to find any. The tool `genisoimage` does work for creating video disk images, but there is no equivalent for general data. Is the Linux toolset really so deficient when it comes to optical disc tools? I've already seen this and the accepted answer simply isn't sufficient.


title: Why mkdir -p /Local/Foo/Bar/Wah not work but cd /Local and mkdir -p Foo/Bar/Wah works?

text: I am trying to create a local folder in my local development machine, on Mac OS X Mountain Lion, so I did:               sudo mkdir /Local     sudo chmod 777 /Local     mkdir -p /Local/Foo/Bar/Wah      (note that last line has no `sudo`) but the last line gives an error:               $ mkdir –p /Local/Foo/Bar/Wah     mkdir: –p: File exists     mkdir: /Local/Foo/Bar: No such file or directory      Is it some sort of bug? I could instead do:               cd /Local     mkdir -p Foo/Bar/Wah      and it works. Why? And if it is for the reason that it tried to `mkdir /Local` first but can't because the superuser already did it, then won't this be a bug? (that it should just accept the fact that `/Local` is there and start mkdir from `Foo` and go down to `Bar` and `Wah`).


title: How to debug ~/.forward

text: How can I debug `~/.forward` file or see errors logged by mail agent on it **without root privileges**? I'm trying to process my mail with procmail. When I invoke procmail manually with               procmail < testMailFile      it works as expected (my procmail rule logs input to a file). When no ~/.forward file is present all mail goes to my default mailbox /var/mail/$USER and ~/.procmailrc **is not processed**. When I create ~/.forward with:               "|exec /usr/bin/procmail || exit 75"      mail stops coming but `.procmailrc` **is still not processed**.               $ lsb_release -a|grep Desc     Description:    CentOS release 5.10 (Final)     $ rpm -q exim     exim-4.63-10.el5


title: Bash autocompletion for an environment variable holding a directory name

text: I'm using, among other things, bash 4.2.37 on Linux Mint 14. When I autocomplete the name of an environment variable by typing `Tab`, it expands to the name of the variable followed by a space. If the value of the variable happens to be a directory name, I want it to expand to the name of the variable followed by `/`. For example, if I type:               $ ls $HOM<tab>      it expands to:               $ ls $HOME _      where `_` marks the location of the cursor. The problem is that I then usually want to continue typing the name of some file or directory under my home directory, which means I have to type `backspace` and then `/`. So I _want_ the above to expand to:               $ ls $HOME/_      The same thing happens when I've typed the entire variable name; after `ls $HOME`, `tab` adds a space, and I want it to add a `/`. (And of course I don't want it to add a `/` if the variable's value is not a directory name.) Is there some way I can tell bash to behave the way I want, either via bash commands or by updating my `$HOME/.inputrc`? Note: I'm specifically looking for a way to make `tab` behave the way I want. Ways to achieve the same behavior with different keystrokes would be interesting, but would not answer my question. (I've disabled `/etc/profile.d/bash_completion.sh` on my system because it interacts poorly with `set -o nounset`. A quick experiment indicates that this is probably not relevant to my question.) Incidentally, tcsh does this: given an environment variable `$FOOBAR`, typing `$FOOBA<tab>` expands to `$FOOBAR/` if it refers to a directory, `$FOOBAR` (with a space) if it doesn't. No, that's not enough to persuade me to go back to tcsh. zsh does this as well.