RPM package naming convention

I'm a little confused with RPM package naming. When I do:               vickey@tb:/usr/include$ rpm -qf event.h      libevent-devel-2.0.10-2.fc15.i686      And:               vickey@tb:/usr/include$ repoquery --list  libevent-devel.i686     /usr/bin/event_rpcgen.py     /usr/include/evdns.h     /usr/include/event.h     ....     ....      Here in the second code box /usr/include/event.h is provided by libevent- devel.i686 but a query in the first code box shows that it belongs to the package libevent-devel-2.0.10-2.fc15.i686. Does package manager use these aliases?


Can I substitute partition number with UUID?

Here is my grub.cfg:               menuentry 'Debian 6.0 on hard disk' {         set  isofile="(hd0,6)/home/toinstall/debian.iso"         loopback  loop  $isofile         search --no-floppy --fs-uuid --set=root 8b29114c-4f89-4c96-b0c0-579ce58c7345         linux  (hd0,6)/hd-media/vmlinuz  root=UUID=8b29114c-4f89-4$         initrd (hd0,6)/hd-media/initrd.gz     }      It can run, it is ok. There are 3 hd0,6. Can I substitute partition number with uuid in the file?


How do you get hardware info and select drivers to be kept in a kernel compiled from source?

I would like to create a minimal kernel for a web server. When you compile a kernel from source how do you **get hardware info** and then know what drivers need to be kept in the kernel so the rest can be removed?


How do regular expressions differ from wildcards used to filter files

While we use `*` to denote zero or more previous characters in `grep`, we use `*.c` to find all C files when we use it with the `ls` command like `ls *.c`. Could someone tell how the use of `*` differs in these two cases?


compiling with gcc broken for users but fine for root

So somewhere along the way compiling as a regular user has stopped working on my server. I'm on Debian Stable. Can't think what has changed on my system that would result in this, or how to fix it, but now only root can compile.               user@box:~/code/helloworld$ gcc helloworld.c -o helloworld     In file included from /usr/include/stdio.h:28:0,                      from helloworld.c:3:     /usr/include/features.h:356:25: fatal error: /usr/local/include/sys/cdefs.h: Permission denied     compilation terminated.      Compiling as root is fine. I presume this is a permissions issue?               As user@server:          ls -la /usr/local/include/sys/cdefs.h     ls: cannot access /usr/local/include/sys/cdefs.h: Permission denied          ls -la /usr/local/include/sys/            ls: cannot access /usr/local/include/sys/.: Permission denied     ls: cannot access /usr/local/include/sys/..: Permission denied     ls: cannot access /usr/local/include/sys/apparmor.h: Permission denied     ls: cannot access /usr/local/include/sys/cdefs.h: Permission denied     total 0     d????????? ? ? ? ?            ? .     d????????? ? ? ? ?            ? ..     -????????? ? ? ? ?            ? apparmor.h     -????????? ? ? ? ?            ? cdefs.h      The user can read /usr/local/include fine. Root shows the perms on /usr/local/include/sys to be (note user is in staff group): drwxr-Sr-- 2 root staff 4096 Dec 7 08:20 sys Location of cdefs.h               locate cdefs.h     /usr/include/ldap_cdefs.h     /usr/include/i386-linux-gnu/sys/cdefs.h     /usr/include/sys/cdefs.h     /usr/local/include/sys/cdefs.h      I've tried fixing the perms but I can't get it right. Is there a way to ignore the cdefs.h from /usr/local and use the one it /usr/include/? Any help greatly appreciated!


Fixing header and print

I have header starting with '>' and I want fix the header by keeping first word and removing other shown as in output.txt and print it input.txt               >AGAJ01065549.1 scaffold:Xipmac4.4.2:AGAJ01065549.1:1:500:1 REF     CGCCAGGTGTCTGGCGTAATAGCGCCAGCGCCAGGTGTCATATACGTAATAGCGCCAGGT     >RGAMMT01065456.1 scaffold:Xipmac4.4.2:AGAJ01065595.1:1:500:1 REF     GACTAGTTTTTACATATAGTAATGGTTATTCGGAAGTGTACAGACGTTTTCAGGTTTTTT     TTTGGTAGGGGTTGAGGTGTTGAGGTGAGGGGACTATGTGGAGGGAACTTTCCATAGAGG      output.txt               >AGAJ01065549.1      CGCCAGGTGTCTGGCGTAATAGCGCCAGCGCCAGGTGTCATATACGTAATAGCGCCAGGT     >RGAMMT01065456.1      GACTAGTTTTTACATATAGTAATGGTTATTCGGAAGTGTACAGACGTTTTCAGGTTTTTT     TTTGGTAGGGGTTGAGGTGTTGAGGTGAGGGGACTATGTGGAGGGAACTTTCCATAGAGG


How do I start Xvfb on startup on Debian?

I’ve got a Debian web server that I’m using for occasional screen-scraping via Selenum and Python. I use Xvfb as a virtual X server for Firefox to run on when being controlled by Selenium. Given that I (think) I have to start this using `sudo`, I don’t think it’ll be feasible to start it from Python each time (see my Stack Overflow question), so I figured I could just have it running all the time. I currently start it like this at the command line:               sudo Xvfb :99 -nolisten tcp -fbdir /var/run      What method should I use to do this automatically at startup? Should I use `cron`, as suggested here?


Linux Mint system settings locked

The system settings for my Linux Mint OS, for example desktop background or mouse speed or screen resolution etc. won't change, for some reason. I just restarted my computer and for some reason the background had changed and the Computer icon was missing. When I tried to change these settings by going to the System Settings menu, the changes won't save. Is there a way to resolve this?


Running a Snow Leopard 10.6.7 Image on an AMD: The CPU has been disabled by the guest operating system

I am quite frustrated so I have turned to this medium in hoping to get an answer. After reading thousands of forums and trying out various methods (I have lost track what I have tried already) I still haven't solved my problem. That is, I am trying to run a Mac OS X Snow Leopard VMware image 10.6.7 on my AMD quad core computer with VMware Workstation 9.0. My latest attempt involves opening the specific configuration .vmx file (which is linked to a VMware image .vmdk) and hence booting it with help of a kernel (darwin.iso). A description of these steps undertaken can be found here: http://anonymous00.hubpages.com/hub/Installing-Mac-OSX-On-Windows I have tried different VMware images and different kernels, but I keep getting the error: "The CPU has been disabled by the guest operating system (...)". So I am guessing that something went wrong when unlocking the Mac OS X (I don't know how to check this however, since the Mac OS X Guest Host seems to be installed and unlocked correctly, that is it appears in the list of available guest hosts). So community, what do you think I should try? A couple of things I have tried already:   * Applying a mask (adding the line cpuid.1.eax = "0000:0000:0000:0001:0000:0110:1010:0101" in the .vmx file)   * Trying to install the operating system instead of running (hence booting from a .iso file): this didn't work as well: my computer didn't recognize the operating system.   * Different versions of kernels and different VMware images (including images that are meant only for AMD processors) Please help! P.s.: yes, I have enabled Virtualization in my BIOS. * * * **My computer specifications:** AMD A6-3410MX APU with Radeon(tm) HD Graphics 1.60GHz; Memory (RAM): 6.00GB; System type: 64-bit; Model: HP Pavilion dv7 Notebook PC


How do I know that FXP is enabled or not? (AIX FTPD)

# grep -i ftp inetd.conf     ftp     stream  tcp     nowait  root    /usr/sbin/ftpd     # oslevel -s                 6100-06-05-1115      So I have an AIX 6 server. How can I check if FXP is enabled on the FTPD or not?


Ubuntu12.04: How to disable a daemon process at startup

I normally use `service start/stop` or `initctl start/stop` to start or stop a daemon process but now what I am looking for is to disable a daemon process from starting at startup example `mysqld`. Currently what am doing is renaming `/etc/init/mysql.conf` to `/etc/init/mysql.conf.bak` but after reading a little about `systemd` I came to know that it provides `enable & disable` option for the above task. So, is there something similar in ubuntu 12.04 with `upstart`.


How does `stdin` of linux work?

I know that `stdin` refers to standard input in linux, usually the keyboard. It can also be referred by `file descriptor 0`. So, which file descriptor does the (standard input) mouse refer to? Or is it a special file which functions in a very different way, when compared to other files, or input files? So how does the mouse work and where is the input from the mouse mapped to? The same questions apply to a touchscreen.


Reasons for Busybox on Current Systems

Being initially developed for use on a floppy-sized bootable system, busybox was designed with a small memory footprint in mind. Today it is used not only on actually small systems like routers and maybe washing machines and microwave ovens, but also on high powered NAS, Smartphones and rescue systems for Desktop Linux Distributions. (On the latter maybe for ensuring it fits in some boot loader images?) But being a single binary it also is a single point of failure. Why don't just use a standard user land instead of busybox on such machines?


How to search and replace text in all php-files in a directory and it's subdirectories

I am looking for a shell script that recursively traverses all `.php` files in a directory and performs a search & replace of a particular text pattern. The search pattern is quite long ( > 5000 characters) so it might be saved in another textfile for convenience. Also it contains forward slash characters. edit: i think i figured out the first part:               find . -name "*.php"      but then how do i search & replace in those files?


Upgrade Firefox in Linux Mint 10

For some reason a while ago I was no longer able to use the Firefox that came with my Linux Mint 10 virtual machine. I've installed the new version of Firefox (16) using both the package manager and extracting the `tar` file but when I go to `/opt/firefox16/firefox`, it says: > /usr/bin/firefox: No such file or directory I also have a symlink so it should automatically go there but I just keep getting that message. Any ideas?


What does this iptables command do?

Does `iptables -I INPUT -j ACCEPT` open all ports?


How to add unity-greeter in Debian wheezy with GDM 3

There are two questions I would like to ask.   1. How do we install unity-greeter in Debian wheezy with GDM 3 to have an Ubuntu style login screen ?   2. How do we have a rounded-styled login box with default gdm 3 setup ?


pacman does not sync core

I run as root `pacman -Syu`   However it just skips right over [core], without prompts, etc.   Just like it was normal to proceed when 0% done. It just proceeds with extra and community.   How can I force the db to be updated or preferably fix this behaviour?


sh and grep numbers only

I'm facing a problem and trying to find a solution that works in **sh**. If I could use bash this code would work:               ls /a|grep ^[0-9]      Unfortunately this is not the case with sh, and yes I need to use sh. :) Running in sh i get               ls /a |grep ^[0-9]     [0-9]: not found     Usage: grep -hblcnsviw pattern file . . .      If I remove the ^ the code works but I need only the files that start with numbers and not the ones that contains numbers. Example, I need the files that are like:               12.00.2     2.222.1234.12      from the grep man page I should be able to use `^`. For the time being my implementation was done by using:               ls /a|grep -v [a-z]|grep -v [A-Z]      As this will remove all the files that contains chars, but still if a file is .123.33 it will show up.


