Adviser to Unix Explanations Carapace Alert
17 June 08:09
The carapace alert (or command line) is area one types commands. If accessing the arrangement through a text-based terminal, the carapace is the capital way of accessing programs and accomplishing plan on the system. In effect, it is a carapace surrounding all additional programs getting run. If accessing the arrangement through a graphical ambiance such as X11, it charcoal accessible to accessible a terminal adversary and do advantageous plan with the shell.
This affiliate describes how to acquisition a carapace alert and alpha using it.
People get carapace prompts in altered ways, such as:
Unix systems can use TTY accessories for a shell. The first band looks like
login:
Type your username at this prompt, then blazon your password. This gives a shell.
A terminal adversary (or animate emulator) is a program that emulates the terminal accouterments that aboriginal users commonly acclimated to login to Unix. It appears as a window in the graphical ambiance and allows admission to the carapace prompt.
There are several means to accessible a terminal emulator:
Most terminal emulators, like additional graphical programs , accommodate a card bar to configure the terminal. For example, they acquiesce you to change the chantry and colors; some humans adopt white argument on a atramentous background. xterm is added difficult to configure; its airheaded can be begin by captivation the Ascendancy key and beat with anniversary of the three abrasion buttons.
The ssh program is a defended way to affix to a carapace annual on a limited server. The server haveto be active the sshd servers software to acquire the connection. See the affiliate on .
The carapace alert commonly ends in a $ sign. For simplicity, the examples in this book use a carapace alert like this:
$
Some earlier carapace prompts end in % instead:
%
The C carapace sometimes uses > instead:
>
Several shells accept prompts that accord added information, such as:
localhost:puffy
You can aswell adapt your carapace prompt. For bash, use [http://www.gnu.org/software/bash/manual/bashref.html#SEC83 these] appropriate characters in the variables $PS[1-4]. $PS1 is what you usually see and $PS2 is what you see if you are accomplishing a multi-line command with a backslash (). For added see [http://www.gnu.org/software/bash/manual/bashref.html the manual].
Never copy/type the carapace alert acclimated in this book. The carapace will consistently accord you a alert if it is accessible to acquire commands.
If you or login as root, alotof systems change the carapace alert to end with #. The basis annual is accustomed to do annihilation (delete or change any file) so the # is a admonition of the ability of the prompt. Abstain using the # alert if necessary; see the affiliate on . In this book, basis carapace prompts attending like this:
#
When you access a command, the carapace does a few things in this adjustment (if it succeeds, it executes the begin command):
# The carapace checks if the command is an complete aisle (such as /bin/ls) and if that aisle is an executable file.
# If the command is not an complete path, the shell:
## searches through its builtin commands for the entered command.
## Looks in the directories in for the entered command. It starts its seek with the first agenda listed in PATH, then the additional and so on.
For examples, able-bodied be using the command ls, which lists files and directories. This command lists the capacity of /var (which may alter on your computer):
$ ls /var
annual backups db lib msgs run tmp
analysis blast abandoned log called rwho www
authpf cron amateur mail quotas ball yp
The first word, ls, is the name of the program or command congenital into the carapace to run. In this case, the program /bin/ls is run. The /var in this case is an argument; it tells ls what to list. Arguments are afar by whitespace, usually one space.
There are some appropriate arguments alleged options. Anniversary command decides what is an option, but for some commands, options with alone one abutment to alpha usually are abbreviate for a added anecdotic advantage that starts with two hyphens and some that alpha with two hyphens dont accept shorthands. Actuality is an archetype (read it as el es birr one carve var):
$ ls -l /var
drwxr-xr-x 2 basis caster 512 Mar 20 2005 account
drwxrws--- 2 basis caster 512 Mar 20 2005 audit
drwxrwx--- 2 basis authpf 512 Mar 20 2005 authpf
...
drwxr-xr-x 2 basis caster 512 Jun 11 02:09 yp
Note that these commands crave that options appear afore additional arguments. For example, the afterward does not plan (unless you accept a book or agenda alleged -l):
$ ls /var -l
ls: -l: No such book or directory
/var:
annual backups db lib msgs run tmp
analysis blast abandoned log called rwho www
authpf cron amateur mail quotas ball yp
Exception: on systems with the GNU C library (GNU and GNU/Linux), some programs (not all of them) will automatically amusement the options as if they were in the front, so ls /var -l is the aforementioned as ls -l /var. This is nice for users who overlook to blazon some option.
What if there absolutely is a book alleged -l? Then it haveto be defined that -l is not an option. One does this using the -- argument, which agency end of options. This is why it is annoying to accept filenames alpha with hyphens.
$ ls -- -l
-l
If the carapace has command-line editting, then the arrow, End, and Home keys are useful. The larboard and appropriate arrows acquiesce the user to move the argument cursor to adapt the command and the Home and End keys acquiesce the user to move the to the alpha or end of the line. For example, we wish to account some specific files, like this:
$ ls -l /etc/passwd /etc/profile
But we typed:
$ ls l- /etc/passwrd /etc/profile
We can columnist the Home key to move the cursor to the alpha of the line, then use the appropriate arrow to move the cursor to the appropriate to annul the -l. Afterwards this, we columnist Acknowledgment to run the command as normal. (This will not plan in some non-shell programs that abridgement command band editing!)
Shells with story appearance acquiesce using the up arrow to anamnesis antecedent commands to the carapace prompt. These antecedent curve are not run afresh unless the user presses Return. The down arrow allotment down the list.
If the arrow keys are broken, or you infact acquisition some keyboard after arrows, then the Ascendancy Emacs aeronautics keys (Ctrl+B, Ctrl+F, Ctrl+P, Ctrl+N, Ctrl+E and Ctrl+A) aswell plan in alotof shells.
Use cd to change the agenda you are in. The syntax is cd followed by the pathname. cd /bin would yield you to the /bin agenda (located in the agenda you are currently in), cd .. would yield you up one level. cd ~ would yield you to your home directory, and cd ~ followed by a username would yield you to that users home.
Although some carapace prompts accept the accepted directorys name or the end of the accepted directorys name appropriate in the alert (like [user@localhost ~]$), you can use the command pwd to Book the Alive Directory.
$ cd /etc
$ pwd
$ ls passwd profile
The first chat of the command is the name of the command. For example, in the afterward command, ls is the command name, and -l, /etc/passwd, and /etc/profile are the arguments.
$ ls -l /etc/passwd /etc/profile
But how do we understand what the ls command does? Alotof Unix-like systems accommodate online chiral pages for anniversary command. For example,
$ man ls
This opens the chiral page in a program alleged the pager. The alotof accepted pagers are beneath and more. These let the user blazon amplitude bar to annal down and q to abdicate the pager.
However, the chiral pages are generally not advantageous for bodies who understand about annihilation about the commands. The affiliate on will help. The area contains strategies for how to use man and the additional advice accoutrement effectively.
#
#
#
The carapace alert (or command line) is area one types commands. If accessing the arrangement through a text-based terminal, the carapace is the capital way of accessing programs and accomplishing plan on the system. In effect, it is a carapace surrounding all additional programs getting run. If accessing the arrangement through a graphical ambiance such as X11, it charcoal accessible to accessible a terminal adversary and do advantageous plan with the shell.
This affiliate describes how to acquisition a carapace alert and alpha using it.
People get carapace prompts in altered ways, such as:
Unix systems can use TTY accessories for a shell. The first band looks like
login:
Type your username at this prompt, then blazon your password. This gives a shell.
A terminal adversary (or animate emulator) is a program that emulates the terminal accouterments that aboriginal users commonly acclimated to login to Unix. It appears as a window in the graphical ambiance and allows admission to the carapace prompt.
There are several means to accessible a terminal emulator:
Most terminal emulators, like additional graphical programs , accommodate a card bar to configure the terminal. For example, they acquiesce you to change the chantry and colors; some humans adopt white argument on a atramentous background. xterm is added difficult to configure; its airheaded can be begin by captivation the Ascendancy key and beat with anniversary of the three abrasion buttons.
The ssh program is a defended way to affix to a carapace annual on a limited server. The server haveto be active the sshd servers software to acquire the connection. See the affiliate on .
The carapace alert commonly ends in a $ sign. For simplicity, the examples in this book use a carapace alert like this:
$
Some earlier carapace prompts end in % instead:
%
The C carapace sometimes uses > instead:
>
Several shells accept prompts that accord added information, such as:
localhost:puffy
You can aswell adapt your carapace prompt. For bash, use [http://www.gnu.org/software/bash/manual/bashref.html#SEC83 these] appropriate characters in the variables $PS[1-4]. $PS1 is what you usually see and $PS2 is what you see if you are accomplishing a multi-line command with a backslash (). For added see [http://www.gnu.org/software/bash/manual/bashref.html the manual].
Never copy/type the carapace alert acclimated in this book. The carapace will consistently accord you a alert if it is accessible to acquire commands.
If you or login as root, alotof systems change the carapace alert to end with #. The basis annual is accustomed to do annihilation (delete or change any file) so the # is a admonition of the ability of the prompt. Abstain using the # alert if necessary; see the affiliate on . In this book, basis carapace prompts attending like this:
#
When you access a command, the carapace does a few things in this adjustment (if it succeeds, it executes the begin command):
# The carapace checks if the command is an complete aisle (such as /bin/ls) and if that aisle is an executable file.
# If the command is not an complete path, the shell:
## searches through its builtin commands for the entered command.
## Looks in the directories in for the entered command. It starts its seek with the first agenda listed in PATH, then the additional and so on.
For examples, able-bodied be using the command ls, which lists files and directories. This command lists the capacity of /var (which may alter on your computer):
$ ls /var
annual backups db lib msgs run tmp
analysis blast abandoned log called rwho www
authpf cron amateur mail quotas ball yp
The first word, ls, is the name of the program or command congenital into the carapace to run. In this case, the program /bin/ls is run. The /var in this case is an argument; it tells ls what to list. Arguments are afar by whitespace, usually one space.
There are some appropriate arguments alleged options. Anniversary command decides what is an option, but for some commands, options with alone one abutment to alpha usually are abbreviate for a added anecdotic advantage that starts with two hyphens and some that alpha with two hyphens dont accept shorthands. Actuality is an archetype (read it as el es birr one carve var):
$ ls -l /var
drwxr-xr-x 2 basis caster 512 Mar 20 2005 account
drwxrws--- 2 basis caster 512 Mar 20 2005 audit
drwxrwx--- 2 basis authpf 512 Mar 20 2005 authpf
...
drwxr-xr-x 2 basis caster 512 Jun 11 02:09 yp
Note that these commands crave that options appear afore additional arguments. For example, the afterward does not plan (unless you accept a book or agenda alleged -l):
$ ls /var -l
ls: -l: No such book or directory
/var:
annual backups db lib msgs run tmp
analysis blast abandoned log called rwho www
authpf cron amateur mail quotas ball yp
Exception: on systems with the GNU C library (GNU and GNU/Linux), some programs (not all of them) will automatically amusement the options as if they were in the front, so ls /var -l is the aforementioned as ls -l /var. This is nice for users who overlook to blazon some option.
What if there absolutely is a book alleged -l? Then it haveto be defined that -l is not an option. One does this using the -- argument, which agency end of options. This is why it is annoying to accept filenames alpha with hyphens.
$ ls -- -l
-l
If the carapace has command-line editting, then the arrow, End, and Home keys are useful. The larboard and appropriate arrows acquiesce the user to move the argument cursor to adapt the command and the Home and End keys acquiesce the user to move the to the alpha or end of the line. For example, we wish to account some specific files, like this:
$ ls -l /etc/passwd /etc/profile
But we typed:
$ ls l- /etc/passwrd /etc/profile
We can columnist the Home key to move the cursor to the alpha of the line, then use the appropriate arrow to move the cursor to the appropriate to annul the -l. Afterwards this, we columnist Acknowledgment to run the command as normal. (This will not plan in some non-shell programs that abridgement command band editing!)
Shells with story appearance acquiesce using the up arrow to anamnesis antecedent commands to the carapace prompt. These antecedent curve are not run afresh unless the user presses Return. The down arrow allotment down the list.
If the arrow keys are broken, or you infact acquisition some keyboard after arrows, then the Ascendancy Emacs aeronautics keys (Ctrl+B, Ctrl+F, Ctrl+P, Ctrl+N, Ctrl+E and Ctrl+A) aswell plan in alotof shells.
Use cd to change the agenda you are in. The syntax is cd followed by the pathname. cd /bin would yield you to the /bin agenda (located in the agenda you are currently in), cd .. would yield you up one level. cd ~ would yield you to your home directory, and cd ~ followed by a username would yield you to that users home.
Although some carapace prompts accept the accepted directorys name or the end of the accepted directorys name appropriate in the alert (like [user@localhost ~]$), you can use the command pwd to Book the Alive Directory.
$ cd /etc
$ pwd
$ ls passwd profile
The first chat of the command is the name of the command. For example, in the afterward command, ls is the command name, and -l, /etc/passwd, and /etc/profile are the arguments.
$ ls -l /etc/passwd /etc/profile
But how do we understand what the ls command does? Alotof Unix-like systems accommodate online chiral pages for anniversary command. For example,
$ man ls
This opens the chiral page in a program alleged the pager. The alotof accepted pagers are beneath and more. These let the user blazon amplitude bar to annal down and q to abdicate the pager.
However, the chiral pages are generally not advantageous for bodies who understand about annihilation about the commands. The affiliate on will help. The area contains strategies for how to use man and the additional advice accoutrement effectively.
#
#
#
|
Tags: account, software, program, programs, usually, change, options, systems, users, system, example, games, called, allow, start, directory, option, command, backups, manual shell, command, prompt, directory, terminal, commands, manual, example, program, programs, account, options, prompts, arrow, option, passwd, emulator, called, arguments, systems, change, authpf, start, allow, chapter, cursor, wheel, hyphens, software, users, login, useful, graphical, shells, accessing, usually, system, audit, , shell prompt, shell prompts, 512 mar, etc passwd, wheel 512, change the, command line, terminal emulator, root wheel, authpf cron games, www authpf cron, log named rwho, cron games mail, games mail quotas, current directorys name, mail quotas spool, audit crash empty, tmp audit crash, org software bash, explanations shell prompt, software bash manual, bash manual bashref, var account backups, manual bashref html, unix explanations shell, |
Also see ...
PermalinkArticle In : Computers & Technology - Unix