LinuxCommandLibrary

legit

Fix Git repository issues automatically

TLDR

Switch to a specified branch, stashing and restoring unstaged changes

$ git switch [target_branch]
copy

Synchronize current branch, automatically merging or rebasing, and stashing and unstashing
$ git sync
copy

Publish a specified branch to the remote server
$ git publish [branch_name]
copy

Remove a branch from the remote server
$ git unpublish [branch_name]
copy

List all branches and their publication status
$ git branches [glob_pattern]
copy

Remove the last commit from the history
$ git undo [--hard]
copy

SYNOPSIS

file [options] file...

PARAMETERS

-b
    Brief mode: Do not prepend filenames to output lines.

-c
    Cause a checking printout of the parsed form of the magic file. This is usually used for debugging the magic file.

-f namefile
    Read the names of the files to be examined from namefile (one file per line).

-i
    (or --mime) Causes the file command to output mime type strings rather than more traditional human readable ones. Thus it may say 'text/plain; charset=us-ascii' rather than 'ASCII text'.

-k
    Don't stop at the first match, keep going. Subsequent matches will be have strength codes printed at the start of the line.

-L
    Options says to follow symlinks.

-m file
    Specify an alternate magic file.

-z
    Try to look inside compressed files.

--version
    Display version information.

DESCRIPTION

The `file` command is a standard Unix utility used to test the type of a file. It performs a series of tests on the file, including examining the filesystem, magic numbers, and content, and then prints a human-readable description of the file type to standard output. This is particularly useful when the filename extension is misleading or absent. It can identify executable files, text files, image files, archives, and more. The command relies on a database of 'magic numbers' stored in `/usr/share/misc/magic` (or similar location, depending on the system) to recognize file types based on their initial bytes. It can also attempt to guess file types based on content analysis. The 'legitimacy' implied by the name is not about security or authenticity, but about identifying the *true* file type.

MAGIC FILE FORMAT

The magic file, typically located at `/usr/share/misc/magic`, contains a list of magic numbers and corresponding descriptions. Each line in the file represents a test. The test consists of an offset, a type, a value, and a message. The `file` command reads this file and uses the information to determine the type of the input files.

SEE ALSO

magic(5), xxd(1)

Copied to clipboard