Chinaunix首页 | 论坛 | 博客
  • 博客访问: 867653
  • 博文数量: 179
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1546
  • 用 户 组: 普通用户
  • 注册时间: 2015-01-27 11:05
个人简介

MySQL工程师 QQ:1815357042

文章分类

全部博文(179)

文章存档

2015年(179)

分类: LINUX

2015-02-02 17:41:40


相关命令
ctrl+d 在空命令行的情况下可以退出终端,相当于注销

source命令
source FileName
作用:在当前bash环境下读取并执行FileName中的命令。
注:该命令通常用命令“.”来替代。
如:source .bash_rc 与 . .bash_rc 是等效的。
注意:source命令与shell scripts的区别是:
source在当前bash环境下执行命令,而scripts是启动一个子shell来执行命令。这样如果把设置环境变量(或alias等等)的命令写进scripts中,就只会影响子shell,无法改变当前的BASH,所以通过文件(命令列)设置环境变量时,要用source 命令。

用到的快捷键

tab 自动补齐(有不知道的吗)

ctrl+a 移动到当前行的开头(a ahead)

ctrl+u 删除(剪切)此处至开始所有内容






系统使用完后,正确的习惯是退出或锁定,Windows和Linux都是一样,Windows是锁定帐号,Linux必须输入命令才会退出
不过这个操作很多使用者都会忘记,所以必须设置系统空闲时间过长自动退出



编辑/etc/profile,设置系统在空闲时间超过30秒后,自动退出,保存设置后,这个设置在下一次登录时才会生效,无需重启

  1. vi /etc/profile

  1. # /etc/profile

  2. # System wide environment and startup programs, for login setup
  3. # Functions and aliases go in /etc/bashrc

  4. # It's NOT a good idea to change this file unless you know what you
  5. # are doing. It's much better to create a custom.sh shell script in
  6. # /etc/profile.d/ to make custom changes to your environment, as this
  7. # will prevent the need for merging in future updates.

  8. pathmunge () {
  9.     case ":${PATH}:" in
  10.         *:"$1":*)
  11.             ;;
  12.         *)
  13.             if [ "$2" = "after" ] ; then
  14.                 PATH=$PATH:$1
  15.             else
  16.                 PATH=$1:$PATH
  17.             fi
  18.     esac
  19. }


  20. if [ -x /usr/bin/id ]; then
  21.     if [ -z "$EUID" ]; then
  22.         # ksh workaround
  23.         EUID=`id -u`
  24.         UID=`id -ru`
  25.     fi
  26.     USER="`id -un`"
  27.     LOGNAME=$USER
  28.     MAIL="/var/spool/mail/$USER"
  29. fi

  30. # Path manipulation
  31. if [ "$EUID" = "0" ]; then
  32. "/etc/profile" 79L, 1812C



在文件的最后增加这一行,默认没有此行

  1. export TMOUT=10
单位为秒,注意字母有大小写之分,输入错误就不会生效。此功能支持远程连接工具,有些远程连接工具版本也会使用这个设置,所以也会自动退出

要使设置生效,还需要使用source命令

  1. [root@localhost~]#source /etc/profile (或者source .profile)


参考文章:




阅读(3836) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~