Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two questions.

Q1. I read a article http://www.thegeekstuff.com/2014/05/linux-keybindings/comment-page-1/#comment-1750752 in this cntrl+/ works perfectly fine for redoing the last undone edit but Cntrl+? doenot. My system details are

[mike@localhost rshare]$ lsb_release -a
LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Release:        5.4
Codename:       Tikanga

and terminal setting are

[mike@localhost rshare]$ stty
speed 9600 baud; line = 0;
erase = ^H;
-brkint ixoff -imaxbel

Please provide good reference for bash keyboard shortcut.

Q2. $ echo * prints all the files in the current directory while $ echo . simply prints "." (without quotes).My question is why it not prints all the files including hidden files in the current directory?

share|improve this question

closed as off-topic by Michael Kjörling, Dave M, Linker3000, harrymc, Sathya May 24 at 8:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – Michael Kjörling, Dave M, harrymc, Sathya
If this question can be reworded to fit the rules in the help center, please edit the question.

To print hidden files you need to do echo .* –  fedorqui May 22 at 12:15
Welcome to Super User. It appears that in this question you are asking multiple, separate questions. The Stack Exchange Question and Answer format works best when each question focuses on a single issue to which an authoritative answer can be given and where the answer can be judged on its technical merits. You don't need to know what the answer is, but one should be possible. I suggest that you edit this question to focus on a single issue that can be answered within a few paragraphs. –  Michael Kjörling May 22 at 12:19

1 Answer 1

1. Keybindings

As suggested in that article, bind -p lists keybindings.

$ bind -p | egrep 'redo|undo'
"\C-x\C-u": undo
"\C-_": undo
# vi-redo (not bound)

Note that bash has vi-mode and emacs-mode. Keys behave differently depending on which modes you have selected.

2. shell wildcard expansion

. isn't a shell wildcard (it is a metacharacter in regular expressions though). Instead I would use

echo .*


echo .??*

because I'm usually not interested in . and .. and don't have hidden files with tiny names.

Michael Kjörling pointed out a superior pattern:

echo .[^.]*

which is only a couple of characters more to type.

share|improve this answer
I often use the shell glob pattern .[^.]* which gives me all dotfiles except . and ... (It works by matching the first dot literally, the next character must be anything but a dot which also excludes anything that is not at least two characters including the initial dot, and then any number of characters following that.) –  Michael Kjörling May 22 at 12:46
@Michael: Thanks for pointing that out. Answer updated accordingly. –  RedGrittyBrick May 22 at 20:58
And here's another one, just because I can, though I'm not sure how portable it is (it works with GNU bash 4.2.37). If you really want everything in a single shell glob pattern and can't rely on shopt dotglob being set for some reason, then at least in bash {,.}[^.]* gives you that. Now we're really getting into the interesting parts of shell glob expansion; it works the same as the one I mentioned earlier, really, except {,.} expands to both the empty string as well as ., so you effectively get [^.]* (all non-dotfiles) and .[^.]* (all dotfiles except . and ..) at once. –  Michael Kjörling May 23 at 7:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.