FLOCK(1) FLOCK(1) flock - flock [] | [] flock [] | -c flock [] flock(2) . , su(1) newgrp(1). , ( ) . , , flock . . . -c, --command , , -c. -E, --conflict-exit-code -n , , -w , . 1. 0 255. -F, --no-fork . . --close . -e, -x, --exclusive , . . -n, --nb, --nonblock . -E . -o, --close . . -s, --shared , . -u, --unlock . , . , , . -w, --wait, --timeout . . -E . --nonblock. --fcntl Instead of flock(2), apply an fcntl(2) open file description lock (that is, using the F_OFD_SETLK (non-blocking) or F_OFD_SETLKW (blocking) commands). These locks are independent of those applied via flock(2), but, unlike traditional POSIX fcntl() locks (F_SETLK, F_SETLKW), have semantics matching those of flock(2). This is only available on kernel versions >= 3.15. --verbose , . -h, --help . -V, --version Display version and exit. , -n -w -E, 1 . -E 0 255. , , . flock . flock(2) . (. NFS CIFS) flock(2) ,,flock" . flock(2), nfs(5) mount.cifs(8). , ,,flock" . ,,shell> " . shell1> flock /tmp -c cat; shell2> flock -w .007 /tmp -c echo; /bin/echo $? /tmp . shell1> flock -s /tmp -c cat; shell2> flock -s -w .007 /tmp -c echo; /bin/echo $? /tmp . . shell> flock -x local-lock-file echo 'a b c' ,,--" ,,echo" ,,a b c". (; flock -n 9 || exit 1; # ... ...; ) 9>/var/lock/moja-datoteka-zakljucavanja . flock-; > >> , , . < . [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || : . . $FLOCKER , flock ( ) . ,,FLOCKER" . shell> exec 4<>/var/lock/mylockfile; shell> flock -n 4 . 4, flock . H. Peter Anvin (C) 2003-2006. H. Peter Anvin. ; . ; . flock(2), fcntl(2) For bug reports, use the issue tracker . flock ,,util-linux" . util-linux 2.41 2025-03-29 FLOCK(1)