Why does root get Permission denied when accessing FUSE directory?

I use a FUSE filesystem with no problems as my own user, but root can't access my FUSE mounts. Instead, any command gives `Permission denied`. How can I give root the permission to read these mounts?               ~/top$ sudo ls -l     total 12     drwxr-xr-x 2 yonran yonran 4096 2011-07-25 18:50 bar     drwxr-xr-x 2 yonran yonran 4096 2011-07-25 18:50 foo     drwxr-xr-x 2 yonran yonran 4096 2011-07-25 18:50 normal-directory     ~/top$ fuse-zip foo.zip foo     ~/top$ unionfs-fuse ~/Pictures bar      My user, **yonran** , can read it fine:               ~/top$ ls -l     total 8     drwxr-xr-x 1 yonran yonran 4096 2011-07-25 18:12 bar     drwxr-xr-x 2 yonran yonran    0 2011-07-25 18:51 foo     drwxr-xr-x 2 yonran yonran 4096 2011-07-25 18:50 normal-directory     ~/top$ ls bar/     Photos      But **root** can't read either FUSE directory:               ~/top$ sudo ls -l     ls: cannot access foo: Permission denied     ls: cannot access bar: Permission denied     total 4     d????????? ? ?      ?         ?                ? bar     d????????? ? ?      ?         ?                ? foo     drwxr-xr-x 2 yonran yonran 4096 2011-07-25 18:50 normal-directory     ~/top$ sudo ls bar/     ls: cannot access bar/: Permission denied      I'm running Ubuntu 10.04: I always install any update from Canonical.               $ uname -a     Linux mochi 2.6.32-33-generic #70-Ubuntu SMP Thu Jul 7 21:13:52 UTC 2011 x86_64 GNU/Linux     $ lsb_release -a     No LSB modules are available.     Distributor ID: Ubuntu     Description:    Ubuntu 10.04.3 LTS     Release:    10.04     Codename:   lucid      **Edit** : removed the implication that root used to be able to access the mounts. Come to think of it, maybe my scripts never tried to access the directory as root.


What filesystem should I choose for an SSD?

I am going to set up a new Linux system on an SSD drive. Does the filesystem choice make a difference for them? Should I go with the default _ext4_ , maybe try _XFS_ , or does it just not matter?


Open Source router firmware options?

What distro's exist that are designed for routers? Please include the following   * link to the project page   * link to supported hardware list   * what distinguishes them, why pick this option   * friendly web interface?   * above friendly interface easily disabled?   * package management for software not initially installed? (e.g. ipkg/opkg)   * good documentation?


Does PGPDesktop supports OpenBSD or e.g. Fedora?

Does PGPDesktop support OpenBSD or e.g. Fedora, or can I only encrypt my whole hard drive when I use Windows?


Why is Debian's root shell colorless?

Are there any security concerns? What is the best way to enable it?


How to determine if disk is compact flash or standard hard drive

I need to determine in a shell script if a given block device (e.g. `/dev/sda`) is a compact flash disk or a regular hard drive. Google did not help me out for once, and while `udevadm info --query=all --name=sda` gives me lots of information, theres nothing I recognize to mean "I'm definately (not) a flash drive" or "I'm definately (not) a hard drive". Is it possible to distinguish these two types of storage devices? I use Ubuntu 10.10.


Tune write disk cache flushing algorithm