How to execute a bash script on multiple directories?

I have a `conv.sh` script that loops over MP3 files in the current directory and converts them into OGG. I have also several directories {F1, F2,..., F20} at `/path/to/Files/`. How should I execute `conv.sh` on all of these directories?


How to provide GUI interface to all users of Ubuntu?

I have "Ubuntu Dekstop" installed in VirtualBox in a Windows 7 PC. How can I configure it to provide a GUI interface to every user I create in the Ubuntu?   Should I install "Ubuntu Server" to accomplish this?   Can this be done in Ubuntu? I remember working in a place where solaris was intalled in a server and every user used to login using cygwin and get a solaris GUI desktop.   Can this be done? And what is this feature called? I am asking this for an event for the following purpose.   I want to install ruby on rails in an ubuntu machine and create 5 users in the ubuntu.   These 5 users will have their own Windows 7 laptops.   These 5 users should be able to get their own GUI desktop on their Windows 7 laptop. And can this be done by installing Ubuntu in Virtual Box in a Windows 7 PC? Please help.


postconf -e postfix_mydestination = localhost blah.deblah.com.au

Above is example of command someone used to successfully direct to subdomain but when I try it I get `postconf: fatal: missing '=' after attribute name` which makes no sense to me when clearly the equal sign is there.


Sanity checking MD5 sums

