LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-22-2010, 10:41 AM   #1
rayandrews
Member
 
Registered: Sep 2010
Posts: 78

Rep: Reputation: 2
Bashing bash


Hi all,

So ... Linux is the true computer lovers OS. Why then is bash so primitive? If 4DOS was a Rolls Royce, bash would be a Lada, and even command.com would be a Pinto. Even command.com has smart command recall but with bash you have to cycle through everything to recall a specific command. 4dos is so elegant, so easy to use, so convenient, so powerful -- why can't we have the same, or better, in Linux? Bash looks and feels like something written in machine language in 1950 to run on ENIAC.
I know there's *power* there, but ease of use is not.

Am I missing something?
 
Old 09-22-2010, 10:44 AM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Bash commands can be input by simply typing in some of the command and then hitting tab. DOS never had that. The command line in Linux (or any *nix) blasts all of the Microsoft command line and GUIs out of the water. You can also see (IIRC) up to 150 of the last commands entered simply by hitting the up arrow key.

What are you trying to do that is getting you so frustrated?
 
1 members found this post helpful.
Old 09-22-2010, 06:14 PM   #3
rayandrews
Member
 
Registered: Sep 2010
Posts: 78

Original Poster
Rep: Reputation: 2
Xavier,

I know there's probably more to bash than I've discovered so far, but right out of the box, what bugs me is not having (it seems) smart recall, i.e being able to type the first few letters of a previous command, at which point TAB cycles through all the commands in history that start with *that* sequence -- not through *all* the commands.

BTW, some other dudes I hang around with thought I was being rude above. I hope not! I'm just being honest about my first impressions of things. Like so much of Linux, the learning curve might be very steep but the view from the top could be marvelous.
 
Old 09-22-2010, 07:15 PM   #4
rupertwh
Member
 
Registered: Sep 2006
Location: Munich, Germany
Distribution: Debian / Ubuntu
Posts: 297

Rep: Reputation: 49
Try hitting Ctrl-r, then start typing.
 
1 members found this post helpful.
Old 09-22-2010, 07:56 PM   #5
rayandrews
Member
 
Registered: Sep 2010
Posts: 78

Original Poster
Rep: Reputation: 2
rupertwh,

Well that's almost good enough, thanks. But I'd still prefer to just type a few letters and press the up arrow, like in DOS.
Nevermind, getting used to something new is almost always a chore.
 
Old 09-22-2010, 07:58 PM   #6
rayandrews
Member
 
Registered: Sep 2010
Posts: 78

Original Poster
Rep: Reputation: 2
... and now that I try it a few more times, it's rather interesting that you can search for characters anywhere in the command string, not just at the start. I'll try to find some 'bash for DOS lovers' tutorial that will walk me through this sort of thing.
 
Old 09-22-2010, 08:06 PM   #7
kurumi
Member
 
Registered: Apr 2010
Posts: 228

Rep: Reputation: 53
man bash. Go to "Readline" section...and read the rest on "History" ..etc
 
Old 09-23-2010, 03:28 AM   #8
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
Originally Posted by rupertwh View Post
Try hitting Ctrl-r, then start typing.
Thanks--I can't believe I've missed that well, never too late to learn something new I guess...

Quote:
Originally Posted by rayandrews View Post
If 4DOS was a Rolls Royce, bash would be a Lada, and even command.com would be a Pinto.
I don't know Pinto, but anywhere in the real world where temperature goes well below zero degrees Celsius (and everything warmer than that), a Lada would definitely be a better choice than Rolls Royce. Here RR wouldn't probably even start, or if it did, it probably asked to be left alone.. Not so with a Lada, so I guess your statement was accurate after all
 
Old 09-23-2010, 07:50 AM   #9
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
bash is definitely better than DOS. In fact, bash is probably more like a programming language that interprets as you type than a simple command line.

