How to Use the Command "nms" (with examples)
The “nms” command-line tool is designed to recreate the famous data decryption effect seen in the 1992 movie Sneakers. It takes input from stdin
and decrypts it on the fly, providing a visual effect similar to the one seen in the movie. This tool can be useful for adding a touch of nostalgia or a unique visual element to your command-line work. Here are some examples of how to use the “nms” command:
Use Case 1: Decrypt text after a keystroke
Code:
echo "Hello, World!" | nms
Motivation: This example shows how to encrypt a simple text string and visualize the decryption effect. It can be used for educational purposes, to create visual content for presentations, or simply for fun.
Explanation: In this use case, we use the “echo” command to send the text “Hello, World!” to the “nms” command via the pipe ("|") operator. The “nms” command then decrypts the text and displays the decryption effect on the terminal.
Example Output:
H
He
Hel
Hell
Hello
Hello,
Hello,
Hello, W
Hello, Wo
Hello, Wor
Hello, Worl
Hello, World
Hello, World!
Use Case 2: Decrypt output immediately, without waiting for a keystroke
Code:
ls -la | nms -a
Motivation: This example demonstrates how to encrypt the output of a command and immediately visualize the decryption effect without waiting for a keystroke. This can be useful for encrypting sensitive data and visualizing the decryption process in real-time.
Explanation: In this use case, we use the “ls -la” command to list all files and directories in the current directory. The output of this command is then piped to the “nms” command with the “-a” argument. The “-a” argument tells the “nms” command to decrypt the input immediately without waiting for a keystroke.
Example Output:
drwxr-xr-x 21 user staff 672B Nov 29 10:23 .
drwxr-xr-x 4 user staff 128B Nov 29 10:23 ..
-rw-r--r-- 1 user staff 757B Nov 29 10:23 file1.txt
-rw-r--r-- 1 user staff 465B Nov 29 10:23 file2.txt
drwxr-xr-x 3 user staff 96B Nov 29 10:23 folder1
drwxr-xr-x 3 user staff 96B Nov 29 10:23 folder2
Use Case 3: Decrypt the content of a file, with a custom output color
Code:
cat path/to/file | nms -a -f blue|white|yellow|black|magenta|green|red
Motivation: This example showcases how to encrypt the contents of a file and customize the output color of the decryption effect. It can be used to create visually striking displays or to highlight specific parts of the decrypted content.
Explanation: In this use case, we use the “cat” command to read the contents of a file specified by the “path/to/file” argument. The output of the “cat” command is then piped to the “nms” command. We specify the “-a” argument to decrypt the input immediately without waiting for a keystroke, and the “-f” argument followed by a color (e.g., blue, white, yellow, black, magenta, green, red) to set the output color of the decryption effect.
Example Output:
Decrypted content displayed in the specified color.
Use Case 4: Clear the screen before decrypting
Code:
command | nms -a -c
Motivation: This example shows how to clear the terminal screen before displaying the decryption effect. It can be used to create a clean visual appearance or to separate different visualizations.
Explanation: In this use case, we use the “command” placeholder to represent any command whose output we want to encrypt and decrypt. The output of this command is then piped to the “nms” command. We specify the “-a” argument to decrypt the input immediately without waiting for a keystroke, and the “-c” argument to clear the screen before displaying the decryption effect.
Example Output:
Decrypted output displayed after clearing the screen.