Linux Daily notes-2

Source: Internet
Author: User

First, the command line base 1. Command format
基本用法命令字   [选项]  …   [参数1] [参数2]…[ ] 表示里面的内容可有可无在执行一个命令的时候,命令字必须存在,选项和参数可有可无命令字 选项 参数之间必须有空格各组件解析选项:用来调控执行方式    单个字符一般用-    单词一般用--eg:# ls -l# ls --help参数:命令的操作对象,如文档的存放路径、用户名等
2. Command-line editing tips
tab键功能:命令或者路径的补齐,如果输入的内容唯一标识某一个命令或者路径,tab一次会自动补齐。如果不唯一则tab2次显示出以输入内容开头的所有的命令或者路径      拍错3.快捷键Ctrl + l:清空整个屏幕Ctrl + c:废弃当前编辑的命令行Esc+.:粘贴上一个命令的参数
Second, browse the directory and file 1.ls command
格式:ls  [选项]...  [目录或文件路径]常用命令选项-A:包括名称以 . 开头的隐藏文档-l:以长格式显示-h:必须和-l配合用,提供易读的容量单位(K、M等)-d:显示目录的属性eg:# ls /root# ls -l /root# ls -A /root# ls -lh /root补充:绝对路径:以/开头的路径相对路径:不以/开头的路径通配符 * 和 ?* 匹配任意0-多个字符?匹配任意单个字符eg:# ls /dev/tty*# ls /dev/tty?# ls /dev/tty??
2.cat command
查看文件的内容# cat /etc/resolv.conf      //查看DNS地址# cat /etc/redhat-release   //查看系统的小版本
Iii. creating directories and files 1.mkdir commands
创建目录-p  递归创建目录eg:[[email protected] /]# cd /opt/[[email protected] opt]# ls[[email protected] opt]# mkdir ntd1711[[email protected] opt]# ls[[email protected] opt]# mkdir ntd1712[[email protected] opt]# ls[[email protected] opt]# mkdir ntd1801/group1/huangsir[roo[email protected] opt]# mkdir -p ntd1801/group1/huangsir[[email protected] opt]# ls[[email protected] opt]# ls ntd1801/[[email protected] opt]# ls ntd1801/group1/[[email protected] opt]# ls -R ntd1801/问答题a.请问下面命令创建了几个目录?b.这几个目录分别创建在什么位置?# mkdir -p ntd1802/ group2 /xushuai 请问
2.touch command
创建文件touch  文件名…eg:# cd /vod/movie/cartoon# mkdir -p /vod/movie/cartoon# cd /vod/movie/cartoon/# touch Mulan.mp4 NeZhaNaoHai.mp4# ls -lh *.mp4
Iv. copy, move, delete 1.CP commands
格式:cp  [选项]...  原文件…  目标路径常用命令选项-r:递归,复制目录时必须有此选项-p:保持原文件的权限、修改时间等属性不变eg:[[email protected] ~]# ls -ld /backup[[email protected] ~]# mkdir /backup[[email protected] ~]# ls -ld /backup[[email protected] ~]# cp -r /boot/grub2 /etc/host.conf /backup/[[email protected] ~]# ls -ld /backup/*[[email protected] ~]# cp /boot/ /backup/[[email protected] ~]# ls -ld /backup/*[[email protected] ~]# cp -r /boot/ /backup/[[email protected] ~]# ls -ld /backup/*
2.RM Delete
格式:rm  [选项]...  文件或目录…常用命令选项-r、-f:递归删除(含目录)、强制删除eg:[[email protected] ~]# ls -ld /backup/*[[email protected] ~]# rm /backup/host.conf [[email protected] ~]# rm -f /backup/grub2/ [[email protected] ~]# rm -rf /backup/grub2/ [[email protected] ~]# rm -rf /backup/boot/[[email protected] ~]# ls -ld /backup/*
3.MV Move or rename
格式:mv  [选项]...  原文件…  目标路径eg:[[email protected] ~]# ls -l /vod/movie/cartoon/Mulan.mp4 [[email protected] ~]# mv /vod/movie/cartoon/Mulan.mp4 /backup/[[email protected] ~]# ls -l /backup/[[email protected] ~]# mv /backup/Mulan.mp4 /backup/HuaMulan.mp4[[email protected] ~]# ls -l /backup/

Linux Daily notes-2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.