官术网_书友最值得收藏!

9.3 Entering Commands at the Prompt

Commands are entered at the shell command prompt simply by typing the command and pressing the Enter key. While some commands perform tasks silently, most will display some form of output before returning to the prompt. For example, the ls command can be used to display the files and directories in the current working directory:

$ ls

Desktop Documents Downloads Music Pictures Public Templates Videos

The available commands are either built into the shell itself, or reside on the physical file system. The location on the file system of a command may be identified using the which command. For example, to find out where the ls executable resides on the file system:

$ which ls

alias ls=’ls --color=auto’

/usr/bin/ls

Clearly the ls command resides in the /usr/bin directory. Note also that an alias is configured, a topic which will be covered later in this chapter. Using the which command to locate the path to commands that are built into the shell will result in a message indicating the executable cannot be found. For example, attempting to find the location of the history command (which is actually built into the shell rather than existing as an executable on the file system) will result in output similar to the following:

$ which history

/usr/bin/which: no history in (/home/demo/.local/bin:/home/demo/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)

主站蜘蛛池模板: 浦江县| 清水县| 阳新县| 肇州县| 西宁市| 高平市| 衡阳市| 九台市| 万州区| 八宿县| 仙居县| 莱西市| 申扎县| 岚皋县| 甘谷县| 太白县| 东光县| 高邑县| 洮南市| 昌图县| 秀山| 沙雅县| 汝阳县| 永城市| 萨嘎县| 永平县| 韶关市| 孝昌县| 孙吴县| 达孜县| 南康市| 平舆县| 屏东县| 东山县| 石景山区| 资阳市| 潞西市| 云南省| 手游| 昌乐县| 库尔勒市|