How can I allow applications to bind to any address in a subnet assigned to an interface?

I recently got a static IPv6 /56 prefix of my own from Freenet6, and am trying to allow applications to bind arbitrary addresses in the prefix. I modified the tunnel creation script that `gogoc` uses in order to assign both the client address (here we'll call it `2001:5c0:1000::cccc/128`) and the entire subnet I have allocated (here called `2001:5c0:2000:5800::/56`) to `tun` and `tun:1`, respectively. I can bind an application to listen on `2001:5c0::cccc` or `2001:5c0:5800::` just fine, and using IPv6 open port testers indicates that the connection is succeeding. However, the dilemma lies in that I am unable to bind an address like `2001:5c0:2000:5800:1111:2222:3333:4444`, which is part of the subnet I assigned to `tun:1`, getting `EADDRNOTAVAIL` as an error code. `socat` reads:               2014/05/10 12:12:06 socat[16940] E bind(3, {AF=10 [2001:5c0:2000:5800:1111:2222:3333:4444]:9876}, 28): Cannot assign requested address      The application I wish to use does not support `IP_FREEBIND` or `IP_TRANSPARENT`. Is there a kernel setting I can use to implicitly free-bind sockets? Or perhaps a way to intercept socket creation from a given process, and attach socket options to that creation? `ip addr`:               1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever     2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000         link/ether 04:7d:7b:XX:XX:XX brd ff:ff:ff:ff:ff:ff     3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000         link/ether 9c:b7:0d:XX:XX:XX brd ff:ff:ff:ff:ff:ff     5: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000         link/ether 00:c0:ff:XX:XX:XX brd ff:ff:ff:ff:ff:ff         inet 192.168.2.8/24 brd 192.168.2.255 scope global wlan1            valid_lft forever preferred_lft forever         inet6 fe80::2c0:ffff:feff:70d1/64 scope link             valid_lft forever preferred_lft forever     11: tun: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1280 qdisc pfifo_fast state UNKNOWN group default qlen 500         link/none          inet6 2001:5c0:1103:5800::/56 scope global             valid_lft forever preferred_lft forever         inet6 2001:5c0:1000:b::5225/128 scope global             valid_lft forever preferred_lft forever


sed script to insert line after the last matching line in a file

I'd like to write a script in sed to insert line to a file after all similar lines in the file. So I need to locate the last match for a pattern and insert immediately after it. It's very unlikely that this would be the last line in the file. I've seen a number of solutions that employ multiple piped calls to sed or use other tools such as tac. These are not appropriate - I need a pure sed solution that can be embedded inside a larger script that makes other changes to the same file. I've been searching for a while but suspect it isn't possible. I thought I'd ask on here before giving up! In case specifics help explain, I want to locate the last "Include" directive in an Apache http.conf file and insert another one beneath the last one.


how to install HAL on Puppy Linux barebone 5.7.1

On other linux distros I have to install `hal` for certain flash player videos to work. youtube works fine with the adobe flash. Just can't find anything on installing `hal` in puppy linux.


unable to create SCCS file

I am working on Ubuntu13.04. I created a file named quit.c I am trying check- in this file in to its SCCS file, s.quit.c I am creating the SCCS file as below using `admin` command:               ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1/sccs$ admin -i quit.c s.quit.c     admin: quit.c is an invalid name.  SCCS file names must begin `s.'          admin: The 'i' keyletter can't be used with multiple files.     ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1/sccs$      I think the syntax has changed from what it was earlier. Is it so? How to create the SCCS file for check-in?


udev GROUP and MODE assignments on symbolic link have no effect

I'm trying to connect my velleman k8055 board per usb to my pc. For this I have the udev rule               SUBSYSTEM !="usb_device", ACTION !="add", GOTO="velleman_rules_end"          ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="5500", MODE="0660", GROUP="k8055", SYMLINK+="k8055_0"     ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="5501", MODE="0660", GROUP="k8055", SYMLINK+="k8055_1"     ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="5502", MODE="0660", GROUP="k8055", SYMLINK+="k8055_2"     ATTRS{idVendor}=="10cf", ATTRS{idProduct}=="5503", MODE="0660", GROUP="k8055", SYMLINK+="k8055_3"          LABEL="velleman_rules_end"      from jeremyz's k8055 github repo. After plugging the board in, I even get the k8055_0 symlink, but it's rights are root:root. But I want that users from the group k8055 can access this link (which is not possible with root:root permissions).


Execute script after period of inactivity

I'm looking for a way to execute certain script after period of inactivity and after completion of that period. By 'inactivity' I mean lack of mouse and keyboard events. E.g. I want:   1. execute first script after X min. of inactivity;   2. execute second script when that period is interrupted by mouse or keyboard. It will be best if that method will not be tied to the X-system and also will work in terminal (when X is not started).


Making tar split archives as it compresses?

I want to compress a file with `tar` but I'd like to know if its possible to do it while splitting the files. I know that in windows is possible to do this with winrar, I also know I can use `split` but I would then have to unsplit this from Linux


Is there a command line method by which I can check whether a downloaded file is complete or broken?

I'm writing a script that involves downloading and manipulating a file, and I want to ensure that the file is not incomplete (due to e.g. a dropped connection) before I work on it.


what does `-t` option of named command stands for?

What does `-t` option of `named` stands for? It looks like `-d` is already taken by `debug-level`, but where is the `t` come from? Is it from `chrooT`?


Boot - How does unix or linux boot?

How does the linux bootup process work? What is the file that is executed by the machine first to initialize all files and folders, like android, android use manifest for initializing?


How to return either "on" or "off" for: chkconfig --list | grep httpd

To ensure httpd is automatically started on reboot. I simply run this command               chkconfig httpd on      what I am looking for is a way to be told if this setting is               on or off      instead of this command               chkconfig --list | grep httpd      which returns this               httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off      I understand about the levels but really what I need is                on or off      so I can insert it onto a script and visually see on or off daily rather than something complex as above.


ssmtp: Cannot open mail:25

I've installed ssmtp and then edited the ssmtp.conf file so could try sending a mail but says cannot open mail:25 however in the conf file I set it to gmail port 467 and I am pretty sure everything else is right. What specifically do I need to look for with this error or could it be any number of settings in and outside of the configuration file?               #     # /etc/ssmtp.conf -- a config file for sSMTP sendmail.     #     # See the ssmtp.conf(5) man page for a more verbose explanation of the     # available options.     #          # The person who gets all mail for userids < 500     # Make this empty to disable rewriting.     root=postmaster          # The place where the mail goes. The actual machine name is required     # no MX records are consulted. Commonly mailhosts are named mail.domain.com     # The example will fit if you are in domain.com and your mailhub is so named.     mailhub=mail          # Example for SMTP port number 2525     mailhub=smtp.gmail.com:465     # Example for SMTP port number 25 (Standard/RFC)     # mailhub=mail.your.domain     # Example for SSL encrypted connection     # mailhub=mail.your.domain:465          # Where will the mail seem to come from?     #RewriteDomain=          # The full hostname     #Hostname=          # Set this to never rewrite the "From:" line (unless not given) and to     # use that address in the "from line" of the envelope.     #FromLineOverride=YES          # Use SSL/TLS to send secure messages to server.     UseTLS=YES     UseSTARTTLS=YES     AuthUser=user@gmail.com     AuthPass=xxxxxx          # Use SSL/TLS certificate to authenticate against smtp host.     #UseTLSCert=YES          # Use this RSA certificate.     #TLSCert=/etc/pki/tls/private/ssmtp.pem     TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt          # Get enhanced (*really* enhanced) debugging information in the logs     # If you want to have debugging of the config file parsing, move this option     # to the top of the config file and uncomment     #Debug=YES      Interestingly all the files in `/etc/pki/tls/certs/` are the exact same ones I deleted in my /etc/ssl folder! haha Now I know a certain amount of business happened when creating an untrusted cert.


Is it possible to login to a Linux machine with AD credentials without the machine beeing member of the AD?

I'm asking because as far as I know this is not possible with Windows machines since it's mandatory that a Windows machine is known to the AD in order to login with AD credentials. Is it possible to achieve that with Linux machines through LDAP?


How do I better read man pages?

How do I search `man` pages for options? I currently do this: `/-<option>` Example: To see what `grep -i` does, I do this: `man grep` and then `/-i`. Or, I can do this: `man grep | grep .-i` Is there a better way of searching `man` pages for options?


How can I determine user base page limit for a printer?

I'm using Debian Linux. I want to determine user base page limit, different page limit for different users, for a printer. I can determine page limit for printer with CUPS but can not determine page limit for single user. How can I achieve this?


Compiling C++11 code on old machines

I'm trying to compile a C++11 project on a bunch of old machines with old kernels. They're running CentOS 6.2, 6.3 Alt Linux 4.1. Others are unknown but similarly old. The machines won't let me install a newer version of GCC. 4.4 is the max they can run, and rewriting the project isn't an option. I somehow managed to build GCC 4.6 locally on one machine, and used it to compile my project, but I don't want to repeat that on every machine. Is there a painless way to compile or run the code on all the machines?


How can I get Mumble's overlay working?

Mumble and Team Fortress 2 (TF2) both work fine for me individually, but I cannot get mumble-overlay working, either independently or within TF2. I've tried putting the following launch options into TF2's properties in Steam, none of which have worked. (N.B. I'm also using bumblebee, and a 64-bit computer.)               mumble-overlay primusrun %command%     mumble-overlay primusrun %command% -nod3d9ex     mumble-overlay primusrun %command% -d3d9ex -32bit     LD_PRELOAD=/usr/lib/mumble/libmumble.so.1.2 primusrun %command%      TF2 is in windowed mode, so I'd be happy with mumble producing its own overlay that wasn't injected into TF2.


cannot create regular file 'filename': File exists

I've been getting this strange error message in one of my build scripts - `cp` fails, returning the error "File exists". I've even tried using `cp -f`, which should overwrite the file if it exists, but the error still shows up. Running `cp` to overwrite existing files works perfectly when I do it manually. What could cause this error?


Validating an OpenSSL Cipher List

Are there any tools that can validate an OpenSSL cipher list both syntactically and semantically? For example, `ALL:!LOW:!SSLv2:!EXP:!aNULL` is both syntactically and semantically valid cipher list. On the other hand, `FOO:!BAR:!SSLv2:!EXP:!aNULL` is semantically invalid since `FOO` and `BAR` are not valid cipher strings while it is syntactically valid. Is there any tool (whether in the OpenSSL package or from a 3rd party) that can validate a cipher list in both scenarios? Of course it is possible to write a tool from scratch using the cipher list format and cipher strings that can be fetched from `openssl ciphers` command output, but I don't like reinventing the wheel if I don't have to.


Execute a command within 'sed'

I have a list of random memory addresses saved in a text file, and I need to `sed` them out, decode them, and save them back to my file. However, the decoding operation I'm trying to perform is handled in a C++ program I've created some time ago. The problem I am encountering now is executing the C++ within the `sed` command; that is, I want to back-reference the part that needs to be decoded and use it as an argument in my C++ program. I have written the following command:               cat $1 | sed -r 's/(0[Xx])([0-9A-Za-z]{1,8})/\1`./convAddrs \2`/g';      before I had the chance to read an answer in this post saying that `sed` does NOT execute commands. Is it true that `sed` doesn't allow the execution of commands? If so, assuming the command I've written is a valid `sed` sequence, how would I write it in `perl`?


How many different ways can you create an "alias" in Bash?

I only know of two ways: `alias foo=bar` and `function foo() { bar }`. The reason I'm asking is that - all of a sudden in one of my bash sessions - I cannot run the `ln` command because `bash` is erroring out with `-bash: /usr/local/.../ln: No such file or directory` (where the `/usr/local/.../` is one of the entries in my `PATH` environment variable). It's not a `PATH` issue though, because If I run `which ln` it outputs the expected binary of `/usr/bin/ln` (which I can run fine if I specify the absolute path). I also checked for `ln` in my `alias` and `function` declarations, and there is nothing:               $ declare -f | grep ln     $ alias | grep ln      The problem is just occurring in one bash session. If I start a new shell, it works fine again, but I want to know what caused this problem all of a sudden in this one particular session of bash. Any ideas as to what could be causing this?


If some program is not working in Ubuntu, how to uninstall and reinstall

I'd be specially interested in a solution that covers the dependencies of this program, and not only the program as such. I have several programs that don't work after I updated to Ubuntu 13.04 from 12.10; and I suspect that they have a common problem in some package that all use. Note: what's not working is Evolution, Unity Tweaks, Ubuntu Tweaks, and Bleach (it freezes after running). I've tried apt-get purge and install, to no avail. I wonder whether the problem is solvable, maybe these programs won't run in Ubuntu 13.04. I get following messages:               (evolution:25416): Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed          (evolution:25416): Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed          (evolution:25416): Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed          (evolution:25416): Gtk-WARNING **: Attempting to read the recently used resources file at `/home/k4/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/k4/.local/share/recently-used.xbel': Permission denied.          (evolution:25416): IBUS-WARNING **: The owner of /home/k4/.config/ibus/bus is not k4!      and then I get the               segmentation fault (core dumped).      message (after it asks me to configure the email).


OpenGL acceleration stopped working after upgrading to Wheezy

After upgrading recently from Squeeze to Wheezy, my 3D acceleration suddenly stopped working. I'm using IBM Thinkpad T60 with ATI M52 [Mobility Radeon X1300]. I found in Xorg.0.log:               [ 48286.173] (EE) AIGLX error: r300 does not export required DRI extension     [ 48286.174] (EE) AIGLX: reverting to software rendering     [ 48286.180] (II) AIGLX: Loaded and initialized swrast     [ 48286.180] (II) GLX: Initialized DRISWRAST GL provider for screen 0      But I have no clue how to solve the problem. _Update:_ Possibly related: http://bugs.debian.org/639621


Cron job still running when deleted

On a server I inherited, there is a `cron` job running hourly on one of the Debian servers. It sends an email out to a non-existent email, but bounces back to my account since I listed myself as the `root` email in `/etc/aliases`. The cron job has been deleted from `/etc/cron.hourly` (it was `ntupdate`), as it's listed in the email. I reloaded the `crontab` daemon, but I am still getting hourly reports that the file failed to launch, and the email address does not exist! The output that is getting emailed:               /etc/cron.hourly/ntpdate:     run-parts: failed to exec /etc/cron.hourly/ntpdate: Exec format error     run-parts: /etc/cron.hourly/ntpdate exited with return code 1      Currently, there is just the `.placeholder` hidden file in `/etc/cron.hourly`. I also ran `crontab -l`, and the only 3 jobs listed are expected to be listed, and are running about 10 minutes after this email keep arriving; so I know it is not one of those. **Where can I look next to stop getting these emails?** **EDIT #1**               # ls -l /var/spool/cron     total 4     drwx-wx--T 2 root crontab 4096 Jan 25  2012 crontabs      **EDIT #2**               # ls -l /var/spool/cron/crontabs/     total 4     -rw------- 1 root crontab 311 Jan 25  2012 root     # more /var/spool/cron/crontabs/root     # DO NOT EDIT THIS FILE - edit the master and reinstall.     # (/tmp/crontab.4nUf85/crontab installed on Wed Jan 25 10:11:10 2012)     # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)     2 1 * * * /etc/webmin/cron/tempdelete.pl     0 22 * * * /etc/init.d/gnugk stop     0 23 * * * /etc/init.d/gnugk start      This is on Debian Squeeze, using just `cron`, as far as I can tell


How to rename a file into a random GUID?

The task is to replace a file's (actually of all the files in a directory) name (but leave extension intact) with a random UUID/GUID. Any ideas on how to do this?


Colored man pages not working on gentoo

I have a problem using **these methods** to get colors in my man pages in gentoo. I've asked already in the gentoo forums but it still doesn't work, and the comments in a bug report (Bug 184604) don't work either. Can someone help me to get colours in my man pages? **EDIT** : Yes, I'm using less as pager and urxvt-unicode as terminal emulator **EDIT2** : I already asked in the gentoo forums but it didn't help, this is the link I couln't post before (because of my reputation) http://forums.gentoo.org/viewtopic-t-819833-start-0.html.


SSH Copy Limit?

So I have a small little Ubuntu server set up, with some rather large files that I've allowed a few people to copy from their putty window. Anyways 2 questions: Lets say a person on windows wants to copy a file using putty from an Ubuntu server. how would they do it? and what directory would it default too? (what would the command be even? would I use SCP?) Second question: is there like a limit? these are mostly 1-2gb files. would that cause any issues? Thanks


How to get only files created after a date with ls?

With `ls` command, does it possible to show only file created after a date, hour... I'm asking it because I have a directory with thousand of files. I want files created since yesterday. I use `ls -ltr` but I have to see all files... There is an equivalent of `DIRECTORY/SINCE=date` from OpenVMS ?


Program to keep track number of login attempts

Is there any way to keep track of number of attempts made by a user to login into his system?


The Right Distro for text-based needs

I'm searching for the right Linux Distro. My four current ideas are:   * Gentoo   * Grml   * Arch   * Debian But I'm absoluty open to more alternatives. Now a little bit more about my needs:   * I want it to be really small by default, so I can customize the hell out of it.   * I want to use text-tools only, I don't need any graphics on that OS   * I'm going to use ZSH, Vim, the NEO Layout and maybe XMonad   * I want to have a really nice package manager   * The OS will mainly be used for programming My CPU is an Intel Core 2 Duo, 64 Bit, of course. My questions are now:   * Which package manager is the most advanced: APT, Portage or Pacman?   * Which distro fits my needs best?   * What is the easiest way to run it from an USB-Flashdrive?


cp and mv if the file named already exists

What happens when you give the following commands if the file named done already exists?               $ cp to_do done     $ mv to_do done


Examine exported binary gpg key

The commands `gpg --export` and `gpg --export-secret-keys` can be used to export keys in a binary format. Is there any command available to examine these exported binary key files? I need to see if the exported files contain some extra fields or any other incompatibility problems.


Turning off default video output with xrandr when external monitor is connected

I'm new to bash scripting, and I'm trying to configure my video outputs so that my laptop display gets turned off when I connect an external monitor via VGA. That's the script I came up with, pretty straightforward:               #!/bin/bash     myvar="$(xrandr -q)"     if [[ $myvar == *"VGA connected"* ]]         then             xrandr --output VGA --auto;             xrandr --output LVDS --off;         else             xrandr --output LVDS --auto;     fi      All is working as it should except for the `xrandr --output LVDS --off` bit, as my laptop display simply adjusts its resolution to match the external monitor's one and stays on. Can't figure out the bug on this one. Any help is appreciated.


Yum: assume yes if install size < 1MB

What the title says: I don't want to use `\--assume-yes` option, but I'm fine with small installs (less than 1MB) to be processed without asking. Is there any way how to achieve that? I'm on Fedora 20.


Generate .asoundrc

Is there any way to generate .asoundrc? I know that by default this file does not exist and system generates one on the go like Xorg does. But is there any way to see how the content will look like?


Batch rename image files by age plus add date and variable to filename

_The question is completely rewritten due to things learned from the first two answers and comments that I was unaware of when first asking._ * * * After a photo shoot I come home with files that look like `_DSC1234.NEF`. `NEF` is Nikon's camera raw file format, so `EXIF` data is present in the files. I would like to automatically rename them with three parts:   1. Creation date in the format `YYYYMMDD`   2. Name of Shoot   3. Number of Image So the final file name should look like this `20140707_NameOfShoot_0001.NEF` There are a few issues: **ad 1. Creation date** sometimes I can only copy and rename the files a few days after shooting, so the date should reflect the date the picture was taken, not the date it was copied. `mtime` seems like the best bet here or if possible creation date from `EXIF`. **ad 2: Name of Shoot** This would ideally be a variable I could set as a parameter on calling the script. **ad 3. Number of Image** This should reflect the age of the image, the oldest having the lowest number. The problem is that cameras usually restart numbering at `0000` after they hit `9999`. So `9995-9999` can potentially be older than `0000-0004`. I am looking for a solution that reflects file age and in this special case would rename   * _DSC0000.NEF -> 20140707_FOO_0004.NEF   * _DSC0001.NEF -> 20140707_FOO_0005.NEF   * _DSC0002.NEF -> 20140707_FOO_0006.NEF   * ...   * _DSC9997.NEF -> 20140707_FOO_0001.NEF   * _DSC9998.NEF -> 20140707_FOO_0002.NEF   * _DSC9999.NEF -> 20140707_FOO_0003.NEF Again, either `mtime` or if possible creation date from `EXIF` seem right. * * * From here I have a working solution which renames all .NEF-files in a folder by date:               find -name '*.NEF' |      gawk 'BEGIN{ a=1 }{ printf "mv %s %04d.NEF\n", $0, a++ }' |      bash       Hard coding file-modification-date and the shootname works well, but it would be great if it could be automated. For the timestamp I find articles on `strftime()`, `mktime()`, `systime()` but I don't understand how to use them to return file modification date. I also tried to add `DATE=$(date +"%Y%m%d")` and add `$DATE` to the gawk-line, which leads to deletion of all files in current folder (and probably is systime anyway and not change time). For the variable, I tried               gawk 'BEGIN{ a=1 }{ printf "mv %s $1_%04d.NEF\n", $0, a++ }' |       and call the script with `./rename FOO`, but FOO is ignored in renaming.


How do I properly allow user jenkins to write to a specific directory under user minecraft home directory?

I am using Jenkins, I want to copy a file from the Jenkins directory in to the _minecraft_ user directory, but I am not sure how to go about this, as when I run               cp build/versions/*.info /home/*minecraft*/www/files/Minecraft/versions      I get 'Permission Denied'


Why does Linux come with SELinux?

If SELinux was created by NSA and published by United States Department of Defence then why the hell does it come with the barebone Linux kernel? Isn’t Linux all about security and privacy? Also, is SELinux not open source?


Gentoo Live CD from Hard Drive: No Mountable Filesystems on root after modules loaded

I am attempting to install Gentoo on my PowerPC Mac. I have reached the point where I can boot the Live CD (I have no functional CD Drive, so it is from a spare Hard Drive), but after the kernel is loaded, I get a message `"No root found at /dev/hda`. It then gives me the options: `shell to get into a shell, q to skip, enter to try the same again`. q to skip doesn't work, but it prints a nice warning `>> Skipping. This will likely cause a boot error.` Then it `can't find /newroot in /etc/SOMETHING` (I can't remember). The shell won't really help me, if I try: dev/hda (the only thing I can find in /dev that looks like the second internal harddrive I am booting from), I only get the nice warning No mountable filesystems!. Within the /boot/yaboot.conf file, the root is by default: `root=/dev/ram0`. Am I possibly missing a swap partition? I changed the `device` within the yaboot.conf file to `ultra0:` as it is for that drive. I used dd to copy the entire disk image to the drive, and it acknowledges itself to be a Live CD. The 40 GB hard drive even thinks it only has a 143.2MB capacity with 0 KB free. The only issue is: `/dev/cdrom` (which it seems to want to access) doesn't exist due to the hardware failure of my internal drive. The kernel will only even consider mounting valid drives within the /dev structure, so any advice on how to make the CD point to my drive?


How can I switch window managers in Gnome 3?

I normally enjoy using Gnome 3 and gnome-shell in Fedora 16. However, I would like to temporarily run a non-compositing window manager such as metacity so that some wine games can have full control of the display. I have metacity installed. When I run `metacity --replace`, instead of switching window managers I get a gnome-shell failure display that forces me to logout. I also cannot find a way to choose a different session from the login prompt. There are no buttons, options, arrows or anything to choose. Just username and password. I'm about to resort to desperate measures involving systemd runlevels to disable X and start it manually via `startx`. Is that going to be my only option? I hope not.


xdg-open opens a different application to the one specified by xdg-mime query

I run Debian Jessie without a desktop environment (I use the tiling window manager i3) and like to use `xdg-open` to quickly open files using a preferred application. I have an ongoing problem setting the preferred app for PDF files though. This is my problem in a nutshell:               $ xdg-mime query filetype ~/Downloads/document.pdf     application/pdf          $ xdg-mime query default application/pdf     /usr/share/applications/qpdfview.desktop          $ xdg-open ~/Downloads/document.pdf     [opens gimp!]      Any ideas would be hugely appreciated - this has been plaguing me for about a year. The only way I've ever managed to (temporarily) fix it is by directly editing the `mimeinfo.cache` and removing the reference to `gimp` from the `application/pdf` record. And yes, `/usr/share/applications/qpdfview.desktop` exists and contains the correct location of the `qpdfview` binary. (Indeed, this .desktop file is used when I hand-edit `mimeinfo.cache`.)


Package management without the need of root permission

Am looking for a way to install packages in home folder. This thread suggests using               apt-get source      ./configure --prefix=$HOME      However, it doesn't provide a way to manage dependencies like apt-get install does. Tools like Homebrew have a limited number of packages. Is there a way to use apt-get, but to install in home folder.


Does BIOS read directly the bootloader or load it into RAM?

I'm trying to understand the very first steps of the boot process.   1. The CPU read the BIOS     * It reads a fixed address instruction     * It will jump to the first BIOS instructions address     * It will execute the code     * It will do the "Power-On Selt Test", check devices and find first bootable device   2. The Bios will then _read_ the MBR to _load_ the primary boot loader   3. The primary boot loader will execute the loader's second stage (ex: Grub)   4. The loader's second stage will load the Kernel in memory My question are:   * When the BIOS **read** and **load** the primary boot loader in memory, are we talking the RAM memory?    * Can the CPU **address directly** (read instructions) from the HDD without loading the content into RAM (we disregard performance issue here)?   * Same question for the BIOS: is it read directly or loaded in RAM before execution?


What is meant by "a system call" if not the implementation in the programing language?

I would like to understand the term "system call". I am familiar that system calls are used to get kernel services from a userspace application. The part i need clarification with is the difference between a "system call" and a "C implementation of the system call". Here is a quote that confuses me: > On Unix-like systems, that API is usually part of an implementation of the C > library (libc), such as glibc, that provides wrapper functions for the > system calls, often named the same as the system calls that they call What are the "system calls that they call"? Where is their source? Can I include them directly in my code? Is the "system call" in a generic sense just a POSIX defined interface but to actually see the implementation one could examine the C source and in it see how the actual userspace to kernel communication actually goes? Background note: I'm trying to understand if, in the end, each c function ends up interacting with devices from `/dev`.


Figuring out what OS is on which partition?

So I have both Ubuntu and Crunchbang installed on my laptop, and I'm trying to figure out which one is on which partition. I'm going to install another OS (probably BT) and need to know what partition can safely be wiped. Any tips ? My partitions at the moment: ![enter image description here](http://i.stack.imgur.com/Z2B7C.png)


understand the output of stty -a and change ctril backspace to just backspace

I am working in bash shell on a **Solaris** environment and whenever I type "backspace" it clears out the entire line. Do you have any suggestions for me to change the backspace clearing entire line to just a character which is the expected behavior of it? And also please guide me also on how do I interpret the output of `stty -a` command in my local **cygwin** environment:               $ stty -a <br/>     speed 38400 baud; rows 34; columns 125; line = 0;     intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = ^Z; start = ^Q; stop = ^S;     susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;     -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts     -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel     opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0     isig icanon iexten echo echoe echok -echonl -noflsh -tostop echoctl echoke


rkhunter /usr/bin/ssh && /usr/sbin/sshd [Warning]

My last rkhuter scan reported a couple of warnings that deserve to be checked(for my noob eyes). Main reason for my suspect is that i wasn't on the machine at (03-Apr-2014 01:12:12) ->AM I googled for understand what's the purpose of the 2 files i mentioned in question title, but i didn't find very helpfull answers. Can anybody tell me what's the aim of those files, and maybee also why/when it would be modified by the system itself?               [10:17:11] Warning: The file properties have changed:     [10:17:11]          File: /usr/sbin/sshd     [10:17:11]          Current hash: 900e153506754ceb7b19f3a01a3ad5e36d43d958     [10:17:11]          Stored hash : 55a1a63a46d84eb9d0322f96bd9a61f070e90698     [10:17:11]          Current inode: 149998    Stored inode: 142248     [10:17:11]          Current file modification time: 1396480332 (03-Apr-2014 01:12:12)     [10:17:11]          Stored file modification time : 1360359087 (08-Feb-2013 22:31:27)      * * *               [10:17:34] Warning: The file properties have changed:     [10:17:34]          File: /usr/bin/ssh     [10:17:34]          Current hash: 60366d414c711a70f9e313f5ff26213ca513b565     [10:17:34]          Stored hash : 1b410fb0de841737f963e1ee011989f155f41259     [10:17:34]          Current inode: 150030    Stored inode: 142203     [10:17:34]          Current file modification time: 1396480332 (03-Apr-2014 01:12:12)     [10:17:34]          Stored file modification time : 1360359087 (08-Feb-2013 22:31:27)      the apt logs files making me worry, i censured couple of info. Apparently in the 03-Apr-2014 i didnt installed nothing.               Start-Date: 2014-04-01  15:49:18     Commandline:  ***********     Install:  ***********     End-Date: 2014-04-01  15:49:29          Start-Date: 2014-04-08  14:03:52     Commandline:  ***********     Install:  ***********     End-Date: 2014-04-08  14:04:04      By the way i think(hope) they are false positives [edit:not anymore]. Maybee Files edited by some process of the system and normally not recorded in the .dat file of rkhunter because i didn't updated. I came here to find some confirmation :) or some more Parania


Xfce and Xscreensaver doesn't seem to consider keyboard activity "activity" - how change?

After I upgraded from Debian Squeeze to Wheezy, the combination of Xfce and Xscreensaver doesn't seem to consider keyboard activity to be user activity. Since I sometimes use only the keyboard for long periods of time, this means that eventually the screensaver activates because of a lack of mouse input. This is somewhat of an annoyance, but another key press (or a bump on the mouse) will cause the screensaver to go away and wait another period of time before kicking in again. **How do I make the system consider keyboard input to be activity?** I looked at the screensaver preferences but couldn't find anything relevant. **Alternatively,** how do I switch to a screensaver subsystem which does accept keyboard input as user activity? (All I want is a blank screen screensaver and monitor DPMI suspend and power-off after a configurable delay in X.) In case it matters, I'm using a USB keyboard hooked directly to the PC (no USB hub in between). The mouse is also USB.


How to build Shallot

I am trying to build Shallot. I run x64 Debian Sqeeze. It runs into compile problems I don't understand...               john@hayek:~/build/katmagic-Shallot-831de01$ make     cc  -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib  -Wall -o src/math.o -c src/math.c     In file included from src/math.c:3:     src/math.h:23:24: error: openssl/bn.h: No such file or directory     src/math.h:24:25: error: openssl/rsa.h: No such file or directory     src/math.h:25:25: error: openssl/sha.h: No such file or directory     In file included from src/math.c:3:     src/math.h:28: error: expected ‘)’ before ‘*’ token     src/math.h:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token     src/math.h:31: error: expected ‘)’ before ‘*’ token     src/math.c:14: error: expected ‘)’ before ‘*’ token     src/math.c:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token     src/math.c:56: error: expected ‘)’ before ‘*’ token     make: *** [src/math.o] Error 1


Upgraded to Gnome 3.4 on Debian, can't login to my main user?

I get into this endless login-cycle if I attempt logging with my main user - I tried Gnome Classic and regular Gnome, but after I login it sends me back to the login. The only way I can login is through another user. This means that there's some hidden setting file in the home directory that messes things up. How can I debug this further?


A way for saving running state of a program

I have a program that will perform a lengthy calculation which may take several days to be completed. Is there a way to save the program's running state; so I will be able to turn off the computer and run the program from a saved state. Or if the program crashed for any reason I can restart it from a saved state (and not from the outset)?


Find all lines between a line matching a pattern and a line matching another pattern

i want to start grepping from the lines that has "CK" at the end of line and stop grepping when the line has "D" at the end. I tried `grep "$CK" "$D" file..txt` , but it didnt work. Input:               kkkkkkkkkkk        jjjjjjjjjjjjjjjjjj       gggggggggggg/CK       JHGHHHHHHHH        HJKHKKLKLLL        JNBHBHJKJJLKKL       JLKKKLLKJLKJ/D       GGGGGGGGGGGGGG       GGGGGGGGGGGGGG      The desired output               gggggggggggg/CK       JHGHHHHHHHH        HJKHKKLKLLL        JNBHBHJKJJLKKL       JLKKKLLKJLKJ/D


Why do package names contain version numbers?

While working with Ubuntu and other Debian-based distros, I've noticed that packages in the software repos often contain the major version number. For example,   * Apache: `apache2`   * Tomcat: `tomcat7`   * PHP: `php5`   * Wine: `wine1.4`   * MySQL: `mysql-server-5.5` I notice however that there's no `apache1` package available, and similar for the rest. If the name of the package changes with updates to the software, doesn't that get in the way of one of the major goals of package management (easy upgrades)? If Apache 3 comes out tomorrow, am I going to have to install the `apache3` package manually if I want to upgrade?`


Is there an operator like && that ignores return status?

I've discovered the following useful trick for long-running tasks on the command line:               do_some_task && make_a_noise      For instance, on OSX:               do_some_task && say 'done'      However, `&&` means "run the next command if the previous one returned 0 for success". If the first command fails, the second doesn't execute. Is there a similar operator that means "do this regardless of the previous command's return status"?


Configure localtime. dpkg-reconfigure tzdata

I'm using this to configure localtime:               dpkg-reconfigure tzdata       It is ncurses interface. I'm looking for the way to programming this. Is there true way without user ncurses interface? How to change localtime by one shell command?


Is there a way to permanently exclude the kernel from updates?

I'm using Fedora and wonder if there is some way I can exclude kernel updates when I run `yum update`, until I specifically want to update the kernel. The reason why I am concerned about this is because sometimes it requires a lot of extra research finding patches for some programs and extra time spent recompiling them to work on the new kernel. I am thinking VMWare specifically as one example. I wonder if there is some way for `yum update` to NOT update the kernel and only notify me that a new one is available when it goes through its routine so that I can decide to put it off until a more convenient time. Or is this thinking likely to cause other issues?


Remove Linux Mint and restore windows's bootloader

I have an old laptop that is setup with dual boot, running Windows Vista and Linux Mint 12. I want to remove the Mint and reclaim the space to Windows. This is a simple task but I've been on it for the whole day and I'm no closer to a solution. I know removing Linux Mint on a dual-boot machine and restoring the windows's bootloader is a simple task of popping in the windows disk and hitting on repair. I've done this before on my old laptop, quite a few times. But that was quite a long time ago. Today, the laptop's CD/DVD drive is not reliable. It almost never works these days. And its also unable to boot from USB, which it used to do in the past. Without a functioning CD/DVD drive and no ability to boot from USB, is this even possible? If there is a way to restore the windows bootloader right from within the currently working Vista OS, that would be perfect. I have the Vista Business disk and I can get files from it by reading it on a different machine and transferring via a usb drive. So, do you guys have any ideas on how I can fix this. The laptop is, as of now, working perfectly fine, booting with grub. But this grub will be gone if I remove the Linux Mint partition.


Why does my desktop lock up when I copy lots of files to a USB drive?

My desktop is usually very responsive, even under heavy load. But when I copy files to a USB drive, it always locks up after some time. By "lock up", I mean:   * Moving focus from one window to another can take 10-20s   * Switching desktops can take 10-20s   * Videos don't update anymore (in YouTube, the audio continues to play, only the video freezes) The system load isn't exceptionally high when this happens. Sometimes, I see a lot of white on xosview indicating that the kernel is busy somewhere. At first glance, it looks as if copying files to the USB drive would interfere somehow with compiz but I can't imagine what the connection could be. Here is the output of `htop`: ![Output of htop shortly after the hang](http://i.stack.imgur.com/76ZSR.png) Here is the output of `iostat -c -z -t -x -d 1` during a 2 minute hang:               19.07.2012 20:38:22     avg-cpu:  %user   %nice %system %iowait  %steal   %idle                1,27    0,00    0,38   37,52    0,00   60,84          Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util     sdg               0,00     2,00    0,00  216,00     0,00 109248,00  1011,56   247,75  677,69    0,00  677,69   4,63 100,00      As you can see, only the external harddisk is active. Here is the complete log: http://pastebin.com/YNWTAkh4 The hang started at 20:38:01 and ended at 20:40:19. Software information:   * openSUSE 12.1   * KDE 4.7.x   * Filesystems: reiserfs and btrfs on my internal harddisk, btrfs on the USB drive


Does inotify fire a notification when a write is started or when it is completed?

Imagine two processes, a reader and a writer, communicating via a regular file on an ext3 fs. Reader has an inotify `IN_MODIFY` watch on the file. Writer writes 1000 bytes to the file, in a single `write()` call. Reader gets the inotify event, and calls `fstat` on the file. What does Reader see?   1. Is there any guarantee that Reader will get back at least 1000 for `st_size` on the file? From my experiments, it seems not.   2. Is there any guarantee that Reader can actually `read()` 1000 bytes? This is happening on a seriously I/O bound box. For example, `sar` shows an await times of about 1 second. In my case the Reader is actually waiting 10 seconds AFTER getting the inotify event before calling `stat`, and getting too-small results. What I had hoped was that the inotify event would not be delivered until the file was ready. What I suspect is actually happening is that the inotify event fires DURING the `write()` call in the Writer, and the data is actually available to other processes on the system whenever it happens to be ready. In this case, 10s is not enough time. I guess I am just looking for confirmation that the kernel actually implements inotify the way I am guessing. Also, if there are any options, possibly, to alter this behavior? Finally- what is the point of inotify, given this behavior? You're reduced to polling the file/directory anyway, after you get the event, until the data is actually available. Might as well be doing that all along, and forget about inotify. _**_*** _**EDIT **_** _*_ *** Okay, as often happens, the behavior I am seeing actually makes sense, now that I understand what I am really doing. ^_^ I am actually responding to an IN_CREATE event on the directory the file lives in. So I am actually stat()'ing the file in response to the creation of the file, not necessarily the IN_MODIFY event, which may be arriving later. I am going to change my code so that, once I get the IN_CREATE event, I will subscribe to IN_MODIFY on the file itself, and I won't actually attempt to read the file until I get the IN_MODIFY event. I realize that there is a small window there in which I may miss a write to the file, but this is acceptable for my application, because in the worst case, the file will be closed after a maximum number of seconds.


How to configure ADSL connection using bash?

I know it's possible to configure the modem to automatically connect the internet using a browser, but I want to do it using bash. I would like the network to automatically connect when the system boots. I have a ADSL2 router/modem and I'm using the Debian 6 Squeeze.


Linux kernel compiling commands

I'm trying to make a mini operating system (using the linux kernel). I'm planning on it being for x86 and I'm trying to make it so that it not only runs on qemu but also on a real device. What are the exact commands that I would need to put into terminal to do this?


What is a spinlock in Linux?

I would like to know about spinlocks in detail?   Could someone explain that to me?


Where to find a PKG or RPM of fsarchiver?

I want to download the latest version of fsarchiver (I need a PKG file or RPM). Where can I find that?


Graphics card recommendation, Dell PowerEdge R210 & CentOS 6.5

I have server with displays and a keyboard-mouse for displaying network map status and for use as a shell and virtual console in my server room. Need a recent video card that is > $100 that can support the hardware requirements. I do not need to do any heavy rendering, but multiple open windows and graphics on Gnome2x desktop. I am required to use CentOS 6.5. =-/ My hardware: Dell PowerEdge R210 - Intel Core (i3 or i5, family6 model 37 stepping 2) 1.2GHz - 4GB DDR3 ram - 1 available PCIx slot (full size/height, it is on a riser/right-angle card) 2x Apple Cinema HD 30" (M9179LL/A) I have tried an ATI HD3450 and several similar older cards. Double screwed with older ATI; the chipsets are unsupported by current drivers (proprietary and ElRepo), and the legacy drivers do not support current Xorg packages (so I have to downgrade etc. ad naseum). I have also tried a Geforce 7300 GT that I cannibalized from an old Mac Pro. Nouveau driver does not like/recognize the card, NVidia driver install script says the adapter is not initialized (bad card? incompatible with Dell hw?) I'm done with old used hardware. Any suggestions on a decent, inexpensive, _currently supported_ video adapter that will drive these two displays at native 2560x1600 resolution?


How to see disk details like manufacturer in Linux

With `sfdisk -s` I can see the disk capacity as follows:               $ sfdisk -s     /dev/cciss/c0d0: 143338560     total: 143338560 blocks      How do I see disk details like disk manufacturer? I tried `hdparm`, but got an error:               $ hdparm -i  /dev/cciss/c0d0     /dev/cciss/c0d0:     HDIO_GET_IDENTITY failed: Inappropriate ioctl for device


Common code for kernel and userspace

I'm working on a linux project. I want to have some code (to be specific, a struct) and a header file (my own implementation) common to both the kernel and the userspace. Can someone tell me how to implement this ?


Join multiple files in a directory column wise

I would like to join about 100 files in the same directory column-wise. I have tried                 paste file1 file2 | column -s $'\t' -t      This works fine for 2 files. But when I try to do it for 100 files, I get an error saying                column: line too long      Could someone please help where I am going wrong?


Mounting NTFS Drives in Linux Mint

![enter image description here](http://i.stack.imgur.com/LHzvx.png) My laptop is an Aspire E1 -431. When I installed Linux Mint 15 and 17, I found that the NTFS drives cannot be mounted:               Error mounting /dev/sda3 at /media/kutti/BE6C20D66C208B6B: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sda3" "/media/kutti/BE6C20D66C208B6B"' exited with non-zero exit status 14: The disk contains an unclean file system (0, 0).     Metadata kept in Windows cache, refused to mount.     Failed to mount '/dev/sda3': Operation not permitted     The NTFS partition is in an unsafe state. Please resume and shutdown     Windows fully (no hibernation or fast restarting), or mount the volume     read-only with the 'ro' mount option.      Here i have enclosed my terminal working: ![](http://i.stack.imgur.com/abZRA.png) After editing `/etc/fstab` and entering the command, `sudo mount -a`, I get the following message:               [mntent]: line 13 in /etc/fstab is bad     [mntent]: line 14 in /etc/fstab is bad


rsync --delete deleted most files in the destination directory, why?

I got my config files in `/etc` folder all messed up because I did not take care of shell expansion while doing rsync:               rsync --progress --delete -avhHe ssh /etc/logrotate.d/{httpd,mariadb,php-fpm,ppp,wpa_supplicant,yum} root@my.ipaddress:/etc      I think the problem is that the '.' following logrotate got expanded and subsequently some folders such as `/etc/httpd` got deleted. I want to learn from this mistake by doing it correctly. How do I prevent shell expansion when rsync multiple files with ssh?


pm-suspend fails to wake up

I use `pm-suspend` on Debian 7.5. Most of the time everything works perfect, but sometimes it fails to wake up. The fans spin up, even the hard disk shows activity, but there is only a blank screen. After some time, I can see a strange mouse pointer on the screen, which looks like this: ![mouse poiinter](http://i.stack.imgur.com/GGF9H.jpg) When this happens, I can't change to another console or do anything. Only shutting down power and rebooting helps. The log (`/var/log/pm-suspend`) indicates a successful wakeup. I think this is not an X server error since I cannot even use my keyboard to change to a tty. Anyway, I use `xorg 7.7`. **EDIT** - hardware:   * AMD FX-8120 CPU   * Sapphire Radeon HD 6850 VGA, 1st screen connected via HDMI, 2nd via DVI   * ASUS M5A97 PRO motherboard with UEFI firmware (up to date, but the latest update is from October, 2012)


Raspeberry pi OTG power and usb pen drive

I know The OTG port is used to power the pi. So, how could I use a usb drive on that OTG port ? Could i plug a powered hub and the drive on the hub ? Moreover, is there any other way to power the pi while leaving the otg port to be used as a normal host usb port ?


conky: proper column alignment

Say I want something like the following in my `.conkyrc`               NAME                PID       CPU%      MEM%     ${top name 1} ${top pid 1}   ${top cpu 1}    ${top mem 1}     ${top name 2} ${top pid 2}   ${top cpu 2}    ${top mem 2}     ${top name 3} ${top pid 3}   ${top cpu 3}    ${top mem 3}     ${top name 4} ${top pid 4}   ${top cpu 4}    ${top mem 4}      Do I have to align the columns manually by adding space, or is there a way to tell conky to align things in columns. With fewer columns, I could just use `$alignc` and `$alignr` but I can't do that here...


Segmentation fault when trying to run glxgears via virtualGL

(Follow-up on How to efficiently use 3D via a remote connection?) I installed the amd64 package on the server and the i386 one on the client. Following the user's guide I run this on the client:               me@client> /opt/VirtualGL/bin/vglconnect me@server     me@server> /opt/VirtualGL/bin/vglrun glxgears      This causes a segfault, using `vglconnect -s` for a ssh tunnel doesn't work either. I also tried the TurboVNC method, where starting `vglrun glxgears` works, but I'd prefer transmitting only the application window using the jpeg compression. Is the problem 32 <-> 64 bit? Or how can I fix things?


What's the difference between fork() and vfork()?

I would like to understand in detail the difference between fork() and vfork(). I was not able to digest the man page completely. I would also like to clarify one of my colleagues comment " **In current Linux, there is no vfork(), even if you call it, it will internally call fork()**."


How is paging managed in the absence of swapping?

How is paging managed in the absence of swapping. If that is the case, how will a page fault be managed? What I meant is, if there is no availability for swapping, then how is Paging managed. I know that there will be two list of pages - free_pages list and allocated_pages list. When the pages in the free_pages list becomes low, it will move the LRU pages from the allocated_pages list to the swap partition. I just want to know what will happen if there is no swap partition.


How to modify a PKGBUILD which uses git sources to pull only a shallow clone?

The other day I tried installing `opencv-git` from the _AUR_ with `makepkg` on Arch Linux. Of course it pulls from the _git_ repository as the name indicates. This pulls 1Gb. I am reading about making a _shallow clone_ with `git`. When I look at the `PKGBUILD` file, using `grep git PKGBUILD`, I see:               pkgname="opencv-git"     makedepends=('git' 'cmake' 'python2-numpy' 'mesa' 'eigen2')     provides=("${pkgname%-git}")     conflicts=("${pkgname%-git}")     source=("${pkgname%-git}::git+http://github.com/Itseez/opencv.git"         cd "${srcdir}/${pkgname%-git}"         git describe --long | sed -r 's/([^-]*-g)/r\1/;s/-/./g'         cd "${srcdir}/${pkgname%-git}"         cd "${srcdir}/${pkgname%-git}"         cd "${srcdir}/${pkgname%-git}"         install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname%-git}/LICENSE"      Is there a way to modify the recipe or the `makepkg` command to pull only a shallow clone (the latest version of the source is what I want) and not the full repository to save space and bandwidth? Reading `man 5 PKGBUILD` doesn't provide the insight I'm looking for. Also looked quickly through the `makepkg` and `pacman` manpages - can't seem to find how to do that.


32 bit appplication on 64 bit linux not working

I'm running linux mint LMDE 64 bit version, I have to install this i386 software to use my modem. So I did it with --force-architecture mode, installation completed with errors. Here is the log               dpkg: warning: overriding problem because --force enabled:      package architecture (i386) does not match system (amd64)     Selecting previously unselected package crossplatformui.     (Reading database ... 175681 files and directories currently installed.)     Unpacking crossplatformui (from CrossPlatformUI-V1.0.27-BSNL-i386-ubuntu.deb) ...     Setting up crossplatformui (1.0.27) ...     Stopping ACPI services....     Starting ACPI services....     package libqtgui4 exist     QT_VERSION = 4     make -C /lib/modules/3.2.0-2-amd64/build M=/usr/local/bin/ztemtApp/zteusbserial/below2.6.27 modules     make[1]: Entering directory `/usr/src/linux-headers-3.2.0-2-amd64'       CC [M]  /usr/local/bin/ztemtApp/zteusbserial/below2.6.27/usb-serial.o     /usr/local/bin/ztemtApp/zteusbserial/below2.6.27/usb-serial.c:34:28: fatal error: linux/smp_lock.h: No such file or directory     compilation terminated.     make[4]: *** [/usr/local/bin/ztemtApp/zteusbserial/below2.6.27/usb-serial.o] Error 1     make[3]: *** [_module_/usr/local/bin/ztemtApp/zteusbserial/below2.6.27] Error 2     make[2]: *** [sub-make] Error 2     make[1]: *** [all] Error 2     make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-2-amd64'     make: *** [modules] Error 2     dpkg: error processing crossplatformui (--install):      subprocess installed post-installation script returned error exit status 2     Processing triggers for desktop-file-utils ...     Processing triggers for gnome-menus ...     Errors were encountered while processing:      crossplatformui      Now if I start the app it says               phanindra@phanindra:~$ ztemtapp      /usr/bin/ztemtapp: 4: exec: /usr/local/bin/ztemtApp/bin/App: not found      How to fix this? Update: I have installed `ia32-libs` now and now it says               phanindra@phanindra:~$ ztemtapp      /usr/local/bin/ztemtApp/bin/App: error while loading shared libraries: libQtGui.so.4: wrong ELF class: ELFCLASS64      whn I started the app


linux VM ware + ifconfig

I have linux machine red-hat 6.3 VM machine when I run the command ifconfig -a I see also the interfaces - **virbr0** and **virbr0-nic** what I want to get is only the interfaces eth0 and lo without **virbr0** and **virbr0-nic** please advice how to delete thise interface ? ( so when I will type ifconfig -a , then I will not see them )                     ifconfig -a|more           eth0      Link encap:Ethernet  HWaddr 00:50:56:BA:06:6B             inet addr:198.202.183.105  Bcast:198.202.183.127  Mask:255.255.255.128           inet6 addr: fe80::250:56ff:feba:66b/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:2694 errors:0 dropped:0 overruns:0 frame:0           TX packets:44 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:258427 (252.3 KiB)  TX bytes:6230 (6.0 KiB)      .                     lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:16436  Metric:1           RX packets:12 errors:0 dropped:0 overruns:0 frame:0           TX packets:12 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:720 (720.0 b)  TX bytes:720 (720.0 b)      .                      virbr0    Link encap:Ethernet  HWaddr 52:54:00:CE:AA:24             inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:0 errors:0 dropped:0 overruns:0 frame:0           TX packets:32 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:0 (0.0 b)  TX bytes:4613 (4.5 KiB)      .                     virbr0-nic Link encap:Ethernet  HWaddr 52:54:00:CE:AA:24             BROADCAST MULTICAST  MTU:1500  Metric:1           RX packets:0 errors:0 dropped:0 overruns:0 frame:0           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:500            RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)


sed substitution matches too many inputs

This is my command:               echo "Test" | sed -f <(sed -e 's/.*/s,&,gI/' mydic)        The file `mydic` contains 2 columns delimited by commas (`,`)               a,AlphabetA       .       .        .         e,AlphabetE        .        .        s,AlphabetS       .        t,AlphabetT        test,testedd        .        .        zebra,zebraaaa      The expect result is `testedd`, but I get `AlphabetTAlphabetEAlphabetSAlphabetT`.


Multiplex bash function execution

I created a bash function to "automagically" connect on our switches and retrive their `startup-config` using the `expect` command. I have to use `expect` because this switch does not accept the `ssh user@host` fashion and ask me again for the User and Password tuple. This is the function that i created to manage those backups               main_pc3548(){             /usr/bin/env expect <<-END3548             spawn ssh -o StrictHostKeyChecking=no -o LogLevel=quiet $IP             expect "User Name:"             send "$USER\r"             expect "Password:"             send "$PASS\r"             expect "*# "             send "copy startup-config tftp://$SERVER/$SWNAME.cfg.bkp\r"             sleep 8             END3548     }      This block of code will separate my switch types, and call `main_pc3548()` when my switch list have this switch model:               egrep -v '(^#|^\s*$|^\s*\t*#)' $LISTA_SWITCHES | while read IP SWNAME SERVER TIPO     do             if [ "$TIPO" = core  ]; then                     main_pc6248             elif [ "$TIPO" = dep ]; then                     main_pc3548             else                     echo "$(date "+%d/%m/%Y-%T") - Switch $SWNOME Have a martian type of switch" >> $LOG_FILE             fi     done      The rest of the script reads a pretty lengthy file with information about the Switch IP, the TFTP ip address, the Switch name, and waiting 8 seconds each switch consumes a lot of time. **This sleep is needed** to avoid slow connections to break the tftp copy so, here it comes my question: Is there a easy way to "multithread" this function to gain performance?


Best way to encrypt my system on an ssd

I consider to buy an ssd for my laptop (something like Samsung 830 or 840) to make the system more responsive. I want my system (at least my home partition) to be encrypted. However I know about rumors that there may be problems with encryption on ssd's and although that statements about this change very fast with time. Especially I don't want to have a big performance drop (as said above, I want the ssd to make the system significantly more responsive) and I don't want to shorten the lifetime of my ssd. Having this in mind, what is the best way to encrypt the system on an ssd? You can assume that the ssd will be a samsung 830, 840 or 840 pro if this matters. **Edit** My CPU is a pretty old Core2 Duo P8700 with 2,53 GHz without AES-NI and I have only SATA II. So I want to add the question: Does it make sense at all to upgrade say to a Samsung 830 and use dm-crypt/luks or ecryptfs? Or does the CPU and SATA port slow down the SSD too much? I don't want to win any benchmark contest, just want to have an clear improvement in my system responsiveness. I am not sure if the following is a good indicator about how fast the system will be, so it would be great if someone could comment it: Currently I am using ecryptfs to encrypt my home partition. An `LC_ALL=C dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc` on my encrypted home partition gives:               1024+0 records in     1024+0 records out     1073741824 bytes (1.1 GB) copied, 56.4674 s, 19.0 MB/s      and the CPU is working between 40 and 60%. The same on an unencrypted partition gives               LC_ALL=C dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc     1024+0 records in     1024+0 records out     1073741824 bytes (1.1 GB) copied, 29.6554 s, 36.2 MB/s      and the CPU is working between 0 and 20%. My `/tmp` folder is mounted via `tempfs` i.e. it lies in RAM. Doing the same in `/tmp` gives:               1024+0 records in     1024+0 records out     1073741824 bytes (1.1 GB) copied, 0.941708 s, 1.1 GB/s      Then I created a new `ecryptfs` directory below `/tmp` and did it there again.               1024+0 records in     1024+0 records out     1073741824 bytes (1.1 GB) copied, 10.1884 s, 105 MB/s      and one core working at 100% the other at 20%. The creation of the ecryptfs dir was as follows: `sudo mount -t ecryptfs /tmp/encrypted/ /tmp/decrypted` As options I choosed the default ones (ubuntu-system): AES, 16 bit, no plaintext passthrough, no filename encryption. Considering this result I would expect that the writing rate will increase from 19.0 MB/s to 105 MB/s when replacing my old WD-scorpion black 7200 with a Samsung 830 SSD and using ecryptfs. Which seems to be a clear performance improvement. I guess that dm-crypt will even be a bit faster. Any suggestions to make more reliable tests which will predict if the SSD will bring a clear performance boost. **Edit 2** Here is a similar test in a German debian wiki using dm-crypt: http://wiki.debianforum.de/Benchmark_f%C3%BCr_Festplattenverschl%C3%BCsselung I did that and got ~95 MB/s.


Using Putty/plink to scp to a named pipe

I have a large tar.gz file that I need to transfer from Windows to a UNIX machine and unzip into a folder that my login user doesn't have write permissions on. Once the file is on the machine I can extract it into the correct folder by using another user, but this user can't log in directly. The problem is that the user that does the scp only has write permissions on its ~ and /tmp folders, neither of which is big enough to accept the file. Therefore, I would like to use a named pipe created in the /tmp directory that I can extract the .tar.gz from using the user with the correct privs. However, I am unsure how to cat the tar.gz to the named pipe using Putty. I have a feeling that plink is involved, but I can't quite work out the command.


PCLOS FM - Kate editor really old version but classic PCLOS has a more current one

I have moved from classic pclinuxos to full monty some weeks ago. With great surprise, I realised that Kate editor is on version 3.12.3 while on the classic Pclinuxos is on much later one. Anyone with similar experience or workaround to "force kate update"? It is a really useful tool for me and I consider compiling from source as my last choice in such cases. Is it safe to go to the repositories of the classic Pclos and download the rpm?


Adding Arch Linux's repository to Manjaro

Is it safe to use Archlinux's repository within Manjaro Linux installation? If it is, all I need to do is just add some line to /etc/pacman.d/mirrorlist, right?


blockdev --setro doesn't work (for me at least)

I'm sure I don't understood how blockdev works. I going to expose the case here and hope some of you can help me. The case: I have mounted a flash drive and it was mapped to `/dev/sdb1`. Then I type in a terminal (as root):               root# blockdev --setro /dev/sdb1     root# blockdev --report      the report was: ![enter image description here](http://i.stack.imgur.com/yRFap.png) as you can see, the report said that `/dev/sdb1` is set to read-only (ro). But I'm still able to create files and folders in the flash drive. What I'm missing? Thanks in advance.


How to password-less log on via ssh alias

Suppose I have access to `pc` via a `server`. I can directly log-on to `pc` by using How do I connect to a pc through another pc using ssh Such that my `.ssh/config` looks like:               Host short     Hostname pc     User me     ProxyCommand ssh me@server nc %h %p      The user and home-folder on `pc` and `server` are the same, but only `server` can be directly reached from the outside world. Now, if I `ssh short`, I have to type the same password twice. I am now looking for a way to login using the tunnel without typing my password even once. I've tried the `ssh-keygen` procedure, but that does not help me here. I also found this quite related question: Set up password-less SSH tunneling from home computer behind NAT to inside computer behind gateway, but I can't figure out how this would apply to my situation. The question basically comes down to: how can I setup passwordless login over a ssh alias?


Start rsyslog as unprivileged user

On Debian, rsyslog runs by default as root (due to POSIX compatibility). It can drop privileges after start, but a cleaner way would be to start as a non- privileged user. Could somebody please advise, what would be a clean way to set up rsyslog to run as non-privileged user? (which user?). While googling, I found start-stop-daemon, which apparently can make daemon start as non-root. is this the way to do it, or is there a better way?


Actkbd as service with systemd

A while ago I asked for how to stop a music player while the screen is locked. The answer was to use actkbd which works like a charm. Now I wanted to add actkbd as a service to systemd in order to start it automatically when booting. So as you can see the service is started correctly and it shows up in htop as well. Some output below:               [root@hostname init.d]# systemctl start actkbd.service     [root@hostname init.d]# systemctl status actkbd.service     actkbd.service - Actkbd: Daemon for X-independent shortcuts           Loaded: loaded (/etc/systemd/system/multi-user.target.wants/actkbd.service)           Active: active (running) since Tue, 10 Apr 2012 17:50:36 +0200; 2s ago          Process: 23526 ExecStart=/usr/local/sbin/actkbd -d /dev/input/event3 -D (code=exited, status=0/SUCCESS)         Main PID: 23527 (actkbd)           CGroup: name=systemd:/system/actkbd.service                   └ 23527 /usr/local/sbin/actkbd -d /dev/input/event3 -D     [root@hostname init.d]# systemctl stop actkbd.service     [root@hostname init.d]# ps -C actkbd       PID TTY          TIME CMD      I have the following `actkbd.service` file in `/etc/systemd/system/multi- user.target.wants/`               [Unit]     Description=Actkbd: Daemon for X-independent shortcuts          [Service]     Type=forking     ExecStart=/usr/local/sbin/actkbd -d /dev/input/event3 -D     ExecReload=/bin/kill -HUP $MAINPID     ExecStop=/bin/kill -15 $MAINPID     Restart=always     User=root      So the problem is that after starting the service with systemctl nothing happens if I press my usual shortcut for pausing Rhythmbox. If I instead just execute the command `/usr/local/sbin/actkbd -d /dev/input/event3 -D` via the a root terminal everything works fine. Why that? Sorry if it's something obvious, I'm new to the systemd business but I couldn't find anything that helped me. Cheers. EDIT: This is still not working. If somebody has some time I'd appreciate it if one could try and reproduce it. If that is possible then I will file a bug report.


How to count the number of a specific character in each line?

I was wondering how to count the number of a specific character in each line by some text processing utilities? For example, to count `"` in each line of the following text               "hello!"      Thank you!      The first line has two, and the second line has 0. Another example is to count `(` in each line.


Writing command synopsis in standard man format

I am writing a script and in the `usage()` function I want to specify the usage. My script uses either option1 or option2 or both. One of them is mandatory. Is there a standard way to write it up?


Solaris swap allocation with mlocked shared memory

I'm having a hard time understanding how Solaris 10 x86 swap allocations work in the presence of `mlock`ed share memory. I wrote a small program that:   * Gets a 1G SHM segment (`shmget`)   * Attaches it to the process (`shmat`)   * Locks a part of that (`mlock`, first round locks nothing, then 512M, then the whole thing)   * Write on the last, then the first, page of the SHM region   * Writes on the whole segment progressively   * Release the lock (if any)   * Detaches and cleans up. It prints out the values of `swap -s` in MB after each action. The output is as follows:   * Round 1, no `mlock`: (values on the right are relative to the first reading)               pid:    2221    mlock size:     0     header:      alloc  resvd   used   free [+/-  alloc  resvd   used   free]       init:        325    130    456   2873 [+/-      0      0      0      0]     shmget:        326   1154   1480   1849 [+/-      1   1024   1024  -1024]      shmat:        326   1154   1480   1849 [+/-      1   1024   1024  -1024]     touchE:        326   1154   1480   1849 [+/-      1   1024   1024  -1024]     touchS:        326   1154   1480   1849 [+/-      1   1024   1024  -1024]       set1:        582    898   1480   1848 [+/-    257    768   1024  -1025]       set2:        838    642   1480   1848 [+/-    513    512   1024  -1025]       set3:       1093    386   1480   1847 [+/-    768    256   1024  -1026]       set4:       1350    130   1480   1847 [+/-   1025      0   1024  -1026]        set:       1350    130   1480   1847 [+/-   1025      0   1024  -1026]      shmdt:       1350    130   1480   1847 [+/-   1025      0   1024  -1026]     shmctl:        326    130    456   2871 [+/-      1      0      0     -2]      Here, all good. `free` column was at most ~1G smaller than it was at startup.   * Round 2, `mlock` the first 512M of the shared segment:                pid:    2221    mlock size:     536870912      header:      alloc  resvd   used   free [+/-  alloc  resvd   used   free]        init:        326    130    456   2871 [+/-      0      0      0      0]      shmget:        326   1154   1480   1847 [+/-      0   1024   1024  -1024]       shmat:        326   1154   1480   1847 [+/-      0   1024   1024  -1024]       mlock:        838    642   1480   1334 [+/-    512    512   1024  -1537] <<<<      touchE:        838    642   1480   1334 [+/-    512    512   1024  -1537]      touchS:        838    642   1480   1334 [+/-    512    512   1024  -1537]        set1:        838    642   1480   1334 [+/-    512    512   1024  -1537]        set2:        838    642   1480   1334 [+/-    512    512   1024  -1537]        set3:       1094    386   1480   1334 [+/-    768    256   1024  -1537]        set4:       1350    130   1480   1334 [+/-   1024      0   1024  -1537]         set:       1350    130   1480   1334 [+/-   1024      0   1024  -1537] <<<<     munlock:       1350    130   1480   1846 [+/-   1024      0   1024  -1025]       shmdt:       1350    130   1480   1847 [+/-   1024      0   1024  -1024]      shmctl:        326    130    456   2871 [+/-      0      0      0      0]        * Round 3, `mlock` the whole segment:                pid:    2221    mlock size:     1073741824      header:      alloc  resvd   used   free [+/-  alloc  resvd   used   free]        init:        326    130    456   2871 [+/-      0      0      0      0]      shmget:        326   1154   1480   1847 [+/-      0   1024   1024  -1024]       shmat:        326   1154   1480   1847 [+/-      0   1024   1024  -1024]       mlock:       1350    130   1480    822 [+/-   1024      0   1024  -2049] <<<<      touchE:       1350    130   1480    822 [+/-   1024      0   1024  -2049]      touchS:       1350    130   1480    822 [+/-   1024      0   1024  -2049]        set1:       1350    130   1480    822 [+/-   1024      0   1024  -2049]        set2:       1350    130   1480    822 [+/-   1024      0   1024  -2049]        set3:       1350    130   1480    822 [+/-   1024      0   1024  -2049]        set4:       1350    130   1480    822 [+/-   1024      0   1024  -2049]         set:       1350    130   1480    822 [+/-   1024      0   1024  -2049] <<<<     munlock:       1350    130   1480   1846 [+/-   1024      0   1024  -1025]       shmdt:       1350    130   1480   1847 [+/-   1024      0   1024  -1024]      shmctl:        326    130    456   2871 [+/-      0      0      0      0]      In the last two rounds, the `free` column goes down an extra 512M or 1G right after the `mlock`, but before any page is actually touched. This "double accounting" disappears after the `munlock` call. Can anyone explain this behavior? Are `mlocked` pages reserved both in real RAM and in backing store or something like that?               SunOS myhost 5.10 Generic_142910-17 i86pc i386 i86pc


Why does VLC superimpose an additional “shadow” image?

![enter image description here](http://i.stack.imgur.com/kw8d5.png) This "effect" has been regularly occuring on my Fedora 20 desktop the past few days. It seems strictly confined to VLC and does not affect any other video players I have installed. I have played with VLC settings (including resetting to the factory default settings) as well as reinstalling the entire package with no luck. The only thing that seems to fix this is a complete reboot of my system. Why does this occur and how can I fix this besides a reboot?


Private Debian repository to serve selected packages to selected machines

I have a private Debian repository setup with a few custom built packages (along with other official Debian packages). All my machines have this repository(only) configured in `/etc/apt/sources.list`. I want to know if there is a way to serve certain packages to certain machines. For example - machine1 should be able to connect to the repository but should be able to download package1 and package2 only. machine2 should not be able to upgrade package1 even if a new version is available in the repository. I know how to do the above on the client side - by running (or not running) the appropriate commands on machine1 and machine2. I want to automate this - I was planning to run a cronjob on those machines to do `apt-get update && apt- get upgrade` once every day but only the packages intended for them should be installed/upgraded. I have looked up online for weeks but couldn't find anything useful. Is this even doable?


Setting up a cronjob as a file

I want to create a cronjob at my Ubuntu server by adding/modifying a file in the `/etc/cron.d` folder, rather than using `crontab -e` as it's not too easy to automate. I've managed to make a file looking like this:               * * * * * username command >> logfile      I can tell that the file is there, I've chmoded it to `777` but it still isn't executed or appears when I do `crontab -l` as root. What am I doing wrong?


Equivalent of pvmove for BTRFS

Similar to the question I asked a while back. This one's a little easier? I can see there's volume management logic in BTRFS for removing/adding/rebalancing physical drives, but is there a tool to manually move extents/blocks off a particular physical device and onto another? Seems like it would be important for files that should be created quickly (like backup files) but can be moved to slower storage on the backend.


How to select, copy and paste some columns from different files and create one file from them?

I want to create and organize data in a file from a number of files by selecting parts of the columns of the given files. I have more than 10 file to copy the second, third and forth columns of each file and pasting them into a single file.


How to disable select-on-release right mouse button in Linux

We are having issues with mouse behavior in Linux. In Windows: In any application, to open a context menu and select an option:   1. right mouse button down + release   2. move the cursor to an option   3. left mouse button down + release In Linux, the same thing can be done in:   1. right mouse button down   2. move the cursor over to an option   3. release right mouse button. We are having problems in Eclipse, when accessed from a remote X server on Windows. The padding between the Eclipse menu items and the mouse cursor is too low (mouse cursor is inside the menu). Whenever we press the right mouse button down, mouse cursor is already moved over onto the immediate menu option, and when we release, selection event is triggered. How to disable this behavior?


wget hangs AFTER download complete, on exit_group

I am running CentOS release 6.3 (Final). This issue occurs for every VM on my server. When connected over SSH, wget hangs after download certain URLs. I am running the following command:               wget --no-http-keep-alive -O test http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz?r=http%3A%2F%2Fwww.nagios.org%2Fdownload%2Fplugins%2F      If I run `strace` on `wget` I get the following output at the end:               clock_gettime(CLOCK_MONOTONIC, {2670737, 421643851}) = 0     write(3, "\316\206\257'\323\4\241\262\322\"\326I\236\37\327\365\27295\310\t\210\"\212$\350[\214\346\177$\320"..., 745) = 745     write(2, ".", 1.)                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, " ", 1 )                        = 1     write(2, "100%", 4100%)                     = 4     write(2, "  508K", 6  508K)                   = 6     write(2, "=4.3s", 5=4.3s)                    = 5     write(2, "\n\n", 2          )                     = 2     close(5)                                = 0     time(NULL)                              = 1365435671     stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3424, ...}) = 0     time(NULL)                              = 1365435671     utime("test", [2013/04/08-12:41:11, 2012/06/27-14:39:15]) = 0     write(2, "2013-04-08 12:41:11 (478 KB/s) -"..., 692013-04-08 12:41:11 (478 KB/s) - “test” saved [2087089/2087089]          ) = 69     close(2)                                = 0     close(3)                                = 0     munmap(0xb77fb000, 4096)                = 0     exit_group(0)                           = ?      Best I can tell, the file has completely finished downloading. Sending a command interrupt kills `wget` and the file is intact. This is very inconvenient and is causing issues with automated scripts.


