![]() The file names are separated from the lines via “xargs” and passed as arguments to the rm command. Each line contains the name of a file to be deleted. In our example, the Linux tail command returns text with several lines. The command is executed when the files are passed as arguments. The xargs command takes a list of files and the name of a command.The output filenames are the oldest files in the directory. Using the Linux tail command without specifying options, we will read the last ten files from the list.We pipe the file list to the Linux tail command. This also serves as a protection so that you don’t accidentally delete important files when you open it. This is a common file extension for backup files. The oldest files are at the bottom of the list. Using the “-t” option, the files are sorted according to their modification date. The ls command lists the files in a directory.Useful to abort the live tail when the file-writing program is terminated. Used in conjunction with the -f option, the tail command is terminated when the process with the specified process ID terminates. This is particularly useful in combination with the “-follow=name” option to continue monitoring the new file with the same name after a log file has been rotated. Try to reopen an unavailable file as soon as it becomes available again. Output of the file is left to rest for the specified number of seconds. This means that the live tail continues to run even if the file is renamed or moved.Ĭorrespond to the call with -follow= name -retry the effect is that the live tail continues to run even if the original file is removed during the log rotation and replaced by a new file with the same name. If a value is not specified after “-follow=”, “descriptor” is used as the default value. Monitor the file for changes and continuously output new data written to the end of the file.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |