Home
Flock (Ludipe) Mac OS

Flock (Ludipe) Mac OS

June 01 2021

Flock (Ludipe) Mac OS

Most UNIX professionals know about the GNU core utilities, from the “used-everyday” ls, cp, ln, rm, touch, tail, wc, etc., to the “not-so-used” shell commands such as tsort, tac, factor, or seq. Among the UNIX utilities available, there is one package that includes some awesome utilities that makes our life’s a lot easier: the moreutils package.

  • The moreutils tools

Flock, the best team communication app and online collaboration platform, comes with team messaging, project management and other great features that improve productivity and boost speed of execution. Flock is a multiplatform web browser that stands out because of the numerous relevant web services that it's integrated with like YouTube, Facebook and Flickr. Flock users get fast, direct access to any of those services. The motor graphic in Flock is Gecko, the same one that's used in Mozilla Firefox. Flock is an award-winning browser, built on Mozilla's Firefox technology and designed for the way we use the web today. With Flock, you can easily connect with friends, share with them, and receive.

Installing

Before describing each of the utilities included, let me tell you that this package is not exclusive for Linux systems. You can install it also under Mac OS and different UNIX flavours.

Under Mac OS, just use the following command:

Note: There is a conflict between the GNU parallel utility and the shipped parallel on the moreutils package. If you want to install GNU parallel instead of the moreutils’ parallel, use the following commands:

You can read more about it here.

Under Linux, use your favourite package manager or the command line to retrieve this package.If you are using Arch Linux all you have to do is:

Under Debian/Ubuntu/Mint a similar command is:

And on RHEL, Fedora, CentOS:

Don’t forget to check your Linux distribution to know how to install this package if the above commands are not for your particular Linux distribution.

##The moreutils tools

###chronicThis tool runs a command , and arranges for its standard out and standard error to only be displayed if the command fails (exits nonzero or crashes). If the command succeeds, any extraneous output will be hidden.

Before discovering this tool I would do something like this to hide a command output:

but using chronic is so much simpler, and has the benefit that I know if the command succeeded or not, which I would not know from the line above (all output is redirected to /dev/null).

A common use for chronic is for running a cron job. Rather than trying to keep the command quiet, and having to deal with mails containing accidental output when it succeeds, and not verbose enough output when it fails, you can just run it verbosely always, and use chronic to hide the successful output.

combine

This tool combines the lines in two files using boolean operations.

Depending on the boolean operation specified, the contents will be combined in different ways:

  • and Outputs lines that are in file1 if they are also present in file2.

  • not Outputs lines that are in file1 but not in file2.

  • or Outputs lines that are in file1 or file2.

  • xor Outputs lines that are in either file1 or file2, but not in both files.

The input files need not be sorted, and the lines are output in the order they occur in file1 (followed by the order they occur in file2 for the two “or” operations). This means that the operations are not commutative; “a and b” will not necessarily be the same as “b and a”. To obtain commutative behavior, use the sort and uniq commands to the result, like this:

errno

This tool looks up errno macro names, errno codes, and the corresponding descriptions.

This is a most valuable tool and a lot better than reading the system header files to figure out the meaning of a particular errno code. If you do a lot UNIX programming you know what I am taking about.

ifdata

This tool can be used to check for the existence of a network interface, or to get information about the interface, such as its IP address, all statistics on input and output, number of packets, bytes, errors, drops, incoming and outgoing bit rate, etc.. Unlike ifconfig or ip, ifdata has simple to parse output that is designed to be easily used by a shell script.

ifne

This tool runs a program if the standard input is not empty. The name stands for “if not empty” and it simply runs the passed command to it, if it receives at least one byte in the stdin. You can also use the -n flag which causes ifne to reverse the operation, e.g., runs the command passed to it if the standard input is empty. Note that if the standard input is not empty, it is passed through ifne in this case. The below command line checks for core files on the current directory, and if found (standard inputs is not empty), sends a mail to user root alerting for this fact.

isutf8

This tool checks if a file or standard input are syntactically valid UTF-8. Input is either files named on the command line, or the standard input. Information about files with invalid UTF-8 are printed to standard output, otherwise nothing is printed.

lckdo

Note: Now that package util-linux contains a similar command named flock, lckdo is deprecated, and will be removed from some future version of moreutils.

The flock utility runs a program with a lock held, in order to prevent multiple processes from running in parallel. It locks from within shell scripts or from the command line. It locks a specified file or directory, which is created (assuming appropriate permissions) if it does not already exist. By default, if the lock cannot be immediately acquired, flock waits until the lock is available. It can also lock an open file by its file descriptor number. Use it just like nice or nohup.

The first command sets an exclusive lock to directory /tmp and the second command will fail.

Flock (ludipe) Mac Os Download

The first command sets a shared lock to directory /tmp and the second command will not fail. Notice that attempting to get exclusive lock with the second command would fail.

