Linux 命令行概览

文件管理

  1. 切换目录 cd
  2. 查看目录 pwd, ls
  3. 打印文件到命令行 cat
  4. 编辑文件 vim, nano
  5. 改变文件所属用户 chown
  6. 改变文件所属组 chgrp
  7. 下载文件 curl, wget
  8. 搜索文件 find, grep, locate
  9. 显示部分内容 head, tail, more, less

运行程序

  1. 直接运行 ./
  2. 退出 ctrl + c
  3. 后台运行 nohup [command] > nohup.log 2>&1 &;
  4. 强制关闭 ps -ef | grep [keyword] | awk '{print $2}' | xargs kill -9
  5. 通过 .service 管理 systemctl enable | start | stop | restart x.service

关机和重启

  1. 关机 poweroff, halt, init 0
  2. 重启 restart, init 6

用户管理

  1. 创建用户 useradd
  2. 设置密码 passwd

安装软件

  1. RPM安装 rpm -ivh x.rpm
  2. RPM查找 rpm -qa | grep jdk
  3. RPM列表 rpm -aq | less
  4. YUM安装 yum install [program_name]
  5. YUM查找 yum search [program_name]
  6. YUM配置文件 /etc/yum.repos.d/CentOS-Base.repo

评论