Linux - 目录结构与查看,复制,删除,剪切指令
Linux当中,一切皆文件。
Linux目录结构
/ 根分区,只有root用户对此目录拥有写权限。
/etc 配置文件
/boot 启动文件
/var 可增长的目录 。日志,文件等。
/root 管理员所有数据 root用户的家目录。
/tmp 临时文件 (大概15天清空一次。)
/usr unix software source /usr/src 源代码目录。/usr/local 自己的软件安装位置。
/bin 命令 二进制可执行文件。
/sbin 系统命令。
/mnt 挂载目录。
/dev 设备文件。 一切皆文件,终端,磁盘等。键盘,鼠标等。
/home 普通用户文件存放位置。
/proc 虚拟目录。可以查看每个进程的情况。
/lib 存放系统的库文件(动态库,静态库。 .a静态库,.so动态库)。类似于.dll文件。
绝对路径与相对路径
绝对路径是从/ 开始的。
相对路径是以. .. 开始的。
创建,删除复制文件
touch a.txt
创建一个文件
mkdir test
创建一个目录
[root@local ~]# cat a.txt
hello linux
查看文件
[root@local ~]# less /var/log/messages
less 可以上下左右查看。enter,空格都是下一页。q退出查看。
[root@local ~]# more /var/log/messages
more只能向下翻页查看。
[root@local ~]# cat /var/log/messages
cat一次性展示所有内容。
[root@local ~]# tail -n 10 /var/log/messages
Jan 5 15:30:01 local systemd: Started Session 14 of user root.
Jan 5 15:30:01 local systemd: Starting Session 14 of user root.
Jan 5 15:40:01 local systemd: Started Session 15 of user root.
Jan 5 15:40:01 local systemd: Starting Session 15 of user root.
Jan 5 15:50:01 local systemd: Started Session 16 of user root.
Jan 5 15:50:01 local systemd: Starting Session 16 of user root.
Jan 5 16:00:01 local systemd: Started Session 17 of user root.
Jan 5 16:00:01 local systemd: Starting Session 17 of user root.
Jan 5 16:01:01 local systemd: Started Session 18 of user root.
Jan 5 16:01:01 local systemd: Starting Session 18 of user root.
tail 最后多少行。
[root@local ~]# head -n 10 /var/log/messages
Jan 2 16:17:58 local rsyslogd: [origin software="rsyslogd" swVersion="7.4.7" x-pid="887" x-info="http://www.rsyslog.com"] start
Jan 2 16:17:47 local journal: Runtime journal is using 8.0M (max allowed 99.2M, trying to leave 148.9M free of 984.9M available → current limit 99.2M).
Jan 2 16:17:47 local journal: Runtime journal is using 8.0M (max allowed 99.2M, trying to leave 148.9M free of 984.9M available → current limit 99.2M).
Jan 2 16:17:47 local kernel: Initializing cgroup subsys cpuset
Jan 2 16:17:47 local kernel: Initializing cgroup subsys cpu
Jan 2 16:17:47 local kernel: Initializing cgroup subsys cpuacct
Jan 2 16:17:47 local kernel: Linux version 3.10.0-327.el7.x86_64 (mockbuild@x86-034.build.eng.bos.redhat.com) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Oct 29 17:29:29 EDT 2015
Jan 2 16:17:47 local kernel: Command line: BOOT_IMAGE=/vmlinuz-3.10.0-327.el7.x86_64 root=UUID=87b51ffa-2f57-4ac2-99e7-e491bb257520 ro rhgb quiet LANG=zh_CN.UTF-8
Jan 2 16:17:47 local kernel: Disabled fast string operations
Jan 2 16:17:47 local kernel: e820: BIOS-provided physical RAM map:
head 开头多少行。
[root@local ~]# tail -f -n 10 /var/log/messages
Jan 5 15:30:01 local systemd: Started Session 14 of user root.
Jan 5 15:30:01 local systemd: Starting Session 14 of user root.
Jan 5 15:40:01 local systemd: Started Session 15 of user root.
Jan 5 15:40:01 local systemd: Starting Session 15 of user root.
Jan 5 15:50:01 local systemd: Started Session 16 of user root.
Jan 5 15:50:01 local systemd: Starting Session 16 of user root.
Jan 5 16:00:01 local systemd: Started Session 17 of user root.
Jan 5 16:00:01 local systemd: Starting Session 17 of user root.
Jan 5 16:01:01 local systemd: Started Session 18 of user root.
Jan 5 16:01:01 local systemd: Starting Session 18 of user root.
Jan 5 16:03:51 local systemd-logind: New session 19 of user root.
Jan 5 16:03:51 local systemd: Started Session 19 of user root.
Jan 5 16:03:51 local systemd: Starting Session 19 of user root.
Jan 5 16:03:51 local dbus[887]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
Jan 5 16:03:51 local dbus-daemon: dbus[887]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
Jan 5 16:03:51 local dbus[887]: [system] Successfully activated service 'org.freedesktop.problems'
Jan 5 16:03:51 local dbus-daemon: dbus[887]: [system] Successfully activated service 'org.freedesktop.problems'
tail -f 动态的查看数据。这个很实用。
[root@local ~]# rm -r test2
rm:是否删除目录 "test2"?y
[root@local ~]# rm -rf test
rm -r 包括子目录,-f 强制删除。
cp 复制。
[root@local ~]# cp b.txt a.txt
mv 重命名。剪切。
[root@local ~]# mv a.txt b.txt
Linux - 目录结构与查看,复制,删除,剪切指令的更多相关文章
- Linux目录结构以及文件操作
Linux目录结构 UNIX 是以目录为主的,Linux 也继承了这一优良特性. Linux 是以树形目录结构的形式来构建整个系统的,可以理解为树形目录是一个用户可操作系统的骨架.虽然本质上无论是目录 ...
- Linux 目录结构及文件基本操作
Linux 目录结构及文件基本操作 实验介绍 1.Linux 的文件组织目录结构. 2.相对路径和绝对路径. 3.对文件的移动.复制.重命名.编辑等操作. 一.Linux 目录结构 在讲 Linux ...
- Linux目录结构及文件基础操作
一.Linux目录结构 windows系统中主要以存储介质为主(磁盘). UNIX和Linux系统中主要是以目录为主(以树形目录结构的形式构建整个系统). 1. FHS(Filesystem Hier ...
- Linux 目录结构和常用命令
Linux目录结构 目录 说明 bin 存放二进制可执行文件(ls,cat,mkdir等) boot 存放用于系统引导时使用的各种文件 dev 用于存放设备文件 etc 存放系统配置文件 home 存 ...
- 实验楼学习linux第一章第四节linux目录结构及文件基本操作
linux目录结构及文件基本操作 常用命令 切换目录 cd 当前目录 . 上一级目录 .. (.和..开头的都是隐藏文件) 查看隐藏文件 ls -a 上一级所在目录 - 当前用户home目录 ~ 获取 ...
- Linux(2)- linux目录结构、shell基本命令
一.Linux之文档与目录结构 1.Linux文件系统结构 Linux目录结构的组织形式和Windows有很大的不同.Linux没有“盘(如C盘.D盘.E盘)”的概念,而是建立一个根"/&q ...
- Linux(3):linux目录结构
查看系统版本: [root@neo ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@neo ~]# uname -r 2.6. ...
- 二、Linux目录结构&常用指令
Linux目录结构: ps -ef:任务管理器 ifconfig: 查看ip ping : 测试与目标主机的连通性,ctrl+c停止 目录指令: ll:列出当前目录下的文件信息 ls -al : 列 ...
- Linux目录结构和基础命令
Linux目录和基础命令 目录 Linux目录和基础命令 1 Linux目录结构 1.1 Linux文件名命令要求 1.2 文件的类型 2. 基础命令 2.1 ls 2.2 cd和pwd 2.3 命令 ...
随机推荐
- C# 多线程系列(三)
线程池 创建线程需要时间,如果有不同的小任务要完成,就可以事先创建许多线程,在应完成这些任务时发出请求.这个线程数最好在需要更多线程时增加,在需要释放资源时减少. 不需要自己创建这样的一个列表.该列表 ...
- java编译器和java解释器、JVM
作用: JVM:JVM有自己完善的硬件架构,如处理器.堆栈(Stack).寄存器等,还具有相应的指令系统(字节码就是一种指令格式).JVM屏蔽了与具体操作系统平台相关的信息,使得Java程序只需要生成 ...
- less 安装和webstorm的使用
1.less 的安装 npm install -g less 2.less安装成功 3.less安装成功后,在webstorm中进行配置.file——>settings:弹出settings框, ...
- 省市区县的sql语句——区县
DROP TABLE IF EXISTS `area`; CREATE TABLE `area` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` va ...
- HDU_5810_数学,概率,方差
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5810 大意:将n个球往m个盒子中投,每个球被投入每个盒子的概率相等,求方差. 看题解说,这是二项分布( ...
- iOS 加密算法汇总
CCCryptorStatus CCCryptorCreate( CCOperation op, /* kCCEncrypt, etc. */ CCAlgorithm alg, ...
- java输入输入流图解
- 【转】虚拟化(五):vsphere高可用群集与容错
vsphere高级功能需要vcenter server和共享存储的支持才能实现.vsphere的高级功能有 vmotion.storage vmotion.vsphere HA.vsphere DRS ...
- Log4net日志发布到服务器上日志无法写入
log4net在本地执行时候,日志正常写入,但是发布到服务器上的时候,日志就无法正常写入 解决方案: 1.文件权限 在发布到服务器上的时候,可能文件没有写入权限,导致日志无法正常写入 打开IIS 找到 ...
- 三种办法来安装Python3.x
Centos7默认自带了Python2.7版本,但是因为项目需要使用Python3.x你可以按照此文的三个方法进行安装. 注:本文示例安装版本为Python3.5, 一.Python源代码编译安装 安 ...