I would like to use the free memory for write cache. Linux does that automatically, but it has some weird flushing algorithm that I would like tuned for my use. I have recently used `ddrescue` to copy a disk. It reads a block and writes the block to disk. What I would like is to have the reading read as much as possible until there is no more free then block until some space is freed, while at the same time the writing writes as fast as possible freeing up memory. So if the writing disk is faster than the reading disk no memory will be used, and if the writing disk is slower than the reading disk then all the memory will stay used until the copying is complete. In both scenarios the memory usage remains constant (unless other programs take some of the free memory). But what I see is this: ![Write cache](http://i.stack.imgur.com/H2J8C.png) The reading fills up the cache (while little to no writing is done) and when the cache hits a limit (or after er period of time) then the reading is blocked while _all_ the cache is written to disk. It is almost as if a troll is running 'sync' every now and then. I have tried changing the /proc/sys/vm/dirty_* to no avail: The only change I have been able to provoke is how tall the tops are. So an answer that mentions /proc/sys/vm/dirty_* will have to provide tested values that measurably flattens out the saw tooth graph. A tuning that will tell Linux to start writing ASAP but never block reading or writing if there is free space, will most likely suit my purpose. I am aware of tools like `mbuffer`. They will flatten out the graph, but they are not dynamic (i.e. releasing memory when the free mem is low) and they do not allow for seeks, so they will not work with programs like `ddrescue` (which has to seek back and forth).


Debian pinning - Use stable but install from testing/unstable when necessary | Also install deps from stable, backports when available

I am configuring a Debian 6 (Squeeze) x86 server, and want to install some packages from testing or unstable when needed, so I'm using pinning. I have configured my /etc/apt/sources.list as follow:               deb http://ftp.br.debian.org/debian stable main     deb http://ftp.br.debian.org/debian stable-updates main     deb http://security.debian.org/ stable/updates main          deb http://backports.debian.org/debian-backports squeeze-backports main          deb http://ftp.br.debian.org/debian testing main     deb http://ftp.br.debian.org/debian testing-updates main     deb http://security.debian.org/ testing/updates main          deb http://ftp.br.debian.org/debian unstable main      And my /etc/apt/preferences as follow:               Package: *     Pin: release a=stable     Pin-Priority: 700          Package: *     Pin: release a=stable-updates     Pin-Priority: 700               Package: *     Pin: release a=squeeze-backports     Pin-Priority: 675               Package: *     Pin: release a=testing     Pin-Priority: 650          Package: *     Pin: release a=testing-updates     Pin-Priority: 650               Package: *     Pin: release a=unstable     Pin-Priority: 600      Executing apt-cache policy, I get:               100 /var/lib/dpkg/status        release a=now     600 http://ftp.br.debian.org/debian/ unstable/main i386 Packages        release o=Debian,a=unstable,n=sid,l=Debian,c=main        origin ftp.br.debian.org     650 http://security.debian.org/ testing/updates/main i386 Packages        release o=Debian,a=testing,n=wheezy,l=Debian-Security,c=main        origin security.debian.org     650 http://ftp.br.debian.org/debian/ testing-updates/main i386 Packages        release o=Debian,a=testing-updates,n=wheezy-updates,l=Debian,c=main        origin ftp.br.debian.org     650 http://ftp.br.debian.org/debian/ testing/main i386 Packages        release o=Debian,a=testing,n=wheezy,l=Debian,c=main        origin ftp.br.debian.org     675 http://backports.debian.org/debian-backports/ squeeze-backports/main i386 Packages        release o=Debian Backports,a=squeeze-backports,n=squeeze-backports,l=Debian Backports,c=main        origin backports.debian.org     700 http://security.debian.org/ stable/updates/main i386 Packages        release v=6.0,o=Debian,a=stable,n=squeeze,l=Debian-Security,c=main        origin security.debian.org     700 http://ftp.br.debian.org/debian/ stable-updates/main i386 Packages        release o=Debian,a=stable-updates,n=squeeze-updates,l=Debian,c=main        origin ftp.br.debian.org     700 http://ftp.br.debian.org/debian/ stable/main i386 Packages        release v=6.0.6,o=Debian,a=stable,n=squeeze,l=Debian,c=main        origin ftp.br.debian.org      * * * The problem I'm facing is that when I try to install some packages from testing. Ex:               apt-get install ruby1.9.1-dev/testing      I get a broken package message:               The following packages have broken dependencies:      ruby1.9.1-dev : Depends: libruby1.9.1 (= 1.9.3.194-5) but 1.9.2.0-2 is set to be installed     E: Broken Packages      This means I want to install from testing but Debian tries to install dependencies from stable. I know I can do:               apt-get install -t testing ruby1.9.1-dev      It works by installing all dependencies from testing, but I want to use the maximum possible the stable packages (install deps from stable if available). * * * Another problem I'm having is, if I install a package like this:               apt-get install -t testing ruby1.9.1-dev      And then try to install another package that depends on a library that was installed as a dependency of ruby1.9.1-dev from testing:               apt-get install gcc      I also get the Broken Packages error. * * * So the questions are: **How can I install a package from testing, but also install the maximum of dependencies possible from stable?** **Is it possible to automatically install a package from testing when it is not available in stable by just running**               apt-get install package_name      **?**


Replace all white spaces with commas in a text file

I need to replace all white spaces inside my text with commas. I'm currently using this line but it doesn't work: I get as output a text file which is exactly the same of the original one:               sed 's/[:blank:]+/,/g' orig.txt > modified.txt      thanks


Automatizing the sequence of mounting commands

When I connect a device (tablet, camera, flash drive, external harddrive) to my laptop with Linux I often type the following sequence of commands.      `$ ls /dev/sd*`   Let's say that my device is /dev/sdc   optional `$ sudo mkdir /media/my_flash`   optional `$ sudo chmod 777 /media/my_flash`   `$ sudo mount /dev/sdc /media/my_flash` Then I will copy some files and   $ `sudo umount /dev/sdc` This sequence guarantees me that the files are copied and nothing bad will happen. Could you tell me how to automatize this sequence of commands? So I will only plug the device, it will recognize to which directory it should be mounted, then I will make some file transfer and then it will signal me (in some way) I can unplug the device? Is there some settings in Linux OS for this? thank you


Replace symbolic link which linked to directory target

I want to upgrade tomcat server from 7.0.19 to 7.0.20. I've already `ln -s apache-tomcat-7.0.19 tomcat7` before, so now I need to _link_ `tomcat7` to new target using the following command `ln -s --force apache-tomcat-7.0.21 tomcat7`, but it does not worked as what I expected: it created a symbolic link `tomcat7/apache-tomcat-7.0.21` instead of replace existing `tomcat7` symbolic link with new target. **Example**               # mkdir v1 v2     # ln -s v1 v     # ln -s v2 v     # ll v*     lrwxrwxrwx. 1 root root    2 Sep  5 16:02 v -> v1          v1:     total 0     lrwxrwxrwx. 1 root root 2 Sep  5 16:02 v2 -> v2          v2:     total 0      I checked the manual of `ln`, I think `ln -s --force apache-tomcat-7.0.21 tomcat7` use the 3rd form instead of 1st form to explain the parameters. That's so ambiguous between the 1st and 3rd form. So how to replace symbolic link in this case?


How to configure character encoding in OpenFT?

When transferring files over: http://ts.fujitsu.com/products/software/openseas/openft.html then the charset of files get's scrumbled...I can't seem to find any character encoding settings, how to set it to use ONLY UTF-8?


Creating UFW rule to allow application to use dynamic ports

I am currently trying to get a Google Chromecast device to work through my Ubuntu 13.04 based computer. Currently, the Google Chrome extension shows "no devices found" as long as my UFW firewall is enabled. If I disable the firewall I am able to see my Chromecast device without any issues. I notice that everytime I click on the Chromecast browser extension a new port is opened up by the Chrome application. It is a different port every time. Is there a way to set a rule in UFW that would always allow the chrome application to access any port it wants? Is there a name for this type of behavior? The port that chrome is using changes everytime I try to find the Chromecast device. I imagine I won't be the only person having this issue. ![Screenshot of Chrome trying to find Chromecast devices](http://i.stack.imgur.com/jC8aX.png)


How can I create a new user but with a home directory that already exists?

Let's say I have a user called **panos** and he has his home directory located at `/home/panos`. Then, I create a another user called **Tom** :               adduser Tom      It creates a user **Tom** who has home dir: `/home/Tom` The question is: what if I would like to create a new user and give him as home dir the home dir of another user. For example, let's create the user **Jerry** and pass him as his home dir the home dir of user **Panos** :               adduser -d /home/panos Jerry      but there's an error saying:               adduser: warning: the home directory already exists.     Not copying any file from skel directory into it.      However, if you take a look at the `/etc/passwd` file:               tail -n 3 /etc/passwd     anthony:x:501:501::/home/anthony:/bin/bash     panos:x:502:502::/home/panos:/bin/bash     Jerry:x:503:503::/home/panos:/bin/bash      it seems it worked. But when I tried to log in as Jerry:               [root@LinuxAcademy ~]# su Jerry     bash-4.1$ bash: /home/panos/.bashrc: Permission denied     bash-4.1$       it prevents me from loggin in as Jerry and it also changes my prompt (the _PS1_ ). So, how can I do this? Is it possible?


File command database and identifying text files

Please let me know if below two statements are correct or not: Folder `/usr/share/mime/magic` has a database/table that will give me what are the current possible file formats (outputs that I can get when I type the `file` command and follow it by a file name). Whenever the `file` command output contains the word "text" it refers to something that you can read with a text viewer, and anything without "text" is some kind of binary.


Saving with CTRL-s in vim

I have added this line in .vimrc so that pressing control-s saves the current file               :nmap <C-s> :w!<cr>     :imap <C-s> <esc>:w!<cr>      But this is not working. Any suggestions about what I am doing wrong?


Why is mount.cifs not installed suid by default?

I am using Gentoo, and on my machine at least `mount.cifs` is not installed suid root by default. In particular, this means that I can't use the `user` mount option with CIFS shares. I noticed that `mount.nfs` has suid set. Is there some reason in particular that this is done for CIFS/samba, or is it just Gentoo being overly cautious? If it matters, I am using `net-fs/samba` and not `net-fs/mount-cifs`. **More Information:** It seems that historically it was very insecure, however as far back as 2010 the Samba team themselves were happy to reallow suid root access, so is this still an issue? I've tried adding suid to `mount.cifs`, and it works but I want to get some more information about this if someone is in the know.


Automatic security updates on Debian squeeze server

For a production Debian squeeze server, what are the best practices or recommendations for handling security updates? I have seen various articles on cron-apt, apticron, unattended-updates, apt cron jobs, etc. that download and/or install security updates as they are released. It seems like there are two philosophies on this:   1. Download all security updates and notify with an email, and then have an admin come in and manually apply the updates.   2. Download and install all security updates as they are released, sending an email notification letting the admin know what packages were upgraded. For these two cases, what is the recommended way to configure automatic security upgrades on a Debian server?


how to redirect output to multiple log files

How to redirect standard output to multiple log files Following seems to be not working. Any help is appreciated. `some_command 1> output_log_1 output_log_2 2>&1`


How can one run multiple programs in the background with single command? I have tried the commands below, but they do not work.               nohup ./script1.sh & && nohup ./script2.sh &     -bash: syntax error near unexpected token '&&'          nohup ./script1.sh & ; nohup ./script2.sh &     -bash: syntax error near unexpected token ';'


Rsnapshot via SSH speed issue

I am trying to backup bunch of desktops running RedHat 6.4 (i86_64) LVM on the top of ext4 to our file server running RedHat using rsnapshot and ssh. I am on 1GbE. I am finding the speed of the first back up abysmal. It takes me about 1 hour to push 1Gb of data. This is my rsnapshot.conf file. What am I doing wrong? Could people suggest some alternatives to rsnapshot.               config_version  1.2          snapshot_root   /mnt/backup/desktops/test/          cmd_cp          /bin/cp     cmd_rm          /bin/rm     cmd_rsync       /usr/bin/rsync      cmd_ssh /usr/bin/ssh     cmd_logger      /usr/bin/logger     cmd_du          /usr/bin/du     #cmd_preexec    /path/to/preexec/script     #cmd_postexec   /path/to/postexec/script          linux_lvm_cmd_lvcreate  /sbin/lvcreate     linux_lvm_cmd_lvremove  /sbin/lvremove     linux_lvm_cmd_mount     /bin/mount     linux_lvm_cmd_umount    /bin/umount               linux_lvm_snapshotsize  2G     linux_lvm_snapshotname  rsnapshot     linux_lvm_vgpath        /dev     linux_lvm_mountpath     /mnt/lvm-snapshot               retain  hourly  6               #              GLOBAL OPTIONS              #     verbose         2     loglevel        3     logfile /var/log/rsnapshot     lockfile        /var/run/rsnapshot.pid          # Default rsync args. All rsync commands have at least these options set.     rsync_short_args        -az     rsync_long_args --delete --numeric-ids --relative --delete-excluded --rsync-path     ="sudo /usr/bin/rsync"          # ssh has no args passed by default, but you can specify some here.     ssh_args        -p 22 -i /root/.ssh/backup_key_dsa               exclude '*.core'          backup--backup@land.lab.edu:/home/me/     land/  +rsync_long_args=--bwlimit=16


searching for sysvinit in a linux tree

This is the tree for petalinux. https://github.com/Xilinx/linux-xlnx/tree/xlnx_3.8 I am looking for sysvinit package,which contains things like init ,halt etc. When this source code is compiled we get corresponding binaries in /sbin/. I found after compiling binary files like init.sysvinit,halt.sysvinit etc. I can download the source code separately from here But the same package must be there in petlainux source also. How do I search these source code in petalinux tree above?


Run script without ./ before the name

I am running a quite complicated script which changes directories and runs many other commands. All these commands are run using 'scriptname', which works fine when I execute the main script from my terminal. However, sometimes I have to ssh into a server and run the main script from there, it fails as there isn't a ./ before each command. I'd rather not go through all the scripts and executables and add a ./ to the commands, so is there another way to solve this problem?


How can I automate the process of copying files from one folder to another in Centos

I have a statistical application which runs every minute and creates charts accordingly. In order to make these charts available to other users, I need to copy the whole folder containing the charts and paste it to a shared folder where other users can see the contents. How can I automate this process so that e.g each 5 minutes the files and folders are updated?


How to make gdb not ask me "y or n"?

When I use GDB command `add-symbol-file` to load the symbol, GDB always asks me 'y or n', like this:               gdb> add-symbol-file mydrv.ko 0xa0070000     add symbol table from file "mydrv.ko" at             .text_addr = 0xa0070000     (y or n)      How to make it not ask and execute quietly?


Command re-assigned

I found a Bash script snippet earlier with which to echo a string to stderr:               echoerr() { echo "$@" 1>&2; }     echoerr hello world      This remained in my clipboard, and when I wanted to edit a file (with VIM) I accidentally pasted this snippet again instead of the file name:               vim echoerr() { echo "$@" 1>&2; }     echoerr hello world      It seems to have re-assigned `echoerr` to `vim`:               $ where vim     vim () {         echo "$@" 1>&2;     }     /usr/bin/vim      Also, attempting to open a file with VIM now just echos the file name back:               vim path/to/some-file      Prints:               path/to/some-file      **What happened?** (I'm running zsh inside tmux)


Possible to see dead proccesses?

In `man ps`, it clearly states the different states a process can have on Linux.               D    Uninterruptible sleep (usually IO)     R    Running or runnable (on run queue)     S    Interruptible sleep (waiting for an event to complete)     T    Stopped, either by a job control signal or because it is being traced.     W    paging (not valid since the 2.6.xx kernel)     X    dead (should never be seen)     Z    Defunct ("zombie") process, terminated but not reaped by its parent.      Even tho `X` is a process state, it should never be seen. But is that correct? Is there a theoretical way to see that as a state on a process? Or is it completely 100% impossible?


MySQL 5.1.73 in Oracle LINUX : Which is the correct mysql configuration file?

I have installed **MySQL 5.1.73** manually by RPM on **Oracle LINUX 5**. When I searched configuration file - **my.cnf** I run below command and get list of multiple configuration files. $ locate *.cnf               /etc/pki/tls/openssl.cnf     /u000/local/openssl/openssl.cnf     /u000/local/openssl/opensslnew.cnf     /usr/openv/pdde/pdopensource/ssl/openssl.cnf     /usr/share/doc/MySQL-server-community-5.1.73/my-huge.cnf     /usr/share/doc/MySQL-server-community-5.1.73/my-innodb-heavy-4G.cnf     /usr/share/doc/MySQL-server-community-5.1.73/my-large.cnf     /usr/share/doc/MySQL-server-community-5.1.73/my-medium.cnf     /usr/share/doc/MySQL-server-community-5.1.73/my-small.cnf     /usr/share/mysql/my-huge.cnf     /usr/share/mysql/my-innodb-heavy-4G.cnf     /usr/share/mysql/my-large.cnf     /usr/share/mysql/my-medium.cnf     /usr/share/mysql/my-small.cnf     /usr/share/mysql-test/include/default_my.cnf     /usr/share/mysql-test/include/default_mysqld.cnf     /usr/share/mysql-test/include/default_ndbd.cnf     /usr/share/mysql-test/std_data/bug15328.cnf     /usr/share/mysql-test/std_data/ndb_config_mycnf1.cnf     /usr/share/mysql-test/std_data/ndb_config_mycnf2.cnf     /usr/share/mysql-test/suite/federated/my.cnf     /usr/share/mysql-test/suite/ndb/my.cnf     /usr/share/mysql-test/suite/rpl/my.cnf     /usr/share/mysql-test/suite/rpl/rpl_1slave_base.cnf     /usr/share/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf     /usr/share/mysql-test/suite/rpl/t/rpl_current_user.cnf     /usr/share/mysql-test/suite/rpl/t/rpl_rotate_logs.cnf     /usr/share/mysql-test/suite/rpl/t/rpl_test_framework.cnf     /usr/share/mysql-test/suite/rpl_ndb/my.cnf     /usr/share/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf      I am not sure which one is the correct configuration file which I have to modify? My application has 260 tables.   * So, should I also need to modify `my-large.cnf or my-medium.cnf or my-small.cnf`?    * Should I need to move the selected configuration file in /etc/ directory? Please advice...


Remap input keys in /dev/input level

I want to remap input keys from keyboard and mouse, but I need it to be in low level, so that reading `/dev/input*` shows remapped functions. Example: I have regular keyboard and I want `ENTER` key to emit `left mouse` button click. Is that possible and how?


Xargs and rm with a *

I am trying to execute the following command               ls -d a* | xargs -i sudo rm -rf {}/*      The problem is that when I add the `/*` part the command does not work. I want to remove the directory contents (not the directory itself).


what is the best way to convert CRLF to LF and the viceversa for C++ files in my project

> **Possible Duplicate:**   >  How to bulk convert all the file in a file system branch between Unix and > Windows line break format? which is the best tool to convert the CRLF to LF for my project in C++,one of the guideline is to do so before review.


Making shortcuts cross desktop environment, possible?

I'm a big fan of keyboards, so a lot of thing a done by combination of keys, like open a file browser, web browser etc. Is there some daemon that can monitor my key presses, and launch some program afterwards, so that I won't have to configure anything else after moving to another desktop environment?


How do I stop charging the battery way prior to 100% in OpenBSD?

I'm thinking about using a netbook as an OpenBSD server. I'd like it to have UPS -- so the integrated battery is quite useful. However, I'm very familiar with the batteries going dead very quickly if stored at 100% charge, plus topped up back to 100% all the time is guaranteed to make it only worse. I'd like to avoid this, to ensure the battery could easily cover one to two hours of power loss for years to come -- which means that charging should only start when below 40% to 50%, and stop at about 60% to 80% (else, it'll probably already only hold at most 60% of charge after a year, and be entirely useless some short time after that). There's a similar question, which has also been cross-posted, and it appears to suggest that ThinkPads and Dell laptops have some proprietary features to this effect; but what about cheapo Acer netbooks?


How can i change the format of text using sed?

cat > inputfile          X1 a1,b1,c1,d1.................. dn     X2 a2,b2,c2,d2.................. and so on upto n     ................................................     ................................................     Xn an,bn,cn,dn....................and so on upto n      output format:               X1 a1 +        b1 +        c1 +        .        .        .        .          X2 a2 +        b2 +        c2 +        .        .        .               and so on      I am trying something like                sed ':b;s/,/\     /;tb;s/\     / +/g'      NOTE : I need to add a tab before `b1 +,c1 +....` ,`b2 +,c2 +,...` etc


sshfs and Emacs: file changed on the disk

I am using Mac 10.6.8 SSHFS version 2.4 fuse4x library version: FUSE 2.8.7 / fuse4x 0.9.2 I connect via sshfs to a remote cluster (via a bridge). I modify the remote files with emacs. The problem is that emacs very often tells me that a file that I modifying has changed on the disk. I have used sshfs successfully and without error on other client, but with the same cluster. I can't understand the origin of this behavior, could it be that the internet connection is not very stable? This problem is very serious because I have experienced data loss in more of one occasion. Is there something I can do, maybe changing come option of ssh? currently I have the following configuration:               Host            remote     HostName        localhost     Port            2222     HostKeyAlias    remote.address     User            username               Host            bridge     HostName        bridge.address     HostKeyAlias    bridge     User            username     TCPKeepAlive    no     LocalForward    localhost:2222 remote:22


SSH tunneling: connect_to localhost port 22: failed

I want to connect from my computer to a remote computer using a middle server(u port forwarding). I run this command on remote computer:               ssh -R 9300:localhost:22 user@middleserver      and this one on my system:               ssh remoteuser@middelserver -p 9300      But I get this error on my system:               ssh_exchange_identification: Connection closed by remote host      this is the log of remote computer:               debug1: client_request_forwarded_tcpip: listen localhost port 9309, originator xxx.xxx.xx.xx port 21470     debug2: fd 7 setting O_NONBLOCK     debug1: connect_next: host localhost ([::1]:22) in progress, fd=7     debug2: fd 7 setting TCP_NODELAY     debug3: fd 7 is O_NONBLOCK     debug3: fd 7 is O_NONBLOCK     debug1: channel 1: new [xx.xx.xx.xx]     debug1: confirm forwarded-tcpip     debug3: channel 1: waiting for connection     debug1: channel 1: connection failed: Connection refused     debug2: fd 8 setting O_NONBLOCK     debug1: connect_next: host localhost ([127.0.0.1]:22) in progress, fd=8     debug2: fd 8 setting TCP_NODELAY     debug3: channel 1: waiting for connection     debug1: channel 1: connection failed: Connection refused     connect_to localhost port 22: failed.     debug2: channel 1: zombie     debug2: channel 1: garbage collecting     debug1: channel 1: free: xxx.xxx.xxx.xxx, nchannels 2     debug3: channel 1: status: The following connections are open:       #0 client-session (t4 r2 i0/0 o0/0 fd 4/5 cc -1)      What's the problem?


du reports size for a directory 4 KBs more than the sum total of the contents

ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1$ ls ./control     amer  calls  q1  q2  q3  quit.c  RCS  SCCS     ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1$ du ./control     20  ./control/calls     16  ./control/RCS     40  ./control/SCCS     96  ./control     ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1$ du ./control/*     0   ./control/amer     20  ./control/calls     4   ./control/q1     4   ./control/q2     4   ./control/q3     4   ./control/quit.c     16  ./control/RCS     40  ./control/SCCS     ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1$      Please note `du` reports that control directory occupies 96 bytes. Now when I add the bytes consumed by the individual files, it comes to be 92 bytes. In the same way, for all reporting du shows 4 bytes more than the sum total of the contents. What this extra 4 bytes from? > EDIT#1               ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1$ ls -ld $_     drwxrwxr-x 5 ravbholua ravbholua 4096 Dec  8 21:39 control      `du` ( or linux) uses 1024-byte blocks (1KB) for reporting (1024 * 4 = 4096) a file.               ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1/control$ ls     ame  amer  calls  q1  q2  q3  quit.c  RCS  SCCS     ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1/control$ du ame     4   ame     ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1/control$ cat ame     a     ravbholua@ravbholua-Aspire-5315:~/CCPP/HelloWorld/das/das1/control$ ll ame     -rw-rw-r-- 1 ravbholua ravbholua 2 Dec  8 21:39 ame      So the above file 'ame' which contains only letter 'a' and 'enter key' occupies 4 KBs of my disk space. So that means for a file/directory linux is allocating 4KB of my disk space!!!! and it will allocate in multiples of 4KB. Also adding one more thing: `ls -l` reports size in units of byte for a directory but not for a regular file. With ref. to the above file 'ame', its clear that for a regular file `ls -l` reports size as character count and not bytes.


How can I reset the bash filename completion for "more"?

I've done something that has changed the way TAB auto-complete works, but only for the more command. Every other command lists the possible completions, but more now lists ALL of the possibilities inside a pair of single quotes. So in /etc, if I type               more pass<TAB>      The result is               $ more 'passwdqc.conf     passwd     passwd-'       Typing               less pass<TAB>      Results in               $ less passwd     passwd         passwd-        passwdqc.conf        How can I reset it so that `more`'s autocompletion behaves more like `less`? Edit:               $ shopt -u     autocd          off     cdable_vars     off     cdspell         off     checkhash       off     checkjobs       off     compat31        off     compat32        off     compat40        off     compat41        off     direxpand       off     dirspell        off     dotglob         off     execfail        off     extdebug        off     failglob        off     globstar        off     gnu_errfmt      off     histreedit      off     histverify      off     hostcomplete    off     huponexit       off     lastpipe        off     lithist         off     login_shell     off     mailwarn        off     no_empty_cmd_completion off     nocaseglob      off     nocasematch     off     nullglob        off     restricted_shell    off     shift_verbose   off     xpg_echo        off     $ set -o     allexport       off     braceexpand     on     emacs           on     errexit         off     errtrace        off     functrace       off     hashall         on     histexpand      on     history         on     ignoreeof       off     interactive-comments    on     keyword         off     monitor         on     noclobber       off     noexec          off     noglob          off     nolog           off     notify          off     nounset         off     onecmd          off     physical        off     pipefail        off     posix           off     privileged      off     verbose         off     vi              off     xtrace          off


Best solution advice for backup to NAS over WAN

What is the best solution for daily backup of linux folder to NAS server over WAN? Here is situation: My customer has expressed a wish that source code for his project must be backed up every day on my local server and then exported to his NAS. He gave me access to NAS via FTP protocol and now I want to use cron scheduler for ftp upload to his server. Is this ok and how is this done?


Windows installer complains that it can only be installed on a primary partition

I have Linux mint installed on my system as primary partition. I want to install windows 8 along side with it (Dual boot). But when I try to install windows 8 installer says (windows can only be install Primary partition). I have only 1 primary partition in which Linux is running, other are extended or logical ones. ![Partition Details](http://i.stack.imgur.com/2FF9i.png) I want to use my last Partition (Label : Apps) for installing Windows. Can I convert a logical partition to primary or any other better suggestion?


Linux Icon Naming Conventions

Is there a naming convention in Linux when it comes to application icon filenames? What I'm referring to is the practice of including the icon size in the filename if the application uses multiple icon files (PNGs, for example) for different views (desktop, lists, menus, etc.). OS X has the `icon_16x16`, `icon_32x32`, etc. convention, so I'm wondering if there's a similar practice in Linux.


how to configure cross compilation for cubieboard?

I have a cubieboard 2 : ARMv7l Cortex-A7 dual core and this will be the first time I build Linux from scratch. I know I could download an image but I want to learn how to do it and configure things myself, and I have been a SWE for many years. I have downloaded crosstool-ng and I am trying to figure out what configuration I should take. I see things for cortex a8 and a9, arm-unknown etc. but nothing for cortex a7. I have found a few configs on the internet about cortex a7 but   * they don't mention if it is for dual core or not   * CT_ARCH_ARCH="armv7-a" is seen in conf files for cortex a8, a9. Should I put that too for cortex a7 ? or "armv7-l"?  Here is the conf "arm-cortex_a8-linux-gnueabi".               CT_LOCAL_TARBALLS_DIR="${HOME}/src"     CT_SAVE_TARBALLS=y     CT_LOG_EXTRA=y     CT_ARCH_ARCH="armv7-a"     CT_ARCH_CPU="cortex-a8"     CT_ARCH_TUNE="cortex-a8"     CT_ARCH_FLOAT_SW=y     CT_ARCH_arm=y     CT_TARGET_VENDOR="cortex_a8"     CT_KERNEL_linux=y     CT_BINUTILS_V_2_20_1a=y     CT_BINUTILS_FOR_TARGET=y     CT_CC_V_4_4_6=y     CT_CC_LANG_CXX=y     CT_LIBC_glibc=y     CT_LIBC_GLIBC_V_2_9=y     # CT_LIBC_GLIBC_FORCE_UNWIND is not set     CT_DEBUG_dmalloc=y     CT_DEBUG_duma=y     CT_DEBUG_gdb=y     CT_GDB_NATIVE=y     CT_GDB_V_6_8a=y     CT_DEBUG_ltrace=y     CT_DEBUG_strace=y     CT_STRACE_V_4_5_19=y     CT_GMP_V_4_3_2=y     CT_MPFR_V_2_4_2=y     CT_PPL_V_0_10_2=y     CT_CLOOG_V_0_15_9=y      Should I just replace cortex a8 by a7? What about dual core?   What would you suggest? What are the variables that matter in this conf?


Flush data to file frequently for long running command?

I have a command that processes data slowly. The command processes lines from a file and writes the results to the output file `data.txt`: `my_command > data.txt` The issue I have is that I'd like to examine output lines in the `data.txt` file as they are processed. The problem is that no output appears in my output file until the OS decides to dump data to the output file, which happens every few hours. Is there anyway I can force data to be flushed to the file more frequently?


strange behaviour of strings command

I am trying to capture mysql traffic and pass those traffic to strings command as follows:               tcpdump -i any -s 0 -l -w - dst port 3306 | strings      This is working as expected and printing all mysql queries like               select * from mytables     show databases      But when i am trying to redirect the output to a file, its not printing the output to `/tmp/out` file:               tcpdump -i any -s 0 -l -w - dst port 3306 | strings > /tmp/out      Can someone explain me the behaviour of above command and why it is not redirecting the output to file.


Reloading Samba4's smb.conf without restarting the service

I want to tweak smb.conf without causing network hiccups for folks who rely on our samba4 fileshare. I made an obvious path change that should only affect my own private share, and ran `smbcontrol smbd reload-config`. It didn't complain, but didn't affect my share, either. I also tried `smbcontrol samba4 reload-config`, which returned `Can't find pid for destination 'samba4'`, so I tried without the '4', and it had the same no-change behaviour as `smbd`. Is there a way to reload the conf in Samba 4 without closing open files and the like?


What is the difference between apt-get and dpkg?

I have several questions regarding `apt-get` vs. `dpkg`.   * Do they install to the same place?   * Is info from these tools 1 to 1 with each other?   * Is there any difference in the commands utility?


track down executables installer

I have a freshly installed debian system It has vim installed using `apt-get install vim`   Now I have the command xxd installed on the system. I know that this had to have come from the vim installation but I can not find the commands installer. How can I track down what it was that has installed this command.


Outputting common lines from 2 files and uncommon lines from both the files in one output file

I have 2 text files. Lets name them file1.txt and file2.txt file1.txt is as follows               chr10   181144  225933     chr10   181243  225933     chr10   181500  225933     chr10   226069  255828     chr10   255989  267134     chr10   255989  282777     chr10   267297  282777     chr10   282856  283524     chr10   283618  285377     chr10   285466  285995      file2.txt is as follows               chr10   181144  225933     chr10   181243  225933     chr10   181500  225933     chr10   255989  282777     chr10   267297  282777     chr10   282856  283524     chr10   375542  387138     chr10   386930  387138     chr10   387270  390748     chr10   390859  390938     chr10   391051  394580     chr10   394703  395270      What I want to output in a single file is 1. All the common lines between file1 and file2 2. All the lines which are in file1 but are not common to both 3. All the lines which are in file2 but are not common to both. I wrote a Perl script to do this but I am pretty sure there must be a command line or an easier way to do it. Any help would be appreciated. Thanks


Dual boot windows on second harddrive, UEFI/GPT system

I'd like to install linux, but I don't want to risk damaging my current windows installation as I have heard a lot of horror stories. Fortunately, I have an extra hard drive. Can I install linux onto that and then dual boot windows without having to modify the windows drive? **Also, I have a UEFI "BIOS" and the windows drive is in GPT format.**


Linux - File change time versus modification time

I'm using Ubuntu 12.04, though I'd imagine this question spans all Linux variants. In the manpage for the `stat` command, there are two (four) formatting options that appear to mean the same thing: > The valid format sequences for files (without --file-system): > > ... > > %y Time of last modification, human-readable > > %Y Time of last modification, seconds since Epoch > > %z Time of last change, human-readable > > %Z Time of last change, seconds since Epoch However, these values aren't always equal. For example, `stat --printf="%y\n%z\n" /usr/local` on my system outputs the following: > 2012-04-26 10:29:13.000000000 -0500 > > 2013-05-06 18:08:19.000000000 -0500 So what is the difference between "change time" and "modification time"?


Huge CPU load due to high system usage

Tasks: 747 total, 176 running, 560 sleeping,   0 stopped,  11 zombie     Cpu(s): 10.5%us, 89.2%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.3%si,  0.0%st     Mem:  74236420k total, 73285344k used,   951076k free, 12261184k buffers     Swap:  8388600k total,    10404k used,  8378196k free, 27872176k cached      89% of CPU is being used by %sy. What is that %sy? This is how iostats look like               root@host [~]# iostat -xk 5     Linux 2.6.32-431.20.3.el6.x86_64 (host.superhostsite.com)       09/03/2014      _x86_64_        (8 CPU)          avg-cpu:  %user   %nice %system %iowait  %steal   %idle               43.02    0.28   50.00    0.05    0.00    6.65          Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util     sdb               0.25    64.95   14.21   79.82    91.86   579.51    14.28     0.15    1.60   0.09   0.84     sda               0.87   182.70   28.06  206.05   247.08  1629.10    16.03     0.49    2.07   0.09   2.22          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                8.45    0.00   91.55    0.00    0.00    0.00          Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util     sdb               0.00    14.00    0.20   15.00     3.20   116.00    15.68     0.03    1.92   0.28   0.42     sda               0.00    23.20    2.00   47.80    25.60   284.00    12.43     0.02    0.42   0.14   0.70      So disk usage is small. Everything is small. And yet, huge 89.2% cpu used by system. Why Why %sy is high? Why not %us?


How to install caffeine on Scientific Linux 6.3

caffeine     Traceback (most recent call last):       File "/usr/bin/caffeine", line 40, in <module>         import caffeine       File "/usr/lib64/python2.6/site-packages/caffeine/__init__.py", line 23, in <module>         from gi.repository import Gtk, Gio     ImportError: No module named gi.repository      This is what I get after installing caffeine.               rpm -qa | egrep -i 'caffeine|gobject'     caffeine-2.4.419-1.el6.nux.noarch     pygobject2-2.20.0-5.el6.x86_64      How can I install it? what am I missing? https://launchpad.net/caffeine


Allowing a user to use sudo without a password

On a sandbox VM environment, I have a setup of Ubuntu Linux which is firewalled and cannot be accessed from outside the local system. Therefore, on that VM, I'd like to give the administrative user (which I set up) the ability to run anything with sudo and not need a password. While I know this is not secure, this VM is not on all the time, and requires my personal passcode to run. So even though this is not "secure", is there a way to get the desired functionality?


Minimal Linux distribution for compiling C programs

What would be the Linux distribution that is minimal? Just enough to run eclipse and the c/c++ compiler. This Linux will be installed on a VM so I don't want to have a full loaded distribution. What I need is just: Linux kernel with a GUI, c/c++ compiler, java, and eclipse *debian base is preferable


How to delete (not disable/mask) a unit in Systemd?

Sometimes I make a new unit in mistake, and then I have to go to /etc/systemd to look for the unit and delete all of its associated files/scripts/links/etc. Is there a better way? Like a single command that deletes everything associated with a unit name?


Linux tool to track directory space over time

Are there any common Linux tools that track disk space over time, not just a filesystem overall, but for example, so I could easily see which directory trees swelled up and shrunk historically? The problem happens on servers which seem to keep hitting 0 free space despite routine house-cleaning of cache and tmp files, logs etc. I already use tools like `df`, `du` and `lsof` often and schedule `at` jobs to find aged files over a certain size/type when low water- marks are hit, etc. Preferably a Debian/Ubuntu package.


How can I limit downloaded file size in wget?

I want to use `wget` (from a php script) to download image files, but don't want to download files over a certain size. Can I limit file size with `wget`? If not, what is a better way?


OpenVPN on OpenWrt

I have a step-by-step guide for OpenVPN on an OpenWRT 10.03 router: (wl500gpv2) ### Needed packages               opkg install openvpn_2.1.1-1_brcm-2.4.ipk kmod-tun_2.4.37.9-1_brcm-2.4.ipk libopenssl_0.9.8m-3_brcm-2.4.ipk liblzo_2.03-3_brcm-2.4.ipk openssl-util_0.9.8m-3_brcm-2.4.ipk ntpd_4.2.6-4_brcm-2.4.ipk      ### Generate certs               # 0)     mkdir -p /etc/ssl/certs/demoCA/newcerts /etc/ssl/certs/demoCA/private /etc/ssl/private; touch /etc/ssl/certs/demoCA/index.txt; echo "01" >> /etc/ssl/certs/demoCA/serial; cd /etc/ssl/certs          # 1)     # cakey.pem: CA's private key - needed by key signing machine only, purpose: Root CA key, keep it in SECRET!!     # cacert.pem: CA's cert - needed by server + all clients, purpose: Root CA certificate, not secret     # common name: "vpnserver" - in every other case just hit enter     time openssl req -nodes -new -x509 -days 3650 -keyout /etc/ssl/certs/demoCA/private/cakey.pem -out demoCA/cacert.pem          # 2)     # server.key: needed by server only, purpose: Server Key, keep it in SECRET!!     # server.csr: [???]     # common name: "vpnserver" - in every other case just hit enter     time openssl req -nodes -new -keyout /etc/ssl/private/server.key -out server.csr # password not advised - only if you're paranoic..          # 3)     # server.crt: needed by server only, purpose: Server Certificate, not secret     # Sign the certificate? [y/n]:y     # 1 out of 1 certificate requests certified, commit? [y/n]y     time openssl ca -cert demoCA/cacert.pem -keyfile /etc/ssl/certs/demoCA/private/cakey.pem -out server.crt -in server.csr -days 3650          # 4)     # shared.key: [???]     time openvpn --genkey --secret shared.key          # 5)     # dh.pem: Diffie-Hellman file for secure SSL/TLS negotiation, identical on the server and all clients     time openssl dhparam -out dh.pem 1024          # 6)     # give a common name! it will be the user name     # client1.key: needed at client1 only, purpose: Client1 Key, keep it in SECRET!     # client1.csr: [???]     # client1.crt: needed at client1 only, purpose: Client1 Certificate, not secret     # Give the client's key file a password for better security.     time openssl req -nodes -new -keyout /etc/ssl/private/client1.key -out client1.csr     # Sign the certificate? [y/n]:y     # 1 out of 1 certificate requests certified, commit? [y/n]y     time openssl ca -out client1.crt -in client1.csr      copy the certs               # on the router     mkdir -p /etc/ssl/certs/client1; cp demoCA/cacert.pem client1.crt /etc/ssl/private/client1.key shared.key dh.pem client1; tar -cvf /root/client1.tar client1; rm -fr /etc/ssl/certs/client1          # on the pc [with a normal user]     mkdir ~/.cert/; rm ~/.cert/*; cd ~/.cert/; scp root@192.168.1.1:/root/client1.tar ~/.cert/; tar -xvf ~/.cert/client1.tar; mv ~/.cert/client1/* .; rm -fr client1; chmod 600 ~/.cert/*          # if you're using e.g.: Fedora/SELinux, then     restorecon -Rv ~/.cert*      ### OpenVPN server config               mkdir /etc/openvpn; vim /etc/openvpn/server.conf          port 1194     proto udp     dev tun     ca /etc/ssl/certs/demoCA/cacert.pem     cert /etc/ssl/certs/server.crt     key /etc/ssl/private/server.key     dh /etc/ssl/certs/dh.pem     tls-auth /etc/ssl/certs/shared.key 0     server 192.168.80.0 255.255.255.0     push "redirect-gateway"     comp-lzo     keepalive 10 120     status /tmp/openvpn.status      ### Firewall on the OpenWrt router               vim /etc/firewall.user          iptables -t nat -A prerouting_wan -p udp --dport 1194 -j ACCEPT     iptables -A input_wan -p udp --dport 1194 -j ACCEPT     iptables -A INPUT -i tun+ -j ACCEPT     iptables -A FORWARD -i tun+ -j ACCEPT     iptables -A OUTPUT -o tun+ -j ACCEPT     iptables -A FORWARD -o tun+ -j ACCEPT      ### Reboot               sync; sync; sync     reboot      ### Start and check               openvpn --daemon --config /etc/openvpn/server.conf          root@OpenWrt:/etc/ssl/certs# ps aux | fgrep -i openvpn     941 root      2876 S    openvpn --daemon --config /etc/openvpn/server.conf      root@OpenWrt:/etc/ssl/certs# netstat -tulpn | fgrep -i 1194     udp        0      0 0.0.0.0:1194            0.0.0.0:*                           941/openvpn     root@OpenWrt:/etc/ssl#       ### Client config               yum install openvpn     vim /etc/openvpn/client.conf          client     dev tun     proto udp     remote 192.168.1.1 1194     nobind     ca /home/USERNAME/.cert/cacert.pem     cert /home/USERNAME/.cert/client1.crt     key /home/USERNAME/.cert/client1.key     dh /home/USERNAME/.cert/dh.pem     tls-auth /home/USERNAME/.cert/shared.key 1     comp-lzo      ### Go!               openvpn /etc/openvpn/client.conf      * * * But after I try it out, the client gives an error: (and when I use the VPN, I can't ping google.com from the client.. just the router)               Sat Jul  9 13:14:19 2011 OpenVPN 2.1.1 i686-redhat-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] built on Jan  5 2010     Sat Jul  9 13:14:19 2011 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.     Sat Jul  9 13:14:19 2011 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables     Sat Jul  9 13:14:19 2011 Control Channel Authentication: using '/home/USERNAME/.cert/shared.key' as a OpenVPN static key file     Sat Jul  9 13:14:19 2011 LZO compression initialized     Sat Jul  9 13:14:19 2011 UDPv4 link local: [undef]     Sat Jul  9 13:14:19 2011 UDPv4 link remote: 192.168.1.1:1194     Sat Jul  9 13:14:19 2011 [vpnserver] Peer Connection Initiated with 192.168.1.1:1194     Sat Jul  9 13:14:21 2011 TUN/TAP device tun0 opened     Sat Jul  9 13:14:21 2011 /sbin/ip link set dev tun0 up mtu 1500     Sat Jul  9 13:14:21 2011 /sbin/ip addr add dev tun0 local 192.168.80.6 peer 192.168.80.5     Sat Jul  9 13:14:21 2011 OpenVPN ROUTE: omitted no-op route: 192.168.1.1/255.255.255.255 -> 192.168.1.1          Sat Jul  9 13:14:21 2011 WARNING: potential route subnet conflict between local LAN [192.168.80.0/255.255.255.0] and remote VPN [192.168.80.1/255.255.255.255]          Sat Jul  9 13:14:21 2011 Initialization Sequence Completed     ^CSat Jul  9 13:16:10 2011 event_wait : Interrupted system call (code=4)     RTNETLINK answers: No such process     Sat Jul  9 13:16:10 2011 ERROR: Linux route delete command failed: external program exited with error status: 2     Sat Jul  9 13:16:10 2011 /sbin/ip addr del dev tun0 local 192.168.80.6 peer 192.168.80.5     Sat Jul  9 13:16:10 2011 SIGINT[hard,] received, process exiting      The question is, what am I doing wrong? Why doesn't it work? Am I giving wrong subnets? How can I give good ones? (e.g.: bad "server" line in the "openvpn server config"?)      ---      Topology:      ISP -> OPENWRT ROUTER(giving 192.168.1.0/24) -> MYPC(dhcp, not static ip)      Thanks for any help/tips. I already googled for hours and asked many experts, but no luck. My purpose is to openvpn to this openwrt router from my PC to have a secured "channel" (from a netcafe, or from the mentioned topology, etc.). The "MYPC" is runing Fedora 14      UPDATE Q:   Can somebody explain what are these files?:      # server.csr: [???]   # shared.key: [???]   # client1.csr: [???]


How does the Linux file system/organization differ from Windows?

One of the things that really slows me down in catching on with Linux is the huge difference between the file system in Linux versus Windows. Up until the last 3-4 years I only used Windows systems and its only been the last 2-3 months that I've really worked at getting accustomed to Linux. I think one of the things that really bothers me at this point is that I felt like I could find just about anything I wanted to when I began digging through the various folders in Windows. I had become accustomed to what kinds of things were placed where and when. I don't have that with Linux. I'm learning a few things like the /opt folder is where most third-party programs get installed... but my understanding is limited. What things are important to know to really understand the file system and to be able to locate different files and programs and such?


Installing install-info

I do not have root privileges in my system and I have noticed that I don't have access to a `install-info` binary, even though I need to install an Emacs package (CEDET). In the past, whenever I had to use a binary not provided by the system admin, I downloaded it to my home directory and installed it there for my personal use. I would like to do the same thing with `install-info` (i.e. install it under my home directory) but I don't know where to download it from. How can I get `install-info` and install it in my home directory?


Linux Mint 13 Xfce - Use Super_L in multiple shortcuts

I'm using the XfApplet for integrating the mintMenu into my Mint Xfce installation.   As shortcut I defined `Super_L` which works fine.   Additionally I want to define a shortcut `<Super_L>r` to execute `gnome- terminal`.   Unfortunately the `Super_L` keystroke gets interpreted and consumed early so that the mintMenu appears and types `r` into the search field. _Is it possible to configure that both shortcuts`Super_L` and `<Super_L>r` work properly?_ **Edit:** This is how the mintmenu looks like.   ![enter image description here](http://i.stack.imgur.com/JJ6SI.png)


Co Record Verification

I have a task requiring some awk to verify a few records quickly. Let' say:               A1,A2     B1,B2     C1,C2     C2,C1     A1,C1     A1,B1     B1,A1      Which would be the best way to check for reciprocity only between the A# the B# and the C# and output only the non reciprocal. For instance: the above should output               A2 -> A1     B2 -> B1      A# belong to one group, B# to another and so on. There's no interest in findind any sort of conexion between A# and C# or B#. Instead it is required to keep the search within the group of As, Bs, Cs and so on.


Does Chrome run on Debian kFreeBSD?

I know that some Linux applications run on FreeBSD. All the more so, they should run on Debian kFreeBSD (since it only uses a FreeBSD kernel while Linux userspace). Does Google Chrome (not Chromium, as I need flash) run on Debian kFreeBSD?


Is it safe to remove the .oh-my-zsh directory?

One point in time, I tried oh my zsh but it causes a lot of issues so I'm back at bash. I'm trying to clean up some files and notice there is a oh my zsh folder. The github instructions tell me to run uninstall oh my zsh but I don't see that script in my folder. Is it safe to remove `.oh-my-zsh` folder?


"Virtual" shell, ie. jailing an user inside a process after the (SSH) login

The title might not say much about the issue at hand so let me get straight to the point. Let's assume I have a casual user who can log in to the system via SSH into a bash shell. I also have a PHP (though the language is irrelevant here) script that acts as a process accepting various commands and other user input and acts according to them (essentially a 'shell-like' script). Now, what I want to do is to lock the user inside said PHP script, ie. run it as soon as the user logs in (this part is simple via .bashrc) but at the same time ensure that when the script execution ends, the user is also automatically 'kicked out' of bash and consequently the ssh session, so that he cannot do anything via bash itself and stays limited to what the PHP script offers. Is that even possible? If yes, how would I go about doing it? **Update:** Based on the answers so far - having bash inbetween my script and the user logging in via SSH is no requirement whatsoever. It just seemed like a necessity to me at first. Anything that forces the user into my script only directly after a SSH login is a welcome answer.


Any packages for download management (some thing like DAP 4 W$ ) in opensuse-Gnome?

I'm looking for a package that can manage my internet downloads. Especially to expedite the download process.


Find -exec + vs find | xargs. Which one to choose?

I understand that the `-exec` can take a `+` option to mimic the behaviour of `xargs`. Is there any situation where you'd prefer one form over the other? I personally tend to prefer the first form, if only to avoid using a pipe. I figure surely the developers of `find` must've done the appropriate optimizations. Am I correct?


What does ^d mean in ls -l | grep ^d?

When I do `ls -l | grep ^d` it lists only directories in the current directory. What I'd like to know is what does the caret `^` in `^d` mean?


vnc over ssh port assignment

At the office I have on the servers a vnc server running. In Windows I use putty to connect to the server, I log in and then use realvnc to see the desktop. But I cannot get this to work on Linux. I have done it in the past struggling but never again. What I have done is try to bind my localhost to the port 5901 and then to the port 5901 on the server machine               ssh -L localhost:5901:server.dog.com:5901 vass@server.dog.com      I am using the vnc client "remote desktop viewer". Best,


Copying Files in a Folder To Individual Folders

This might sound like something quite odd but for my HTPC, I need to rearrange how my files are stored such that each of the individual files in a folder needs to be moved to a subdirectory of its own (with the same name as the file). I.E. - Currently the directory is:               directory/     - a.file     - b.file     - c.file      and I want to change it to:               directory/     - a/     -- a.file     - b/     -- b.file     - c/     -- c.file      I don't think this is terribly tricky but it's just odd and I haven't found anybody doing it before: I think it can be done with find and exec but I'm a bit of a battler and can't quite get it. Thank you very much in advance (or even just for taking the time to read this).


Can we find page count of a file in Unix/Linux?

I want to count number of pages in the file `/var/log/messages`, so that I can use `pr` command to start printing from the page I want to. For example, suppose that `/var/log/messages` file contains 300 pages, then I can use the following to print last 5 pages.               pr +295 /var/log/messages      Note: `pr` command will list the page count when we specify page number that exceeds number of pages available in the file as mentioned below.               pr +400 /var/log/messages     pr: starting page number 400 exceeds page count 313       Having said that I would like know if there is a specific command to find the page count.


using udptunnel with openvpn

I'm trying to tunnel `openvpn` traffic (UDP protocol) over a firewall using `udptunnel`   I can't use `openvpn` itself on TCP protocol.   On the server I'm running `udptunnel` like this:               udptunnel -s 9999 127.0.0.1/1196      but I'm getting `setup_udp_recv: bind: Address already in use` because openvpn is listening on this UDP port.   How should I run `udptunnel` on server to forward tunneled openvpn's traffic from port 9999 TCP over same server's 1196 UDP?


Get specific line from command output in awk

I have used pipeline to read specific record from impala shell.Here is what I got               [cloudera@localhost ~]$ echo "select * from abc where key > 'a-26052014015400' limit 1;" | impala-shell     Starting Impala Shell without Kerberos authentication     Connected to localhost.localdomain:21000     Server version: impalad version cdh5-1.3.0 RELEASE (build 40e1b62cf0b97f666d084d9509bf9639c575068c)     Welcome to the Impala shell. Press TAB twice to see a list of available commands.          Copyright (c) 2012 Cloudera, Inc. All rights reserved.          (Shell build version: Impala Shell vcdh5-1.3.0 (40e1b62) built on Tue Mar 25 13:46:44 PDT 2014)     Query: select * from abc where key > 'a-26052014015400' limit 1     [localhost.localdomain:21000] > +------------------------+------+----------------+-------+     | key                    | hpid | uts            | value |     +------------------------+------+----------------+-------+     | a-26052014015700 | HS2  | 26052014015450 | 50    |     +------------------------+------+----------------+-------+     Returned 1 row(s) in 2.42s     Goodbye      What I really want is `a-26052014015700 | HS2 | 26052014015450 | 50` this record in awk programming , I have tried with pipelined awk command               `echo "select * from abc where key > 'a-26052014015400' limit 1;" | impala-shell| awk -F'=' '{print $2}' | awk -F '>' '{print $1}`      but didnt get the expected out,Any better and efficient method to extract record ,thanks.


In iptables, what is the difference between targets DNAT and REDIRECT?

More specifically, is               -A PREROUTING -i $INT -p $PROTO --dport $PORT -j REDIRECT --to-ports $NEWPORT      equivalent to one or both of these?               -A PREROUTING -i $INT -p $PROTO --dport $PORT -j DNAT --to-destination :$NEWPORT     -A PREROUTING -i $INT -p $PROTO --dport $PORT -j DNAT --to-destination $IP_OF_INT:$NEWPORT


Root access that can't change root password?

We are having a little problem on a server. We want that some users should be able to do e.g. `sudo` and become root, but with the restriction that the user can't change root password. That is, a guarantee that we still can login to that server and become root no matter of what the other users will do. Is that possible?


creation time attribute on CIFS

I have a linux server which captures network pcap files and save it to a CIFS shared drive. I have found out that the creation time and modified time of the pcap files seems to be the same. Which shouldn't be, as each file has 10 seconds of data so the creation time should be 10 seconds older than the modified time. If I'm correctly understanding the time attributes. I need this difference as the software with which I extract the files from the shared drive fixes the time span with start time as creation time of first file and end time as "last write /modified time" of the last file. Is this happening because of a linux bug? I know there will be a difference in the creation time and modified time as I have seen it before on the system few months ago.


How to add a custom timezone clock to an XFCE panel?

My local time is CET (Prague, EU), I also need to see UTC and, some times, MSK time. Can I add multiple clocks with different zones to a panel in XFCE? I know how to add multiple clocks, actually, but how to customize time zone of each of them?


locale not found/setting locale failed - what should I do?

I've installed Debian 7 i386 on my VPS (OpenVZ). Everything works fine, except locales - any attempt to install anything shows:               [...]     perl: warning: Setting locale failed.     perl: warning: Please check that your locale settings:         LANGUAGE = (unset),         LC_ALL = (unset),         LANG = "pl_PL.UTF-8"         are supported and installed on your system.     perl: warning: Falling back to the standard locale ("C").     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     [...]      What I've tried:   1. Generating locales myself - update-locale LC_ALL="pl_PL.UTF-8" - shows: http://www.wklej.org/id/1248438/   2. `apt-get install --reinstall locales` http://www.wklej.org/id/1248442/   3. The same with `dpkg-reconfigure locales` + setting pl_PL.UTF-8, pl_PL.ISO-8859-2 or even en_US: http://www.wklej.org/id/1248446/   4. `export LC_ALL=pl_PL.UTF-8` (even on root): -bash: warning: setlocale: LC_ALL: cannot change locale (pl_PL.UTF-8) Here is what shows locale:               root:~# locale     locale: Cannot set LC_CTYPE to default locale: No such file or directory     locale: Cannot set LC_MESSAGES to default locale: No such file or directory     locale: Cannot set LC_ALL to default locale: No such file or directory     LANG=pl_PL.UTF-8     LANGUAGE=     LC_CTYPE="pl_PL.UTF-8"     LC_NUMERIC="pl_PL.UTF-8"     LC_TIME="pl_PL.UTF-8"     LC_COLLATE="pl_PL.UTF-8"     LC_MONETARY="pl_PL.UTF-8"     LC_MESSAGES="pl_PL.UTF-8"     LC_PAPER="pl_PL.UTF-8"     LC_NAME="pl_PL.UTF-8"     LC_ADDRESS="pl_PL.UTF-8"     LC_TELEPHONE="pl_PL.UTF-8"     LC_MEASUREMENT="pl_PL.UTF-8"     LC_IDENTIFICATION="pl_PL.UTF-8"     LC_ALL=      Nothing interesting found in /var/log. Even changing repo to official + purge and manual installation locales doesn't solve my problem, which manifests itself on each fresh installation of Debian 7.


Does tar -x Extract to Current Directory or Does it Extract to the Source of the Archive?

Does `tar -x` by default just extract to the current directory or does it try to reproduce the original directory structure including overwriting the original source? I know I can specify a folder to extract to by using `-C directory/` but I am asking about it's default behavior. So if I used `tar -cvpjf ~/backup.tar.bz2 /` to make a backup of my root directory and I then extract the `backup.tar.bz2` (assuming I had root privileges) from within my home directory would it recreate `/` in my home directory or would it actually try to overwrite `/`?


Alias in .bashrc doesn't seem to accept an argument

> **Possible Duplicate:**   >  In Bash, when to alias, when to script, and when to write a function? I'm trying to setup an alias in my .bashrc file, but it's not working as expected. I have this alias which works:               alias lolcat='python /home/martyn/Dropbox/Applications/Scripts/logcat-viewer/unixcoloredlogcat.py'      and I normally use this command as such:               adb logcat SomeValue:* *:e | lolcat      But I want to put that in to an alias so that I can write:               logcat SomeValue      but my alias below isn't working - it seems that the $1 isn't coming through - can anyone help me fix this?               alias logcat="adb lolcat $1:* *:E | lolcat"      ** FIX **               alias lolcat='python /home/martyn/Dropbox/Applications/Scripts/logcat-viewer/unixcoloredlogcat.py'          function logcat(){          adb lolcat $1:* *:E | lolcat      }


sticky alias command

I want to have the alias `inst` to be used instead of `installpkg /tmp/` and then install packages by `inst <pkg name>`. But in normal alias define, We can not stick alias name to the package name and it gives: `installpkg /tmp/ <pkg name>` That have space between /tmp/ and There is a way to use `alias inst="cd /tmp/; installpkg"`; That changes the directory too. But is there any way to have sticky alias?


How do I decide whether to make a command a shell script or an alias?

> **Possible Duplicate:**   >  In Bash, when to alias, when to script, and when to write a function? If I want to make a command like `gsb` that will expand to something like `git show-branch -a | more` or something even longer, what are the pros and cons of using a bash shell alias vs making a bash script and putting it on your PATH? Are there any performance considerations? For instance, does creating a lot of aliases create more overhead than adding a lot of commands to a directory on your PATH?


Is it possible to run ganglias gmetad and ganglia-monitor not demonized on debian?

I wonder is it possible to run ganglias gmetad and ganglia-monitor not demonized, under my own user (me, sudo) on debian? Because while `gmond.conf` contains something like `demonize` option I see no such in `gmetad.conf`...


How to log all the events performed on directory?

How can I log all the events performed on a particular directory? I want to log the entry of each directory modified within some time duration. I am using `find . -type d -mmin -5` command. In addition to this, I want to put more details, when any directory is moved to another place, I need to add the below log details, eg., > directory "xyz" moved from "home/usr/xyz" => to "home/usr/documents/xyz"


Allow setuid on shell scripts

The `setuid` permission bit tells Linux to run a program with the effective user id of the owner instead of the executor:               > cat setuid-test.c          #include <stdio.h>     #include <unistd.h>          int main(int argc, char** argv) {         printf("%d", geteuid());         return 0;     }          > gcc -o setuid-test setuid-test.c     > ./setuid-test          1000          > sudo chown nobody ./setuid-test; sudo chmod +s ./setuid-test     > ./setuid-test          65534      However, this only applies to executables; shell scripts ignore the setuid bit:               > cat setuid-test2          #!/bin/bash     id -u          > ./setuid-test2          1000          > sudo chown nobody ./setuid-test2; sudo chmod +s ./setuid-test2     > ./setuid-test2          1000      * * * Wikipedia says: > Due to the increased likelihood of security flaws, many operating systems > ignore the setuid attribute when applied to executable shell scripts. Assuming I'm willing to accept those risks, is there any way to tell Linux to treat the setuid bit the same on shell scripts as it does on executables? If not, is there a common workaround for this problem? My current solution is to add a `sudoers` entry to allow `ALL` to run a given script as the user I want it run as, with `NOPASSWD` to avoid the password prompt. The main downsides to that is the need for a `sudoers` entry every time I want to do this, and the need for the caller to `sudo some-script` instead of just `some- script`


How to let a user execute a script owned by root? Setuid doesn't seem to work anymore

I have some bash scripts that I use with the user 'root' to manage iptable rules. The problem is that I want these things at the same time:   * The script must be owned by root   * Permissions must be 700   * I want to have an executable binary that certain user can execute. This executable will run the mentioned script as root. This used to work, and is still what I use in older distributions:               #include <stdio.h>     #include <stdlib.h>     #include <sys/types.h>     #include <unistd.h>          int main()     {        setuid(0);        system("/root/iptables/my-iptables-script.sh");             return 0;     }      So I compile this and then use `sudo chown root` and `sudo chmod 4777`. This way the user can now execute the binary and run the script owned by root. But now I installed Ubuntu 13.10 and when I run that binary I get "permission denied" for the script. Is it possible that something changed in this respect since 12.04? What can I do?


Finding the number of time a particular number in a file where range also specified

I have a file with numbers separated by `,`(comma). In between it also contains a number range like `300-400`. Say for example I have a text file, namely `testme.txt` which looks like,               200,300,234,340-350,400,360,333-339     409-420     4444-31231231     348      I want to find out whether number `348` is present or not. 348 is present in 2 places:   * 340-350    * In last line. How to find it?. I tried using `regex` in sed,awk, but I am not able to completely write the script to capture the number range. Is there any other way to find it? UPDATE: Found 1 brute force solution & it's working only for range.               count=0;     num1=348;     for i in `sed 's/\([0-9]\+\-[0-9]\+\)/:&:/g' testme.txt  |          awk -F: '{ for(i=1; i<=NF; i++) if($i ~/[0-9]+-[0-9]+/){print $i} }'`;           do          lh=`echo $i | awk -F\- '{print $1}'`;          rh=`echo $i | awk -F\- '{print $2}'`;           if [ $lh -le $num1 -a $rh -ge $num1 ];          then               count=`expr $count + 1`;          fi;      done     echo $count;


How to pass parameters to an alias?

For bash script, I can use `"$@"` to access arguments. What's the equivalent when I use an alias?


How to create an alias, but so I can enter in different info with the command

Hi I was wondering I have to run some rather long commands all day. I know how to create aliases for the commands, but the problem I am having is each command contains different IP address in the middle of the command. Is there a way to create an alias so that it runs the command and all I would have to do is enter an IP?


how to make alias to make grep command shorter

In my coding, I always do `grep -rnIi "abcabc" . --color` But, how to make an alias that can let me type only one word with my search string? Is that possible?


Create alias that can interact with arguments

My ultimate goal is to simplify routine task of compilation and run. Now I've following commands                1. g++ foo.cpp -o foo --std=c++11      2. chmod foo +x #this may be overkill      3. ./foo      So, my question if this can be done like               compile foo      with alias or something like that * * * I've tried               alias compile='g++ $1.cpp -o $1 --std=c++11'      with no luck


create an alias that runs a command with string replacement from arguments

I'm trying to write a couple of shortcut aliases to quickly navigate to the httpdocs folders of the various domains and subdomains on my server. basically so I can type something like:               $ pwd     /     $ # Go to the 'site.com' domain:     $ goto site.com     $ pwd     /var/www/vhosts/site.com/httpdocs     $ # Go to the 'subsite' subdomain:     $ gotosub site.com subsite     $ pwd     /var/www/vhosts/site.com/subdomains/subsite/httpdocs      I'm pretty green when it comes to Linux commands and I've tried to research this but failed at putting together search terms that have helped. I've tried using printf and backticks like this:               $ alias goto='`printf "cd /var/www/vhosts/%s/httpdocs"`'     $ alias gotosub='`printf "cd /var/www/vhosts/%s/subdomains/%s/httpdocs"`'      but that doesn't replace in the arguments. If I remove the backticks:               $ alias goto='printf "cd /var/www/vhosts/%s/httpdocs"'     $ alias gotosub='printf "cd /var/www/vhosts/%s/subdomains/%s/httpdocs"'      Then it works but I need to run them like so:               $ `goto site.com`     $ `gotosub site.com subsite`      ...Which seems ugly and inefficient. What's the best approach to achieve this?


How to create an alias that takes an argument in KornShell

I am trying to create an alias which when given some argument will look for the folder with contains the argument as pattern. Let the alias name be `gohf`. Now, I will be using this alias like `gohf <some-pattern>`, for eg. `gohf testing`. Now this should look for a folder that contains “testing” in its name and take me to that folder in the last step. Following is what I could think of.               alias gohf='cd `find . -type d | grep testing`';      The above alias works when the pattern is always “testing”. How can I modify so that if the alias is used as say `gohf game`, then the alias should take me to the folder that contains game in its name. **Note** : Shell: ksh I am assuming that there is only one folder for each pattern I input.


Is it possible to use a parameter within an alias command

> **Possible Duplicate:**   >  How to pass parameters to an alias? As answered in Can less retain colored output? I want to use   `git diff --color=always filename | less -r` to get a colored output of my git diffs. Since I use this a lot it would be nice to set up an alias for this. But how to include the `filename` in this command? I tried the following without success:               alias gdiff='git diff --color=always $1 | less -r'      Typing `gdiff example.php` displays the content of `example.php` with `less` but ignores the diff part. Any ideas?


Unix alias with parameters

> **Possible Duplicate:**   >  How to pass parameters to an alias? I'm wondering if it is possible to define an alias with parameters. For example, when I have to compile a tex file I execute pdflatex and then I have to open the pdf:               $ pdlatex Main.tex     $ Open Main.pdf      Is there a way for defining an alias like this:               alias buildPdf="pdflatex x.tex && Open x.pdf"      Where x is a parameter?


Command substitution in alias resolved in bash profile?

I want to make an alias for randomly changing my mac address               alias chrandmac="sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')"      but the command substitution part is already resolved when executing the profile.               alias chrandmac='sudo ifconfig en0 ether 83:3a:bf:fc:4e:29'      Any thoughts as to why this occurs?


Error creating an alias for the find command

> **Possible Duplicate:**   >  How to pass parameter to alias? I am trying to shorten the `find` command, but getting an error:               $ alias f='find . -name $1 -print'     $ f JobConf.java      > find: paths must precede expression: JobConf.java   >  Usage: find [-H] [-L] [-P] [-Olevel] [-D > help|tree|search|stat|rates|opt|exec] [path...] [expression] How can I make this work?


Bash alias arguments

> **Possible Duplicate:**   >  How to pass parameters to an alias? I am trying to make a bash alias that will allow me to quickly make an archive of the current git repo. My current alias is: `alias gitarch="git archive master --format=tar | gzip >$@"` This works great if I supply a destination file exactly like `gitarch ~/Desktop/MyArchive.tar.gz` but I want to be able to just type a filename and it will always save to the desktop with the tar.gz extension. I tried doing: `alias gitarch="git archive master --format=tar | gzip >~/Desktop/$@.tar.gz"` But it doesnt seem to work correctly. Can anyone tell me the secret to getting this working?


Alias for redirecting both standard output and standard error, as well as sending to background

I am trying to create an `alias` for redirecting both standard output and standard error of `gedit` to `/dev/null`, whilst sending the command to background. This works:               $ alias gedit='gedit $1 > /dev/null 2>&1'     $ gedit file.txt &      However, adding the background instruction `&` to the `alias` string fails to work because it gets immediately interpreted:               $ alias gedit='gedit $1 > /dev/null 2>&1 &'     [1]+  Done                    gedit > /dev/null 2>&1      How should I add this `&` background instruction to the `alias` command?


How extend linux partition with?(after success to extend : fail to boot computer)

I have Ubuntu and I want to enlarge the disk space of /dev/sda1 from 10GB to 90GB. gparted Ubuntu 9.04 live cd show:                Partition    File System   Size      /dev/sda1    ext4          10GB      /dev/sda2    linux-swap    4GB      unallocated  unallocated   146000      I would like to get this disk map:                Partition    File System   Size      /dev/sda1    ext4          90GB      /dev/sda2    linux-swap    4GB      unallocated  unallocated   56000      I click on /dev/sda1 and option resize only gives the option to reduce and not enlarge disk. If gparted cannot handle this, are there other tools that would? (I think that I should merge /dev/sda1 with unallocated but I don't know how to do it.) * * * **Update:failing boot** - unable to enter to my ubuntu OS, infinite loop in begining(solve the problem to enlarge partition but blocked to enter to my partition OS): What I done:   1. delete /dev/sda2   2. resize /dev/sda1 to 160GB   3. create /dev/sda2 with size 4GB primary partition and make it linux-swap   4. restart PC and remove ubuntu live cd - result: unable to access to my installed before ubuntu OS. my current map according gparted ubuntu live cd:                Partition    File System   Size      /dev/sda1    ext4          156GB      /dev/sda2    linux-swap    4GB      **Update2:** reinstall bootloader(Mat idea - thank you very much) https://help.ubuntu.com/community/Grub2#Reinstalling_GRUB2 Thanks,


Conflict between my prompt definition and cat in zsh

I have a file on a remote filesystem that I know has a short text string in it (a sequence of numbers in a single line). If I open the file on a text editor like nano or Emacs I can see the string. Also, not sure if this is relevant, but `ls` reports the file has 8 bytes*. The odd thing is that if I `cat` this file, `cat` reports nothing. However, I noticed that if I add a linebreak at the end of the line, `cat` then shows the contents, which is confusing me. So my questions are:   * Why does this happen? Do I really need a linebreak at the end of each line to have `cat` print its contents? Is this the default behavior for `cat`? (if so, what is the reasoning behind it?)   * Is there a way to force `cat` to print everything in a file, regardless of whether or not I have linebreaks? ## Update: Based on the answers below, I thought it would be relevant to post how I defined my prompt. I'm on `zsh`, and I have the following **two lines** on my `~/.zshrc`:               export PS1="%{$fg[white]%}%n%{$reset_color%} @ %{$fg[green]%}%m: %{$fg[yellow]%}%~ %{$reset_color%}%%     > "      Before the definition of my prompt, I have the following two lines which I believe enable me to use color aliases in the shell:               autoload -U colors     colors      ### Rephrasing the question: With the above in mind, how can I get a linebreak in my prompt, and still manage to get `cat` to print a file like the above correctly? * * * *If I `touch` a random file, `ls` reports the file has only 0 bytes, so I presume that the fact that `ls` reports that my file has 8 bytes is meaningful. Not sure if this is helpful though.


ls command operating differently depending on recipient

How does commands like `ls` know what its stdout is? It seems `ls` is operating different depending on what the target stdout is. For example if I do:               ls /home/matt/tmp       the result is:               a.txt b.txt c.txt      However if I do               ls /home/matt/tmp | cat      the result is (i.e. new line per result):               a.txt     b.txt     c.txt      The process is passed a file descriptor 1 for stdout right? How does it determine how to format the result? Does the file descriptor reveal information?


An oom killer thats baffling me

I am not able to understand why would kernel issue this oom killer when I see enough memory is available: Also why are there so many kernel cache pages allocated? I say enough memory is available after looking at Normal DMA Normal free lines This is an embedded nand flash based device with 256 MB RAM Kernel : 2.6.31                myshellscript invoked oom-killer: gfp_mask=0xd0, order=2, oomkilladj=0       Backtrace:       [<c0106494>] (dump_backtrace+0x0/0x110) from [<c03641a0>] (dump_stack+0x18/0x1c)       r6:000000d0 r5:c9040c60 r4:00000002 r3:c0448690       [<c0364188>] (dump_stack+0x0/0x1c) from [<c015a314>] (oom_kill_process.clone.11+0x60/0x1b4)       [<c015a2b4>] (oom_kill_process.clone.11+0x0/0x1b4) from [<c015a738>] (__out_of_memory+0x154/0x178)       r8:c21e86e0 r7:001fb000 r6:00000002 r5:000000d0 r4:c9b6e000       [<c015a5e4>] (__out_of_memory+0x0/0x178) from [<c015a980>] (out_of_memory+0x68/0xa0)       [<c015a918>] (out_of_memory+0x0/0xa0) from [<c015d230>] (__alloc_pages_nodemask+0x42c/0x520)       r5:00000002 r4:000000d0       [<c015ce04>] (__alloc_pages_nodemask+0x0/0x520) from [<c015d388>] (__get_free_pages+0x18/0x44)       [<c015d370>] (__get_free_pages+0x0/0x44) from [<c0109418>] (get_pgd_slow+0x1c/0xe0)       [<c01093fc>] (get_pgd_slow+0x0/0xe0) from [<c0129ab0>] (mm_init.clone.43+0xb0/0xf0)       r7:c90858c0 r6:00000000 r5:c90858c0 r4:ce1a6680       [<c0129a00>] (mm_init.clone.43+0x0/0xf0) from [<c0129c40>] (mm_alloc+0x34/0x44)       r6:0009230c r5:c90858c0 r4:ce1a6680 r3:00000000       [<c0129c0c>] (mm_alloc+0x0/0x44) from [<c0180f70>] (bprm_mm_init+0x14/0x148)       r4:c5154000 r3:cd472564       [<c0180f5c>] (bprm_mm_init+0x0/0x148) from [<c01812d0>] (do_execve+0xa8/0x254)       [<c0181228>] (do_execve+0x0/0x254) from [<c0106000>] (sys_execve+0x3c/0x5c)       [<c0105fc4>] (sys_execve+0x0/0x5c) from [<c0102e80>] (ret_fast_syscall+0x0/0x2c)       r7:0000000b r6:0009230c r5:0009237c r4:000922fc       Mem-info:       DMA per-cpu:       CPU 0: hi: 18, btch: 3 usd: 0       Normal per-cpu:       CPU 0: hi: 42, btch: 7 usd: 0       Active_anon:28162 active_file:16 inactive_anon:18037       inactive_file:13 unevictable:0 dirty:0 writeback:0 unstable:0       free:9998 slab:2447 mapped:164 pagetables:701 bounce:0       DMA free:17128kB min:1560kB low:1948kB high:2340kB active_anon:51068kB inactive_anon:10320kB active_file:24kB inactive_file:0kB unevictable:0kB present:97536kB pages_scanned:0 all_unreclaimable? no       lowmem_reserve[]: 0 158 158       Normal free:22864kB min:2600kB low:3248kB high:3900kB active_anon:61580kB inactive_anon:61828kB active_file:40kB inactive_file:52kB unevictable:0kB present:162560kB pages_scanned:0 all_unreclaimable? no       lowmem_reserve[]: 0 0 0       DMA: 2358*4kB 912*8kB 25*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB = 17128kB       Normal: 4266*4kB 657*8kB 32*16kB 1*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB = 22864kB       26591 total pagecache pages       0 pages in swap cache       Swap cache stats: add 0, delete 0, find 0/0       Free swap = 0kB       Total swap = 0kB       65536 pages of RAM       10471 free pages       3967 reserved pages       2447 slab pages       892 shared page count       389 shared pages      620 mapped shared page count      177 mapped shared pages      0 pages swap cached      2481 dma reserved pages      19892 total user pages      20512 RSS sum by tasks      20512 RSS sum by page stats      164 user cache pages      26427 kernel cache pages


Password protecting a system file? (e.g. /etc/resolv.conf)

I am trying to parental control myself by restricting web access via OpenDNS. The OpenDNS account password will be handed to someone trustworthy. Now, I want to put some restriction on the /etc/resolv.conf, perhaps using a key or password, but not the root password. Also I do not want to compromise the accessibility by the kernel. Is this possible?


Capture raw image from V4L (webcam) device

I'm using a Raspberry pi to monitor a self-service fridge. When the door opens, a shell script is being executed to capture pictures until the door closes again. The problem, however, is the speed of the ARM-processor. Capturing in full resolution using fswebcam takes 2-4 seconds, which is too long. Our idea to solve this is to split the process:   1. Capture raw images and save to memory card   2. After the door is closed, process the raw data. This is not time-critical. Now, my questions are:   1. Is this possible / wise?   2. Which program should I use?


GNOME-keyring KWallet integration?

I use some GNOME apps, and some KDE apps, so some of them use G-keyring and some KWallet... What I would like to have is a single place for managing passwords. Is there a way to integrate G-keyring and KWallet? Or is there maybe a way to force GNOME apps to use KWallet or KDE apps to use G-keyring? OR is there maybe a way to force them all to use KeePassX or something similar (automaticaly using it after entering the master password)...?


Monitor com port with strace

I have done small application in Java that writes to com port two strings -'dddd' and 'ffff'. I decided to look how it writes with thelp of `strace -s9999 -o serialtrace.log -eread,write,ioctl` And I got log in which I found that com port descriptor is `5`. Tgis is filtered output:               Line 112: read(5, "#\n#Tue Jan 14 12:28:06 GMT+01:00 2014\ncurrencyCode=440\nlogFileName=dbg.log\nport=4462\ncommunicationForward=true\nterminalLanguage=4\ntermInterfaces=\ndelLogDaysOld=0\nStopBits=1\nParity=0\nmessagesFileName=language.ini\nDataBits=8\ncomPort=/dev/ttyS0\nInfoInReceiptSlip=1\ntermDataEncoding=1\nBaudRate=9600\nDebugRX=true", 8192) = 311     Line 113: read(5, "", 8192)                       = 0     Line 114: read(5, "", 8192)                       = 0     Line 222: read(5, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P/\0\0004\0\0\0x4\2\0\0\0\0\0004\0 \0\4\0(\0\34\0\31\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\310\250\0\0\310\250\0\0\5\0\0\0\0\20\0\0\1\0\0\0\310\250\0\0\310\270\0\0\310\270\0\0\34\3\0\0\330\4\0\0\6\0\0\0\0\20\0\0\2\0\0\0\334\250\0\0\334\270\0\0\334\270\0\0\320\0\0\0\320\0\0\0\6\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\7\0\0\0\4\0\0\0\305\0\0\0\306\0\0\0i\0\0\0\23\0\0\0{\0\0\0\220\0\0\0\0\0\0\0c\0\0\0l\0\0\0\243\0\0\0~\0\0\0\0\0\0\0\234\0\0\0Z\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\254\0\0\0\212\0\0\0\247\0\0\0\r\0\0\0\0\0\0\0X\0\0\0\0\0\0\0\241\0\0\0\206\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\217\0\0\0\0\0\0\0\263\0\0\0\20\0\0\0\200\0\0\0S\0\0\0009\0\0\0[\0\0\0\0\0\0\0\262\0\0\0U\0\0\0\231\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270\0\0\0\0\0\0\0\304\0\0\0\235\0\0\0\0\0\0\0\0\0\0\0\305\0\0\0\0\0\0\0\0\0\0\0\257\0\0\0\0\0\0\0\223\0\0\0d\0\0\0t\0\0\0\0\0\0\0n\0\0\0\246\0\0\0\0\0\0\0V\0\0\0\0\0\0\0\267\0\0\0\271\0\0\0z\0\0\0\301\0\0\0\27...     Line 232: write(5, "      8643\n", 11)            = 11     Line 233: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0     Line 234: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0     Line 235: ioctl(5, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0     Line 236: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0     Line 237: read(5, "", 1)                          = 0     Line 238: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0     Line 239: ioctl(5, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0     Line 240: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0     Line 242: write(5, "      8643\n", 11)            = 11     Line 243: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 244: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 245: ioctl(5, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 246: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 247: read(5, "", 1)                          = 0     Line 248: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 249: ioctl(5, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 250: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 252: write(5, "      8643\n", 11)            = 11     Line 253: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 254: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 255: ioctl(5, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 256: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 257: read(5, "", 1)                          = 0     Line 258: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 259: ioctl(5, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 260: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 262: read(5, "      8612\n", 11)             = 11     Line 264: write(5, "      8643\n", 11)            = 11     Line 265: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 266: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 267: ioctl(5, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 268: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 269: read(5, "", 1)                          = 0     Line 270: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 271: ioctl(5, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 272: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 274: write(5, "      8643\n", 11)            = 11     Line 276: write(5, "      8643\n", 11)            = 11     Line 277: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 278: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 279: ioctl(5, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 280: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 281: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 282: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 283: ioctl(5, SNDCTL_TMR_START or TCSETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 284: ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 -opost -isig -icanon -echo ...}) = 0     Line 297: write(5, "ddd", 3)                      = 3     Line 305: write(5, "fff", 3)        But I'm not sure about this line :                Line 112: read(5, "#\n#Tue Jan 14 12:28:06 GMT+01:00 2014\ncurrencyCode=440\nlogFileName=dbg.log\nport=4462\ncommunicationForward=true\nterminalLanguage=4\ntermInterfaces=\ndelLogDaysOld=0\nStopBits=1\nParity=0\nmessagesFileName=language.ini\nDataBits=8\ncomPort=/dev/ttyS0\nInfoInReceiptSlip=1\ntermDataEncoding=1\nBaudRate=9600\nDebugRX=true", 8192) = 311      This info is in configuration file. I dont write this info to com port. What is that?


`sort` disregards question mark

I need to sort a file based on names in the first column. Some of the names end in a question mark. `sort` persistently ignores this question mark during sorting:               sort -k 1 -t , <<TEST     a?,1     a,2     b?,2     b,1     TEST                    a?,1     a,2     b,1     b?,2      I don’t really care about how `sort` orders the question mark, if it only did it _consistently_. But it doesn’t, it seems to consider the second column instead, _even_ if I tell `sort` explicitly only to use the first column as key. Version info:               $ sort --version     sort (GNU coreutils) 8.22     Packaged by Gentoo (8.22 (p1.0))      Incidentally, on OS X 10.9 (where `sort` identifies itself as “sort (GNU coreutils) 5.93”), the above works as expected for me.


What's with `-` in filename affecting sorting order depending on platform?

I just checked if contents of directory on my cygwin/Win7 development system, and test embedded platform running Linux+Busybox are the same. Simple, `cat * | md5sum` on both (RXVT/Bash on Cygwin, serial console on Busybox/Bash), compare. And... mismatch. So I went manually file-by-file, doing `md5sum *` and... Cygwin:                 c69a7926998066fcb79aad3e2fc0c33f *blankpack       5866f29a5bc74f741bcc1074c883abaa *cleanup.sh       d4923d7df2540e279664b0633784f1c4 *clean-www.sh       c44ab61b62af040ee55a3e4ddc271299 *d      Linux:                 c69a7926998066fcb79aad3e2fc0c33f *blankpack       d4923d7df2540e279664b0633784f1c4 *clean-www.sh       5866f29a5bc74f741bcc1074c883abaa *cleanup.sh       c44ab61b62af040ee55a3e4ddc271299 *d      Somehow the two cleanup scripts switched places. The same happens with `ls`, `echo *` etc. Is this some bug? Some dependency on the underlying OS? Which of the two orders is the "correct one"(if any)?


I had a folder full of files, then I used "sudo mount" to mount a Windows samba share. Where did the files go?

I'm using a raspberry pi. I didn't think mounting a samba share to a folder full of files would do anything - I thought it would copy the files to the samba share. Now the files are gone from this folder, but the pi's drive is still full. Where did the files go when I mounted the samba share to the folder?


accessing files hidden by mounted drive

> **Possible Duplicate:**   >  Access to original contents of mount point I have a directory `d` containing some file `f` and I mount a drive on directory `d`. Is there a way of accessing file `f` without unmounting?


Activating WiFi in Fedora

I am using a Fedora 13 OS and i see that in the network connections the WiFi thing has been disabled. Generally when there is a WiFi connection around it would show in the Wireless networks option, but it is not showing for me. What to do, in order to keep the WiFi mode always active. **ADDED** I have tried the following               iwlist wlan0 power      It says the mode is off. `ifconfig wlan0` gives me the following output: > wlan0 Link encap:Ethernet HWaddr 00:19:7D3:0C:FD   >  UP 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:1000   >  RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) `iwconfig` has the following: > wlan0 IEEE 802.11bg Mode:Managed Access Point: Not-Associated   >  Tx-Power=20 dBm   >  Retry long limit:7 RTS thr:off Fragment thr:off   >  Power Management:off