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

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

Интервал:

Закладка:

Сделать

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

$ chmod u+rw files

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

$ chmod a+x files

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

$ chmod ug+rx files

Using letters to change permission recursively with chmodgenerally works better than using numbers because you can change bits selectively instead of changing all permission bits at once. For example, suppose that you want to remove write permission for “other” without changing any other permission bits on a set of files and directories. You could do the following:

$ chmod -R o-w $HOME/myapps

This example recursively removes write permissions for “other” on any files and directories below the myappsdirectory. If you had used numbers such as 644, execute permission would be turned off for directories; using 755, execute permission would be turned on for regular files. Using o-w, only one bit is turned off and all other bits are left alone.

Setting default file permission with umask

When you create a file as a regular user, it's given permission rw-rw-r--by default. A directory is given the permission rwxrwxr-x. For the root user, file and directory permission are rw-r--r--and rwxr-xr-x, respectively. These default values are determined by the value of umask. Enter umaskto see what your umaskvalue is. For example:

$ umask 0002

If you ignore the leading zero for the moment, the umaskvalue masks what is considered to be fully opened permissions for a file 666 or a directory 777. The umaskvalue of 002 results in permission for a directory of 775 ( rwxrwxr-x). That same umaskresults in a file permission of 644 ( rw-rw-r--). (Execute permissions are off by default for regular files.)

To change your umaskvalue temporarily, run the umaskcommand. Then try creating some files and directories to see how the umaskvalue affects how permissions are set. For example:

$ umask 777 ; touch file01 ; mkdir dir01 ; ls -ld file01 dir01 d---------. 2 joe joe 6 Dec 19 11:03 dir01 ----------. 1 joe joe 0 Dec 19 11:02 file01 $ umask 000 ; touch file02 ; mkdir dir02 ; ls -ld file02 dir02 drwxrwxrwx. 2 joe joe 6 Dec 19 11:00 dir02/ -rw-rw-rw-. 1 joe joe 0 Dec 19 10:59 file02 $ umask 022 ; touch file03 ; mkdir dir03 ; ls -ld file03 dir03 drwxr-xr-x. 2 joe joe 6 Dec 19 11:07 dir03 -rw-r--r--. 1 joe joe 0 Dec 19 11:07 file03

If you want to change your umaskvalue permanently, add a umaskcommand to the .bashrcfile in your home directory (near the end of that file). The next time you open a shell, your umaskis set to whatever value you chose.

Changing file ownership

As a regular user, you cannot change ownership of files or directories to have them belong to another user. You can change ownership as the root user. For example, suppose that you created a file called memo.txtin the user joe's home directory while you were root user. Here's how you could change it to be owned by joe:

# chown joe /home/joe/memo.txt # ls -l /home/joe/memo.txt -rw-r--r--. 1 joe root 0 Dec 19 11:23 /home/joe/memo.txt

Notice that the chowncommand changed the user to joebut left the group as root. To change both user and group to joe, you could enter the following instead:

# chown joe:joe /home/joe/memo.txt # ls -l /home/joe/memo.txt -rw-r--r--. 1 joe joe 0 Dec 19 11:23 /home/joe/memo.txt

The chowncommand can be use recursively as well. Using the recursive option ( -R) is helpful if you need to change a whole directory structure to ownership by a particular user. For example, if you inserted a USB drive, which is mounted on the /media/myusbdirectory, and you wanted to give full ownership of the contents of that drive to the user joe, you could enter the following:

# chown -R joe:joe /media/myusb

Moving, Copying, and Removing Files

Commands for moving, copying, and deleting files are fairly straightforward. To change the location of a file, use the mvcommand. To copy a file from one location to another, use the cpcommand. To remove a file, use the rmcommand. These commands can be used to act on individual files and directories or recursively to act on many files and directories at once. Here are some examples:

$ mv abc def $ mv abc ~ $ mv /home/joe/mymemos/ /home/joe/Documents/

The first mvcommand moves the file abcto the file defin the same directory (essentially renaming it), whereas the second mvcommand moves the file abcto your home directory ( ~). The next mvcommand moves the mymemosdirectory (and all its contents) to the /home/joe/Documentsdirectory.

By default, the mvcommand overwrites any existing files if the file to which you are moving exists. However, many Linux systems alias the mvcommand so that it uses the -ioption (which causes mvto prompt you before overwriting existing files). Here's how to check if that is true on your system:

$ alias mv alias mv='mv -i'

Here are some examples of using the cpcommand to copy files from one location to another:

$ cp abc def $ cp abc ~ $ cp -r /usr/share/doc/bash-completion* /tmp/a/ $ cp -ra /usr/share/doc/bash-completion* /tmp/b/

The first copy command ( cp) copies abcto the new name defin the same directory, whereas the second copies abcto your home directory ( ~), keeping the name abc. The two recursive ( -r) copies copy the bash-completiondirectory and all of the files it contains, first to new /tmp/a/and /tmp/b/directories. If you run ls -lon those two directories, you see that for the cpcommand run with the archive ( -a) option, the date/time stamps and permissions are maintained by the copy. Without the -a, current date/time stamps are used, and permissions are determined by your umask.

The cpcommand typically also is aliased with the -ioption in order to prevent you from inadvertently overwriting files.

As with the cpand mvcommands, rmis also usually aliased to include the -ioption. This can prevent the damage that can come from an inadvertent recursive remove ( -r) option. Here are some examples of the rmcommand:

$ rm abc $ rm *

The first remove command deletes the abcfile; the second removes all of the files in the current directory (except that it doesn't remove directories and/or any files that start with a dot). If you want to remove a directory, you need to use the recursive ( -r) option to rmor, for an empty directory, you can use the rmdircommand. Consider the following examples:

$ rmdir /home/joe/nothing/ $ rm -r /home/joe/bigdir/ $ rm -rf /home/joe/hugedir/

The rmdircommand in the preceding code only removes the directory ( nothing) if it is empty. The rm -rexample removes the directory bigdirand all of its contents (files and multiple levels of subdirectories), but it prompts you before each is removed. When you add the force option ( -f), the hugedirdirectory and all of its contents are immediately removed, without prompting.

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

Интервал:

Закладка:

Сделать

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

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


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

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

x