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

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

Интервал:

Закладка:

Сделать

To list files and append file-type indicators:

$ ls -F apple banana docs/ grape grapefruit pointer_to_apple@ script.sh* watermelon

To avoid displaying certain files or directories when you use ls, use the --hide=option. In the next set of examples, any file beginning with gdoes not appear in the output. Using a -doption on a directory shows information about that directory instead of showing the files and directories the directory contains. The -Roption lists all files in the current directory as well as any files or directories that are associated with the original directory. The -Soption lists files by size.

To exclude any files beginning with the letter gin the list:

$ ls --hide=g* apple banana docs pointer_to_apple script.sh watermelon

To list info about a directory instead of the files it contains:

$ ls -ld $HOME/test/ drwxrwxr-x. 4 joe joe 4096 Dec 18 22:00 /home/joe/test/

To create multiple directory layers (-pis needed):

$ mkdir -p $HOME/test/documents/memos/

To list all files and directories recursively from current directory down:

$ ls -R ...

To list files by size:

$ ls -S ...

Understanding File Permissions and Ownership

After you've worked with Linux for a while, you are almost sure to get a Permission deniedmessage. Permissions associated with files and directories in Linux were designed to keep users from accessing other users' private files and to protect important system files.

The nine bits assigned to each file for permissions define the access that you and others have to your file. Permission bits for a regular file appear as -rwxrwxrwx. Those bits are used to define who can read, write, or execute the file.

NOTE

For a regular file, a dash appears in front of the nine-bit permissions indicator. Instead of a dash, you might see a d(for a directory), l(for a symbolic link), b(for a block device), c(for a character device), s(for a socket), or p(for a named pipe).

Of the nine-bit permissions, the first three bits apply to the owner's permission, the next three apply to the group assigned to the file, and the last three apply to all others. The rstands for read, the wstands for write, and the xstands for execute permissions. If a dash appears instead of the letter, it means that permission is turned off for that associated read, write, or execute bit.

Because files and directories are different types of elements, read, write, and execute permissions on files and directories mean different things. Table 4.2explains what you can do with each of them.

TABLE 4.2 Setting Read, Write, and Execute Permissions

Permission File Directory
Read View what's in the file. See what files and subdirectories it contains.
Write Change the file's content, rename it, or delete it. Add files or subdirectories to the directory. Remove files or directories from the directory.
Execute Run the file as a program. Change to the directory as the current directory, search through the directory, or execute a program from the directory. Access file metadata (file size, time stamps, and so on) of files in that directory.

As noted earlier, you can see the permission for any file or directory by typing the ls -ldcommand. The named file or directory appears as those shown in this example:

$ ls -ld ch3 test -rw-rw-r-- 1 joe sales 4983 Jan 18 22:13 ch3 drwxr-xr-x 2 joe sales 1024 Jan 24 13:47 test

The first line shows that the ch3file has read and write permission for the owner and the group. All other users have read permission, which means that they can view the file but cannot change its contents or remove it. The second line shows the testdirectory (indicated by the letter dbefore the permission bits). The owner has read, write, and execute permissions while the group and other users have only read and execute permissions. As a result, the owner can add, change, or delete files in that directory, and everyone else can only read the contents, change to that directory, and list the contents of the directory. (If you had not used the -doptions to ls, you would have listed files in the test directory instead of permissions of that directory.)

Changing permissions with chmod (numbers)

If you own a file, you can use the chmodcommand to change the permission on it as you please. In one method of doing this, each permission (read, write, and execute) is assigned a number—r=4, w=2, and x=1—and you use each set's total number to establish the permission. For example, to make permissions wide open for yourself as owner, you would set the first number to 7 (4+2+1), and then you would give the group and others read-only permission by setting both the second and third numbers to 4 (4+0+0), so that the final number is 744. Any combination of permissions can result from 0 (no permission) through 7 (full permission).

Here are some examples of how to change permission on a file (named file) and what the resulting permission would be:

The following chmodcommand results in this permission: rwxrwxrwx

# chmod 777 file

The following chmodcommand results in this permission: rwxr-xr-x

# chmod 755 file

The following chmodcommand results in this permission: rw-r--r--

# chmod 644 file

The following chmodcommand results in this permission: ---------

# chmod 000 file

The chmodcommand also can be used recursively. For example, suppose that you wanted to give an entire directory structure 755 permission ( rwxr-xr-x), starting at the $HOME/myappsdirectory. To do that, you could use the -Roption, as follows:

$ chmod -R 755 $HOME/myapps

All files and directories below, and including, the myappsdirectory in your home directory will have 755 permissions set. Because the numbers approach to setting permission changes all permission bits at once, it's more common to use letters to change permission bits recursively over a large set of files.

Changing permissions with chmod (letters)

You can also turn file permissions on and off using plus ( +) and minus ( ) signs, respectively, along with letters to indicate what changes and for whom. Using letters, for each file you can change permission for the user ( u), group ( g), other ( o), and all users ( a). What you would change includes the read ( r), write ( w), and execute ( x) bits. For example, start with a file that has all permissions open ( rwxrwxrwx). Run the following chmodcommands using minus sign options. The resulting permissions are shown to the right of each command.

The following chmodcommand results in this permission: r-xr-xr-x

$ chmod a-w file

The following chmodcommand results in this permission: rwxrwxrw-

$ chmod o-x file

The following chmodcommand results in this permission: rwx------

$ chmod go-rwx file

Likewise, the following examples start with all permissions closed ( ---------). The plus sign is used with chmodto turn permissions on.

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

Интервал:

Закладка:

Сделать

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

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


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

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

x