19.04에서 19.10으로 업그레이드하는 동안 업데이트된 명령줄 옵션이 변경되었습니다.

19.04에서 19.10으로 업그레이드하는 동안 업데이트된 명령줄 옵션이 변경되었습니다.

Ubuntu 19.04에서 19.10으로 업그레이드한 후 업데이트된 유틸리티가 변경되었습니다(어, 왜요?). 이로 인해 이전 명령줄 옵션을 사용했던 일부 스크립트가 손상되었습니다. 새 시스템의 새 매뉴얼 페이지에는 새 옵션이 무엇인지 식별할 만큼 설명이 충분하지 않습니다.

참고로 이전 명령줄은 다음과 같습니다.https://www.commandlinux.com/man-page/man8/updatedb.8.html이제 19.10의 man 유틸리티에서 이전 버전에 대한 매뉴얼 페이지를 찾을 수 없기 때문에 이전 버전이라고 추측합니다.

NAME

updatedb - update a database for mlocate
SYNOPSIS

updatedb [OPTION]...
DESCRIPTION

updatedb creates or updates a database used by locate(1). If the database already exists, its data is reused to avoid rereading directories that have not changed.

updatedb is usually run daily by cron(8) to update the default database.
EXIT STATUS

updatedb returns with exit status 0 on success, 1 on error.
OPTIONS

The PRUNE_BIND_MOUNTS, PRUNEFS, PRUNENAMES and PRUNEPATHS variables, which are modified by some of the options, are documented in detail in updatedb.conf(5).

-f, --add-prunefs FS
    Add entries in white-space-separated list FS to PRUNEFS. 
-n, --add-prunenames NAMES
    Add entries in white-space-separated list NAMES to PRUNENAMES. 
-e, --add-prunepaths PATHS
    Add entries in white-space-separated list PATHS to PRUNEPATHS. 
-U, --database-root PATH
    Store only results of scanning the file system subtree rooted at PATH to the generated database. The whole file system is scanned by default.

    locate(1) outputs entries as absolute path names which don't contain symbolic links, regardless of the form of PATH. 
--debug-pruning
    Write debugging information about pruning decisions to standard error output. 
-h, --help
    Write a summary of the available options to standard output and exit successfully. 
-o, --output FILE
    Write the database to FILE instead of using the default database. 
--prune-bind-mounts FLAG
    Set PRUNE_BIND_MOUNTS to FLAG, overriding the configuration file. 
--prunefs FS
    Set PRUNEFS to FS, overriding the configuration file. 
--prunenames NAMES
    Set PRUNENAMES to NAMES, overriding the configuration file. 
--prunepaths PATHS
    Set PRUNEPATHS to PATHS, overriding the configuration file. 
-l, --require-visibility FLAG
    Set the ``require file visibility before reporting it'' flag in the generated database to FLAG.

    If FLAG is 0 or no, or if the database file is readable by "others" or it is not owned by mlocate, locate(1) outputs the database entries even if the user running locate(1) could not have read the directory necessary to find out the file described by the database entry.

    If FLAG is 1 or yes (the default), locate(1) checks the permissions of parent directories of each entry before reporting it to the invoking user. To make the file existence truly hidden from other users, the database group is set to mlocate and the database permissions prohibit reading the database by users using other means than locate(1), which is set-gid mlocate.

    Note that the visibility flag is checked only if the database is owned by mlocate and it is not readable by "others". 
-v, --verbose
    Output path names of files to standard output, as soon as they are found. 
-V, --version
    Write information about the version and license of locate on standard output and exit successfully. 

EXAMPLES

To create a private mlocate database as an user other than root, run

    updatedb -l 0 -o db_file -U source_directory 

Note that all users that can read db_file can get the complete list of files in the subtree of source_directory.
FILES

/etc/updatedb.conf
    A configuration file. See updatedb.conf(5). 
/var/lib/mlocate/mlocate.db
    The database updated by default. 

SECURITY

Databases built with --require-visibility no allow users to find names of files and directories of other users, which they would not otherwise be able to do.
NOTES

The accompanying locate(1) utility was designed to be compatible to slocate and attempts to be compatible to GNU locate where possible. This is not the case for updatedb.
AUTHOR

Miloslav Trmac <[email protected]>
SEE ALSO

locate(1), mlocate.db(5), updatedb.conf(5) 

Ubuntu 19.10의 새로운 업데이트된 매뉴얼 페이지는 다음과 같습니다.

UPDATEDB(1)                                                                               General Commands Manual                                                                              UPDATEDB(1)

NAME
       updatedb - update a file name database

SYNOPSIS
       updatedb [options]

