Set default permisson for newly folders and files in Linux

I'm using OpenSuSE and my computer has only 2 accounts: root and me.I have a directory `/srv/www/htdocs/abc`. I just want to set it up so that when new folders or files are created in this directory they will have the permissions set to 777. When new files are created in this directory, I have to set them to 777 again to gain write access. I use root and type:               chmod me /srv/www/htdocs      But I doesn't work. How can I do that?


How can I recover damaged file from overwritten ext4 partition?

My disk, which was previously ext4 has been formatted and Windows has been installed. I want to recover my previous files (family photos, ..) and I tried everything I could find on the internet. I first cloned an image of the disk to work on it, and I've tested Testdisk, but I couldn't do anything with it. In fact, when I analyze the disk I can find the partition (multiple instances, I don't know why) but when I list the files it doesn't find anything and give the message error: "can't open filesystem. Filesystem seems damaged". I also tried to look for superblocks but still the same error. `e2fsck` tell's me : "the superblock could not be read or does not describe a correct ext2 filesystem".


small Linux host for virtual box

Does anybody know a small and simple Linux distribution that contains not much more than the "VirtualBox" program? I'd like to set up a machine that actually needs some kind of graphical display plus VirtualBox, which should automatically boot the productive OS as a virtual system.


How to make an ext4 file writable on mounting by a user (not root)

I have been trying to write onto a newly created partition My partition block is /dev/sda6 I am unable to write anything onto that partition. My Corresponding fstab file is this               /dev/disk/by-id/ata-WDC_WD5000BEVT-24A0RT0_WD-WXD1EA0TV384-part7 swap                 swap       defaults              0 0     UUID=827020aa-bccf-493e-acdc-21dd8eb98639 /                    btrfs      defaults              1 1     /dev/disk/by-id/ata-WDC_WD5000BEVT-24A0RT0_WD-WXD1EA0TV384-part8 /boot                ext4       acl,user_xattr        1 2     proc                 /proc                proc       defaults              0 0     sysfs                /sys                 sysfs      noauto                0 0     debugfs              /sys/kernel/debug    debugfs    noauto                0 0     devpts               /dev/pts             devpts     mode=0620,gid=5       0 0     /dev/sda6            /home/hawk/gentoo            ext4       users,gid=users,fmask=133,dmask=022                   1 2      If I format it back to any other windows based file system such as fat I am able to both read and write


To pass a parameter with sed

For my script I have to read the data from a file. For example I have 2 files: one is a text file, the second is a csv file with 10 columns. What I am trying to do is to read the csv and change the parameters in the first file.   1. Using `sed -n` to read the data one row at a time and save this in a `fileC`   2. Using `sed "s/&replacefile1param/&readFileC/g"` What I have issue is to read the `cat` of `readFileC` as a parameter in the second step. How can I do this? The first file is a sample script file with 2 parameters inside. The second file is a CSV file with 200 lines with 6 columns. I need to change the template file by reading the columns from the CSV, and substituting the parameters. The result need to be 200 file1 and each result needs to be saved in the location specified in the the 4th column of the CSV as well. ### Sample template file               The name =scriptname          The staments go here          job name = jobname          exit      ### Sample CSV data               scriptname,jobname,date,location,updated,env     kkkkkk,filetest,2001-01-01,/san00/project,test     kkkkk2,filetest2,2001-01-01,/san00/project,test     kkkkk3,filetest3,2001-01-01,/san00/project2,real      I need to replace the parameters in the template file with values taken from the CSV, and save the file in the `/san00` location from the 4th column of the CSV. ### Desired output               The script name kkkkkk          The staments go here          job name = filetest          exit      This should be saved in `san00/project`.


Is there a PAM Standard?

Related to a StackOverflow question I have. Since it's more or less really a SO question through and through, I won't go into the whole spiel. My platform question is this: Is there an industry standard somewhere that specifies how various aspects of PAM should operate?


Why is du giving me unexpected output?

I'm new to Linux, so sorry for my simple question. I'm on Ubuntu. I have this directory:               $ ls -al     total 16     drwxr-xr-x 2 alberto alberto 4096 2011-04-03 16:02 .     drwxr-xr-x 4 alberto alberto 4096 2011-04-03 16:01 ..     -rw-r--r-- 1 alberto alberto    7 2011-04-03 16:02 .hidden     -rw-r--r-- 1 alberto alberto    4 2011-04-03 15:51 testfile      When I run `du`, I'm expecting this:               $ du     4   testfile     4   .hidden      But I'm getting this:               $ du     12  .     $ du *     4   testfile     $ du .*     12  .     20  ../snippet     12  ../test     52  ..     4   .hidden      Why is this happening?


How to enable autocompletion for remote paths when using scp?

I remote copied a file to my laptop using:               scp someFile USER@192.168.178.32:/home/USER/put/it/some/where/oh/damn/you/here      I want to be able to autocomplete the remote path by hitting tab.


Does Linux Kernel 3.5 have the improvement from 3.3?

Some weeks ago I updated to Linux kernel version 3.3 because Radeon Audio HDMI wasn't working on my laptop. The issue was fixed with the upgrade to version 3.3 (Though Suspend still doesn't work) I recently changed distributions, switching from Ubuntu to Mint and when I wanted to update to 3.3 I saw that 3.5 was out too(i'm not really kernel- aware). But after updating, my Radeon HDMI Audio stopped working again. So my question is: for me in logical order kernel 3.5 should have improvements from 3.3, except if it's a completely different branch which I don't know about. So why did it break my system? And is there any (easy) way to get the improvement made to radeon drivers from 3.3 to 3.5 ? (question already asked on superuser , but someone told me that will be better to move it here)


Check integrity of a dd backup

I just made a backup of an entire hard drive (50GB) over `ssh` via:               dd if=/dev/hda | buffer -s 64k -S 10m | ssh myuser@myhost "cat > ~/image.img"      What's now the best way to check the integrity of the file `image.img`, i.e. how to verify that everything is copied correctly?


Creating formatted partition from nothing

I need to create filesystem with just one partition from nothing (`/dev/zero`). I tried this sequence of commands:               dd if=/dev/zero of=mountedImage.img bs=512 count=131072     fdisk mountedImage.img         n         p          2048         131072      Basically, I need to create 64MB image file filled with zeroes. Then I use `fdisk` to add a new partition for new filesystem (which should finally be FAT32), starting at sector `2048` and using all remaining sectors.               losetup /dev/loop1 mountedImage.img     mkfs -t vfat /dev/loop1      But here I'm hitting problems. If I set up a `loop` device and format it using `mkfs -t vfat`, partition table is overwritten and filesystem (FAT32) is placed to disk. I don't need whole disk formatted with FAT32, I just need my primary partition to be so. Does anybody know how can I format only one partition of raw disk image, not whole image? Please help.


Untar directory from large tarball

How do I untar a directory that I don't know the path to? I only know the directory name. I know how to untar a single file with a wildcard: `tar -xf somefile.tar.gz --wildcards --no-anchored 'index.php'`


Is there a way to install and remove packages in a single yum command?

Is there a way to add and remove packages at the same time with a single `yum` command? For example, installing postfix and removing sendmail without running two separate commands/transactions.


From df device name to physical drive name (vendor / type)

Seeing the device name by df, is it somehow possible to resolve it to the physical drive name such as **vendor / type**.               /dev/sda3               915.4G     34.9G    880.0G   4% /share/HDA_DATA     /dev/sdd3                 1.8T    668.1G      1.1T  36% /share/HDD_DATA      I have learnt that I find some info in sys/block, but I do not find the vendor's type name in there? -- Added -- My system is a Linux based QNAP NAS, so things might be a little different there. For me as a non Linux expert hard to tell, what is "standard", and what not. -- Added as of Steven's answer --               [~] # hdparm -I /dev/sdb3          /dev/sdb3:      HDIO_DRIVE_CMD(identify) failed: Invalid argument


Running chsh does not change shell

I want to change my shell from bash to zsh. I have tried running the following while logged in as user zol:               $ chsh -s /bin/zsh     $ sudo chsh -s /bin/zsh zol     $ su -c 'chsh -s /bin/zsh zol'     # The above all results with:     $ password:     $ chsh: Shell not changed.          # zsh exists in /etc/shells..      chsh -l     /bin/sh     /bin/bash     /sbin/nologin     /bin/zsh      What could be wrong? How can I fix it?


"Short write" error message with wget

I got the following error when trying to pull down a 300 MB ISO. It appears to pull down 25 MB then stop. Any idea what's going on here?               ~ # wget http://centos.mbni.med.umich.edu/..../CentOS-6.2-x86_64-netinstall.iso     Connecting to centos.mbni.med.umich.edu (141.214.186.162:80)     CentOS-6.2-x86_64-ne  11% |**************| 25930k 00:00:39 ETA     wget: short write


Redirect http using iptables for an ip range

I have a range of ip addresses (10.13.13.10-19) that I want to redirect all outgoing http traffic to an internal webserver. So if someone in that range tried to access any site, the html from my webserver would be returned instead. However, I only want to affect that ip range. What iptables rules do I need on my router to make this happen?


How do I go to beginning of command line when I am inside the screen?

In bash I can hit `Ctrl` + `a` and go to first of the command line. But in `screen` `Ctrl` + `a` does not do this. How do I go to first of command line in screen?


Protecting data against bit rot

I have realized that I need to protect all of my photographs against bit rot (file corruption occurring at random due to errors in hard drives or network transfer). I recently discovered par2 which seems like a great program to create redundancy files and give the ability to detect and repair file corruptions. I don't think journaling file systems are the right solution here, since I want the protection to follow along with the files into my backup and when migrating onto new laptops. So, what I think I need is a script that can be run as a cronjob, maybe once an hour. It would look through all of the files that needs protection and update the redundancy files if files are added or changed (file has edit timestamp newer than redundancy arhive), and it would repair files if any file has been corrupted (file has changed but edit timestamp hasn't been updated). Is there any script or program that would do this? Or are there programs that solve the problem in another way? Or should I just write such a script myself (a would prefer not to, I want something robust and tested by a lot of users)?


In tcsh shell how I find a particular word in the command prompt?

Suppose I have the following line in my command prompt and the cursor is at the and of the line or the beginning of the line by using (`CTRL+A`)               [subhrcho@slc04lyo pcbpel]$ abc def ghi jkl      How can I navigate to a particular word say, for example, to `def`. I am using _tcsh_ shell in _linux_ with default binding which I suppose is _emacs_ mode. P.S:I do not have a `Meta` key in my keyboard. I can move forward or backward between words by using `CTRL+f` and respectively. So I think my `Meta` key is the `Esc` key. Please **correct me if that presumption is wrong**. `Alt` isn't working either as the meta key.I had a look at the emacs documentation but invoking `CTRL-s w` and then pressing `Enter` is not working for me. It would just try to execute whatever is there in the prompt by first appending a `w` character to it and the prompt would say :               [subhrcho@slc04lyo pcbpel]$ abc def ghi jklw     abc: Command not found.


