Linux学习-day2-常用命令2

1. 用户组管理命令

    1)groupadd新增组

    2)groupdel删除组

    3)groupmod修改组

    4)cat /etc/group查看创建了那些组

2. 文件属性

    1)

 

    2)chmod改变权限

        改变文件或者目录权限
        文件: r-查看;w-修改;x-执行文件
        目录: r-列出目录内容;w-在目录中创建和删除;x-进入目录
        删除一个文件的前提条件:该文件所在的目录有写权限,你才能删除该文件。

        [root@hadoop106 test1]# chmod u+x test1.java

        [root@hadoop106 test1]# chmod g+x test1.java

        [root@hadoop106 test1]# chmod o+x test1.java

        [root@hadoop106 test1]# chmod 777 test1.java

        [root@hadoop106 test1]#chmod -R 777 testdir

    3)chgrp改变所属组

        [root@hadoop106 test1]# chgrp atguigu test1.java

        [root@hadoop106 test1]# ls -al

        -rwxr-xr-x. 1 root atguigu 551 5月 23 13:02 test1.java

    4)chown改变所有者

        [root@hadoop106 test1]# chown atguigu test1.java 
        [root@hadoop106 test1]# ls –al
        -rwxr-xr-x. 1 atguigu atguigu 551 5月 23 13:02 test1.java

    5)su 切换用户

 

3. 磁盘分区类:

    1)fdisk查看分区:fdisk -l root才能使用

    2)df查看硬盘:df -h

    3)mount/umount挂载/卸载

 

4. 搜索查找类:

    1)find查找文件或目录

    (1)按文件名:根据名称查找/目录下的filename.txt文件。

        [root@hadoop106 ~]# find /opt/ -name '*.txt'

    (2)按拥有者:查找/opt目录下,用户名称为-user的文件

        [root@hadoop106 ~]# find /opt/ -user atguigu

    (3)按文件大小:在/home目录下查找大于200m的文件(+n 大于  -n小于   n等于)

        [root@hadoop106 ~]# find /home –size +204800

 

    2)grep在文件内搜索字符串匹配的行并输出

        grep+参数+查找内容+源文件

 

    3)搜索命令所在目录和别名信息 which + 命令名

 

5. 进程线程类

    进程是正在执行的一个程序或命令,每一个进程都是一个运行的实体,都有自己的地址空间,并占用一定的系统资源。

        ps 查看系统中所有进程

        top 查看系统健康状态

        pstree 查看进程数

        kill 终止进程

        netstat 显示网络统计信息

 

6.压缩和解压类

    1)gzip/gunzip 只能压缩文件不能压缩目录

    2)tar打包

        压缩:tar -zcvf XXX.tar.gz n1.txt n2.txt

        解压:tar -zxvf XXX.tar.gz   解压到别的目录tar -zxvf test.tar.gz –C /opt

    3)zip/unizp压缩:zip test.zip test1.java  test.java 

 

7. 后台服务管理类:

    1)service后台服务管理

    2)chkconfig设置后台服务的自启配置

    3)crond系统定时任务

猜你喜欢

转载自blog.csdn.net/canglan211/article/details/80801646
今日推荐