How to list ALL directories according to their size? [without including the parent directory]

I have a bunch of random folders, some of them are hidden (beginning with a period). I want to list all of them, sorted by their sizes. I have something on the lines of this in mind:               ls -d -1 -a */ | xargs du -s | sort      But the `ls ...` part of it doesn't show hidden files. I know some questions have been asked before on the same topic, but the answers never include a way to include hidden files. Or if it does, it uses the long format, hence making the output incompatible with the rest of the command.


What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

I think these terms almost refer to the same thing, when used loosely:   * terminal   * shell   * tty   * console What exactly does each of these terms refer to?


> **Possible Duplicate:**   >  What is the exact difference between a 'terminal', a 'shell', a 'tty' and a > 'console'? What is the difference between a terminal and a console in unix?


PseudoTerminal concept in Linux

> **Possible Duplicate:**   >  What is the exact difference between a ‘terminal’, a ‘shell’, a ‘tty’ and a > ‘console’? This question follows directly from another question of mine in this great forum. What exactly is the concept of a `Pseudo Terminal` in Linux speak? Can you please explain with an example. Is it a different concept from `Terminal emulators`?


Trying to understand how TTYs and PTYs work in CentOS 6.5?

I started to dig into the whole Linux `pty` and `tty` hell. I'm trying to understand how it works here in Linux so I was reading quite a lot of articles that covered this topic. So far I know: > TTYs are TERMINALS which are the last "secretary" to talk to kernel. PTS are > virtual terminals, that on the one end are connected to the TTY and on the > other end are connected to the terminal-emulator (the one that we can for > example open by clicking applications->system tools->terminal. or to ssh > session(?). So ssh uses another pts. That seems pretty clear to me because when I will do `w` in a shell on my system I get:               21:26:53 up 2 days, 11:35,  2 users,  load average: 0.11, 0.08, 0.08     USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT     kris     tty1     :0               Thu09    2days 52:28   0.05s pam: gdm-passwo     kris     pts/0    :0.0             21:18    0.00s  0.02s  0.01s w      The `tty1` is a terminal session, which was started when I logged into my machine, and the `pts/0` is a virtual terminal (instance of _App_ -> _System Tools_ -> _Terminal_ ). However, what is the `pty` then? If I will connect to my server through `ssh` then another `pts` will be spawned, but when will another `tty` be spawned, and whats the point of `pty`, from the `man pty` it seems to me like it is this:   1. Emulated terminal (gui terminal) talks to `pts`   2. This `pts` in turn talks to `pty` , which talks to `tty` That doesn't make sense. Please try to explain it using examples because it is very easy to fall off with all the differences between consoles, terminals, virtual terminals, emulated terminals, `pts`, `pty`, `tty`.


