LinuxQuestions.org
Visit Jeremy's Blog.
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 11-11-2007, 08:41 PM   #1
mibo12
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Rep: Reputation: 0
Standard commands give "-bash: open: command not found" even in "su -" and "su root"


Hi,

I am very new to Linux and the command line, so I apologize for my ignorance.

As the subject says, I cannot do simple commands such as "open" and "creat" in the text editor. I had an earlier problem with "ifconfig", but that was solved by the "su -" / "su root" fix. A "man open" / "man creat" indicates that the commands exist, but I still get the error "-bash: open: command not found". Why is this? Did I do something wrong?
 
Old 11-11-2007, 09:02 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
open isn't a shell command or a program name, it is a system call. Ultimately all normal programs are implemented using these operations, but in the case of shell script this is hidden from the user (as it is very fiddly). The shell provides a simpler interface for doing file operations than open and friends.

When you read a manual page, check the section number (in brackets after the page name at the top left). Section 1 documents commands and programs which can be used from the shell, section 2 documents system calls (like open). Section 3 documents library calls (again, these can be used from C programs). See the man manual page for a list of what all the sections contain.

For example, if you want to read the contents of a file line by line, you don't explicitly open it, you use standard input re-direction, like this:
Code:
while read line; do echo "I read this: $line"; done < input_file
Which will read lines from the file "input_file" and print each one, prefixing each line with "I read this: ".

To get an idea of how to program in the shell, I recommend having a read a shell tutorial. Don't be discouraged - it can seem a little intimidating at first, but if you can spend some effort to learn it, you will be able to do all sorts of cool stuff with ease which is a massive pain to do in other ways.

Have a look here: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html

This re-direction thing I mentioned above will hopefully be a lot clearer after you've read that part of the guide. Learn what it means: stdout, stdin, stderr, redirection.
 
Old 11-11-2007, 09:24 PM   #3
mibo12
LQ Newbie
 
Registered: Nov 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks!

Thank you very much for your help. Your information was very informative. After wikipedia'ing System call, I have a clearer understanding of what you are trying to say. However, I am still murky about the idea of "shell command" - it's limitations, what is hidden from me etc..

Again, thank you!
 
Old 11-11-2007, 10:00 PM   #4
Bernard Swiss
LQ Newbie
 
Registered: Sep 2007
Location: Just outside Vancouver, Canada
Distribution: Debian (for now)
Posts: 25

Rep: Reputation: 15
I'm going to assume that you're looking for the really basic stuff, which is usually refered to as "linux command-line" rather than the "linux shell" -- in fact you could consider the command-line as a part of the shell for direct, interactive use.

So you might want stuff like this, for complete beginners who just want to know who to "get around" in the shell:

http://www.physics.ubc.ca/mbelab/com...ml/basics.html -- basics, and some common tasks

http://linuxcommand.org/ -- the basics, and then building on it...

Opening files is usually a job for some specific program or utility -- for example a text-editor, an image viewer, etc. there are usually multiple command-line versions of such programs, and unix/linux-style programs are often written to permit being access from the command-line, and GUI programs are frequently just "front-ends" for one or several command-line utilitis or programs.

Last edited by Bernard Swiss; 11-11-2007 at 10:02 PM.
 
Old 11-11-2007, 11:18 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,174

Rep: Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784
You can google for the meaning of a shell but in a nutshell (pun intended) it is basically an application that allows one to interface with the operating system. You will see it referenced as command line interface (CLI), console or sometimes terminal. In windows the shell application is cmd.exe (command prompt window) for anything NT and newer or command.com for windows ME and older. In linux there are many but BASH (Bourne Again shell) is typically the default installed shell. There are internal commands which are built in to the shell or external commands. An external commands are nothing more then programs like ifconfig. Whether it be a BASH script or a c compiled application.

Quote:
it's limitations, what is hidden from me etc
Not sure I understand the question.

Again you can find out lots of information by googling.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 6 03-21-2013 11:35 AM
"clear" and "reset" bash commands broken AviJacobson Linux - General 6 07-03-2006 07:28 AM
"clear" and "reset" bash commands broken AviJacobson Linux - Software 1 06-29-2006 03:31 PM


All times are GMT -5. The time now is 01:43 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration