title: Display the number of bytes, words and lines in a file

text: I want to create a shell script `df`. As, I want to type in `df name_of_file` and then I can get the contents of the file. If the file name is in the directory, I want it to show its contents. If not, I want to show the size in words, lines, and bytes. How do I go about this? So far, I have this:               #!/bin/bash     FILENAME=$FILENAME     FILEBYTES=$(stat -c%s "$FILENAME")     FILEWORDS=$(stat -w%s "$FILENAME")     FILELINES=$(stat -l%s "$FILENAME")     echo "Size of $FILENAME in bytes = $FILEBYTES  bytes, $FILEWORDS words, $FILELINES lines."


title: Unzip file contents, but without creating archive folder

text: I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Well, when I use the "unzip myarchive.zip" command, the system creates a directory by default called "myarchive" with the contents of the zip file. I do **not** want the system to create this "myarchive" directory - I just want the contents to be extracted to directory "b". Is this possible? What I've been doing now is simply issuing a "cp" command to copy the files from the newly created directory (in this case "myarchive" to "b") to where I want them.


title: Split video file into pieces with ffmpeg

text: When you want to extract two minutes of a video file from minute 2 to minute 4, you will use command               ffmpeg -i input.mpg -sameq -ss 00:02:00 -t 00:02:00 output.mpg      I'd like to split the video into two minutes chunks. I have an idea to use a bash script, but there are a few errors.               for i in seq 50;     do ffmpeg -i input.mpg -sameq -ss 00:`expr $i \* 2 - 2`:00 -t 00:02:00 output.mpg; done      Do you know how to correct the errors in script that are where I use `$i` expression? Or is there some better solution?


title: Check a bash variable against a file

text: I have a bash variable ($HTTP_COOKIE) which contains a string. I want to check if this string matches the content of a given file (token). I'm working on a busybox linux. How should I do?


title: X Session / xdmx, keybindings lost

text: I am using startx (with Xdmx) to run a remote session on another computer. However, when I do this, keybindings (especially control, alt and the cursor keys) are not correct on the remote session-- and this persists when the session is closed, requiring logout to restore. I'm coming up zilch after some googling. Any ideas? Thanks!


title: Maximize xterm via bash script

text: I have found this answer providing how to manipulate the current xterm window's dimensions, ie:               echo -ne "\e[8;30;30t"      How can I modify this to maximize the window (xterm's `alt` + `enter` shortcut)? Also, where do I find more info on these xterm command line modifiers? **UPDATE:** See multiple solutions below for both maximize and full screen (without title and borders)


title: Setting up multiple video streams with publishing points for clients

text: Can anyone suggest if this is viable on Linux? I have searched and found many many results using VLC but nothing that matches previous Windows Media Services on Windows Server 2008 that we were using.   1. Needs to support push streams from multiple clients - all windows based   2. Setting up channels (publishing points) so clients can stream live video So clients can use VLC or any other software that can push the stream to the linux server and the server will broadcast it to the world. I hope this is the correct place to ask this :)


title: scp and umask setting

text: How do i make SCP respect umask ? Ive tried adding this               Subsystem      sftp  internal-sftp -u 0002      in /etc/ssh/sshd_config and               session    optional     pam_umask.so umask=0002      in /etc/pam.d/sshd any other things to try ? each time scp creates the file as 644 instead of 664 as the umask would suggest


title: Setting up network cards on FreeBSD

text: I just installed FreeBSD 9 on a new laptop and I'm having some trouble getting the network cards to work. Presumably the file representing the cards is in /dev, but where would the configuration files be? In /etc? Any tutorial or guidance in this matter would be greatly appreciated.


title: Wake on LAN through PHY and unicast only works in the first ~30 seconds after pm-suspend

text: I'm having some trouble with Wake on LAN through PHY and unicast. I'm able to wake the system by pinging or sshing the shut down machine, but only within the first ~30 seconds. Why's that, what could be the cause? I put a script `70wol` into `/usr/lib/pm-utils/sleep.d` and made it executable, it obviously is executed since it works:               #!/bin/bash     ethtool -s eth0 wol pug      I'm on Debian Testing, NIC is Intel I217-V on an Intel DH87RL, Driver is Intel 2.5.4 e1000e.ko


title: file system is not mounted on system: warning crnonshdw not mounted on system

text: I am new to this field scripting. I am a Solaris engineer. In my system when I type: `df -k` it will output it like this:               mmr1ap04:/xahome/xa21> 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     swap                 5019512      16 5019496     1%    /var/run     /dev/dsk/c0t0d0s6    11593708 3837805 7639966    34%    /cots     /dev/dsk/c0t0d0s7    2055463 1915744   78056    97%    /crshdw     /dev/dsk/c2t3d0s7    13845475 10935286 2771735    80%    /extra2     /dev/dsk/c0t0d0s5    8260757 7517289  660861    92%    /xa     /dev/dsk/c0t0d0s3    4130982 2845778 1243895    70%    /xahome     /dev/dsk/c0t0d0s4    4130982 2841395 1248278    70%    /xalocal     /dev/dsk/c2t3d0s6    4129290  716642 3371356    18%    /jumpstart     /dev/dsk/c2t3d0s5    3096423   65222 2969273     3%    /dcol_shdw     swap                 5020184     688 5019496     1%    /tmp     /dev/dsk/c2t3d0s4    3096423  193827 2840668     7%    /cdata     /dev/dsk/c2t3d0s1    2053605  837714 1154283    43%    /uc_shdw     /dev/dsk/c2t3d0s0    2053605 1815547  176450    92%    /psa_shdw     mmr1asxx:/crnonshdw  106687632 92602932 14084700    87%    /crnonshdw     mmr1ap02:/psa_shdw   2055463 1509888  483912    76%    /xanfs/sc3cp6.mmr1ap02      Here I am concentrating on /crnonshdw. But in my case, I need to print the output as:               "warning if crnonshdw file system is not mounted on system:warning crnonshdw not mounted on system.


title: How to execute some shell script before VM suspend?

text: I have created one Centos VM. And I have created some IP aliases. Once I suspend and resume the VM my IP aliases are all going down. So I just want to capture the aliases address before suspend and bring up those IP's after resume. How to do this? I just want a script, I don't want to use VMware tools for this..


title: Multi statement if condition in bash

text: I wanted to execute several statements in an if condition as follows:               [[ -e cli.tar.gz ]] && `tar -xvf cli.tar.gz -C ~/` ||              echo "cli.tar.gz can not be found. Exiting" >&2 && exit 1      What happened is that the exit 1 was reached when cli.tar.gz is found and tarred, i.e. exactly the opposite of what I was trying to achieve, so I added parentheses around the part after the OR as follows               [[ -e cli.tar.gz ]] && tar -xvf cli.tar.gz -C ~/ ||         { echo "cli.tar.gz can not be found. Exiting" >&2; exit 1; }      I received an error unexpected token '}' at the end of the function (this line is part of a function) I solved my problem by writing a good formatted if condition like this               if [[ -e cli.tar.gz ]]     then         if [[ ! `tar -xvf cli.tar.gz -C ${UDM_REMOTE}` ]]         then             echo "cli.tar.gz can not be found. Exiting" >&2; exit 1;         fi     fi      But still what would have been the solution of doing nested if condition in one line like what I've tried to achieve initially? **Update 1** Thanks to the answers of @uwe and @goldilocks I updated the statement as follows which now works               [[ ! -e cli.tar.gz ]] && ! `tar -xvf cli.tar.gz -C ~/` && \        echo "cli.tar.gz can not be found (or tar failed). Exiting" >&2 && exit 1


title: Unable to login via ssh after several months

text: I have a Dell Poweredge running Ubuntu 13.04 in my office to serve up an interal web-app address system. It has been at least a 2 months possibly 3 since my last login. Everything _is_ running great, but I can not login. I know I have the correct credentials because they are saved in putty. Error simply says: Access Denied What could possibly cause this to happen? Can it be fixed without pulling it off the shelf and hooking up monitors and keyboards etc (as a side-note it weighs something like 50+ pounds so I am not looking forward to that at all)?               guest@buildsys2:~$ ssh -v me@192.168.1.10     OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: /etc/ssh/ssh_config line 19: Applying options for *     debug1: Connecting to 192.168.1.10 [192.168.1.10] port 22.     debug1: Connection established.     debug1: SELinux support disabled     debug1: identity file /tmp/guest-YBscPe/.ssh/id_rsa type -1     debug1: identity file /tmp/guest-YBscPe/.ssh/id_rsa-cert type -1     debug1: identity file /tmp/guest-YBscPe/.ssh/id_dsa type -1     debug1: identity file /tmp/guest-YBscPe/.ssh/id_dsa-cert type -1     debug1: identity file /tmp/guest-YBscPe/.ssh/id_ecdsa type -1     debug1: identity file /tmp/guest-YBscPe/.ssh/id_ecdsa-cert type -1     debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 >      Debian-5ubuntu1.1     debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*     debug1: Enabling compatibility mode for protocol 2.0     debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1     debug1: SSH2_MSG_KEXINIT sent     debug1: SSH2_MSG_KEXINIT received     debug1: kex: server->client aes128-ctr hmac-md5 none     debug1: kex: client->server aes128-ctr hmac-md5 none     debug1: sending SSH2_MSG_KEX_ECDH_INIT     debug1: expecting SSH2_MSG_KEX_ECDH_REPLY     debug1: Server host key: ECDSA [removed]     The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.     ECDSA key fingerprint is [removed].     Are you sure you want to continue connecting (yes/no)? yes     Warning: Permanently added '192.168.1.10' (ECDSA) to the list of known hosts.     debug1: ssh_ecdsa_verify: signature correct     debug1: SSH2_MSG_NEWKEYS sent     debug1: expecting SSH2_MSG_NEWKEYS     debug1: SSH2_MSG_NEWKEYS received     debug1: Roaming not allowed by server     debug1: SSH2_MSG_SERVICE_REQUEST sent     debug1: SSH2_MSG_SERVICE_ACCEPT received     debug1: Authentications that can continue: publickey,password     debug1: Next authentication method: publickey     debug1: Trying private key: /tmp/guest-YBscPe/.ssh/id_rsa     debug1: Trying private key: /tmp/guest-YBscPe/.ssh/id_dsa     debug1: Trying private key: /tmp/guest-YBscPe/.ssh/id_ecdsa     debug1: Next authentication method: password     me@192.168.1.10's password:      debug1: Authentications that can continue: publickey,password     Permission denied, please try again.     me@192.168.1.10's password:


title: Looking for economical ARM based board for learning Linux

text: I want to learn embedded linux and porting. I am planning to buy a Respberry PI which is based on 700 MHz Low Power ARM1176JZ-F Applications Processor, with 512MB SDRAM. this is the cheapest board I have found. My intention is to learn embedded linux and porting. How good is this board for this purpose? Or shall I look for any other board such as FriendlyARM Mini 2440?


title: Hard disk power management with image toggling in display

text: We have a system in which we almost toggle some display data in the screen 24 hours x 7 days a week. Since our application runs every day, we see some hard disk failures in the field. Unfortunately, our application specification contains that it should toggle specified data in the screen all time while idle. To fix this issue:   **Is it possible to power off the hard disk when no user is using it for a certain period time and also make sure display toggles a set of images on the screen?**


title: zsh completion and unknow bzr commands

text: ZSH's Bazaar completion does not offer any expansion/completion when it does not know the `bzr` subcommand I am using. In my case, I use `bzr qlog` but ZSH's `/usr/share/zsh/5.0.2/functions/_bzr` does not know about this command. As far as I can tell it ends up returning nothing from completion function:               (*)         _message "unknown bzr command completion: $cmd"         return 1         ;;      At this point I have employed a hack like this to make it complete with file names:               (*)         _message "unknown bzr command completion: $cmd"         args+=( '*:FILE:_files' )         #return 1         ;;      Is there any better way how to do this?


title: Running bash script gives `No such file or directory` when run with path

text: I have bash script `aaa.sh` that runs fine when I run it from the current directory. But if I try to run using the full path `/home/vik/Projects/updd/aaa.sh`, my system tells me `No such file or directory`. What might be wrong?               ls -ld /home /home/vik /home/vik/Projects /home/vik/Projects/updd /home/vik/Projects/updd/aaa.sh      brings               ls: cannot access /home/vik/Projects/updd/aaa.sh: No such file or directory     drwxr-xr-x  3 root  root  4096 Nov 21 09:53 /home     drwxr-xr-x 30 vik vik 4096 Dec  2 00:55 /home/vik     drwxrwxr-x  4 vik vik 4096 Dec 11 01:04 /home/vik/Projects     drwxrwxr-x  4 vik vik 4096 Nov 25 03:16 /home/vik/Projects/updd               sh /home/vik/Projects/updd/aaa.sh      brings               Can't open /home/vik/Projects/updd/aaa.sh


title: When removing a Debian package, how can I also remove Python *.pyc files?

text: I have a Debian package say `XYZ.deb` which copies some file on installation. As per Debian package policy on package uninstallation only those files will be removed which were copied during installation. Also Debian doesn't remove `conf` files either. XYZ package installs some Python scripts which on execution creates `.pyc` file. Now on de-installation I want to remove all the files. What would be the postrm script to cleanly remove package?


title: How to use regex with AWK for string replacement?

text: Suppose there is some text from a file:               (bookmarks     ("Chapter 1 Introduction 1" "#1"     ("1.1 Problem Statement and Basic Definitions 23" "#2")     ("Exercises 31" "#30")     ("Notes and References 42" "#34"))     )      I want to add 11 to each number followed by a `"` in each line if there is one, ie               (bookmarks     ("Chapter 1 Introduction 12" "#12"     ("1.1 Problem Statement and Basic Definitions 34" "#13")     ("Exercises 42" "#41")     ("Notes and References 53" "#45"))     )      Here is my solution by using GNU AWK and regex:               awk -F'#' 'NF>1{gsub(/"(\d+)\""/, "\1+11\"")}'      i.e., I want to replace `(\d+)\"` with `\1+10\"`, where `\1` is the group representing `(\d+)`. But it doesn't work. How can I make it work? If gawk is not the best solution, what else can be used?


title: How enable safeguards for CPU temperature

text: My desktop has a nasty habit. When I have several high intensity applications running and my CPU is at maximum usage for a period of time, the core temperature rises and my computer auto-shuts off. Is there a way I can monitor (write a script) my CPU temperature in the background and have some sort of warning when it gets above a certain temperature? I'm running Opensuse with dwm as my window manager. I usually use `sensors` to see my CPU temperature.


title: Is vnstat reporting accurate?

