Christopher Negus - Linux Bible

Здесь есть возможность читать онлайн «Christopher Negus - Linux Bible» — ознакомительный отрывок электронной книги совершенно бесплатно, а после прочтения отрывка купить полную версию. В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: unrecognised, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Linux Bible: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Linux Bible»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

The industry favorite Linux guide
Linux Bible, 10th Edition This useful guide assumes a base of little or no Linux knowledge, and takes you step by step through what you need to know to get the job done.
Get Linux up and running quickly Master basic operations and tackle more advanced tasks Get up to date on the recent changes to Linux server system management Bring Linux to the cloud using Openstack and Cloudforms Simplified Linux administration through the Cockpit Web Interface Automated Linux Deployment with Ansible Learn to navigate Linux with Amazon (AWS), Google (GCE), and Microsofr Azure Cloud services 
 is the one resource you need, and provides the hands-on training that gets you on track in a flash.

Linux Bible — читать онлайн ознакомительный отрывок

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Linux Bible», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Using $BASHas an argument to ls -lcauses a long listing of the bash command to be printed.

Using Shell Variables

The shell itself stores information that may be useful to the user's shell session in what are called variables . Examples of variables include $SHELL(which identifies the shell you are using), $PS1(which defines your shell prompt), and $MAIL(which identifies the location of your user's mailbox).

You can see all variables set for your current shell by typing the setcommand. A subset of your local variables is referred to as environment variables . Environment variables are variables that are exported to any new shells opened from the current shell. Type envto see environment variables.

You can type echo $VALUE, where VALUEis replaced by the name of a particular environment variable you want to list. And because there are always multiple ways to do anything in Linux, you can also type declareto get a list of the current environment variables and their values along with a list of shell functions.

Besides those that you set yourself, system files set variables that store things such as locations of configuration files, mailboxes, and path directories. They can also store values for your shell prompts, the size of your history list, and type of operating system. You can refer to the value of any of those variables by preceding it with a dollar sign ( $) and placing it anywhere on a command line. For example:

$ echo $USER chris

This command prints the value of the USERvariable, which holds your username ( chris). Substitute any other value for USERto print its value instead.

When you start a shell (by logging in via a virtual console or opening a Terminal window), many environment variables are already set. Table 3.5shows some variables that are either set when you use a bash shell or that can be set by you to use with different features.

Creating and using aliases

Using the aliascommand, you can effectively create a shortcut to any command and options that you want to run later. You can add and list aliases with the aliascommand. Consider the following examples of using aliasfrom a bash shell:

$ alias p='pwd ; ls –CF' $ alias rm='rm -i'

In the first example, the letter pis assigned to run the command pwdand then to run ls -CFto print the current working directory and list its contents in column form. The second example runs the rmcommand with the -ioption each time you type rm. (This is an alias that is often set automatically for the root user. Instead of just removing files, you are prompted for each individual file removal. This prevents you from automatically removing all of the files in a directory by mistakenly typing something such as rm *.)

TABLE 3.5 Common Shell Environment Variables

Variable Description
BASH This contains the full pathname of the bashcommand. This is usually /bin/bash.
BASH_VERSION This is a number representing the current version of the bashcommand.
EUID This is the effective user ID number of the current user. It is assigned when the shell starts, based on the user's entry in the /etc/passwdfile.
FCEDIT If set, this variable indicates the text editor used by the fccommand to edit historycommands. If this variable isn't set, the vicommand is used.
HISTFILE This is the location of your history file. It is typically located at $HOME/.bash_history.
HISTFILESIZE This is the number of history entries that can be stored. After this number is reached, the oldest commands are discarded. The default value is 1000.
HISTCMD This returns the number of the current command in the historylist.
HOME This is your home directory. It is your current working directory each time you log in or type the cdcommand with any options.
HOSTTYPE This is a value that describes the computer architecture on which the Linux system is running. For Intel-compatible PCs, the value is i386, i486, i586, i686, or something like i386-linux. For AMD 64-bit machines, the value is x86_64.
MAIL This is the location of your mailbox file. The file is typically your username in the /var/spool/mail directory.
OLDPWD This is the directory that was the working directory before you changed to the current working directory.
OSTYPE This name identifies the current operating system. For Fedora Linux, the OSTYPEvalue is either linuxor linux-gnu, depending on the type of shell you are using. (Bash can run on other operating systems as well.)
PATH This is the colon-separated list of directories used to find commands that you type. The default value for regular users varies for different distributions but typically includes the following: /bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:~/bin. You need to type the full path or a relative path to a command that you want to run which is not in your PATH. For the root user, the value also includes /sbin, /usr/sbin, and /usr/local/sbin.
PPID This is the process ID of the command that started the current shell (for example, the Terminal window containing the shell).
PROMPT_COMMAND This can be set to a command name that is run each time before your shell prompt is displayed. Setting PROMPT_COMMAND=datelists the current date/time before the prompt appears.
PS1 This sets the value of your shell prompt. There are many items that you can read into your prompt (date, time, username, hostname, and so on). Sometimes a command requires additional prompts, which you can set with the variables PS2, PS3, and so on.
PWD This is the directory that is assigned as your current directory. This value changes each time you change directories using the cdcommand.
RANDOM Accessing this variable causes a random number to be generated. The number is between 0 and 99999.
SECONDS This is the number of seconds since the time the shell was started.
SHLVL This is the number of shell levels associated with the current shell session. When you log in to the shell, the SHLVLis 1. Each time you start a new bash command (by, for example, using suto become a new user, or by simply typing bash), this number is incremented.
TMOUT This can be set to a number representing the number of seconds the shell can be idle without receiving input. After the number of seconds is reached, the shell exits. This security feature makes it less likely for unattended shells to be accessed by unauthorized people. (This must be set in the login shell for it actually to cause the shell to log out the user.)

While you are in the shell, you can check which aliases are set by typing the aliascommand. If you want to remove an alias, use unalias. (Remember that if the aliasis set in a configuration file, it will be set again when you open another shell.)

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Linux Bible»

Представляем Вашему вниманию похожие книги на «Linux Bible» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Linux Bible»

Обсуждение, отзывы о книге «Linux Bible» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x