小方法,在这里共享一下。
[root@web-02 dist-packages]# python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tab
>>> exit()
[root@web-02 dist-packages]# tail -n 1 /etc/profile //文件路径,source下
export PYTHONSTARTUP=/usr/lib/python2.7/dist-packages/tab.py
[root@web-02 dist-packages]# cat tab.py
#!/usr/bin/python # python startup file import sys import readline import rlcompleter import atexit import os # tab completion readline.parse_and_bind('tab: complete') # history file histfile = os.path.join(os.environ['HOME'], '.pythonhistory') try: readline.read_history_file(histfile) except IOError: pass atexit.register(readline.write_history_file, histfile) del os, histfile, readline, rlcompleter
[root@web-02 dist-packages]#