Echo $PATH
You can view the value of the system's environment variable path, and use the which command to see the absolute path of a command;
[Email protected] ~]# echo $PATH/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin[[email Protected] ~]# Whereis Lsls:/bin/ls/usr/share/man/man1/ls.1.gz[[email protected] ~]# which cat/bin/cat
Execute Command path= $PATH:/tmp can add the/tmp directory to the PATH
So we can use the/tmp/executable file as the command
To make the path permanent, you need to add it to the last line of the/etc/profile, restart it, or run the command directly to take effect:
Source/etc/profile =. /etc/profile
[Email protected] ~]# path= $PATH:/tmp[[email protected] ~]# echo $PATH/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr /sbin:/usr/bin:/root/bin:/tmp/[[email protected] ~]# cp/bin/cat/tmp/yong[[email protected] ~]# Ls/tmp/yong yum.log[ [Email protected] ~]# YONG/TMP/PASSWD | Head-1 Root:x:0:0:root:/root:/bin/bash
#加入PATH后/tmp The command below can be run directly. Yong equivalent to Cat
About alias Aliases
Query aliases, which take effect only in the current window.
[[email protected]/]# alias alias cp= ' Cp-i ' Alias l.= ' ls-d. *--color=auto ' Alias ll= ' Ls-l--color=auto ' Alias ls= ' ls --color=auto ' Alias mv= ' mv-i ' Alias rm= ' rm-i ' Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde '
Custom alias Alias
[[email protected]/]# alias aming= ' ls/tmp/' [[email protected]/]# amingyum.log[[email protected]/]# Ls/tmp/yum.log
Alias settings command aliases, such as Alias Aming= ' Ls-lt ' are only temporary use, reboot does not exist.
De-alias using Unalias aming
To make the alias permanent, you need to add the alias command to/ROOT/.BASHRC.
[Email protected] ~]# CAT/ROOT/.BASHRC # bashrc# User specific aliases and Functionsalias rm= ' rm-i ' Alias cp= ' Cp-i ' Ali As mv= ' mv-i ' Alias yo= ' Ls-l '
yo= ' ls-l ' this article is new;
[email protected] ~]# SOURCE/ROOT/.BASHRC
#别名生效需要执行此命令, which is equivalent to ./ROOT/.BASHRC , or restart after it takes effect.
[email protected] ~]# yo total 24-rw-------. 1 root root 1090 Nov 09:29 anaconda-ks.cfg-rw-r--r--. 1 root root 9119 Nov 09:29 install.log-rw-r--r--. 1 root root 3091 Nov 09:28 install.log.syslog
Yo alias takes effect, yo=ls-l command;
View the user's home directory commands Ehco $HOME
[Email protected] tmp]# echo $HOME/root
This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://8802265.blog.51cto.com/8792265/1622606
Usage of the environment variable path under Linux