create new tag
, view all tags
Like dos / Windows (with doskey), Linux let's you scroll through old commands using the up and down arrows, optionally modify them and rerun them.

The similar facility in Linux is more capable, but varies depending on which shell you are using.

See also:




  • history to view a list of numbered commands previously run from by this user in this shell, but there may be slight variations between consoles

  • !<number> rerun the command with the given number in the history list

  • !! rerun the previous command

  • !<partial command string> rerun the most recent previous command that started with the same string

Actually, the commands don't rerun until you press enter.

Command Line Editing

(Maybe I should move this to CommandLineEditing

In some situations, you may find that the Home and End keys don't work as expected. The following keys may then be useful:

  • control-A (^A) - Home
  • control-E (^E) - End
  • control-D (^D) - Delete
  • control-K (^K) - "Delete the entire line from the cursor to the end. K=Kill. The line isn't actually deleted, but put into a temporary holding place called the "kill buffer"."
  • control-Y (^Y) - "Paste the contents of the kill buffer onto the command line starting at the cursor. Y=Yank."

Quoted text from OK. I've Logged in. What Now?

Shell Wild Cards

* and ? work pretty much as they do in dos, with some exceptions:

  • Globbing (which I won't try to explain -- I'll look up (again) later

  • There are some things that won't work as you'd expect from dos, and I think they are due to globbing -- again, can't immediately think of an example, but things something like the following don't work (haven't tried just now):

cp <filename>.* <new_filename>.*

Ok, I think I've got it:

Example: In dos / Windows, if you have a directory with these three files:

  • 1.txt
  • 1.bin
  • 2.txt

And issue the command copy 1.* 3.* you will end up with the following files:

  • 1.txt
  • 1.bin
  • 2.txt
  • 3.txt
  • 3.bin

In Linux, you will get an error message: "cp: copying multiple files, but last argument `3.*' is not a directory"

Now the reason for this and some hypotheses:

Reason (I'm speculating a little -- some of this I'm sure of, some of it is currently a (good?) guess):

In dos/Windows, each iteration of the command is done as a whole -- in other words, dos starts to run the command once, finds the first *, finds the first match, reads the rest of the line, finds the second *, and substitutes what it found in the first match, performs the command, then attempts to perform the command again, looking for another match.

In Linux, the shell sees the command, looks for things to match the *, and issues multiple commands to the shell, each with the matching string in place of the wild card. I.e., it will issue cp 1.txt 3.(??) and then cp 1.bin 3.(??).

Ok, writing this out (as above) made me decide the limit isn't what I've heard so many times, and maybe is what I was about to say anyway:

Linux seems to have a limit of one globbing character per line, while dos allows more than one. (Oops, not sure that's true either -- IIRC, Linux can do things like cp *baby?.txt to match all files that include baby?.txt ?? not sure -- need to test this now -- I'll be back. Yup, works as expected in Linux, and, surprise in dos (at least the dos in Win95) -- I thought in older versions of dos, as soon as it saw the first * it wouldn't pay any attention to anything else before the .txt -- in other words, a command like dir *1?.txt would return all files with a .txt extension instead of only those that included 1 followed by a single character. Wonder if I'm remembering wrong of if Win95 fixed that old problem?



See ResourceRecommendations. Feel free to add additional resources to these lists, but please follow the guidelines on ResourceRecommendations including ResourceRecommendations#Guidelines_for_Rating_Resources.


  • (rhk) [[][]]; ; -


  • () RandyKramer - 28 Feb 2003
  • <If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.>

Page Ratings

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2003-02-28 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look