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», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

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

Интервал:

Закладка:

Сделать

$ ls a* apple $ ls g* grape grapefruit $ ls g*t grapefruit $ ls *e* apple grape grapefruit watermelon $ ls *n* banana watermelon

The first example matches any file that begins with a( apple). The next example matches any files that begin with g( grape, grapefruit). Next, files beginning with gand ending in tare matched ( grapefruit). Next, any file that contains ein the name is matched ( apple, grape, grapefruit, watermelon). Finally, any file that contains nis matched ( banana, watermelon).

Here are a few examples of pattern matching with the question mark ( ?):

$ ls ????e apple grape $ ls g???e* grape grapefruit

The first example matches any five-character file that ends in e( apple, grape). The second matches any file that begins with gand has eas its fifth character ( grape, grapefruit).

The following examples use braces to do pattern matching:

$ ls [abw]* apple banana watermelon $ ls [agw]*[ne] apple grape watermelon

In the first example, any file beginning with a, b, or wis matched. In the second, any file that begins with a, g, or wand also ends with either nor eis matched. You can also include ranges within brackets. For example:

$ ls [a-g]* apple banana grape grapefruit

Here, any filenames beginning with a letter from athrough gare matched.

Using file-redirection metacharacters

Commands receive data from standard input and send it to standard output. Using pipes (described earlier), you can direct standard output from one command to the standard input of another. With files, you can use less than ( <) and greater than ( >) signs to direct data to and from files. Here are the file-redirection characters:

< Directs the contents of a file to the command. In most cases, this is the default action expected by the command and the use of the character is optional; using less bigfileis the same as less < bigfile.
> Directs the standard output of a command to a file. If the file exists, the content of that file is overwritten.
2> Directs standard error (error messages) to the file.
&> Directs both standard output and standard error to the file.
>> Directs the output of a command to a file, adding the output to the end of the existing file.

The following are some examples of command lines where information is directed to and from files:

$ mail root < ~/.bashrc $ man chmod | col -b > /tmp/chmod $ echo "I finished the project on $(date)" >> ~/projects

In the first example, the content of the .bashrcfile in the home directory is sent in a mail message to the computer's root user. The second command line formats the chmodman page (using the mancommand), removes extra back spaces ( col -b), and sends the output to the file /tmp/chmod(erasing the previous /tmp/chmodfile, if it exists). The final command results in the following text being added to the user's project file:

I finished the project on Sat Jun 15 13:46:49 EDT 2019

Another type of redirection, referred to as here text (also called here document ), enables you to type text that can be used as standard input for a command. Here documents involve entering two less-than characters ( <<) after a command, followed by a word. All typing following that word is taken as user input until the word is repeated on a line by itself. Here is an example:

$ mail root cnegus rjones bdecker << thetext > I want to tell everyone that there will be a 10 a.m. > meeting in conference room B. Everyone should attend. > > -- James > thetext $

This example sends a mail message to root, cnegus, rjones, and bdecker usernames. The text entered between thetextbecomes the content of the message. A common use of here text is to use it with a text editor to create or add to a file from within a script:

/bin/ed /etc/resolv.conf <

With these lines added to a script run by the root user, the edtext editor adds the IP address of a DNS server to the /etc/resolv.conffile.

Using brace expansion characters

By using curly braces ( {}), you can expand out a set of characters across filenames, directory names, or other arguments to which you give commands. For example, if you want to create a set of files such as memo1through memo5, you can do that as follows:

$ touch memo{1,2,3,4,5} $ ls memo1 memo2 memo3 memo4 memo5

The items that are expanded don't have to be numbers or even single digits. For example, you could use ranges of numbers or digits. You could also use any string of characters, as long as you separate them with commas. Here are some examples:

$ touch {John,Bill,Sally}-{Breakfast,Lunch,Dinner} $ ls Bill-Breakfast Bill-Lunch John-Dinner Sally-Breakfast Sally-Lunch Bill-Dinner John-Breakfast John-Lunch Sally-Dinner $ rm -f {John,Bill,Sally}-{Breakfast,Lunch,Dinner} $ touch {a..f}{1..5} $ ls a1 a3 a5 b2 b4 c1 c3 c5 d2 d4 e1 e3 e5 f2 f4 a2 a4 b1 b3 b5 c2 c4 d1 d3 d5 e2 e4 f1 f3 f5

In the first example, the use of two sets of braces means John, Bill, and Sally each have filenames associated with Breakfast, Lunch, and Dinner. If I had made a mistake, I could easily recall the command and change touchto rm -fto delete all of the files. In the next example, the use of two dots between letters aand fand numbers 1and 5specifies the ranges to be used. Note the files that were created from those few characters.

Listing Files and Directories

The lscommand is the most common command used to list information about files and directories. Many options available with the lscommand allow you to gather different sets of files and directories as well as to view different kinds of information about them.

By default, when you type the lscommand, the output shows you all non-hidden files and directories contained in the current directory. When you type ls, however, many Linux systems (including Fedora and RHEL) assign an alias lsto add options. To see if lsis aliased, enter the following:

$ alias ls alias ls='ls --color=auto'

The --color=autooption causes different types of files and directories to be displayed in different colors. So, return to the $HOME/testdirectory created earlier in the chapter, add a couple of different types of files, and then see what they look like with the lscommand.

$ cd $HOME/test $ touch scriptx.sh apple $ chmod 755 scriptx.sh $ mkdir Stuff $ ln -s apple pointer_to_apple $ ls apple pointer_to_apple scriptx.sh Stuff

Although you can't see it in the preceding code example, the directory Stuffshows up in blue, pointer_to_apple(a symbolic link) appears as aqua, and scriptx.sh(which is an executable file) appears in green. All other regular files show up in black. Typing ls -lto see a long listing of those files can make these different types of files clearer still:

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

Интервал:

Закладка:

Сделать

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

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


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

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

x