Skip to Content.
Sympa Menu

baslinux - [BL] Shell Collection (was long filenames) 3D

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Lee Forrest <lforrestster AT gmail.com>
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] Shell Collection (was long filenames) 3D
  • Date: Thu, 1 Feb 2007 17:09:37 +0000

On Thu, Feb 01, 2007 at 08:26:10AM -0500, James Miller wrote:

> On Thu, Feb 01, 2007 at 09:58:11PM +1300,
> 3aoo-cvfd AT dea.spamcon.org wrote:
>
> > Greg Mayman wrote:
> >
> > > And doing dumb exercises from the linux CLI isn't going to
> > > help me either.
> >
> > I'm surprised to hear a DOS user refer to the command line as
> > dumb.
>
> I'm pretty attached to mc and feel disoriented on any Linux
> system that doesn't have it installed.

That would be most linux systems...

(You could carry a statically-compiled mc around with you, to
temporarily install on any system you needed to work on. Or do it
over the inet. I know people who do that with various apps they
can't live without.)

> I'm not going to get
> into the philosophical underpinnings of that, though, since I
> see it as largely an exercise in futility (if the aim is to
> convince anyone of something rather than just to explain why I
> do what I do).

>But there's one very fundamental and powerful secret to
>the command line that no one has yet pointed out yet to
>Greg. With it, doing dumb exercises can actually help one
>learn the command line quite quickly. What am I referring
>to? Command-line auto-completion. Let's say you want to do
>something from the command line, Greg, and you're not sure
>of the command. You have some ideas of what it could be, or
>perhaps a vague memory. Let's say it's editing a file, and you
>suspect that the command may begin with the letter "e."
>
> Enter "e" on the command line and then hit the tab key. You'll
> see one of two things: either Linux will complete what you've
> written and the necessary command will appear or, if there's
> more than one command on the system that starts with the letter
> "e," nothing will appear but the system beep will sound. In
> the second case, if you hit the tab key again, Linux (bash,
> actually) will list onscreen for you all the commands that
> begin with the letter "e." It should be obvious how you can
> learn what commands are on your system this way: you could go
> through the whole alphabet doing a similar thing. The only
> further observation on this I have time for is to point out
> that the more letters you enter for the desired command at the
> command line before hitting the enter key, the more likely it
> will be that auto-completion will work the first time (i.e.,
> will complete the command you want, as oppsed to showing you a
> list of possibilities). Auto-completion also works for entering
> directory and file names at the command line.
>
> It took me a year or two to learn about this, but it has proven
> quite indispensible since then.

That's an important feature of the shell. Like James, I use it _all_ the
time.

Another one is the commandline history.

Everything that you enter on the commandline gets recorded in
the history (there will be a limit on the number of entries) and
you can scroll back through that history with Ctrl-p and forward
again with Ctrl-n (or use the Up/Down-Arrow keys).

This can save you a lot of typing with long commands.

Here's something I find to be extremely useful, a simple shell function
(just a script, really). You put it in your /etc/profile.

cs () {
cd $1 && /bin/ls -Fs ;
}

What that does is combine cd and ls, so that you not only cd to the new
directory, but it automatically runs ls when you get there.

Until you reboot, you'll have to run the following command in each of the
windows/consoles you have up. It tells bash to reread /etc/profile:

. /etc/profile

To run the ls -Fs component on your current directory, do:

cs .

Lee


--
BasicLinux: Small is Beautiful
http://www.basiclinux.com.ru





Archive powered by MHonArc 2.6.24.

Top of Page