Difference between pts and tty

> **Possible Duplicate:**   >  What is the exact difference between a 'terminal', a 'shell', a 'tty' and a > 'console'? I always see pts and tty when I use the `who` command but I never understand how they are different? Can somebody please explain me this?


Recover files from corrupt DVD

I have a DVD+RW containing a lot of images and videos. Multiple DVD drives fail to read or mount it. I tried to follow this to try and recover the files using DVDisaster, and have created an iso file. But after that, I am lost. The instructions apply to a video DVD, not a data one, so the "split" command doesn't make sense. The iso file created by DVDisaster can't be mounted either in linux (with the "mount" command) or Windows (I understand it creates something like a "raw" image, though I'm not sure of the technicalities). Any idea what to do now? The error I get with mount is: > mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing > codepage or helper program, or other error In some cases useful info is > found in syslog - try dmesg | tail or so


Do special characters in paths pose a problem when mounting network shares?

I am trying to create a permanant access point to a windows share from a CentOS 5.5 machine. I edited the `/etc/fstab` file to have the following entry:               //travellot/ArcGIS Setup's/9.3.1 Entire/ArcGIS_Server_ent_Unix /home/thomasm/shares/agslinux cifs username=thomasm,dom=cssl,password=*******     0 0      I have blocked out the password only for this Q and the parameters are separated by tabs. Anyway, this doesn't seem to work. The agslinux directory on the CentOS machine does not list the files in the windows share. I think it may be the underscores, apostrophes, spaces or periods that are causing the problem. Can someone confirm if this is the issue? If it is, is there any way to workaround this? Perhaps by encasing the windows share with double quotes or by using escaped characters?


RAMFS seems slower than expected — what is the bottleneck?

RAMFS doesn't uses swap (TMPFS does). So I mount the FS               cd /mnt/; mkdir SOMETHING; mount -t ramfs -o size=1500m ramfs /mnt/SOMETHING; cd /mnt/SOMETHING      I generate a testfile:               dd if=/dev/zero of=testfile_500MB bs=524288000 count=1      I cp the test file (from memory to memory)               time cp testfile_500MB testfile_500MB_cptestfile          real    0m0.599s     user    0m0.008s     sys     0m0.592s      I have one DDR2-1066 module in my PC. What is the bottleneck? According to this wikipedia article: http://en.wikipedia.org/wiki/List_of_device_bandwidths it would need to do more then 10 GByte/sec! It's waay not more 10 GByte/sec 500 MByte in 0.599 sec = 835 MByte/sec. It's slow. Is the CPU the bottleneck? OR what? :O (E7300 @ 2.66GHz) UPDATE: is measuring a "cp" with "time" a good thing?


Why isn't the -rt (RT-Preempt) kernel patch included by default in the mainline kernel?

According to https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO , the RT- Preempt patch converts Linux into a fully preemptible kernel. The magic is done by:   1. Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes.   2. Critical sections protected by i.e. spinlock_t and rwlock_t are now preemptible. The creation of non-preemptible sections (in kernel) is still possible with raw_spinlock_t (same APIs like spinlock_t)   3. Implementing priority inheritance for in-kernel mutexes, spinlocks and rw_semaphores.   4. Converting interrupt handlers into preemptible kernel threads: The RT-Preempt patch treats soft interrupt handlers in kernel thread context, which is represented by a task_struct like a common userspace process. However it is also possible to register an IRQ in kernel context.   5. Converting the old Linux timer API into separate infrastructures for high resolution kernel timers plus one for timeouts, leading to userspace POSIX timers with high resolution.  Are there any drawbacks of being real-time instead of just multi-tasking?


What is the difference between '.' and 'source' in shells?

> **Possible Duplicate:**   >  running script with “. ” and with “source ” I have used both the dot command '.' and 'source' to reload a given rc file (typically to update my environment variables) but I am not sure if they are different and if one is preferred. What is the difference between the two ?


Compiling Netcat with DFLAGS

I've been trying to compile netcat so that I can use the `-e` option but I am not sure as to how or where to place the custom flags. So far I've done:               ./configure     Make      and then I edit the Makefile with:               DFLAGS = -DGAPING_SECURITY_HOLE -DTELNET      and then do `make install`. Is that the correct way to do this?


Configure third button of a 3M Ergonomic Mouse

I've just bought a 3M Ergonomic Mouse, model EM500GPL, and for pointer movement and left/right click it works fine. But I'd like to know if it's possible to configure the third button to behave the way the makers intended. Holding the third button down and then moving the mouse up should cause a scroll-up action in the target window; holding the third button down and then moving the mouse down should cause a scroll-down action. I'm using OpenSUSE 12.3 with KDE 4.10.5. I suspect the desired behaviour is not something that can be achieved easily, but I'd be very happy to be proved wrong.


How are "xterm" and "screen" related?

I am not quite sure if there is any subtle or wide differences between screen and xterm. I have used screen before and had it being described as kind of like a multiplexer and have tried xterm a few times. Can anyone explain the differences between the two as well as the pros and cons to them both?


PHP on centos 6 not working

I have installed PHP, MySQL, Apache on CentOS 6, now I have restarted the Apache and mysql, to test PHP i have created a `index.php` on `/var/www/html/test/` now once i go to `localhost/test/index.php` then it shows only PHP soruce code like this: ![enter image description here](http://i.stack.imgur.com/0VO5F.jpg)    From Gnouc comment, i understand that it is due to SELinux security layer.   To work with HTML directory i did this in my terminal, but still i have the same result:               [root@localhost www]# chcon -v --type=httpd_sys_content_t html     changing security context of `html`         Any idea? Thanks


How to make a system lock when the USB pendrive with authentication key is removed?

Say, I have USB drive authentication up and working. So far, so hoopy. But now I want to take the next step, which is locking the machine when I eject the medium. I know there is udev I can script, but it would be really silly if there's a solution out there which I fail to type the right keywords to find. So the objective is: lock the screen when the key medium is taken out. Optionally, offer to switch user. In case anyone cares, I use Debian Sid with WindowMaker, adding gnome- settings-daemon to the mix. I have GNOME programs and use them, just not using the DE itself. I hope there is DE/WM-agnostic solution. „There is no ready-made solution” counts as a valid answer, too.


How to recreate EFI boot partition?

I've installed Fedora on my machine with `/` partition, `swap` partition and `ESP` partition for EFI booting. Now, I was installing Elementary OS instead of Fedora.   1. I have formatted the `/` partition (/dev/sda3)   2. Formatted the swap partition (/dev/sda4)   3. But **did not** format the EFI boot partition (/dev/sda1) Now when i boot, i get my old grub menu that's was installed by Fedora. I can only boot into Elementary OS by:   1. Entering the boot menu.   2. Selecting boot from EFI file   3. Navigate through `/dev/sda1/`, to get the `elementary` directory that contains `grubx64.efi` file. Which is `/boot/efi/EFI/elementary/grubx64.efi`. How can i fix that ? I thought of formatting the boot partition `/dev/sda1/` with `fat16` or something then re-installing grub on it. My `/dev/sda1` now contains this :               root@rafael:/home/rafael# ls /boot/efi/     EFI  mach_kernel  System          root@rafael:/home/rafael# ls /boot/efi/EFI/     BOOT/       elementary/ fedora/               root@rafael:/home/rafael# ls /boot/efi/EFI/fedora/     BOOT.CSV  fonts  gcdx64.efi  grub.cfg  grubx64.efi  MokManager.efi  shim.efi  shim-fedora.efi          root@rafael:/home/rafael# ls /boot/efi/EFI/elementary/     grubx64.efi      Here's my `efibootmgr` output :               BootCurrent: 003D     Timeout: 0 seconds     BootOrder: 2001,2002,2003     Boot0000* Notebook Hard Drive     Boot0010* Internal CD/DVD ROM Drive     Boot0011* Internal CD/DVD ROM Drive (UEFI)     Boot0012* Fedora     Boot0013* Fedora     Boot0014* Fedora     Boot0015* Fedora     Boot0016* Fedora     Boot0017* Fedora     Boot0018* Fedora     Boot0019* Fedora     Boot001A* Fedora     Boot001B* Fedora     Boot001C* Fedora     Boot001D* Fedora     Boot001E* Fedora     Boot001F* elementary     Boot2001* USB Drive (UEFI)     Boot2002* Internal CD/DVD ROM Drive (UEFI)      Any help would be appreciated.


Is it bad to select remember me option in the browsers of a compromised machine?

I was reading an article on how to sniff network packets. (of course for knowledge purposes only). I came across these particular lines. > For instance, say I was sniffing traffic on the network, and you logged in > to Facebook and left the Remember Me On This Computer check box checked. > That signals Facebook to send you a session cookie that your browser stores. > I potentially could collect that cookie through packet sniffing, add it to > my browser and then have access to your Facebook account. So, assuming my Linux client is compromised and am unaware of it currently, does that mean if I have clicked on `remember me` on this machine to login to my accounts, my personal details are compromised? How can the compromised machine's cookie information can be used in any hacker's browser?


$ORIGIN directive in IPv6 zone files

I have often seen similar BIND zone files:               $ORIGIN 2.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.     $TTL 604800     @   IN  SOA ns1.example.org. hostmaster.example.org. (             1978022513  ; Serial             10800       ; Refresh             3600        ; Retry             2419200     ; Expire             604800 )    ; Default TTL                  NS   ns1.example.org.             NS   ns2.example.org.             TXT  "2001:db8:302::/48 Example IPv6 reverse"               $ORIGIN 0.0.0.0.2.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.     1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 PTR host.example.net.      Why is there additional $ORIGIN directive? I mean this "$ORIGIN 0.0.0.0.2.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa." one. Why isn't it simply:               $ORIGIN 2.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.     $TTL 604800     @   IN  SOA ns1.example.org. hostmaster.example.org. (             1978022513  ; Serial             10800       ; Refresh             3600        ; Retry             2419200     ; Expire             604800 )    ; Default TTL                  NS   ns1.example.org.             NS   ns2.example.org.             TXT  "2001:db8:302::/48 Example IPv6 reverse"          1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 PTR host.example.net.


Root not affected by file permissions?

Why does this work as root?               # touch test1     # chmod 000 ./test1     # echo "test" > ./test1      I take it root is not affected by file permissions?


Unity: Stop Dock Repopulation at Restart

Unity is currently the default window manager on my system, a window manager that's available for many Linux distributions, meaning this question isn't Ubuntu-specific. I have disabled the dock's autohide using `debconf`, but apart from that I haven't altered any of the default settings. My usage pattern is centred around the Windows key; whenever I wish to start something, whether it be Firefox, GVim, or a terminal window, I just hit the windows key, start typing the name, and hit enter when Unity guesses what it is I want. This use means I have no need to keep anything in the launcher. Given that I only start applications using the keyboard, I only need the dock to show me currently running applications. Naturally, my response was to simply remove everything I could from the dock, meaning all that remains is running applications. It doesn't work though. If I remove all 'pinned' applications from the dock, the system repopulates it to the defaults on restart of Unity. I assume that Unity thinks everything being removed is either a user error or a clobbered configuration file somewhere, and as such 'repairs' it by restoring the pinned applications. How can I suppress this setting so I can have an empty dock?


MySQL Workbench Cannot start SSH tunnel manager

I don't know why this error is happening when I try to connect by MySQL Workbench. > Cannot start SSH tunnel manager. I'm using slackware 14.1 and installed all dependencies.    ![enter image description here](http://i.stack.imgur.com/7rhtr.png)