Archive for the 'ODOC' Category

ODOC: lsb_release

lsb_release — Show Linux Standard Base and Distribution info.

Summary:

If the installation is LSB compliant, the /etc/lsb-release file should contain the LSB_VERSION field and other optional fields like DISTRIB_ID, DISTRIB_RELEASE, DISTRIB_CODENAME, DISTRIB_DESCRIPTION.

lsb_release will read the above config file and show the details in different format. It is useful command to find your distribution informations.

Example:

$ lsb_release — Show the LSB version number.

$ lsb_release -i — Display the distributor ID or Name.

$ lsb_release -d — Display the single line text description of the distribution.

$ lsb_release -r — Display the release number of the distribution.

$ lsb_release -c — Display the distribution code-name.

$ lsb_release -a — Display all of the above information.

$ lsb_release -s — Show only field values, not the filed name.

$ lsb_release -ds — Show only field values, not the filed name.

$ lsb_release -as — Show in short format.

Read: man lsb_release
lsb_release, distribution, distro, linux+distro, linux, gnu/linux

ODOC: factor

factor — Print prime factors

Summary:

Print the prime factors of each number.The algorithm it uses is not very sophisticated, so for some inputs `factor’ runs for a long time.

Example:

$ factor 25 — Print prime factors

$ factor 125 200 — Print prime factors for each number.

$ factor `echo ‘2^64-1′|bc` — Factors the largest 64-bit number.

$ factor `echo ‘4294967279 * 4294967291′|bc` — Factors the largest 32-bit prime numbers. (Warning: It take more time)

Read: man factor
odoc, factor, linux, gnu/linux

ODOC: sha1sum

sha1sum - Compute & Check Secure Hash Algorithm Std 1 message digest.

Summary:

sha1sum computes a 160-bit checksum/fingerprint/message-digest for each specified file. `sha1sum’ can also determine whether a file & checksum are consistent. The sums are computed as described in FIPS-180-1.

Example:

$ sha1sum file — Compute and print the MD5 checksum of that file.

$ sha1sum -c input.txt — Read checksum and filename from the file and validate checksums.

$ sha1sum -w -c input.txt — Same as above and warn if the checksums format is wrong in the file.

$ sha1sum –status -c input.txt — Indicate the status in exit status code.

Read: man sha1sum

Format of input.txt :

2bff10a7855964335a86e84efb5f4ce9c40d4cfd file1
e62341664decd9f55896ab3635697de29ed1077f file2
9b088ddc22456233a76 file3
odoc, sha1sum, linux, gnu/linux

ODOC: logger

logger — Makes entries in the system log file.

Summary:

Logger is a shell command interface to the syslog system log module. It can be used to makes entries in the system log from the shell scripts. By default, messages will be logged in /var/log/messages.

Example:

$ logger MyLog1 — Log the message in syslog.

$ logger -i MyLog2 — Log the message with PID.

$ logger -s MyLog3 — Log the message in stderr and syslog.

$ logger -t MYTAG MyLog4 — Log the message with specified Tag.

$ logger -p user.panic MyLog5 — Log the message with priority.

Read the man page for more priority Facility and Level details.

Read: man logger
logger, log, odoc, linux, gnu/linux

ODOC: cksum

cksum — Computes a CRC (Cyclic Redundancy Check) checksum.

Summary:

cksum prints the CRC checksum for each file along with the number of bytes in the file. The CRC algorithm is specified by the POSIX Std. It is not compatible with the BSD or System V `sum’ algorithms.

Example:

$ cksum file — Prints the Checksum, No of Bytes and filename.

$ cksum file1 file2 — Prints the Checksum, No of Bytes and filename for each file.

Read: man cksum
cksum, crc, linux, gnu/linux, odoc

ODOC: sum

sum — Compute and Check .

Summary:

sum computes a 16-Bit checksum for each given file(s)/stdin. By default, it computes checksums using an algorithm compatible with BSD sum and prints file sizes in units of 1024-byte blocks.

Example:

$ sum file — Print checksum and block counts.

$ sum file1 file2 — Print checksum, block counts and filename.

$ sum -r file — Default. Use BSD sum algorithm (1KB/Block).

$ sum -s file — Use System V sum algorithm (512 bytes/Block).

Read: man sum

sum, odoc, linux, gnu/linux

ODOC: md5sum

md5sum — Compute and Check MD5 Check sums.

Summary:

md5sum computes a 128-bit checksum/fingerprint/message-digest for each specified file. md5sum can also determine whether a file & checksum are consistent.

Example:

$ md5sum file — Compute and print the MD5 checksum of that file.

$ md5sum -c input.txt — Read checksum and filename from the file and validate checksums.

$ md5sum -w -c input.txt — Same as above and warn if the checksums format is wrong in the file.

$ md5sum –status -c input.txt — Indicate the status in exit status code.

Read: man md5sum

md5, md5sum, odoc, linux, gnu/linux

ODOC: shred

shred — Overwrite/Delete a file securely.

Summary:

Overwrite the specified file repeatedly and remove, in order to make it harder for even very expensive hardware probing to recover the data.

Example:

$ shred file — Repeatedly overwrite the file content with random data.

$ shred -v file — Show progress info.

$ shred -n 5 file — Overwrite 5 times instead of the default is 25.

$ shred -x file — Use exact file size. Don’t round off.

$ shred -z file — At the end of shred, overwrite the file with zeros.

$ shred -u file — Overwrite, Truncate and Remove the file.

Read: man shred

shred, odoc, linux, gnu/linux

ODOC: tac

tac — Concatenate and Print files in reverse order.

Summary:

tac copies each file to standard output, reversing the records (lines by default) in each separately. It is doing the reverse function of the CAT command (TAC).

Example:

$ tac myfile — Print the file (Line by Line) in reverse order.

$ tac -r -s ‘[^a-zA-z0-9\-]‘ myfile — Print the file (Word by Word) in reverse order, by passing the Regular expression.

$ tac -r -s ‘.\|’ myfile — Print the file (Char by Char) in reverse order.

Read: man tac

tac, cat, odoc, linux, gnu/linux

ODOC: strings

strings - Print the strings of printable characters in files.

Summary:

For each file given, strings prints the printable character sequences that are at least 4 characters long & are followed by an unprintable character. Strings is mainly useful for determining the contents of
non-text files.

Example:

$ strings /bin/ls — Prints the strings from initialized & loaded sections.

$ strings -a file — Scan the whole file for the strings.

$ strings -f /bin/* | grep Free — Print Filename before each string.

$ strings -t o file — Print the offset within the file before each string [o = octal, x = hex, d = decimal].

$ strings -n 10 file — Print sequences of characters that are at least 10 characters long (Default 4).

NOTE: Write one “Hello World” Program in C and try this command on the binary file(a.out) of that program.

Read: man strings
strings, odoc, linux, gnu/linux