O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

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

Aliases

Aliases are command name macros used as shorthand for other commands, especially frequently used ones. This saves a lot of typing time. Aliases are defined with the alias name=value command. For example, we could create an alias for the print command like this:

					$ alias p=print
				

Whenever p is invoked, print is executed:

					$ p Hello
					Hello
				

Make sure to enclose the value in quotes if it contains whitespace. Here we create an alias l that is set to the ls –Fac command:

					$ alias l="ls —Fac"
				

Now when you type in l, ls –Fac is executed:

					$ l
					./
					../
					compress.Z*
					func.Z*
					test/
					uncompress.Z*
					. . .
				

Alias values can contain any text, including special characters, like wildcards, pipes, or I/O redirection operators. Let's change alias l so that ...

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