Linux
1. As a regular user, search the /etc directory for every file named passwd. Redirect error messages from your search to /dev/null.
2.Find files under the /usr/share/doc directory that have not been modified in more than 300 days.
3. Find all files on your system which are longer than 1 MiB, and output their names.
4. How could you use find to delete a file with an unusual name (e. g., containing invisible control characters or umlauts)?
5. How would you ensure that files in /tmp which belong to you are deleted once you log out?
6. README is a very popular file name. Give the absolute path names of all files on your system called README .

11 Июн 2019 в 19:47
343 +1
0
Ответы
1

As a regular user, you can use the following command to search the /etc directory for every file named passwd and redirect error messages to /dev/null:

find /etc -name passwd 2>/dev/null

You can find files under the /usr/share/doc directory that have not been modified in more than 300 days using the following command:

find /usr/share/doc -type f -mtime +300

To find all files on your system which are longer than 1 MiB and output their names, you can use the following command:

find / -size +1M -type f -exec ls -lh {} \;

To delete a file with an unusual name using find, you can use the following command:

find . -type f -name 'file_with_unusual_name*' -exec rm {} \;

To ensure that files in /tmp which belong to you are deleted once you log out, you can use a tool like tmpwatch to clean up files older than a certain time. You can add a cron job to run tmpwatch at regular intervals.

To find all files on your system called README, you can use the following command:

find / -name README -type f
21 Апр 2024 в 01:16
Не можешь разобраться в этой теме?
Обратись за помощью к экспертам
Гарантированные бесплатные доработки в течение 1 года
Быстрое выполнение от 2 часов
Проверка работы на плагиат
Поможем написать учебную работу
Прямой эфир