美文网首页
初探linux

初探linux

作者: 汤海怪 | 来源:发表于2019-12-21 21:08 被阅读0次
  • 查看我们当前在哪个家下 pwd


    image.png
image.png
  • 命令格式

image.png
  • ls命令

image.png
[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog
[root@localhost ~]# ls -l    能看到的文件
总用量 44
-rw-------. 1 root root  1273 11月 27 07:11 anaconda-ks.cfg
-rw-r--r--. 1 root root 27605 11月 27 07:11 install.log
-rw-r--r--. 1 root root  7572 11月 27 07:10 install.log.syslog
[root@localhost ~]# ls -lh      人性化查看
总用量 44K
-rw-------. 1 root root 1.3K 11月 27 07:11 anaconda-ks.cfg
-rw-r--r--. 1 root root  27K 11月 27 07:11 install.log
-rw-r--r--. 1 root root 7.4K 11月 27 07:10 install.log.syslog
[root@localhost ~]# ls -a      查看所有目录
.                .bash_logout   .cshrc              .tcshrc
..               .bash_profile  install.log         .Xauthority
anaconda-ks.cfg  .bashrc        install.log.syslog
[root@localhost ~]# ls -l /etc
总用量 1808
drwxr-xr-x.  3 root root   4096 11月 27 07:09 abrt
drwxr-xr-x.  4 root root   4096 11月 27 07:10 acpi


[root@localhost ~]# ls -ld /etc/       查看目录本身
drwxr-xr-x. 105 root root 12288 11月 28 01:02 /etc/

[root@localhost ~]# ls -i        我们知道每个文件都一个id号,系统查找文件就是通过id号
796998 anaconda-ks.cfg  784899 install.log  784900 install.log.syslog


  • rw-r--r--
[root@localhost ~]# ls -l   也可以写成ll
总用量 44
-rw-------. 1 root root  1273 11月 27 07:11 anaconda-ks.cfg
-rw-r--r--. 1 root root 27605 11月 27 07:11 install.log
-rw-r--r--. 1 root root  7572 11月 27 07:10 install.log.syslog

#文件类型有10位
    文件类型(- 文件 d 目录 | 软链接文件)
rw-      r--      r--
u所有者  g所有组  o其他人
r读  w写  x执行
  • 文件处理命令

    • 目录处理命令
  • 建立目录

image.png

[root@localhost ~]# ls      查看目录
anaconda-ks.cfg  install.log  install.log.syslog

[root@localhost ~]# mkdir bols    创建文件夹
[root@localhost ~]# ls
anaconda-ks.cfg  bols  install.log  install.log.syslog
[root@localhost ~]# mkdir japan/dinner   因为都不存在,会报错
mkdir: 无法创建目录"japan/dinner": 没有那个文件或目录
[root@localhost ~]# mkdir -p japan/dinner    用-p来进行递归创建
[root@localhost ~]# ls
anaconda-ks.cfg  bols  install.log  install.log.syslog  japan
[root@localhost ~]# cd japan/    查看japan文件夹
[root@localhost japan]# ls
dinner

  • 切换目录命令
image.png
[root@localhost japan]# cd /root/    返回root目录
[root@localhost ~]# pwd          查看当前目录
/root
[root@localhost ~]# cd japan/    进入japan文件夹
[root@localhost japan]# ls
dinner
[root@localhost japan]# cd dinner   进入dinner文件夹
[root@localhost dinner]# ls        因为没有文件
[root@localhost dinner]# pwd      查看当前目录
/root/japan/dinner

ctrl + l 清屏

相对路径 绝对路径

image.png
  • 相对路径
- 相对路径  从当前路径开始

[root@localhost ~]# pwd    当前目录
/root
[root@localhost ~]# cd ../usr/local/src/   当前前一个目录就是根目录
[root@localhost src]# pwd
/usr/local/src
[root@localhost src]# cd ../usr/local/src/   当前是src 之前的目录是local 就不能在用了,会报错
-bash: cd: ../usr/local/src/: 没有那个文件或目录


- 绝对路径

[root@localhost src]# cd /etc/   直接从根目录开始怎么都行
[root@localhost etc]# cd
[root@localhost ~]# cd /etc/

  • pwd

image.png
  • 删除空目录 只能删除空目录
image.png
  • 删除目录
image.png
  • 复制命令
image.png
  • 剪切或改名 注意不需要 -r
image.png

相关文章

  • Linux初探

    作为.net开发者为何要学习Linux 对于普通用户来说,Windows桌面系统都使用的炉火纯青,因为UI化的操作...

  • 初探linux

    查看我们当前在哪个家下 pwdimage.png 命令格式 ls命令 rw-r--r-- 文件处理命令目录处理命...

  • C#开发linux服务初探2

    承接上文《C#开发linux服务初探1》,本篇记录将c#程序,部署成linux服务程序。 1下载 anyexec ...

  • LINUX的初探

    计算机的组成 冯诺依曼体系 一般而言,计算机的组成遵循着“冯诺依曼体系结构”。这种结构的体现实质上是一种存储程序的...

  • linux命令初探

    linux命令分类:shell内部命令:一般是最常用最简单的指令如 cd ,type 在shell启动时载入内存s...

  • Linux学习笔记 | 初探Linux

    一、Linux是什么 Linux是一套操作系统。我们知道计算机是由一堆硬件所组成的,为了更有效低控制这些硬件资源,...

  • 2016-06-14

    RHEL 7 网络初探 Redhat Linux 7已经出来好久了,但是我一直没有仔细研究。现在因为项目需要,我需...

  • 初探python之做一个简单小爬虫

    准备工作 初探python,这个文章属于自己的一个总结。所以教程面向新手,无技术含量。python环境Linux基...

  • 01 Linux操作初探

    回到根目录: 列出文件夹内文件 运行结果: usr/bin和根目录bin两个目录一般是存放二进制可执行文件的文件的...

  • Linux C编程初探

    之前一直都是在Windows下享受IDE带来的各种便利,但对于程序到底是怎么从源代码变成可执行文件的,一直不甚明了...

网友评论

      本文标题:初探linux

      本文链接:https://www.haomeiwen.com/subject/wkfywctx.html