Why *not* parse `ls`?

I consistently see answers quoting this link stating definitively **_"Don't parse`ls`!"_** This bothers me for a couple of reasons:   1. It seems the information in that link has been accepted wholesale with little question, though I can pick out at least a few errors in casual reading.   2. It also seems as if the problems stated in that link have sparked no desire to find a solution. From the first paragraph: > ...when you ask `[ls]` for a list of files, there's a huge problem: Unix > allows almost any character in a filename, including whitespace, newlines, > commas, pipe symbols, and pretty much anything else you'd ever try to use as > a delimiter except NUL. ... `ls` separates filenames with newlines. This is > fine until you have a file with a newline in its name. And since I don't > know of any implementation of `ls` that allows you to terminate filenames > with NUL characters instead of newlines, this leaves us unable to get a list > of filenames safely with `ls`. Bummer, right? How _ever_ can we handle a newline terminated listed dataset for data that might contain newlines? Well, if the people answering questions on this websiite didn't do this kind of thing on a daily basis, I might think we were in some trouble. The truth is though, most `ls` implementations actually provide a very simple api for parsing their output and we've all been doing it all along without even realizing it. Not only can you end a filename with null, you can begin one with null as well or with any other arbitrary string you might desire. What's more, you can assign these arbitrary strings _per file-type_. Please consider:               LS_COLORS='lc=\0:rc=:ec=\0\0\0:fi=:di=:' ls -l --color=always | cat -A     total 4$     drwxr-xr-x 1 mikeserv mikeserv 0 Jul 10 01:05 ^@^@^@^@dir^@^@^@/$     -rw-r--r-- 1 mikeserv mikeserv 4 Jul 10 02:18 ^@file1^@^@^@$     -rw-r--r-- 1 mikeserv mikeserv 0 Jul 10 01:08 ^@file2^@^@^@$     -rw-r--r-- 1 mikeserv mikeserv 0 Jul 10 02:27 ^@new$     line$     file^@^@^@$     ^@      See this for more. Now it's the next part of this article that really gets me though:               $ ls -l     total 8     -rw-r-----  1 lhunath  lhunath  19 Mar 27 10:47 a     -rw-r-----  1 lhunath  lhunath   0 Mar 27 10:47 a?newline     -rw-r-----  1 lhunath  lhunath   0 Mar 27 10:47 a space      > The problem is that from the output of `ls`, neither you or the computer can > tell what parts of it constitute a filename. Is it each word? No. Is it each > line? No. There is no correct answer to this question other than: you can't > tell. > > Also notice how `ls` sometimes garbles your filename data (in our case, it > turned the `\n` character in between the words _"a"_ and _"newline"_ into a > _?question mark_... > > ... > > If you just want to iterate over all the files in the current directory, use > a `for` loop and a glob:               for f in *; do         [[ -e $f ]] || continue         ...     done      The author calls it _garbling filenames_ when `ls` returns a list of filenames containing shell globs **_and then_** recommends using a shell glob to retrieve a file list! Consider the following:               printf 'touch ./"%b"\n' "file\nname" "f i l e n a m e" |         . /dev/stdin     ls -1q          f i l e n a m e       file?name          IFS="     " ; printf "'%s'\n" $(ls -1q)          'f i l e n a m e'     'file     name'      POSIX defines the `-1` and `-q` `ls` operands so: > `-q` - Force each instance of non-printable filename characters and `<tab>`s > to be written as the question-mark ( `'?'` ) character. Implementations may > provide this option by default if the output is to a terminal device. > > `-1` - _(The numeric digit one.)_ Force output to be one entry per line. Globbing is not without its own problems - the `?` matches _any_ character so multiple matching `?` results in a list will match the same file multiple times. That's easily handled. Though how to do this thing is not the point - it doesn't take much to do after all and is demonstrated below - I was interested in _why not_. As I consider it, the best answer to that question has been accepted. I would suggest you try to focus more often on telling people what they _can_ do than on what they _can't._ You're a lot less likely, as I think, to be proven wrong at least. But why even try? Admittedly, my primary motivation was that others kept telling me I couldn't. I know very well that `ls` output is as regular and predictable as you could wish it so long as you know what to look for. Misinformation bothers me more than do most things. The truth is, though, with the notable exception of both Patrick's and Wumpus Q. Wumbley's answers _(despite the latter's awesome handle)_ , I regard most of the information in the answers here as mostly correct - a shell glob is both more simple to use and generally more effective when it comes to searching the current directory than is parsing `ls`. They are not, however, at least in my regard, reason enough to justify either propagating the misinformation quoted in the article above nor are they acceptable justification to " _never parse`ls`._" Please note that Patrick's answer's inconsistent results are mostly a result of him using `zsh` then `bash`. `zsh` - by default - does not word-split `$(`command substituted`)` results in a portable manner. So when he asks **_where did the rest of the files go?_** the answer to that question is **_your shell ate them._** This is why you need to set the `SH_WORD_SPLIT` variable when using `zsh` and dealing with portable shell code. I regard his failure to note this in his answer as awfully misleading. Wumpus's answer doesn't compute for me - in a list context the `?` character _is_ a shell glob. I don't know how else to say that. In order to handle a multiple results case you need to restrict the glob's greediness. The following will just create a test base of awful file names and display it for you:               { printf %b $(printf \\%04o `seq 0 127`) |     sed "/[^[-b]*/s///g             s/\(.\)\(.\)/touch '?\v\2' '\1\t\2' '\1\n\2'\n/g" |     . /dev/stdin          echo '`ls` ?QUOTED `-m` COMMA,SEP'     ls -qm     echo ; echo 'NOW LITERAL - COMMA,SEP'     ls -m | cat     ( set -- * ; printf "\nFILE COUNT: %s\n" $# )     }      ### OUTPUT               `ls` ?QUOTED `-m` COMMA,SEP     ??\, ??^, ??`, ??b, [?\, [?\, ]?^, ]?^, _?`, _?`, a?b, a?b          NOW LITERAL - COMMA,SEP     ?      \, ?          ^, ?              `, ?                  b, [       \, [     \, ]    ^, ]     ^, _    `, _     `, a    b, a     b          FILE COUNT: 12      Now I'll safe every character that isn't a `/slash`, `-dash`, `:colon`, or alpha-numeric character in a shell glob then `sort -u` the list for unique results. This is safe because `ls` has already safed-away any non printable characters for us. Watch:               for f in $(             ls -1q |             sed 's|[^-:/[:alnum:]]|[!-\\:[:alnum:]]|g' |             sort -u | {                     echo 'PRE-GLOB:' >&2                     tee /dev/fd/2                     printf '\nPOST-GLOB:\n' >&2             }     ) ; do             printf "FILE #$((i=i+1)): '%s'\n" "$f"     done      ### OUTPUT:               PRE-GLOB:     [!-\:[:alnum:]][!-\:[:alnum:]][!-\:[:alnum:]]     [!-\:[:alnum:]][!-\:[:alnum:]]b     a[!-\:[:alnum:]]b          POST-GLOB:     FILE #1: '?                \'     FILE #2: '?                ^'     FILE #3: '?                `'     FILE #4: '[     \'     FILE #5: '[     \'     FILE #6: ']     ^'     FILE #7: ']     ^'     FILE #8: '_     `'     FILE #9: '_     `'     FILE #10: '?                 b'     FILE #11: 'a    b'     FILE #12: 'a     b'      Below I approach the problem again but I use a different methodology. Remember that - besides `\0`null - the `/` ASCII character is the only byte forbidden in a pathname. I put globs aside here and instead combine the POSIX specified `-d` option for `ls` and the also POSIX specified `-exec $cmd {} +` construct for `find`. Because `find` will only ever naturally emit one `/` in sequence, the following easily procures a recursive and reliably delimited filelist including all dentry information for every entry. Just imagine what you might do with something like this:               #v#note: to do this fully portably substitute an actual newline \#v#     #v#for 'n' for the first sed invocation#v#     cd ..     find ././ -exec ls -1ldin {} + |     sed -e '\| *\./\./|{s||\n.///|;i///' -e \} |     sed 'N;s|\(\n\)///|///\1|;$s|$|///|;P;D'          ###OUTPUT          152398 drwxr-xr-x 1 1000 1000        72 Jun 24 14:49     .///testls///          152399 -rw-r--r-- 1 1000 1000         0 Jun 24 14:49     .///testls/?                 \///          152402 -rw-r--r-- 1 1000 1000         0 Jun 24 14:49     .///testls/?                 ^///          152405 -rw-r--r-- 1 1000 1000         0 Jun 24 14:49     .///testls/?             `///     ...      `ls -i` can be very useful - especially when result uniqueness is in question.               ls -1iq |      sed '/ .*/s///;s/^/-inum /;$!s/$/ -o /' |      tr -d '\n' |      xargs find      These are just the most portable means I can think of. With GNU `ls` you could do:               ls --quoting-style=WORD      And last, here's a much simpler method of _parsing`ls`_ that I happen to use quite often when in need of inode numbers:               ls -1iq | grep -o '^ *[0-9]*'      That just returns inode numbers - which is another handy POSIX specified option.


Public key not found for RPM

I am trying to install package on Redhat 5.5 using YUM but it always give me this error               [root@redhat64 Desktop]# yum install perl-Net-Server-0.97-1.el5.rf.noarch.rpm   Loaded plugins: rhnplugin, security     This system is not registered with RHN.     RHN support will be disabled.     Setting up Install Process     Examining perl-Net-Server-0.97-1.el5.rf.noarch.rpm: perl-Net-Server-0.97-1.el5.rf.noarch     Marking perl-Net-Server-0.97-1.el5.rf.noarch.rpm to be installed     Resolving Dependencies     --> Running transaction check     ---> Package perl-Net-Server.noarch 0:0.97-1.el5.rf set to be updated     --> Finished Dependency Resolution          Dependencies Resolved          ================================================================================      Package           Arch      Version          Repository                                Size     ================================================================================     Installing:      perl-Net-Server           noarch    0.97-1.el5.rf    /perl-Net-Server-0.97-1.el5.rf.noarch    357 k          Transaction Summary     ================================================================================     Install       1 Package(s)     Upgrade       0 Package(s)          Total size: 357 k     Is this ok [y/N]: y     Downloading Packages:     warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6               Public key for perl-Net-Server-0.97-1.el5.rf.noarch.rpm is not installed      Note :: OS is 5.5 64bit running on virtual box and I have set GPGCHECK=0 in local YUM repository. # Output of Repository               [root@redhat64 ~]# cat /etc/yum.repos.d/* | grep -v "^#"     [rhel-debuginfo]     name=Red Hat Enterprise Linux $releasever - $basearch - Debug     baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/     enabled=0     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release          [rhel-debuginfo-beta]     name=Red Hat Enterprise Linux $releasever Beta - $basearch - Debug     baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/$basearch/Debuginfo/     enabled=0     gpgcheck=1     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release     [rhel-local.repo]     name=Local Repo     Baseurl=file:///RPMS     enabled=1     gpgcheck=0      Im using the Local.repo as my main packages repository


How to change variable color in vim solarized theme?

I have just installed solarized theme for vim from https://github.com/altercation/vim-colors-solarized But the problem for me is that the background stays black and I have the variable names in really dark blue color. Like so : ![enter image description here](http://i.stack.imgur.com/b0oU5.png) Does anyone know how to change that to ? (namely: where it is stored in the theme ?)


Use Synaptic Package Installer by default

I'm running elementary 0.2 and whenever I open a .deb, it opens in Ubuntu Software Center. Is there any way to make it open in Synaptic instead? I just prefer Synaptic; quicker, easier to use.


Execute multiple bash commands on the output of find

I want to execute some commands using the find -exec option, but I'm not sure what' wrong with this code. Currently, it's only processing the first find result, then getting stuck. I'm using bash in OS X.               read -e DIRECTORY          find $DIRECTORY -type f -name '*.mov' -exec sh -c '       file="$0"       echo "Processing $file ..."       modmovie -notrack "Timecode Track" $file -save-in-place       read line </dev/tty     ' {} \;


How can I test whether a block device is read-only from /sys or /proc?

On a CentOS6 system I have `/dev/block/sr0` (read only) and `/dev/block/sda` (read/write). How can I find out programmatically which devices are read-only? There is a `ro` file in there, but it's '0' for both devices. There are some hacks I could use (compare names `^sr` vs `^sd`, look for `cdrom` ownership of device node), but I'd like to have a generic solution.


sshfs - device not found

After updating the server with `apt-get update && apt-get upgrade` this command return an error # OS               Debian 3.2.60-1+deb7u3 x86_64 (wheezy)      # command               echo "the-password" | sshfs root@domain.com:/var/www /remote_mount -o password_stdin      # error               fuse: device not found, try 'modprobe fuse' first      # modprobe fuse               root@dyntest-amd-3700-2gb ~ # modprobe fuse     modprobe: ERROR: could not insert 'fuse': Unknown symbol in module, or unknown parameter (see dmesg)          root@dyntest-amd-3700-2gb ~ # dmesg | grep fuse     [   20.126156] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1607702.343086] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1607745.824310] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1607908.188559] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1608724.690945] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [1608741.684927] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)     [2565283.964259] fuse: Unknown symbol nosteal_pipe_buf_ops (err 0)      # Kernel version               root@dyntest-amd-3700-2gb ~ # cat /proc/version     Linux version 3.2.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.54-2          root@dyntest-amd-3700-2gb ~ # locate -i -r /fuse     /bin/fuser     /bin/fusermount     /etc/fuse.conf     /lib/modules/3.2.0-4-amd64/kernel/fs/fuse     /lib/modules/3.2.0-4-amd64/kernel/fs/fuse/cuse.ko     /lib/modules/3.2.0-4-amd64/kernel/fs/fuse/fuse.ko     /lib/modules-load.d/fuse.conf     /usr/include/boost/fusion/functional/adapter/fused.hpp     /usr/include/boost/fusion/functional/adapter/fused_function_object.hpp     /usr/include/boost/fusion/functional/adapter/fused_procedure.hpp     /usr/include/boost/fusion/include/fused.hpp     /usr/include/boost/fusion/include/fused_function_object.hpp     /usr/include/boost/fusion/include/fused_procedure.hpp     /usr/include/linux/fuse.h     /usr/share/bash-completion/completions/fusermount     /usr/share/doc/fuse     /usr/share/doc/fuse/changelog.Debian.gz     /usr/share/doc/fuse/changelog.gz     /usr/share/doc/fuse/copyright     /usr/share/initramfs-tools/hooks/fuse     /usr/share/lintian/overrides/fuse     /usr/share/man/man1/fuser.1.gz     /usr/share/man/man1/fusermount.1.gz     /var/cache/apt/archives/fuse_2.9.0-2+deb7u1_amd64.deb     /var/cache/apt/archives/fuse_2.9.3-14_amd64.deb     /var/cache/apt/archives/fuse_2.9.3-15_amd64.deb     /var/cache/apt/archives/fuse_2.9.3-9_amd64.deb     /var/lib/dpkg/info/fuse.conffiles     /var/lib/dpkg/info/fuse.list     /var/lib/dpkg/info/fuse.md5sums     /var/lib/dpkg/info/fuse.postinst     /var/lib/dpkg/info/fuse.postrm     /var/lib/dpkg/info/fuse.preinst      # update               root@dyntest-amd-3700-2gb ~ # apt-get install --reinstall linux-image-generic linux-image     Reading package lists... Done     Building dependency tree     Reading state information... Done     Package linux-image is a virtual package provided by:       linux-image-3.2.0-4-rt-amd64 3.2.60-1+deb7u3       linux-image-3.2.0-4-amd64 3.2.60-1+deb7u3     You should explicitly select one to install.          E: Unable to locate package linux-image-generic     E: Package 'linux-image' has no installation candidate


How to remap keycodes via setkeycodes?

I'm trying to change keycodes of some keys, but I don't get one thing. If I use `/lib/udev/keymap`, I get the following output:               # /lib/udev/keymap -i input/event1     scan code: 0xC022D   key code: zoomin     scan code: 0xC022E   key code: zoomout      The keys aren't visible in Xserver because they both have keycodes >255:               # evtest          Event: time 1396340441.362876, type 4 (EV_MSC), code 4 (MSC_SCAN), value c022d     Event: time 1396340441.362876, type 1 (EV_KEY), code 418 (KEY_ZOOMIN), value 1     Event: time 1396340441.362876, -------------- SYN_REPORT ------------     Event: time 1396340441.458872, type 4 (EV_MSC), code 4 (MSC_SCAN), value c022d     Event: time 1396340441.458872, type 1 (EV_KEY), code 418 (KEY_ZOOMIN), value 0     Event: time 1396340441.458872, -------------- SYN_REPORT ------------     Event: time 1396340443.442873, type 4 (EV_MSC), code 4 (MSC_SCAN), value c022e     Event: time 1396340443.442873, type 1 (EV_KEY), code 419 (KEY_ZOOMOUT), value 1     Event: time 1396340443.442873, -------------- SYN_REPORT ------------     Event: time 1396340443.602877, type 4 (EV_MSC), code 4 (MSC_SCAN), value c022e     Event: time 1396340443.602877, type 1 (EV_KEY), code 419 (KEY_ZOOMOUT), value 0     Event: time 1396340443.602877, -------------- SYN_REPORT ------------      I can add a `udev` rule:               KERNEL=="event*", ACTION=="add", SUBSYSTEM=="input", SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c30f", RUN+="/lib/udev/keymap $name /lib/udev/keymaps/logitech-media-keyboard-elite"      and entries in the `logitech-media-keyboard-elite` file look like this:               0xC022D     PROG3   # zoom in     0xC022E PROG4   # zoom out      But there's also `setkeycodes`, and it has to be used in the following way: > setkeycodes scancode keycode I also aded the `atkbd.softraw=0` parameter to the kernel line in order to see real scancodes. But when I use the scancode provided by `/lib/udev/keymap`, it doesn't work:               # setkeycodes 0xC022D 200     KDSETKEYCODE: Invalid argument     failed to set scancode b22ad to keycode 200      According to `showkey -s`, there's no scancode, at least in the case of the two keys, but other keys have something like this:               # showkey -s     a0x1e     0x9e      and `/lib/udev/keymap` shows something different:               scan code: 0x70004   key code: a      Is `setkeycodes` somehow obsolete and shouldn't be used, or am I doing something wrong? Maybe is there a way to translate the codes?


Checking the Speed of Active Network Connections

In Ubuntu 12.04 LTS, there is a window called "Active Network Connections", and in there is a label called `Speed`. How can I get Ubuntu to do a speed check? I know of websites I can use to check the speed of my network, but that won't be logged in this window... or will it? As you can see in the attached screenshot, there is a label called `Speed` and it says it is `Unknown`. ![Active Network Connections](http://i.stack.imgur.com/hLzvK.gif)


How to access windows file server from linux

We have a windows file server with an address like this:               \\bioinf-filesrv2.mycompany.fr\cluster15      How can I access it from Linux? On a Ubuntu 14.04 I tried to access this through nautilus, but it crashed. Here is the crash report: http://pastebin.mozilla.org/5533388


Mail send to my domain ends up in local inbox instead of exchange server

I'm running a MediaWiki install under Ubuntu Server 10.10. I have configured it to use the standard php `mail()` function with my local mail delivery agent (postfix). The mail gets sent from the MediaWiki site, but the only problem is that whenever the address it's meant to be sent to is on the same domain as the server, those mails get delivered to local inboxes on the Ubuntu server. So basically, the server is `linuxbox.companydomain.com`, and our e-mails are `name@companydomain.com`. Any mail sent to an address like that simply ends up in the user's local inbox, e.g. a message to `anders@companydomain.com` ends up in `/home/anders/mbox`, while a message to `anders@gmail.com` would end up in the correct gmail inbox. How do I prevent this from happening?


Port multiplexer sslh: why is it so resource-intensive?

I've just discovered the existence of `sslh`. I tried to install it on my 512MB RAM VPS running Debian 7 wheezy. After having configured `sslh`, I tried to connect to one of my apache2 virtual hosts, and immediately the cpu usage went up to 50-60%, even ssh-ing the VPS was almost impossible due to the lack of resources.   * Is this normal?   * Is there any valid alternative? The problem I was trying to solve using `sslh` is that many free wifi hotspots block almost every port, except 80 and 443, and I often need to use OpenVPN to connect to my home server, which is natted by my ISP. Do you have any other solution to suggest?


Save password for Windows Samba server for printing in Gnome?

Unfortunately for us Linux users, our University printer works over the Samba protocoll. After configuring it in CUPS I can print, but I have to enter username and password everytime with no option to save. I also used the `username:password@adress` syntax, but to no avail. The gnome key manager also does not seem to be used there. Is there any way to save the credentials? I use Arch Linux 3.15.3-1-ARCH with GNOME Shell 3.12.2.


vi[m] read range of lines from another file

On Linux, editing `file_B` in vim I want to add line 10-25 from `file_A`. Example: One has a whole set of HTML-Documents with quite the same header and yes, one could create a template and start from there, but still: I am looking for **a simple [and elegant] way to insert a range of lines from one file and add it to the file I am currently editing. In vim.** The solutions I found so far but **are not exactly** what I'm looking for, are   * _inside_ `file_B` the command `:read file_A` will add *the whole file_A* into file_B. Too much   * there is copy&paste inside vim - but for this one must have opened `file_A`   * _inside_ file_A `:10,25w! file_B` will 'send' the given range of lines to `file_B`.   This seems quite close to copy&paste   * one can open multiple windows in vim   But as I work on an 8inch screen, multiple windows make orientation hard As I wasn't able to find a comfortable solution I wonder if I just misunderstood something or the ways I found so far are commonly used and taken as the standard way.


How to get notification from upower when UPS is on battery

I have a Fedora Core 19 system powered via a desk-side UPS. I've connected the UPS' USP port to the FC19 system, and it was apparently recognized, as upower -d now reports its presence:                ups          present:             yes          state:               fully-charged          time to empty:       1.3 hours          percentage:          100%      I'd like to have a script run for power state changes (on battery, on line power, etc.) The documentation for upower is pretty sketchy and I can't find any reference to hooks for running scripts for these events; is this possible?


Script to show number of files (by file type) in a directory?

I want to show this kind of statistics about a particular directory:               $ myscript.sh     .c 34265 files     .h 17866 files     .cbl 1804 files     .pco 389 files     [...]      Is there a tool that can do this? Here is my attempt:               find . -name "*.*" | sed -e "s/.*\.//g" | sort -u      And then I could type for each type `find . -name "*.pc" | wc -l` but it is bothersome so I wrote:               find . -name "*.*" | sed -e "s/.*\.//g" | sort -u |\         xargs find . -name "*.{}" | wc -l      Unfortunately I must be missing something because it says:               find: paths must precede expression: as      ("as" is the first extension)   Any idea what is going wrong?   Is there already a tool that does what I want (a tool counting file lines would be OK too).


Time synchronization in XFCE 4.8

Apparently there is no gui in XFCE (as there was in gnome) to synchronize time with NTP (if there is one, please let me know the name of the application). So, how can I synch with the time servers? (I'm using Debian wheezy)


Real Time Local File Sync

How can I set up an _instant_ file sync for two local directories? The catch is I need it in real time (15, 10 or even 5 seconds is too slow), and I don't want the target root directory created. For example, something similar to...               cp -fr sourcea/* /some/destdir     cp -fr sourceb/* /some/destdir     cp -fr sourcec/* /some/destdir      Catching deletions would be nice too, though it's not a deal breaker. I do not want the "sourcex" created within destdir. (hence the *). I've tried using rsync, which apparently wasn't close or even close to real-time, as well as several generic sync systems. However, most will want a 1 to 1 sync, rather than contents only. Any suggestions? I've been fighting this for a while now, so any help would be greatly appreciated!


smbclient alternative for large files

I'm using smbclient to transfer a set of large files (80GB) nightly from a Linux system to a Windows share. Lately, for whatever reason, I've been getting I/O timeouts:               cli_push returned NT_STATUS_IO_TIMEOUT      which causes the active file transfer to be aborted and deleted from the Windows share. This may be due to unresolved Samba bug 8498 (or maybe not). The Windows system is not under my control, so I can't install an ssh server (to use scp or sftp), and do not want to depend on Microsoft's implementation of NFS. Is there another simple, standard alternative that would let me move 80GB of data reliably from Linux to Windows over the network on a regular basis (the network is GB ethernet, so bandwidth isn't a problem)?


Problem with LD_LIBRARY_PATH, program can't find a libraray.

I have already asked this question on stackoverflow, but it's also a linux related question and somebody here might know a solution. Hope it's okay. Problem is that I can't run 3D visualisation in Paraprof program on ARM Linux. I am running a small cluster (8 nodes) using armhf Debian Wheezy 7.1 with OpenMPI. I am using Tau OpenMPI profiling tool and it's got a very nice visualising tool called Paraprof. I have a problem with 3D visualisation with paraprof. When I try to run it it says that:               /home/cluster/tool/tau-2.22.2/lib/libjogl_drihack.so :/home/cluster/tool/tau-2.22.2/lib/libjogl_drihack.so cannot open shared object: No such file or directory      I think it's a problem with libraries paths settings, because the path is doubled. Interestingly libjogl_drihack.so is in this directory. LD_LIBRARY_PATH is set correctly as:               /usr/local/lib/:/home/cluster/tools/tau-2.22.2/arm_linux/lib/      OpenGL is installed (I can run glxinfo) and all libjogl packages. Attaching screenshots. https://www.dropbox.com/s/x54xpo5c2kjzew8/tau1.png https://www.dropbox.com/s/mimze22pcl6vxkq/tau2.png Some more info:               root@master:~# ldd     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libjogl_drihack.so         not a dynamic executable     root@master:~# ls /home/cluster/tools/tau-2.22.2/arm_linux/lib/lib*.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libjogl_awt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libjogl_drihack.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libjogl.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTauDisable.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-depthlimit-mpi-pdt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-depthlimit-mpi-pdt-trace.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-mpi-pdt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-mpi-pdt-trace.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-param-mpi-pdt-profile-trace.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-param-mpi-pdt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-pthread-pdt.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh-pthread.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAUsh.so     /home/cluster/tools/tau-2.22.2/arm_linux/lib/libTAU.so     root@master:~# uname -a     Linux master 3.8.13-bone26 #1 SMP Fri Aug 16 20:56:24 UTC 2013 armv7l GNU/Linux     root@master:~#      OpenGL:               root@master:~$ glxinfo | grep OpenGL     OpenGL vendor string:Mesa Project     OpenGL renderer string: Software Rasterizer     OpenGL version string: 2.1 Mesa 8.0.5     OpenGL shading language version string: 1.20     OpenGL extensions      The configuration script for Tau, was looking for libGL.so in /usr/lib directory, on my system this file is in /usr/lib/arm-linux-gnueabihf so i copied it to the /usr/lib, but still no luck. The same error persits.


I've wiped my partition table using gparted, is there a way to recover my partition?

I've wiped my NTFS (windows) partition table using gparted by clicking on "Device->Create Partition Table... and then apply", is there a way to recover my NTFS partition? I tried using this command `gpart /dev/sda` I get the following out put:               Begin scan...     End scan.          Checking partitions...     Ok.          Guessed primary partition table:     Primary partition(1)     type: 000(0x00)(unused)     size: 0mb #s(0) s(0-0)     chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r          Primary partition(2)     type: 000(0x00)(unused)     size: 0mb #s(0) s(0-0)     chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r          Primary partition(3)     type: 000(0x00)(unused)     size: 0mb #s(0) s(0-0)     chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r          Primary partition(4)     type: 000(0x00)(unused)     size: 0mb #s(0) s(0-0)     chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r      What does this output mean? Is there a way I can recover?


One X Client Many X Servers

I have an X client and I would like to display it on many servers (with different IPs), is it possible with X Display? EDIT: Simple situation I have in network some hosts: 192.168.0.1 192.168.0.2 192.168.0.3 From host 192.168.0.1 I would like to run 'firefox' and display them (only display! no control from remote hosts) in 192.168.0.2 and in 192.168.0.3. One solutions that I've found is to use ffmpeg to screencast and broadcast it , but it is for sure less efficient then forwarding X, and also doesn't allow to broadcast more than one program.


-bash: /usr/sbin/useradd: Input/output error — What does this mean?

Today, on my Centos server I tried to add a user but got the following error:               -bash: /usr/sbin/useradd: Input/output error      How do I fix it?


Is my SSD broken?

/bin/ls: cannot access cache-zch-5666-cache.txt: Input/output error     /bin/ls: cannot access cache-zch-4970-cache.txt: Input/output error     /bin/ls: cannot access cache-zch-4782-cache.txt: Input/output error     ./   cache-zch-4782-cache.txt  cache-zch-5666-cache.txt     ../  cache-zch-4970-cache.txt     root@host [/home2/investgr1/public_html/hello/cache/zch]# rm *     rm: cannot remove `cache-zch-4782-cache.txt': Input/output error     rm: cannot remove `cache-zch-4970-cache.txt': Input/output error     rm: cannot remove `cache-zch-5666-cache.txt': Input/output error     root@host [/home2/investgr1/public_html/hello/cache/zch]#     **      What does input/output error mean>? How do I make sure that it's broken. So far only a few file. I am wondering if something more profound happen Is there a way to prove to my provider that it's indeed a problematic SSD? Also, can I try to just reformat the disk? I am concern that there is a bad sector on that disk. My host said: > We will only replace the drive if we can identify a problem with it. The > permissions error you encountered is not an indicator of a failed drive. > > If you require any further assistance feel free to update this ticket.


input/output error that come back just fine. How to make sure it doesn't happen again?

root@host [/backup/2013-08-15/accounts]# cd /home1     root@host [/home1]# ls     /bin/ls: reading directory .: Input/output error     root@host [/home1]#      Suddenly /home1 doesn't work. It used to work just fine. Yes I put one of my most demanding sites there. Then I started getting these errors. Is it possible that the disk can't handle the load? My provider insist that it's user's error though > Actually, I think this was a case of user error. Your hard drives are all > fine, and I've confirmed I am able to read and write files to all mounted > partitions (/home, /home1, /home2, /home3 and /home4). I did need to run an > fsck to fix several errors on your filesystem, and it also appears you have > a whole load of unresolved links leading all over your system (fsck tried to > clear some of these manually, all may not have been fixed). This system > appears to have been very poorly maintained, however as of right now all > disks and all filesystems are accessible. I will put this system back online > shortly and let you know when I've confirmed it is back online. So we have a system that's working just fine for now and then suddenly crash for no reason. After doing some check my host provider says that NOTHING is wrong with the server. I got my server back and yea everything is working. How can this happen? So after all those checks and reboot, the server is running fine, including the drive. However, I am afraid of moving stuff to the server again. If it broke again it can cost me hundreds of dollars. What should I do to make sure nothing else go wrong? How com input/output is in error but then it works again just fine now? What kind of error is this that works now and then fail latter? Call dmesg and got this: I run dmesg and this is what I see: EXT4-fs (sda1): warning: mounting fs with errors, running e2fsck is recommended EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: Here is the stuff in context               EXT3-fs (sdd1): using internal journal     EXT3-fs (sdd1): mounted filesystem with ordered data mode     EXT4-fs (sda1): warning: mounting fs with errors, running e2fsck is recommended     EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts:      EXT4-fs (sdb1): warning: maximal mount count reached, running e2fsck is recommended     EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts:      EXT4-fs (sdc1): warning: maximal mount count reached, running e2fsck is recommended     EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts:      Adding 4194296k swap on /dev/sdd2.  Priority:-1 extents:1 across:4194296k SSD     kjournald starting.  Commit interval 5 seconds     EXT3-fs (loop0): warning: maximal mount count reached, running e2fsck is recommended     EXT3-fs (loop0): using internal journal     EXT3-fs (loop0): mounted filesystem with ordered data mode      What should I do?


I get the error               /usr/bin/env: zsh -: No such file or directory      ...when I run an executable `zsh` script that starts with the following shebang line:               #!/usr/bin/env zsh -      Also, FWIW, replacing `-` with `\--` causes `/usr/bin/env` to print a similar complaint about `zsh --`. I have only seen this error under ubuntu, and only in the context of the shebang hack. Under darwin the same script runs fine. And under ubuntu, running               % /usr/bin/env zsh -      from the command line succeeds. (Actually, "under ubuntu" should be understood as short-hand for "under ubuntu 12.04 LTS and `env (GNU coreutils) 8.13`".) My question is: how can I modify the shebang above to avoid this error? Of course, I know that removing the trailing `-` will eliminate the error, but this is not an acceptable solution. The rest of this post explains why. The shebang line that is causing the error comes about as an attempt to comply with two entirely independent guidelines:   1. To make scripts portable, use `#!/usr/bin/env <cmd ...>` rather than `#!/path/to/cmd <...>`.   2. Putting `-` as the sole argument to `zsh` in the shebang line of zsh scripts thwarts certain types of attacks. So, I can restate my question more precisely as follows: Is it possible to satisfy both of these guidelines without triggering the error shown above under ubuntu?


Setting up samba,netatalk and avahi (bonjour) on raspberry pi

I'm trying to create a fileserver/timecapsule combo server out of my new raspberry pi (Raspbian), and it's not going as well as I'd like. _netatalk_ , _avahi_ and _samba_ are the packages that I'm using and they're not playing nice with each other. **I would like all shares, AFP and SMB to be accessible from a server icon in the finder navigation bar.** **This is what I know**   Netatalk has built-in bonjour support, so if you run netatalk, the `afp` shares show up nicely in Finder (great!).   Samba does _not_ have built-in bonjour support, but with the help of `avahi`, it's possible to advertise your `smb` shares through bonjour as well, and they show up in the Finder's navigation bar as well (awesome!). **The problem**   When netatalk and samba+avahi are both running, it seems like netatalk hides any other bonjour stuff on the same host. When I click on the server icon in the navigation bar, I only see the `afp` shares, no `smb` to be seen. I can still use Cmd+K to get to the `smb` shares, but I find this less preferable, because I want to make it easy to use for non technical people. Does anyone know how I can solve this?


Is there a postexec/predisplay hook for ZSH?

I know zsh has a preexec hook that fires before the command is executed, but is there one that fires after the command has been initiated but before the output is displayed to the screen? I ask because I want to display something based on if there was/will be actual output. For example:   `cd dir` does not output anything   `ls dir` outputs stuff In that example, I want to display: `Output:\n` before the ls directory display but not when `cd` is run since it doesn't have a display. I want it to look like:               ~ $: cd dir     ~/dir $: ls .     Output:     total 464     drwxr-xr-x+  55 eddie  staff   1.8K May  2 11:07 .     drwxr-xr-x    6 root   admin   204B Apr 22 13:48 ..     ~/dir $      I don't just want to wrap cd and ls. Those were examples. I want it to be for _every_ command.


Why Linux syslog file does not follow the RFC3339 protocol?

Why Linux syslog file: /var/log/syslog does not follow the timestamp format defined in the protocol http://tools.ietf.org/html/rfc5424#page-11?


network device name is changed by itself

I use a Ubuntu-arm, `uname -a`               Linux arm 3.7.8-x8 #1 SMP Sat Feb 16 04:15:13 UTC 2013 armv7l armv7l armv7l GNU/Linux      I have two USB WiFi interfaces that are named wlan0 and wlan1 on `/etc/udev/rules.d/70-persistent-net.rules` I run a script on each start-up that does:               ifdown wlan0      rm /var/run/wpa_supplicant/wlan0     ifup wlan0     wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/w.conf          ifdown wlan1     rm /var/run/wpa_supplicant/wlan1     ifup wlan1     wpa_supplicant -B -Dnl80211 -iwlan1 -c/etc/w2.conf      sometimes one of the interface is named as `rename5` whereas the other interface is named according to the `70-persistent-net.rules`. Could anyone explain why it is named rename5 instead of wlan0 or wlan1 and how can I prevent that thing to happen?


How to use `ls` to group and show only a first word of directory name?

I want to define a new `ls` command to do something like this The first when i use ordinary `ls` command:               $ls     undergrade.AI              undergrade.KDD     undergrade.AI2             undergrade.micro     undergrade.ANN             undergrade.OOT     undergrade.autoMata        undergrade.OS     undergrade.bulletin        undergrade.parallelAndDistributedProgramming     undergrade.CG              undergrade.pop     undergrade.CLP             undergrade.PPL     undergrade.comNet          undergrade.researchingMethod     undergrade.comOr           undergrade.SA     undergrade.comSec          undergrade.SE     undergrade.DBMS            undergrade.softwareTesting     undergrade.discrete        undergrade.webApps     code.ajax  code.cc  code.erl  code.html    code.js    code.pl     code.py        code.sage  code.x3d code.c    code.cl      code.go    code.jquery code.lisp       code.pro   code.roo code.sh   code.xml      And for a new ls that i want:               $ls_new     undergrade  code      I want it to show only the first word when i type `ls_new`. Why do i want this command? Because i named my folders in pattern of `category.subj` that so too much output when i use ordinary `ls`. then i need some command that can filter, group and show them but only the `category` name.


Correctly setting environment

I'm using zsh and gdm to run gnome. Some time ago I discovered that variables are not set correctly. For example LANG/LC_ALL are incorrect (`""` instead of `en_GB.UTF-8`). I split the `.zshrc` into `.zshrc` and `.profile`. In the latter I set the environment variables, but how can I set the variables before the session starts? I tried a few choices (`.xinitrc`, `.xsessionrc`) but none seemed to work. **Edit** To clarify - I used `.profile` and _manually_ sourced it in `.zshrc`. It does not change question anyway.


Centrino N-6300 OpenBSD 5.5 - No Link

I have a Lenovo X230 with a Centrino N-6300 wifi card. I cannot get wifi to work on it. I did `fw_upgrade` I can do a               ifconfig iwno scan      I have the list of Wifi networks around including mine. However if I try to setup `/etc/hostname.iwn0`               nwid Livebox-XXXX     wpakey XXXXXXXXX     dhcp      then               sh /etc/netstart iwn0      I got:               No link: .............. sleeping      Same if I try:               ifconfig iwn0 nwid Livebox-XXXX wpakey XXXXXXXX      What did I miss?


Replacing graphical sudo prompts with sudo command

I'm trying to replace `gksudo`, `pkexec` and its ilk with `sudo`. However, I'm told that using `sudo <graphical_program>` is a bad idea. Would the following work as a decent replacement?               sudo -H <graphical_program>      Or do I have to do other things as well?


joystick as a mouse with Fedora

I would like to use a joystick as a mouse with Fedora 12. I tried js2mouse but didn't work. Is there another solution? How should I configure the system?


How can I change my bash prompt to show my working directory?

I can print my current working dir like this               myPrompt$ pwd     /Users/me/myDir      I want my shell to look like this               /Users/me/myDir$ pwd     /Users/me/myDir      Is that possible? How can I do it?


"Enabling additional executable binary formats" fails

On ubuntu 14.04, after doing `do-release-upgrade -d` several systems failed like dbus, network-manager, sound card etc.. I am logged into terminal instead of X. Looking at the `/var/log/boot.log` I managed to fix all failed services except the line "enabling additional executable binary formats". What is the purpose of it and how do I debug it?


How can I view a reference or cheat sheet of the basic bash syntax, in the linux terminal?

Every time I need to do a little bash scripting involving if statements, checking for empty variables and non-existent files et.c. I find myself hitting google for some simple bash manual or guide. Often these are way too long and complicated to quickly answer the question I have at hand. So, I was thinking that there must be some command or man page that covers the basic bash syntax (for things like if-statements, checks for empty variables, non-existent files etc) in a short and accessible manner. I'm sure I just havent found out the command (man bash doesn't seem to be it). Where can I find that?


What happens between double-click in file manager and application launch?

What is the chain of apps involved in process of opening a file from a file manager? Consider these two moments, say it's Xfce 4 and a simple plain text file set up to open in Mousepad:   1. I hit double-click the file in Thunar or Nautilus etc.,   2. Mousepad is launched with the file The background is that I have a bug which seems to happen even when I use different file manager as well as application. For example, Nautilus/Mousepad or Thunar/Libreoffice Calc scenarios suffer from this bug as well. It's Debian Jessie amd64, FTM.


The -cp option to the java command

java -cp FILE.jar FILE.Main inputfile       What does the `-cp` option mean? For that matter, what a negative sign in front mean? I've searched everywhere and couldn't find the answer.


Unzipping a TAR file, causing an error

I am trying to unzip a .tar.gz file using `tar xvzf`, as hhaamu said in his answer to my other question about Installing GCC on SCO. When I type:               bash-3.1$ tar xzf gcc-2.95.2pl1-dist.tar.gz     tar: z: unknown option     Usage: tar -{txruc}[0-9vfbkelmnopwAFLTP] [tapefile] [blocksize] [tapesize] files...         Key     Device            Block   Size(K)    Tape         0       /dev/rfd048ds9    18      360        No         1       /dev/rfd148ds9    18      360        No         2       /dev/rfd096ds15   10      1200       No         3       /dev/rfd196ds15   10      1200       No         4       /dev/rfd0135ds9   18      720        No         5       /dev/rfd1135ds9   18      720        No         6       /dev/rfd0135ds18  18      1440       No         7       /dev/rfd1135ds18  18      1440       No         8       /dev/rct0         20      0          Yes         9       /dev/rctmini      20      0          Yes         10      /dev/rdsk/fp03d   18      720        No         11      /dev/rdsk/fp03h   18      1440       No         12      /dev/rdsk/fp03v21 10      20330      No      Notice the second and third line, where it says: > tar: z: unknown option Usage: tar -{txruc}[0-9vfbkelmnopwAFLTP] [tapefile] > [blocksize] [tapesize] files... **What does that mean, and how can I resolve this?**


Display command in xterm titlebar

My Bash Prompt is currently setting the xterm titlebar using the following sequence:               PS1='\033]0;\u@\h>\w\007'      Is there an easy way to display the current command in the titlebar. For example, if I am tailing a file using `tail -f foo.log`, I want my titlebar to say `tail -f foo.log`.


Change title on xterm

> **Possible Duplicate:**   >  Display command in xterm titlebar Like `konsole`'s tabs on KDE I want the title on `xterm` do the same thing (automatically changes). ¿Can anyone teach me? Thanks!


How can I format a flat file using awk?

Below is the format of some table data contained within a single file:               ;NULL;ABCD;ABHJARS;;ABCD;ABCD;Y;;;;;;;;;A;     ;NULL;XEU-ANKD;XEU-AJKD;;ABCD;ABCD;Y;;;;;;;;;A;     .     .     ;11744;AMKDIONSKH;AMKDJ AN DJ JAHF AS CPFVH MTM;;QWERDF;QWERDF;Y;;;;;;;;;A;          (5436rowsaffected)     (returnstatus=0)          Returnparameters:          ;;     ;5436;               (1rowaffected)     ;;;     ;-------;-----------;     ;grepkey;5436;          (1rowaffected)      **NOTE:** Above `grepkey=5436` (Count of the records present in table). Below is the expected output:               1;NULL;ABCD;ABHJARS;;ABCD;ABCD;Y;;;;;;;;;A;     2;NULL;XEU-ANKD;XEU-AJKD;;ABCD;ABCD;Y;;;;;;;;;A;     .     .     5436;11744;AMKDIONSKH;AMKDJ AN DJ JAHF AS CPFVH MTM;;QWERDF;QWERDF;Y;;;;;;;;;A;      I need the data in the above format. I'd like to prefix the row number and exclude the additional data that is present at the end of the file, like count of records in the table etc. Additionally I'd like to accomplish the above using `awk`.


Does Debian have any kind of virtual environment for make install?

If someone used a Python virtualenv he knows we can run scripts in its own environment installing all necessary libraries which won't impact main python distribution. Do we have something similar in a Linux (Debian) world for `make` utility?   1. Case 1: I downloaded sources and I know what dependencies I need. I put libraries somewhere in home directory and I explicitly say to `make` utility where to search them.   2. Case 2: I run some kind of virtualenv for `make` utility and I call there `apt-get install lib-required-dev` so downloaded libraries would be placed in this virtual environment and won't pollute my OS. And then I run `make`.


How to recover from desktop freeze without losing running windows?

Sometimes VirtualBox causes random freeze of my Mint 16 Cinnamon Desktop 64bit. I am not able to pinpoint what is actually wrong and even where to fill the bug report. But the life goes on and I need some means of re-initializing the windowing subsystem without losing the work I've done with existing applications.   * When I run `sudo service mdm restart` all the already running applications got killed brutally.   * The `cinnamon --replace -d :0` spell doesn't do anything; it just hangs. I guess it is because it need some form of co-operation with the already running cinnamon, which I guess doesn't respond to that.   * Commands entered with Alt+F2 are ignored, as well as the "r" command used to restart the Cinnamon. The screen is not updated, and it seems that the very keystrokes are ignored. What are my other options? * * * Symptoms of the freeze: The bug manifests by just freezing the screen update of the graphic terminal; the mouse moves alright, it even changes the icon when hovering over different parts of the screen. The problem is that I can't do anything with it; besides the screen doesn't update, and the keyboard don't do anything as well. But I can switch to the text console and I can see, that the windows' processes run well. I can event interact with the applications, that supply some form of cli interactions (like VBoxManage). To reproduce:   1. Install the Linux Mint 16 with Cinnamon 2.0 64 bit   2. Install a program that changes wallpaper (tested on variety, and wallch) and set it to start changing wallpaper as the background task.   3. Wait for background to change several times. The bug doesn't kick in on the first background change, you need to wait a moment.    4. On the .xsession.errors you will see something like that. * * * Edit: I've updated the symptoms. The time went by and I was able to triage the problem a lot better. It is NOT related to VirtualBox activity in any way.


mkfs.xfs /dev/custom_dev

I try to format a custom block device with `mkfs.xfs` in Ubuntu Server 12.04 LTS. In the end terminal prints:               cache_node_put: node put on refcount 0 (node=0x1cd7810)       cache_node_put:node put on node (0x1cd7810) in MRU list      and fails. I do not have any problem with the other filesystems such as `ext2`. Only `xfs` returns that. `dmesg` prints               segfault at 10 ip ........ sp ..... error 4 in libc-2.15.so[...]      The full command is `sudo mkfs.xfs /dev/custom_dev`. When I use the same command with the `-f` flag, the terminal prints at the end:               *** glibc detected *** mkfs.xfs: free(): invalid pointer: 0x0000000002431600 ***     *** glibc detected *** mkfs.xfs: malloc(): memory corruption: 0x000000000243170 ***      I use Ubuntu Server 12.04 LTS. The full command is "sudo mkfs.xfs /dev/custom_dev". When i use the same command with flag -f (sudo mkfs.xfs -f /dev/custom_dev) the terminal prints in the end "* glibc detected mkfs.xfs: free(): invalid pointer: 0x0000000002431600 glibc detected mkfs.xfs: malloc(): memory corruption: 0x000000000243170 * and does not return(unless i hit ^C) I tested mkfs.xfs in another device and i have no problem. The problem remains in custom_dev only in which i use a simple device driver i wrote on my own. The custom_dev does not seem to have any problem with ext2. Only with xfs. Any ideas?


Remove multiple possible suffixes

Example: I want to create a quick command to shrink images (for my filebrowser).               ...     FN="/tmp/some-image.jpg"     gm convert "$FN" -resize 50% "$(dirname $FN)/$(basename $FN .jpg/png/gif).jpg"     ...      How can I specify that more than one suffix should be stripped?


objdump Vs sh4-linux-objdump

I need this command (sh4-linux-objcopy) in RHEL 6. I could not find the package by `yum install` , neither there is a corresponding rpm. Here is how I want to use it:               sh4-linux-objdump -h vmlinux | grep .empty_zero_page | awk '{print $4}'      But `objdump` is installed and works fine. So is there any difference between `objdump` and `sh4-linux-objdump` and what is `sh4-linux-`


RHEL - not able to write in /opt as root

I am trying to copy a virtual box image inside **/opt** folder in _RHEL 5.6_. I am logged in as the _root_ and I strangely see that I am not able to write anything into **/opt** folder. I checked the permissions from other machines in the lab and see that the permissions are set correctly. However, in the **/etc/fstab** file in all the remaining machines (where everything is correct and working fine), I see the below entry.               LABEL = /home1 /opt ext3 defaults 1 2      In the faulty machine where **/opt** directory is not writable, I see the **/etc/fstab** file entry as,               LABEL = /home /opt ext3 defaults 1 2      I am quite new to system administration and I believe it has to do something with the improper mounting of the file system as read only. I checked the **dmesg** for any errors but was not able to understand it. I think I have to remount the **/opt** with the proper settings. But I don't want to do anything in the lab to disturb the current setup. I just wanted to know if my understanding is correct and, is it the missing " **1** " in **/etc/fstab** file causing the **/opt** to be read only? **EDIT:** After I run the mount command, The output from the faulty machine,               /dev/sda2 on / type ext3 (rw)     proc on /proc type proc (rw)     sysfs on /sys type sysfs (rw)     devpts on /dev/pts type devpts (rw,gid=5,mode=620)     /dev/sda5 on /opt type ext3 (rw)     /dev/sda1 on /boot type ext3 (rw)     tmpfs on /dev/shm type tmpfs (rw)     none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)     sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)     XXXserver.XXX.XXX:/opt/vbox_image on /opt/vbox_image type nfs (rw,addr=192.168.1.10)     nfsd on /proc/fs/nfsd type nfsd (rw)      The output from the correct machine               /dev/sda2 on / type ext3 (rw)     proc on /proc type proc (rw)     sysfs on /sys type sysfs (rw)     devpts on /dev/pts type devpts (rw,gid=5,mode=620)     /dev/sda5 on /opt type ext3 (rw)     /dev/sda1 on /boot type ext3 (rw)     tmpfs on /dev/shm type tmpfs (rw)     none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)     sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)     ascentserver.uta.edu:/opt/vbox_image on /opt/vbox_image type nfs (rw,addr=192.168.1.10)     **none on /proc/fs/vmblock/mountPoint type vmblock (rw)**     nfsd on /proc/fs/nfsd type nfsd (rw)      **EDIT 2:** If I run the command, `for i in $( cat /proc/partitions | awk '{ print $4 }' ) ; do e2label /dev/$i ; done`, I get the below output. I am not able to debug this output.               e2label: No such file or directory while trying to open /dev/name     Couldn't find valid filesystem superblock.     e2label: Bad magic number in super-block while trying to open /dev/sda     Couldn't find valid filesystem superblock.     /boot1     /1     e2label: Bad magic number in super-block while trying to open /dev/sda3     Couldn't find valid filesystem superblock.     e2label: Attempt to read block from filesystem resulted in short read while trying to open /dev/sda4     Couldn't find valid filesystem superblock.     /home      **EDIT 3:** The `ls-l` command on /opt directory shows I have rwx permission on all the files inside it. However, I tried creating a simple text file and it was not allowing me to create the file.


Where is <libraryname>.pc?

1. When installing a library with `configure`, `make` and `make install`, does `make install` copy `<libraryname>.pc` to some place?     * If yes: Where is it?     * If no: Should we copy it somewhere rather than leave them where they are?    2. I am asking that, because on an old notebook of mine, I saw: > add the directory containing `libraryname.pc` to the PKG_CONFIG_PATH > environment variable, so that `pkg-config --clags libraryname` and `pkg- > config --libs libraryname` can find them.   3. Will `dpkg -l` be able to track the installed library depending on whether it's path was added to `PKG_CONFIG_PATH`?   4. Once I copy `<libraryname>.pc` to some place, will `dpkg -l` be able to track the installed packages?


Why does `tmux` copy operation always output temporary gibberish to the terminal?

If I complete a copy operation using `tmux`, I always get one or more lines of gibberish written to my screen, which goes away when I change windows or do a paste. Why does this happen, and can it be disabled?


Focusrite Scarlett 8i6 With linux mint

I have a focusrite scarlett 8i6 soundcard and I would like to make many sounds with it. Currently it's deadly silent and I want to crack on with some programming whilst listening to music! I usually go for a very standard Ubuntu install, but thought I would give Linux Mint a try, but the soundcard doesn't seem to work currently. After some fiddling with Linux Mint I've actually made it recognise the soundcard. `cat /proc/asound/cards`:                1 [USB            ]: USB-Audio - Scarlett 8i6 USB                       Focusrite Scarlett 8i6 USB at usb-0000:00:14.0-1, high speed      I've blacklisted the onboard soundcard, but now I'm not sure how to use this one. It isn't picked up in sound preferences, by default that just has a dummy output now. I've got `pulseaudio`, `alsa` and `jack` installed, but have no idea how to actually get any or all of those working together. Some other info:               # /sbin/lsmod | grep snd     snd_usb_audio         149200  0        snd_usbmidi_lib        25070  1 snd_usb_audio     snd_hwdep              13602  1 snd_usb_audio     snd_seq_midi           13324  0      snd_seq_midi_event     14899  1 snd_seq_midi     snd_rawmidi            30095  2 snd_usbmidi_lib,snd_seq_midi     snd_seq                61560  2 snd_seq_midi_event,snd_seq_midi     snd_pcm               102033  1 snd_usb_audio     snd_seq_device         14497  3 snd_seq,snd_rawmidi,snd_seq_midi     snd_page_alloc         18710  1 snd_pcm     snd_timer              29433  2 snd_pcm,snd_seq     snd                    69141  9                         snd_usb_audio,snd_hwdep,snd_timer,snd_pcm,snd_seq,sn     d_rawmidi,snd_usbmidi_lib,snd_seq_device,snd_seq_midi     soundcore              12680  1 snd      I've also updated `/etc/modprobe.d/alsa-base.conf`:               options snd-usb-audio index=0      `aplay --list-devices`:                **** List of PLAYBACK Hardware Devices ****      card 1: USB [Scarlett 8i6 USB], device 0: USB Audio [USB Audio]       Subdevices: 1/1       Subdevice #0: subdevice #0      * * * I don't really know much about pulseaudio, other than the basic of what it does. But the soundcard doesn't seem to be picked up by it.               pacmd list-cards     Welcome to PulseAudio! Use "help" for usage information.     >>> 0 card(s) available.      For completeness the output of speaker test               speaker-test 1.0.27.1          Playback device is default     Stream parameters are 48000Hz, S16_LE, 1 channels     Using 16 octaves of pink noise     Rate set to 48000Hz (requested 48000Hz)     Buffer size range from 192 to 2097152     Period size range from 64 to 699051     Using max buffer size 2097152     Periods = 4     was set period_size = 524288     was set buffer_size = 2097152     0 - Front Left     Time per period = 12.425529      But still no sound. Any suggestions? *********UPDATE************* Command: amixer -c 0 contents               numid=1,iface=MIXER,name='Scarlett 8i6 USB-Sync'       ; type=ENUMERATED,access=rw------,values=1,items=2       ; Item #0 'Internal'       ; Item #1 'S/PDIF'       : values=0


How to apply a patch correctly?

I am trying to patch a linux 3.13.7 source tree to 3.13.8 using the `patch-3.13.8.xz` file. Since the patch file is in `xz` format, I used the following command to apply it while in the source tree:               unxz -cd ../patch-3.13.8.xz | patch -p1      But I receive:               Reversed (or previously applied) patch detected!  Assume -R? [n]      I have checked `man patch` for the `-R` flag and the description makes no sense to me. Can someone please explain what is going on and what I need to do to fix this?


How do I copy multiple files by wildcard?

I have a folder with a number of files in it ABC.* (there are roughly 100 such files). I want to duplicate them all to new files with names starting with DEF.* So, I want               ABC.Page1     ABC.Page2     ABC.Topic12     ...etc      copied to               DEF.Page1     DEF.Page2     DEF.Topic12     ...etc      What is the simplest way to do this with a batch command (in BASH or similar)? I am thinking something involving sed or awk or xargs, but I'm having difficulty figuring out the syntax. I could write a Python script, but I'm thinking there is probably a command line solution that is not too complicated.


mv on a glob pattern does not work without sudo

I am using **MySQL** database on **Ubuntu** machine. My **MySQL** data directory is `/var/lib/mysql/` , since I have a database named " **db_test** " , so, I have a directory named `db_test/` under `/var/lib/mysql/` . And all the table info are under `/var/lib/mysql/db_test/`               /var/lib/mysql# ls     db_test          /var/lib/mysql# cd db_test     /var/lib/mysql/db_test# ls     cars.frm     cars.MYD     cars.MYI     customers.frm     customers.MYD     ...      What I want to achieve is very simple, just make a new directory named " **backup** ", and **move all files under** `/var/lib/mysql/db_test/` to the `/var/lib/mysql/backup/` directory. So, I run the following commands under **a sub-directory of my home directory** :               ~/tmp$ sudo mkdir /var/lib/mysql/backup     ~/tmp$ sudo mv /var/lib/mysql/db_test/* /var/lib/mysql/backup      The 1st `mkdir` command run successfully, I did get a new directory named "backup/" under `/var/lib/mysql/` **But the 2nd command get failed** , with the following error message:               mv: cannot stat `/var/lib/mysql/db_test/*': No such file or directory      Why?? I have `db_test/` directory under `/var/lib/mysql/` and many table files inside, why it raise the error message? **P.S.** I know only root user can access `/var/lib/mysql/`. Could it be the reason? (but I used `sudo`), I am not sure though... and how to get rid of it?


Grep alias - line numbers unless it's in a pipeline

I want to create a bash alias for grep that adds line numbers:               alias grep='grep -n'      But that, of course, adds line numbers to pipelines as well. Most of the time (and no exceptions come to mind) I don't want line numbers within a pipeline (at least internally, probably OK if it's last), and I don't really want to add a sed/awk/cut to the pipeline just to take them out. Perhaps my requirements could be simplified to "only add line numbers if grep is the only command on the line." Is there any way to do this without a particularly ugly alias?


Add/update a file to an existing tar.gz archive?

Is there a way to add/update a file in a tar.gz archive? Basically, I have an archive which contains a file at `/data/data/com.myapp.backup/./files/settings.txt` and I'd like to pull that file from the archive (already done) and push it back into the archive once the edit has been done. How can I accomplish this? Is it problematic because of the `.` in the path?


Has anyone got any performance numbers comparing IIS and .NET to Cherokee and Mono?

I am setting up a development server and want to set it up to serve ASP.NET pages using Mono. I am planning on using Cherokee and Mono (http://www.cherokee-project.com/doc/cookbook_mono.html) and wondered if anyone had done any performance testing comparing the Unix based stack to the Windows based.


How do I set the default ftp root folder for an Ubuntu user connecting to VSFTPD?

How do I set/change the default ftp root folder for a specific user? I want to be able to create a developer account that homes to different sites on a development box depending on what is currently being worked on. EDIT: The server is running Ubuntu and vsftpd.


I have downloaded and un-tarred zsh, what do I do next

I am running Linux Fedora 20, and have downloaded and un-tarred `tar -jvxf zshell/zsh-5.0.5.tar.bz2`, and now have what looks like the correct directory, as in the following listing which also shows what happens when I try `make`.               [1156][root@localhost:/home/Harry/zsh-5.0.5]# ls     aclocal.m4  config.guess  Doc        install-sh   Misc           Src     aczsh.m4    config.h.in   Etc        LICENCE      mkinstalldirs  stamp-h.in     ChangeLog   config.sub    FEATURES   MACHINES     NEWS          StartupFiles     Completion  configure     Functions  Makefile.in  README         Test     Config      configure.ac  INSTALL    META-FAQ     Scripts        Util     [1156][root@localhost:/home/Harry/zsh-5.0.5]# make     make: *** No targets specified and no makefile found.  Stop.      So, please what do I do to complete the installation of zshell?


Find the files algorithm

I'm using Linux (Ubuntu 12.04). I'm trying to know how 'find' command works. My question is, how can I run and test the C files for 'find' which I downloaded from the GNU findutils ?


xmodmap causes incorrect keyboard shortcuts

I used `xmodmap` to switch the Caps Lock and Ctrl keys on my Thinkpad X120e. The keys are swapped but this has caused keyboard shortcuts in several applications to stop working correctly. In Libre Office `Ctrl+Shift+s` no longer works (but `Ctrl+s` and `Ctrl+Shift+v` do). `Ctrl+Shift+S` is also broken in `emacs` (where I have it mapped to save as) and `Ctrl+N` and `Ctrl+Shift+N` have swapped purposes (new buffer and new frame). My `.xmodmap` file looks as follows:               remove Lock = Caps_Lock     remove Control = Control_L     keysym Control_L = Caps_Lock     keysym Caps_Lock = Control_L     add Lock = Caps_Lock     add Control = Control_L      I used the same file on my desktop (also running Debian Wheezy) and did not experience these problems.


Why is 'df' hanging?

I have recently been having problems running `df`, where it just _hangs_. Here's `strace` output, and in it, you'll see that I killed since it was just sitting there:               $ strace /bin/df     execve("/bin/df", ["/bin/df"], [/* 35 vars */]) = 0     brk(0)                                  = 0x8d03000     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7840000     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY)      = 3     fstat64(3, {st_mode=S_IFREG|0644, st_size=90781, ...}) = 0     mmap2(NULL, 90781, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7829000     close(3)                                = 0     access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)     open("/lib/i386-linux-gnu/i686/cmov/libc.so.6", O_RDONLY) = 3     read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240o\1\0004\0\0\0"..., 512) = 512     fstat64(3, {st_mode=S_IFREG|0755, st_size=1401000, ...}) = 0     mmap2(NULL, 1415544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb76cf000     mprotect(0xb7822000, 4096, PROT_NONE)   = 0     mmap2(0xb7823000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x153) = 0xb7823000     mmap2(0xb7826000, 10616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7826000     close(3)                                = 0     mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76ce000     set_thread_area({entry_number:-1 -> 6, base_addr:0xb76ce8d0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0     mprotect(0xb7823000, 8192, PROT_READ)   = 0     mprotect(0xb785e000, 4096, PROT_READ)   = 0     munmap(0xb7829000, 90781)               = 0     brk(0)                                  = 0x8d03000     brk(0x8d24000)                          = 0x8d24000     open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3     fstat64(3, {st_mode=S_IFREG|0644, st_size=1534656, ...}) = 0     mmap2(NULL, 1534656, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7557000     close(3)                                = 0     open("/etc/mtab", O_RDONLY)             = 3     fstat64(3, {st_mode=S_IFREG|0644, st_size=708, ...}) = 0     mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb783f000     read(3, "/dev/sda6 / ext4 rw,errors=remou"..., 4096) = 708     read(3, "", 4096)                       = 0     close(3)                                = 0     munmap(0xb783f000, 4096)                = 0     statfs64("/", 84, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=4805813, f_bfree=3325193, f_bavail=3081072, f_files=1220608, f_ffree=1007617, f_fsid={-1624337824, -871214780}, f_namelen=255, f_frsize=4096}) = 0     open("/usr/share/locale/locale.alias", O_RDONLY) = 3     fstat64(3, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0     mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb783f000     read(3, "# Locale name alias data base.\n#"..., 4096) = 2570     read(3, "", 4096)                       = 0     close(3)                                = 0     munmap(0xb783f000, 4096)                = 0     open("/usr/share/locale/en_ZA.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)     open("/usr/share/locale/en_ZA/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)     open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)     open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)     statfs64("/lib/init/rw", 84, {f_type=0x1021994, f_bsize=4096, f_blocks=1280, f_bfree=1280, f_bavail=1280, f_files=215959, f_ffree=215956, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0     statfs64("/run", 84, {f_type=0x1021994, f_bsize=4096, f_blocks=102000, f_bfree=101823, f_bavail=101823, f_files=215959, f_ffree=215559, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0     statfs64("/sys", 84, {f_type="SYSFS_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0     statfs64("/dev", 84, {f_type=0x1021994, f_bsize=4096, f_blocks=508762, f_bfree=508762, f_bavail=508762, f_files=213490, f_ffree=213031, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0     statfs64("/run/shm", 84, {f_type=0x1021994, f_bsize=4096, f_blocks=203999, f_bfree=203816, f_bavail=203816, f_files=215959, f_ffree=215955, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0     statfs64("/dev/pts", 84, {f_type="DEVPTS_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0     statfs64("/boot", 84, {f_type="EXT2_SUPER_MAGIC", f_bsize=1024, f_blocks=188403, f_bfree=150550, f_bavail=140822, f_files=48768, f_ffree=48525, f_fsid={-655942775, 1382872797}, f_namelen=255, f_frsize=1024}) = 0     statfs64("/home", 84, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=66535124, f_bfree=6683145, f_bavail=3303357, f_files=16900096, f_ffree=16633097, f_fsid={-515912651, 307591087}, f_namelen=255, f_frsize=4096}) = 0     statfs64("/sys/fs/fuse/connections", 84, {f_type=0x65735543, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0     statfs64("/home/wena/temp/mount", 84, ^C <unfinished ...>      Another tool that fails is `gnome-system-monitor`, which also seems to hang immediately after being launched.


Proper way to distribute shell scripts

What is the most proper way to distribute shell scripts, if behaviours of shells can be modified by `set` and thus are unpredictable? For example, `rm *.txt` wouldn't be executed as expected on the environments in which `set -f` has been run. How should I make sure that `rm *.txt` removes all text files in a current directory in any environments? How should I make that sure that shell scripts will run as expected before distributing them in general?


How to update MOTD regularly?

Every week there's a new work log/to-do list at work. There's a `todo` script which can be used to extract my own to-do items from that. Currently this is called in `~/.bash_aliases_local`, which is sourced from `~/.bash_aliases`. Rather than parsing the log every time I start another shell, I'd like to use the standard MOTD (message of the day) functionality. This would involve updating a static file with the to-do list on a weekly basis:               @weekly update-motd      The resulting static text file should be printed every time I start an interactive Bash shell. What's the standard way to do this?


Functional shell scripting

I found out that when I want to create some shell script or advanced command it always made me trouble to remember the names of the commands and their switches. e.g.               tr -d '\n' < file | wc -c      Though in programming languages I could write something like > len(replace(str(file), "\n", "")) Which is more memorable and there is less probability to search in man pages and it's more understandable for others. So, why shell scripting is for so many years in this cryptic form? Is their an effort to change the syntax to be clear what the code does without a lot of man pages studying? Are there some advantages of this form? How can we cope with the disadvantages to get most from the shell scripting?


How to print the next crontab tasks to be executed?

Is there some way to display a list of the approaching task executions? That is, translate this crontab:               # m h  dom mon dow   command       * *  *   *   *     imapfilter       4 20 *   *   Sun   fgit gc -- ~/*/ ~/.*/ ~/dev/*/      into this:               2012-04-12 14:40 imapfilter     2012-04-12 14:41 imapfilter     ...     2012-04-15 20:03 imapfilter     2012-04-15 20:04 fgit gc -- ~/*/ ~/.*/ ~/dev/*/     2012-04-15 20:04 imapfilter     2012-04-15 20:05 imapfilter     ...      It would be useful for verifying the saved schedules.


logging session with 'script' - how later read it?

I log my terminal session with `script`. As we know, it contains all characters that were send to terminal, including control ones, like backspaces etc. This makes output file a kind of unreadable, therefore: What's the best way to later read output of `script`? (so it looks more like terminal after finished session)


Tilde (~) inside working unix directory

So, Im working in a UNIX environment and I noticed that inside my working directory, which is miles miles away from my UNIX home, there is a `~`. Now, once in the past, I did `rm -rf ~` from my working directory and ended up erasing my home directory completely and had to involve IT. I do not want to do it again. At the same time, I want to know   1. Why is `~` created in my working directory? Is it a faulty finger slip while saving (`:w!` but what happens is `:w~` ?!!)   2. Before checking in, there is a script that looks for extra files or folders that p4 is not aware so def this `~` might cause an issue. So how can I remove the `~` from my working directory and at the same time not erase my home? I do have a backup command called `del` that I use instead of `rm -rf`. It just places stuff in a temporary location. I could use that and get rid of the `~`. But I'm more interested in knowing why this happens, and how I can remove it?


Flash Player on Linux

I'm going to switch to Linux with my new computer. I've read something weird about Firefox not supporting Flash on Linux (Chrome seems to support it, but I wouldn't want to switch if possible). The only sites I remember that I visit that use Flash are Youtube (with which I have no problem because I suppose it'll work fine with HTML5 (it'll work even better, because now with flash player I can't use the HTML5-only half speed configuration) and minigame sites (which I suppose it won't work anymore, but that's no big deal). However, will this affect other sites I can't remember now? Just to be sure, is there any good alternative? (I've heard about Lightspark and Gnash, but they say that they aren't very good).


Why do I need to insert the passphrase for an RSA key on a remote host after SSH?

From host **B** I can SSH various other hosts ( **C, D** ) without using any password as I put the public key in the correspondent authorized_keys files (in hosts C and D). From host **A** I can SSH host **B** (via _password_ authentication). However, once I am logged into host **B** I _need to authenticate my key each time_ when I connect to C and D (even if in principle this should not be the case). To summarize, if I connect directly to host B (e.g office) I do not need to type any password to connect to C or D. If I connect to A (e.g. home) and then from A I connect to B, once I am in B I need passwords to connect to D or C. I can partially solve the problem by adding the password to an ssh-agent (using ssh-add), but every time I open a new shell in B I need to do this again. **Update** Thanks to the useful comments, it turned out that the problem is the following. When I connect directly to B there is a keyring program running (in my specific case this is seahorse). Therefore the passwords of all encrypted private keys can be used automatically. When I connect to B from A this does not happen. For a mysterious reason even if I start a remote session (vnc / remmina) from A to B the program seahorse is not active in B and hence I have to manually insert the passwords over and over. I installed **keychain** and the problem has been solved. However, I am not sure if it is worth to encrypt a private key which is only used for SSH connection to a specific server. **Is there any concrete security risk by not encrypting the private keys?** In principle if one is able to access the private key he/she is also able to use the passwords stored in the keychain...so it seems that there might not be a big advantage in encrypting the private keys.