0

A Linux terminal full of text on a laptop.

If you want to master the Bash shell on Linux, macOS, or another UNIX-like system, special characters (like ~, *, |, and >) are critical. We’ll help you unravel these cryptic Linux command sequences and become a hero of hieroglyphics.

What Are Special Characters?

There are a set of characters the Bash shell treats in two different ways. When you type them at the shell, they act as instructions or commands and tell the shell to perform a certain function. Think of them as single-character commands.

Sometimes, you just want to print a character and don’t need it to act as a magic symbol. There’s a way you can use a character to represent itself rather than its special function.

We’ll show you which characters are “special” or “meta-” characters, as well as how you can use them functionally and literally.

~ Home Directory

The tilde (~) is shorthand for your home directory. It means you don’t have to type the full path to your home directory in commands. Wherever you are in the filesystem, you can use this command to go to your home directory:

cd ~

The "cd ~" command in a terminal window.

You can also use this command with relative paths. For example, if you’re somewhere in the file system that’s not under your home folder and want to change to the archive directory in your work directory, use the tilde to do it:

cd ~/work/archive

The "cd ~/work/archive" command in a terminal window.

. Current Directory

Read the remaining 104 paragraphs


Post a Comment Blogger

We welcome comments that add value to the discussion. We attempt to block comments that use offensive language or appear to be spam, and our editors frequently review the comments to ensure they are appropriate. As the comments are written and submitted by visitors of The Sheen Blog, they in no way represent the opinion of The Sheen Blog. Let's work together to keep the conversation civil.

 
Top