DESCRIPTION
       This  manual  page  documents  the GNU version of updatedb, which updates file name databases used by GNU locate.  The file name databases contain lists of files that were in particular directory
       trees when the databases were last updated.  The file name of the default database is determined when locate and updatedb are configured and installed.  The frequency with which the databases are
       updated and the directories for which they contain entries depend on how often updatedb is run, and with which arguments.

       In  networked  environments,  it often makes sense to build a database at the root of each filesystem, containing the entries for that filesystem.  updatedb is then run for each filesystem on the
       fileserver where that filesystem is on a local disk, to prevent thrashing the network.  Users can select which databases locate searches using an environment variable or command line option;  see
       locate(1).  Databases cannot be concatenated together.

       The @samp{LOCATGE02} database format was introduced in GNU findutils version 4.0 in order to allow machines with different byte orderings to share the databases.  GNU locate can read both the old
       and @samp{LOCATE02} database formats, though support for the old pre-4.0 database format will be removed shortly.

OPTIONS
       --findoptions='-option1 -option2...'
              Global options to pass on to find.  The environment variable FINDOPTIONS also sets this value.  Default is none.

       --localpaths='path1 path2...'
              Non-network directories to put in the database.  Default is /.

       --netpaths='path1 path2...'
              Network (NFS, AFS, RFS, etc.) directories to put in the database.  The environment variable NETPATHS also sets this value.  Default is none.

       --prunepaths='path1 path2...'
              Directories to not put in the database, which would otherwise be.  Remove any trailing slashes from the path names, otherwise updatedb won´t recognise the paths you want to  omit  (because
              it uses them as regular expression patterns).  The environment variable PRUNEPATHS also sets this value.  Default is /tmp /usr/tmp /var/tmp /afs.

       --prunefs='path...'
              File systems to not put in the database, which would otherwise be.  Note that files are pruned when a file system is reached; any file system mounted under an undesired file system will be
              ignored.  The environment variable PRUNEFS also sets this value.  Default is nfs NFS proc.

       --output=dbfile
              The database file to build.  Default is system-dependent.  In Debian GNU/Linux, the default is /var/cache/locate/locatedb.

       --localuser=user
              The user to search non-network directories as, using su(1).  Default is to search the non-network directories as the current user.  You can also use the environment variable  LOCALUSER  to
              set this user.

       --netuser=user
              The user to search network directories as, using su(1).  Default is daemon.  You can also use the environment variable NETUSER to set this user.

       --dbformat=F
              Create  the  database in format F.  The default format is called LOCATE02.  Alternatively the slocate format is also supported.  When the slocate format is in use, the database produced is
              marked as having security level 1.  If you want to build a system-wide slocate database, you may want to run updatedb as root.

       --version
              Print the version number of updatedb and exit.

       --help Print a summary of the options to updatedb and exit.

SEE ALSO
       find(1), locate(1), locatedb(5), xargs(1)

       The full documentation for updatedb is maintained as a Texinfo manual.  If the info and updatedb programs are properly installed at your site, the command info updatedb should give you access  to
       the complete manual.

COPYRIGHT
       Copyright © 1994-2019 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
       This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.

BUGS
       The  updatedb program correctly handles filenames containing newlines, but only if the system's sort command has a working -z option.  If you suspect that locate may need to return filenames con‐
       taining newlines, consider using its --null option.

       The best way to report a bug is to use the form at https://savannah.gnu.org/bugs/?group=findutils.  The reason for this is that you will then be able to track  progress  in  fixing  the  problem.
       Other comments about updatedb(1) and about the findutils package in general can be sent to the bug-findutils mailing list.  To join the list, send email to [email protected].

                                                                                                                                                                                               UPDATEDB(1)

이전 유형의updateb를 사용하는 현재 명령은 다음과 같습니다.

updatedb -l 0 -o /path/to/some/locate.db -U /path/to/some/dir/to/be/scanned

그래서 제가 가지고 있는 기본적인 질문은 다음과 같습니다. 새 버전의updateb를 사용하여 /path/to/some/dir/to/be/scanned를 어디에 지정해야 합니까?

글쎄요, 아마도 다음 두 가지 옵션 중 하나일 것입니다.

       --localpaths='path1 path2...'
              Non-network directories to put in the database.  Default is /.

       --netpaths='path1 path2...'
              Network (NFS, AFS, RFS, etc.) directories to put in the database.  The environment variable NETPATHS also sets this value.  Default is none.

그러나 "netpath"가 무엇인지 명확하게 설명하지 않습니다. /path/to/some/dir/to/be/scanned가 랩탑의 로컬 디렉토리이고 다른 경우에는 디렉토리가 NFS 마운트 파티션에 있는 디렉토리인 혼합 실행이 있습니다. 회로망.

답변1

내가 사용한 옵션은 --localpaths. --netpaths누군가 후자가 무엇을 사용하는지 설명할 수 있을 때까지 나는 지금은 포기했습니다 .

답변2

나도 같은 문제가 있습니다. 일부 스크립트를 그에 따라 불필요하게 변경해야 합니다.

처음에는 찾기/업데이트의 새 버전인 줄 알았습니다. 대신에 나는 이것이 동일한 작업을 수행하지만 다른 방식으로 수행되는 updateb/locate의 busybox 버전이라는 것을 발견했습니다.

이 문제를 해결하려면 "mlocate"를 설치해야 했습니다!

답변3

Ubuntu 20.04에서 를 사용하려면 sudo updatedb먼저mlocate

sudo apt install mlocate

그 후에는 간단히 sudo updatedb.

관련 정보