linux和shell学习

sudo spctl --master-disable开启application安装时的来自任何来源;

sudo lsof  -i:9000;sodu kill -9 pid;查看端口占用并杀死进程;

rmic编译器生成stub类和skeleton类;

/home 安装软件

  • 内核的引导
    • /boot
  • 运行init
    • SysV: init, CentOS 5之前, 配置文件: /etc/inittab。
    • Upstart: init,CentOS 6, 配置文件: /etc/inittab, /etc/init/*.conf。
    • Systemd: systemd, CentOS 7,配置文件: /usr/lib/systemd/system、 /etc/systemd/system。
      • daemon
      • runlevel
  • 系统初始化
    •  
  • 建立终端
  • 用户登录系统
  • 系统目录结构
    •   /bin常用命令/boot启动链接镜像/dev外部设备/etc系统管理/home主目录/lib动态连接共享库
    • /lost+found非法关机/media外部设备挂载/mnt临时media/opt软件/proc内存/root超级权限主目录
    • /sbin系统管理程序/selinux防火墙/srv服务数据/sys(proc+devfs+devpts)/tmp临时
    • /usr(program files )/usr/binsbin(bin和sbin)/usr/src内核源代码。/var(variable)
      •   3s-e-single-passwd
  • 远程登录SecureCRT,Putty,SSH Secure Shell;ssh -p(port)
  • 文件属性
    •   ll或者ls -l
    • d目录-文件l链接b可随机存取装置c一次性读取装置
    • chgrp -r 递归 owner grouper/chown -r owner:grouper filer/chmod -r xyz filer(x1r2w4)/
    • chmod o/g/u/a(逗号间隔) +-= xrw file
    • cat
    • nl
    • tac
    • more/less
    • useradd -c comment -d dir -g group -G apGroup -s ShellDir (-u -o)[etc/passwd..][userconf]
    • userdel -r name
    • usermod (useradd command) name
    • passwd -l lock -u unlock -d dis -f first-next
    • groupadd -g GID -o/groupdel/groupmod
    • newgrp name
    • /etc/(passwd,shadow,group)
    • nweusers<(以passwd格式写的txt);passwd<(以name:pwd格式写的txt)
    • pwunconv取消shadow password;pwconv启用shadow password
    • df(-h 文件系统使用量)du(磁盘空间使用量) fdisk(分区)
    • df -a,--all -B,--block-size -t,--type -T,--print-type -x,--exclude-type
    • du 0c,--total --time --time-style -d,--max-depth -S,--separate-dirs 
    • find path parameters regex/-exe {} ;/-ok {} ;
    • curl ifconfig.me查看公网ip
  • 系统信息
    • uname 内核
    • sb_release 系统
    • cat /etc/issue
  • 内存
    • free
  • cpu
    • uptime
    • top
    • cat /proc/cpuinfo
  • 硬盘
    • df
    • du
    • fdisk
    • iostat
  • 终端文本处理脚本命令
    • seq  产生从指定起始值或0到指定终止值之间的整数sequence
    • sed 文件展示处理及修改(善用高级命令h,H,g,G,d,D,!1,$等)
    • awk 复杂格式处理(善用内建变量FS(Field Separator),RS(Record Separator),NF(Number for Field),NR(Number for Record),OFS(out of field separator))
  • diff -y(side-by-side) -c(all-changes) -n(rcs)
  • mount挂载,trap接收信号
  • https://www.cnblogs.com/favana/p/5545132.html
  • https://blog.csdn.net/u013686019/article/details/26846571
  • Shell
    • 后缀可以随便改
    • $(#var)长度 $(var:startInd:endInd)截取 `expr index "${var}" var_s`查找
    • 数组变量值以空格或换行分割 var[@]获取数组所有元素(var[*]应该也可以)
    • #var删除左起至第一var %var删除右起至第一var ##删除左起至最后var %%var删除右起至最后var
    • var=holyshit ${var:7}=t ${var:1-2:3}=t(右边算起) $(var:1-2}=t字符串中最后一个位置是0第一个是1;或者最后一个位置是-1
    • for i in "$@";dodone
      •   echo $i
    • + - * / % = == != 
    • -eq -lt -gt -ge -le -ne
    • ! -o -a
    • && ||
    • =(有空格) != -z -n str([var]) this is about the characters operation.
    • -e(exit) -s() -x(excutable) -w(writable) -r(readable) -f(file?) -d(dir?) 
    • echo -e开启转义  ""可直接使用文本格式
    • test is bound with []
    • 文件包含. file/source file
    • 重定向 >>输出追加;
原文地址:https://www.cnblogs.com/burn19/p/7842726.html