Although Neutrino includes an easy-to-use graphical interface see the Using the Photon microGUI chapter , you'll likely have to type a command sometime — especially if you're the system administrator. For information about choosing Photon or text mode, see the Controlling How Neutrino Starts chapter in this guide. If you want to use command lines from Photon, you can start a pterm terminal by clicking on the Terminal icon:. You can run many terminals at once, each capable of running multitasking processes.
|Country:||Bosnia & Herzegovina|
|Published (Last):||27 November 2008|
|PDF File Size:||11.82 Mb|
|ePub File Size:||7.12 Mb|
|Price:||Free* [*Free Regsitration Required]|
Although Neutrino includes an easy-to-use graphical interface see the Using the Photon microGUI chapter , you'll likely have to type a command sometime — especially if you're the system administrator.
For information about choosing Photon or text mode, see the Controlling How Neutrino Starts chapter in this guide. If you want to use command lines from Photon, you can start a pterm terminal by clicking on the Terminal icon:. You can run many terminals at once, each capable of running multitasking processes. Photon terminals emulate character devices, so the information in this chapter applies to them as well as to real character devices. When you type a command, the first process that interprets it is the character-device driver.
Character-device drivers run in either raw input mode , or canonical or edited input mode. In raw input mode, each character is submitted to an application process as it's received; in edited input mode, the application process receives characters only after a whole line has been entered usually signalled by a carriage return.
Some programs, such as vi , need to know just what your terminal can do, so that they can move the cursor, clear the screen, and so on.
In this directory, you can find subdirectories a through z that contain the information for specific terminals. If you're connecting to a Neutrino box from some other operating system, and the terminal isn't behaving properly, quit from telnet and start it again with the -8 option.
The table below describes how the character-device drivers interpret various keys and keychords groups of keys that you press simultaneously.
The drivers handle these keys as soon as you type them. The display adapter, the screen, and the system keyboard are collectively referred to as the physical console , which is controlled by a console driver. To let you interact with several applications at once, Neutrino permits multiple sessions to be run concurrently by means of virtual consoles. Photon provides virtual consoles even if your system doesn't include a console driver; see Using the Photon microGUI.
When the system starts devc-con or devc-con-hid , it can specify how many virtual consoles to enable by specifying the -n. In a desktop system, the buildfile specifies four consoles when it starts diskboot.
For more information, see the description of diskboot in the Controlling How Neutrino Starts chapter. The maximum number of virtual consoles is nine.
The root user can also specify the program, if any, that's initially launched on each console. This means that while console 1 is always available, the other consoles aren't used unless you specifically switch to one of them and press a key. Each virtual console can be running a different foreground application that uses the entire screen. The keyboard is attached to the virtual console that's currently visible. You can switch from one virtual console to another, and thus from one application to another, by entering these keychords:.
You can also jump to a specific console by typing Ctrl - Alt - n , where n is a digit that represents the console number of the virtual console. When you terminate the session by typing logout or exit , or by pressing Ctrl - D , the console is once again idle. It doesn't appear when you use any of the cyclical console-switching keychords.
The exception is console 1, where the system usually restarts login. After the character-device driver processes what you type, the command line is passed to a command interpreter or shell. The default shell is sh , which, under Neutrino, is a link to the Korn shell, ksh. There are other shells available, including small ones that are suitable for embedded systems; see the Utilities Reference.
In general terms, the shell breaks the command line into tokens, parses them, and invokes the program or programs that you asked for. The specific details depend on the shell that you're using; this section describes what ksh does. As you type, the Korn shell immediately processes the keys that you use to edit the command line , including completing commands and filenames.
When you press Enter the shell processes the command line:. You can also specify multiple commands on the command line.
To override the order in which the shell processes the command line, you use quoting to change the meaning of the special characters. The sections that follow give the briefest descriptions of these steps — ksh is a very powerful command interpreter!
For more details, see its entry in the Utilities Reference. The Korn shell supports emacs -style commands that let you edit the command line:. As in emacs , commands that involve the Ctrl key are keychords; for commands that involve Esc , press and release each key in sequence. In order to process these commands, ksh uses the character device in raw mode, but emulates all of the driver's processing of the keys.
Other shells, such as esh , use the character device in canonical edited input mode. You can reduce the amount of typing you have to do by using command completion and filename completion. To do this, type part of the command's or file's name, and then press Esc twice i. Esc Esc or Tab once. The shell fills as much of the name as it can; you can then type the rest of the name — or type more of it, and then press Esc Esc or Tab again.
You can control which keys the shell uses for completing names by setting the shell's complete key binding. For example, the command that lets you use the Tab key is as follows:. You can use bind on the command line or in the ksh profile. You can enter more than one command at a time by separating your commands with a semicolon ;.
For example, if you want to determine your current working directory, invoke pwd. If you want to see what the directory contains, use ls. You could combine the two commands as follows:. You can define an alias in the shell to create new commands or to specify your favorite options. For example, the -F option to the ls command displays certain characters at the end of the names to indicate that the file is executable, a link, a directory, and so on. If you always want ls to use this option, create an alias:.
Aliases are expanded in place, so you can't put an argument into the middle of the expanded form; if you want to do that, use a shell function instead. For example, if you want a version of the cd command that tells you where you end up in, type something like the following in ksh :. The shell lets you use a shorthand notation to include the values of certain things in the command line. The shell does the following substitutions, in this order:. The characters between the tilde and the next slash if any are interpreted as the name of a user.
For example, to display the value of your PATH environment variable, type:. Sometimes, you might want to execute a command and use the results of the command in another command. You can do it like this:.
The find command searches the given directory. The command substitution causes grep to search for the given string in the files that find produces. Instead of using a command to work on just one file or directory, you can use wildcard characters to operate on many.
For example, the ls command lists the files in a directory. If you want to redirect to output of ls to a file called filelist , enter:. You can specify a file descriptor for the above redirections.
You can also use a pipe to to build complex commands from smaller ones:. Programs such as grep , sort , and wc a utility that counts characters, words, and lines that read from standard input and write to standard output are called filters. Certain characters may have special meaning to the shell, depending on their context. If you want a command line to include any of the special characters that the shell processes, then you may have to quote these characters to force the shell to treat them as simple characters.
You might need to quote the following characters, depending on their context within a shell command:. The command line uses find to locate all of the files with an extension of html and passes the list of files to the xargs command, which executes the given grep command on each file in turn.
All of the output from xargs is then passed to less , which displays the output, one screenful at a time. This command uses quoting in various ways to control when the special characters are processed, and by which process:.
You can edit the command, if you wish, and then press Enter to reexecute it. The shell also includes a builtin fc command that you can use to display and edit previous commands, as well as an r alias to fc that reexecutes a previous command.
For example:. You can enter shell commands into a text file, called a shell script , and then invoke the commands in batch mode by executing or shelling the file. For more information, see the Writing Shell Scripts chapter in this guide. Once the shell has processed all of its special characters, what remains typically consists of commands and the arguments to them. Most commands correspond to executable files somewhere on your system, although some — such as cd — are built into the shell.
It's possible for you to have more than one executable file with the same name on your system. The shell uses the PATH environment variable to determine which version to use. The value of PATH is a list of directories, separated by colons : , in the order in which you want the shell to search for executables. To see the value of your PATH , type:. If you want to have your current directory in your PATH , make sure that you put it after the directories that hold the common utilities.
If you want to know which version of a command the shell will choose, use the which command. If you try this for a command that's built into the shell, which can't find it:. The whence command displays what the command means to the shell, including any aliases in effect. For example, if you've created an alias for ls , the output might be:. Whenever you look up a command in the Utilities Reference , you'll see a syntax statement that summarizes how you can use the command. For most commands, this statement consists of:.
The entries in the Utilities Reference use some special symbols to express the command syntax:.
10 Unix commands every Mac and Linux user should know
Some rights reserved under Creative Commons. Basics Script example awk sed Regular Expressions useful commands. Unix Toolbox revision On a duplex printer the booklet will create a small book ready to bind. See also the about page. Error reports and comments are most welcome - c cb. If the master.
Linux telnet command
If telnet is invoked with a host argument , it performs an open command implicitly see the Commands section below for details. If this fails, then telnet will revert to one of two input modes: either "character at a time" or "old line by line" depending on what the remote system supports. When input editing or character echoing is to be disabled, the remote system will relay that information. The remote system will also relay changes to any special characters that happen on the remote system, so that they can take effect on the local system. In "character at a time" mode, most text typed is immediately sent to the remote host for processing. In "old line by line" mode, all text is echoed locally, and normally only completed lines are sent to the remote host.