Create .tar.gz from a directory omitting some subdirectories and add only new or changed files

I need to create a script, maybe `bash`, maybe just a `.sh` that checks for files changes on a root directory and sub-directories of the root, and adds to a new file. The tar.gz file name should have the creation date at the end (e.g. `monitor-17.06.2013.tar.gz`). I made this:               tar -zcvf /home/monitor.tar.gz /var/www/html/monitor --exclude /var/www/html/monitor/cache /var/www/html/monitor/log      and it works, but the directory `/var/www/html/monitor/log` isn't omitted, the file name doesn't contain the date, and this is missing the part that adds only new or changed files because I don't know how to do it. **EDIT: clarify a bit my needs** Ok, due to some comments by users here I'll try to leave exactly what I'm looking for.               Day1: 2013-06-15     Directory: /var/www/html/monitor     Backup File Created: monitor-2013-06-15.tar.gz (contains all the content of /monitor folder)          Day2: 2013-06-16     Directory: /var/www/html/monitor     Files Changed:        /var/www/html/monitor/file1.php       /var/www/html/monitor/log/file2.php       /var/www/html/monitor/web/file3.php          Files Added:        /var/www/html/monitor/index.php     Backup File Created: monitor-2013-06-16.tar.gz (contains **only** the files index.php, file1.php, file2.php and file3.php)          Day3: 2013-06-17     Directory: /var/www/html/monitor     Files Changed:        /var/www/html/monitor/index.php     Backup File Created: monitor-2013-06-17.tar.gz (contains **only** the file index.php)      The first backup always will have all the content but the rest should only have the modified files and the newest files, nothing else.


How do I run chromium inside a chroot?

Okay, I can run Iceweasel 17 ESR fine and some simple X apps like xkill, so I know that it's not merely an X display problem. However any version of Chromium and Iceweasel 24 fail with the following errors respectively:               mikoto@localhost:~$ chromium      [12031:12031:1010/111246:FATAL:zygote_host_impl_linux.cc(73)] Check failed: PathService::Get(base::FILE_EXE, &chrome_path).      Aborted     mikoto@localhost:~$ iceweasel      (process:12035): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed      I'm using the standard Debian chroot environment produced by `sudo debootstrap --variant=minbase --arch=i386 unstable chroot` on a x86-64 system without any 32-bit compatibility libs installed. I can't run wine or the Google Android SDK directly on my base system, but I've extracted some of the tools into my 32-bit chroot and they run fine. Note that the Iceweasel 24 error message above appears to be non-fatal since I can find that line even when running Iceweasel 24 successfully on my base system. By "non-fatal", I mean the error message, despite the ominous "CRITICAL" tag, most likely doesn't provide a clue as to why Iceweasel 24 won't run. This is confirmed by the few hours of web searching I spent using the error message as a keyword. So, besides spitting out this error message, Iceweasel 24 fails silently. I'm posing this as a chromium question since I suspect anything that fixes the Chromium startup failure will also fix Iceweasel 24.


Which folder should I write to for my intermediate files, as a dev?

I'm starting to write a few bash scripts for my project and they need some intermediate files or variables to be written. I want to know which folders can I be sure of having access to when someone runs my script? Is it a common practice to use `/tmp/` ? Or should I used something else?


DU: only show folders at depth

I'm getting output from `du -h` like the following:               103M    ./.wine/drive_c/windows/mono/mono-2.0/lib/mono     103M    ./.wine/drive_c/windows/mono/mono-2.0/lib     129M    ./.wine/drive_c/windows/mono/mono-2.0     129M    ./.wine/drive_c/windows/mono     362M    ./.wine/drive_c/windows     545M    ./.wine/drive_c      I'd like to only show the most actionable folder, which is the folder `./.wine/drive_c/windows/mono/mono-2.0/lib/mono` Is there any way of removing the parent folder if a child folder is responsible for most of the disk space usage? A setting to only show leaf folders might do the trick, or a setting to subtract the size of all subfolders from a parent folder when calculating the size of the parent folder.


What does kill 0 do actually?

In the `man page`, it says:               kill [ -s signal | -p ] [ -a ] [ -- ] pid ...      pid... Specify the list of processes that kill should signal.  Each pid can be one of five things:               0      All processes in the current process group are signaled      And I tried like this in bash:               $ man kill &     [1] 15247     $     [1]+  Stopped                 man kill     $ kill 0     $ ps     15247 pts/41   00:00:00 man      Here `0` is used as `pid`. As I understood, `kill 0` will kill all processes in the current process, which includes `pid15247`. However, it didn't do anything in this example. Does anyone have ideas about how to use it?


Linux Operating system recovery after abnormal termination

How does the operating system (Linux) while rebooting checks whether abnormal termination happened during last shutdown and then does the file system consistent checks etc if required ?


How can I downgrade gcc 4.6.3 to 4.4.3?

I have gcc-4.6.3 installed in my PC.but for my project I need gcc-4.4.3 version. I do not mind removing gcc-4.6.3 but I badly need gcc-4.4.3. How can I downgrade? or how can I keep two gcc and make gcc-4.4.3 as primary GCC.?


Prevent SSH client passing TERM environment variable to server?

I'm currently using Fedora 18 gnome-terminal, then started `tmux` multiplexer in it. After I connected to a CentOS 5 server via `ssh` command, I find:   * `ls` result has no color   * `tmux`, `screen`, `hexedit`, `htop` all failed to start with error message like:  > open terminal failed: missing or unsuitable terminal: screen-256color It seems that `ssh` passes the $TERM environment variable to the server, but I can't find it in `/etc/ssh/ssh_config` file of Fedora 18. Although I can manually change the $TERM variable on the server, each time I connect, it happens again. So how to prevent it?


How to rsync only new files

I am trying to set up rsync to syncronize my main web server to the remote server by adding newly generated file to the later. Here is the command that I use:               rsync -avh --update -e "ssh -i /path/to/thishost-rsync-key" remoteuser@remotehost:/foo/bar /foo/bar      But it seems that the web server actually transfers all files despite the '-- update' flag. I have tried different flag combinations (e.g omitting '-a' and using'-uv' instead) but none helped. So wondering how can I modify the rsync command to send out only newly added files. Thanks


Installing 12.04LTS Server on a Fake RAID10

**Scenario** Install Ubuntu 12.04LTS Server on a RAID10 with boot on a RAID1.   * 4 - 2Tb SATA Hard Drives   * 3 Partitions (`/boot`, `/`, and `swap`)   * boot (256Mb from each disk) setup in RAID1 `/dev/md0`     * partition is ext2 `/dev/md0p1` **should be where boot is loaded**   * swap and root partition (remaining disk space) setup in RAID10 `/dev/md1`     * swap partition - 8Gb partition of RAID10, linux-swap `/dev/md1p1`     * root partition - remaining space of RAID10 - GPT partition table, ext2 `/dev/md1p2` We've setup our disks and RAID configurations using mdadm, fdisk, and parted while running the Ubuntu 12.04LTS Server Trial from a thumb-drive. Installation fails at grub. I can't get past this. On one machine it fails at grub-dummy-install, and on the other it simply fails with grub. The latter of the machines has completed installation but asks to install bootloader at different location or not at all. Installer becomes unresponsive though if you choose "install at different location". **Goal** We want the OS loaded on the RAID10 but we want to make sure that if **any** drive fails the machine can still boot from `/boot` and find the OS on the RAID10. **What We Know** The alternative installer supports RAID10 configuration at installation, but does it achieve our goal without taking the same process in setting up the disks? We know we should see our RAIDs in `/dev/mapper/{array-name}` but we don't, we only see `control`. This info I've gathered from this previous question We followed instructions we've found here and here **What We Don't Know**   1. Is there a better way to do this and still achieve our goal?   2. Why we're not seeing our disks in `/dev/mapper/`   3. Most importantly: Why we can't install the boot-loader to our `/boot` partition, namely `/dev/md0p1` at installation.


beagleboard com and HDMI dispaly

I've installed Ubuntu 11.10,lkde and gem on my BB and I connect to it through serial com. when trying GUI application through the com (e.g. gedit) I get "display not found, though a monitor is connected to the HDMI output. Is it possible to pass display from the serial terminal to the HDMI output?


Xmonad doesn't change workspace

I have just installed xmonad. I logged in, press `alt`+`shift`+`enter`, and got a xterm. (Pressed again to see windows tiling.) Typed in man xmonad, read, press `alt` `j`,`k` to switch between windows, ok, then press `alt` + `number`, and `alt` + `shift` + `number`... And it doesn't switch between workspaces... As it is the first time I execute xmonad, is there any key binding that I might check or fix ? Do I have to set a number of workspace, maybe it is set internally to 1. What can be the cause of my problem ?


How to add Puppy Linux to grub menu installed by Ubuntu?