Script to restart the application

I need to write a script for the below scenario in Linux:   * Run a cron every 5 minutes.   * `grep` the application log file to see if we can see the pattern "ORA-".   * If we see this pattern:     * stop the service.     * Rename the application log file with timestamp appended.     * Start the service. So each time there is a problem, within 5 minutes the application will get restarted.


Dual boot Linux partition scheme with encryption

I am trying to figure out how I should encrypt my machine. I am reorganizing and will have two 500GB drives. I am setting up a dual boot system (both linux). My prospective partition scheme: sda:   * `/boot`   * `/swap` [encrypted]   * `/[file system #1 - Xubuntu]` [encrypted]   * `/[file system #2 - Crunchbang]` [encrypted]   * `/home` [encrypted]   * `/data1` [encrypted] sdb:   * `/data2` [encrypted] the encryption schemes I’ve been looking at (dm-crypt and/or ecryptfs) are: sda:   * `/boot`   * `/VLM` [dm-crypt]      * swap     * `[file system #1 - Xubuntu]`     * `[file system #2 - Crunchbang]`     * `/home`     * `/data` sdb:   * `/data2` [dm-crypt] or sda:   * `/boot`   * `/swap` [dm-crypt]   * `/file system #1` [dm-crypt]   * `/file system #2` [dm-crypt]   * `/home`     * /home/xubuntu [ecryptfs]     * /home/crunchbang [ecryptfs]   * `/data1` [dm-crypt] sdb:   * `/data2` [dm-crypt] I want decryption of the sub-LVM disk (or individual file system depending on the case) encryption to trigger decryption of both home directories and the data partitions. encrypting with LVM would nead just one encrypt hook for the sdb encryption I suppose. Does one align more with best practices?


umount an external ntfs drive as non-root

