Command which shell




















Manuals and documentation are available on-line. Go to our web site www. The following Shell commands give information. Files can be printed using shell commands, using the GUI print manager, or direct from some applications. Most commands which can be used to print files, expect the printer name to be given following a -P argument.

Files may be sent to the printers as simple text files or they may be processed in various ways for the laser printers. These commands are used to send and receive files from Campus Linux hosts and from other hosts on JIPS and the Internet, that permit such connections, around the world. TeX is a typesetting language used extensively in Linux and other operating systems for producing high-quality printed documents.

Another set of programs based on Troff is the standard Linux text formatting family used, for example to format manual pages. LibreOffice is available on the School's Linux systems and attempts compatibilty with Microsoft Office. Toggle navigation. Home Documentation Software Services Contact.

The Shell The Linux command interpreter or shell is the program users interact with in a terminal emulation window. Can I look further at what it is? In that case, you want to know what your shell does when you invoke the command without actually invoking the command. In shell scripts, it tends to be quite different. In a shell script there's no reason why you'd want to know where or what a command is if all you want to do is run it.

Generally, what you want to know is the path of the executable, so you can get more information out of it like the path to another file relative to that, or read information from the content of the executable file at that path.

Interactively, you may want to know about all the my-cmd commands available on the system, in scripts, rarely so. The early Unix shells until the late 70s had no functions or aliases. While the Bourne shell was first released in Unix V7 earlier in , function support was only added much later in SVR2 , and anyway, it never had some rc file the. Here you go: which came first for the most popular shell at the time and csh was still popular until the mids , which is the main reason why it got documented in books and is still widely used.

Note that, even for a csh user, that which csh script does not necessarily give you the right information. A similar functionality was not added to the Bourne shell until in SVR2 with the type builtin command. The fact that it is builtin as opposed to an external script means that it can give you the right information to some extent as it has access to the internals of the shell.

The initial type command suffered from a similar issue as the which script in that it didn't return a failure exit status if the command was not found. Unix Version 8's not released in the wild Bourne shell had its type builtin renamed to whatis and extended to also report about parameters and print function definitions.

It also fixed type issue of not returning failure when failing to find a name. The Korn shell a subset of which the POSIX sh definition is based on , developed in the mids but not widely available before , added many of the csh features line editor, aliases All of the Almquist shell ash , to be replacement of the Bourne shell in BSDs , the public domain implementation of ksh pdksh , bash sponsored by the FSF , zsh came out in-between and Ash, though meant to be a replacement for the Bourne shell, didn't have a type builtin until much later in NetBSD 1.

There are dozens of implementations of a which command on various Unices with different syntax and behaviour. On Linux beside the builtin ones in tcsh and zsh we find several implementations. There is a GNU which which is probably the most extravagant one. It tries to extend what the which csh script did to other shells: you can tell it what your aliases and functions are so that it can give you a better answer and I believe some Linux distributions set some global aliases around that for bash to do that.

So again, that answers a different need. UNIX specifies the type command no option. That's all where , which , whence are not specified in any standard. Up to some version, type and command -v were optional in the Linux Standard Base specification which explains why for instance some old versions of posh though based on pdksh which had both didn't have either.

If you have an alias or function defined for it, it may or may not tell you about it, or tell you the wrong thing. If you want to know about all the commands by a given name, there's nothing portable. You'd use where in tcsh or zsh , type -a in bash or zsh , whence -a in ksh93 and in other shells, you can use type in combination with which -a which may work. In csh and tcsh , you don't have much choice.

In tcsh , that's fine as which is builtin. In csh , that will be the system which command, which may not do what you want in a few cases. A case where it might make sense to use which is if you want to know the path of a command, ignoring potential shell builtins or functions in bash , csh not tcsh , dash , or Bourne shell scripts, that is shells that don't have whence -p like ksh or zsh , command -ev like yash , whatis -p rc , akanga or a builtin which like tcsh or zsh on systems where which is available and is not the csh script.

Note that if all you want to do is run that echo command, you don't have to get its path, you can just do:. Another case where you may want to use which is when you actually need an external command. POSIX requires that all shell builtins like command be also available as external commands, but unfortunately, that's not the case for command on many systems. For instance, it's rare to find a command command on Linux based operating systems while most of them have a which command though different ones with different options and behaviours.

Cases where you may want an external command would be wherever you would execute a command without invoking a POSIX shell. The best answers are voted up and rise to the top.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. How do I check which shell I am using? Ask Question. Asked 6 years, 8 months ago. Active 4 months ago. Viewed k times. I read that terminal is nothing but shell, and Unix provides different flavors of shells: Bourne shell sh C shell csh TC shell tcsh Korn shell ksh Bourne Again shell bash Questions: When I open a terminal window, which shell is opened by default?

How do I check how many shells are installed? How do I change the shell used from my account? Improve this question. Joshua Besneatte 4, 4 4 gold badges 20 20 silver badges 37 37 bronze badges. LearNer LearNer 5, 3 3 gold badges 12 12 silver badges 6 6 bronze badges. How to determine the current shell I'm working on? KasiyA This is also related to askubuntu. Please note that terminal is interface to the shell which at one point used to be actually physical interface , and shell is not terminal - it is a command interpreter.

See also askubuntu. Add a comment. Active Oldest Votes. Improve this answer. If you use it inside of a shell then it will return the name of the shell. If you use it inside of a script, it will be the name of the script. This lesson uses Bash, the default shell in many implementations of Unix.

Programs can be run in Bash by entering commands at the command-line prompt. Navigating Files and Directories. The file system is responsible for managing information on the disk.

Information is stored in files, which are stored in directories folders. Directories can also store other directories, which then form a directory tree.



0コメント

  • 1000 / 1000