Home - huwenyuan/Linux GitHub Wiki

####$ Set Environment Variable

  • For single user:

    vi ~/.bash_profile

Add:

export JAVA_HOME=/usr/lib...

  • For all users:

    vi /etc/profile

To make it effect:

source /etc/profile

####$ Install OpenJDK on Ubuntu sudo apt-get install default-jre

sudo apt-get install default-jdk

Or:

sudo apt-get install openjdk-7-jre

sudo apt-get install openjdk-7-jdk

####$Add username in sudoers file If the user name not in sudoers file, when running sudo command will get error:

username is not in the sudoers file. This incident will be reported.

To add username in sudoers file, open /etc/sudoers, add following line:

username ALL=(ALL:ALL) ALL

See [this] (https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos) for detail

####$Check System and Process Status top

####$Check Disk Space df

The “df” command displays the information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system.

df -h human readable format

####$Check Disk Usage by file/folder du -hs /usr/cad/*

-h means human readable format, -s means summarize (for folder, show the total disk usage of that folder)

####Linux OS 将操作 环境分为以下7个等级,即 0. 关机

  1. 用户模式(单用户、无网络)
  2. 无网络支持的多用户模式(多用户、无网络)
  3. 有网络支持的多用户模式(多用户、有网络)
  4. 保留,未使用
  5. 有网络支持有X-Window支持的多用户模式(多用户、有网络、X-Window界面)
  6. 重新引导系统,即重启

Linux中有多种运行级,常见的就是多用户的2,3,4,5 ,很 多人知道5是运行X-Windows的级别,而0就是关机了。运行级的改变可以通过init命令来切换。例如,假 设你要维护系统进入单用户状态,那 么,可以使用init1来切换。在Linux的运行级的切换过程中,系统会自动寻找对应运行级的目录/etc/rc[0-6].d下的K和S开头的文件, 按后面的数字顺序,执行这些脚本。