(BTW I didn't know about Ctrl+R either!)
 
Old 09-23-2010, 12:32 PM   #10
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Quote:
Originally Posted by rayandrews View Post
I know there's probably more to bash than I've discovered so far, but right out of the box, what bugs me is not having (it seems) smart recall, i.e being able to type the first few letters of a previous command, at which point TAB cycles through all the commands in history that start with *that* sequence -- not through *all* the commands.

Visit the website below
http://linux.101hacks.com/toc/

Scroll down to Chapter 8: Command Line History
and click Hack 51. Search the history using Control+R

This is a free book to help new users to linux. Somewhat dated, but still usable.

Even season linux users will pick up interesting tips and tricks.

PS: bash is not the only shell. There is csh, tcsh,ksh and zsh. But bash is the most popular.

- Cheers

Last edited by dv502; 09-23-2010 at 02:29 PM.
 
Old 09-23-2010, 02:44 PM   #11
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Ok, I might be missing something, but...

Isn't the feature you're looking for just the exclamation mark? For instance, suppose this sequence of commands (output omitted):
Code:
$ gcc -Wall -o run_me main.c parse.c output.c
$ ./run_me fileA fileB
$ diff fileA fileB
$ emacs output.c
$ !gcc
The last command ("!gcc") will run the most recently executed command in the shell history that starts with "gcc" (which, in this case, would be "gcc -Wall -o run_me main.c parse.c output.c")
 
Old 09-23-2010, 04:25 PM   #12
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986

Rep: Reputation: 53
Back to the original topic

Bash is integrated into Linux in as far as ideaology and in the "Linux data structure". It's like a built in Interpreter to configure your O.S which does make it like windows in that way. I believe you can use something like python but it's not "ready to go" like bash is. The Bash interface I have is temperamental which makes it hard to use but after you get used to its rickety interface is astounding of the commands you can run. Use the file search commands sometime and compare it to DOS. DOS stands for (Disc operated System). Just because the screen is black with green lettering does not mean you are using DOS. I think you have to go prior to Windows ME to actually be running the same Command terminal as you did when you had to load your O.S off of a floppy disk. When a non multi- tasking O.S is run it does have to be MS DOS etc.
 
Old 09-24-2010, 10:44 AM   #13
rayandrews
Member
 
Registered: Sep 2010
Posts: 78

Original Poster
Rep: Reputation: 2
All,

Thanks, '101 hacks' bookmarked. I love docs like that, they are cheat sheets for the real world problems you are likely to fall into.

I guess I'll get to love bash when I find it's power makes it's clunkyness endurable. OK it's not a Lada it's
a Union Pacific Big Boy locomotive, and about as easy to drive ;-)

http://en.wikipedia.org/wiki/File:40...d_20040426.jpg

But I still wish one could just type the first few letters of a previous command, press the up arrow and have that command back on the line, for editing. Rather like a combination of '!' and 'Ctrl + r', as you guys have mentioned above.
 
Old 09-24-2010, 12:01 PM   #14
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Quote:
Originally Posted by rayandrews View Post
Thanks, '101 hacks' bookmarked. I love docs like that, they are cheat sheets for the real world problems you are likely to fall into.
You're welcome...

BTW, in the Control+R hack example, this is not mentioned.

The author used red as the keyword in his example. Let's say it found one instance of red. To see if there are any more instances of red, just hit Control+R again and the next instance of red will display.

You can continue this until all instances of red has exhausted.

Quote:
Originally Posted by rayandrews View Post
But I still wish one could just type the first few letters of a previous command, press the up arrow and have that command back on the line, for editing. Rather like a combination of '!' and 'Ctrl + r', as you guys have mentioned above.
It's possible that maybe the other shells have this feature that you are seeking. The csh, tsch, ksh and zsh are all powerful shells in their own right.

Just curious, did you know when using the Control+R method, you can edit the command line by hitting the left-arrow keys before executing? if not, that is how it's done.

- Cheers

Linux Rules !!!

Last edited by dv502; 09-24-2010 at 02:00 PM.
 
Old 01-18-2011, 10:19 AM   #15
Juako
Member
 
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
Quote:
Originally Posted by MTK358 View Post
bash is definitely better than DOS. In fact, bash is probably more like a programming language that interprets as you type than a simple command line.
Hey, you could program in DOS too! Anyway the shell isn't "DOS", it was "command.com" and associated utilities. Though it was thousands of time more limited than bash or any other modern shell, i've seen (and sometime wrote) ridiculously complex stuff in "batch language", to give an example a fairly efficient virus that infected other batch files, or piping output to the "debug" program to assemble binaries on the fly (ok the virus could be bad morally, but technically it was kick-ass, besides never got out from my computer).

btw, ctrl-r is for searching "backward" in history, if it happens to you that you type it too fast and miss your command, ctrl-s will search "forward".

bind -p | grep history will show current key combos for history ops.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bashing my plumber... jsheffie Programming 6 04-04-2006 03:22 PM
Keyboard bashing!!! spedsta Linux - General 4 09-06-2004 10:55 PM
A little Microsoft bashing jimdaworm General 13 04-21-2004 04:06 PM
Emacs bashing guygriffiths Linux - Software 0 12-16-2003 06:20 AM
Linux Bashing lava General 2 03-26-2003 11:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration