O'Reilly logo

Fedora® Linux® TOOLBOX: 1000+ Commands for Fedora, CentOS, and Red Hat® Power Users by Christopher Negus, François Caen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Shell Special Characters and Variables

IN THIS APPENDIX

  • Using special shell characters

  • Using shell variables

Fedora provides bash as the default shell. Chapter 3 helps you become comfortable working in the shell. This appendix provides a reference of the numerous characters and variables that have special meaning to the bash shell. Many of those elements are referenced in Table B-1 (Shell Special Characters) and Table B-2 (Shell Variables).

Using Special Shell Characters

You can use special characters from the shell to match multiple files, save some keystrokes, or perform special operations. Table B-1 shows some shell special characters you may find useful.

Table B-1. Shell Special Characters

Character

Description

*

Match any string of characters.

?

Match any one character.

[ ... ]

Match any character enclosed in the braces.

' ... '

Remove special meaning of characters between quotes. Variables are not expanded.

" ... "

Same as simple quotes except for the escape characters ($ ` and \) that preserve their special meaning.

\

Escape character to remove the special meaning of the character that follows.

Refers to the $HOME directory.

∼+

Value of the shell variable PWD (working directory).

∼-

Refers to the previous working directory.

.

Refers to the current working directory.

...

Refers to the directory above the current directory. Can be used repeatedly to reference several directories up.

$param

Used to expand a shell variable parameter.

cmd1 `cmd2` or cmd1 $(cmd2)

cmd2 is executed first. Then the call ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required