᠎᠎᠎          
51K

Shell escaper

World's simplest linux tool

This online utility escapes all special bash (and other shell) characters with a backslash. Anything that you enter in the input textbox on the left will get escaped on the right. Escaping a string lets you safely put it in other strings and variables. You can also control if spaces, commas, and newlines should be escaped. Created by Linux experts from team Browserling.
More tools! gif tools
We just created Online GIF Tools with dozens of utilities for editing GIFs. Check it out!
Newlines
Select this option to escape newlines.
Neutral Characters
Select this option if you need spaces to be escaped.
Select this option if you need commas to be escaped.
Shell escaper tool What is a shell escaper?
This browser-based tool adds backslash symbols before special shell characters. The implementation of this tool is based on the printf command with the %q argument. Everything that is escaped by this command is also escaped by this tool. A backslash preserves the literal value of the next character (with the exception of \n). By default, the %q format also escapes spaces and commas but often that is not really needed, so we have added an option to skip escaping spaces and commas. In case you have multiple strings to escape, we have also made it easy to skip escaping newlines. If you unselect the "Escape Newlines" option, then every string on every line will get escaped separately. Tuxabulous!
Shell escaper examples Click to use
Shell Variables
In this example, we escape shell variables that begin with the dollar sign. If you echo the output string, then variables $1 and $2 won't be expanded.
First argument is $1 and the second argument is $2.
First argument is \$1 and the second argument is \$2.
Required options
These options will be used automatically if you select this example.
Select this option if you need spaces to be escaped.
Select this option if you need commas to be escaped.
Escape Spaces
Usually, spaces are neutral characters and don't need to be escaped. However, if you're working with file names, then they need to be escaped. We added an option that lets you do that and this example demonstrates that.
Metallica - For Whom the Bell Tolls.mp3 Metallica - Nothing Else Matters.mp3 Metallica - Enter Sandman.mp3
Metallica\ -\ For\ Whom\ the\ Bell\ Tolls.mp3\nMetallica\ -\ Nothing\ Else\ Matters.mp3\nMetallica\ -\ Enter\ Sandman.mp3
Required options
These options will be used automatically if you select this example.
Select this option to escape newlines.
Select this option if you need spaces to be escaped.
Select this option if you need commas to be escaped.
Skip Escaping Newlines
This example escapes every string on every line separately. This is done by disabling the escape-newlines option. If you compare this example with the previous one, you'll notice there are no \n symbols in the escaped shell string.
These symbols are special `! This symbol is special ", too. This one as well #.
These symbols are special \`\! This symbol is special \", too. This one as well \#.
Required options
These options will be used automatically if you select this example.
Select this option to escape newlines.
Select this option if you need spaces to be escaped.
Select this option if you need commas to be escaped.
Pro tips Master online linux tools
You can pass input to this tool via ?input query argument and it will automatically compute output. Here's how to type it in your browser's address bar. Click to try!
https://onlinelinuxtools.com/escape-shell-characters?input=First%20argument%20is%20%241%20and%20the%20second%20argument%20is%20%242.&escape-space=false&escape-comma=false
All linux tools
Didn't find the tool you were looking for? Let us know what tool we are missing and we'll build it!
Quickly escape special shell characters in a string.
Quickly output the first part of the input text or data.
Quickly output the last part of the input text or data.
Quickly combine head and tail commands and extract a range.
Quickly print a sequence of numbers to standard output.
Quickly reverse the given lines characterwise.
Coming soon These linux tools are on the way
Run Awk
Run Awk-like commands on the input text.
Run Sed
Run Sed-like commands on the input text.
Printf Data
Run printf-like command on input text or data.
Run Base64
Base64 encode/decode on text and data.
Run Cksum
Print CRC checksum and byte counts.
Run Csplit
Split a file into context-determined pieces.
Run Cut
Remove parts of lines of files.
Run Expand
Convert tabs to spaces.
Run Expr
Evaluate expressions.
Run Factor
Print prime factors of n.
Run Fmt
Run simple text formatter.
Run Numfmt
Convert numbers to and from human-readable strings.
Run Par
Run paragaph reformatter (similar to fmt but better).
Run Strftime
Format time and date according to the given format string.
Run Fold
Wrap each input line to fit in specified width.
Run Join
Join lines of two files on a common field.
Run Md5sum
Compute checksums of files or strings.
Run Nl
Add line numbers to text lines in files.
Run Paste
Merge lines of files.
Run Sha1sum
Print or check SHA-1 digests.
Run Shuf
Shuffle lines of text.
Run Sort
Sort lines of text (with all kinds of options).
Run Split
Split a file into pieces.
Run Tac
Concatenate and print files in reverse.
Run Tr
Translate or delete characters in files.
Run Truncate
Truncate or extend the length of files.
Run Unexpand
Convert spaces to tabs.
Run Uniq
Remove duplicate lines from a sorted file.
Run Wc
Print the number of lines, words, and bytes in files.
Run Cal
Displays a calendar.
Run Colrm
Remove columns from a file.
Run Columns
Convert lists into nice columns.
Run Hexdump
Print ascii, decimal, hexadecimal, octal dump of input data.
Run Uuidgen
Create and print a new universally unique identifier (UUID).
Unescape Shell Characters
Given an escaped shell string, unescape it.
Quote a Shell String
Single or double quote a shell string.
Unquote a Shell String
Remove quotes from a quoted shell string.
Run Yes
Repeatedly output lines with all specified strings or "y".
Run Cowsay
Generate an ASCII picture of the speaking cow.
Run Figlet
Generate ASCII art text in a variety of typefaces.
Run Banner
Print a large, high quality banner using ASCII characters.
Run img2sixel
Convert an image to the DEC Sixel format.
Run sixel2img
Convert DEC Sixel data to an image.
Long to IP
Convert a long integer IP to a dotted string IP address.
IP to Long
Convert a standard IP address to a long numeric IP.
Fuzzy Match
Run the fuzzy matching algorithm on the input data.
Glob Match
Run the glob matching algorithm on the input data.
Unixify File Names
Convert filenames to Unix-friendly filenames.
Print Unix Time
Print time in seconds since 1970-01-01.
Convert UTC to Unix
Convert UTC time to Unix time.
Convert Unix to UTC
Convert Unix time to UTC time.