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

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

Интервал:

Закладка:

Сделать

$ type bash bash is /bin/bash

Try these few words with the typecommand to see other locations of commands: which, case, and return. If a command resides in several locations, you can add the -aoption to have all of the known locations of the command printed. For example, the command type -a lsshould show an aliased and filesystem location for the lscommand.

TIP

Sometimes, you run a command and receive an error message that the command was not found or that permission to run the command was denied. If the command was not found, check that you spelled the command correctly and that it is located in your PATHvariable. If permission to run the command was denied, the command may be in the PATHvariable but may not be executable. Also remember that case is important, so typing CAT or Cat will not find the catcommand.

If a command is not in your PATHvariable, you can use the locatecommand to try to find it. Using locate, you can search any part of the system that is accessible to you. (Some files are only accessible to the root user.) For example, if you wanted to find the location of the chagecommand, you could enter the following:

$ locate chage /usr/bin/chage /usr/sbin/lchage /usr/share/man/fr/man1/chage.1.gz /usr/share/man/it/man1/chage.1.gz /usr/share/man/ja/man1/chage.1.gz /usr/share/man/man1/chage.1.gz /usr/share/man/man1/lchage.1.gz /usr/share/man/pl/man1/chage.1.gz /usr/share/man/ru/man1/chage.1.gz /usr/share/man/sv/man1/chage.1.gz /usr/share/man/tr/man1/chage.1.gz

Notice that locatenot only found the chagecommand, it also found the lchagecommand and a variety of man pages associated with chagefor different languages. The locatecommand looks all over your filesystem, not just in directories that contain commands. (If locatedoes not find files recently added to your system, run updatedbas root to update the locate database.)

In the coming chapters, you learn to use additional commands. For now, I want you to become more familiar with how the shell itself works. So next I discuss features for recalling commands, completing commands, using variables, and creating aliases.

Recalling Commands Using Command History

Being able to repeat a command you ran earlier in a shell session can be convenient. Recalling a long and complex command line that you mistyped can save you some trouble. Fortunately, some shell features enable you to recall previous command lines, edit those lines, or complete a partially typed command line.

The shell history is a list of the commands that you have entered before. Using the historycommand in a bash shell, you can view your previous commands. Then using various shell features, you can recall individual command lines from that list and change them however you please.

The rest of this section describes how to do command-line editing, how to complete parts of command lines, and how to recall and work with the history list.

Command-line editing

If you type something wrong on a command line, the bash shell ensures that you don't have to delete the entire line and start over. Likewise, you can recall a previous command line and change the elements to make a new command.

By default, the bash shell uses command-line editing that is based on the emacs text editor. (Type man emacsto read about it, if you care to do so.) If you are familiar with emacs, you probably already know most of the keystrokes described here.

TIP

If you prefer the vicommand for editing shell command lines, you can easily make that happen. Add the following line to the .bashrcfile in your home directory:

set -o vi

The next time you open a shell, you can use vicommands to edit your command lines.

To do the editing, you can use a combination of control keys, meta keys, and arrow keys. For example, Ctrl+F means to hold down the Ctrl key, and type f. Alt+F means to hold down the Alt key, and type f. (Instead of the Alt key, your keyboard may use a Meta key or the Esc key. On a Windows keyboard, you can use the Windows key.)

To try out a bit of command-line editing, enter the following:

$ ls /usr/bin | sort -f | less

This command lists the contents of the /usr/bindirectory, sorts the contents in alphabetical order (regardless of case), and pipes the output to less. The lesscommand displays the first page of output, after which you can go through the rest of the output a line (press Enter) or a page (press spacebar) at a time. Simply press qwhen you are finished. Now, suppose that you want to change /usr/binto /bin. You can use the following steps to change the command:

1 Press the up arrow (↑) key. This displays the most recent command from your shell history.

2 Press Ctrl+A. This moves the cursor to the beginning of the command line.

3 Press Ctrl+F or the right arrow (→) key. Repeat this command a few times to position the cursor under the first slash (/).

4 Press Ctrl+D. Type this command four times to delete /usr from the line.

5 Press Enter. This executes the command line.

As you edit a command line, at any point you can type regular characters to add those characters to the command line. The characters appear at the location of your text cursor. You can use right → and left ← arrows to move the cursor from one end to the other on the command line. You can also press the up ↑ and down ↓ arrow keys to step through previous commands in the history list to select a command line for editing. (See the section “Command-line recall” for details on how to recall commands from the history list.) You can use many keystrokes to edit your command lines. Table 3.1lists the keystrokes that you can use to move around the command line.

TABLE 3.1 Keystrokes for Navigating Command Lines

Keystroke Full Name Meaning
Ctrl+F Character forward Go forward one character.
Ctrl+B Character backward Go backward one character.
Alt+F Word forward Go forward one word.
Alt+B Word backward Go backward one word.
Ctrl+A Beginning of line Go to the beginning of the current line.
Ctrl+E End of line Go to the end of the line.
Ctrl+L Clear screen Clear screen and leave line at the top of the screen.

The keystrokes in Table 3.2can be used to edit command lines.

TABLE 3.2 Keystrokes for Editing Command Lines

Keystroke Full Name Meaning
Ctrl+D Delete current Delete the current character.
Backspace Delete previous Delete the previous character.
Ctrl+T Transpose character Switch positions of current and previous characters.
Alt+T Transpose words Switch positions of current and previous words.
Alt+U Uppercase word Change the current word to uppercase.
Alt+L Lowercase word Change the current word to lowercase.
Alt+C Capitalize word Change the current word to an initial capital.
Ctrl+V Insert special character Add a special character. For example, to add a Tab character, press Ctrl+V+Tab.

Use the keystrokes in Table 3.3to cut and paste text on a command line.

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

Интервал:

Закладка:

Сделать

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

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


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

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

x