Prev | Current Page 197 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

You could run a program
from that directory called hotdog by typing $M/hotdog. You could edit a file from there
called bun by typing vi $M/bun.
CAUTION
59
Running Commands from the Shell 2
Adding Aliases
Setting aliases can save you even more typing than setting environment variables. With aliases, you
can have a string of characters execute an entire command line. You can add and list aliases with
the alias command. Here are some examples of using alias from a bash shell:
alias p=??™pwd ; ls -CF??™
alias rm=??™rm -i??™
In the first example, the letter p is assigned to run the command pwd, and then to run ls -CF to
print the current working directory and list its contents in column form. The second runs the rm
command with the -i option each time you simply type rm. (This is an alias that is often set automatically
for the root user, so that instead of just removing files, you are prompted for each individual
file removal. This prevents you from automatically removing all the files in a directory by
mistakenly typing something such as rm *.)
While you are in the shell, you can check which aliases are set by typing the alias command. If
you want to remove an alias, type unalias. (Remember that if the alias is set in a configuration
file, it will be set again when you open another shell.


Pages:
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209