Операционная система Linux

Текущий каталог:


[methody@localhost methody]$ pwd /home/methody [methody@localhost methody]$
Пример 4.1. Текущий каталог: pwd
Закрыть окно

[methody@localhost methody]$ cat text File: info.info, Node: Help-Cross, Up: Cross-refs
The node reached by the cross reference in Info . . . [methody@localhost methody]$ cat /home/methody/text File: info.info, Node: Help-Cross, Up: Cross-refs
The node reached by the cross reference in Info . . .
Пример 4.2. Полный и относительный путь к файлу
Закрыть окно

[methody@localhost methody]$ basename /home/methody/text text [methody@localhost methody]$ basename text text [methody@localhost methody]$ dirname /home/methody/text /home/methody [methody@localhost methody]$ dirname ./text . [methody@localhost methody]$ dirname text .
Пример 4.3. Использование dirname и basename
Закрыть окно

[methody@localhost methody]$ ls -filename- with- text [methody@localhost methody]$
Пример 4.4. Команда ls
Закрыть окно



[methody@localhost methody]$ ls -F / bin/ dev/ home/ mnt/ root/ swap/ tmp/ var/ boot/ etc/ lib/ proc/ sbin/ sys/ usr/ [methody@localhost methody]$
Пример 4.5. Команда ls -F
Закрыть окно

[methody@localhost methody]$ ls -aF -filename-with- .bash_history .bashrc .lpoptions . rpmmacros Documents/ ./ .bash_logout .emacs .mutt/ .xemacs/ text ../ .bash_profile .i18n .pinerc .xsession.d/ tmp/ [methody@localhost methody]$
Пример 4.6. Команда ls -aF
Закрыть окно

[methody@localhost methody]$ cd /home [methody@localhost home]$ ls methody shogun [methody@localhost home]$ cd methody [methody@localhost methody]$
Пример 4.7. Смена текущего каталога
Закрыть окно

[methody@localhost methody]$ cd .. [methody@localhost home]$ cd ~ [methody@localhost methody]$ cd ~shogun [methody@localhost shogun]$ cd [methody@localhost methody]$
Пример 4.8. Переход в родительский и в домашний каталог
Закрыть окно

[methody@localhost methody]$ mkdir examples [methody@localhost methody]$ ls -F -filename-with- Documents/ examples/ text tmp/ [methody@localhost methody]$
Пример 4.9. Создание каталога
Закрыть окно

[methody@localhost methody]$ mv -- -filename-with- examples/ [methody@localhost methody]$ cd examples [methody@localhost examples]$ mv ../text . [methody@localhost examples]$ ls -filename-with- text [methody@localhost examples]$
Пример 4.10. Перемещение файлов
Закрыть окно

[methody@localhost examples]$ cp text text.bak [methody@localhost examples]$ ls -filename-with- text text.bak
Пример 4.11. Копирование файлов
Закрыть окно

[methody@localhost methody]$ ln examples/text text-hardlink [methody@localhost methody]$ ls -lR ./: . . . drwxr-xr-x 3 methody methody 4096 Окт 16 04:45 examples -rw-r--r-- 2 methody methody 653 Окт 6 10:31 text-hardlink ./examples: итого 92 -rw-r--r-- 1 methody methody 84718 Окт 6 10:31 -filename-with- -rw-r--r-- 2 methody methody 653 Окт 6 10:31 text
Пример 4.12. Создание жестких ссылок
Закрыть окно

[methody@localhost methody]$ ls -i ./text-hardlink examples/text 127705 examples/text 127705 ./text-hardlink
Пример 4.13. Информация об индексных дескрипторах файлов
Закрыть окно

[methody@localhost methody]$ ln -s examples/text text-symlink [methody@localhost methody]$ ls -li
. . .
127699 drwxr-xr-x 2 methody methody 4096 Окт 4 17:12 examples 127705 -rw-r--r-- 2 methody methody 653 Сен 30 10:04 text-hardlink 3621 lrwxrwxrwx 1 methody methody 13 Окт 4 18:05 text-symlink -> examples/text [methody@localhost methody]$
Пример 4.14. Создание символьных ссылок
Закрыть окно

[methody@localhost methody]$ realpath text-symlink /home/methody/examples/text
Пример 4.15. Раскрытие символьных ссылок
Закрыть окно

[methody@localhost methody]$ rm examples/text [methody@localhost methody]$ ls -l text-hardlink -rw-r--r-- 1 methody methody 653 Сен 30 10:04 text-hardlink [methody@localhost methody]$ rm text-hardlink [methody@localhost methody]$ ls -l text-hardlink ls: text-hardlink: No such file or directory
Пример 4.16. Удаление файла
Закрыть окно

[methody@localhost methody]$ mkdir test [methody@localhost methody]$ rm test rm: невозможно удалить `test': Is a directory [methody@localhost methody]$ rmdir test [methody@localhost methody]$
Пример 4.17. Удаление каталога
Закрыть окно
Содержание раздела