This command grabs the exclusive lock local-lock-file before running echo with ‘a b c’.

mispipe

This command pipes two commands together like the shell does, but unlike piping in the shell, which returns the exit status of the last command; when using mispipe, the exit status of the first command is returned.

Note: Modern shells, like bash or zsh, offer a pipefail option, although that option does not behave the same like mispipe because it makes a failure of any command in the pipeline to be returned, not just the exit status of the first. This can be a better alternative to mispipe which only returns the exit status of the first command passed to it.

parallel

This tool runs the specified command, passing it a single one of the specified arguments. This is repeated for each argument. Jobs may be run in parallel. The default is to run one job per CPU.

The above command runs three subshells that each print a message, delay, and print another message. If your system has multiple CPUs, parallel will run some of the jobs in parallel, which should be clear from the order the messages are output.

The above command runs three ufraw processes at the same time until all of the NEF files have been processed.

The above command runs three independent commands (ls, df and the echo) in parallel.

Note: check the xargs command to also run multiple processes at a time, specifically with the -n and -P flags.

pee

This command is similar to how tee uses the standard input but for pipes, hence the name. It allows redirecting output to multiple commands at once. Each command is run and fed a copy of the standard input. The output of all commands is sent to stdout. While this is similar to tee, a copy of the input is not sent to stdout, like tee does. If that is desired, use pee cat ... instead.

In this example, pee receives two commands: one for sorting the contents of the file, and another for randomly sorting the same file contents, outputting to two different files named sorted and unsorted, respectively.

sponge

This tool reads standard input and writes it out to the specified file. Unlike a shell redirect, sponge soaks up all its input before writing the output file. This means that it only writes to the file once the input has been fully read. This allows constructing pipelines that read from and write to the same file, without needing to redirect the output to temporary files.

Instead of using these commands to sort a file contents:

Just use:

No need to redirecting anymore.

ts

This tool adds a timestamp to the beginning of each line of input. This is an awesome tool that I like to use specially on a chain of commands where I can measure how long a given command is taking to complete before passing the control to the next command. It is also a great way of logging the time stamps of a programs’ output.

One possible use of the ts command is to assert whenever a given machine is up and running. Restart a machine and then use ping with the ts to know exactly when that machine came up to life!

The optional format parameter controls how the timestamp is formatted, as used by the C function strftime. The default format is %b %d %H:%M:%S. In addition to the regular strftime conversion specifications, %.S and %.s are like %S and %s, but provide sub-second resolution (i.e., “30.00001” and “1301682593.00001”).

vidir

This tool allows editing of the contents of a directory in a text editor (check the $EDITOR environment variable, because it will be used for the text editor of your choice). If no directory is specified, the current directory is edited. When editing a directory, each item in the directory will appear on its own numbered line. These numbers are how vidir keeps track of what items are changed. Delete lines to remove files from the directory, or edit filenames to rename files. You can also switch pairs of numbers to swap filenames. Note that if “-“ is specified as the directory to edit, it reads a list of filenames from stdin and displays those for editing. Alternatively, a list of files can be specified on the command line.

vipe

This tool allows you to run your editor in the middle of a unix pipeline and edit the data that is being piped between programs (once again, check the $EDITOR environment variable for your text editor of choice).

On the above command I edited the fortune cookie before passing it to the cowsay command. This is a command that offers you great flexibility and power.

zrun

This tool automatically decompresses arguments to command. Prefixing a shell command with zrun causes any compressed files that are arguments of the command to be transparently uncompressed to temp files (not pipes) and the uncompressed files fed to the command. This is a quick way to run a command that does not itself support compressed files, without manually uncompressing the files. For example, if you want to diff the contents of two archives without having to uncompress them first, use the following command:

Flock

This command will uncompress automatically the two .gz files and pass the contents to the diff command. Very cool.

The following compression types are supported: gz bz2 Z xz lzma lzo. If zrun is linked to some name beginning with z, like zprog, and the link is executed, this is equivalent to executing zrun prog.

Flock (ludipe) Mac Os X

That’s it! Please don’t forget to read the manpages for greater detail on the above commands. I hope you liked to learn about this fantastic tool package and that it motivated you to use it on your daily UNIX programming tasks! Until next time, have an awesome coding fun!

ADC Home>Reference Library>Reference>Mac OS X>Mac OS X Man Pages

This document is a Mac OS X manual page. Manual pages are a command-line technologyfor providing documentation. You can view these manual pages locally using theman(1) command.These manual pages come from many different sources, and thus, have a variety of writingstyles.

For more information about the manual page format, see the manual page for manpages(5).

Sending feedback…

We’re sorry, an error has occurred.

Please try submitting your feedback later.

Thank you for providing feedback!

Flock (ludipe) Mac Os Update

Your input helps improve our developer documentation.

Flock (Ludipe) Mac OS

Leave a Reply

Cancel reply