讀 linux_101_hacks 有感

強大的 CD 命令技巧php

-rw-------.  1 root root    14808 Mar 13 12:31 .bash_history
-rw-r--r--.  1 root root       18 May 20  2009 .bash_logout
-rw-r--r--.  1 root root      176 May 20  2009 .bash_profile
-rw-r--r--.  1 root root      212 Jan 11 11:23 .bashrc
-rw-r--r--.  1 root root      100 Sep 23  2004 .cshrc    linux


讀 linux_101_hacks 有感shell


/etc/profile:此文件爲系統的每一個用戶設置環境信息,當用戶第一次登陸時,該文件被執行.
並從/etc/profile.d目錄的配置文件中搜集shell的設置.
/etc/bashrc:爲每個運行bash shell的用戶執行此文件.當bash shell被打開時,該文件被讀取.
~/.bash_profile:每一個用戶均可使用該文件輸入專用於本身使用的shell信息,當用戶登陸時,該
文件僅僅執行一次!默認狀況下,他設置一些環境變量,執行用戶的.bashrc文件.
~/.bashrc:該文件包含專用於你的bash shell的bash信息,當登陸時以及每次打開新的shell時,該
該文件被讀取.
~/.bash_logout:當每次退出系統(退出bash shell)時,執行該文件. bash

另外,/etc/profile中設定的變量(全局)的能夠做用於任何用戶,而~/.bashrc等中設定的變量(局部)只能繼承/etc/profile中的變量,他們是"父子"關係.
 
~/.bash_profile 是交互式、login 方式進入 bash 運行的
~/.bashrc 是交互式 non-login 方式進入 bash 運行的
一般兩者設置大體相同,因此一般前者會調用後者。ui

設置生效:能夠重啓生效,也能夠使用命令:source
alias php=/var/eyouim/pub/php/bin/php
source /etc/profile繼承

14 alias ..="cd .."
15 alias ..2="cd ../.."
16 alias ..3="cd ../../.."
17 alias ..4="cd ../../../.."
18 alias ..5="cd ../../../../.."登錄

相關文章
相關標籤/搜索