CentOS 常用系统命令

2020-01-30 15:15:43丽君

用户
# w                      # 查看活动用户
# id <用户名>            # 查看指定用户信息
# last                   # 查看用户登录日志
# cut -d: -f1 /etc/passwd   # 查看系统所有用户
# cut -d: -f1 /etc/group    # 查看系统所有组
# crontab -l             # 查看当前用户的计划任务

服务
# chkconfig --list       # 列出所有系统服务
# chkconfig --list | grep on    # 列出所有启动的系统服务

程序
# rpm -qa                # 查看所有安装的软件包

修改hostname,需修改两处:

1)  vim  /etc/sysconfig/network 修改 HOSTNAME=your_hostname
2)vim /etc/hosts  修改 12.160.134.168  your_hostname

Python 安装

1) 下载 Python, 直接下载 Python-2.7.6.tar.xz
2) 安装.tar.xz 解压工具: yum -y install xz
3) 解压.tar.xz文件: unxz Python-2.7.6.tar.xz     和   tar xvf Python-2.7.6.tar
4) cd Python-2.7.6
5) ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
         make && make altinstall

pip 安装

1) wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
2) python2.7 ez_setup.py
3) easy_install-2.7 pip
4) pip2.7 install [packagename]
  pip2.7 install --upgrade [packagename]
  pip2.7 uninstall [packagename]