Standard commands give "-bash: open: command not found" even in "su -" and "su root"
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?
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:
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.
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!
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.
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.
Again you can find out lots of information by googling.
|All times are GMT -5. The time now is 05:06 PM.|