linux shell

  • chmod [777] [u-r] [u=r] filename
  • -rwxrwx---
  • cd - cd ~ = cd
  • cp source target 将文件source复制为target cp -r
  • rm rm -r
  • mv
    ln命令

功能:建立链接。windows的快捷方式就是根据链接的原理来做的

ln source_path target_path 硬连接

ln -s source_path target_path 软连接

  • cat file

tail 命令

功能:显示文件的最后几行

tail -n 100 aaa.txt 显示文件aaa.txt文件的最后100行

  • vi 三种工作模式
    i a o I A O

  • touch

8、关闭和重新启动系统命令

reboot  重新启动计算机

shutdown -r now 重新启动计算机,停止服务后重新启动计算机

shutdown -h now 关闭计算机,停止服务后再关闭系统

  • ps aux 显示所有用户的进程

kill -9 1001 将进程编号为1001的程序干掉 kill -KILL pid

  • ps aux | grep "gedit"

5、chown命令

功能:改变文件或目录的所有者

chown user1 /dir 将/dir目录设置为user1所有

chown -R user1.user1 /dir 将/dir目录下所有文件和目录,设置为user1所有,组为user1。-R递归到下面的每个文件和目录

7、chmod命令

功能:改变用户的权限

chmod a+x file 将file文件设置为可执行,脚本类文件一定要这样设置一个,否则得用bash file才能执行

chmod 666 file 将文件file设置为可读写

chmod 750 file 将文件file设置为,所有者为完全权限,同组可以读和执行,其他无权限

  • 打包命令 tar -cvf test.tar *
  • 解包命令 tar -xvf test.tar
    tar -zcvf test.tar.gz *
    tar -zxvf test.tar.gz

你可能感兴趣的:(linux shell)