Do MD5 checksums contain a checkbit? I have to copy some MD5 checksums by hand (there's no other way) and was wondering whether there is any code out there that can validate a checksum as being valid in the same way one can validate a credit card number. Just to be clear, I'm not asking how to generate an MD5 sum from a file so that I can compare it with the sum I've been given, I'm asking if it's possible (and I doubt it is) to validate that an MD5 sum is a genuine MD5 sum without actually making any reference back to the bytes that have been used to generate the sum. I want to identify a possible typo.


Does grep use a cache to speed up the searches?

I have noticed that subsequent runs of `grep` on the same query (and also a different query, but on the same file) are much faster than the first run (the effect is easily noticeable when searching through a big file). This suggests that grep uses some sort of caching of the structures used for search, but I could not find a reference on the Internet. What mechanism enables `grep` to return results faster in subsequent searches?


How to get top 5 most ram intensive applications from Bash?

So I look at avaliable to me servers load ![enter image description here](http://i.stack.imgur.com/vsBGD.png) and see that some other user has created some really ram intensive app that kills my server hosting abileties. I wonder what is bash command to get top 5 most ram using applications n my server. How would such command look like?


Parsing of command line options

For I school project, I have to implement a shell/terminal app. But I am wondering how are command line options parsed, because it appears abit weird to be. For example for the command paste (and I believe other utilities behave similarly)               [jiewmeng@JM tmp]$ paste --help     Usage: paste [OPTION]... [FILE]...      Behavior when combining multiple options into one               [jiewmeng@JM tmp]$ paste -ds file1     file1 xxx     file1     d aaws dafd a      Here it appears options are just ignored ...               [jiewmeng@JM tmp]$ paste -sd file1      It behaves the same as `paste -`, waiting for `stdin`. But when its valid combination               [jiewmeng@JM tmp]$ paste -sd. file1     file1 xxx.file1.d aaws dafd a      It works. Shouldn't the invalid one give an error instead of waiting for `stdin`?               [jiewmeng@JM tmp]$ paste -d     paste: option requires an argument -- 'd'     Try 'paste --help' for more information.      Ok, makes sense `d` requires an argument, but ...               [jiewmeng@JM tmp]$ paste -d file1      ... waits for `stdin`. why?


I/O statistics per user

I have access to an academic supercomputer where there is an NFS filesystem where our lab keeps our data. When I run `iostats -nh` I believe I am getting statistics for **all** users accessing all storage devices. Is there a way to see **my own** I/O statistics on this particular NFS filesystem? i.e. see how much of the total load is mine?


Installing new Operating System such as FreeBSD with PXE boot?

I am no expert on this issue, I am maybe even using the wrong technical term. Anyway, my goal is this: to install a new OS from a server that has the installation documents etc so some settings in boot-loader apparently. I would like to install FreeBSD here but I am lacking physical mediums to install it. Is there any easy way to upgrade the system through network (as far as I have understood, this is what the PXE is for)? **Perhaps related**   1. http://superuser.com/questions/397646/cloning-fresh-windows-7-fsed-hdd-to-linux-server-because-having-no-external-hdd


Should I use LILO or GRUB or other?

I am making a netinstall DVD which will have netinstall for 10 different Linux distros on it. I will need to install a bootloader on the disk so I can choose which distro I want to install. Which is the easiest to set up and put on a disc - LILO or GRUB? Or are there even easier ones? I don't need any advanced settings, etc - I just need a simple, easy to set up, bootloader.


Ignore file changes

I have a process, which generates a file with configuration data and then calls a subprocess with this data as parameter. I'd like to override the configuration data, which is passed. The problem is, that I have no control over that process. I've tried to make the file immutable using `chattr +i` so that my changes get untouched from the process, but the process creating the file returns an error. So is there another option, that I can use? EDIT: More specific: processA deletes `settings.ovp`n and then creates it again with the new content. Then it calls `openvpn --settings settings.opvn`. I want to override settings.ovpn, because it is generated wrong.


Are there 2 ways to set awk vars via command line?

I noticed an O'Reilly `awk` example (1997) which assigned an awk variable by setting it on the command line **after** the program-text. It does work, but I can't find this syntax in _man / info awk_. Have I just missed it; is it depricated...? The only syntax I've seen in the manual is the `-v` option.               awk '/home/{print foo, bar}' foo="cat" bar="dog" /proc/$$/cmdline      Output: `cat dog`


Creating SSH Terminal Wrapper

I'm new to scripting, but somewhat familiar with Linux. I am actually using this on a Fedora16 build, with Gnome3 and gnome-terminal... fyi. I flip through all sorts of ssh terminals all day long and I thought it would be nice to create a ssh script called lambda that contains information that is sent to a terminal_wrapper script that accepts all sorts of variables and creates a new gnome-terminal based on those given variables. The information I would like would be to rename the title, change bg and fg colors, and start an ssh in a new gnome-terminal window. I feel like I'm close to getting the ssh to work, but I'm missing something. Here is what I've got for my ssh script for lambda: `terminal_wrapper user lambda.company.com` And here is my terminal_wrapper: `gnome-terminal --title=$2 -e ssh $1 $2` It opens a new window for me, renames it to the lambda.company.com, and then sits there and closes after a second. Any help? Thanks.


automount nfs: autofs timeout settings for unreliable servers - how to avoid hangup?

I'm running a small server for our flat share. It's mostly a **file server** with some additional services. The clients are Linux machines (mostly Ubuntu, but some others Distros too) and some Mac(-Book)s in between (but they're not important for the question). The server is running _Ubuntu 11.10_ (Oneiric Ocelot) 'Server Edition', the system from which I do my setup and testing runs the 11.10 'Desktop Edition'. We where running our shares with Samba (which we are more familiar with) for quite some time but then migrate to **NFS** (because we don't have any Windows users in the LAN and want to try it out) and so far _everything works fine_. Now I want to setup auto-mounting with **autofs** to smooth things up (up to now everyone mounts the shares manually when needed). The auto-mounting seems to work too. The problem is that our "server" don't run 24/7 to save energy (if someone needs stuff from the server s/he powers it on and shuts it down afterwards, so it only runs a couple of hours each day). But since the autofs setup the clients hang up quit often when the server isn't running.   * I can start all clients just fine, even when the server ain't running.    * But when I want to display a directory (in terminal or nautilus), that contains symbolic links to a share under `/nfs` while the server ain't running, it hangs for at least two minutes (because autofs can't connect to the server but keeps trying, I assume).      * Is there a way to avoid that? So that the mounting would be delayed till a change into that directory or till content of that dir get accessed? Not when "looking" at a link to a share under `/nfs`? I think not, but maybe don't try it for so long? And just give me an empty dir or a "can't find / connect to that dir" or something like that.   * When the server is running, everything works fine.    * But when the server gets shut down, _before_ a share got unmounted, tools (like `df` or `ll`) hang (assuming because they think the share is still on but the server won't respond anymore).      * Is there a way to unmount shares automatically, when the connection gets lost?   * Also the clients won't shutdown or restart when the server is down and they have still shares mounted. They hang (infinitely as it seems) in " _killing remaining processes_ " and nothing seems to happen. **I think it all comes down to neat timeout values for mounting and unmounting. And maybe to remove all shares when the connection to the server gets lost.** So my question is: How to handle this? And as a bonus: is there a good way to link inside `/nfs` without the need to mount the real shares (an autofs option or maybe using a pseudo FS for `/nfs` which gets replaced when the mount happens or something like that)? # My Setup The **NFS setting** is pretty basic but served us well so far (using **NFSv4** ): **/etc/default/nfs-common**               NEED_STATD=     STATDOPTS=     NEED_IDMAPD=YES     NEED_GSSD=      **/etc/idmapd.conf**               [General]     Verbosity = 0     Pipefs-Directory = /var/lib/nfs/rpc_pipefs     Domain = localdomain     [Mapping]     Nobody-User = nobody     Nobody-Group = nogroup      **/etc/exports**               /srv/   192.168.0.0/24(rw,no_root_squash,no_subtree_check,crossmnt,fsid=0)      Under the export root `/srv` we got two directories with `bind`: **/etc/fstab** (Server)               ...     /shared/shared/      /srv/shared/      none    bind  0 0     /home/Upload/        /srv/upload/      none    bind  0 0      The 1st one is mostly read only (but I enforce that through file attributes and ownership instead of NFS settings) and the 2nd is _rw_ for all. Note: They have no extra entries in _/etc/exports_ , mounting them separately works though. On the client side they get setup in `/etc/fstab` and mounted manually as needed (`morton` is the name of the server and it resolves fine). **/etc/fstab** (Client)               morton:/shared  /nfs/shared nfs4    noauto,users,noatime,soft,intr,rsize=8192,wsize=8192    0   0     morton:/upload  /nfs/upload nfs4    noauto,users,noatime,soft,intr,rsize=8192,wsize=8192    0   0      For the **autofs setup** I removed the entries from `/etc/fstab` on the clients and set the rest up like this: **/etc/auto.master**               /nfs    /etc/auto.nfs      First I tied the supplied executable `/etc/auto.net` (you can take a look at it here) but it wont automatically mount anything for me. Then I write a `/etc/auto.nfs` based on some HowTos I found online: **/etc/auto.nfs**               shared  -fstype=nfs4  morton:/shared     upload  -fstype=nfs4  morton:/upload      And it kinda works... Or would work if the server would run 24/7. So we get the hangups when a client boots without the server running or when the server goes down while shares where still connected.


Running Apache with Tomcat

I was wondering if it's possible to run a Tomcat server within Apache whilst also running PHP servers under other virtual host instances? And if so, how is this done? Basically, I'm trying to run an Apache server that redirects to different applications based on the DNS address used. For example: www.javaapp.com -> Sends the Java application to the clients browser and www.phpapp.com -> Sends a PHP application to the clients browser And I was also wondering if there's a way of adding a third application in RoR as well, and whether Apache can serve Rails or not? I am currently using Tomcat for my JSP application, I know this can be integrated with Apache, but I wasn't sure if it could be done alongside applications written in other languages. As I know that Apache is able to redirect to virtual hosts based on the DNS address entered, which I thought was pretty cool and would really help me to host multiple applications on my box that I'm writing.


find file, copy but with different name

I have files with random numbers in /home/user/files folder (every 4 days I have new ones). for example:               john20     john25     john40     tom12     tom32     simon2     simon8     simon53      I want to take only last modified files (the newest) and copy them to different location (/home/user/fixed) without that numbers in file name. I know how to filter and copy that using find command but I don't know how copy all of them without that numbers.               find $files_are_here -maxdepth 1 -mtime -2 -type f -exec cp {} $new_path \;      This will copy all of the files modified in the last 2 days to the new path but with original name. In my case:               john40     tom32     simon53      but I would like to have only john, tom and simon inside that folder. So after I run my script again they will be replaced by the newest one.


Measuring context switches of a LWP gives incorrect results. Why?

I have a Java thread pinned at my cpu core. It is busy spinning and I see through `top` that it is running fine:               %Cpu0  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st     %Cpu1  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st     %Cpu2  :100.0 us,  0.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st     %Cpu3  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st      I traced down the LWP number of the Java thread, with the steps below: First the JVM PID:               $ ps -ef | grep -i java | grep -v grep     1000      9062  1531 99 22:41 pts/0    00:16:42 java -cp target/mylib-all.jar -Dbind=2 com.examples.PinnedThread      Then the LWP ID:               $ ps -eLo pid,lwp,nlwp | grep 9062      9062  9062   20      9062  9063   20      9062  9064   20      9062  9065   20      9062  9066   20      9062  9067   20      9062  9068   20      9062  9069   20      9062  9070   20      9062  9071   20      9062  9072   20      9062  9073   20      9062  9074   20      9062  9075   20      9062  9076   20      9062  9077   20      9062  9078   20      9062  9079   20      9062  9080   20      9062  9105   20      It is one of those in the second column above, so I use jstack to find out:               $ jstack 9062          "PinnedThread" prio=10 tid=0x00007fcf9817b800 nid=0x2378 runnable [0x00007fcf7e1ed000]        java.lang.Thread.State: RUNNABLE      0x2378 is 9080 in DEC, so I found the LWP for my thread, it is **9080**. Now I want to monitor my thread context switches, so I do:               $ watch -n.5 grep ctxt /proc/9080/status     Every 0.5s: grep ctxt /proc/9080/status          voluntary_ctxt_switches:        9     nonvoluntary_ctxt_switches:     120743      Problem is: `nonvoluntary_ctxt_switches` increments like a counter, non-stop and fast. I am sure my thread is not doing hundreds of context switches per second. What is going on here? Is that something particular about LWP and that `nonvoluntary_ctxt_switches` ? Interesting enough, if I check the status of the main process PID (JVM), I get much quieter numbers:               $ cat /proc/9062/status | grep ctxt     voluntary_ctxt_switches:    3     nonvoluntary_ctxt_switches: 2      And they never change! Can anyone shed a light here? I am pinning the thread with `sched_setaffinity` and it looks from `top` that this part is working very well but 100 `nonvoluntary_ctxt_switches` per second doesn't make any sense. I also tried to use pidstat and it gives me 84 nonvoluntary_ctxt_switches per second. :(               pidstat -w -I -t -p 9062 3 | grep 9080     12:21:07 AM         -     9080      0.00     84.33  |__java     12:21:10 AM         -     9080      0.00     84.00  |__java     12:21:13 AM         -     9080      0.00     84.33  |__java      Here is what my thread is doing, in other words, nothing, just busy spinning and incrementing a counter:                   Thread t = new Thread(new Runnable() {                  long count = 0;                  @Override             public void run() {                      Affinity.bind();                      try {                          while(true) {                         count = (count == Long.MAX_VALUE ? 0 : count + 1);                     }                      } finally {                     Affinity.unbind();                 }             }         }, "PinnedThread");      Below is my `/proc/interrupts`. I turned off `irqbalance`, so all hardware interrupts should go to CPU0. For CPU2 I have:   * 23 is moving very slowly (IO-APIC-fasteoi ehci_hcd:usb2)   * NMI is moving one per second (Non-maskable interrupts)   * LOC is moving very fast (Local timer interrupts)   * PMI is moving one per second (Performance monitoring interrupts)               $ watch -n.5 cat /proc/interrupts                CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7       0:         43          0          0          0          0          0          0          0   IO-APIC-edge      timer       1:          3          0          0          0          0          0          0          0   IO-APIC-edge      i8042       8:          1          0          0          0          0          0          0          0   IO-APIC-edge      rtc0       9:          0          0          0          0          0          0          0          0   IO-APIC-fasteoi   acpi      12:          4          0          0          0          0          0          0          0   IO-APIC-edge      i8042      16:      67936        557       1530        275       6474       2516      16305       4790   IO-APIC-fasteoi   ehci_hcd:usb1, nouveau      17:         59          2          0          0          6          1          0          0   IO-APIC-fasteoi   snd_hda_intel      23:    3109042     102263      57885       9186     196294     119229     716776     184137   IO-APIC-fasteoi   ehci_hcd:usb2      40:          0          0          0          0          0          0          0          0   PCI-MSI-edge      PCIe PME      41:          0          0          0          0          0          0          0          0   PCI-MSI-edge      PCIe PME      42:          0          0          0          0          0          0          0          0   PCI-MSI-edge      PCIe PME      43:          0          0          0          0          0          0          0          0   PCI-MSI-edge      PCIe PME      44:          0          0          0          0          0          0          0          0   PCI-MSI-edge      PCIe PME      45:          0          0          0          0          0          0          0          0   PCI-MSI-edge      PCIe PME      46:      16996        781        242         46       5245       1435       3424        932   PCI-MSI-edge      ahci      47:          0          0          0          0          0          0          0          0   PCI-MSI-edge      ahci      48:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      49:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      50:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      51:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      52:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      53:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      54:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      55:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      56:          0          0          0          0          0          0          0          0   PCI-MSI-edge      xhci_hcd      57:         13          0          0          0          0          0          0          0   PCI-MSI-edge      mei      58:        300         31          0          0         21          0          0          0   PCI-MSI-edge      snd_hda_intel     NMI:       2966       2642      10738       3122       1490       1251        858        136   Non-maskable interrupts     LOC:    1549246     742527    2500092     745512     465500     434371     451682     117591   Local timer interrupts     SPU:          0          0          0          0          0          0          0          0   Spurious interrupts     PMI:       2966       2642      10738       3122       1490       1251        858        136   Performance monitoring interrupts     IWI:          0          0          0          0          0          0          0          0   IRQ work interrupts     RTR:          7          0          0          0          0          0          0          0   APIC ICR read retries     RES:     153708      47896         15         39       4188       4699          1          1   Rescheduling interrupts     CAL:        299        345        390        391        346        213        391        386   Function call interrupts     TLB:      49114      50157        826        292      44726      44832         86          4   TLB shootdowns     TRM:          0          0          0          0          0          0          0          0   Thermal event interrupts     THR:          0          0          0          0          0          0          0          0   Threshold APIC interrupts     MCE:          0          0          0          0          0          0          0          0   Machine check exceptions     MCP:         99         99         99         99         99         99         99         99   Machine check polls     ERR:          0     MIS:          0


How to suppress su authentication failure warning?

I created an account "`diag`" and set it as expired (`usermod --expiredate 1`). Then I have a script which I want to run to log into it, so in the script I use the following command:               su -s /bin/bash - diag      This outputs like so:               Your account has expired; please contact your system administrator     su: Authentication failure     (Ignored)     diag@computer:~$      And then I'm able to use the account, as expected. I want to suppress the first three lines, the warning about the expired account. I tried adding `2> /dev/null` to the end of the command, but that suppresses all the output from bash; I just get a blank response, and I can type commands into it and see the result from them, but I see no bash prompt. I tried adding just `> /dev/null` and that does nothing. So I've deduced that apparently `su` is piping all its output over `stderr`. How can I get `su` to just suppress those first three lines, but otherwise act normally as if the account weren't expired?


Extract tomcat parameters from ps output

I'm trying to write a little diagnostic tool and one of the functions I want from it is that I want to run is:               ps axu | grep tomcat | grep -v grep | awk '{ print $<list of desired fields> }'        I want to return the userid that started tomcat and the following parameters that were passed when tomcat started:               -javaagent:/usr/share/tomcat7/<someagent> -Dcatalina.base=/var/lib/tomcat7      - Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp      I want those fields passed into an array which I can then use to tell the user something about the tomcat install. The problem is I can't find a way of formatting the command to force the fields to be what I need them to be to make awk work. At this point I'm thinking of just taking the output, writing it to a temp file, then pulling what I want out using regex. I know there's a way to do this in Bash but I have not had any success getting there from here.


Using cat to modify ~/.bash_profile seems to remove __git_ps1 compeltely

I want my prompt to display the current git-branch when inside of a repo directory. e.g.,               [desktop repo(master)]$      In my terminal I can type:               cat <<EOF >> ~/.bash_profile     PS1='\[\e[0;32m\][\h \W\[\e[m\]$(__git_ps1 "(%s)")\[\e[0;32m\]]\$ \[\e[m\]'     EOF      But the resultant appended text in .bash_profile is:               PS1='\[\e[0;32m\][\h \W\[\e[m\]\[\e[0;32m\]]$ \[\e[m\]'      the __git_ps1 method is not present in the result. If I manually edit the .bash_profile with vim then source ~./bash_profile, the PS1 statement contains the __git_ps1 method and it works fine. This cat statement is part of a larger 'bootstrapping' script, but I've trimmed out all the irrelevant stuff. I have successfully implemented this on Ubuntu. I am trying to get it running on a CentOS VM. Thanks!


APF firewall & IPset

Due to too many hack attempts from spam countries, today got the server configured with IPset for iptables. I loaded thousands of ip range in IPset & then added it to iptables with this command               iptables -A INPUT -m set --set Cblock src -j DROP      Cblock is the name I gave for the ipset rule containing 20 countries ip range All is good! but the moment I start APF firewall, ipset rules no longer in effect even though it still shows up in the status.               service iptables status      I checked APF config file & there is no mention about IPset. I also tried to start APF first & then load IPset rules. This approach also did not make a difference. Anyone had similar circumstance to tackle? I use APF to deal with spamhouse ip's, port blocking etc. Is there any other firewall wrapper that is compatible with IPset?


Wrong mount point for internal SSD

I am having a problem with mounting an internal SSD. For some reason The mounting point is chosen as `/media/user/Data` instead of, as specified in `/etc/fstab`, `/mnt/Data`. The according line in `/etc/fstab` goes as follows:               UUID="064ced5e-19c1-43d1-876f-3de0c115b65e"     /mnt/Data       ext4    users,noauto,exec,rw,async,dev  0       0      I am using Ubuntu 14.04 LTS 64bit. (edit:) Here goes the complete fstab file:               # /etc/fstab: static file system information.     #     # Use 'blkid' to print the universally unique identifier for a     # device; this may be used with UUID= as a more robust way to name devices     # that works even if disks are added and removed. See fstab(5).     #     # <file system> <mount point>   <type>  <options>       <dump>  <pass>     # / was on /dev/sdc2 during installation     UUID=9cf86df3-3d02-45d7-8078-d6ff5fc83ea6 /               ext4    errors=remount-ro 0       1     # /boot/efi was on /dev/sda2 during installation     UUID=5AC7-594F  /boot/efi       vfat    defaults        0       1     # swap was on /dev/sdc5 during installation     UUID=5460f609-5245-417a-833a-271c533db97a none            swap    sw              0       0          UUID="064ced5e-19c1-43d1-876f-3de0c115b65e"     /mnt/Data      ext4    users,noauto,exec,rw,async,dev  0       0


What's the difference between "dir" and "ls"?

I have compared the man pages of `dir` and `ls` and they seem to be exactly the same. Both are part of GNU coreutils and "list directory contents". The only difference I've seen so far is that `dir` doesn't colorize the output. So why do two commands exist? Is there a difference I missed? Why would one prefer `dir` over `ls`?


Identify the number of unique values and then the number of occurrences of those values in the file

I have a data file which contains 15000 lines, but only 400 unique values. I am looking for a way to identify the number of unique values and then the number of occurrences of those values in the file. I came up with the following but it is very very slow. Any thoughts?               for value in `cat mylist.txt | uniq`     do         counter=`grep $value mylist.txt |wc -l`         echo $value $counter     done


Can I use variables inside {} expansion without `eval`?

Can I use variables inside `{}` expansion without appealing to `eval`? If so, how? This doesn't work:               $ touch 1.foo 1.bar     $ ls 1.{foo,bar}     1.bar  1.foo     $ extensions=foo,bar     $ ls 1.{$extensions}     ls: cannot access 1.{foo,bar}: No such file or directory      It works with `eval`:               $ eval ls 1.{$extensions}     1.bar  1.foo


connect two VMs and one VM to the internet

Disclaimer: My knowledge about networking as well as qemu is little to none. I'm using QEMU to run a Debian VM that runs an application. For testing purposes I now want to create a second VM running Windows that is connected to the first VM so it can access it. This, so far, is working. However, with the current setup, the Windows VM has no connection to the Internet. I'd like to change this, though, but without allowing the Debian VM to connect to the Internet. The current setup is that a bridge is being created as well as a number of virtual network devices (tap) which are then added to the bridge. One of the tap devices (let's say it's `tap0`) is then used for the second VM (the other ones are used by the first VM). My question now is: Does it make sense, i.e. is it possible, to configure the bridge `br0` such that only `tap0` can connect to the internet? If so, how can I go about doing that (utilities like `brctl` are available). It is deliberate that the Debian VM can't access the internet and this needs to stay this way. From what I understand I could just add `eth0` to the bridge to allow Internet access, but can I restrict that to the Windows VM (e.g. `tap0`)?


sed: substitute text with a string that contains special characters

I have a lot of text file with specific tag called "Comment", **example** I have a file called 3dchess.sh, I need change the tag:               Comment=3D chess for X11       to               Comment='3D chess for X11'      The script is:               #!/bin/sh     Package=3dchess     Popcon=48     Section=universe          Comment=3D chess for X11     Exec=3Dc      I have tried this but it doesn't work in my case:               sed -i ':Comment=:s:Comment=:Comment=':g;/Comment=/s/$/'/' $HOME/3dchess.sh


Indent like first line

How can I indent a file such as its first line? **Example:** A file containing                    x=1+2+3+4+     5+6+7+8     +9+10+12      should be converted to                    x=1+2+3+4+          5+6+7+8          +9+10+12      I need this inside a shell-script on a Linux system. One-liners are preferred.


USB HDD not working on linux

I have a WD My Passport 1 TB external hard drive which is giving me some problems on different linux machines:   * When I plug it in, nothing happens   * Gparted when detecting connected devices says _"Error opening /dev/sdb: No such device or address"_ and it doesn't list the hard drive   * Typing on terminal `sudo fdisk -l` the hard drive is not listed This happens on both my main Debian PC and on my Raspberry Pi, but I can use the hard drive perfectly normally on my Mac. I can't check its S.M.A.R.T. status since it's a USB hard drive, but I don't think the HDD is failing, because if so it wouldn't work on my Mac. I checked and reformatted the drive several times on my Mac but it still doesn't work on linux. Any ideas on what's going on? **Edit:** here is the output of `lsusb`:               Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 001 Device 000: ID 1058:0730 Western Digital Technologies, Inc.      Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.      Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB     Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB     Bus 001 Device 006: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB      As you can see, the device is listed here (Bus 001 Device 000). **Edit x2:** This is kern.log file since when the hard drive was connected:   * via dropbox: https://www.dropbox.com/s/e11tb8bsstxrgyl/kern.log   * via fpaste: http://fpaste.org/127795/87285661/. **Edit x3:** The hard drive has 4 partitions; two are HFS+ and two are FAT32. The partition table is GUID. **Edit x4:** I found this question about one error in the kernel log file I found too, which means the USB 3.0 drive is requesting too much power from the computer. However I tried using a USB power splitter cable (so that the HDD could have 1000 mA instead of 500 mA) and it didn't solve the problem. The HDD seems to be rated 600 mA, but I've always used on USB 2.0 ports without problems.


Can a process running in a linux container communicate with another process running on the host OS via IPC?

I have 2 processes A and B. Currently, both A and B are running on the same OS (RHEL6.2) and the processes can intercommunicate via TCP sockets. My objective is to run process B in a Linux Container and still have it communicate (send/receive messages/signals) with process A on the host OS. I've been unable to find a clear answer after a few days of searching the web. Can this be done or are containers completely isolated? If so, how can I achieve this? I'm very new to this concept.


Writes to FrameBuffer /dev/fb0 do not seem to change graphics screen

In attempting to write directly to the graphics frame buffer /dev/fb0 , (Ubuntu 12.04) , the graphics screen does not change. Has Ubuntu 12.04 invalidated the use of /dev/fb0 , or does it need to be activated in some way ?


BSD Net/1 was a free fully operating system?

I think that the old BSD Net/1 was not a fully operating system, but an add-on to 4.3BSD for VAX, as I realize from http://gunkies.org/wiki/Net/1 and http://gunkies.org/wiki/Net/2   Is it right? In the same web page I read: "This software suite is copyright The Regents of the University of California and may be freely redistributed. No previous license, either AT&T or Berkeley is required. The release costs $400.00 US." So, it was free or not?   I think that someone could have bought just one copy and then give other copies to all his friend. Is it right? Now the last question: If Net/1 was an add-on, users had also to buy a Unix license from AT&T?   Could someone give me more info?   Thanks to all.


Do I need to install LIRC separately in Fedora 18?

I just finished installing Fedora 18 and out of the box I noticed that it recognizes my IMON/MCE Remote control. I have had to make some changes to the rc_keymaps/imon_mce file to remap some of the keys, but it is pretty accurate. However, when I use the remote with XBMC, I see that I sometimes get multiple presses instead of just one. For instance, if I press the down arrow once quickly, it will scroll down several lines very fast before stopping. I've done a little searching online and have seen a lot of talk about Lirc, and the need to ensure that only Lirc is decoding the keypresses and not both Lirc and the kernel. However, from what I understand Lirc is already built into the kernel, so I am a little confused. If I check which protocols are listening, I see only rc-6:               # cat /sys/class/rc/rc0/protocols      [rc-6]      What do I need to do to fix this problem? Additionally, when I modify the imon_mce file, what service do I need to restart in order to reread the new file? I know I can force it using ir- keytable, but I presumed that there must be some service that loads up upon bootup.


Conky above full screen

I would like to run an instance of conky on top, that is, to always be visible. I tried to use               own_window yes     own_window_type normal     own_window_class conky     own_window_transparent no     own_window_hints undecorate,above,sticky,skip_taskbar,skip_pager      I don't know what all these commands means but it works (partially). The problem is that it is not visible if I am using a pdf in full screen mode, like slides during a presentation. How can I do this? ps: I'm trying to run it to show a small clock to have time control during the presentation.


Enabling multicast communication between 2 AIX JVM processes

I'm having trouble with multicast distribution on a single AIX machine between two JVM processes. Think ehcache or jgroups. In order to enable on Mac OS X:               route add -net 224.0.0.0 -interface lo0      On Linux (from JGroups doco, untested)               route add -net 224.0.0.0 netmask 224.0.0.0 dev lo      What is the equivalent command for AIX?


automated bug reporting tool always says "invalid password or login"

Every time I get an ABRT bug in Fedora 20 and I try to report it, I have to enter my BZ login/PW again. How do I setup ABRT so that it saves my ID/PW and/or just logs in and reports my bugs when I tell it to?


Client-server app for sending and monitoring asynchronous jobs

I am looking for a desktop app/IDE in which you can:   1. Maintain a list of UNIX/Linux connections   2. Be able to write a script locally in a local editor, not SCP files to the host or writing them on the host directly   3. Run it in a chosen directory on a remote host from #1 above by SCP-ing first   4. Be able to do #3 above one-time or permanent   5. Have a console of remote jobs that monitors requests   6. Ability to send data from the host back to the client in the form of a structured named pipe rather than SCP-ing files    7. Preferably have an API to do all of this in Java (`Jsch` can do most of this but I've had some difficulty and would like to try something else too) Is there free software out there that matches the above requirements? We have Autosys where I work and we can do some of the above items in it but it is not free and not so great for ad-hoc/on-demand jobs.


What does "Empty print file" mean and how can I diagnose it?

When trying to print I get this error. What does it mean? How can I diagnose it?


Add a new user steps for Oracle Linux 5

It's been over 10 years since I last used RedHat (which I believe that Oracle Linux came from). So I cannot remember the steps to create a new user, add them to the appropriate groups, set up their home environment, etc. I can find individual commands for Oracle Linux, but no work flow on how to go about the process (as in what steps an admin must follow to do the complete process of adding a new user to the Oracle Linux environment). Could someone provide the recommended steps when a new user is required for a Oracle Linux system please? --- edit --- I should note that I'm dealing with a headless system so I need to know how to do this from the command line. Looking at the resources on the oracle site keeps showing GUI ways to do things intermingled with the CLI. For example, it states the command of how to create a user at the command line, but doesn't show how to set the user name via the command line. Instead it shows the GUI User Manager tool.


iotop but for particular disk?

Is there a tool like `iotop` but for monitoring IO on specific volumes? (Or perhaps I missed a way to filter `iotop`?) If not is there any way to get at this information via (say)`/proc`? (`dstat` etc. only show aggregate activity across all processes per volume, whereas I'm interested in seeing how much each process is contributing.)


Reading from USB serial port under Cygwin

I am actually using Cygwin, but it is my understanding that it responds to Unix commands so hopefully I am in the correct place. I have an Arduino hooked up via USB to my LapTop for data reading. I want to be able to simultaneously be able to output the serial port data to the shell for my viewing and also save all that data as a text file. Is there a command I can use to do this?


Determine how much a process is using each disk?

How do I tell how much load a particular process is contributing to each of several available volumes/mounts? It seems that `dstat` only shows aggregate stats across all processes per disk, and `iotop` only shows aggregates stats across all disks per process.


Vim 7.3 with Lua: How do I use it?

The latest Vim release is awesome! I compiled it with `\--enable-luainterp=yes` and it does have the Lua feature:               % gvim --version | egrep '\+lua'     +linebreak +lispindent +listcmds +localmap +lua +menu +mksession +modify_fname       But how do I actually use it? Up until now, I was always using Vim script for my files, but how do I let it interpret Lua? And what are the bindings that I can use from inside Lua?


XMonad MouseResizableTile automatic pane rebalancing

How can I automatically update the number of windows in the master pane to be the same as or close to the number of windows in the slave pane, while still supporting the default `mod-,` and `mod-.` keys? I've tried to configure XMonad to arrange windows how I want them automatically, and this is the one area where I still find myself making frequent manual adjustments. I think I want to send `IncMasterN` messages at open/close, depending on which column has more windows (or at least that would be enough to get me started), but I'm not clear on how to find `nmaster` at run-time, and my previous attempt at sending such a message seemed to result in an infinite loop (see excerpt below; CPU usage went to 100% and XMonad stopped responding, like it was still stuck in the log hook). Any tips?               main = do         xmonad $ gnomeConfig {             logHook    =  balancePanes         } where             balancePanes :: X()             balancePanes = do                 ws <- gets windowset                 let howMany = windowCount ws in do                     when (howMany == 3) (sendMessage (IncMasterN 1))


Understanding getlogin spoofing

My question is in three (or so) related parts: 1) My understanding is that `getlogin()` will effectively return the `auid` associated with the process and so isn't actually changable by the user. Is that understanding true? 2) I found this old exploit regarding `getlogin()` used in pam_wheel. I'm familiar with each individual command but not sure I understand how they're accomplishing the end effect. It seems they're accepting input from a symlink called `tty1` which is also the same tty name the root user is on. How is it that the symlink succeeded? Shouldn't /dev/tty1 already be there if `root` is shown as being logged into it (in utmp)? 3) I was just starting out with GNU/Linux (like abut a year or so into it) when this exploit was written up, so it's possible that I'm unaware of some previous iteration in Linux identity/privilege management. How could a normal user create that symlink? I know `/dev` was a static list of `mknod` files back then, but reads/writes on symlinks get evaluated by the hardlink referenced, correct? I realize this is on a udev-based `/dev` hierarchy, but by way of example this is one pty on one of my systems:               crw--w----. 1 jadavis6 tty 136, 3 May 27 00:47 /dev/pts/3      Shouldn't the above prevent any user that's not `jadavis6` nor in the `tty` group access (via symlink or otherwise) for reading or writing? Were the permissions in `/dev` more liberal pre-`devfs`/`udev`? Also, how does reading from the TTY grant the process you're currently in root access? I could see using it to spy on the remote session by reading everything written to the tty device, but how are they getting `logname` to change for them? Are the subsequent commands (after the redirect from tty1) just what is happening on the root console or is there something at play here that actually led to this be a way to get root? If it's the latter, is this exploit really `su` specific? I mean won't a lot of functionality be opened up if all you have to do is create a symlink to a device file and then your `auid` is now root? **Answer:** Found out most of the critical information above in this question


I installed Fedora 20 using the liveOS. While taking the updates I am getting the following result:               [root@localhost bioinfo]# yum update     Loaded plugins: langpacks, refresh-packagekit     Error: Cannot retrieve metalink for repository: fedora/20/i386. Please verify its path and try again      How do I fix this error?


install mysql 5.5(remi) with centos 6.2 complains error

Finished Dependency Resolution     Error: Package: mysql-server-5.5.31-1.el6.remi.i686 (remi)                Requires: libz.so.1(ZLIB_1.2.0)      I type `yum --enablerepo=remi install mysq` and these error appears. I have epel installed already.


Inserting the results of a for loop into an html file - BASH

I have a script that takes the results of a command and puts them into a html code. Here's what I have so far...               #!/bin/bash          list_dir=`ls -t downloads/`          for i in $list_dir     do     #----       #       echo "$i"     #----attempt 1        #           ` sed -n 'H;${x;s/placeholder .*\n/<a href="downloads/$i">$i</a>\                            &/;p;}' index.html`     done      I'm trying to get the results of the for loop to replace the contents of the html file where it says "placeholder" (I would rather have it just insert the content below a certain point without having the placeholders). I'm not too certain how to go about this.


Set dual screen on Fedora

I would like to set dual screen mode on my Fedora 18 XFCE (what I mean is that I want to be able to display different content on every screen). Currently my screens shows the same, i.e. the secondary one is the mirroring primary one. I have a laptop plugged into the docking station with other monitor if that matters. I actually tried to play with `xrandr` but didn't succeed. This command `xrandr --output VGA1 --left-of LVDS1` does what I want but I still can't drag and drop applications between the screens


What does -u of diff really do?

Looks like `-u` can take an extra number argument, but I don't quiet get the manual, It says,                 -u, -U NUM, --unified[=NUM]               output NUM (default 3) lines of unified context      Someone name an example please? I couldn't find a working one.


Redirecting only stderr to a pipe

This code snippet is from Advanced Bash Scripting Guide.               # Redirecting only stderr to a pipe.          exec 3>&1                              # Save current "value" of stdout.     ls -l 2>&1 >&3 3>&- | grep bad 3>&-    # Close fd 3 for 'grep' (but not 'ls').     #              ^^^^   ^^^^     exec 3>&-                              # Now close it for the remainder of the script.          # Thanks, S.C.      The comments explains the code closes fd 3 only for 'grep'. but the closes fd 3 twice. Why we need to do like this? Is it wrong to close fd 3 only one time for 'grep' like this?               ls -l 2>&1 >&3 | grep bad 3>&-


Automate workflow in shell

Coming from GUI interfaces I've come to finally understand the power of having everything piped in text, but I don't really know how to use all that power yet. I realized the workflow for a particular project goes like this...               # compile repo 1     cd ~/workspace/repo1     make -B     # deploys compiled code into repo2     make deploy          # commit repo 1     cd ~/workspace/repo1     git add .     git commit -m "changes"     git push origin master          # commit repo 2     cd ~/workspace/repo2     git add .     git commit -m "changes"     git push origin master      My question isn't so much how to accomplish this, it's what is the right tool for this? Reading around it seems that a Bash script is what I need, but I'd like to know from the experts.


Pass colors from ls through pipe to awk 'print' statement

This is a follow-up to my question from yesterday, Show sum of file sizes in directory listing. Thanks to Zero Piraeus and a point in the right direction by Mauritz Hansen, I now have               function dir() {             ls -FaGl "${@}" | awk '{print; total += $4}; END {print "\t\ttotal: ",total/1024,"KB"}'     }      in my `.bash_profile`, and it works great. However, at least on Linux (I haven't had a chance to try it on OSX yet), where I'm `ssh`ing in using PuTTY on XP, my dir colors are now gone. Is there some way of passing the color codes through the pipe to the awk `print` statement? ### Update Thanks to Sukminder's answer, adding `\--color=always` does the trick, as it had been set to `auto` before. However, I now get a blank space between the end of the directory listing and the total line:               [19:30:58 mattdmo@server ~/webapps/django15 ] $ dir     drwxr-xr-x  7 mattdmo 4096 Mar 24 20:28 ./     drwxr-xr-x 17 root    4096 Mar 18 20:15 ../     drwxr-xr-x  7 mattdmo 4096 Mar 14 14:57 apache2/     drwxr-xr-x  3 mattdmo 4096 Mar 14 14:57 bin/     drwxr-xr-x  2 mattdmo 4096 Mar 24 20:10 lib/     drwxr-xr-x  3 mattdmo 4096 Mar 14 14:57 myproject/     drwxrwxr-x  3 mattdmo 4096 Mar 24 20:28 pigimal/                          total:  28 KB     [19:30:59 mattdmo@server ~/webapps/django15 ] $      Any suggestions on fixing this?


Is the output mixed like this because of xargs and how can I fix it?

I'm learning a bit of Bash by using xargs to list whois records for a bunch of IP addresses. The command used is:               echo "$1" | tr "\n" "\0" | xargs -0 -n 1 -t -P 3 -I %  sh -c 'echo "\n 44rBegin whois record -- \n"; whois -h whois.arin.net % ; echo "\n 44rEnd whois record -- \n"'      The executed commands are:               sh -c echo "\n 44rBegin whois record -- \n"; whois -h whois.arin.net 206.190.36.45 ; echo "\n 44rEnd whois record -- \n"     sh -c echo "\n 44rBegin whois record -- \n"; whois -h whois.arin.net 212.146.69.237 ; echo "\n 44rEnd whois record -- \n"     sh -c echo "\n 44rBegin whois record -- \n"; whois -h whois.arin.net 77.238.184.24 ; echo "\n 44rEnd whois record -- \n"      I want the output to appear as if each block of commands executed using `sh -c` is executed sequentially. Instead my output is something like:               44rBegin whois record          44rBegin whois record          44rBegin whois record          whois1 output          44rEnd whois record --          whois2 output          44rEnd whois record --          whois3 output          44rEnd whois record --      How can I fix this problem?


Comparing an string by value of a floating number to a number

I wrote the code below:               for j in `cat output_10.txt`          do          dri=`echo $j |cut -d':' -f1`      nu=`echo $j |cut -d':' -f2`     tot=`echo $j |cut -d':' -f3`     fre=`echo $j |cut -d':' -f4`               if [ $fre > 2 ]                     then                     echo " $fre 	" >>mailbody.html                     else                     echo " $fre 	" >>mailbody.html     fi     done       where the value of fre is being read from output_10.txt file and is a something like 9.8. The issue is that the `else` condition is not working even if the value of the `$fre` is less than 2 . I want if the value of `$fre` is less than 2, the `else` condition work and it should display the color red in my HTML page. As of now green color is displayed in my HTML page for both the cases.


libc.so.6(GLIBC_2.14)(64bit)

Installed:       glibc-static.x86_64 0:2.12-1.107.el6_4.4                                 glibc-utils.x86_64 0:2.12-1.107.el6_4.4          Dependency Installed:       fontconfig.x86_64 0:2.8.0-3.el6        freetype.x86_64 0:2.3.11-14.el6_3.1     gd.x86_64 0:2.0.35-11.el6        libX11.x86_64 0:1.5.0-4.el6       libX11-common.noarch 0:1.5.0-4.el6     libXau.x86_64 0:1.0.6-4.el6             libXpm.x86_64 0:3.5.10-2.el6     libxcb.x86_64 0:1.8.1-1.el6               [root@host728 ~]# rpm -Uvh pptpd-1.3.4-2.fc19.x86_64.rpm     warning: pptpd-1.3.4-2.fc19.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 862acc42: NOKEY     error: Failed dependencies:             libc.so.6(GLIBC_2.14)(64bit) is needed by pptpd-1.3.4-2.fc19.x86_64             libc.so.6(GLIBC_2.15)(64bit) is needed by pptpd-1.3.4-2.fc19.x86_64          [root@host728 ~]# uname -a     Linux host728.me.net 2.6.32-042stab079.4 #1 SMP Thu Jul 18 18:57:29 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux     [root@host728 ~]#      What am I missing here? Do I need a different RPM that is RHEL based? I am running CentOS 6.x


Change the default terminal for all .desktop files?

My `htop.desktop` launches XTerm, but I want to change the default terminal to xfce4-terminal in all "Terminal=true" .desktop files.


if env variable exists then exit out of script

#!/bin/bash        if  [[ -n "$MYVAR" ]]; then exit; fi     # otherwise the rest of the script continues...      I'm trying to exit out of a shell script if a certain ENV variable is 0. The script above does not seem to work (I've also tried using `return` instead of `exit`. Can someone explain how this would be done, or what's wrong with the line above? When I type that in my terminal (replacing exit with `echo "YES"` it works just fine.


How to use nemo actions to mount an iso file?

I read these articles: https://wiki.archlinux.org/index.php/Nemo   https://wiki.archlinux.org/index.php/Mounting_images_as_user and try use `Nemo Actions` to mount `iso` files but nothing happened while I clicked the context menu option. My steps:   1. `sudo pacman -S fuseiso`   2. create `nemo-actions-iso-mount.sh` in `/usr/bin/`              #!/bin/bash         FILE=$(basename "$1")         MOUNTPOINT="$HOME/Desktop/$FILE"       fuseiso -p "$1" "$MOUNTPOINT"        3. `sudo chmod a+x /usr/bin/nemo-actions-iso-mount.sh`   4. create the script `mountiso.nemo_action` in `$HOME/.local/share/nemo/actions/`              [Nemo Action]        Name=Mount Image File: %N        Comment=Create an folder in ~/Desktop with the name of the image file        Exec=/usr/bin/nemo-actions-iso-mount.sh %N         Selection=S        Extensions=iso;nrg;bin;img;mdf;         Mimetypes=*/*


Are there other LSM (Linux Security Modules) in addition to SELinux and AppArmor?

In researching this U&L Q&A titled: permission denied for ptrace under GDB, the question came up, "Is there other software similar to SELinux & AppArmor?". User @IwillnotexistIdonotexist mentioned 2 that I'd never heard of: Smack & Yama. He found them by searching through the Linux source code. So now we're up to 4.   * SELinux   * AppArmor   * Smack   * Yama Are there others?


Guide/help using Dialog with bash scripting

While I understand how to create menus, no guide I've found teaches how to actually link them to commands I was hoping to have something like:               dialog--clear --title "n00b's spellbook" \             --menu "Choose thine spell:" 20 51 4 \             1 "Name of program"  "blah" \             2 "Name of other program" "blah" \      then somehow 1 runs `./program1` and 2 runs `./program2`


command to determine ports of a device (like /dev/ttyUSB0)

I have a question regarding the ports in Linux. If I connect my device via USB and want to check its port I cant do it using the command lsusb, which only specifies bus number and device number on this bus:               [ziga@Ziga-PC ~]$ lsusb     Bus 003 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC      **Is there a command that tells me the port the device is connected to directly?** Only way to do this untill now was to disconect and reconnect and using the command:               [ziga@Ziga-PC ~]$ dmesg | grep tty     [    0.000000] console [tty0] enabled     [    0.929510] 00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A     [    4.378109] systemd[1]: Starting system-getty.slice.     [    4.378543] systemd[1]: Created slice system-getty.slice.     [    8.786474] usb 3-4.4: FTDI USB Serial Device converter now attached to ttyUSB0      In the last line it can be seen that my device is connected to **/dev/ttyUSB0**.


How do I highlight the current line and the cursor in .vimrc?

I am trying to highlight the current line as well as the cursor position in Vim. Here's my .vimrc:               set cursorline     hi CursorLine ctermbg=8 ctermfg=15 "8 = dark gray, 15 = white     hi Cursor ctermbg=15 ctermfg=8      The problem I'm experiencing is that the current line background color covers up the cursor background color, so it looks like this: ![The current line is highlighted but the cursor is not.](http://i.stack.imgur.com/KSlH8.jpg) I can obviously tell where the cursor is because the foreground color is almost black, but when the cursor is on a space or at the beginning/end of a line I have no clue where it is unless I move it. ![The cursor is at the end of the line, though you'd never know it.](http://i.stack.imgur.com/i6YJP.jpg) What am I doing wrong here?


Return username of the user who just logged in within a login script

I'm writing a login script for OSX 10.8. I need to know the name of the user who logged in via the Login Window within a login script. I've tried "whoami", "$USER", and "ls -l /dev/console | awk '{print $3}'", but they all return "root". I assume this is because login scripts run as root, not as the user who authenticated at the Login Window. Here's an example: If I login as "bob", or "john", I want the to be able to set a variable to "bob", or "john".


ls in glorious 256 colours

Apart from the ls colors solarized theme, is there any other ls colour themes out there that you would recommend for a dark background with a urxvt terminal?


What is Unix for the OpenVMS DUMP command?

In OpenVMS the DUMP command: > Displays the contents of a file, a directory, a disk volume, a magnetic tape > volume, or a CD-ROM volume in decimal, hexadecimal, octal format, ASCII, or > formatted data structures. This is frequently used when a file is not a simple text file where the content has a mixture of data types such as strings and integers. What is the Unix/Linux command for this?


Why does (GNU?) parallel fail silently, and how do I fix it?

In a larger script to post-process some simulation data I had the following line:               parallel bnzip2 -- *.bz2      Which, if I understand `parallel` correctly (and I may not), should run n-core threads of the program over all files with the listed extension. You may notice that I misspelled the command `bunzip2`. I would expect a warning or error message here, but it fails silently. Is this intended? How do I not get bit by this in the future? **Update:** It is possible that I have a different `parallel` installed than I think I do:               > parallel --version`               parallel: invalid option -- '-'     parallel [OPTIONS] command -- arguments         for each argument, run command with argument, in parallel     parallel [OPTIONS] -- commands         run specified commands in parallel      A man page of `parallel` on my system gives:                parallel(1)                                                        parallel(1)     NAME            parallel - run programs in parallel     ....     AUTHOR        Tollef Fog Heen      Which seems this is _not_ the GNU version.


Installing jdk7 on Debian server via SSH

Currently, I'm trying to launch a java program on a server. The server is launched on my virtual machine (VirtualBox) and controlled over SSH. Its OS is Debian. So, in order to launch my program I need jdk7. I've downloaded its tar.gz archive to the server and extracted it to `/usr/jav`a. But the system can't see the new jdk. When I type "java -version" in my terminal it writes 1.6 instead of desired 1.7. So, a trivial question: how can I install jdk7 on Debian? (No GUI is available).


Flatten shell script (include sourced scripts) and remove unused functions

I am manually tweaking Debian init scripts in order to optimize the boot time of an embedded device. So far I reduced it by half just with the "low hanging fruits" ie. the smaller scripts that are easy to understand. Now I am left with a few init scripts that take about 20s to run in total. Based on the experience from the other scripts, I can gain another 5 to 10 seconds here. The problem is those scripts are a bit too hard for me to understand because they source several helper scripts from `/lib/init/` which are difficult to follow (`mount-functions.sh` being the first culprit). In order to make those remaining scripts easier to understand so that I can optimize them, I'd like some way to "pre-process" those init scripts so that whenever they source a file it gets inlined in the script itself (recursively of course), and remove the unused functions to unclutter the code. Is there a tool for this?


Removing certain fields from a CSV file

I have a large CSV file (~15GB) which a client has sent over as an export of a table. The format is a follows:               field, ... , field, field which sometimes contains commas,     another field which sometimes contains commas, field, ... , field      Consequently, I can't import the data because of the shift produced in some rows where the fields contain one or more commas. I do not need the data in those two fields, so getting rid of them would probably be the best option. Consequently, to avoid the two fields in the middle that cause trouble, I was thinking of something that for each row would take the first 9 fields (the ones before the two) and the last 57 fields (the ones after the two). I'm guessing this is something that can be done with `sed` or `awk` but my expertise with these tools (or whatever may be better) is rather limited.


Rename multiple files, sub directories, and insert characters at specific location on OSX

I have files and directories starting with **"cateory-icon-"** in many sub directories. I am trying to rename them recursively to **"category-icons-"**. Please note that I added missing **"g"** to the **category** and **"s"** at the end of **icons**. I did look at tons of other questions dealing with renaming multiple files and directories but could not make any of them work for me! A little bit explanation about the answer would be greatly appreciated. EDITED: Here is an example of my directory structure:               test/cateory-icon-archery/cateory-icon-archery.png                               cateory-icon-archery@2x.png          test/cateory-icon-automotive/cateory-icon-automotive.png                                  cateory-icon-automotive@2x.png


OpenWrt: prevent that an IP address could be reachable in the network, excluding a few hosts

So there is a network: 192.168.1.0/24. Router is an OpenWrt 12.04 on a WRT160NL. We got a new network printer. But it's www server is reachable to everyone in the network (and thus everyone can print with it..). **Q:** How can I disable the network access for all the machines in 192.168.1.0/24 - and only let 2 IP's ex.: 192.168.1.10 and .20 to access the printer? - there isn't ANY access control on the network printer...


Why the duplications in the command line output

Entering the following command prints duplicates as shown below. Not all lines print twice but some do. What gives?               XXXX:~ XXXX$ man -k pid     pid(ntcl)                - Retrieve process identifiers     pidpersec.d(1m)          - print new PIDs per sec. Uses DTrace     rwbypid.d(1m)            - read/write calls by PID. Uses DTrace     syscallbypid.d(1m)       - syscalls by process ID. Uses DTrace     git(1)                   - the stupid content tracker     Sub::Exporter::Cookbook(3pm) - useful, demonstrative, or stupid Sub::Exporter tricks     Tcl_DetachPids(3tcl), Tcl_ReapDetachedProcs(3tcl), Tcl_WaitPid(3tcl) - manage child processes in background     getpid(2), getppid(2)    - get parent or calling process identification     pid(ntcl)                - Retrieve process identifiers     pidpersec.d(1m)          - print new PIDs per sec. Uses DTrace     pthread_setugid_np(2)    - Set the per-thread userid and single groupid     rwbypid.d(1m)            - read/write calls by PID. Uses DTrace     syscallbypid.d(1m)       - syscalls by process ID. Uses DTrace     wait(2), wait3(2), wait4(2), waitpid(2) - wait for process termination     git(1)                   - the stupid content tracker     XXXX:~ XXXX$


Where did scp put these files?

I ran an `scp` command to download some files from an SSH server. Instead of using the `.` to put it in the current folder, I accidentally typed `*`. It looks like scp copied the files and put them somewhere. My command was similar to this:               $moshe> scp username@server.com:~/SomeDirectory/SubDir/* *      I meant to type something more like this:               $moshe> scp username@server.com:~/SomeDirectory/SubDir/* .      Where would they be?


Pacman could not find gnome-system-tools ArchLinux

I tried to install gnome-system-tools on ArchLinux using pacman . I've run pacman -Syy before but pacman could not find the package. Here is my pacman.conf file               #     # /etc/pacman.conf     #     # See the pacman.conf(5) manpage for option and repository directives          #     # GENERAL OPTIONS     #     [options]     # The following paths are commented out with their default values listed.     # If you wish to use different paths, uncomment and update the paths.     #RootDir     = /     #DBPath      = /var/lib/pacman/     #CacheDir    = /var/cache/pacman/pkg/     #LogFile     = /var/log/pacman.log     #GPGDir      = /etc/pacman.d/gnupg/     HoldPkg     = pacman glibc     # If upgrades are available for these packages they will be asked for first     SyncFirst   = pacman     #XferCommand = /usr/bin/curl -C - -f %u > %o     #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u     #CleanMethod = KeepInstalled     Architecture = auto          CheckSpace     SigLevel = Never          # REPOSITORIES          [testing]     #SigLevel = PackageRequired     Include = /etc/pacman.d/mirrorlist               [community]     Include = /etc/pacman.d/mirrorlist          [multilib]     Include = /etc/pacman.d/mirrorlist          [core]     #SigLevel = PackageRequired     Include = /etc/pacman.d/mirrorlist          [extra]     #SigLevel = PackageOptional     Include = /etc/pacman.d/mirrorlist          #[community-testing]     #SigLevel = PackageRequired     Include = /etc/pacman.d/mirrorlist          [community]     #SigLevel = PackageOptional     Include = /etc/pacman.d/mirrorlist          [multilib-testing]     #SigLevel = PackageRequired     Include = /etc/pacman.d/mirrorlist          [multilib]     #SigLevel = PackageOptional     Include = /etc/pacman.d/mirrorlist      Do I miss a repository ? Thanks for your help.


Why can't I boot off my Debian update CD?

I downloaded a .iso file with the name `debian-update-6.0.4-amd64-DVD-1.iso` from http://debian.org and burned it with `k3b` with default settings, but unfortunately found it won't boot. Did I download the wrong image? There are three folders in the image file: `.disk`, `dists`, and `pool`.


Schedule halt using ConsoleKit and Dbus

I have been playing with Dbus (versions 1.4.0, in Ubuntu 10.10 and 1.4.14) and ConsoleKit (versions 0.4.1 and 0.4.5) to reboot or halt my computer without being a superuser. Everything works fine in both versions. If I execute the commands detailed in this page, the systems halts or reboots without troubles. Now, what I'd like to know is whether I can schedule that halt/reboot at a certain time (still using Dbus/ConsoleKit). Something like the `shutdown` command can do (`shutdown -h 10:56`) Is that possible? I can always use an `at` or `cron`, but if I can do it straight with `dbus`, that'd be perfect.


Can't see the free disk space of the drive

I am installing redhat 6 with pendrive, I get only two drives option for installing one is the whole hard disk and the other is pendrive, but I've created a free logical disk of 30 GB in windows. I am unable to view my other disks or the free disk as well. Anyone please help


Automatic internet connection on startup in OpenBSD?

I just installed the OpenBSD in my computer. I am completely new to Unix-like operating systems. I've learned how to connect to my wireless network using the following commands (even though I don't quite know what they mean):               ifconfig iwn0 nwid [network name] wpa wpapsk [password]     dhclient iwn0      I am looking for a way to connect just after the boot. Thank you.


How to limit a search to the current line

VIM newbie here. I'm trying to write a mapping that will let me move around 'common' insertion points in a line when in insert mode. For ex. I have the delimitMate plugin - so typing a opening delimiter automatically closes the delimiter and puts me in between. once I've typed the text that goes inside, I usually want to jump to the end of the delimiter and stay in insert mode. Taking this forward, for a function like below                $("#someid").live("someevent", function (param1, param2) {      What I'd like is a insert mode mapping that lets me jump to after the first of any of the following delimiter chars (quote, double quote, parens, and/or EOL) and cycle over these points. Checked VIM documentation for search - the \%l operator allows to restrict over a specific line number. I tried \%.l (. being current line ) - but this doesn't work. Any ideas? **UPDATE**               :exe  "/\\%" . line(".") . "l[{}()\"':=\\[\\],]"      seems to work - but doesnt move the cursor to the match.


Pinguy OS 11.04 WiFi and Wired Networking is not working

I was attempting to install Pinguy OS from a YUMI created USB thumb drive, with the computer wired to my router. The internet, however, was not working. After the install, it still is not working. Wireless itself refused to work, most likely because I do not have the drivers. I was using a DELL Inspiron 1520. I assumed it might be an issue with my router or connection itself, so I went onto my Windows laptop (I hadn't powered it on in a day, and we have issues with connectivity every once in a while). I am sending this message from said laptop, the internet is having absolutely no problems. What do you suggest I do? I know that the driver required is Broadcom STA from prior experience with different versions of Linux on the computer. Before this, I was using Kubuntu 10.10 on the said computer. Thanks in advance! Edit: Is there any possible way for me to download the driver on Windows, put it on a USB drive, extract the tar.gz onto Pinguy, and run the makefile? I've tried that, and I'm not 100% sure it worked. I'm restarting now, just in case it doesn't tell me I need to restart because of it being ran outside of the normal program. Edit 2: The things mentioned in the previous edit do not appear to have worked.


Fedora 14 install Fedora 19 software?

I am using Fedora 14 right now and find some software in the fc14 repository is a little old. I need some software in my machine to be updated, say, to the Fedora 19 version. Without upgrading the system, what is the best practice to do so?


Advantages/Disadvantages of installing GRUB on a software RAID?

What **Advantages** are there to installing GRUB on a software RAID-1? What **Disadvantages** are there to installing GRUB on a software RAID-1? * * * I ask this because most tutorials/help sections seems to assume that GRUB is on a _normal_ (i.e not on a RAID) partition. So is there a strong case against installing GRUB on a software RAID? or is this just convention? Everything below is a reflection of my limited knowledge, be warned it is bound to contain errors. If you find errors I'd appreciate it if you offered corrections or/and explanations, Thanks :0) So for me personally (as a newbie) having installed to RAID-1 it's made tutorial/recovery instructions more confusing. e.g `fsck /dev/sda1` is OK for non-RAID systems but **NOT** something that should be done on individual md drives (AFAIK). Also my understanding is that since it's a software RAID that a failure on the first boot drive will halt booting anyway. (I.E. can only use RAID-1 for boot because actually it's not loaded as a RAID drive initially until enough of the OS has loaded to manage md drives. So it's only reading data from the first drive anyway when loading GRUB)


Fedora 18: Unable to connect to a WLAN network

I'm using Fedora 18 with the LXDE desktop. I seem to be unable to connect to any WLAN network. The network manager applets seem to accept only WEP but no WPA encryption. Am I missing something, or is WLAN networks on Fedora 18 broken right now? Wired network is working OK, WLAN used to work OK with Linux Mint on the same laptop.


init.d script is not starting under virtualbox

The script is in /etc/init.d:               #!/bin/bash          VMUSER=myname     CURRDATE=(`date +"%m-%d-%Y"` + `date +"%H:%M:%S"`)     CURRTIME=(`date +"%X"`)     FILE=/home/myname/log/vm-services.log     VBPATH=/usr/bin               start(){             echo "Starting VM Guest"        echo "Starting VM Services on $CURRDATE at $CURRTIME" >> $FILE        sudo -u $VMUSER $VBPATH/VBoxManage startvm sherbet --type headless     }          stop(){             echo "Stopping VM Guest"        echo "Stopping VM Services on $CURRDATE at $CURRTIME" >> $FILE        sudo -u $VMUSER $VBPATH/VBoxManage controlvm sherbet savestate     }          restart(){        echo "Restart"        echo "Restarted on $CURRDATE at $CURRTIME" >> $FILE     }          case "$1" in      start)        echo "In Start" >> $FILE        start        ;;      stop)        stop        ;;      restart)        restart        ;;      *)         echo "Usage: vm-service {start|stop}"         exit 1     esac      When I reboot the script stop is called. But Ubuntu restarts the start is never called. The script seems to have the correct execute settings: ![enter image description here](http://i.stack.imgur.com/rV9mJ.jpg) The echo for shutdown is working cause I see the entry.   I installed the script as follows: => sudo update-rc.d vm-services defaults 99 01 I can manually start/stop with no problems: =>/etc/init.d/vm-services start =>/etc/init.d/vm-services stop Any advise would be appreciated **Update 8/19/2014 - 1:24PM**I modified the script above now includes VBPATH that points to the VBoxManage path. But it doesnt work. The stop is always called when it reboots but the start never gets hit. Just sending the string to the file doesnt get hit. On reboot it does it everytime.


/usr partition filled up, need to make it larger or mount it somewhere else

I have 160 GBhdd. I have `ubuntu` on about 30GB and Rest is `PC-BSD` 9.0. On PC-BSD, my /usr is about 11GB and that is all used up. I realize that when I try to install ubuntu inside `VirtualBox`. I need 15GB at least. I am complete newbie here and I do not understand how 11GB became /usr partition's limit. I do not recall making any such decision while installation. BTW, for now, to solve my problem, here is output of `gpart`. How can I extend /usr? OR, how can I make the home dirs which are now part of /usr/home separate from /usr?               [root@pcbsd] ~# gpart show     =>       63  312581745  ada0  MBR  (149G)              63    2002879        - free -  (978M)         2002942   60825602     2  ebr  (29G)        62828544    6000640     1  linux-data  (2.9G)        68829184       9341        - free -  (4.6M)        68838525  243738180     3  freebsd  [active]  (116G)       312576705       5103        - free -  (2.5M)          =>       0  60825602  ada0s2  EBR  (29G)              0   7997442       1  linux-swap  (3.8G)        7997442  48828416  126944  linux-data  (23G)       56825858      1230          - free -  (615k)       56827088   3998514  902018  linux-data  (1.9G)          =>        0  243738180  ada0s3  BSD  (116G)               0    4194304       1  freebsd-ufs  (2.0G)         4194304    8101888       2  freebsd-swap  (3.9G)        12296192    4194304       4  freebsd-ufs  (2.0G)        16490496  227247684       5  freebsd-ufs  (108G)          [root@pcbsd] ~# df -k     Filesystem         1024-blocks     Used    Avail Capacity  Mounted on     /dev/label/rootfs0     2063900   570260  1328528    30%    /     devfs                        1        1        0   100%    /dev     /dev/label/var0        2063900   207488  1691300    11%    /var     /dev/label/usr0      111838140 11911712 90979380    12%    /usr     procfs                       4        4        0   100%    /proc     linprocfs                    4        4        0   100%    /compat/linux/proc      ![Disk Usage Analyzer for entire disk](http://i.stack.imgur.com/KOLOD.png) ![Disk Usage Analyzer for /usr which is filling up](http://i.stack.imgur.com/mYARc.png)


Running python script from terminal without .py extension

I want to call a python script _script.py_ from the terminal by simply typing _script_. Is this possible? If so, how? I know I can avoid typing _python script.py_ by adding _#!/usr/bin/env python_ to the top of the script, but I still have to add the suffix _.py_ in order to run the script.


Getting error during Installation of Cross Binutils in Linux From Scratch -7.5

I am building my first LFS 7.5 using Linux Mint-13 (32-bit) While preparing Binutils for compilation(5.4.1):               ../binutils-2.24/configure  \     --prefix=/tools             \                          --with-sysroot=$LFS         \     --with-lib-path=/tools/lib  \     --target=$LFS_TGT               \     --disable-nls                   \     --disable-werror.      I have got following error :               bash: --with-sysroot=/mnt/lfs--with-lib-path=/tools/lib--target=i686-   lfs-linux-gnu: No such file or directory      This is the output I'm getting:               lfs@jaassi-virtual-machine /mnt/lfs/tools/binutils-2.24 $ ../binutils-2.24/configure \     --prefix=/tools/binutils-2.24      binutils-2.24/         binutils-2.24.tar.bz2       > --prefix=/tools/binutils-2.24       binutils-2.24/         binutils-2.24.tar.bz2       > --prefix=/tools/binutils-2.24        > checking build system type... i686-pc-linux-gnu     > checking host system type... i686-pc-linux-gnu       checking target system type... i686-pc-linux-gnu       checking for a BSD-compatible install... /usr/bin/install -c       checking whether ln works... yes       checking whether ln -s works... yes        checking for a sed that does not truncate output... /bin/sed       checking for gawk... gawk       checking for gcc... gcc       checking for C compiler default output file name... a.out        checking whether the C compiler works... yes       checking whether we are cross compiling... no       checking for suffix of executables...        checking for suffix of object files... o       checking whether we are using the GNU C compiler... yes       checking whether gcc accepts -g... yes       checking for gcc option to accept ISO C89... none needed       checking for g++... g++       checking whether we are using the GNU C++ compiler... yes       checking whether g++ accepts -g... yes       checking whether g++ accepts -static-libstdc++ -static-libgcc... yes       checking for gnatbind... no       checking for gnatmake... no       checking whether compiler driver understands Ada... no       checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2       checking for objdir... .libs       checking for version 0.10 of ISL... no       checking for version 0.11 of ISL... no       checking for default BUILD_CONFIG...        checking for bison... bison -y       checking for bison... bison       checking for gm4... no       checking for gnum4... no       checking for m4... m4       checking for flex... no       checking for lex... no       checking for flex... no       checking for makeinfo... no       checking for expect... no       checking for runtest... no       checking for ar... ar       checking for as... as       checking for dlltool... no       checking for ld... ld       checking for lipo... no       checking for nm... nm       checking for ranlib... ranlib       checking for strip... strip       checking for windres... no       checking for windmc... no       checking for objcopy... objcopy       checking for objdump... objdump       checking for readelf... readelf       checking for cc... cc       checking for c++... c++       checking for gcc... gcc       checking for gcj... no       checking for gfortran... no       checking for gccgo... no       checking for ar... ar       checking for as... as       checking for dlltool... no       checking for ld... ld       checking for lipo... no       checking for nm... nm       checking for objdump... objdump       checking for ranlib... ranlib       checking for readelf... readelf       checking for strip... strip       checking for windres... no       checking for windmc... no       checking where to find the target ar... just compiled       checking where to find the target as... just compiled       checking where to find the target cc... host tool       checking where to find the target c++... host tool       checking where to find the target c++ for libstdc++... host tool       checking where to find the target dlltool... just compiled       checking where to find the target gcc... host tool       checking where to find the target gcj... host tool       checking where to find the target gfortran... host tool       checking where to find the target gccgo... host tool       checking where to find the target ld... just compiled       checking where to find the target lipo... host tool       checking where to find the target nm... just compiled       checking where to find the target objdump... just compiled       checking where to find the target ranlib... just compiled       checking where to find the target readelf... just compiled       checking where to find the target strip... just compiled       checking where to find the target windres... just compiled       checking where to find the target windmc... just compiled       checking whether to enable maintainer-specific portions of Makefiles... no       configure: creating ./config.status       config.status: creating Makefile       lfs@jaassi-virtual-machine /mnt/lfs/tools/binutils-2.24 $ --with-sysroot=$LFS       $LFS      $LFS_TGT         lfs@jaassi-virtual-machine /mnt/lfs/tools/binutils-2.24 $ --with-sysroot=$LFS\       > --with-lib-path=/tools/lib\       > --target=$LFS_TGT \       > --disable-nls\       > --disable-werror       bash: --with-sysroot=/mnt/lfs--with-lib-path=/tools/lib--target=i686-   lfs-linux-gnu: No such file or directory      How can I resolve this?


Optimised ZFS in low RAM environment feasibility?

I am currently setting up a file server and have come to the point of actually setting up the data drives. The system has 4 drives (one OS disk, 3 data disks). The OS disk is formatted as ext4 and won't be added to the ZFS pool (if I Choose to run ZFS).my main concern is data integrity and minimum risk of data loss(drive caching is disabled in bios) . For this ZFS seems to be the perfect candidate, since it has a stable version for Linux (correct?), and supports data duplication, pooling and raidz, where the hard-drives don't have to be the same size. But here is my problem. The server only has 2GB of RAM and this cannot be upgraded in the near future, and realistically only 1.5 will actually be accessible to ZFS after I install all the other services. A maximum of about 10 clients will use it at any one time (more like 4 on average). Is this too low to be considered safe? From what I understand ZFS can crash in a low RAM situations and take the pool with it. I heard confliciting opinions whether swap will help in alleviating this problem (I have a 20 GB swap dedicated drive). Has anyone experienced data loss with ZFS with little RAM and what optimizations did you include to prevent that? Bearing in mind the above would it be possible to still run ZFS, albeit reduce ack size and trim it down a bit or will this be too risky? System specs: 2GB RAM 20GB swap drive OS, Debian 7, minimal install, with FTP, and XBMC, DNLA, (to give an idea of the RAM requirement). Used for storage server and music media streaming to other devices.


Filename completion in gvim

for some reason, my filename completion in gvim is not working. In vim, its working properly. Commands and such are, however, completed correctly. I have set `wildmode=full`. An example: Assume i want to open the file `main.c` I type `:op<Tab>` and gvim gives me a list with all possible completions (open and options). I choose open and continue to `:open m<Tab>`. I would expect gvim to now complete my file, what happens however, is this: `:open m^I`, no completion. As mentioned, in vim it works perfectly fine.


What's the use dirsync option for mount?

Today I stumbled upon this `mount`'s option: > `dirsync` All directory updates within the filesystem should be done > synchronously. This affects the following system calls: creat, link, unlink, > symlink, mkdir, rmdir, mknod and rename. What are some real-life use cases for this option? When would I want to use `dirsync` instead of `sync`?


How to create Virtual Network for VM's

I have downloaded a Linux Live CD which I am required to do pentesting using VirtualBox . Live CD is configured for router with Pool Starting Address 192.168.2.2 . Now problem is that my router is't configurable to that setting nor I am allowed to change anything in Live CD. How can i create a virtual network that can be configured as per this requirement ?


Arguments against Ubuntu?

As someone who's been using Ubuntu for a couple of years now both in production and at home, when seeking answers to certain administrative questions for my systems, I often hear the "that's what you get for being on [Ubuntu | Debian]" comment, seemingly indicating that there's something fundamentally ineffective about this specific distro that I'm using. Often you'll hear CentOS/RHEL/Fedora recommended instead. E.g. argument would be: " _Ubuntu starts services by default on`apt-get install` instead of allowing to you change their `configs` before boot_", which sometimes can be convenient when working with configuration management tools. Personally I don't care too much about any specific distro, but I do deeply care about productivity, simplicity, stability and availability of latest versions of critical packages. Now, would anyone be so kind as to explain why Ubuntu tends to receive much criticism from the Linux community, and what my options are? What would be some of the gains if I were to switch to a different distro?