text: I'm checking the stats of a busy site that host mirror downloads. I installed vnstat on the machine and after a few days i saw the number `125.25 Mbit/s` or using `-ru 0` `15.29 MiB/s` I'm extremely confused. How is this possible? I assume he is on a 100mbps connection. He doesnt know his hosting stats. When looking at numbers i suspect MiB (the # seen using -ru 0) is 1000*1000 as oppose to 1024*1024. Ok but even if i do ((value*1000*1000)/1024)/1024 then *8 to get bits rather then bytes the result is still > 100Mbps (it was 116). Confused i googled. I found this wiki page and saw it meant 100mbps down and 50 up. Fantastic it makes sense. Then i double check by doing -h and using the tx number * 1000 to get the # of bytes (it said KiB rather then Kib so i assume the number is bytes). Then i did /1024(for KB)/1024(MB) and then *8 for bits. The number was >100 (it was close to 150). The rx speed was insignificant (<1mbp). How the heck is the network going so fast? Does this mean he has a connection >100mbps? I havent heard of that and heard of ISP buying speeds in 100mbps chucks. Is there some reason the number is so high? The server is running apache with php support. Its nothing special.


title: OpenSuse custom keyboard shortcuts not working

text: Note: This question is specifically on a clean install of OpenSuse 11.3 with gnome as the display/desktop manager I can't get custom keyboard shortcuts to work, default shortcuts are working properly, but the ones I changed I can only get one of them to work, I'm using the "windows key" to match functionality of Windows 7 for a few keys like maximize window (winkey+up), minimize window (winkey+down), etc; none of them work; for the record **I did the exact same thing in Ubuntu and it worked without any problems.** additional info: I also noticed that gnome-do by default uses a key that I had assigned (winkey+space) and it "wins" (runs gnome-do) over the custom global key I had assigned (show main menu), actually, I can change the key in gnome- do to another that I have in the keyboard shortcuts, and the gnome-do works; this just makes me wonder if there are other applications that are disabling the usage of the "winkey" update: I also tried using gconf-editor apps/metacity, adding the keys there, still no luck, I tried _Windows_ , _Super_ , _Mod4_ for the WinKey name, none worked In some apps it seems the WinKey is completely ignored, i.e. it performs the action associated to the key without the WinKey, though, like I said before, there's one or two custom WinKey+SomeKey that ARE working (changed them to something else, stopped working, changed it back, worked again) Found this article from 2006 that sounds very much like the problem I'm having, though I followed the steps to fix it but didn't work for me > There seems to be a bug in Gnome / Metacity / X somewhere that means you > can't use SUPER_L or SUPER_R (the left and right windows keys on a keyboard) > with gnome system commands such as "Lock Screen". another thread of the same issue I'm having I've been reading linux forums, it seems this might a be a bug on recent OpenSuse releases: Many actions do not work with shortcuts in 11.3 Changing the Keyboard shortcuts in System->personal->Keyboard Shortcuts does not seem to be working. and several others


title: regex matching with "locate"

text: I'm trying to use the locate command to find files in my home folder, however whenever I try and run this I get no results:               locate -i -l 4 --regexp '^\/home\/jack\/[A-Za-z0-9\/\ ]*(My.)*$'      I've also tried `^\/home\/jack\/^(?!\\.)[A-Za-z0-9\/\ ]*(My.)*$` but that returns no results either. The file I'm looking for just to test it is `/home/jack/Music/Foals/My Number.flac` I would like to exclude the results of hidden files from my search.


title: Exim4 Configuration for Webserver

text: I successfully configured `exim4` to handle mail only for the `localhost` (just for forms on the website). I tested it by sending messages from the CLI to myself on another domain. My problem is that the server has the FQDN of `www.example.com` and I need to be able to send mail to `person@example.com`. `person` doesn't have an account on the Webserver box as the mail is handled elsewhere. How can I get `exim4` to route the message? Currently I see the following error in `mainlog`:               person@example.com: Unrouteable address      The server is running Debian Wheezy.


title: How to safely remove hard-link to home folder?

text: In a folder owned by my user `/sites/Website` there is a dir named `~`. When I `cd` to this directory, I am redirected to `~/`, my home folder. At first I thought this was a symbolic link, but doing `ls -al` shows it to be ordinary. I'm assuming it is a hard link. I ran:               $ rm -r /sites/Website/~      This began to actually delete my home folder and I lost a lot of data. I stopped `rm` with `Ctrl``c`. How can I get rid of this link safely?


title: ssh -X foo@host then su bar then run X app with local display, while bar also logged in?

text: I want to `ssh` into another machine, using one user account, then `su` to another user and run X programs as that user, with the display on my computer. The case when the 2nd user is not logged in to X is nicely covered by another question, but what when the other user _is_ logged in? That answer suggests you copy the `.Xauthority` file, created by `ssh -X`, in the first user's home dir, to the `su`-ed to user. However, when they are logged in, they already have an `.Xauthority` file and presumably they won't like me overwriting that... So is this possible?


title: How long has GNU kill(1) accepted a name argument?

text: We recently discovered that GNU kill, going beyond spec, will take a name as its argument and try to kill all processes with that name, in the same vein as pkill(1) or some implementations of killall. I haven't been able to find GNU's changelog for kill. When was that "feature" added?


title: Fedora 16 install does not fully shutdown

text: I did a fresh install (not upgrade) of Fedora 16 shortly after it came out. However I've never been able to have it fully shutdown. When you select it I can see it try to shutdown, but it doesn't finish I turned off quiet booting so I see mostly what Linux is trying to do. IIRC usually the last line is something about shutting down the live image, after that it just hangs. Is there anything I can do to get Fedora to shutdown correctly? Note that I'm on a Lenovo Thinkpad X220 Laptop if that helps


title: flash live media encoder Linux

text: Apparently there is no way of installing Adobe media encoder for Linux unless you use "Wine" which I'm not about to do because seems very messy option. Does anyone know of any other open source live media encoders that will install on Linux and play H.264 codec?


title: How can I log in my laptop with public key authentication?

text: Stemming from my recent aversion to passwords (this thread convinced me), I'm wondering if there's a way to login locally (on my laptop running Crunchbang/Debian) by using public-key encryption. I figured I could store a private key in a USB stick that I could use to authenticate myself. I'm both interested in tools, if any, that allow to do this and theory on how to implement it.


title: How to create a bounded queue for shell tasks?

text: I have 1000 gzipped files which I want to sort. Doing this sequentially, the procedure looks pretty straightforward:               find . -name *.gz -exec zcat {} | sort > {}.txt \;      Not sure that the code above works (please correct me if I did a mistake somewhere), but I hope you understand the idea. Anyway, I'd like to parallelize ungzip/sort jobs in order to make the whole thing faster. Also, I don't want to see all 1000 processes running simultaneously. It would be great to have some bounded job queue (like BlockingQueue in Java or BlockingCollection in .NET) with configurable capacity. In this case, only, say, 10 processes will run in parallel. Is it possible to do this in shell?


title: Nautilus, mount ISO file with right-click menu

text: I am using Nautilus now, and back then when i was using Ubuntu i could right- click on an ISO file and automount it without the need to issue any command. But now i am using Nautilus in Archlinux and it seems that it doesn't have the needed plugin for that to work, is anybody know what is the package name, or what should i do in order to get that feature ?


title: special device tmpfs does not exist

text: I'm trying to speed up a project which uses a folder for cache by mounting the cache folder on `tmpfs`. But whenever I mount it I get this error message:               mount: special device tmpfs does not exist      this is the entry on `/etc/fstab`:               tmpfs /home/rkmax/Projects/webapp/app/cache rw,size=500M,nosuid,uid=1000,gid=100 0 0      My distro is ArchLinux.


title: Exclude symbolic links to other filesystems with find -mount

text: I am working on a script that, among other things, extracts a list of all items in a directory (files and subdirs) for archival but it needs to skip remote symlinks (i.e. on other file systems). The script was migrated from Solaris where `find . -mount` seems to have excluded symlinks to other file systems. The find man page for `-mount` says               -mount Don't  descend directories on other filesystems.  An alternate name for -xdev, for compatibility with some other versions of find.      I tried `-xdev` but that didn't work either. As a result of the difference, my remote symlinks get deleted. Any idea how I can fix this as a one-liner to eliminate remote symlinks from being returned?


title: Point IP to an application instance

text: I was just wondering how I go about pointing a static IP address which I have purchased to an application instance on my server, using a different IP from the one I currently have pointing to my main server? This baffles me completely, I know of two commands that are related but I don't know how to force them to point the IP to a certain port on my localhost. I think they are ARP and route. I could be completely wrong. All I want to do is point different IP addresses to different instances of Java. Also I'm using CentOS 5.9


title: What values from debconf-get-selections should not be preseeded?

text: I want to replicate the Debian installation choices made for my system's current configuration in the installation of a new system. Debian can be pre-configured through a "pre-configuration" (aka "preseed") file, which basically contains the answers to the questions the installer will ask. The documentation states that one way to create a preconfiguration file from an existing installation of Debian is to: > ...use the `debconf-get-selections` from the debconf-utils package to dump > both the debconf database and the installer's cdebconf database to a single > file: > > `$ debconf-get-selections --installer > file`   >  `$ debconf-get-selections >> file` But it then immediately adds: > However, a file generated in this manner will have some items that should > not be preseeded... The documentation does not elaborate on what those items-that-should-not-be- preseeded would be. Could someone elaborate? * * * By way of illustration, below I include the second field of the output I get from the two commands above, where I've kept only the lines that begin with `d-i`, along with the comments, sometimes truncated for brevity. (The reason for keeping only the configuration lines that begin with `d-i` is that in the example pre-configuration file provided by Debian, only such lines appear.)               # Check the integrity of another CD-ROM?     cdrom-checker/nextcd          # Web server started, but network not running     save-logs/no_network          # for internal use only     debian-installer/consoledisplay          debian-installer/shell-plugin          # Country, territory or area:     # Choices: Antigua and Barbuda, Australia, Botswana, Canada, ...     localechooser/shortlist          # for internal use; can be preseeded     preseed/include_command          # Country of origin for the keyboard:     # Choices:      keyboard-configuration/layout          # Choices: Canada, Mexico, Saint Pierre and Miquelon, United ...     localechooser/countrylist/North_America          # Choices: Greece, Cyprus, other     localechooser/shortlist/el          # Keyboard layout:     # Choices:      keyboard-configuration/variant          # Choices: Algeria, Angola, Benin, Botswana, Burkina Faso, Bu...     localechooser/countrylist/Africa          # Choices: Finland, Sweden, other     localechooser/shortlist/sv          # Keep default keyboard options ()?     keyboard-configuration/unsupported_options          # Choices: Cyprus, Turkey, other     localechooser/shortlist/tr          # Interactive shell     di-utils-shell/do-shell          # for internal use only     # Choices: stable, testing, unstable     cdrom/suite          # Choose an installation step:     # Choices:      debian-installer/missing-provide          # Check CD-ROM integrity?     cdrom-checker/start          # Failed to retrieve the preconfiguration file     preseed/retrieve_error          # Directory in which to save debug logs:     save-logs/directory          # for internal use only     debconf/showold          # Failed to open checksum file     cdrom-checker/md5file_failed          # Choices: Andorra, Spain, France, Italy, other     localechooser/shortlist/ca          # Write the changes to the storage devices and configure RAID...     partman-md/confirm_nooverwrite          # PCMCIA resource range options:     hw-detect/pcmcia_resources          # Failed to mount the floppy     save-logs/floppy_mount_failed          # for internal use only     debconf/language          # Choices: China, Singapore, Taiwan, Hong Kong, other     localechooser/shortlist/zh_TW          # Dummy template for preseeding unavailable questions     debian-installer/dummy          # Additional parameters for module :     hw-detect/retry_params          # Incorrect CD-ROM detected     cdrom-detect/wrong-cd          # for internal use; can be preseeded     cdrom-detect/eject          # Choices: Argentina, Bolivia, Chile, Colombia, Costa Rica, E...     localechooser/shortlist/es          # for internal use; can be preseeded     preseed/run          # Write the changes to disks and configure LVM?     partman-lvm/confirm_nooverwrite          # Cannot save logs     save-logs/bad_directory          # Choices: Belgium, Canada, France, Luxembourg, Switzerland, ...     localechooser/shortlist/fr          # Insufficient memory     lowmem/insufficient          # for internal use     keyboard-configuration/optionscode          # Choices: China, Taiwan, Singapore, Hong Kong, other     localechooser/shortlist/zh_CN          # Load missing firmware from removable media?     hw-detect/load_firmware          # Choices: Italy, Switzerland, other     localechooser/shortlist/it          # Choices: Antarctica     localechooser/countrylist/Antarctica          # Choose the next step in the install process:     # Choices: Choose language, Configure the speech synthesizer ...     debian-installer/main-menu          # Failed to load installer component     anna/install_failed          # Choices: Russian Federation, Ukraine, other     localechooser/shortlist/ru          # for internal use     keyboard-configuration/modelcode          # Entering low memory mode     lowmem/low          # Choices: Jordan, United Arab Emirates, Bahrain, Algeria, Sy...     localechooser/shortlist/ar          # Keep current keyboard options in the configuration file?     keyboard-configuration/unsupported_config_options          # Choices: Antigua and Barbuda, Australia, Botswana, Canada, ...     localechooser/shortlist/en          # Method for toggling between national and Latin mode:     # Choices: Caps Lock, Right Alt (AltGr), Right Control, Right...     keyboard-configuration/toggle          # for internal use only     anna/retriever          # Choices: Curaçao     localechooser/countrylist/other          # Choices: Albania, Andorra, Armenia, Austria, Azerbaijan, Be...     localechooser/countrylist/Europe          # locale     localechooser/help/locale          # Load CD-ROM drivers from removable media?     cdrom-detect/load_media          # for internal use; can be preseeded     debian-installer/framebuffer          # for internal use     espeakup/voice          # for internal use; can be preseeded     preseed/include          # Error reading Release file     cdrom-detect/no-release          # Ignore questions with a priority less than:     # Choices: critical, high, medium, low     debconf/priority          # Key to function as AltGr:     # Choices: The default for the keyboard layout, No AltGr key,...     keyboard-configuration/altgr          # CD-ROM detected     cdrom-detect/success          # Choices: Bouvet Island, Falkland Islands (Malvinas), Saint ...     localechooser/countrylist/Atlantic_Ocean          # Continue the install without loading kernel modules?     anna/no_kernel_modules          # for internal use; can be preseeded     debian-installer/exit/poweroff          # Choices: Bangladesh, India, other     localechooser/shortlist/bn          # for internal use; can be preseeded     preseed/include/checksum          # Integrity test failed     cdrom-checker/mismatch          # Load missing drivers from removable media?     hw-detect/load_media          # Keep default keyboard layout ()?     keyboard-configuration/unsupported_layout          # Start PC card services?     hw-detect/start_pcmcia          # for internal use; can be preseeded     debian-installer/add-kernel-opts          # for internal use; can be preseeded     mouse/protocol          # for internal use; can be preseeded     mouse/left          # for internal use     keyboard-configuration/layoutcode          # for internal use     keyboard-configuration/store_defaults_in_debconf_db          # Choices: Brazil, Portugal, other     localechooser/shortlist/pt          # for internal use; can be preseeded     preseed/early_command          # for internal use only     debian-installer/exit/always_halt          # Choices: Africa, Antarctica, Asia, Atlantic Ocean, Caribbea...     localechooser/continentlist          # Insert Debian boot CD-ROM     cdrom-checker/firstcd          # How should the debug logs be saved or transferred?     # Choices: floppy, web, mounted file system     save-logs/menu          # for internal use; can be preseeded     rescue/enable          # for internal use only     cdrom-detect/cdrom_fs          # Insert formatted floppy in drive     save-logs/insert_floppy          # Translations temporarily not available     localechooser/translation/none-yet          # Keymap to use:     # Choices: American English, Albanian, Arabic, Asturian, Bang...     keyboard-configuration/xkb-keymap          # for internal use; can be preseeded     mouse/device          # for internal use only     cdrom-detect/hybrid          # for internal use only     debconf/translations-dropped          # Country to base default locale settings on:     # Choices: Antigua and Barbuda${!TAB}-${!TAB}en_AG, Australia...     localechooser/preferred-locale          # Choices: Spain, France, other     localechooser/shortlist/eu          # Choices: Argentina, Bolivia, Brazil, Chile, Colombia, Ecuad...     localechooser/countrylist/South_America          # Failed to mount CD-ROM     cdrom-checker/mntfailed          # Retry mounting the CD-ROM?     cdrom-detect/retry          # Choices: Serbia, Montenegro, other     localechooser/shortlist/sr          # Module needed for accessing the CD-ROM:     # Choices:      cdrom-detect/cdrom_module          # for internal use; can be preseeded     preseed/file          # for internal use; can be preseeded     hw-detect/load-ide          # for internal use; can be preseeded     preseed/interactive          # Installation step failed     debian-installer/main-menu/item-failure          # Error while running ''     hw-detect/modprobe_error          # Choices: Pakistan, India, other     localechooser/shortlist/pa          # Use Control+Alt+Backspace to terminate the X server?     keyboard-configuration/ctrl_alt_bksp          # Choices: China, India, other     localechooser/shortlist/bo          # Language:     # Choices: C${!TAB}-${!TAB}No localization, Albanian${!TAB}-$...     localechooser/languagelist          # Installer components to load:     # Choices:      anna/choose_modules_lowmem          # for internal use only     debian-installer/language          # for internal use     keyboard-configuration/variantcode          # Choices: Anguilla, Antigua and Barbuda, Aruba, Bahamas, Bar...     localechooser/countrylist/Caribbean          # Language selection no longer possible     localechooser/translation/no-select          # Failed to copy file from CD-ROM. Retry?     retriever/cdrom/error          # Choices: Afghanistan, Bahrain, Bangladesh, Bhutan, Brunei D...     localechooser/countrylist/Asia          # Write the changes to disk and configure encrypted volumes?     partman-crypto/confirm_nooverwrite          # for internal use; can be preseeded     debian-installer/country          # No valid Debian CD-ROM     cdrom-checker/wrongcd          # Choices: Belgium, Germany, Liechtenstein, Luxembourg, Austr...     localechooser/shortlist/de          # for internal use; can be preseeded     anna/standard_modules          # Failed to process the preconfiguration file     preseed/load_error          # for internal use; can be preseeded     preseed/file/checksum          # Device file for accessing the CD-ROM:     cdrom-detect/cdrom_device          # for internal use; can be preseeded     directfb/hw-accel          # for internal use; can be preseeded     debian-installer/allow_unauthenticated          # Continue the installation in the selected language?     localechooser/translation/warn-severe          # for internal use; can be preseeded     debian-installer/theme          # Choices: American Samoa, Australia, Cook Islands, Fiji, Fre...     localechooser/countrylist/Oceania          # Are you sure you want to exit now?     di-utils-reboot/really_reboot          # Choices: Brazil, Portugal, other     localechooser/shortlist/pt_BR          # for internal use only     debconf/frontend          # for internal use; can be preseeded     debian-installer/exit/halt          # Choices: Belize, Costa Rica, El Salvador, Guatemala, Hondur...     localechooser/countrylist/Central_America          # Keep the current keyboard layout in the configuration file?     keyboard-configuration/unsupported_config_layout          # Compose key:     # Choices: No compose key, Right Alt (AltGr), Right Control, ...     keyboard-configuration/compose          # Method for temporarily toggling between national and Latin ...     # Choices: No temporary switch, Both Logo keys, Right Alt (Al...     keyboard-configuration/switch          # Installer components to load:     # Choices: cfdisk-udeb: Manually partition a hard drive (cfdi...     anna/choose_modules          # Integrity test successful     cdrom-checker/passed          # Manually select a CD-ROM module and device?     cdrom-detect/manual_config          # Terminal plugin not available     debian-installer/terminal-plugin-unavailable          # Insert a Debian CD-ROM     cdrom-checker/askmount          # Additional locales:     # Choices: aa_DJ.UTF-8, aa_DJ, aa_ER, aa_ER@saaho, aa_ET, af_...     localechooser/supported-locales          # for internal use only     cdrom-detect/usb-hdd          # for internal use; can be preseeded     preseed/late_command          # Failed to run preseeded command     preseed/command_failed          # Modules to load:     # Choices:      hw-detect/select_modules          # Keyboard model:     # Choices:      keyboard-configuration/model          # Continue the installation in the selected language?     localechooser/translation/warn-light          # Choices: Aruba, Belgium, Netherlands, other     localechooser/shortlist/nl          # for internal use only     cdrom/codename          # Choices: British Indian Ocean Territory, Christmas Island, ...     localechooser/countrylist/Indian_Ocean          # for internal use; can be preseeded     preseed/boot_command          # Web server started     save-logs/httpd_running          # System locale:     # Choices:      debian-installer/locale          # Choices: Macedonia\, Republic of, Albania, other     localechooser/shortlist/sq          # Country of origin for the keyboard:     # Choices:      keyboard-configuration/layout          # Keymap to use:     # Choices: American English, Albanian, Arabic, Asturian, Bang...     keyboard-configuration/xkb-keymap          # Keyboard layout:     # Choices: English (US), English (US) - Cherokee, English (US...     keyboard-configuration/variant          # Keep default keyboard options ()?     keyboard-configuration/unsupported_options          # Use Control+Alt+Backspace to terminate the X server?     keyboard-configuration/ctrl_alt_bksp          # for internal use     keyboard-configuration/variantcode          # for internal use     keyboard-configuration/optionscode          # for internal use     keyboard-configuration/modelcode          # Keep current keyboard options in the configuration file?     keyboard-configuration/unsupported_config_options          # Keep the current keyboard layout in the configuration file?     keyboard-configuration/unsupported_config_layout          # Method for toggling between national and Latin mode:     # Choices: Caps Lock, Right Alt (AltGr), Right Control, Right...     keyboard-configuration/toggle          # Compose key:     # Choices: No compose key, Right Alt (AltGr), Right Control, ...     keyboard-configuration/compose          # Method for temporarily toggling between national and Latin ...     # Choices: No temporary switch, Both Logo keys, Right Alt (Al...     keyboard-configuration/switch          # Key to function as AltGr:     # Choices: The default for the keyboard layout, No AltGr key,...     keyboard-configuration/altgr          # Keep default keyboard layout ()?     keyboard-configuration/unsupported_layout          # Keyboard model:     # Choices: A4Tech KB-21, A4Tech KBS-8, A4Tech Wireless Deskto...     keyboard-configuration/model          # for internal use     keyboard-configuration/layoutcode          # for internal use     keyboard-configuration/store_defaults_in_debconf_db


title: Lock folder when running cron

text: I am setting up my first cron on a Ubuntu Desktop system. I was curious to know if there is a way to lock a folder before a cron is ran and how to set it up? I am following this article. I am just trying to make sure I don't damage any files when moving them from and to the cron folder because it is on a shared network.


title: Linux nuisance: /dev/stdin doesn't work with sockets

text: Linux has this blitheringly annoying peculiarity that `/dev/stdin` won't work with sockets - it is hardcoded to return ENXIO. Try this:               socat TCP-OPEN:localhost:1234 EXEC:cat\ /dev/stdin,nofork      That's a perfectly reasonable command you'd expect to work, and does on basically every system, except Linux. (I'm using `cat` as a general example of any tool that opens a filename as the only way for you to specify a specific fd to use.) The linux kernel is explicitly written to forbid sensible use of `/dev/stdin` in this way — see http://marc.info/?l=ast-users&m=120978595414993. If you only need unidirectional capability, you can buffer the data in a separate process:               socat TCP-OPEN:localhost:1234 SYSTEM:'cat | thingy /dev/stdin'      It's wasteful, and worse, is useless if `thingy` is meant to be reading and writing to the same fd, because pipes are unidirectional in Linux. What are we meant to do? `/dev/stdin` simply can't be used on Linux for building pipelines with bidirectional pipes, as far as I can tell, because sockets are the only underlying mechanism on Linux that yield a bidi stream with a single fd to read and write from (unlike a pair of pipes).