I've been using Puppy Linux off a USB flash drive drive for a while, but that was really wearing it out. I decided to do a full install to the hard drive, so I cleared out some space, created an ext4 partition, and installed. Unfortunately, I can't figure out how to add it to the Grub menu that Ubuntu installed. I looked around the documentation for a while, then decided that, rather than risk screwing something up, I'd just ask for help. The output of `fdisk -l` is:               # fdisk -l          Disk /dev/sda: 160.0 GB, 160000000000 bytes     255 heads, 63 sectors/track, 19452 cylinders, total 312500000 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: 0xf475f475             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *          63   196527491    98263714+   7  HPFS/NTFS/exFAT     /dev/sda2       196528126   312498175    57985025    5  Extended     /dev/sda5       308310016   312498175     2094080   82  Linux swap     /dev/sda6       196528128   295727103    49599488   83  Linux     /dev/sda7       295729152   308307967     6289408   83  Linux          Partition table entries are not in disk order          Disk /dev/sdb: 4004 MB, 4004511744 bytes     255 heads, 32 sectors/track, 958 cylinders, total 7821312 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: 0x00000000             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *          32     7817279     3908624    b  W95 FAT32     # I have a Windows XP installation on `sda1`, an Ubuntu installation on `sda6`, and I've installed Puppy Linux on `sda7`. (Currently, I'm running Puppy Linux off of `sdb1`.) I'm not sure where Grub is, but I think it's either on `sda6`, with Ubuntu, or hiding somewhere in `sda`'s MBR. Not sure though. Basically, I need to find out how to add an entry to the Grub boot screen, with these options:               title Puppy Linux 5.4     root (hd0,6)     kernel /boot/vmlinuz root=/dev/sda7 pmedia=atahd I've already tried to puzzle it out, but I couldn't manage to pull it off. I just need step-by-step instructions. I will provide any other config files or Terminal outputs requested.


How to use as default nautilus in XFCE?

I'd like to use nautilus as default in XFCE instead of Thunar, but how can I remove full Thunar. I have already typed               sudo apt-get remove thunar gvfs-backends      But I still have problems because if I click on a folder in the desktop thunar start. Someone can help me? Thank you.


Exploding amount of Debian source code lines

According to the table at the Source lines of code article at Wikipedia, the amount of Debian source code lines rapidly grew to over 324m LoC (Lines of Code) in 2009:   * 2000: 55-59m   * 2002: 104m   * 2005: 215m   * 2007: 283m   * 2009: 324m On the other hand:   * Linux kernel 3.6: 15.9m   * Mac OS X 10.4: 86m   * Windows XP: 45m ### My Questions   1. Why did the LoC from the Debian source grow from 55m to over 300m in ~9 years?   2. Why is there such a big difference in size compared to other operating systems?   3. Describe the processes and criteria used by Debian to add software to the Debian archives.


Error with local created repository

This is the error I am getting frequently in CentOS, could somebody tell me why & how I can solve the issue.               [root@localhost ~]# yum install finger     Loaded plugins: refresh-packagekit, rhnplugin     Repository 'raze' is missing name in configuration, using id     This system is not registered with RHN.     RHN support will be disabled.     Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia.      Please verify its path and try again


sysrq-trigger doesn't accept parameter 'g'

I'm trying to debug the kernel. But I couldn't trigger kgdb with `echo g > /proc/sysrq-trigger`, it just prints help message. ![enter image description here](http://i.stack.imgur.com/ybmln.jpg) I have enabled kernel debugging, kgdb over serial, frame pointer etc.               CONFIG_DEBUG_KERNEL=y     CONFIG_FRAME_POINTER=y     CONFIG_HAVE_ARCH_KGDB=y     CONFIG_KGDB=y     CONFIG_KGDB_SERIAL_CONSOLE=y      What could be missing? The kernel version is 2.6.32.1, running CentOS 5 in KVM


How can fill characters in sed only

I have this file. I want to use only sed, no awk               FSDFDSFSD     FDSFD     FHGDHFDHGHFGHGHGF     HHGDF     GFDGDFGFDG     GFDGFDGFDGDFGDGD      I want to fill every odd line appended with 000 so that total characters are 30 in each line I want output like               FSDFDSFSD0000000000     FDSFD     FHGDHFDHGHFGHGHGF00     HHGDF     GFDGDFGFDG000000000     GFDGFDGFDGDFGDGD


Similar to solaries prstart -t command in linux

What is a similar command in Linux for the command from Solaris:               prstat -t      I am interested to get user vice resource consumption (i.e. memory and processor). It gives `NPROC UserName SWAP RSS Memory TimeCPU` Is there any scripts available to generate more or less similar output?


Touchscreen and mouse as separate inputs?

Can someone give me a good reference on how to achieve this, or just tell me how its done? Google isn't really helping me here, since it always tries to give me recommendations on touchpad :/


Process in user mode switch to kernel mode. Then the process will have root privileges?

According to http://www.linfo.org/kernel_mode.html in paragraph 7: > When a user process runs a portion of the kernel code via a system call, the > process temporarily becomes a kernel process and is in kernel mode. While in > kernel mode, the process will have root (i.e., administrative) privileges > and access to key system resources. The entire kernel, which is not a > process but a controller of processes, executes only in kernel mode. When > the kernel has satisfied the request by a process, it returns the process to > user mode. It is quit unclear to me about the line, > While in kernel mode, the process will have root (i.e., administrative) > privileges and access to key system resources. How come a userspace process running not as root will have root privilege? How does it differ from userspace process running as root?


Samba gvfs mount and symbolic link seems not to work

I have a server with samba shares and 2 HDs mounted that I use for backup. I have some symbolic links that work well between these 2 hard drives. When I mount the drives with gvfs (samba) I can't use the symbolic link. `ls` from the client:                $ls -al      drwx------ 1  users 0  4 mag 17.09 .      drwx------ 1 feboss users 0 13 dic 00.13 ..      drwx------ 1 feboss users 0 15 nov 00.14 FILM      drwx------ 1 feboss users 0 18 apr 22.49 foto      ?????????? ? ?      ?     ?            ? torrent      ?????????? ? ?      ?     ?            ? TV      `ls` from the server:               $ ls -al     total 8     drwxrwxrwx 2 nobody nogroup 4096 mag  4 17:09 .     drwxrwxrwx 9 feboss feboss  4096 dic 13 00:13 ..     lrwxrwxrwx 1 feboss feboss    14 nov  7  2013 FILM -> /mnt/3TB/FILM/     lrwxrwxrwx 1 feboss feboss    17 mag  4 17:09 foto -> /mnt/3TB/100D5100     lrwxrwxrwx 1 feboss feboss    25 nov 11  2013 torrent -> /mnt/2TB/TORRENT/complete     lrwxrwxrwx 1 feboss feboss    11 nov  7  2013 TV -> /mnt/2TB/TV      Can someone explain how I can fix this? Obviously, I can't make new symbolic link from the client. If I mount with cifs everything works well but it is not automatic like gvfs.


openSuse, linux, chmod to change link's permisions

I am trying to change the permissions for the link. I want the "Other" entity to have only the read permission, but when I run the command the permissions are not changing. Is there something I am not doing correctly, or there is a different way to change the permissions for the links.               linux-gn77:~ # ls -l /usr/bin/startup.sh     lrwxrwxrwx 1 root dev 31 May  3 20:33 /usr/bin/startup.sh -> /usr/lib   /tomcat7/bin/startup.sh     linux-gn77:~ # chmod 770 /usr/bin/startup.sh     linux-gn77:~ # ls -l /usr/bin/startup.sh     lrwxrwxrwx 1 root dev 31 May  3 20:33 /usr/bin/startup.sh -> /usr/lib/tomcat7/bin/startup.sh     linux-gn77:~ # chmod o=r /usr/bin/startup.sh     linux-gn77:~ # ls -l /usr/bin/startup.sh     lrwxrwxrwx 1 root dev 31 May  3 20:33 /usr/bin/startup.sh -> /usr/lib/tomcat7/bin/startup.sh     linux-gn77:~ # chmod o-r /usr/bin/startup.sh     linux-gn77:~ # ls -l /usr/bin/startup.sh     lrwxrwxrwx 1 root dev 31 May  3 20:33 /usr/bin/startup.sh -> /usr/lib/tomcat7/bin/startup.sh      Please, let me know how can this be achieved. Thanks


Adjusting the width of the grip for an Openbox theme

I'm trying to recreate the Blackbox Gray theme for Openbox. However, the size of the grips is smaller in Openbox compared to Blackbox. Is there a setting somewhere that controls the size of the grips? Openbox: ![enter image description here](http://i.stack.imgur.com/TSUmy.png) Blackbox: ![enter image description here](http://i.stack.imgur.com/6iQr7.png)


file system not mounted should display it is not mounted

I need to check a particular file system is mounted or not . I know we can find out this from df -k.But here if a particular file system is not mounted, the error should display "cronshadow(file system-example) is not mounted ".I will give you an example output of df -k               Filesystem            kbytes    used   avail capacity  Mounted on     /dev/dsk/c0t0d0s0    4130982 1463894 2625779    36%    /     /proc                      0       0       0     0%    /proc     fd                         0       0       0     0%    /dev/fd     mnttab                     0       0       0     0%    /etc/mnttab          /dev/dsk/c2t3d0s0    2053605 1815547  176450    92%    /psa_shdw     mmr1asxx:/crnonshdw  106687632 92602932 14084700    87%    /crnonshdw      Here which file system i marked with asterisk is not mounted ,need to display amessage like ---"crnonshdw is not mounted"


How to log incoming icmp traffic?

I am watching my ip6table and observing an icmp packet arriving and getting dropped at the rate of 1 per second. I am trying to find out what that message is about. I tried using tcpdump (it is definitely not an echo since I explicitly allowed that):               tcpdump 'icmp[icmptype] != icmp-echo'          0 packets captured     0 packets received by filter     0 packets dropped by kernel      As can be seen, I am seeing nothing. I have also tried logging it with iptables without any success. Any ideas?


I'm looking for a free database package for Ubuntu

I need to operate a database for personal use. Now I'm using Ubuntu 14.04 LTS, as opposed to Windows operating system, I'm wondering if there's a dBase, Lotus123 or Access equivalent for Linux? Something simple like MS Works data base would be ideal. Can someone point me to a suitable package?


Configuring IPoD on Linux

I use Fedora 13 and very recently i brought a new Apple iPOD shuffle. I would like to know whether i can transfer music without using iTunes into my iPOD. I tried using gtkPOD and RhythmicBox, but thats is of no avail.


Upgrading CentOS web server

Have just taken over control of a CentOS 6.4 web server with Apache. My question is, to update the server software, is it a case of just using `yum update` and then `yum upgrade`? Server has been neglected until now so need to install new security patches etc, but I don't (obviously) want to risk losing clients' documents / sites. Brand new to CentOS so please excuse the 'noob' questions!


How can I trigger a script when a certain port becomes available for requests?

I want to trigger a script when port 3000 is opened by a process. The process is a Rails development server, and I just want to be notified when it finishes spinning up and port 3000 starts accepting requests.


Is the sticky bit not used in current file systems

Can I safely conclude that the sticky bit is not used in current file sysems and reuse the bit for my own purpose.


Bash autocomplete variables for other commands than cd

I have env variable `$SCRIPT`. Normaly I can use autocomplete               vim $SC<tab>      and completion works as expected. On some systems it does not work. I have bash completion loaded, but completion in these cases works only with directories (`cd $SCRIPT_DIREC<tab>` is working). Mostly I have problem with bash 4.2. What `shopt` can enable it? EDIT: I have compared my `shopt` settings with Bash 4.3 where it's working and Bash 4.2 (Ubuntu server 12.04) where is NOT working, there were few differences (most of them 4.3 specific), set the rest the same, but nothing worked.


Is it possible to log in in a host with an user created for programs like apache or postgreSQL?

I am wondering whether is it possible to log in in a computer with users like `www-data` or `postgres` as I do with my own user. Are some users "allowed to log in" while others not? Is there any difference between my own user and the ones created by programs like apache, postgres besides name? They got password?? As you may see I have lots of doubts, maybe you could recommend me some reading about this topic! The question born when I was trying to create a new group and add new users to that group in Ubuntu 11.04 via the gnome GUI. I was able to create a new group "test" but the system only allowed me to add my user to that group and not the other users in the system like the ones that appear in /etc/passwd (I was running the Add Users/Group GUI with sudo privileges).


mutliple default gateways for alias interfaces (SOLVED)

Alias interfaces defined in _/etc/network/interfaces_ cannot have multiple default gateways. Unfortunately I would like to use the same interface to access 2 differents nets, and I **need** to define 2 addresses and 2 gateways, on the same interface. This alias interface has to be on _eth1_ interface because _eth0_ is used on the local network. If I define only one gateway for the main _eth1_ interface, and manally do `route add default gw 1.2.3.4` for the alias _eth1:0_ it works. **But** I would like it to set up correctly at boot time **automatically**. This is my last trial _/etc/network/interfaces_ :               # The loopback network interface     auto lo     iface lo inet loopback          # The external network interface, address on university internal network     auto eth1     iface eth1 inet static         address 172.x.y.33         netmask 255.255.255.224         network 172.x.y.32         broadcast 172.x.y.63         # dns-* options are implemented by the resolvconf package, if installed         dns-nameservers x.x.x.x         dns-search mysite.org         # multiple gateways are not allowed, so I try to add them like that:         post-up route add default gw 172.x.y.62 metric 1         pre-down route del default gw 172.x.y.62          # external interface with external world IP address     auto eth1:0     iface eth1:0 inet static             address 1.2.3.1             netmask 255.255.255.128             network 1.2.3.0             broadcast 1.2.3.128         # dns on ensg dns             dns-nameservers x.x.x.x             dns-search mysite.org             # multiple gateways are not allowed, so I try to add them like that:         post-up route add default gw x.x.x.x metric 2         pre-down route del default gw x.x.x.x          # internal network for my cluster     auto eth0     iface eth0 inet static         address 10.1.1.1         netmask 255.255.255.0         network 10.1.1.0         broadcast 10.1.1.255         gateway 10.1.1.1         # dns-* options are implemented by the resolvconf package, if installed         dns-nameservers 10.1.1.1 127.0.0.1         dns-search cluster      But when I try to bring _up_ one interface I get:               root@server:~# ifconfig eth1:0 up     SIOCSIFFLAGS: Cannot assign requested address      I cannot find a further solution on my own, does anyone have an idea? Thanks, best regards. SOLUTION: I have finally solved it like that:               # The primary network interface     auto eth1     iface eth1 inet static             address a.b.c.1             netmask 255.255.255.128             network a.b.c.0             broadcast a.b.c.128             # this is the interface with the default gateway!             gateway a.b.c.126              dns-nameservers a.d.e.f             dns-search mysite.org          auto eth1:0     iface eth1:0 inet static         address 172.x.y.33         netmask 255.255.255.224         network 172.x.y.32         broadcast 172.x.y.63         # multiple gateways are not allowed, so we do it like that         post-up route add -net 172.x.y.32 netmask 255.255.255.224 gw 172.x.y.62         pre-down route del -net 172.x.y.32 netmask 255.255.255.224 gw 172.x.y.62                    auto eth0     iface eth0 inet static         address 10.1.1.1         netmask 255.255.255.0         network 10.1.1.0         broadcast 10.1.1.255         # dns-* options are implemented by the resolvconf package, if installed         dns-nameservers 10.1.1.1 127.0.0.1         dns-search cluster


How to zip individual files from different directories in one line?

I want to zip numerous files from different directories(paths) in one line. How can I do that?


Shell script- syntax error: unexpected end of file

I'm practicing some scripts from a book and I keep getting an unexpected end- of-file syntax error. The images below show the error message and the script that uses basic commands to create a system-information html file. The second set of images show my attempt to comment out the problematic lines and run it. In the top part I have three functions that use here-documents to generate html tags, I'm using the '<<-' switch to allow me to indent the tags for readability. My issue is that the error I mentioned keeps popping up. If I change it to 'echo' commands it works just fine, the weird part is I have a here-document at the bottom of the script, outside of a function and that works just fine if I comment out the three functions. What I am I doing wrong? ![dual terminal view: error message and script file](http://i.stack.imgur.com/UdBmJ.png) ![working shoot of script with commented out functions](http://i.stack.imgur.com/LMJLt.png)


Set tmux status line color based on hostname

I'd like `tmux` to pick a color dynamically based on the hostname of the machine. Since I share my `tmux.conf` across several machines, assigning an unique color for each of those hosts would be handy visually, especially when working on more than one of the simultaneously. Is this doable?


System often freezes without warning

The system often just freezes up without any warning, it doesn't gradually start getting slower or something like that, and every time I look the avarage system load is below 20% (usually not even 10%).   When looking at `dmesg`, there's one thing that always seems to come back though. The message `composite sync not supported`. These freezes are getiing **indredibly annoying** as I always lose all my work I haven't saved yet, and the last time it froze up happened **while** I was saving something (I don't think I need to tell you that that file was gone).   Can annyone give me any pointers (and hopefully solutions as well), to where this problem lies? If you've found something that might be the cause, but you don't know how to fix it, just put it in the comments, please. That way I can do a bit of research myself maybe. * * * Dmesg: http://pastebin.com/ZeiULvSK   ... And I thought there was a `kernel.log` file in `/var/log`, but apparently I was wrong. * * * More recent `dmesg`: http://pastebin.com/CXETguti   This is the output taken right after closing VVVVVV (a game).   I found out 2 things today that both point to the same thing... The `dmesg` is full of **Nouveau** errors, and games lag like hell, and some don't start at all. The conclusion is that **it refuses to use the NVidia drivers**.   Help on getting them to work would be nice as well. More info on that: http://askubuntu.com/a/83995/18953 * * * When adding `nomodeset` to my kernel line in GRUB I'm stuck with a small screen resolution, limited amount of colours (gradients look like crap), the screen becomes laggy, but the errors don't crop up anymore in `dmesg`. I've experienced no freezes with this parameter added, but I haven't worked longer than 10 minutes with `nomodeset` because making mindmaps on a small resolution is annoying.   My graphic card is an NVidia Quadro NVS 110M.               robin@robin-Latitude-D620:~$ lspci | grep -i vga     01:00.0 VGA compatible controller: nVidia Corporation G72M [Quadro NVS 110M/GeForce Go 7300] (rev a1)     robin@robin-Latitude-D620:~$ sudo lshw -class display     [sudo] password for robin:        *-display                           description: VGA compatible controller            product: G72M [Quadro NVS 110M/GeForce Go 7300]            vendor: nVidia Corporation            physical id: 0            bus info: pci@0000:01:00.0            version: a1            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress vga_controller bus_master cap_list rom            configuration: driver=nouveau latency=0            resources: irq:16 memory:ed000000-edffffff memory:d0000000-dfffffff memory:ee000000-eeffffff memory:ef000000-ef01ffff      * * * **What I did to install the NVidia drivers**   Installed `nvidia-current` with Jockey, removed it again (had to try 2 times, first time failed), added a PPA for a newer version, installed `nvidia- current` again (this time with the terminal), rebooted.


"Safe mode" on Linux?

Under RouterOS/Cisco there is a function called "safe mode". When someone presses CTRL+X then the terminal goes in "safe-mode" that meant that if the terminal exists in a "bad way", ex.: the user locks out himself with a bad firewall policy, etc. then the configurations will be restored for the point before the safe mode started. If the terminal in the safe-mode exists okay, like ex.: the user gives out the "exit" command, then all the configuration modifications are going to be permanent. Are there any great functions like this "safe mode" under any Linux?


print output to 3 separate columns

MYPATH=/var/www/html/error_logs/     TOTALFILE=$(ls $MYPATH* | wc -l)     FILETIME=$(stat --format=%y $MYPATH* | head -5 | cut -d'.' -f1)       FILE=$(ls -1tcr $MYPATH* | head -5 | rev | cut -d/ -f1 | rev)     TOPLINE=$(head -1 $MYPATH* | grep -Po '".*?"' | head -5)      how can i elegantly print this out 5 files information into columns with headers?               FILE CREATED TIME   | FILE NAME        | ERROR HEADER     ---------------------------------------------     $FILETIME           | $FILE            | $TOPLINE     2012-11-29 11:27:45 | 684939947465     | "SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"      and so on 5 files `total files: $TOTALFILE` is there any easy way to get what i want? **note: this output i got when echo every variable**               2012-11-29 11:27:45 2012-11-29 11:27:41 2012-11-28 23:33:01 2012-11-26 10:23:37 2012-11-19 22:49:36     684939947465 1313307654813 1311411049509 1234980770182 354797376843     "SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)" "SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)" "Connection to localhost:6379 failed: Connection refused (111)" "An error occurred connecting to Redis." "SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"


parrot VM on linux

Any Linux distros or applications that mainly use/run on parrot vm? I"m asking because in windows, there is .NET and libraries written in C#, F#, VB will work together. parrot can do the same. (Correct me if I'm wrong) So why aren't Linux application development using this? Won't it be better if there's some kind of unified development model/platform?


Chat source code

Source code of chat program (used for dialog with modem) is open? If it is so, where I can find it? I'm try find it, but no success.


root@server # tar fcz bkup.tar.gz /home/foo/     tar: Removing leading `/' from member names      How can I solve this problem and keep the `/` on file names ?


Stuck installing TexLive from scratch on Debian KDE!

I'm trying to install TexLive 2013 on my Debian 7.3 kde desktop from scratch. I've read these guides (1 & 2) but instead of getting the perltk installer's GUI, I get the txt mode installer which I don't like because I don't know how to move around with it. I don't want the +3.2 GB installation, only some packages and I want to have the GUI that gives me better control over the different packages I need from time to time. So far this is what I've done   1. `wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz`   2. `tar -xvzf install-tl-unx.tar.gz`   3. `cd install-tl-20140123/`   4. `./install-tl -gui perltk` The last command was given as root AFTER installing the `perl-tk` package from the repos (v. 1:804.030-1). However I get this back from the command line:               root@aliquis:/home/guest/install-tl-20140123# ./install-tl -gui perltk     No protocol specified     perl/Tk unusable, cannot create main window.     Error message from creating MainWindow:     couldn't connect to display ":0" at /usr/lib/perl5/Tk/MainWindow.pm line  53.     Tk::MainWindow->new() at ./install-tl line 339          Continuing in text mode...      What is wrong with `perl-tk`? Do I have to install some additional packages?


ldconfig not finding libprotobuf.so

I am attempting to install the protobuf library on a Redhat system (Amazon EC2's Linux build). I ran `configure`, `make`, and `make install` without a problem, and the `.so` libraries were copied over to `/usr/local/lib`. Since Redhat doesn't include the `/usr/local/lib` directory in `/etc/ld.so.conf`, I added it, and then ran `ldconfig` to update the linkages. My problem is that, for whatever reason, `ldconfig` isn't picking up `libprotobuf.so`, even though it is in the `/usr/local/lib` directory. Here is the output of `ls -l /usr/local/lib`:               total 61336     -rw-r--r-- 1 root root 17654940 Mar 26 02:39 libprotobuf.a     -rwxr-xr-x 1 root root      994 Mar 26 02:39 libprotobuf.la     -rw-r--r-- 1 root root  1948106 Mar 26 02:39 libprotobuf-lite.a     -rwxr-xr-x 1 root root     1029 Mar 26 02:39 libprotobuf-lite.la     lrwxrwxrwx 1 root root       25 Mar 26 02:39 libprotobuf-lite.so -> libprotobuf-lite.so.7.0.0     lrwxrwxrwx 1 root root       25 Mar 26 02:39 libprotobuf-lite.so.7 -> libprotobuf-lite.so.7.0.0     -rwxr-xr-x 1 root root   893083 Mar 26 02:39 libprotobuf-lite.so.7.0.0     lrwxrwxrwx 1 root root       20 Mar 26 02:39 libprotobuf.so -> libprotobuf.so.7.0.0     lrwxrwxrwx 1 root root       20 Mar 26 02:39 libprotobuf.so.7 -> libprotobuf.so.7.0.0     -rwxr-xr-x 1 root root  7326093 Mar 26 02:39 libprotobuf.so.7.0.0     -rw-r--r-- 1 root root 25883264 Mar 26 02:39 libprotoc.a     -rwxr-xr-x 1 root root     1010 Mar 26 02:39 libprotoc.la     lrwxrwxrwx 1 root root       18 Mar 26 02:39 libprotoc.so -> libprotoc.so.7.0.0     lrwxrwxrwx 1 root root       18 Mar 26 02:39 libprotoc.so.7 -> libprotoc.so.7.0.0     -rwxr-xr-x 1 root root  9071740 Mar 26 02:39 libprotoc.so.7.0.0     drwxr-xr-x 2 root root     4096 Mar 26 02:39 pkgconfig      Here is the output of `ldconfig -v | grep protobuf`:               libprotobuf.so.7 -> libprotobuf.so.7.0.0     libprotobuf-lite.so.7 -> libprotobuf-lite.so.7.0.0      What do I have to do to get `libprotobuf` recognized by the linker? **Edit** : When I try to link the library directly, I get this error:               ldconfig: Ignored file /usr/local/lib/libprotobuf.so since it is not a regular file.      I tried copying `libprotobuf.so.7.0.0` over `libprotobuf.so` so that it is no longer a symlink, which fixed the error, but my linker still can't find `libprotobuf`.


Window Manager / Desktop Environment Testbed

It is quite difficult to get a profound overview of the available desktop environments and window managers. To experience their look and feel in action without the hassle of permanently altering my existing system, I am currently searching for a way to try out most of the major ones without permanently installing them. When using Live CDs, this poses quite a hassle, because normally, the Live Medium of one distribution (or spin) only includes one Desktop Setup. So one would have to burn a new CD for each test. Is there a distribution that ships a live medium providing many desktop environments? My ideal compilation would contain most of the following.   * GNOME Shell   * Unitiy   * KDE   * Razor-qt   * Cinnamon   * MATE   * LXDE   * Xfce   * Enlightenment   * one of fluxbox, openbox or blackbox   * a tiling window manager


Iptables - modprobe: FATAL - Fail2ban random restarts

I have been running fail2ban on my server for a while without any problems but have recently seen fail2ban restart randomly. After some looking in my logs I noticed that the restarts occur when ever someone gets banned. So every time someone gets banned the fail2ban server restarts. Here are a couple of logs.               2012-03-23 00:58:39,025 fail2ban.actions: WARNING [dovecot] Ban xx.xx.xx.xx (ip removed)      What I have been able to find out is that the fail2ban bans the IP and then it restarts and the only error I can find is.               2012-03-23 00:58:39,025 modprobe: FATAL: Module ip_tables not found.      Iptables is present and running - and I can issue any commands without iptables failing or fail2ban crashing. Please let me know if you have any idea and if you would need the fail2ban config files Edit: I have been able to narrow it down to this iptables rule causing the errors:               iptables -I INPUT -p tcp -m multiport --dports 110,995,143,993 -j fail2ban-Dovecot      Why would this multiport rule cause this error?               2012-03-23 00:58:39,025 modprobe: FATAL: Module ip_tables not found.      System Information: Centos 5.8 Fail2ban 0.8.2 Iptables 1.3.5


How to run a command while logging output to a file?

I have a console application that needs to be run as part of the deployment of a new application version on my server. This console application is designed to output to the console, and cannot be changed. I'd like to run it as normal, but have stdout and stderr logged to a file at the same time they're output to the console. How can I do that on Linux?


How to disable a daemon process on RHEL 6.3 like SMF does on Solaris

This problem has been bugging me for a while, we have a program running on Solaris, which managed as a service well by SMF, can be enabled/disabled very easily. Now, according to our market, we would like to migrate this service to RHEL 6.3, so we are trying to use Upstart to manage it and make it have the same behaviors like what it does on Solaris. Most of behaviors are good and fulfill our requirements, but when we stop the service, it still was started automatically on startup, this is not what we want. We want to make it be stopped no matter how many times we reboot or shutdown server after stopping the service. I read this article, Ubuntu12.04: How to disable a daemon process at startup, it says, this feature can be done by Upstart 1.3, but we are limited to use RHEL 6.3, which Upstart package version is 0.6.7, and the most important thing is, no upgrade for Upstart and cannot switch to other platform. :( So, my question is that: is there any alternative method to achieve my target but not change system and do not introduce any dependencies, and still, this service have to be managed by system, like SMF/Upstart/init.d. A little more requirement here, we still want to implement a feature that, if user kill the service process, system can detect this and try to start the process automatically with upper limit times, which can be specified as well. Reference for SMF: Introducing the Basics of Service Management Facility (SMF) on Oracle Solaris 11 Advanced Administration with the Service Management Facility (SMF) on Oracle Solaris 11


How do I create more /dev/tty entries and /dev/ptmx on boot up?

After building kernel 3.2.13 and installing via RPM on my system, I have this problem:   1. There is no /dev/ptmx which the rest of my system is expecting. There is actually a /dev/tty/ptmx device though. How do I get this linked or created on bootup?   2. On all of my other kernels ( 2.6.X ), there are 255 /dev/tty character devices. I cannot for the life of me figure out how to create more with my new kernel.  What actually makes the tty devices? I can create them myself or through some scripts, but is this something that should be done when the /dev is mounted? Can I somehow build this _into_ the kernel? I thought it was udev that was responsible for this, but I haven't modified udev and only when I boot into 3.2.13 do the entries not exist and I see nothing indicating that udev isn't working on the newer kernel. Please help!


generate links of pages with incrementing variable

consider the links > > http://unix.stackexchange.com/questions/tagged/linux?page=2&sort=newest&pagesize=15 > http://unix.stackexchange.com/questions/tagged/linux?page=3&sort=newest&pagesize=15 > http://unix.stackexchange.com/questions/tagged/linux?page=4&sort=newest&pagesize=15 here 'page' is incrementing, if there are 115 pages then the value of page will be 115 for the last page How to know which part of the link is incrementing by processing 2 sample links? I need to generate all 115 links using shell script. The inputs will be 2 links of page 2 and page 3 and total number of pages. I am on bash shell, python is also possible


ip function exit code

I use use `ip` by `system("ip link set eth0 up")` in a C program. I know that `system` returns `-1` if it fails and returns what the called function returns(exit). E.g., if eth0 is not exist on the system, it returns `256`. **Where can I find what these numerical values defined for`ip`?** For example `ifconfig`'s Return Codes:               Return Code Description     0    The command completed successfully.     4    The command completed successfully, but a warning condition was detected.     8    The command was not specified correctly.     12    An error was encountered.     16    An unexpected condition was encountered.


How to launch an application with default "terminal emulator" on Ubuntu?

I wanted to execute some command in terminal emulator, like Konsole, but I need to make this cross-desktop. Is there some command like `xdg-open`, but for getting the default terminal emulator? I'm using Ubuntu.


Linux: LUKS and multiple hard drives

I have a Debian Linux system (amd64) installed on a RAID-1 system encrypted device (LVM on LUKS) and will have a RAID-6 of >=4 disks where I'll put my data (LUKS and maybe LVM). I think the basic idea is to unlock the system encrypted partition (at boot at local or via ssh) and to store a keyfile in /etc/crypttab for the RAID-6 encrypted partition. Does that pose a security risk ? I mean ... it's pretty useless if anybody can just enter my system locally / remotely and I think there are plenty of services running on servers that are vulnerable to "rooting" (e.g. SSH). Is there an alternative (beside unlocking the partition via SSH which may be a problem since e.g. backup operations start even before the data partition is mounted). On another machine I'll use multiple disks with LUKS+greyhole (no RAID-6) for Backups and it'll be a real pain to unlock 10 disks by enterning 10 times the same password ...


Variable name from command output

I have some string, and want to split on colon ":" assigning on variable with name from left part and value from right part. For example: `echo "Title: Some title" | sed 's/:.*//'` gives me wanted variable name "Title", and: `echo "Title: Some title" | sed 's/.*: //'` gives me the value "Some title". My problem is how to assign variable named "Title" by the output of above command. I can assign the value like `$(echo "Title: Some title" | sed 's/.*: //)` but can't find how to assign the name


How to stop Vim from changing my directory when executing a makefile?

OK, I posted this question before I knew the extent of what was happening. Suppose I have a mix of Python and C++ code. I use a simple makefile which copies the files from my editing directory to where they are compiled (with a separate makefile.               my_stuff:             cp source.c source.h /some/other/dir             pushd /some/other/dir; make && su -c "make install"; popd      Originally I was editing source.c, running :make, and then a new buffer opened in my current window (replacing source.c) with /some/other/dir/source.h. I then tried this again while editing some_python.py and running :make and yet again it opened /some/other/dir/source.h. Can anyone explain this? Am I going crazy? * * * Hello all, I am having this annoying issue with Vim. I like the fact that I can be editing a file and then type :make to automatically execute a Makefile in the same directory. However, Vim is changing my directory after it is executed. For example, if my source file is /some/dir/source.c and it needs to be compiled in /some/dir/library/, my makefile first copies the file to the library folder and then executes another makefile.               move_files:         cp /some/dir/source.c /some/dir/library/         pushd /some/dir/libary/; make && su -c "make install"; popd      The problem happens after compilation finishes. If I launch vim as 'vim /some/dir/source.c' and then use :make, when the compile finishes I am looking at '/some/dir/libary/source.c'. I would like to be looking at the file in the original location. Does this make sense? What can I do to disable this behavior? Thanks! **UPDATE** I was mistaken before -- when the make completes, a new buffer is opened in my window which has the copied header file (even if I was editing the .c before the compile). So I open /some/dir/source.c, then do :make, then in my current window a new buffer is opened with /some/dir/library/source.h. Weird? The original buffer is still open, but I need to switch back to it since its now in the background.


Updating a driver quirk in kernel

Os : Debian 6 Kernel Version : 2.6.32 I have been recently working with Linux application and now we have some little hard-disk issues where my motherboard doesn't support AHCI through bios. On various Google searches i found that i can force Linux kernel force load driver to AHCI mode. i have just now started my kernel walk through and i am very new for handling issues. THS IS THE QUIRK WHICH I FOUND WILL WORK : http://tartarus.org/~ds/quirk-ich- force-ahci.patch I download the kernel and its respective headers and did a complete kernel build.since its Debian updated it in the client machine and found it was working as expected                 linux-image-2.6.32_2.6.32-2_i386.deb -- 26MB       linux-firmware-image_2.6.32-2_all.deb -- 5k      but now i need to apply the patch in all my client machines which i located n remote locations where 26 mb in the network is very high Is there a way where only this quirk can be updated in client in a reduce size like some KO file update. Is this the only way way to update the driver?? need some guidelines on the same. i also saw : http://www.cyberciti.biz/faq/add-remove-list-linux-kernel- modules/ in my case can someone guide me with some pointers how this has to be done Please guide


Custom X application RCNG startup script woes

I am attempting to build a FreeBSD + XBMC based media box. Everything is all working fine except for one point. I need to boot XBMC as an RCNG startup script, which is all fine, except: If the command to start X and XBMC is run in the foreground all works fine. If it is pushed to the background (with &) it starts to work then is kicked out (I think) by getty starting. Is there some way of stopping getty from killing X, or am I barking up completely the wrong tree? * * * # rcng script:               #!/bin/sh     #     # $FreeBSD$     #     # PROVIDE: xbmc     # REQUIRE: sshd     # KEYWORD: shutdown     #     # Add the following line to /etc/rc.conf to enable xbmc:     #     # xbmc_enable="YES"     #     # You will also need to fill in the xbmc_flags="" variable to suit your configuration.     #          xbmc_enable=${xbmc_enable:-"NO"}     xbmc_flags=${xbmc_flags:-""}          . /etc/rc.subr          name=xbmc     rcvar=`set_rcvar`     #required_files="/usr/local/etc/xbmc.conf"          xbmc_start() {             PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin             HOME=/root             /usr/local/bin/xinit /usr/local/bin/xbmc       # adding & makes it all fail     }          start_cmd=xbmc_start          #command=/usr/local/bin/xbmcboot          load_rc_config $name     run_rc_command "$1"      * * * One more note - when it does kick it out the screen is screwed. It shows me the first bit of the X.Org startup messages and that's all. No login, no control over it, no ability to start X again even remotely. * * * I have now turned off ttyv2 and upwards in the /etc/ttys - it has stopped the screen from locking up when it kicks out Xorg (gives me a normal getty prompt), but it still kicks it out. So it's deffinately getty / init related. * * * Ok, I am 100% convinced it's to do with getty starting up. If I put the commands to start the x session in a script with a _sleep 5_ in it so the X session doesn't actually start until after getty has started running it all works fine. While I can live with this for now, it would be nice to understand why it behaves like this and maybe get it to start up more friendly.


SpamAssassin Under Linux VPS

I am getting bald with this guys: On a Linux VPS (CentOS), I have setup a mail server (Exim+Dovecot+Clamav+SpamAssassin) but scanning mail for spam using SpamAssassin is proving to be a challenge. I am not a Linux expert, especially when it comes to challenges associated with VPS, but I can pretty much RTFM and succeed. This one is beating me: On my FreeBSD servers, I can easily get the desired results:               (15:59:00 <~>) 0 $ sockstat -l | grep 783     root     perl       83997 5  tcp4   127.0.0.1:783         *:*     root     perl       83996 5  tcp4   127.0.0.1:783         *:*     root     perl       10281 5  tcp4   127.0.0.1:783         *:*          (15:57:21 <~>) 0 $ telnet 127.0.0.1 783     Trying 127.0.0.1...     Connected to localhost.     Escape character is '^]'.     CONT     SPAMD/1.0 76 Bad header line: CONT     Connection closed by foreign host.`      However, on the Linux VPS when I run the same test, it just hangs there ... nothing responds on the port, even though I can see spamd listening on 783:               [root@vps exim]# netstat -anp | grep 783     tcp   0   0  127.0.0.1:783   0.0.0.0:*   LISTEN   21602/spamd.pid      If any of you runs their servers on VPSes and are able to communicate with spamd, please tell me where to look. Af it might help, I can connect to the POP3 port on this server from remote locations, BUT not from localhost (127.0.0.1)! Since spamd is set to listen on 127.0.0.1, I cannot test it from a remote server, and I don't intend to change it to listen on the public IP for test purposes. Could it be something I need to change on the Linux?


What aspects of Plan 9 have made their way into Unix?

Plan 9 was developed by Bell Labs as a successor to Unix. Although for various reasons it never quite materialized as such, a fair amount of development still went into Plan 9. My question is, what - if anything - from Plan 9 has made its way into modern Unix?


RHEL6 Compatibility Libraries and Development tools through RPM?

Is it possible to download the full RPM package for Compatibility Libraries and Development tools (RHEL6)? If so, where? I'd like to keep it as backup for emergencies.


With XenServer, how can I give a PV guest a display?

I have Xen running through XenServer 6.2. I created a PV Debian 7 guest using the built-in template, and chose to install the Gnome desktop environment. However, the guest only has a text console by default, so I can't start X. How can I add a virtual display to the device like I get with HVM guests?


Specify an alias as preferred editor in rc files (like .cvsrc)?

I have in my .cvsrc:               cvs -q -e vim      I want to create an alias (like my-vim or something like that):               alias my-vim="vim -S ~/myscript.vim"      And do               cvs -q -e my-vim      Unfortunately, this doesn't work. What do I have to do to make an alias work inside `cvs -e` parameter?


RHEL - Uuencode + mailx = gibberish

I understand `uuencode` is for encoding files, and `mailx` sends mail. However, I'm not exactly understanding...   1. Why `uuencode file file | mailx -s "subject" email_adress` keeps sending messages with the encoded content inside the email instead of as an attachment. (And how to go about fixing it...)   2. I have tried `echo | mailx -s "subject" -a <file> <email_address>` and seemed to get my files just fine. But does this mean I am without the protection of encoding or does `-a` give you that?   3. I've skimmed there may be better alternatives. Is this really the way to go? I am not particular fluent on the *nix side of things.... Is `mutt` a good place to start? Are there other suggestions? This is on RHEL 6.4, uuencode (GNU sharutils) 4.14 **Update** Does it matter that `mailx` version is Heirloom Mail version 12.4 7/29/08? Could the issue be a difference in behavior how `mailx` treats the `uuencode` output? Could it be a `mailrc` setting or some environment variable? Well, I found another post that seems to have more details on mail headers... I found it helps me understand this issue more, so I'm keeping a link here.


How do I configure PulseAudio for 7.1 Surround Sound over HDMI?

I have my machine connected over HDMI to a receiver. But when I try to use more than two channels with PulseAudio, I only get two. `pacmd list cards` shows the card, but does not show an HDMI profile with more than two channels. I have confirmed that 7.1 sound works via ALSA:               pasuspender -- speaker-test -D hdmi -c 8 -m FL,FC,FR,RR,RRC,RLC,RL,LFE      Produces static that goes around the room.


Apache "RSA server certificate CN does not match server name" error

I have an apache installation with some name-based vhosts and a SSL certficate with CN=`maindomain.com` and DNS Alternative Names for the all the vhosts (sub)domains. However, this setup gives warnings in the logs in the form:               [Fri Jan 03 16:52:38 2014] [warn] RSA server certificate CommonName (CN) `maindomain.com' does NOT match server name!?     [Fri Jan 03 16:52:38 2014] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)      While working, I should say that Name-based SSL vhosts are irrelevant because the certificate is for all vhosts. Furthermore I would say the CN matches the main ServerName. Is there any way to fix this and clear the logs? Distilled configuration is as follows:               Servername maindomain.com          <VirtualHost *:80>         ServerName www.maindomain.com         DocumentRoot /var/www/www.maindomain.com/public_html/     </VirtualHost>     <VirtualHost *:443>         ServerName www.maindomain.com         Include ssl.vhost.conf         DocumentRoot /var/www/www.maindomain.com/public_html/     </VirtualHost>          <VirtualHost *:80>         ServerName altdomain.com         DocumentRoot /var/www/altdomain.com/public_html/     </VirtualHost>     <VirtualHost *:443>         ServerName altdomain.com         Include ssl.vhost.conf         DocumentRoot /var/www/altdomain.com/public_html/     </VirtualHost>     # More vhosts in the same way, sometimes tld's sometimes subdomains      And `ssl.vhost.conf` as follows:               SSLEngine ON     SSLProtocol all -SSLv2     SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM          SSLCertificateFile      /etc/certificates/maindomain.com.crt     SSLCertificateKeyFile   /etc/certificates/maindomain.com.key     SSLCertificateChainFile /etc/certificates/ca-intermediate.crt     SSLCACertificateFile    /etc/certificates/ca.crt


Running du command reports infinity as disk usage

I'm trying to get the total size of what's stored in my home directory. To my surprise, it reports infinity after a few seconds:               /home/user $ du -sh .     Infinity      Huh? I'm pretty sure there are no recursive symlinks, but `du` should not follow symlinks anyways per default. I've also tried `du -shx .` so it won't cross device boundaries - with the same result. I'm pretty sure I don't have infinite disk space or disk usage. ;-) The target filesystem is a btrfs subvolume with no snapshots. `rsync` syncs this directory to an external disk just fine every night, it has no problem with this "infinity." However, `du` reports the same there. **Answers to comments:** There are no mount points within my home directory:               $ mount|grep home     /dev/sda3 on /home type btrfs (rw,relatime,compress=lzo,space_cache,autodefrag)      Using the full path instead of `.` as parameter shows the same behavior. There are no files bigger than 200GB:               $ sudo find -size +$((200*1024*1024)) | wc -l     0


Will this open up a non-standard port to ssh?

I am following tutorials on iptable and want to allow ssh traffic on my non- standard SSH port = YYY. I think this is how you do it, but want to double check so I don't lock myself out of my server. This will add a rule as part of an "input chain" (I'm not sure what that is). The rule will accept ssh traffic on port=YYY (by allowing tcp traffic on port=YYY). Right?               $sudo iptables -A INPUT -p tcp --dport YYY -j ACCEPT


How do I determine LVM mapping on a physical device?

I have a server (SUSE 11.5) that has two disks. There is only one volume group (vg01). How do I determine the physical device on which that vg exists?


setting up a local VoIP to use as a Wifi Headset

I had this idea of using Wi-fi in a vehicle to connect my cell to the car call handler.Just as it works with bluetooth nowadays. Just to demonstrate that such a thing is possible , i had three Linux computers play the roles of call components. **Linux 1:** the VoIP caller **Linux 2:** My cellphone **Linux 3:** My car's Head-unit Since this was just a demonstration i chose to use Wi-fi to establish the connection.It would make it easier to handle network related problems. The scenario is just like a simple telephony with a headset. There is a **user1** ( Linux 1) trying to call **user 2** ( Linux2). On this path it occurs a signaling event that lets my cell know there is a user ( linux 1 ) trying to call. I chose to use SIP protocol to do this signaling. There is a SIP User-Agent that can establish a peer-to-peer session using IPs which was perfect for my demonstration. So signaling Linux 2 was pretty easy, and a call was established. Now the challenge was to have the cellphone broadcast the incoming voice on head-unit's speakers, meaning when Linux 1 called **linux 2** a signal would be forwarded to the head-unit and connect **Linux 2** and **Linux 3** , But this time the difference was that the incoming voice from **Linux 1** had to flow through the cellphone and be forwarded to the headunit without cellphones Mic or speakers being used in any way, and have it play on car's speakers.And the outgoing voice traffic (from the user 3 in the car) should be recorded using Headunit's Microphones and be forwarded to the Linux 3( the voIP caller ) without using cellphones microphones or speakers in any way.( Just like headset connected to a cellphone) I needed some type of signaling strategy. Now from Literature to technique. Pjsua uses an IP and a port number to define a user. it means i call from a Linux 1 **( IP=192.168.1.1 UDPnumber=1111)** to a Linux 2 **( IP=192.168.1.2 UDPnumber=2222)** but after the invitation is acknowledged the incoming voice is played by Linux 2, however what we want is that it is played on Linux 3 **(IP=192.168.1.3 UDPnumber=3333)**. Now there might be some ways to do such a thing. Off the top of my head i could somehow broadcast what is being played on Linux 2 to Linux 3 using port forwarding, but i am not sure if it would work. Could anyone think of a way to bring the Linux 3 into the loop as well? I am so close to making this work.


Change directory for Kate syntax highlighting files

I'm running Standard Debian Wheezy with KDE 4.8.4 and Kate 3.8.4. The Kate text editor's syntax highlighting files are located in:               /usr/share/apps/katepart/syntax      If I run               kde4-config --prefix      this gives               /usr      and _$KDEDIR_ is empty. This results in that only XML files in the upper direcory are used for highlighting. In several other forums, I saw that it should work to create a folder "syntax" in               ~/.kde/share/apps/katepart/      If I put syntax-highlighting files there on my system, they appear to be ignored. How can someone change/set the directory for the syntax-highlighting files used by _Kate_ to an arbitrary directory?


Network via ieee1394 is unreachable (PC and laptop)

I decided to connect my PC to the laptop via firewire. All interfaces are up, but no packets can be send/recieved. I'm using Linux Slackware64-current (kernel 2.6.37.4) Laptop (Dell Vostro 3700) has this adapter:               root@trium:~# lspci | grep 1394     14:00.3 FireWire (IEEE 1394): Ricoh Co Ltd FireWire Host Controller (rev 01)      Old ieee1394 stack was removed in new kernels. thats why I use new:               root@trium:~# modprobe firewire-net     root@trium:~# lsmod | grep fire     firewire_net           12930  0      firewire_ohci          27301  0      firewire_core          51107  2 firewire_net,firewire_ohci      dmesg shows:               firewire_net: firewire0: IPv4 over FireWire on device 47203fc0434fc000     firewire_net: max_rec 0 out of range     firewire_core: refreshed device fw0      1st string is good, but the 2nd is strange for me. what does it mean? maybe it is the source of the problem? ok. lets configure the interface:               root@trium:~# ifconfig firewire0 192.168.1.2 netmask 255.255.255.0 up     root@trium:~# ifconfig     firewire0 Link encap:UNSPEC  HWaddr 47-20-3F-C0-43-4F-C0-00-00-00-00-00-00-00-00-00                 inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:20                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:24 errors:0 dropped:0 overruns:0 frame:0               TX packets:24 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:2445 (2.3 KiB)  TX bytes:2445 (2.3 KiB)      Same configuration steps were made on my PC. OS is the same. FireWire device -               05:06.0 FireWire (IEEE 1394): VIA Technologies, Inc. VT6306/7/8 [Fire II(M)] IEEE 1394 OHCI Controller (rev 46)      dmesg showed:               firewire_net: firewire0: IPv4 over FireWire on device 4d5a900003000000     firewire_net: max_rec 0 out of range     firewire_core: refreshed device fw0      interface configuration -               root@bium:~# ifconfig firewire0 192.168.1.3 netmask 255.255.255.0     root@bium:~# ifconfig     firewire0 Link encap:UNSPEC  HWaddr 4D-5A-90-00-03-00-00-00-00-00-00-00-00-00-00-00                 inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:20                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)          lo        Link encap:Local Loopback                 inet addr:127.0.0.1  Mask:255.0.0.0               inet6 addr: ::1/128 Scope:Host               UP LOOPBACK RUNNING  MTU:16436  Metric:1               RX packets:107 errors:0 dropped:0 overruns:0 frame:0               TX packets:107 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0                RX bytes:70120 (68.4 KiB)  TX bytes:70120 (68.4 KiB)      Now lets ping PC from laptop -               root@trium:~# ping -c 3 192.168.1.3     PING 192.168.1.3 (192.168.1.3) 56(84) bytes of data.     From 192.168.1.2 icmp_seq=1 Destination Host Unreachable     From 192.168.1.2 icmp_seq=2 Destination Host Unreachable     From 192.168.1.2 icmp_seq=3 Destination Host Unreachable          --- 192.168.1.3 ping statistics ---     3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 1999ms     pipe 3      Yes. the cable is connected. Laptop has 4pin port, and PC has 6pin port. AFAIK 6pin uses two pins for power supplyment. I have the coresponding cable, so i don't think that the problem is here. thats all. thanks


SELinux - CentOSx86_64: User command limitation Is SELinux the right tool for this job? If so, what is the best way to do it? I would like to limit a particular user to only running some list of pre- defined commands/scripts (perhaps in their home directory). In addition the users scripts could have permission to run commands that the user cannot run directly (e.g. the user script test.sh could call 'ping localhost' but the user could not call 'ping localhost' directly from the command line). It is worth mentioning that I think these limitations are only required for one user account (I will not need multiple different configurations for different user accounts). The OS is CentOSx86_64 and SELinux is enabled as follows:               SELinux status:                 enabled     SELinuxfs mount:                /selinux     Current mode:                   enforcing     Mode from config file:          enforcing     Policy version:                 24     Policy from config file:        targeted      I am very new to SELinux but have experimented with the following: (1) I thought that the MLS policy would perhaps be best suited (This link looked promising: http://www.centos.org/docs/5/html/Deployment_Guide-en- US/sec-mcs-getstarted.html) for this task so I first attempted to switch this on. The 'SELinux Admin GUI' does not provide any option to change the policy from targeted so I attempted to directly change /etc/selinux/config. This ended with 'kernel panic' after rebooting so I decided to use the original installed policy (i.e. targeted). (2) From the SELinux Admin GUI I created a new policy with a policy type of 'Minimal Terminal User Role'. For the 'name' I called it 'limiteduser'. I selected no roles that it would be transitioned to. I selected no additional roles. I selected 'All' TCP and UDP ports for binds/connects. I added no booleans to the policy. After running the generated .sh the new SELinux User and Role were created. I then assigned a login name to the 'limiteduser'. As expected this gave me a user with very limited privileges. (3) Initially this new user could create a script in its home directory but could not execute it. After I set a boolean called 'allow_guest_exec_content' the user was able to execute the script. Initially the script just contained an 'echo' but once I changed this to ping it failed again. In an attempt to allow 'ping' for this new user I deselected the boolean user_ping (although I think this only applies to user_u rather than guest_u). To do what I want, I think an alternative might be to define a 'user_u' based type and then remove permissions (rather than go with the approach I have taken which is to go with a guest_u based type and add permissions - However I don't know how to do that either!). (4) A number of online sources discuss policy files from a src directory but this was not installed and I could not figure out which package to install that would add this. I have the following selinux related packages installed:               libselinux.x86_64                   2.0.94-5.3.el6                     installed     libselinux-devel.x86_64             2.0.94-5.3.el6                     installed     libselinux-python.x86_64            2.0.94-5.3.el6                     installed     libselinux-utils.x86_64             2.0.94-5.3.el6                     installed     selinux-policy.noarch               3.7.19-126.el6_2.4                 @updates      selinux-policy-targeted.noarch      3.7.19-126.el6_2.4                 @updates      setools-console.x86_64              3.3.7-4.el6                        @base         setools-devel.x86_64                3.3.7-4.el6                        @base         setools-gui.x86_64                  3.3.7-4.el6                        @base         setools-libs.x86_64                 3.3.7-4.el6                        @base         setools-libs-java.x86_64            3.3.7-4.el6                        @base         setools-libs-python.x86_64          3.3.7-4.el6                        @base         setools-libs-tcl.x86_64             3.3.7-4.el6                        @base       (5) I looked at an alternative limited shell such as http://lshell.ghantoos.org/ but my company requirement is either to use SELinux -or- if all fails to use something already provided by the os (e.g. bash restricted) but this may not be as secure. I think that I need to define a custom policy and within that: (a) Allow the user to execute files in its home directory. (b) Allow the user scripts to transition into different types in order to run commands that the user does not have permissions for. Using the SELinux admin GUI (and the configuration files I am aware of) I have not idea how to do this. Thanks for any help you can provide.


Email picture attachments as inline along with the email body

I'm right now working with a script for emailing attachment (.png pics). Since I'm using `mutt` command with `-a` option, the email is sent as a mail attachment. I want these .png pictures to be mailed inline with the mail body. How can I implement this with a bash script? I had also tried with the `mail` command and the result was the same. Also I would like to have any ideas on this if it can be done with a Perl script.


Which socket is gnome-shell reading from continuously?

`strace` shows that the GNOME shell is continuously trying to read from a socket, which is often not available (or doesn't contain any data to read from):               strace -p gnome-shell-pid -e trace=recvfrom          recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(6, "\1\233t\35\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\0\0\3304\351\244\307\202\36", 4096, 0, NULL, NULL) = 32     recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)     recvfrom(6, 0x1390a84, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)      `/proc/$pid/fd` shows that _6_ is a file descriptor for a UNIX socket.               lrwx------. 1 me me 64 Jan  5 12:48 6 -> socket:[55696]      I tried to get info about that in `/proc/$pid/net/unix`, but it seems that this file doesn't contain any useful information for this purpose. Is it possible to know which process is on the other side of this connection? **Edit:** output of `lsof | grep 55696`:               gnome-she  2250         hamid    6u     unix 0xffff880101064000       0t0      55696 socket     gdbus      2250  5801   hamid    6u     unix 0xffff880101064000       0t0      55696 socket     dconf      2250  5805   hamid    6u     unix 0xffff880101064000       0t0      55696 socket     threaded-  2250  5806   hamid    6u     unix 0xffff880101064000       0t0      55696 socket     JS         2250  5807   hamid    6u     unix 0xffff880101064000       0t0      55696 socket     JS         2250  5808   hamid    6u     unix 0xffff880101064000       0t0      55696 socket     gmain      2250  5818   hamid    6u     unix 0xffff880101064000       0t0      55696 socket      This means that this socket is used by threads of the GNOME shell process. OK, but can anyone say what data is sent and received by this socket?


Is it possible to run shell commands inside zip files?

Is it possible to run a shell script inside a zip folder in Linux? I have a shell script that is saved inside a zip folder, and I'd like to run the shell script inside the zip file (as if the zip file were a directory). All that I'm trying to do now is run the command `ls` inside a zip file (so that the command will run inside the zip folder, and run just as if the zip folder were an unzipped folder.)


Launching a sudo gui from desktop

Environment: CentOS 5.10 on 32 Bit. `test.sh`:               #!/bin/bash     cd /dump     sudo /opt/java/jre1.7.0_60/bin/java -jar mytest.jar      `mytest.jar` will pop a GUI app in the desktop, username is in sudoers with NOPASSWD. Created a launcher in desktop, on double click it doesn't launch the GUI. If I run `test.sh` in terminal, it works without issue.


How can I count the number of words in a file whilst editing the file in vim

I know I can use `wc` for counting characters, words and lines of files _at the command line_. Is there any way I can can count the number of words _while in vim_?


X does not load after debian upgrade

After upgrading to "jessie" (debian 8) from stable (debian 7), the system hangs at a blank screen (displaying only an underscore at the top left corner), but otherwise displays no error message to support a diagnosis. The problem seems to be a failure to load `X`, and the following warnings are contained in `/var/log/Xorg.0.log`:               [     8.810] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.     [     8.834] (WW) Falling back to old probe method for vesa     [     8.834] (WW) Falling back to old probe method for fbdev     [445797.803] (WW) Open ACPI failed (/var/run/acpid.socket) (Connection refused)     [445800.781] (WW) Open ACPI failed (/var/run/acpid.socket) (Connection refused)     [526625.329] (WW) Open ACPI failed (/var/run/acpid.socket) (Connection refused)     [527190.989] (WW) Open ACPI failed (/var/run/acpid.socket) (Connection refused)      I have tried investigating the error messages relating to `vesa`, `fbdev`, and `Open ACPI`, but haven't found anything particularly helpful. The lack of cyrillic font does not seem very important and ACPI relates to power settings, so I suspect a solution might involve fixing the `vesa` and `fbdev` errors. I'm wondering if these messages mean something to anyone, and if so, if a remedy might be suggested. **Edit 1:** Some system information that may be pertinent:               lspci | grep VGA     00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)          uname -a     Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux      **Edit 2:** I was checking an outdated log file (`Xorg.0.log`). Searching for errors and warnings in the most recently updated log file (`Xorg.1.log`) reveals the following:               [   232.705] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.     [   232.717] (WW) Falling back to old probe method for modesetting     [   232.717] (WW) Falling back to old probe method for fbdev     [   232.718] (WW) Falling back to old probe method for vesa


windows 7 reinstallation killed grub

I have been running dual boot windows7/ubuntu. Recently I reinstalled windows 7, and I no longer have the option to boot to ubuntu. I would like to be able to get my dual boot working again or at least be able to access that drive so that I can recover my data. These are some of the things that I have tried and their results. I tried:               sudo grub-install --root-directory=/mnt/ /dev/sda      but that lost me the ability to boot from cd drive. ( can still boot from flash drive) Eventually I tried boot-repair but It still boots directly to windows. It gave me the file: http://paste.ubuntu.com/7814117 When I do "restore the mbr of sda", it says:               partition booted by the MBR" sda1 (windows7(boot))      But none of my windows stuff should have been on sda. Is it possible that windows 7 installed its boot over my main ubuntu partition (or the ubuntu grub)? I also believe this may have happened because in the paste file, boot- repair says that my ex-linux partition is now "Boot sector type: Windows 7/2008: NTFS" Any ideas? My partition table looks like this:               $ sudo fdisk -l     /dev/sda1   *        2048   819202047   409600000    7  HPFS/NTFS/exFAT     /dev/sda2       819204094  1953523711   567159809    5  Extended     Partition 2 does not start on physical sector boundary.     /dev/sda5      1936891904  1953523711     8315904   82  Linux swap / Solaris      plus the windows stuff which is on `/dev/sdb`. My Ubuntu drive was `sda1`. I did               $ sudo mount /dev/sda1 /mnt     $ sudo chroot /mnt     chroot: failed to run command `/bin/bash': No such file or directory      I also tried mounting sda1 under media, but that didn't work               ubuntu@ubuntu:/media$ sudo mount -t cifs -o ro /dev/sda1 /media/sda1     mount.cifs: bad UNC (/dev/sda1)


rsync archive mode

I have been reading plenty of articles regarding `rsync` and its `-a` switch. As per theory, I have understood that it preserves a lot of properties like permission, time, group, owner, etc., but why doesn't this work when I'm trying it? There are two users `sam` and `pam`. I'm trying to rsync a file from `/home/sam` to `/home/pam`, while retaining its owner & group.               [sam@localhost sam]$ ll     -rwx---r-x 1 sam sam 0 Jul 18 18:39 abc      If I try to rsync (after logging as user `pam`), the copied files don't have `sam` as owner or group.               [pam@localhost pam]$ rsync -a /home/sam/* /home/pam     [pam@localhost pam]$ ll     -rwx---r-x 1 pam pam 0 Jul 18 18:39 abc      Why doesn't it retain owner and group for `abc` as `sam`?


Problem with bash script executed from website

I have just begun writing scripts in bash and I am putting some of them on my web server (whihc is located on my virtual Debian 6.0.4 machine). I have installed lighttpd on this machine.and when I execute for instance this command :               TOP=`top -n 1`;     PS=`ps aux`;          echo "that's top\n" $TOP;     echo "ps\n" $PS;      Nothing is printed as `$TOP` and for `$PS` the text is written without separation for lines (all is written in a single line). How can I change this ?


Can someone clarify: 'case ":$PATH:" in' in script?

I am not an expert at Unix scripting. An answer to another question suggests using the following piece of code in a script:               case ":$PATH:" in       *:$HOME/mydir:*) echo it is in the path;;       *) echo not there ;;     esac      The purpose of this code is to check whether `$HOME/mydir` is in `$PATH`, but the examples in this and this suggest exact 'matching' rather than 'contains'. How is 'case' operating here? Thanks.


Why logs show a different ssh connection port # than the one specified?

My Ubuntu runs ssh on port 22. But my `/var/log/auth.log` says different port numbers when connections are made. And the port numbers are seemingly random:               Connection from xxx.xxx.xxx.xxx port 33692     Connection from xxx.xxx.xxx.xxx port 32970      Why are these port numbers not 22? And is there a pattern behind which port numbers are picked?


Why is bash's prompt variable called PS1?

The environment variable for the bash prompt is called `PS1` (usually set in ~/.bashrc). What does PS1 stand for? Is there a PS2?


Can't use my USB wireless adapter D-link (DWA-131) to work Backtrack5 R1 VMware

I have a USB wireless adapter D-Link DWA-131. I also have backtrack 5R1 on Vmware. I installed the driver on the system, and here are some outputs:               root@bt:~# lsusb     Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 002: ID 07d1:3303 D-Link System DWA-131 802.11n Wireless N Nano Adapter(rev.A1) [Realtek RTL8192SU]     Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     root@bt:~# iwconfig     lo no wireless extensions.          eth1 no wireless extensions.          eth2 no wireless extensions.          wlan0 unassociated Nickname:"rtl_wifi"     Mode:Auto Access Point: Not-Associated Sensitivity:0/0      Retryff RTS thrff Fragment thrff     Encryption keyff     Power Managementff     Link Quality:0 Signal level:0 Noise level:0     Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0     Tx excessive retries:0 Invalid misc:0 Missed beacon:0      Please note that the chip of the adapter is RTL8192SU, and it's installed successfully on the system. The problem comes when I can't use the wireless adapter to scan available networks.               root@bt:~# airmon-ng start wlan0     Interface   Chipset  Driver      How can I get this adapter to work?


Running Commands on Remote Linux Server Using SSH

I am writing a Bash Script wherein I need to run some set of commands on a remote Linux server from my local computer using SSH. I want the results to be displayed on the terminal screen or dump the results in a file on my local system. How can achieve this? Is the following syntax correct?               \#!/bin/bash     .     .     .     .          ssh <user>@<remote_host> 'COMMAND >> /path/to/file ; scp /path/to/file <user>@<local_host>:<location>; exit'     .     .      Thanks in advance.


Make iotop show only the most disk-intensive item

My laptop (no VM, just plain Ubuntu with encrypted home) freezes for 3 minutes a few times per day. During these 3 minutes, the disk LED indicates intense disk activity, and I can't even move the mouse or press CTRL-ALT-F1. I want to use `iotop` to find out which process is causing this.   The problem with iotop is that it shows disk usage for all processes (huge table).   How do I limit iotop's output to only the first row? The idea is to make iotop more efficient so that it manages to compute and write to the log file even when the system is super-slow, so letting iotop display the whole table and then grepping is not a solution.


Using Linux cgroups to balance CPU performance

I have two dual-core Linux systems installed using Linux cgroups with relatively recent kernels; one is running Debian Squeeze, the other Ubuntu 11.04 Natty Narwhal. I've gotten CPU load balancing with cgroups working a bit better on the Debian system despite its older kernel. But it's not right for everything, and the specific oddity I'm asking about here happens on both systems. If you read Resource Management in Linux with Control Groups it gives an example showing how to reproduce the problem. Here's the Ubuntu version (run this as root):               cd /sys/fs/cgroup/cpu         [On Debian Squeeze start at /mnt/cgroups/cpu instead]     mkdir low high     echo 512 > low/cpu.shares     echo 2048 > high/cpu.shares     yes low > /dev/null &     echo $! > low/tasks     yes high > /dev/null &     echo $! > high/tasks     ps -C yes -opid,%cpu,psr,args         [repeat that a few times]     killall -9 yes      I was expecting the "high" process to be allocated more time than the "low" one; what actually happens with this test case is always more like this:               root@black:/sys/fs/cgroup/cpu# ps -C yes -opid,%cpu,psr,args       PID %CPU PSR COMMAND      3105 88.3   1 yes low      3106 94.5   0 yes high      Where the times are almost equal. Here's my question: why is that happening? In the presentation, this problem is shown going away by pinning each process to the same CPU; additional lines to test that:               taskset -c 1 yes high > /dev/null &     echo $! > high/tasks     taskset -c 1 yes low > /dev/null &     echo $! > low/tasks     ps -C yes -opid,%cpu,psr,args     [later, rinse, repeat]     killall -9 yes      The result then is what I was expecting to see all the time: the "high" process getting a much higher percentage of the CPU:               root@black:/sys/fs/cgroup/cpu# ps -C yes -opid,%cpu,psr,args       PID %CPU PSR COMMAND      3128 83.3   1 yes high      3129 20.7   1 yes low      Explaining why this works would be a useful step toward figuring out why the earlier one doesn't too.


How to run tcptraceroute utility on UNIX machine?

How can I run the `tcptraceroute` utility on a UNIX machine?   I want to run a TCP traceroute for port 80.


Alias for finding a file not working in bash

The following alias for finding a file works in tcsh but not in bash.               alias ff "find . -name '*\!{*}*' -ls"      When I put the above line in .bashrc and then source it I get :               bash-3.2$ source .bashrc     bash: alias: ff: not found     bash: alias: find . -name '*\!{*}*' -ls: not found      Now if I define the alias but putting an equals sign just after the alias name the above error goes away but it doesn't work as expected.                alias ff="find . -name '*\!{*}*' -ls"       Now if I source the file the previous error goes away but the `find` command doesn't work as expected.                bash-3.2$ source .bashrc      bash-3.2$ ff somefile      find: paths must precede expression      Usage: find [-H] [-L] [-P] [path...] [expression]


Colored FIND output?

Is it possible to get colored output from the _find_ command? That is, in the path of each found item, directories are blue, executable scripts are green, et cetera? I'm using version 4.4.2 of _GNU findutils_. Edit - To clarify, each result would be highlighted like this:               ./path/to/file.sh       ^    ^  ^       |    |  L green        blue      (if, for example, executing `find . -type f`).


Linking issues with libjpeg

I have a game I'm writing which recently required libjpeg. I wrote some code using libjpeg on some-other-machine and it worked as expected. I pulled the code to this machine and tried compiling and running it and have been getting the runtime error out of libjpeg: > `Wrong JPEG library version: library is 62, caller expects 80` If I use ldd to see what the binary is linked to, I get: > `ldd Debug/tc | grep jpeg `libjpeg.so.62 => /usr/lib/x86_64-linux- > gnu/libjpeg.so.62 (0x00007f50f02f2000) My compile flags include -ljpeg. The current jpeg related shared objects in my /usr/lib looks like this:               find | grep jpeg | xargs ls -l --color     -rwxr-xr-x 1 root root  61256 2011-09-26 15:43 ./gimp/2.0/plug-ins/file-jpeg     -rw-r--r-- 1 root root   5912 2011-10-01 06:40 ./grub/i386-pc/jpeg.mod     -rw-r--r-- 1 root root  40264 2011-08-24 05:41 ./gstreamer-0.10/libgstjpegformat.so     -rw-r--r-- 1 root root  78064 2011-08-24 05:41 ./gstreamer-0.10/libgstjpeg.so     -rw-r--r-- 1 root root  17920 2011-09-27 17:30 ./i386-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so     lrwxrwxrwx 1 root root     17 2011-08-10 14:07 ./i386-linux-gnu/libjpeg.so.62 -> libjpeg.so.62.0.0     -rw-r--r-- 1 root root 145068 2011-08-10 14:07 ./i386-linux-gnu/libjpeg.so.62.0.0     -rw-r--r-- 1 root root  30440 2011-09-30 05:25 ./i386-linux-gnu/qt4/plugins/imageformats/libqjpeg.so     -rw-r--r-- 1 root root    924 2011-06-15 05:05 ./ImageMagick-6.6.0/modules-Q16/coders/jpeg.la     -rw-r--r-- 1 root root  39504 2011-06-15 05:05 ./ImageMagick-6.6.0/modules-Q16/coders/jpeg.so     -rw-r--r-- 1 root root  10312 2011-06-03 00:18 ./imlib2/loaders/jpeg.so     -rw-r--r-- 1 root root  43072 2011-10-21 19:11 ./jvm/java-6-openjdk/jre/lib/amd64/libjpeg.so     -rw-r--r-- 1 root root  23184 2011-10-14 02:46 ./kde4/jpegthumbnail.so     -rw-r--r-- 1 root root 132632 2009-04-30 00:24 ./libopenjpeg-2.1.3.0.so     lrwxrwxrwx 1 root root     22 2009-04-30 00:24 ./libopenjpeg.so.2 -> libopenjpeg-2.1.3.0.so     -rw-r--r-- 1 root root  23224 2011-08-03 04:20 ./libquicktime2/lqt_mjpeg.so     -rw-r--r-- 1 root root  27208 2011-08-03 04:20 ./libquicktime2/lqt_rtjpeg.so     -rw-r--r-- 1 root root  47800 2011-09-24 10:12 ./strigi/strigiea_jpeg.so     -rw-r--r-- 1 root root   3091 2011-05-18 05:25 ./syslinux/com32/include/tinyjpeg.h     -rw-r--r-- 1 root root  22912 2011-09-27 17:38 ./x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so     -rw-r--r-- 1 root root 226798 2011-08-10 14:06 ./x86_64-linux-gnu/libjpeg.a     -rw-r--r-- 1 root root    935 2011-08-10 14:06 ./x86_64-linux-gnu/libjpeg.la     lrwxrwxrwx 1 root root     17 2011-08-10 14:06 ./x86_64-linux-gnu/libjpeg.so -> libjpeg.so.62.0.0     lrwxrwxrwx 1 root root     17 2011-10-15 10:50 ./x86_64-linux-gnu/libjpeg.so.62 -> libjpeg.so.62.0.0     -rw-r--r-- 1 root root 150144 2011-08-10 14:06 ./x86_64-linux-gnu/libjpeg.so.62.0.0     lrwxrwxrwx 1 root root     16 2011-10-15 10:50 ./x86_64-linux-gnu/libjpeg.so.8 -> libjpeg.so.8.3.0     lrwxrwxrwx 1 root root     19 2011-11-30 01:25 ./x86_64-linux-gnu/libjpeg.so.8.3.0.bak -> ./libjpeg.so.62.0.0     -rw-r--r-- 1 root root  31488 2011-09-30 05:13 ./x86_64-linux-gnu/qt4/plugins/imageformats/libqjpeg.so      The original machine runs Gentoo, 'this' machine runs Ubuntu 11.10. Both are 64-bit. The gentoo box only has libjpeg version 8, it seems. Ultimately, my question is: **How can I resolve this?** I'd also like to know how I can determine exactly which library the linker has used. EDIT: My game also links to SDL_image, which according to ldd, links to libjpeg version 8. I bet this is where my troubles stem from. How can I tell gcc to link my game to libjpeg version 8? I tried -l/usr/lib/libjpeg.so.whatever and it complained about not finding the specified lib.


volcopy for Linux?

Reading one of the editions of the Nemeth's book (Nemeth et al), have read about `volcopy` -- an utility that copies a filesystem from one device to another, making "a literal copy" (here's a man page, though not _too_ helpful). The Book said the utility exists for Linux, but quick googlin' didn't show many results. So the question is -- is it used on Linux, and if not, what is the default alternative to mirror-copy a filesystem ? `dump` and `restore` ? **Edit.** I was thinking that such an utility could be useful in the case of e.g. hard disk replacement -- currently I am using `dd` to replicate the root partition etc, this is fast but obviously preserves the size of the partition. So I thought `volcopy` could be a quick alternative that allows to copy to a bigger partition. `dump` | `restore` allow to to that, if I am not mistaken. Sorry for being too unspecific initially.


Install Linux Mint 14 from CLI

I'm trying to install Linux Mint 14 from a live cd on a HP Pavilion laptop. I got some problem with X and the nvidia card, which prevents X from starting (and therefore prevents the live installer from starting). I'm following this tutorial(link), but it requires rebooting for unloading the nouveau driver. But rebooting from a live cd means that I lose all progress and must restart from scratch, therefore it's not viable. Therefore I'm looking for a way to have the system installed on hard drive from the command line interface. What should I do? I want to install a user friendly and recent Linux distribution. If I'm not able I will have to install Windows 7 :(((


Linux compability file system

I need to develop a file system for Linux for my diploma work.   * Where can I find infomation about this theme?   * How can I test it and other?


Recording and charting boot process information in Linux

I need to write a command line tool that records the boot process information in Linux, and then renders it in a chart format (a textual chart would do). How do I **_programmatically_** obtain the this boot process information? Languages that I am allowed to use are C and C++. Thanks in advance. :-)


Can I pipe lpt port over tcp?

I'd like to pipe data in and out to a lpt (parallel IEEE 1284) port on another machine, to remotely use a device. Can it be done in a common unix-y system? I have ubuntu 12.04. :) I was thinking something like: machine A, terminal 1:               nc -l 1234 > /dev/lpt0      machine B, terminal 1:               nc 192.168.1.100 1234 < /dev/lpt0      and on second terminals: machine A, terminal 2:               nc 192.168.1.100 4321 < /dev/lpt0      machine B, terminal 2:               nc -l 4321 > /dev/lpt0      I don't know if this is a sound way to do this. **How to communicate with parallel ports remotely?**


Emacs and windows manager keyboard shortcuts without "Super" key

I found a classic M-series keyboard and I want to use it. However, it does not have the "Windows" key (a.k.a "Super"), only the Shift, Control and Alt modifiers. My keyboard shortcuts are cluttered as-is, since that I try to control both Emacs and the windows manager (Gnome) only from the keyboard. I rely on the "Super" key to identify the windows manager shortcuts. What it the best practice for keyboard-centric work without the "Super" key?


On which unix distributions is Python installed as part of the default install?

Does anyone know of an overview that would document on which (recent) UNIX distributions Python is available by default, i.e. part of the default installation? PS: Answers from StackOverflow, before the question was moved here:   * Don't know for all Unix OSes, but for Linux you can always check distrowatch.org. But this is not the right site to post this kind of question: please move this to unix.stackexchange.com – vstrien 2 hours ago   * I can't think of any distributions where it isn't installed by default. Many basic system tools are written in Python these days. – Daniel Roseman 1 hour ago   * It is NOT installed by default in LFS... – Oz123 1 hour ago


How to "grep -v" private/broadcast IPv4 addresses?

time nmap -n -iR 0 -sL | cut -d " " -f 5 | egrep -v "^10.*|^172.[16\-32].*|^192.168.*|^[224\-255].*" > RANDOM-IPS.txt      so the important part is:               egrep -v "^10.*|^172.[16\-32].*|^192.168.*|^[224\-255].*"      **Q** : Is this a good regexp? /So I will generate all the 2^32 IPv4 addresses, and "grep -v" the private/broadcast ranges./ Or are there any better ways to generate the usable IPv4 addresses on the internet?


Save sessions to file in xmonad

Is it possible to save an xmonad session to a file and reload it on the fly? I don't want to save only the last session but to be able to save different sessions to different files and reload it if I want.


immutable-like flag for perms

Is there any `chattr` flag that would allow me to lock a file's unix permissons, and not change them without resetting the flag? The file itself should still be modifiable, I just want to prevent ... ignorant people ... from changing the permissions to something wrong accidentally.


What file to I have to edit to make static dns server in CentOS

Almost every distro I know will wipe `/etc/resolv.conf` on reboot (I think dhcp does this) and thus the place to add static dhcp entries varies per distro. How to I add static dns servers to a CentOS server? so that I know that my entries will survive a reboot?


How to find out total memory resource usage with ps?

With `ps` command I can find out how much memory each program uses:               ps -u mertnuhoglu -o pcpu,rss,pid,command      Is it possible to find out the sums of each type of resource usage as well, easily?


SAS hardrive 600GB 10k is not detecting in my linux server

I have inserted one new 600 GB HDD to my Linux server. Green light is glowing but in my Oracle Enterprise Linux 5.5 OS it is not showing after executing the command below:               fdisk -l     grep -H . /sys/block/sd*/device/model


What causes /dev/disk/by-label to be populated?

I've noticed that Linux distributions typically have a /dev/disk/by-label directory, but this isn't always the case (For example, the CirrOS Linux test image doesn't have one). What's required on a Linux system for the /dev/disk/by-label directory to be properly populated?


sshfs: experiencing data loss

I am connecting to a filesystem on a remote server via sshfs. What I do is just to modify these files with emacs. From time to time I am experiencing data loss. While I work on a file and try to save the changes I get that the file has changed on the disk and Emacs asks me if I want to save the changes or not. So I choose no, if I choose yes the modification are not saved on the remote cluster but only on the local mount point. Now I was working on a file, Emacs told me that the file had been modified on the disk, so I choose to not save the changes and then Emacs asks me if I want to keep the recent modification I said no, and the file is completely gone. I don't know what it is wrong with this, because I have used sshfs many other times and it has always been fine. I am using Mac 10.6.8, sshfs 2.4 and fuse4x library version: FUSE 2.8.7 / fuse4x 0.9.2