zoukankan      html  css  js  c++  java
  • 蓝点中文_Linux 实验十 目录与文件管理(二)

    一,实验要求:

    (1)掌握查看文件内容的主要方法(moer,less,和cat命令)

    (2)掌握复制,移动和删除文件(cp,mv,rm)

    (3)掌握不同情况查找文件的方法(find)

    二.实验内容

    实验准备:超级用户身份登录.

    1.查看文件内容

    ●分页显示文件内容:

    more –p filename

    示例:more –p install.log

    image

    >>回车键-->显示下一行内容

    >>空格键-->显示下一屏内容

    >>等号,显示当前行号

    >>q键退出显示.

    ●less –p 查找内容 文件名

    PgDn和PgUp可以翻页查看内容.

    例如less –p zip /root/tmp/install.log

    image

    ●合并test1和test2文件的内容,保存为/root目录下的file5.

    cat /home/temp1/test1 /home/ temp2/test2

    查看test1和test2文件的内容.

    cat /home/temp1/test1 /home/ temp2/test2  >/home/file5

    查看test1和test2文件的内容,并且重定向输出为文件file5.

    image

    2.复制文件

    方法 : cp filename 目的地

    其中filename必须是当前目录下的文件或目录.

    示例:将/home下file5复制到/home/temp1目录下.

    image 3.移动文件

    ●方法: mv filename 目的地

    其中filename必须是当前目录下的文件或目录.

    示例:将/home下f1移动到/home/temp2目录下.

    image 方法:

    将/home目录下file5改名为newfile5

    方法: mv file5 newfile5

    image4.删除文件

    ●删除/home/temp1目录下的文件 file5和test1

    方法: rm 目录名

    image 删除/root下的Desktop目录以及目录下的所有文件.

    方法: rm Desktop 

    rm –r Desktop

    rm –rf Desktop

    image 查看/home目录下的所有链接文件,并指出某个链接文件的具体指向哪个文件.

    方法: find 目录名 –type l

    示例:find /home –type l

    image 查看具体的链接指向:

    ls –l 链接地址.

  • 相关阅读:
    左偏树
    论在Windows下远程连接Ubuntu
    ZOJ 3711 Give Me Your Hand
    SGU 495. Kids and Prizes
    POJ 2151 Check the difficulty of problems
    CodeForces 148D. Bag of mice
    HDU 3631 Shortest Path
    HDU 1869 六度分离
    HDU 2544 最短路
    HDU 3584 Cube
  • 原文地址:https://www.cnblogs.com/xilifeng/p/2571343.html
Copyright © 2011-2022 走看看