title: Is there a way to run 'screen' in read-only mode?

text: I'd like to be able to check progress and output of my existing `screen` sessions, but in a read-only manner, so as to prevent something from going wrong due to user error. Is there a way to do this?


title: localhost [127.0.0.1] in email headers

text: I'm using sendmail to send a very simple email from a text file. Here is the text file:               to:test@someaddress.com     from:admin@hostname.tld     subject:Testing          test test test      Which I send with:               sendmail -t < mail.txt      The server I am running sendmail from is hostname.tld. Here is /etc/hosts:               12.34.56.78     hostname hostname.tld     127.0.0.1       localhost      Where hostname.tld is the fqdn of the server and 12.34.56.78 is the public IP of the server. /etc/hostname simply contains hostname.tld When I receive the email, I get this header:               Received: from hostname.tld (hostname.tld [127.0.0.1])      I don't want 127.0.0.1, I want the public IP to be there, but I can't get sendmail to use it no matter what I do. I've also edited /etc/mail/sendmail.mc to have the line:               define(`confDOMAIN_NAME', `hostname.tld')dnl      But it does nothing. I've read so many threads where people have a similar problem but nothing seems to resolve it. What can I do?


title: Bluetooth: Unable to connect internet on laptop from Nokia N73

text: Earlier I had been doing Internet on laptop after connecting my Nokia N73 to laptop via bluetooth. But I'm not clear as to what happened a day that after that time I couldn't connect via bluetooth. Earlier to enable Internet on my laptop I didn't follow any document. I simply got my laptop connected to the cell phone via bluetooth and selected the option on laptop for connecting Internet. Now when there seems to be a problem & many days have passed since I'm unable to connect to Internet via bluetooth, I followed this document. But still I couldn't get it work. Please look at the below files on my laptop which are prepared following the document. (I have included the bluetooth address of the device)               ravbholua@ravbholua-Aspire-5315:/etc/bluetooth$ cat rfcomm.conf     rfcomm0 {     # # Automatically bind the device at startup     bind yes;     #     # # Bluetooth address of the device     device 00:1B:EE:95:BB:09;     #     # # RFCOMM channel for the connection     channel 2;     #     # # Description of the connection     comment "Nokia N73";          rfcomm release 0 # make sure is it not already connected     rfcomm connect 0 # create a connection to rfcomm device 0     }     ravbholua@ravbholua-Aspire-5315:/etc/bluetooth$     ravbholua@ravbholua-Aspire-5315:/etc/bluetooth$ cd /etc/ppp/peers     ravbholua@ravbholua-Aspire-5315:/etc/ppp/peers$ ls     provider  vodafone     ravbholua@ravbholua-Aspire-5315:/etc/ppp/peers$ cat vodafone     # from www.hingston.demon.co.uk/mike/nokia6680.html       noauth     #change this if you move the path to your connect script       connect "/usr/sbin/chat -v -f /etc/chatscripts/vodafone-connect"     #change this if you move the path to your disconnect script       disconnect "/usr/sbin/chat -v -f /etc/chatscripts/vodafone-disconnect"     #I found that I needed this to remove problems with loopback on connecting       silent     #remove this if you don't want lots of information going to /var/log/messages       debug     #this is the device specified in your rfcomm.conf file       dfdf     #speed at which to connect - might be worth trying higher...     # 115200     #this is needed so that a default route is added to your routing table       defaultroute     #this is needed so that you pick up Orange's DNS settings       usepeerdns     ravbholua@ravbholua-Aspire-5315:/etc/ppp/peers$       The below files are exactly the same as in the link.               /etc/chatscripts/vodafone-connect     /etc/chatscripts/vodafone-disconnect      I feel much comfortable to use bluetooth for Internet and also its more speed than using a cable.


title: Cannot remove iwlwifi module, even though interface is down

text: When I run the following two commands, the first one returns without eror, but the second one gives me `FATAL: Module iwlwifi is in use.`               sudo ifconfig wlan0 down     sudo modprobe -r iwlwifi      If bringing the wireless interface down still leave the kernel module in use, what does that imply?


title: Bash script testing if a command has run correctly

text: I am working on a bash script that I would like to work for several types of VCS. I am thinking of testing if a directory is a repo for a system by running a typical info command and checking the return code, success or error. In pseudo code:               if a svn command succeded;         Then run svn commands     elif a darcs command succeded;         Then run darcs commands     elif a mercurial command succeded;         then run hg commands     else          something else     fi      I can run a command, e.g. `darcs show repo` and use `$?` to get its return code. My question is: is there a neat way to run and return the return code number in one line? for example               if [ 0 -eq `darcs show repo`$? ];       Or do I have to define a function? An added requirement is that both stderr and stdout should be printed.


title: ZFS Snapshot to file as Backup with rotation

text: I have a local FreeNAS system and want to use ZFS snapshots for backups.   FreeNAS has the built-in Replication Tasks which use               zfs send snapshot_name      to send a snapshot to a remote system. But this needs a system with ZFS on the other end. I want to send the snapshot to a a file and send this compressed and encrypted file to the remote machine. This is possible with               zfs send snapshot_name | gzip | openssl enc -aes-256-cbc -a -salt > file.gz.ssl      Everyday I make a snapshot of the storage pool and keep every snapshot for 30 days.   With every snapshot taken I'll pipe this snapshot to a file.   - snapshot_file 1 has every file in it (let's say 2GB)   - snapshot_file 2 only has the changes to snapshot_file 1 (let's say 5MB)   - snapshot_file 3 holds the changes to snapshot_file 2; and so on. On day 31 snapshot_file 1 is getting deleted (because I only want the changes from the last 30 days) Therefore snapshot_file 2 needs to hold every file (2GB of snapshot_file 1 + 5MB changes) But with this approach everyday (from day 31 on) a new 2GB file has to be created and send to a remote system. This is too much overhead. What would be the best approach to use snapshots piped to a file as a backup strategy with a history of X days? P.S.: I know there are a lot of backup software out there (rdiff-backup for example), which I could use. But I am curious how this could be done.


title: What do these errors mean in sysbench disk test?

text: I have been running a continuous test of sysbench disk tests on my Linux system that uses compact flash. I am seeing some errors in the output, as shown below. What do these errors mean exactly? Do they mean that some of the disk reads failed? The part itself is an industrial grade part and supports SMART, and SMART reported no unrecoverable ECC failures. The command I was using to run the test was:               while true; do sysbench --num-threads=16 --test=fileio --file-total-size=3500M --file-test-mode=rndrw prepare; sysbench --num-threads=16 --test=fileio --file-total-size=500M --file-test-mode=rndrw run; sync; sysbench --num-threads=16 --test=fileio --file-total-size=3500M --file-test-mode=rndrw cleanup; done      Sample output:               sysbench 0.4.12:  multi-threaded system evaluation benchmark          128 files, 28000Kb each, 3500Mb total     Creating files for the test...     FATAL: Failed to write file! errno = 28 (¦?¦)     sysbench 0.4.12:  multi-threaded system evaluation benchmark          Running the test with following options:     Number of threads: 16          Extra file open flags: 0     128 files, 3.9062Mb each     500Mb total file size     Block size 16Kb     Number of random requests for random IO: 10000     Read/Write ratio for combined random IO test: 1.50     Periodic FSYNC enabled, calling fsync() each 100 requests.     Calling fsync() at the end of test, Enabled.     Using synchronous I/O mode     Doing random r/w test     Threads started!     FATAL: Failed to read file! file: 127 pos: 2965504 errno = 0 ()     FATAL: Failed to read file! file: 127 pos: 540672 errno = 0 ()     FATAL: Failed to read file! file: 130 pos: 655360 errno = 0 ()     FATAL: Failed to read file! file: 129 pos: 2441216 errno = 0 ()     FATAL: Failed to read file! file: 129 pos: 475136 errno = 0 ()     FATAL: Failed to read file! file: 128 pos: 2588672 errno = 0 ()     FATAL: Failed to read file! file: 126 pos: 2588672 errno = 0 ()     FATAL: Failed to read file! file: 127 pos: 2899968 errno = 0 ()     FATAL: Failed to read file! file: 125 pos: 3309568 errno = 0 (T¦v¦)     FATAL: Failed to read file! file: 126 pos: 49152 errno = 0 (¦v¦0R0¦¦¦v¦R0¦¦u¦¦Q0¦T¦Q0¦T¦v¦)     FATAL: Failed to read file! file: 125 pos: 1097728 errno = 0 ()     FATAL: Failed to read file! file: 126 pos: 606208 errno = 0 ()     FATAL: Failed to write file! file: 125 pos: 3440640 errno = 28 ()     FATAL: Failed to wrisysbench 0.4.12:  multi-threaded system evaluation benchmark


title: Is it possible to configure applications to use different network interfaces differently? If yes, how?

text: I am running scrapy on ubuntu server 13. And while it is crawling the network becomes very slow and it becomes difficult to even ssh into the system. I think I can solve the problem by having one more network interface card connected to a different router that scrapy doesn't use. Is it possible? How?


title: perl one liner + how to replace any last IP address octets

text: How to replace any last IP address octets (four octet ) to 0 remark: Implementation should be by Perl one linear on linux machines for example                     192.9.200.124 will replaced to 192.9.200.0      full example: IP address before change:                 more file            10.140.4.10 10.140.4.10        192.9.201  192.9.201        44.44.44 44.44.44       100.100.1  100.100.1       10.140.4.11 10.140.4.11       45.0.0  45.0.0       10.219.39.188 10.219.39.188       10.219.39.189 10.219.39.189       10.140.4.12  10.140.4.12       10.219.39.138 10.219.39.138        10.219.39.139 10.219.39.139       Expected results (IP address after changing)                more file           10.140.4.0  10.140.4.0      192.9.201  192.9.201       44.44.44 44.44.44       100.100.1  100.100.1       10.140.4.0 10.140.4.0      45.0.0 45.0.0       10.219.39.0 10.219.39.0       10.219.39.0  10.219.39.0      10.140.4.0 10.140.4.0       10.219.39.0 10.219.39.0       10.219.39.0 10.219.39.0


title: Support for old network cards in lightweight distros?

text: I'm planning to revive and old desk pc, but it is hard for me to choose a distro. My problem is to find a distro that has a good support for old hardware, especially of network cards for wireless connections. I, a long time ago, installed Ubuntu on that pc and my only problem was that I couldn't make the internet work (i.e. make the computer detect wireless networks to select mine), so I stayed away from Linux that time. Now I want to install Linux on that old machine for basic tasks: writing simple documents and (especially) surfing the web. Since the computer is going to be used by my aunt, who has zero knowledge of computers, I need the distro to be friendly. I have finally come to three names that match my needs: Lubuntu, Zorin OS lite and LXLE. So which, to the best of your knowledge, is better supported for old network cards? **NOTE:** I have been a Linux user for the last six months (openSUSE), so I have some idea how to move here. However don't assume I know a lot ;)


title: Window display table and buffer display table conflict in Emacs

text: _In Emacs;_ Is there a way for both `window-display-table` and `buffer-display-table` to have effect at the same time? The reason is, I'm using _Pretty-Control-L_ (from _Emacs Goodies El_ script package) and _whitespace_ (of `whitespace.el`, I think it is in the base Emacs distribution, but I’m not sure).   * **_Pretty-Control-L_** visualizes form-feeds (`^L`) in a customized manner, by setting the entry for `C-l` in the window-local **`window-display-table`**.   * **_Whitespace_** visualizes spaces, tabs and newlines by setting entries in the buffer-local **`buffer-display-table`**. (and also by using `font-lock` functionality). These uses clashes (or rather, the use of a `window-display-table` and `buffer-display-table` clashes) since, if the `window-display-table` is non-`nil` it completely overrides any `buffer-display-table` for any buffer displayed in that window. Quote from the _Emacs Lisp_ manual: > ## 38.21.2 Active Display Table > > Each window can specify a display table, and so can each buffer. When a > buffer B is displayed in window W, display uses the display table for window > W if it has one; **otherwise** , the display table for buffer B if it has > one; otherwise, the standard display table if any. The display table chosen > is called the "active" display table. > > [...] (emphasis by me) So, Is there any easy way to consolidate this? Or is the only way to re-code one of them to use the same mechanism as the other? I've been considering writing a small (i.e. even smaller) crude variant of the form-feed visualization compatible with the white-space visualization that just uses some buffer-loading hook (or other) to put a hard-coded entry for `^L` in the `buffer-display-table`. But I’d like to know if there’s any simpler alternative.


title: Need advice for tools to use in everyday workflow

text: I am an open source web developer that has decided to transition away from using the Microsoft stack as the center of my everyday workflow and dive into Linux for my primary workstation. As I am new to Linux, I would like to know from Linux experts what the most valuable tools are available for common (and not so common) tasks from a web developer's perspective. The best online resources to learn those tools would also be very helpful.


title: receiving command as a parameter in bash

text: I have a following simple script called single-instance that executes the given command if there is no process under that command running. If I hard- code the command after the else statement, it has no trouble running, but if I substitute the hard-coded command with $1 or $@, I get no new instance of the command. Is there a security mechanism in bash to prevent such command?               #!/bin/bash     if ps ax | grep -v grep | grep $1 > /dev/null;then         wmctrl -xa $1     else         # works fine if I switch $1 to terminator         $1     fi      The if statement part works fine. I only get one instance of the process as long as I invoke it using this script.


title: Issue with Hugepage reservation in linux

text: I have reserved hugepages for my process using below commands:               #echo 64 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages     #mkdir -p /mnt/huge  && mount -t hugetlbfs nodev /mnt/huge .      And I have placed it in `rc.local` file. After machine reboot, huge pages reserved successfully and `/mnt/huge` created. But before my process startups, I could see 21 hugepages are not available for reservation. Below command output:               # cat /proc/meminfo | grep Huge      HugePages_Total: 64      HugePages_Free: 43      HugePages_Rsvd: 43      HugePages_Surp: 0      Hugepagesize: 2048 kB       And no results for the below commands:               # lsof |grep /mnt/huge      [root@CLA-0(11) /root]       Then I tried to free hugepages ...               # echo 0 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages       No error message displayed. But below command output tells no change ..               # cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages       0       But I could see if we `echo > 64` it updates nr_hugepages. Also tested with other numbers, it only updates if value is greater then current value in nr_hugepages. I am looking for below clarification in this site:   1. 43 hugepages are free , who requested 21 hugepages allocation out of 64.    2. Why `echo 0 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepage` is not updating nr_hugepages  Linux Kernel               # cat /proc/version      Linux version 2.6.34.13-WR4.3.x86_64_fbsa_standard-00038-gc4b8cb8 (gcc version 4.4.1 (Wind River Linux Sourcery G++ 4.4a-431) ) #1 SMP Wed Jan 8 20:40:41 EET 2014


title: What's the best way to take a segment out of a text file?

text: What's a good way of extracting say, lines 20 -45 out of a huge text file. Non-interactively of course!


title: Gconf profiles personalized with environment variables

text: What is best practice for creating mandatory or default gconf-profiles using the users environment variables. That would make it easy to maintain system- wide profiles and distribute profiles in a corporate network. For an example, I want to use a Gconf key where some information is defined by environment variables, the key `/apps/evolution/mail/accounts` and `$USER`/`$USERNAME`:               [<?xml version="1.0"?>     <account name="$(USER)@example.com">     <identity>         <name>$(USERNAME)</name>         <addr-spec>$(USER)@example.com</addr-spec>     </identity>     <source>       <url>imap://$(USER)%     40example.com@imap.example.com/;;use_ssl=when-possible      </url>     </source>     <transport save-passwd="true">             <url>smtp://$(USER)%40smtp.example.com;;use_ssl=when-possible</url>     </transport>          </account>     ,     ]      I believe that I need a subsystem that processes template profiles into something `gconfd` can use. I have tried desktop-profiles and sabayon without any luck. Evoldap-backend works only for evolution and feels a little overkill even if I end up with LDAP / Gosa or LDAP / phamm for authentication. Mail, IM and VoIP / Telepathy uses only information that is easy reachable from GECOS (/etc/passwd) and standard login environment. It feels more robust to administer one system-wide template than a profile per user.


title: How to replace all percent-encoded UTF-8 substrings with plain UTF-8 text?

text: I've got a html file with a lot of %-encoded UTF-8 text in URLs. For example "%D1%80%D0%B5%D1%81%D1%83%D1%80%D1%81%D1%8B" stands for "ресурсы" ("resources" in Russian). The task is to replace all such substrings with readable UTF-8 text. To simplify the task we can consider there is no other `%` sign usage in the file. Letter digits can be both upper and lower case. I suspect this can be done elegantly with `sed`, `perl`, `awk` or something but don't know how. This web application seems to do the trick with text you paste there.


title: Is there a tmux equivalent of "screen -D -R"

text: I would like to know if there is a way to get `tmux` to behave like `screen -D -R` so I could say, have the command as a default command in Putty. These `screen` switches would force detach of an existing screen session for my user (even if it was still active and logged-in somewhere else) and reattach it to the current session. Also, in the case that no screen session existed, it would create a new one. I like tmux and can see clear benefits over screen, but the existence of this feature would really seal the deal. `tmux attach` doesn't seem to create a new session if there isn't one. The man page for tmux says: > If no server is started, attach-session (attach) will attempt to start it; > **this will fail unless sessions are created in the configuration file.** What does the section in bold mean? (I can't find an example of creating a session in the conf file).


title: Set gtk-application-prefer-dark-theme as a user setting

text: Is there a way to set gtk-application-prefer-dark-theme for an application? This is normally set in the code by the application. Apps such as Eye of Gnome and Totem turn it on. I want to, as a user turn it on, on a per application bases. For gnome-terminal, I normally use a white text on black background color scheme, and having the dark window border would improve the overall look. I also want to turn it on for vlc.


title: Replacing lines in files with file contents

text:
I have several files which contain some PHP `include`s and I want to substitute them with the file contents. The file looks like               foo     <?php     include("file1.php");     ?>     bar     baz     <?php     include("file2.php");     include("file3.php");     ?>     more content      So after `foo` should be the content of file1.php and after `baz` should be first content of file2.php followed by file3.php. I want also remove the `<?php` and `?>` tags in both cases. What is a good way to resolve this? Assume the following file contents:   1. `file1.php`: is empty   2. `file2.php`: `<p>Hello`   3. `file3.php`: `World</p>` So the resulting file should look like:               foo     bar     baz
Hello     World
     more content      The word `foo`, `bar` etc. are just expletives within the real file there could be any text.


title: How to know when and which user logged into the system under Mac OS X? Last is not enough!

text: In Mac OS X, if I don't touch it for a while, it will lock the screen and one must use password to unlock it, but this kind of log in is not recorded by last command. I want to know if anybody tried to break into my MacBook when I am not in front of it. Is there any way I can log such attempts?


title: Bash Reuse Process Substitution File

text: I have a big script which takes a file as input and does various stuff with it. Here is a test version:               echo "cat: $1"     cat $1     echo "grep: $1"     grep hello $1     echo "sed: $1"     sed 's/hello/world/g' $1      I want my script to work with process substitution, but only the first command (`cat`) works, while the rest don't. I think this is because it is a pipe.               $ myscript.sh <(echo hello)      should print:               cat: /dev/fd/63     hello     grep: /dev/fd/63     hello     sed: /dev/fd/63     world      Is this possible?


title: How can I have screen transmit an audible bell produced in a background window?

text: I managed to replace the audible bell by a visual clue in the active window, but for background windows, can I get an audible bell instead of a visual notification ?


title: Change tracking in OpenOffice?

text: If e.g.: I delete/modify a few words in a .doc file that is edited with OpenOffice how can I highlight those changes? Under microsoft office it works pretty good. Where is this feature in OpenOffice?


title: Can I use divert as an alternative to ipfw fwd?

text: I would like to lead some traffic through a transparent proxy (which actually is on another server and connected with an ssh tunnel). Normally I could do this:               ipfw add forward localhost,8080 tcp from any to x.x.x.x 80      However, fwd/forward needs a re-compile of the kernel, which I am not happy to do. Therefore, I'm searching for a solution that doesn't need a recompile. For example, could I somehow use a divert socket to implement this? Or are there any other basic good solutions?


title: Extract only a specific file from a zipped archive to a given directory

text: I need to pull a single file from a ZIP file which I know the path to. Is there a command like the following: unzip -d . myarchive.zip path/to/zipped/file.txt Unfortunately, the above command extracts and recreates the entire path to the file at `./path/to/zipped/file.txt`. Is there a way for me to simply pull the file out into a specified directory?


title: ability to view browser view for html file from vim

text: Is there a plugin / program / key binding that will let me preview html files that I am editing in vim in a browser? Background: I have abandoned traditional full-feature editors and IDE's (of which I was once a big fan!). As time has gone by I've realized that most of the skills and knowledge isn't transferable. So now I stick with vim, tmux and the like. btw I need high visibility so I need panes not tabs. I'm not looking for the best tool. Any one would do. Maybe it can be done with a key binding?


title: GLib-GObject-WARNING: Core dump when running Inkscape on Ubuntu 13.04

text: On two different computers, Inkscape sometimes crashes with the following error messages:               (inkscape:2536): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkBin'     (inkscape:2536): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GtkBin'     (inkscape:2536): GLib-GObject-WARNING **: invalid cast from `GtkLabel' to `GtkBin'     [...]     Segmentation fault (core dumped)      I googled the error messages but could not find any satisfying answers. Any ideas?


title: mount.nfs: access denied by server while mounting on Ubuntu machines?

text: I am a linux newbie and I have a very basic question. I have three machines in production -               machineA    10.66.136.129     machineB    10.66.138.181     machineC    10.66.138.183      and all those machines have Ubuntu 12.04 installed in it and I have root access to all those three machines. Now I am supposed to do below things in my above machines -               Create mount point /opt/exhibitor/conf     Mount the directory in all servers.      sudo mount <NFS-SERVER>:/opt/exhibitor/conf /opt/exhibitor/conf/      I have already created `/opt/exhibitor/conf` directory in all those three machines as mentioned above. Now I am trying to create a Mount Point. So I followed the below process - Install NFS support files and NFS kernel server in all the above three machines               $ sudo apt-get install nfs-common nfs-kernel-server      Create the shared directory in all the above three machines               $ mkdir /opt/exhibitor/conf/      Edited the `/etc/exports` and added the entry like this in all the above three machines -               # /etc/exports: the access control list for filesystems which may be exported     #               to NFS clients.  See exports(5).     #     # Example for NFSv2 and NFSv3:     # /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)     #     # Example for NFSv4:     # /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)     # /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)     #     /opt/exhibitor/conf/     10.66.136.129(rw)     /opt/exhibitor/conf/     10.66.138.181(rw)     /opt/exhibitor/conf/     10.66.138.183(rw)      I have tried mounting on machineA like below from machineB and machineC and it gives me this error-               root@machineB:/# sudo mount -t nfs 10.66.136.129:/opt/exhibitor/conf /opt/exhibitor/conf/     mount.nfs: access denied by server while mounting 10.66.136.129:/opt/exhibitor/conf          root@machineC:/# sudo mount -t nfs 10.66.136.129:/opt/exhibitor/conf /opt/exhibitor/conf/     mount.nfs: access denied by server while mounting 10.66.136.129:/opt/exhibitor/conf      Did my `/etc/exports` file looks good? I am pretty sure, I have messed up my `exports` file. As I have the same content in all the three machines in exports file. Any idea what wrong I am doing here? And what will be the correct `/exports` file here?


title: Specific Jar file doesn't run on startup

text: I want to run a jar at startup, so I asked a question here. I was given a few suggestions, so I started from trying to create a script file and desktop file. I created a script file and desktop file and placed the script file in `/usr/bin` and the desktop file in `/etc/xdg/autostart`. The script file and desktop files are as follows: Script: suscript               #!/bin/bash            ### BEGIN INIT INFO       # Provides:          suscript       # Required-Start:    $remote_fs $syslog       # Required-Stop:     $remote_fs $syslog       # Default-Start:     2 3 4 5       # Default-Stop:      0 1 6       # Short-Description: Start daemon at boot time       # Description:       Enable service provided by daemon.       ### END INIT INFO            java -jar /etc/ready/ready.jar       Desktop file: su.desktop               [Desktop Entry]       Name=su       Exec=/usr/bin/suscript       Type=Application       Terminal=false        But it did not work. So I thought of testing and created a jar file which does nothing but display a message dialog with string "success". I followed the same procedure but it worked fine. When i rebooted my system, the message dialog appeared. The script and desktop files are as shown below: Script: sutscript               #!/bin/bash            ### BEGIN INIT INFO       # Provides:          sutscript       # Required-Start:    $remote_fs $syslog       # Required-Stop:     $remote_fs $syslog       # Default-Start:     2 3 4 5       # Default-Stop:      0 1 6       # Short-Description: Start daemon at boot time       # Description:       Enable service provided by daemon.       ### END INIT INFO            java -jar /etc/ready/Start.jar       Desktop file: sut.desktop               [Desktop Entry]       Name=sut       Exec=/usr/bin/sutscript       Type=Application       Terminal=false       After creating the scripts I changed the permission using `chmod +x /path/to/script` for both scripts. The test script works fine but not my original script. I also tried changing the permissions for jar files. Same results. But when I run `suscript` or my jar file from terminal it runs fine. No exceptions or errors occur. I tried these in Ubuntu 14.04 (Trusty) and Linux Mint (Cinnamon).


title: Elementary OS System Settings has disappeared

text: I don't know how this happen. Part of the system setting has disappeared. How have any idea to restore them ? ![enter image description here](http://i.stack.imgur.com/93r6Z.png)


title: Wireless connection not figuring in VMware Workstation 10(Kali-Linux)

text: I just installed **kali-linux** on my **VMware workstation 10**. I had to check for the wireless connection in the kali-linux. I tried to check for the **wireless-network connection(WiFi)** ;but,it was incorrectly identifying the wireless-network as an **Ethernet-connection(eth 0)**. How can this be resolved? I just googled for it and came to know that one can't evaluate the wireless network connection in Virtual Machines. I might sound like nerd, but, I really want to know why exactly is this so; and,if this is a **short-coming of Virtual Machines** ; why don't the bigger giants like VMware/Oracle,etc. figure this out and correct it? Please list the reasons along with some useful resources,if possible. Thanks for giving the time to study the whole question with patience.


title: Error while Compiling Subversion with a custom-compiled Apache on a shared server

text: Am using a RHEL 5.5 shared server, my user has complete access to /opt folder.   No root access, cant write to /etc, /usr etc.   So, I downloaded httpd-2.4.6 and httpd-2.4.6-deps onto /opt (ie. /opt/httpd-2.4.6)   I installed Apache on /opt/httpd.   By using `./configure --prefix=/opt/httpd --with-included-apr`   It installed and worked w/o any issues. Then, I wanted to setup this Apache with mod_dav_svn, So i downloaded subversion 1.6.23(i prefer svn 1.6) from Apache site.   But when i compile subversion with   `./configure --prefix=/opt/svn --with-apr=/opt/httpd/bin/apr-1-config --with- apr-util=/opt/httpd/bin/apu-1-config --with-ssl --with- apxs=/opt/httpd/bin/apxs` I got this error:               checking whether Apache version is compatible with APR version... no     configure: error: Apache version incompatible with APR version      I googled on the error, which mentioned i need to use latest version of APR, but the apr i used was from the httpd-2.4.6-deps.tar.bz2   I checked the version in /opt/httpd-2.4.6/srclib/apr/CHANGES, it was 1.4.8, Isnt it latest? Can anyone tell me whats the source of the issue?


title: How can I determine a file's conventional filename extension

text: The `file` command is good at determining file types for my needs. Is there any way to map those results to conventional filename extensions?


title: Which system calls could create a new process?

text: When executing `ps` command in my Linux system i see some user processes twice (different PID...). I wonder if they are new processes or threads of the same process. I know some functions in standard C library that could create a new process such `fork()`. I wonder what concrete functions can make a process appear twice when i execute `ps` command because i am looking in the source code where the new process or thread is created.


title: How to capture data transferred on a PTY?

text: I am running NetBSD 6.1.4, and I have an stunnel instance with the following configuration:               [https service]     accept = 443     CAfile = /u01/usbtether/CA/certs/rootCA.crt     cert = /usr/pkg/etc/stunnel/stunnel.pem     pty = yes     exec = /usr/sbin/pppd     execargs = pppd call phone     verify = 2     client = no      Everything works nicely, except for an ever increasing rx error count on the other side. I want to compare the ppp traffic before and after it leaves the stunnel. My strategy thus far is to use socat. I changed the exec lines to point to a shell script like               #!/bin/sh     socat -,echo=0,raw SYSTEM:'tee /root/pppd-in.log | socat -,echo=0,raw EXEC:"/usr/sbin/pppd call phone" | tee /root/pppd-out.log'      But I cannot seem to get my ducks in a row. I've managed to loopback everything the other pppd sends, or ignore everything the other pppd sends, but I cannot get the syntax right to actually pass the data between stunnel and pppd while also dumping input and output to a file(although I only care about output). I've also tried               #!/bin/sh     /usr/sbin/pppd call phone | tee /root/serial-out.log      But I just seem to send gibberish back to the calling pppd (I assume the pipe through tee is like not including raw in socat?). So what is the best way to snoop on the data in a PTY? For added interest, the data I receive on the other side of the stunnel is occasionally scrambled a little bit. For example, I may receive a ppp frame with an IP packet of length 100, followed by a 0x7e, and 10 additional bytes. Another frame, (which may have arrived several frames before or after the frame with extra bytes) will arrive with an IP packet that is missing 8 bytes. If I were to take that extra chunk and tack it onto the end, I would have, presumably, the correct IP packet plus the FCS. My intention with the PTY snoop is to verify if pppd is sending the data like that (since the missing chunk is always preceded by a 0x7e byte, I think this is likely), or if something weird is happening in transit.


title: Adding a network card to the modprobe file

text: I'm trying to setup an ADSL connection on an Arch Linux machine. I read the Arch wiki article on Internet Access, but I'm still confused -- how do I add my network card to the `modprobe` file?


title: Is a ? treated in a special way in parameter expansion?

text: I'm attempting to parse to output from `git status --porcelain -b` for use in my prompt but I'm coming across strange behaviour when performing parameter expansion. This snippet should demonstrate the issue:               #!/bin/bash     IFS=$'\n'     touch ab     status_arr=( $(git status --porcelain -b) )     for (( i=0; i<${#status_arr[@]}; i++ )); do         echo ${status_arr[$i]}         echo ${status_arr[$i]:0:2}     done      When run in a clean git directory, I get this output:               $ . sandbox/statusline/issue.sh      ## master...origin/master     ##     ?? ab     ab      I would expect `??` to be echoed on line 4 of the output and indeed if I change the script to `touch abc` or even `touch a`, that is what I get. I'm really confused by this, I guess I must be missing something obvious in bash but google isn't yielding anything useful. If this is a known "thing", is there a way I can get around it/avoid it completely?


title: Generating a Linux executable with Mono with mkbundle

text: A C# file in mono can be compiled using `gmcs` command. This will create a `hello.exe` file.               $ gmcs hello.cs     $ ls     hello.cs  hello.exe     $ ./hello.exe     Hello from Mono!      To generate a linux executable, I tried this command, but it generates the error:               $ gmcs /t:exe hello.cs /out:hello          Unhandled Exception: System.ArgumentException: Module file name 'hello' must have file extension.      I want create a standalone executable so that I can execute it simply run it by saying and I get the desired output:               $ ./hello     Hello from Mono!      I searched and found a solution which mentions of a tool called mkbundle:               $ mkbundle -o hello hello.exe --deps     Sources: 1 Auto-dependencies: True     embedding: /home/ed/Projects/hello_world/hello.exe     embedding: /mono/lib/mono/1.0/mscorlib.dll     Compiling:     as -o /tmp/tmp54ff73e6.o temp.s     cc -o hello -Wall temp.c `pkg-config --cflags --libs mono` /tmp/tmp54ff73e6.o     Done          $ ls -l     total 3     -rwxr-xr-x  1 ed users 1503897 2005-04-29 11:07 hello     -rw-r--r--  1 ed users     136 2005-04-29 11:06 hello.cs     -rwxr-xr-x  1 ed users    3072 2005-04-29 11:06 hello.exe      This utility does not seem to exist in my Mono install. I found that this is available in `mono-devel` package. To install this package meant installing around 82 other packages. My goal was to keep my mono install minimal until sometime. Is there a way to install `mkbundle` standalone?


title: Bought Wireless Adapter, Can't Use It

text: I bought a cheap Aztech WL572USB Wireless-N USB Adapter. It clearly says it supports linux on the documentation but strangely doesn't even provide any way to set it up. I assumed it's plug-n-play but it didn't work, neither on my physical machine (I turned built-in wireless card off using `Fn`+`F2`) nor on the intended Kali Linux Virtual Machine, the VMware says: "Connect Ralink Wireless Adapter" and when I do, I still can't see a wireless interface on `ifconfig` or `iwconfig`. how can I get this to work? Here's an Aztech doc with two important information: LINK It says it supports Linux, and it says it uses the Chipset: Ralink RT5370 Notes:   * Physical PC OS: Linux Mint Debian Edition.   * Virtual Machine OS: Kali Linux (target device).   * Virtualization: VMware.


title: What does the syntax on this shell command with extglob mean?

text: In Building paths robustly, A solution is proposed that includes:               shopt -s extglob; dir="${dir//+(\/)//}"      Can someone explain (parse) that for me? I understand what it's doing, but not how the syntax works.


title: "bash: [: : integer expression expected"

text: I want this function to return one random word if there aren't any command- line arguments. I am modifying linuxconfig.org's random-word generator to run even when #$ -ne 1.               function random-word {         if [ $# -eq 0 ] ;         then              echo "I only take one argument, dummy"             # previously was exit 0         fi              # Constants          X=0         ALL_NON_RANDOM_WORDS=/usr/share/dict/words              # total number of non-random words available          non_random_words=`cat $ALL_NON_RANDOM_WORDS | wc -l`               # while loop to generate random words           # number of random generated words depends on supplied argument          while [ $X -lt "$1" ]          do          random_number=`od -N3 -An -i /dev/urandom |          awk -v f=0 -v r="$non_random_words" '{printf "%i\n", f + r * $1 / 16777216}'`          sed `echo $random_number`"q;d" $ALL_NON_RANDOM_WORDS            let "X = X + 1"          done      The statement executes, but there's a bash error:               $ bob     I only take one argument, dummy     bash: [: : integer expression expected      How do I fix this so the bash error won't display?


title: Suddenly I have troubles plotting with python

text: I have a code that I used yesterday to generate plots. Today, when I tried to use it (with the same input as yesterday), I get an error: > QGtkStyle was unable to detect the current GTK+ theme. There was an update to the system (arch linux) that I ran today that is probably related. Also, I have removed some xfce4 libraries from my machine. How can I fix this?


title: What's the limit on the no. of partitions I can have?

text: I would like to know how many `Primary` and `Extended Partitions` I can create on a x86_64 PC with Linux running on it? * * * **Update** :   If there is a limit to the number of partitions, why is that the limit?


title: Version Error Integrating PowerBroker Identity Services and Samba on ubuntu

text: I am trying to use PBIS (formally likewise open) to enable me to limit permissions on shares to certain AD groups. When I run the command `samba- interop-install --install` I get the following error                  Found smbd version 4.1.6-Ubuntu     Unsupported smbd version 4.1.6-Ubuntu     Error: ERROR_PRODUCT_VERSION         I am running:   * The latest version of PBIS from http://download1.beyondtrust.com/Technical-Support/Downloads/PowerBroker-Identity-Services-Open-Edition/?Pass=True   * Ubuntu 14.04.1 LTS   * Samba version `Version 4.1.6-Ubuntu`    From what I can find on the internet this is a common issue with version 4.x of samba. I am wondering if anyone has had luck setting up this type of environment and if so what steps they needed to take.    **Update:** I have successful validated the installation of PBIS by logging in an AD user over SSH


title: libvirtd not suspending guests

text: My guests, one windows, one linux, are not being suspended. I'm not sure why. Here's the output of `systemctl`, which looks wrong, but I've done `systemctl start libvirt-guests && systemctl enable libvirt-guests`               libvirt-guests.service                  loaded active exited    Suspend Active Libvirt Guests     libvirtd.service                        loaded active running   Virtualization daemon      and possibly some related logs?               Oct 05 12:06:27 slave-vi libvirtd[353]: End of file while reading data: Input/output error     Oct 05 12:06:27 slave-vi libvirtd[353]: internal error: End of file from monitor     Oct 05 12:06:27 slave-vi libvirtd[353]: internal error: End of file from monitor      I'm not sure what to look for at this point, or what possibly to try?


title: Which USB slot is 2.0 or 3.0? How do I know?

text: I would like to know if my desktop computer supports `USB 3.0`, but from the output below this seems unlikely. I get the following output from `lspci`:               root@liv-HP-Compaq-dc7900:/home/liv# lspci -v | grep -i usb     00:1a.0 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #4 (rev 02) (prog-if 00 [UHCI])     00:1a.1 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #5 (rev 02) (prog-if 00 [UHCI])     00:1a.2 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #6 (rev 02) (prog-if 00 [UHCI])     00:1a.7 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB2 EHCI Controller #2 (rev 02) (prog-if 20 [EHCI])     00:1d.0 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #1 (rev 02) (prog-if 00 [UHCI])     00:1d.1 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #2 (rev 02) (prog-if 00 [UHCI])     00:1d.2 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB UHCI Controller #3 (rev 02) (prog-if 00 [UHCI])     00:1d.7 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB2 EHCI Controller #1 (rev 02) (prog-if 20 [EHCI])      And from `lsusb`:               root@liv-HP-Compaq-dc7900:/home/liv# lsusb      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 002: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n     Bus 004 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver     Bus 002 Device 004: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) 64MB QDI U2 DISK      Following All USB ports detected as USB 1.0, not USB 2.0, I'm also posting output of `lsusb -t`:               root@liv-HP-Compaq-dc7900:/home/liv# lsusb -t     /:  Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M     /:  Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M     /:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M     /:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M     /:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M         |__ Port 2: Dev 2, If 0, Class=HID, Driver=usbhid, 12M         |__ Port 2: Dev 2, If 1, Class=HID, Driver=usbhid, 12M         |__ Port 2: Dev 2, If 2, Class=HID, Driver=usbhid, 12M     /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M     /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/6p, 480M         |__ Port 5: Dev 6, If 0, Class=stor., Driver=usb-storage, 480M     /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/6p, 480M         |__ Port 3: Dev 2, If 0, Class=vend., Driver=ath9k_htc, 480M      Do I understand correctly that only two slots support USB 2.0? And if so, how can I pinpoint exactly which physical slot supports USB 2.0?


title: iptables on tor exit node

text: I want to run an open Tor router. My exit policy will be similar to ReducedExitPolicy. But I also want to make it hard for the tor network to abuse my resources. Cases I want to prevent clients from doing via Tor:   * Hammering one site with very many packets.    * Aggresive netscans of whole IP blocks Cases I do NOT want to prevent clients from doing via Tor:   * uploading a few hudreds of image files to the cloud   * seeding a torrent My question is, can this be done at all, and how? My first thought was some firewall (Linux/iptables or *BSD/ipfw/pf) - but this will probably be useless due to inherent properties of the Onion router. Is there any ongoing torproject team development on this topic? I also ask for general hints on securing Tor exit nodes. ## Update (Sep 2012) From helpful answers and some other research I think this can not be done. The best you can do to stop people from abusing exit node to contribute in DDOS, is to detect very frequent packets directed to one IP. The "very frequent" threshold depends on total node bandwidth... If it is wrong, there will be false positives, blocking legitimate traffic of realtime TCP apps and traffic sourced from very many clients to one destination.


title: Running script before shutdown seemingly not working

text: I created a small script `backup_files.sh` and placed it in `/etc/init.d`:               #/bin/sh     logfile=/media/verbatim/log     date >> $logfile     rsync -av /home/philipp/Documents /media/verbatim/ >> $logfile      I would like this script to be executed whenever the computer is rebooted or shut down, so I did the following:               sudo ln -s /etc/init.d/backup_files.sh /etc/rc0.d/backup_files.sh     sudo ln -s /etc/init.d/backup_files.sh /etc/rc6.d/backup_files.sh      Moreover, I made the script executable:               sudo chmod +x /etc/init.d/backup_files.sh      I tried the script "manually" and it worked just fine. However, if I shutdown or reboot my computer, it is apparently not executed. Does anybody see what I'm doing wrong? Note: I'm using Xubuntu 11.10.


title: Configurations needed to be done post GCC compilation and installation

text: I have compiled the latest GCC 4.7.0, on my Linux Mint 12, using gcc 4.6.1 (default).   Compiler compiled successfully, steps followed   1. ./configure   2. make   3. make install Binaries of gcc-4.7.0 are in /usr/local/bin/ after install step. Now the goal is to make the new compiler the default while also keeping the old one around(no uninstall) i.e. I want to be able to do gcc a.c or g++ a.cpp directly in the terminal window.   I have been unable to find a proper series of steps that would help me accomplish this.      Also, doing /usr/local/bin/g++ hello-world.cpp generates iostream file/directory not found. Any help is appreciated.


title: How to change Firefox language?

text: I have a Scientific Linux on my notebook (installed with German language). I installed Firefox with a simple "yum install firefox". But I need Firefox with Hungarian language. How can I configure Firefox to use Hungarian language? (menus, etc. ) ps.: no, the tools->contents->change language didn't helped in Firefox.


title: Multiple subnets on multiple virtual interfaces with one physical interface

text: I have a Ubuntu pc with one interface -- `eth0` -- which is connected to an unmanaged switch which is linked to two subnets: `192.168.0.0/24` and `192.168.1.0/24`. I want to have two virtual interfaces with different MAC's on Ubuntu pc to connect to both the subnets (each virtual interface is connected to a different subnet). I do not want an alias (eth0:0), because I also want to add default gateways (192.168.0.1 and 192.168.1.1) of both subnets. What I want is something like another dumb virtual switch inside Ubuntu pc to which I can add two or more virtual interfaces. I tried the answer here, but when I ping the ip of the virtual interface I get the MAC of eth0. Also I created a bridge and gave different ips representing different subnets to `br0` and `eth0`, but that too didn't work. I have tried every possible howto and I have also googled for months on the issue: the only solution seems to be to buy another network card and plug both to my unmanaged switch.


title: Running script on system start as given user

text: I have a small script on a dev/staging server that runs services inside `tmux`. The script just creates a few sessions with a few windows each in which various services are running. How can I make this script run each time the system starts after reboot? I would like to have this script run as specified user.


title: ZFS detach mirrored drives in a pool

text: I have an older (2-3 years) NAS running FreeNAS. I figured its time to upgrade some of the hard drives. Here's the current status:                   NAME        STATE     READ WRITE CKSUM                                           Pool1       ONLINE       0     0     0                                             raidz1    ONLINE       0     0     0                                               ada3p2  ONLINE       0     0     0                                               ada4p2  ONLINE       0     0     0                                               ada5p2  ONLINE       0     0     0                                             mirror    ONLINE       0     0     0                                               ada1p2  ONLINE       0     0     0                                               ada2p2  ONLINE       0     0     0       The drives in RaidZ1 are all 1GB and will stay. What's the best way to add 2 or 3 more 1GB hard drives to RaidZ1 and completely remove the mirrored drives, which are 500GB only, without:   * Copying the data to a temporary holding spot   * Recreating the pool   * Copying it back The pool is about 50% full, so I'm not even sure there's data on the mirrored drives. How to check or where to begin?


title: Any random password results in successful login on tty

text: I can login to my machine (FreeBSD 9.1-RELEASE) for any user (for example: `root` or `operator` or any that exists in `/etc/passwd`) with any random password that I type... I tried to reset password for `root` with `passwd`, but again if I try to login I can login with any random password that I type in... strange. This ONLY works when I login directly from `tty`. When trying to log in via SSH, everything is as it should be - I need to give correct password to log in. How to fix this? EDIT: Contents of `/etc/ttys`:               # name  getty                           type    status          comments     #     # If console is marked "insecure", then init will ask for the root password     # when going to single-user mode.     console none                            unknown off secure     #          console none                            unknown off secure     #     ttyv0   "/usr/libexec/getty Pc"         xterm   on  secure     # Virtual terminals     ttyv1   "/usr/libexec/getty Pc"         xterm   on  secure     ttyv2   "/usr/libexec/getty Pc"         xterm   on  secure     ttyv3   "/usr/libexec/getty Pc"         xterm   on  secure     ttyv4   "/usr/libexec/getty Pc"         xterm   on  secure     ttyv5   "/usr/libexec/getty Pc"         xterm   on  secure     ttyv6   "/usr/libexec/getty Pc"         xterm   on  secure     ttyv7   "/usr/libexec/getty Pc"         xterm   on  secure     ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   off secure     # Serial terminals     # The 'dialup' keyword identifies dialin lines to login, fingerd etc.     ttyu0   "/usr/libexec/getty std.9600"   dialup  off secure     ttyu1   "/usr/libexec/getty std.9600"   dialup  off secure     ttyu2   "/usr/libexec/getty std.9600"   dialup  off secure     ttyu3   "/usr/libexec/getty std.9600"   dialup  off secure     # Dumb console     dcons   "/usr/libexec/getty std.9600"   vt100   off secure


title: Contents of stack area of a process

text: I've been going through some Unix text books and I can't have a clear picture on the contents of the stack area of the process. Can anyone please explain or point out some references?