I have ntfs-3g installed, and use this udev rule to auto mount external drives automatically. When I try umount it as non-root, it says:               umount: /media/umm is not in the fstab (and you are not root)      The device mounts as:               /dev/sdc1  fuseblk    150G  143G  6.6G  96% /media/umm      and is part of the `users` group. I did a `chkdsk` on a Windows machine to ensure no file system errors. Any ideas? (personally I'd prefer not to use ntfs, but I need it for sharing with all the non-UNIX systems and allow for files > 4GB).


How to align columns of multiple lines at a fixed distance with vim

Here is another one of my `vim` question (They seem to become my trademark here.). I have a really long file basically consisting of lines of the following form:               ;07     :ANZ textv      S9_1  9_1_K3_2  S9_3  S9_4 9_1_K3_5 S9_T1_1 S9_T1_2 S9_T1_3 S9_T1_4 S9_T1_5 S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10    9_V3n   E3              ;08     :ANZ textv      S9_1  9_1_K3_2  S9_3  S9_4 9_1_K3_5 S9_T1_1 S9_T1_2 S9_T1_3 S9_T2_4 S9_T1_5 S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10    9_V3n   E3       09     :ANZ textv       S9_1  9_1_K3_2  S9_3  S9_4 9_1_K3_5 S9_T1_1 S9_T1_2 S9_T1_3 S9_T3_4 S9_T1_5 S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10    9_V3n   E3            ;10     :ANZ textv      S9_1  9_1_K4_2  S9_3  S9_4 9_1_K4_5 S9_T1_1 S9_T1_2 S9_T1_3 S9_T1_4 S9_T1_5 S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10    9_V4n   E3              ;11     :ANZ textv      S9_1  9_1_K4_2  S9_3  S9_4 9_1_K4_5 S9_T1_1 S9_T1_2 S9_T1_3 S9_T2_4 S9_T1_5 S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10    9_V4n   E3       12     :ANZ textv       S9_1  9_1_K4_2  S9_3  S9_4 9_1_K4_5     S9_T1_1     S9_T1_2     S9_T1_3     S9_T3_4     S9_T1_5     S9_T1_6     S9_T1_7     S9_T1_8     S9_T1_9     S9_T1_10    9_V4n       E3            13     :ANZ text    S9_1  9_2_K1_2  S9_3  S9_4  9_2_K1_5    S9_T1_1 S9_T1_2 S9_T1_3 S9_T1_4 S9_T1_5 S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10         ;14     :ANZ text       S9_1  9_2_K1_2  S9_3  S9_4  9_2_K1_5    S9_T1_1 S9_T1_2 S9_T1_3 S9_T2_4 S9_T1_5 S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10         ;15     :ANZ text       S9_1  9_2_K1_2  S9_3  S9_4  9_2_K1_5    S9_T1_1 S9_T1_2 S9_T1_3 S9_T3_4 S9_T1_5 S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10          As you can see the columns of these lines are not aligned e.g. line `13` is misaligned with respect to lines `14` and `15` because of the `;`. But there are more difficult cases of misalignment. For example there are lines like this:               ;14     :ANZ text   S9_1  9_2_K1_2   S9_3  S9_4 9_2_K1_5         S9_T1_1    S9_T1_2 S9_T1_3 S9_T2_4 S9_T1_5 S9_T1_6 S9_T1_7       S9_T1_8 S9_T1_9   S9_T1_10         ;15     :ANZ text           S9_1  9_2_K1_2  S9_3     S9_4   9_2_K1_5    S9_T1_1 S9_T1_2 S9_T1_3 S9_T3_4 S9_T1_5     S9_T1_6 S9_T1_7 S9_T1_8 S9_T1_9 S9_T1_10          or whatever you can imagine. What I want is to align all columns such that between every column there are four spaces distance. For example, I want lines `;07-09` to look like this:               ;07     :ANZ    textv    S9_1    9_1_K3_2    S9_3    S9_4    9_1_K3_5    S9_T1_1    S9_T1_2    S9_T1_3    S9_T1_4    S9_T1_5    S9_T1_6    S9_T1_7    S9_T1_8    S9_T1_9    S9_T1_10    9_V3n    E3              ;08     :ANZ    textv    S9_1    9_1_K3_2    S9_3    S9_4    9_1_K3_5    S9_T1_1    S9_T1_2    S9_T1_3    S9_T2_4    S9_T1_5    S9_T1_6    S9_T1_7    S9_T1_8    S9_T1_9    S9_T1_10    9_V3n    E3        09     :ANZ    textv    S9_1    9_1_K3_2    S9_3    S9_4    9_1_K3_5    S9_T1_1    S9_T1_2    S9_T1_3    S9_T3_4    S9_T1_5    S9_T1_6    S9_T1_7    S9_T1_8    S9_T1_9    S9_T1_10    9_V3n    E3        Is there a way to do this with `vim` in an efficient way?


Why does this simple Perl client not work?

I am fairly new to IPC with sockets and expect this issue is a simple one to resolve. I'm trying to understand why I cannot get this example script from `perldoc perlipc` to run on my Ubuntu setup:               #!/usr/bin/perl -w     use IO::Socket;     $remote = IO::Socket::INET->new(                                      Proto    => "tcp",                                      PeerAddr => "localhost",                                      PeerPort => "daytime(13)",                                    )               || die "can't connect to daytime service on localhost";          while (<$remote>) { print }      The script `die`s because the TCP client cannot be established. Running `$ less /etc/services` shows me that `daytime(13)` is defined. What could be wrong here?


Is there an upper limit to the number of zombie processes you can have?

I used to work with an HP-UX system and the old admin told me there is an upper limit on the number of zombie processes you can have on the system, I believe 1024.   * Is this a hard fact ceiling? I think you could have any number of zombies just as if you can have any number of processes...?   * Is it different value from distro to distro?   * What occurs if we hit the upper limit and try to create another zombie?


Proxy problem in Mint 16

I recently installed Mint 16 alongside windows 8. I use the Internet through a proxy server in my campus.So after setting the proxy in the Network setting, I noticed that the Software center and the terminal cannot connect to the Internet.However, FireFox works fine and it has in its network settings to use the system proxy.So what is the problem? I can't install repositories using apt-get, help me please.


Pg Dn key returns tilde (~)

When I hit `Page Down` in terminal (I'm using Ubuntu 12.04), strangely I get the ~ (tilde) character. This is annoying especially when I searched my command line history and decided to go to the bottom to get my prompt back. Say, I have 1,351 lines of history. Found what I was looking for in line 869. I could just `backspace` or `Ctrl` + `C`, but I'd much prefer to go to the bottom. Anyone knows how to change this behavior?


fail to install kolab dependencies

I need some help. I'm trying to setup a kolab sever to be used by computer science students at my college, starting this fall. I had a bit of some trouble setting up ldap, bur after some experimenting it finally worked. Now I'm having trouble installing kolab. IN SUMMARY:               sudo apt-get install kolab          (...)          dpkg: error processing kolab-cli (--configure):      dependency problems - leaving unconfigured     dpkg: dependency problems prevent configuration of kolab-server:      kolab-server depends on pykolab (= 0.5.11-5); however:       Package pykolab is not configured yet.          (...)          dpkg: error processing kolab-saslauthd (--configure):      dependency problems - leaving unconfigured     Errors were encountered while processing:      pykolab      kolab-cli      kolab-server      kolab-conf      wallace      kolab      kolab-xml      kolab-mta      kolab-saslauthd      --->>>>> How can I fix this? I really would appreciate your help, my deadline is approaching fast.


What is this VIM plugin?

It's a modified vim bar that includes current path and current git branch. I've been looking around but couldn't find anything. ![enter image description here](http://i.stack.imgur.com/lU78y.png) ![enter image description here](http://i.stack.imgur.com/PauqK.png) Found in: https://github.com/w0ng/vim-hybrid


Ways to give a process "idle" network priority

When I'm playing a game, I don't want Dropbox taking hogging my network connection. I have been able to noticeably reduce my latency by turning it off while playing. The same is true to a lesser extend for web browsing. I'm looking for network equivalents for niceness and scheduling policies (`SCHED_BATCH` etc. in schedtool). Does such a thing exist? Alternatively, automatically cutting off network access for a specific process while another one is running would work too.


How to configure for an Authenticating Proxy Server

My work proxy server requires authentication with the Microsoft AD domain user credentials. Everybody knows how it works: If you log in on a Windows workstation, your "Internet Explorer" browser based internet access requests are automatically authenticated (and identified) using your domain login credentials. I found that Firefox can also authenticate against these proxy servers and long assumed that they "do something special". Recently a colleague installed Linux Mint in a VM and to my surprise he was busy getting updates from the internet. When I asked how he got it wo work he shrugged and said "It just worked" This prompted me to re-look at the proxy settings. I run Kubuntu (with a mix of G* and K* applications, but I only use the GTK applications when I'm convinced that they are much better than anything K*) I do still have a copy of Windows guest running in a VirtualBox VM, mainly for Printing and for accessing internal/corporate web sites (Which both requires authentication and identification via MS domain credentials) as well as for changing my domain password every so many days. So it would be very helpful if I could get [some/most/all] of my Linux applications to work via the proxy server. My most urgent needs are for Akregator and Muon to be able to work. Other applications that may benefit are some apps that auto-update (Eg Virtual Box Extentions) or wrap themselves around a browser (Get More Themes/Wall Papers/etc comes to mind, and the occasional use of wget) SSH/SCP clients manage to work via the firewall without authentication. What is the right way (tool and/or procedure) to configure this, ideally in a single location because having to maintain my password in multiple locations is a recipe for getting locked out of my account :-/ Oh, and it would be a dream come true if I could have the equivalent to the Firefox "Quick Proxy" proxy disable/enable utility, eg one click to enable or disable the use of proxy, without heaving to log out and back in, depending on what network I'm on. Actually thinking about it, a utility should be trainable to look at your IP address and know when you need to use the proxy! But I digress. I imagine running a local proxy server which can dynamically add the authentication and forward to an upstream proxy server when needed may be the only real solution.


What happens when you read a file while it is overwritten?

Suppose I read (cat) a file while another process is rewriting its contents. Is the output predictable? What would happen?


How to find/correct error in a path

It's often that a long path is mistyped or you get a log file entry that a path does not exist. Is there a command or shell function that navigates the path hierarchy until it finds a matching path? The command line exchange could go like this:               $ ls /var/lib/my/supper/complicated/path     File or directory not found     $ fixpath /var/lib/my/supper/complicated/path     Found /var/lib/my      As a bonus feature, a similarity detection would be great:               $ fixpath /var/lib/my/supper/complicated/path     Found /var/lib/my     Did you mean /var/lib/my/super/complicated/path


Slow network with e1000

I've got a problem with my network speed. I sometimes have full download speed (i.e. 5 MB/s, which is about my max. internet dl-speed) and sometimes comparable slow speed (about 0.5 MB/s). This is affects **both** internet and home network! When I got slow network speed it stays that way until I 'renew' the module for my PCI network card (`sudo rmmod e1000` followed by `sudo modprobe e1000`). Then I've got full speed again for at least a few minutes, if I'm lucky even for a few hours... I've got no idea where to look for such an error (and how to get rid of it). Any help/suggestion is appreciated! EDIT2: **'Solution'** : I'm using a PCIe NIC now and everything works fine. EDIT: Xubuntu 12.10 (also tried other recent Distros like openSUSE and Fedora because of this issue, same results) Kernel 3.5.0-26-generic #42-Ubuntu SMP Fri Mar 8 23:18:20 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux **ethtool eth0**               Settings for eth0:         Supported ports: [ TP ]         Supported link modes:   10baseT/Half 10baseT/Full                                  100baseT/Half 100baseT/Full                                  1000baseT/Full          Supported pause frame use: No         Supports auto-negotiation: Yes         Advertised link modes:  10baseT/Half 10baseT/Full                                  100baseT/Half 100baseT/Full                                  1000baseT/Full          Advertised pause frame use: No         Advertised auto-negotiation: Yes         Speed: 100Mb/s         Duplex: Full         Port: Twisted Pair         PHYAD: 0         Transceiver: internal         Auto-negotiation: on         MDI-X: Unknown         Supports Wake-on: umbg         Wake-on: g         Current message level: 0x00000007 (7)                                drv probe link         Link detected: yes'      **ethtool -S eth0**               NIC statistics:      rx_packets: 23955      tx_packets: 19121      rx_bytes: 23989358      tx_bytes: 2096615      rx_broadcast: 17      tx_broadcast: 4      rx_multicast: 556      tx_multicast: 310      rx_errors: 0      tx_errors: 0      tx_dropped: 0      multicast: 556      collisions: 0      rx_length_errors: 0      rx_over_errors: 0      rx_crc_errors: 0      rx_frame_errors: 0      rx_no_buffer_count: 0      rx_missed_errors: 0      tx_aborted_errors: 0      tx_carrier_errors: 0      tx_fifo_errors: 0      tx_heartbeat_errors: 0      tx_window_errors: 0      tx_abort_late_coll: 0      tx_deferred_ok: 0      tx_single_coll_ok: 0      tx_multi_coll_ok: 0      tx_timeout_count: 0      tx_restart_queue: 0      rx_long_length_errors: 0      rx_short_length_errors: 0      rx_align_errors: 0      tx_tcp_seg_good: 9      tx_tcp_seg_failed: 0      rx_flow_control_xon: 0      rx_flow_control_xoff: 0      tx_flow_control_xon: 0      tx_flow_control_xoff: 0      rx_long_byte_count: 23989358      rx_csum_offload_good: 23035      rx_csum_offload_errors: 0      alloc_rx_buff_failed: 0      tx_smbus: 0      rx_smbus: 0      dropped_smbus: 0      **dmsg** (partially, `/var/log/kern.log` says quite the same concerning e1000)               [12113.565834] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI     [12113.565838] e1000: Copyright (c) 1999-2006 Intel Corporation.     [12114.045957] e1000 0000:08:00.0: eth0: (PCI:33MHz:32-bit) 90:e2:ba:39:b1:17     [12114.045965] e1000 0000:08:00.0: eth0: Intel(R) PRO/1000 Network Connection     [12114.056047] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready     [12114.056399] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready     [12116.058691] e1000: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX     [12116.059516] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready     [12245.684427] irq 18: nobody cared (try booting with the "irqpoll" option)     [12245.684432] Pid: 0, comm: swapper/2 Tainted: P           O 3.5.0-26-generic #42-Ubuntu     [12245.684433] Call Trace:     [12245.684435]  <IRQ>  [<ffffffff810e1c1d>] __report_bad_irq+0x3d/0xe0     [12245.684443]  [<ffffffff810e1f24>] note_interrupt+0x1b4/0x200     [12245.684448]  [<ffffffff810df6b7>] handle_irq_event_percpu+0xa7/0x1f0     [12245.684451]  [<ffffffff810df84e>] handle_irq_event+0x4e/0x80     [12245.684454]  [<ffffffff810e2a5a>] handle_fasteoi_irq+0x5a/0x100     [12245.684458]  [<ffffffff81015082>] handle_irq+0x22/0x40     [12245.684461]  [<ffffffff8168ad4a>] do_IRQ+0x5a/0xe0     [12245.684466]  [<ffffffff816812ea>] common_interrupt+0x6a/0x6a     [12245.684467]  <EOI>  [<ffffffff8139145a>] ? intel_idle+0xea/0x150     [12245.684474]  [<ffffffff8139143b>] ? intel_idle+0xcb/0x150     [12245.684479]  [<ffffffff81525009>] cpuidle_enter+0x19/0x20     [12245.684482]  [<ffffffff81525639>] cpuidle_idle_call+0xa9/0x240     [12245.684486]  [<ffffffff8101c48f>] cpu_idle+0xaf/0x120     [12245.684489]  [<ffffffff81669baa>] start_secondary+0x1de/0x1e5     [12245.684491] handlers:     [12245.684496] [<ffffffffa0148a60>] oxygen_interrupt [snd_oxygen_lib]     [12245.684501] [<ffffffffa0ae8540>] e1000_intr [e1000]     [12245.684502] Disabling IRQ #18      **/proc/interrupts**                      CPU0       CPU1       CPU2       CPU3              0:         43          0          0          0   IO-APIC-edge      timer       1:          3          0          0          0   IO-APIC-edge      i8042       8:          1          0          0          0   IO-APIC-edge      rtc0       9:          0          0          0          0   IO-APIC-fasteoi   acpi      12:          4          0          0          0   IO-APIC-edge      i8042      16:     143514      62226     106210     312347   IO-APIC-fasteoi   ehci_hcd:usb1, nvidia      17:        126          0          0         98   IO-APIC-fasteoi   snd_hda_intel      18:        495      20639     179361     199518   IO-APIC-fasteoi   snd_oxygen_lib, eth0      23:      30450     257271     182367     175510   IO-APIC-fasteoi   ehci_hcd:usb2      41:          1          0          0          0   PCI-MSI-edge      xhci_hcd      42:          0          0          0          0   PCI-MSI-edge      xhci_hcd      43:          0          0          0          0   PCI-MSI-edge      xhci_hcd      44:          0          0          0          0   PCI-MSI-edge      xhci_hcd      45:          0          0          0          0   PCI-MSI-edge      xhci_hcd      46:          1          0          0          0   PCI-MSI-edge      xhci_hcd      47:          0          0          0          0   PCI-MSI-edge      xhci_hcd      48:          0          0          0          0   PCI-MSI-edge      xhci_hcd      49:          0          0          0          0   PCI-MSI-edge      xhci_hcd      50:          0          0          0          0   PCI-MSI-edge      xhci_hcd      51:      40805       8429      38266      34073   PCI-MSI-edge      ahci      52:          0          0          0          0   PCI-MSI-edge      ahci      53:         11          0          0          0   PCI-MSI-edge      mei     NMI:        924        997        962       1005   Non-maskable interrupts     LOC:     895029    1172293     876204     941898   Local timer interrupts     SPU:          0          0          0          0   Spurious interrupts     PMI:        924        997        962       1005   Performance monitoring interrupts     IWI:          0          0          0          0   IRQ work interrupts     RTR:          3          0          0          0   APIC ICR read retries     RES:     435704      55688      17924      11697   Rescheduling interrupts     CAL:      43826      56182      55976      43671   Function call interrupts     TLB:      24234      30699      30637      27213   TLB shootdowns     TRM:          0          0          0          0   Thermal event interrupts     THR:          0          0          0          0   Threshold APIC interrupts     MCE:          0          0          0          0   Machine check exceptions     MCP:         79         79         79         79   Machine check polls     ERR:          0     MIS:          0


make: i686-linux-gcc: Command not found

I am using Ubuntu-11.10 amd64 and trying to cross-compile a linux-2.6.38.8 kernel for a 32-bit target.I tried               make CROSS_COMPILE=i686-linux- ARCH=i386      But I got error               make: i686-linux-gcc: Command not found     CHK     include/linux/version.h     CHK     include/generated/utsrelease.h     CC      kernel/bounds.s     /bin/sh: i686-linux-gcc: not found     make[1]: *** [kernel/bounds.s] Error 127     make: *** [prepare0] Error 2      I know there is not any i686-linux-gcc compiler on my system. I don't know how to install it too.               echo $path       shows               /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin      I created **symlinks** too but no results. Any help will be greatly appreciated.


What makes an operating system "Unix-Like"?

I frequently come across the term "unix-like" on the internet on many sites. There is no standard; it is just in the way it behaves. But if I were to develop a kernel from scratch, what would make it considered "unix-like"? Basically, what are the things that make written code like Unix?


How to create folder shortcuts in file manager?

![enter image description here](http://i.stack.imgur.com/Nvjsn.jpg) I'm using Thunar. What i want is remove `Networks` since i don't use it, and add `Lello` below `videos`. I know if you right click on any folder like `videos` you can remove the shortcut, I don't know how to add shortcuts.


Why doesn't "sudo su" in a shell script run the rest of the script as root?

A sample script can be as below:               #!/bin/bash     sudo su     ls /root      When using `./test.sh` as the normal user, instead run `ls` as super user and exit, it switches to root; and when I logout, it executes `ls /root` as the normal user. Can anybody tell me about the mechanism about it?


Disable the GIO network extension?

I don't use any LAN, so the following "Network" is useless to me: ![enter image description here](http://i.stack.imgur.com/XJtcz.png) I checked the source code partially and it seems to be using the GIO network extension. How can I disable this without modification of the source code ?


Detached screen on a remote host

I have a local script that runs a remote script via ssh. The local script is minecraft.php:               ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {$this->pemkey} {$this->ssh_user} sudo /vol/start_bukkit.sh      The remote script is /vol/start_bukkit.sh:               #!/bin/bash     cd "/vol/bukkit"     /usr/bin/screen -S bukkit -m -d /usr/local/bin/java -Xnoclassgc -Xms1024M -Xmx1024M -jar /vol/bukkit/craftbukkit.jar nogui      What happens is that the java command works, launching craftbukkit.jar, but screen doesn't launch a new window. What's going on? How can a new window be created? If I sign in to the remote server and run start_bukkit.sh then screen works as expected, creating a newly detached window running craftbukkit.jar in it. **EDIT:** I got it to work. I updated the local script by removing the sudo and putting the screen command in. Here it is:               ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {$this->pemkey} {$this->ssh_user} /usr/bin/screen -S bukkit -m -d /vol/start_bukkit.sh      On the remote side I removed the screen command:               #!/bin/bash     cd "/vol/bukkit"     /usr/local/bin/java -Xnoclassgc -Xms1024M -Xmx1024M -jar /vol/bukkit/craftbukkit.jar nogui      I can't explain why this works.


How do I create a bunch of files with different parameters in the body of each file?

So, say, I want to create a bunch of files named this way (where I have an original file "albedo10solar100" with text inside), where I vary albedo from 10 to 60 in steps of 10 and solar from 90 to 100 in steps of 5:   * albedo10solar100.m   * albedo10solar95.m   * albedo10solar90.m   * ...   * albedo20solar100.m   * albedo30solar100.m I would imagine that I would have to first use the cat command numerous times first on albedo10solar100, so I would first need some shell script that could cat albedo10solar100 > albedo{$m}solar{$n}. But then, what if I then wanted to batch replace every instance of 100 with 95 in the body of albedo10solar100? And so on for each additional file?


Replace multiple strings in a single pass

I'm looking for a way to replace placeholder strings in a template file with concrete values, with common Unix tools (bash, sed, awk, maybe perl). It is important that the replacement is done in a single pass, that is, what is already scanned/replaced must not be considered for another replacement. For example, these two attempts fail:               echo "AB" | awk '{gsub("A","B");gsub("B","A");print}'     >> AA          echo "AB" | sed 's/A/B/g;s/B/A/g'     >> AA      The correct result in this case is of course BA. In general, the solution should be equivalent to scanning the input left-to- right for a longest match to one of the given replacement strings, and for each match, performing a replacement and continuing from that point on in the input (none of the already read input nor the replacements performed should be considered for matches). Actually, the details don't matter, just that the results of the replacement are never considered for another replacement, in whole or in part. **NOTE** I am only looking for correct generic solutions. Please do not propose solutions which fail for certain inputs (input files, search and replace pairs), however unlikely they may seem.


Easiest way to sandbox an user

I'd like to sandbox a user so that they can only read files under `/media/shared/somefolder`. What's the easiest way to accomplish this? Users/groups? ACL? AppArmor? Some context: Plex Media Server is a media server with a web interface that allows you to browse all of your server's file-system searching for media files. I don't want users to be able to navigate my whole filesystem, not even in read-only mode! So I need to restrict the `plex` user.


Could not boot from an external hard drive

I burned a live session of Linux Mint 17 Cinnamon to a USB stick. Then I installed LM17C into an external hard drive by using this USB stick. I managed to do it and even successfully started on my computer. However I have tried to boot it on another computer, yet it did not started and gave the error below:               error: file '/boot/grub/i386-pc/normal.mod' not found.     entering rescue mode...     grub rescue >      My computer has an Intel processor, but the second PC has AMD. I think this is the problem. I do not know how to solve it, though.


Is it possible for a shell script to contain both tcsh and bash commands in the same script?

Say, I modify a lot of code that uses tcsh, but since a lot of people say that bash is more modern, I'd also like to learn bash along the way. Is it possible for me to use a script that contains both of these commands at the same time? Since this is for personal use, elegance is not an issue.


Creating a file from another file on the basis of a numeric value in each line

We will generate a csv file with below values.               yp1234,577,1,3     yp5678,570,3,5     yp9012,132,8,9      I need to extract data and create files based on second column. If it's value greater than 577 then the whole line has to be extracted and placed in a separate file. I mean I need a file having lines with second column greater than 577. Please assist using `sed` or `awk` command.


Emacs: mode-local macro with dashes and dots

In Emacs, how can I make a macro, that is local to the HTML mode, and uses dashes and dots? Take a look at the Elisp below:               (define-abbrev-table 'html-mode-abbrev-table        '(("..." "…")   ; won't work          ("---" "—")    ; won't work          ("aaa" "…")   ; works          ("bbb" "—") )) ; works


two instances of privoxy not working

SOLVED Always check for those pesky capital letters! In the privoxytor config file I had typed that the location of the config file as privoxyTor with a capital 'T' -why privoxy needs this I have know idea as it's accessing the file already. * * * After following the instructions here: https://trac.torproject.org/projects/tor/wiki/doc/RunTwoPrivoxys And, excepting one difference - I used the name privoxytor instead of privoxy2, I can't seem to get the second instance of privoxy running and can't find any more error messages. The original still starts up fine with "service privoxy start", but the new one, while not giving any error messages does not. running "service privoxytor status" gives: "privoxytor is not running ... failed!" here is my init.d file # ! /bin/sh               ### BEGIN INIT INFO     # Provides:          privoxytor     # Required-Start:    $local_fs $remote_fs $named $network $time     # Required-Stop:     $local_fs $remote_fs $named $network $time     # Default-Start:     2 3 4 5     # Default-Stop:      0 1 6     # Short-Description: Privacy enhancing HTTP Proxy     # Description:       Privoxy is a web proxy with advanced filtering     #                    capabilities for protecting privacy, filtering     #                    web page content, managing cookies, controlling     #                    access, and removing ads, banners, pop-ups and     #                    other obnoxious Internet junk.     ### END INIT INFO          # Author: Roland Rosenfeld <roland@debian.org>          # Do NOT "set -e"          # PATH should only include /usr/* if it runs after the mountnfs.sh script     PATH=/sbin:/usr/sbin:/bin:/usr/bin     DESC="filtering parent proxy server for Tor"     NAM=privoxy     NAME=${NAM}tor     echo $NAME     DAEMON=/usr/sbin/${NAME}     echo $DAEMON     PIDFILE=/var/run/${NAME}.pid     echo $PIDFILE     OWNER=${NAME}     echo $OWNER     CONFIGFILE=/etc/${NAME}/config     echo $CONFIGFILE     DAEMON_ARGS="--pidfile $PIDFILE --user $OWNER $CONFIGFILE"     SCRIPTNAME=/etc/init.d/${NAME}     LOGDIR=/var/log/${NAME}     DEFAULTSFILE=/etc/default/${NAM}          # Exit if the package is not installed     [ -x "$DAEMON" ] || exit 0          # Read configuration variable file if it is present     [ -r $DEFAULTSFILE ] && . $DEFAULTSFILE          # Create log directory if it does not exist     if [ ! -d "$LOGDIR" ]; then         mkdir -m 750 $LOGDIR         chown $OWNER:adm $LOGDIR     fi          # Load the VERBOSE setting and other rcS variables     . /lib/init/vars.sh          # Define LSB log_* functions.     # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.     . /lib/lsb/init-functions          #     # Function that starts the daemon/service     #     do_start()     {             # Return             #   0 if daemon has been started             #   1 if daemon was already running             #   2 if daemon could not be started             start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \                 || return 1             start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \                 $DAEMON_ARGS \                 || return 2             # Add code here, if necessary, that waits for the process to be ready             # to handle requests from services started subsequently which depend             # on this one.  As a last resort, sleep for some time.     }          #     # Function that stops the daemon/service     #     do_stop()     {             # Return             #   0 if daemon has been stopped             #   1 if daemon was already stopped             #   2 if daemon could not be stopped             #   other if a failure occurred             start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME             RETVAL="$?"             [ "$RETVAL" = 2 ] && return 2             # Wait for children to finish too if this is a daemon that forks             # and if the daemon is only ever run from this initscript.             # If the above conditions are not satisfied then add some other code             # that waits for the process to drop all resources that could be             # needed by services started subsequently.  A last resort is to             # sleep for some time.             start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON             [ "$?" = 2 ] && return 2             # Many daemons don't delete their pidfiles when they exit.             rm -f $PIDFILE             return "$RETVAL"     }          #     # Function that sends a SIGHUP to the daemon/service     #     do_reload() {             #             # If the daemon can reload its configuration without             # restarting (for example, when it is sent a SIGHUP),             # then implement that here.             #             start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME             return 0     }               case "$1" in       start)             if [ "$RUN_DAEMON" = "no" ]; then                 [ "$VERBOSE" != no ] && log_warning_msg "Not starting $DESC (disabled in $DEFAULTSFILE)."                 exit 0             fi                  [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"             do_start             case "$?" in                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;             esac             ;;       stop)             [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"             do_stop             case "$?" in                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;             esac             ;;       #reload|force-reload)             #             # If do_reload() is not implemented then leave this commented out             # and leave 'force-reload' as an alias for 'restart'.             #             #log_daemon_msg "Reloading $DESC" "$NAME"             #do_reload             #log_end_msg $?             #;;       restart|force-reload)             #             # If the "reload" option is implemented then remove the             # 'force-reload' alias             #             if [ "$RUN_DAEMON" = "no" ]; then                 [ "$VERBOSE" != no ] && log_warning_msg "Not restarting $DESC (disabled in $DEFAULTSFILE)."                 exit 0             fi                  log_daemon_msg "Restarting $DESC" "$NAME"             do_stop             case "$?" in               0|1)                 do_start                 case "$?" in                     0) log_end_msg 0 ;;                     1) log_end_msg 1 ;; # Old process is still running                     *) log_end_msg 1 ;; # Failed to start                 esac                 ;;               *)                 # Failed to stop                 log_end_msg 1                 ;;             esac             ;;       status)             status_of_proc "$DAEMON" "$NAME"             exit $?             ;;            *)             #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2             echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2             exit 3             ;;     esac          :      And here is the result of "strace /etc/init.d/privoxytor start"               execve("/etc/init.d/privoxytor", ["/etc/init.d/privoxytor", "start"], [/* 22 vars */]) = 0     brk(0)                                  = 0x161c000     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4df95c7000     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY)      = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=98415, ...}) = 0     mmap(NULL, 98415, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4df95ae000     close(3)                                = 0     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY) = 3     read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\357\1\0\0\0\0\0"..., 832) = 832     fstat(3, {st_mode=S_IFREG|0755, st_size=1595408, ...}) = 0     mmap(NULL, 3709016, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4df9020000     mprotect(0x7f4df91a0000, 2097152, PROT_NONE) = 0     mmap(0x7f4df93a0000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x180000) = 0x7f4df93a0000     mmap(0x7f4df93a5000, 18520, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4df93a5000     close(3)                                = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4df95ad000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4df95ac000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4df95ab000     arch_prctl(ARCH_SET_FS, 0x7f4df95ac700) = 0     mprotect(0x7f4df93a0000, 16384, PROT_READ) = 0     mprotect(0x7f4df95c9000, 4096, PROT_READ) = 0     munmap(0x7f4df95ae000, 98415)           = 0     getpid()                                = 2698     rt_sigaction(SIGCHLD, {0x40f270, ~[RTMIN RT_1], SA_RESTORER, 0x7f4df90524f0}, NULL, 8) = 0     geteuid()                               = 0     brk(0)                                  = 0x161c000     brk(0x163d000)                          = 0x163d000     getppid()                               = 2697     stat("/etc/privoxytor", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0     stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0     open("/etc/init.d/privoxytor", O_RDONLY) = 3     fcntl(3, F_DUPFD, 10)                   = 10     close(3)                                = 0     fcntl(10, F_SETFD, FD_CLOEXEC)          = 0     rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGINT, {0x40f270, ~[RTMIN RT_1], SA_RESTORER, 0x7f4df90524f0}, NULL, 8) = 0     rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7f4df90524f0}, NULL, 8) = 0     rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7f4df90524f0}, NULL, 8) = 0     read(10, "#! /bin/sh\n### BEGIN INIT INFO\n#"..., 8192) = 5094     write(1, "privoxytor\n", 11privoxytor     )            = 11     write(1, "/usr/sbin/privoxytor\n", 21/usr/sbin/privoxytor     )  = 21     write(1, "/var/run/privoxytor.pid\n", 24/var/run/privoxytor.pid     ) = 24     write(1, "privoxytor\n", 11privoxytor     )            = 11     write(1, "/etc/privoxytor/config\n", 23/etc/privoxytor/config     ) = 23     geteuid()                               = 0     stat("/usr/sbin/privoxytor", {st_mode=S_IFREG|0755, st_size=273616, ...}) = 0     faccessat(AT_FDCWD, "/usr/sbin/privoxytor", X_OK) = 0     faccessat(AT_FDCWD, "/etc/default/privoxy", R_OK) = -1 ENOENT (No such file or directory)     stat("/var/log/privoxytor", {st_mode=S_IFDIR|0750, st_size=6, ...}) = 0     open("/lib/init/vars.sh", O_RDONLY)     = 3     fcntl(3, F_DUPFD, 10)                   = 11     close(3)                                = 0     fcntl(11, F_SETFD, FD_CLOEXEC)          = 0     read(11, "#\n# Set rcS vars\n#\n\n# Because /e"..., 8192) = 1228     stat("/etc/default/rcS", {st_mode=S_IFREG|0644, st_size=620, ...}) = 0     open("/etc/default/rcS", O_RDONLY)      = 3     fcntl(3, F_DUPFD, 10)                   = 12     close(3)                                = 0     fcntl(12, F_SETFD, FD_CLOEXEC)          = 0     read(12, "#\n# /etc/default/rcS\n#\n# Default"..., 8192) = 620     read(12, "", 8192)                      = 0     close(12)                               = 0     faccessat(AT_FDCWD, "/proc/cmdline", R_OK) = 0     pipe([3, 4])                            = 0     clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4df95ac9d0) = 2703     close(4)                                = 0     read(3, "BOOT_IMAGE=/boot/vmlinuz-3.2.0-4"..., 128) = 95     read(3, "", 128)                        = 0     close(3)                                = 0     wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 2703     --- SIGCHLD (Child exited) @ 0 (0) ---     rt_sigreturn(0x11)                      = 2703     read(11, "", 8192)                      = 0     close(11)                               = 0     open("/lib/lsb/init-functions", O_RDONLY) = 3     fcntl(3, F_DUPFD, 10)                   = 11     close(3)                                = 0     fcntl(11, F_SETFD, FD_CLOEXEC)          = 0     read(11, "# /lib/lsb/init-functions for De"..., 8192) = 8192     read(11, " \" * Starting remote filesystem "..., 8192) = 3253     pipe([3, 4])                            = 0     clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4df95ac9d0) = 2704     close(4)                                = 0     read(3, "/lib/lsb/init-functions.d/20-lef"..., 128) = 46     read(3, "", 128)                        = 0     close(3)                                = 0     wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 2704     --- SIGCHLD (Child exited) @ 0 (0) ---     rt_sigreturn(0x11)                      = 2704     faccessat(AT_FDCWD, "/lib/lsb/init-functions.d/20-left-info-blocks", R_OK) = 0     open("/lib/lsb/init-functions.d/20-left-info-blocks", O_RDONLY) = 3     fcntl(3, F_DUPFD, 10)                   = 12     close(3)                                = 0     fcntl(12, F_SETFD, FD_CLOEXEC)          = 0     read(12, "# Default info blocks put to the"..., 8192) = 1093     read(12, "", 8192)                      = 0     close(12)                               = 0     stat("/etc/lsb-base-logging.sh", {st_mode=S_IFREG|0755, st_size=11, ...}) = 0     open("/etc/lsb-base-logging.sh", O_RDONLY) = 3     fcntl(3, F_DUPFD, 10)                   = 12     close(3)                                = 0     fcntl(12, F_SETFD, FD_CLOEXEC)          = 0     read(12, "FANCYTTY=0\n", 8192)          = 11     read(12, "", 8192)                      = 0     close(12)                               = 0     read(11, "", 8192)                      = 0     close(11)                               = 0     open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3     fcntl(1, F_DUPFD, 10)                   = 11     close(1)                                = 0     fcntl(11, F_SETFD, FD_CLOEXEC)          = 0     dup2(3, 1)                              = 1     close(3)                                = 0     stat("/sbin/start-stop-daemon", {st_mode=S_IFREG|0755, st_size=28152, ...}) = 0     clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4df95ac9d0) = 2707     wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 2707     --- SIGCHLD (Child exited) @ 0 (0) ---     rt_sigreturn(0x11)                      = 2707     dup2(11, 1)                             = 1     close(11)                               = 0     clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4df95ac9d0) = 2708     wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 2708     --- SIGCHLD (Child exited) @ 0 (0) ---     rt_sigreturn(0x11)                      = 2708     read(10, "", 8192)                      = 0     exit_group(0)


How to strip directory structure with command line (or script)

I have a large collection of files packed into a two-level directory structure with many, many, many folders. In other words, I have a folder with a great many subfolders in it. There are no subfolders in these subfolders, however, there are hundreds of files in them. What I would like to do is move all the files out of these subfolders into the directory that holds the subfolders. This is a limited resource system, so a way to do it without two copies of all these files having to exist at once would be amazing......


VSFTPD Virtual User Group

Currently I have a Running vsftpd server in a Cent OS Machine with virtual users. Users are authenticated using MySQL. The users has all the permissions in their home directory and they are jailed into their home directories. The current home directory is /home/vsftpd/username where username is the unique username for each user. It is working file. Now I want to create some new virtual or real users which will have another kind of home directories i.e. /var/www/html/username. I want to keep both types of users in the same server. I mean I need both the old users with the old home directories and new ones with the different home directories in the same vsftpd server. I have gone through many tutorial but found nothing. So please let me know if is it possible,if yes how?


How can I exit from read-only mode in Vim?

I opened a file in readonly mode; is there a way to get out of readonly mode?


Chrubuntu 12.04 Bluetooth not detecting devices

I have Chrubuntu running on an Acer c710. It seems like most people had Bluetooth working right away. I Am having a problem with it. The Bluetooth manager allows me to turn the adapter on and off, but I can't connect to anything. If I search from my phone I can't find the computer. If I search from the manager I can't find my phone, my headphones or my home stereo. I have tried the default manager, `blueman` and `bluedevil` extension to KDE. Nothing works. I know people have had this problem with the Realink card and have fixed it by going into Windows and turning it on there but there is no option to turn it on in Chrome OS. Besides, it's not a Realink card. I opened it up and the card says Atheros model #: ar5b22. It's a combo wifi Bluetooth card. Any help would be greatly appreciated.


Incremental system backup and restore w/ rsync or rdiff-backup issues

I've been reading about using rsync and rdiff-backup to make incremental backups of my entire Linux system. I am planning to practise that by setting up a Linux system, making some changes to it, erasing everything and restoring the system (all with the convenience of doing it in a virtual machine). But I want to clarify a few things before taking the plunge:   1. How do I get fine control about what gets included in and excluded from the backup? i.e. by default would everything (including invisible "." files, trash, etc.) be backed up? If so, how can I exclude some of them?   2. The rdiff-backup tutorial tells you how to retrieve a file from an arbitrary time in the past (as long as you still have the backup). What if I want to restore the complete system on a new computer? How do I do that?   3. Suppose I make backups of my system on machine A. A few years later I buy a new computer B, and want to restore my system from the backup of machine A. Since the hardware might be totally different, will my new system work when I try to start it up after the restore? How can I ensure a smooth restore onto a new machine? Thanks for your answers.


Adobe Flash App based Linux Distro

What would be the best way to create a small Linux image that just runs a single Flash SWF on startup (full screen)? Are there distros catered to something like this, or is my best bet manually slimming down an image and then adding something into one of the startup scripts? Also, what's the best way to run an SWF outside of a browser? gnash? swfdec? other?


Can other users view the arguments passed to a command?

If I invoke a command with arguments like so:               bob@bob-pc:~$ command -arg1 -arg2      ...can other users view the arguments passed to the command?


How to find speed of wlan interface?

I'm trying to find speed of network interface using file-descriptor. It's easy to do it for `ethX`, just calling `cat /sys/class/net/eth0/speed`. Unfortunately this method doesn't work with wireless interface. When I call `/sys/class/net/wlan0/speed` I get error: invalid argument. So, do you know any `/sys/class/net/eth0/speed` like analog for wlan interface?


Detecting Physical Network Addresses Reliably

I'm trying to find a way to list physical (aka MAC) addresses for all network cards/interfaces attached to a certain host. The problem is, I want this functionality on my Debian live (squeeze) USB image which is plugged into many different boxes with widely diverse hardware. So the wireless driver (for example) isn't always available on my USB stick, and thus I can't obtain the physical address from `ifconfig`. I was under the impression that I could achieve this by querying `/sys/class/net/*/address` where `*` is the interface name in question. But this is not the case. I think there should be a way of querying the hardware for the physical address even if the device driver is not installed. So my questions are:   1. Is it actually possible to query the physical address of a network device even if its device driver isn't installed?   2. If it's possible, how?


What methods are used to encrypt passwords in /etc/passwd and /etc/shadow?

A careful examination of the `/etc/passwd` and `/etc/shadow` files reveal that the passwords stored are hashed using some form of hashing function. A quick Google search reveals that by default, the passwords are encrypted using DES. If an entry begins with `$`, then it indicates that some other hashing function was used. For example, some entries on my Ubuntu machine begin with `$6$`... What do the various numbers represent?


Who's consuming my inotify resources?

After a recent upgrade to Fedora 15, I'm finding that a number of tools are failing with errors along the lines of:               tail: inotify resources exhausted     tail: inotify cannot be used, reverting to polling      It's not just `tail` that's reporting problems with inotify, either. Is there any way to interrogate the kernel to find out what process or processes are consuming the inotify resources? The current inotify-related `sysctl` settings look like this:               fs.inotify.max_user_instances = 128     fs.inotify.max_user_watches = 8192     fs.inotify.max_queued_events = 16384


ssh to a new user in ubuntu

I created an user in ubuntu and now I want to do ssh with that user. I'm able to do ssh but I'm not getting in the shell:               myUserName@myMachineName:path$      I just get:               $      And I don't see the path where I'm standing or been able to get last commands. I'm not sure how is this called or how to look for it on the internet. That's why I prefer to ask here. ![enter image description here](http://i.stack.imgur.com/xDOoP.png)


Run Ubuntu 10.04 LTS with Apache2 SSL with passphrase

I am setting up a Virtual Machine with Ubuntu 10.04 Lucid Lynx Server. I have been reading the section on setting up Apache with an SSL certificate within the book : "Beginning Ubuntu LTS Server Administration - 2nd Edition" Contrary to the official documentation, the book advises to always use a 'pass phrase' when setting up Apache with SSL (to protect your reputation if the private SSL key is compromised). If you set-up a 'pass phrased SSL key' then you are required to type a pass phrase each time you start Apache. This is a slight problem if Apache starts up automatically when Ubuntu boots up. On page 338 it then offers a tip to prevent Apache from starting up at boot time. > ...To ensure that it doesn't start automatically, enter the line > `NO_START=0` in `/etc/default/apache2` I have modified that `/etc/default/apache2` file accordingly, rebooted and Apache2 is still trying to start-up upon boot. The `NO_START=0` line seems to have no effect. As I look through forums on the web, it seems that most people have issues and then end up skirting the problem by simply using a certificate without a pass phrase. Does anyone know the the best practice method of preventing Apache from starting up at boot time for a passphrased secure _SSL'd Apache_?


Uncopyable 5GB file, BTRFS

I have a 5.3GB tar file, located on a BTRFS partitioned eSATA drive. When trying to copy the file to another disk, or expand the tar the process seems to freeze. No errors are generated, and waiting doesn't seem to bear any fruit. When booted from this eSATA (64bit OS) I manage to copy no more than 12MB of the file, and when booted from another drive(32bit OS) I copy 361.4MB ( before freezing).


What happens the most, context switches or mode switches?

Which happens the most, context switches or mode switches? I have two answers myself, but I do not know which one is correct:   1. Context switches happen in user mode, but this does not mean that a system call is needed; therefore, mode changes do not happen when a context switch occurs.   2. Context switches mean a dispatch is needed. I think this is privileged, so a mode change from user to kernel mode is needed to do a context switch. Which means a context switch goes along with a mode switch. Anyone have a definite answer to this?


Stream grep from subprogram, not tail file

Does a simple one liner exist for grepping continuous output from a program rather than just a file? Now just as an example, I would like to skip lines containing `PHPUnit` in them. For obvious reasons the following gist does not do that:               phpunit tests/cases | grep -v --line-buffered "PHPUnit"      Can it be done as a universally usable oneliner, without user defined functions and so?


Does bash support forking similar to C's fork()?

I have a script that I would like to fork at one point so two copies of the same script are running. For example, I would like the following bash script to exist:               echo $$     do_fork()     echo $$      If this bash script truly existed, the expected output would be:               <ProcessA PID>     <ProcessB PID>     <ProcessA PID>      or               <ProcessA PID>     <ProcessA PID>     <ProcessB PID>      Is there something that I can put in place of "do_fork()" to get this kind of output, or to cause the bash script to do a C-like fork?


Why does Linux scale so well to different hardware platforms?

Why does Linux run well on so many different types of machines - desktops, laptops, servers, embedded devices, mobile phones, etc? Is it mainly because the system is open, so any part of it can be modified to work in different environments? Or are there other properties of the Linux kernel and/or system that make it easier for this OS to work on such a wide range of platforms?


Why do some regex commands have opposite intepretations of '\' with various characters?

Take, for example, this command:               find . -regex ".*\.\(cpp\|h\)"      This will find all the .h and .cpp files in your directory. The period character '.' in regular expressions usually means "any character". To get it to match only an actual period, you must escape it using the backslash character '\'. In this case, given a character with a special meaning, you must escape it to get the actual character it represents. Now, take the parenthesis and the "or" bar, being characters '(', ')', and '|', respectively. These also have special meanings, used for grouping regular expressions. However, to get the special meaning, the characters must be escaped using the backslash! Without the backslash, the characters have the meaning of the actual character it represents. Why is the '.' treated differently from '(', ')', and '|'?


If I change permissions on a tar file, will that apply to the files inside it?

I have a script that runs regularly via `cron`, that creates a `tar.gz` file for the purpose of backing up a directory. For reasons beyond my control, the only user who can execute the script via `cron` is a root user. So the resulting `tar` file can not be moved or deleted by any other user. So, as part of the script, I want to execute a `chown` and `chmod` on the `tar` file so that other users can manipulate it. But is it good enough to just change permissions on the `tar` file, or will the root user permissions also be saved to the files inside the `tar`? When a user unpacks the `tar` file, will they be able to act on those files as if they created the files themselves?


Why is this scp command creating a directory one level up?

I am trying to copy a file from one machine to another machine via ssh. Both machines are Ubuntu servers. Both machines have exchaged keys so that they can log into each other without passwords. The command I have looks like this (details changed for privacy, of course):               scp -i /var/www/place/.ssh/id_rsa file.tar.gz otherserver@000.000.000.000:directoryName/file.tar.gz      However, every time I run it, I get this error:               Could not create directory '/var/www/.ssh'.     Host key verification failed.     lost connection      It seems like the `scp` command is trying to create a directory called `.ssh` one level up from `place`. What's going on here? Does scp need to create some kind of temporary directory in order to execute? The user account that is running the command has read/write permissions within /var/www/place, but not /var/www, so how do I get this scp command to run? _(Please be aware I am not very experienced with Linux command line stuff, so please make answers verbose and simple. Thanks for your understanding.)_


Spawn 6 windows in 2 rows in the i3 window manager

How can I bind a key that spawns (via the `exec` command) six terminal windows? I managed to figure out how to do this, but all windows were on one row. What I would like to have is that 3 on top and 3 on bottom. Like this,                _ _ _ _ _ _ _ _ _ _ _ _ _ _ _     |         |         |         |     |    T1   |   T2    |    T3   |     | _ _ _ _ | _ _ _ _ | _ _ _ _ |     |         |         |         |     |    T4   |   T5    |    T6   |     | _ _ _ _ | _ _ _ _ | _ _ _ _ |           This is for the i3 window manager.


How to display server's TLS certicicate details in terminal?

Having TLS certificate in local file, I can display its details using syntax like: `openssl x509 -text -noout -in cert_filename` Is there any way to display remote SMTP/POP3/HTTP server's TLS certificate in this same format in bash terminal?


AIX 6.1 starting xhost + from inittab at the boot time

Everytime after restarting the servers, I have to run `xhost +` from console prompt. Does anyone have any idea about enabling `xhost +` from `inittab` file?


How can I get the output and test the dig command?

when we type " dig +short www.example.com " command we get something like that:               www.example.com.     192.168.1.1     192.168.1.2     192.168.1.3      I want to get the first address and test it if it is what I want to (192.168.1.1) How can I get the output of this command, especially the second line by using shell script ?


Ubuntu: How to configure DNS servers in /etc/network/interfaces correctly for resolvconf?

All examples I have seen of configurations (`/etc/network/interfaces`) showed that you configure an interface and then underneath that gave the `dns-*` lines such as:               auto eth0     iface eth0 inet static             ...             dns-nameservers 127.0.0.2             dns-search example.com my.example.com      Now I am aware that the DNS protocol is independent of the transport mechanism. Therefore it shouldn't be per-se wrong to add an IPv6 address on the `dns-nameservers` line. However, since I am also configuring the interface for IPv6 anyway, it made sense to add the `dns-nameservers` line there:               iface eth0 inet6 static             ...             dns-nameservers ::2             dns-search example.com my.example.com      ... or did it? Because when `resolvconf` creates `/etc/resolv.conf` it simply ignores all the IPv6 DNS servers. It also seems to ignore `dns-search` and `dns-domain`. The only line it seems to honor is the `dns-nameservers` line from the IPv4 configuration for `eth0`. What is the correct method of configuring DNS servers? * * * Further circumstantial evidence as to why it should be part of each respective `iface` stanza. Quote from `man 8 resolvconf`: > The `ifup(8)` program can be used to configure network interfaces according > to settings in `/etc/network/interfaces(5)`. To make `ifup` push nameserver > information to `resolvconf` when it configures an interface, add `dns-` > lines to the relevant `iface` stanza in `/etc/network/interfaces`. To add > nameserver addresses add a line beginning with `dns-nameservers`.


Is there a system command, in Linux, that reports the endianness?

Does anyone know of a command that reports whether a system is Big Endian or Little Endian, or is the best option a technique like this using Perl or a string of commands? _Perl_               # little     $ perl -MConfig -e 'print "$Config{byteorder}\n";'     12345678          # big     $ perl -MConfig -e 'print "$Config{byteorder}\n";'     87654321      _od | awk_               # little     $ echo -n I | od -to2 | awk 'FNR==1{ print substr($2,6,1)}'     1          # big     $ echo -n I | od -to2 | awk 'FNR==1{ print substr($2,6,1)}'     0      ### References   * Perl Config documentation - byteorder


Vim alerts after a few seconds when no event occurred

I use Vim in a tmux session, and recently I've noticed that Vim is raising an alert after a few seconds when I switch to another tmux window. Nothing has happened in Vim after I move windows - usually I do some edits and write the file with `:w` and then move in tmux. A few seconds later Vim alerts and tmux flashes that Vim needs attention. Why is Vim being so needy? How can I prevent this? ### Update #1 Output from `:au FocusLost` as requested:               :au FocusLost     --- Auto-Commands ---     Press ENTER or type command to continue      Links to `.vimrc` and `.tmux.conf`:   * .vimrc   * .tmux.conf ### Update #2 Using versions Vim 7.3 and tmux 1.6. This whole thing is happening when in an SSH session where tmux is running. I switch away from the Vim window using tmux keys `Ctrl+A` `Ctrl+N` as per the tmux conf.


Why can't a regular user delete a btrfs subvolume

Using a loop-mounted user created btrfs filesystem, with the permissions set correcly, a user is able to freely create btrfs subvolumes:               user@machine:~/btrfs/fs/snapshots$ /sbin/btrfs sub create newsubvol     Create subvolume './newsubvol'      However, trying to delete the newly created subvolume results in an error:               user@machine:~/btrfs/fs/snapshots$ /sbin/btrfs sub del newsubvol     Delete subvolume '/home/user/btrfs/fs/snapshots/newsubvol'     ERROR: cannot delete '/home/user/btrfs/fs/snapshots/newsubvol'      The root user, of course, is able to delete it:               root@machine:/home/user/btrfs/fs/snapshots# /sbin/btrfs sub del newsubvol     Delete subvolume '/home/user/btrfs/fs/snapshots/newsubvol'      This difference in behavior between the create and delete operations seems a bit strange. Can anyone shed some light on this? Here is the exact sequence of commands:               user@machine:~$ dd if=/dev/zero of=btrfs_disk bs=1M count=100     100+0 records in     100+0 records out     104857600 bytes (105 MB) copied, 1.2345 s, 84.9 MB/s     user@machine:~$ mkdir mountpoint     user@machine:~$ /sbin/mkfs.btrfs btrfs_disk          WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL     WARNING! - see http://btrfs.wiki.kernel.org before using          SMALL VOLUME: forcing mixed metadata/data groups     Created a data/metadata chunk of size 8388608     fs created label (null) on btrfs_disk         nodesize 4096 leafsize 4096 sectorsize 4096 size 100.00MB     Btrfs Btrfs v0.19     user@machine:~$ sudo mount btrfs_disk mountpoint/     user@machine:~$ cd mountpoint/     user@machine:~/mountpoint$ /sbin/btrfs sub create test     Create subvolume './test'     user@machine:~/mountpoint$ /sbin/btrfs sub delete test     Delete subvolume '/home/user/mountpoint/test'     ERROR: cannot delete '/home/user/mountpoint/test' - Operation not permitted      Here are the permissions:               user@machine:~/mountpoint$ ls -la     total 4     drwxr-xr-x 1 user user    8 Set  4 09:30 .     drwx------ 1 user user 4486 Set  4 09:29 ..     drwx------ 1 user user    0 Set  4 09:38 test      And the relevant line on `df -T`:               Filesystem              Type     1K-blocks      Used Available Use% Mounted on     /dev/loop0              btrfs       102400        32     98284   1% /home/user/mountpoint      The distro is a Debian Wheezy, `3.2.0-4-686-pae` kernel, `v0.19` btrfs-tools. The situation still occurs on Ubuntu Saucy, `3.11.0-4-generic` kernel, `v0.20-rc1` btrfs-tools.


du (disk usage) and format specifier for file/directory sizes strings?

I am really fond of `du`, and I often like to use it like this:               $ du -hsc /var/mail/ /var/log/ 2>/dev/null      4,0K    /var/mail/     5,7M    /var/log/     5,7M    total      However, I'd like to be able to print out sizes in format "[bytes] [kbytes]K [mbytes]M"; and as far as I can see, I cannot do that:               $ du -hscb /var/mail/ /var/log/ 2>/dev/null     4096    /var/mail/     14734462    /var/log/     14738558    total          $ du -hsck /var/mail/ /var/log/ 2>/dev/null     4   /var/mail/     5764    /var/log/     5768    total          $ du -hscm /var/mail/ /var/log/ 2>/dev/null     1   /var/mail/     6   /var/log/     6   total          $ # all (b,k,m) here:      $ du -hscbkm /var/mail/ /var/log/ 2>/dev/null     1   /var/mail/     15  /var/log/     15  total      The k,b,m switches simply choose a block size, and then a prefix (K, M) is not even printed (and when you run them all together, you get some weird sizes reported). Any ideas if there is something like a size format specifier string for `du`? Many thanks in advance for any answers,   Cheers!


Partitioning scheme for a virtual machine host

I am planning to use an Ubuntu Server 12.04 with KVM to create 2 virtual machines. Reading some docs on the net, I have found that a good approach is to use LVM based VM, so my idea is to have:   * 1 ext2 partition for boot   * 1 LVG with 3 logical volumes: 1 for host, 1 for vm1 and 1 for vm2 Is this a good partitioning scheme? What factors do I need to consider?


How does iperf calculate throughput and jitter?

I've read that `iperf` basically tries to send as much information down a connection as quickly as possible reporting on the throughput achieved. This tool is especially useful in determining the volume of data that links between two machines can supply. Is it possible to gather the same results by sending regular data, as in not testing data? What I'm trying to do is this; sending data in the foreground while in the back ground gather statistics (throughput and jitter). So can anyone tell me how `iperf` calculates these two values ?


(L)ubuntu 12.04 syslog to custom file (not /var/log/syslog but /var/log/mylog) - ubuntu 12.04

I successfully tested the following syslog "hello world" example on ubuntu 12.04:               // gcc giuspexample.c -o giuspexample          #include <syslog.h>          int  main(int argc, char *argv[])     {         setlogmask(LOG_UPTO (LOG_NOTICE));              openlog("atm", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL0);              syslog(LOG_NOTICE, "Program started by User %d", getuid ());         syslog(LOG_INFO, "A tree falls in a forest");              closelog();         return 0;     }      and I can read the entry in /var/log/syslog. I followed the instructions on http://www.codealias.info/technotes/syslog_simple_example on how to change the destination filepath               echo "local0.*  /var/log/mylog" >> /etc/syslog.conf      but trying to run               sudo /etc/init.d/syslog restart      doesn't work (command not found) and rebooting the pc anyway doesn't start to write on /var/log/mylog but still on /var/log/syslog. Does anybody know what's wrong? Thanks.


View temporary files which exist for milliseconds

I'm trying to debug a program which is not logging the information I need. Fortunately, it does write temporary files which should contain the information. These files are written to a directory like: `program/temp/{someGUID}` on one of ten machines. Neither `{someGUID}` nor which machine will contain the temp files is known in advance of the run. After the run is complete, the temporary files are deleted. The time from beginning to end is too fast for manual intervention. I kick off the runs through a client program, but it is the server which writes the files. I am unable to manipulate the server program and once a run is kicked off I am unable to stop it. I do have root access to the all the machines on which the temp files could be written. I'm running CentOS 6. Is there a way to allow the server user to write files to the temp directory but not remove them? It would probably crash the run, but it would give me the information I need. Is there a way to copy the contents of the temp folder right after they are written/before they are deleted? Must I install a program for recovery of deleted files?


Specify the sort order with LC_COLLATE so lowercase is before uppercase

Given the file:               $ cat file     1     a     C     B     2     c     3     A     b      By default `sort` will:               $ sort file     1     2     3     a     A     b     B     c     C      With `LC_COLLATE=C` so will sort in uppercase letter before lowercase:               $ LC_COLLATE=C sort file     1     2     3     A     B     C     a     b     c      Is it possible to get sort to reverse the case ordering, that is digits, lowercase then uppercase?


Configure UML to generate core file

The User Mode Linux (UML) I run on Ubuntu crashes occasionally, but does not generate any core file. I'd like to know the necessary configuration to be applied on UML so it generates a core when it crashes. Also, additional configuration which will ease the process of analyzing the core would be appreciated.


Checking existence of file with underscore in file name in zsh

I am writing a very simple script which will link shared configuration files. For some reason it does not behave as i expected for file with underscore in name. Does _ (underscore) means something special in zsh? The mentioned script as it is now:               #!/bin/zsh     STATIC_CONFIG_PATH="/opt/apps/config"     STATIC_CONFIG_FILES=("couchdb.yml" "database.yml" "elasticsearch.yml" "slurm_api.yml")               cd $1/config     ELEMENTS=${#STATIC_CONFIG_FILES[@]}     for (( i=0;i<$ELEMENTS;i++)); do       if [ ! -L ${STATIC_CONFIG_FILES[${i}]} ]; then         echo 'Linking '$STATIC_CONFIG_PATH'/'${STATIC_CONFIG_FILES[${i}]}         ln -s $STATIC_CONFIG_PATH'/'${STATIC_CONFIG_FILES[${i}]}       fi     done


Change view in emacs dired mode

What options are there to change the view of a directory in `emacs dired mode`? How to apply it? How can I change it on the fly? In particular I want to know:   * How to make it show the file sizes in human readable format (MB, GB, ...)?   * How to omit the permissions, owner and group in the list view?   * How to change appearance of symbolic links? (I want it to be displayed like regular files i.e. **_without_** the target, but in another color to indicate that they are links).


How to install a specific video driver on Fedora?

I need to install a compatible video driver on a Fedora machine. The resolution proportion isn't very well and I can't change the brightness and contrast (xbacklight and xgamma) either. Please answer me with a complete solution or a final successfully tutorial. Some information about the system is:               $ lspci | grep VGA     00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)     $ cat /etc/issue     Fedora release 17 (Beefy Miracle)     Kernel \r on an \m (\l)


How can I create a variable for just the Size, Used, and Available of df?

Say I want to create variables, one for each the size, used, and available when using df. How can I create variables for each? Is there an option that returns just one of these things?               directorySize=          directoryUsed=          directoryAvailable=      Say I want to create those variables based on the home directory. How would I do this?


Add item to inittab on OpenSuse 12.1

I am currently working on a project which needs to be added to `inittab` so that the program loads during startup. The program that I am trying to start is a c# mono application. I have created a start script and if the start script is run manually the program launches fine. However, when I put it into `inittab` the program doesn't launch. I've checked in `/var/log/messages` but it doesn't say anything is wrong, it just says that it is reloading. Below is what I have added to my `inittab` script               bes:2345:respawn:/home/bits/MyProgram/start.myprogram      Thanks for any help you can provide **UPDATE** Below is the code in the start script which is located in /home/bits/MyProgram.               #!/bin/sh          cd /home/bits/MyProgram          /usr/bin/mono EmailServer.exe "$@"      I have also tried adding > mylog.txt onto the end of the line beginning with /usr/bin/mono e.g. > /usr/bin/mono EmailServer.exe "$@" > mylog.txt If I run the start script manually, even if I am not in the directory where the start script is located it works fine, its just when I add it to inittab and run telinit q it never starts and the log isn't written to but the log does get written to if I start the program manually. Thanks for any help you can provide.


Setting up ad-hoc in Debian with DHCP?

I made a quick search and found a doc that showed me a way to setup ad-hoc. Only problem is that I need this to work with my phone (WP7) and I'm not able to set a static IP on the phone so I need the debian machine to dish out IPs when clients connect to it :-) How can I set up a ad-hoc network that also gives out IPs? Pref in some range too :)


Losing (realtime) permission when sudoing from root to myself

After an upgrade to debian wheezy (I did not upgrade the kernel - it is still 3.8.2) I can no longer start jackd in the way I used to do it. I get `you are not allowed to use realtime scheduling`. My investigation show, that this is related to a `sudo` command in my script, where I sudo from root to martin. The sudo is required, because I start jackd when my firewire mixing console gets switched on, using an udev rule. I can reproduce the problem by typing sudo from the commandline. In short, this is what I observe   * start jackd as martin -> works   * start jackd as root -> works   * login as root and `su - martin`, then start jackd -> works   * as root `sudo -u martin /usr/bin/jackd ...` -> does not work   * as above but `sudo -E -u martin ...` -> does not work My /etc/security/limits.conf contains these lines               @audio - rtprio 40     @audio - nice -20     @audio - memlock 1554963      `sudo -u martin id` shows that I am in the audio group, however root is not. After sudoing from root to martin, martin has no realtime permissions               sudo -u martin sh -c "ulimit -e -r"     scheduling priority             (-e) 0     real-time priority              (-r) 0      Adding root to the audo group made no difference. Root still has no realtime permissions and after `sudo -u martin` martin still looks as above


Why is /etc/passwd open to public for reading?

Is there any reason that /etc/passwd should be world-wide readable ? It's not like password hashes that shouldn't be exposed, I just want to know why.


Wireshark packet dissection codes?

Hi all we have a system which could capture packets accordingly. The only problem now we need some codes on how to interpret the packet just like how wireshark does it so well. Anyplace we can get hold of how wireshark does it?


Chinese input in Linux Mint 13

I started to use Linux Mint 13 MATE a few days ago. What frustrates me most is that I can't found anywhere to change my input language. In Windows, it is easy, just `Ctrl`+`Shift`. How can I configure the input and switch between them? Specifically I need a Chinese Traditional Input - Quick.


How to get wireless access point information from MacOS terminal

I'm trying to gather information about surrounding access points but can't find the right tools to do that. For Linux there are tools like iwconfig and iwlist, but it looks like they are not available for MacOS.


Import single rows from SQLite to MySQL?

I need to do some kind of incremental import again and again from a SQLite 3 database to a MySQL database. Column names are the same in both databases. Is there a good way to do this by a script (therefore is there a good way to get the column values of one row as some kind of array/list, so I can really work with them?) or am I better off with a small C program? Update: OK, there is the -line option, giving one column value per line, result rows are then separated by an empty line. Still need to find a really simple way to parse this ;-)


Parsing SQLite output

Using -line Option I get this output from SQLite:               row1_column1 = valueA     row1_column2 = valueB          row2_column1 = valueC     row2_column2 = valueD      So one line for each column value and result rows are separated by a blank line. I need to get this output in a array or list containing               valueA,valueB     valueC,valueD      Additionally non-numeric (!) values shall be enclosed by ' and '. Any simple way to do this? Thanks for any hint!


Add info under specific line

I want to know how could I add files contain information under specific line in file. For example, I have `file1.txt` with the following lines:               line 1     line 2     line 3      and `file2.txt` has the information I want to add in `file1.txt` under specific in `line 2`. How could this to be done?


Compiling Android Image error: rebase-apply still exists but mbox given

I am building an android image on fedora, and I am running into some problems. I have done this before and had no issues. Does anyone know how to fix this problem?               error: bootable/bootloader/lk/: prior sync failed; rebase still in progress     !!!Error Downloading code!!!     Applying patches ...        applying patches on ./bootable/bootloader/lk ...      previous rebase directory /home/Max/workdir/APQ8074_M8974AAAAANLYA31050108_JB_V10/bootable/bootloader/lk/.git/rebase-apply still exists but mbox given.           FAIL: Current working dir:/home/Max/workdir/APQ8074_M8974AAAAANLYA31050108_JB_V10/bootable/bootloader/lk


Something very strange happen to my server today

If I type `cd ~username` it will say               Can't find /home2/username      Actually `~username` exists, in `/home3`, and it used to work. Nothing strange has happened. Somehow Linux thinks that all of my `/home2` files are in `/home3` and all my `/home3` files are in `/home2`. Yesterday it worked fine. Then I saw:                   root     pts/6        139.193.156.125  Thu Aug 29 05:48   still logged in         root     pts/5        ng1.cptxoffice.n Thu Aug 29 05:43   still logged in         root     pts/4        139.193.156.125  Thu Aug 29 05:35   still logged in         root     pts/3        139.193.156.125  Thu Aug 29 05:31   still logged in         root     pts/2        139.193.156.125  Thu Aug 29 05:12   still logged in         root     pts/1        139.193.156.125  Thu Aug 29 02:20   still logged in         root     pts/0        139.193.156.125  Thu Aug 29 01:34   still logged in         reboot   system boot  2.6.32-279.22.1. Wed Aug 28 17:00 - 05:48  (12:48)         reboot   system boot  2.6.32-279.22.1. Wed Aug 28 11:33 - 16:46  (05:13)         root     pts/0        139.193.156.125  Mon Aug 26 05:12 - 01:23  (20:11)         root     pts/0        139.193.156.125  Wed Aug 21 20:51 - 22:07  (01:15)         root     pts/1        139.193.156.125  Wed Aug 21 06:50 - 22:01  (15:11)      I do not know of the host `ng1.cptxoffice.net`. How do I tell linux that `~freemark` belong to `/home2` or `/home3`? I can temporarily fix the problem by putting a soft link from `/home2` to `/home3` and vice versa. But why this happened in the first place is beyond understanding.


Wrong PAM settings: successful login logged as failure

SERVER:/etc/pam.d # head -1 /etc/issue               SUSE LINUX Enterprise Server 9.4      SERVER:/etc/pam.d # cat login               #%PAM-1.0     auth requisite  pam_unix2.so    nullok     #set_secrpc     auth required   pam_securetty.so     auth required   pam_nologin.so     #auth    required   pam_homecheck.so     auth required   pam_env.so     auth required   pam_mail.so     #account required pam_tally.so deny=5 reset no_magic_root     account required    pam_unix2.so     password required   pam_pwcheck.so  nullok md5     password required   pam_unix2.so    nullok use_first_pass use_authtok md5     session required    pam_unix2.so    none     # debug or trace     session required    pam_limits.so      SERVER:/etc/pam.d # cat sshd               #%PAM-1.0     auth     required   pam_tally.so no_magic_root     auth     required       /lib/security/pam_unix.so   # set_secrpc     auth     required       /lib/security/pam_nologin.so     auth     required       /lib/security/pam_env.so     #account required pam_tally.so deny=5 reset no_magic_root     account  required       /lib/security/pam_unix.so     password required       /lib/security/pam_pwcheck.so     password required       /lib/security/pam_unix.so       use_first_pass use_authtok md5     session  required       /lib/security/pam_unix.so   none # trace or debug     session  required       /lib/security/pam_limits.so     SERVER:/etc/pam.d #      SERVER:/etc/pam.d #       SERVER:/etc/pam.d # faillog -u pamtest               Username   Failures  Maximum  Latest     pamtest           0        5  Thu Aug 29 13:35:15 +0200 2013 on localhost      SERVER:/etc/pam.d # ssh pamtest@localhost               pamtest@localhost's password:      Last login: Thu Aug 29 13:35:15 2013 from localhost     pamtest@SERVER:~> exit     logout     Connection to localhost closed.     SERVER:/etc/pam.d # faillog -u pamtest     Username   Failures  Maximum  Latest     pamtest           1        5  Thu Aug 29 13:39:40 +0200 2013 on localhost     SERVER:/etc/pam.d #       **Q:** Why does the system logs the successful login as failed login? "UsePAM yes" is in the sshd_config. (Does the order of the lines in the ex.: sshd file counts?)


Installed fonts not showing up, Linux Mint 15 64bit

I'm trying to install these bitmap fonts: http://font.gohu.org/ I downloaded the compressed PCF files and extracted them to /usr/share/fonts, Then ran `sudo fc-cache -fv`. The fonts weren't showing up in any program's font options. I tried the same but with true type fonts, same result. I tried using `~/.fonts` as my font directory, still no change I tried using Mint's inbuilt font installer (by double clicking on the font file), and it says Install Failed when I click on the Install button. I've tried renaming the `.pcf.gz` files to .pcf but with the same results. I tried doing all of the above and then rebooting my system and I still cant see the fonts in any programs. Any help would be appreciated.


Why does apt-get remove only a few kB?

I installed nginx (`sudo apt-get install nginx`) and then removed it with `sudo apt-get remove nginx`. I to need ensure that the application is uninstalled and cannot run. (I'm still able to run `service nginx start` without error in `nginx\error.log`). I wonder why only 90kB was removed when I downloaded several megabytes? What am I doing wrong?


how to know the type of symmetric encryption used by ssh?

I want to know the type of symmetric encryption (after authentication) used by ssh in a connection client-server. I'm not sure who determines the encryption. Client or Server?. I have looked in `/etc/ssh/ssh_config` (on client) and `/etc/ssh/sshd_config` (on server) and nothing.