Linux basic knowledge

Linux磁盘管理 要进行磁盘管理,首先我们需要知道磁盘的基本使用状况,使用了多少,还剩多少等等。df命令可以帮助我们看到它。 查看磁盘分区使用状况 df [选项] [文件]显示指定磁盘文件的可用空间。如果没有文件名被指定,则所有当前被挂载的文件系统的可用空间将被显示。默认情况下,磁盘空间将以 1KB 为单位进行显示。 选项: -a 全部文件系统列表 -h 方便阅读方式显示 -H 等于“-h”,但是计算 阅读详情

Linux获取CPU,内存和硬盘信息

本文目的

本文搜集了Linux上常用的获取机器配置信息和实时信息相关命令。这些命令在开发运维相关程序时,比较常用。

CPU

  • CPU位数(32或64): getconf LONG_BIT
  • CPU配置信息:cat /proc/cpuinfo
  • CPU实时信息:top -n 1 | grep Cpu | cut -d ',' -f 4 (获取实时CPU空闲率)

          P.S.: 上面命令中最后的4可以换成其他值,以获取不同CPU实时信息

Memeory

  • 内存实时数据:free

          P.S.:第二行数据以系统角度,第三行数据以用户角度

  • 内存实时统计数据:cat /proc/meminfo

Hard Disk

  • 硬盘实时数据:df 
  • 获取目录下每个文件大小:du

Top

top程序可以获取当前时刻系统cpu,mem的相关信息,可以使用相关shell命令,抓取你所需要的特定信息,正如上面获取CPU实时信息中使用的方式。


Hard link is a bit different object when compared to a symlink. In softlink a new file and a new Inode is created, but in hard link, only an entry into directory structure is created for the file, but it points to the inode location of the original file. Which means there is no new inode creation in the hard link

【硬连接】
硬连接指通过索引节点来进行连接。在Linux的文件系统中,保存在磁盘分区中的文件不管是什么类型都给它分配一个编号,称为索引节点号(Inode Index)。在Linux中,多个文件名指向同一索引节点是存在的。一般这种连接就是硬连接。硬连接的作用是允许一个文件拥有多个有效路径名,这样用户就可以建立硬连接到重要文件,以防止“误删”的功能。其原因如上所述,因为对应该目录的索引节点有一个以上的连接。只删除一个连接并不影响索引节点本身和其它的连接,只有当最后一个连接被删除后,文件的数据块及目录的连接才会被释放。也就是说,文件真正删除的条件是与之相关的所有硬连接文件均被删除。
硬连接的2个限制:
1  不允许给目录创建硬链接
2  只有在同一文件系统中的文件之间才能创建链接。 即不同硬盘分区上的两个文件之间不能够建立硬链接。这是因为硬链接是通过结点指向原始文件的,而文件的i-结点在不同的文件系统中可能会不同。
 
【软连接】
另外一种连接称之为符号连接(Symbolic Link),也叫软连接。软链接文件有类似于Windows的快捷方式。它实际上是一个特殊的文件。在符号连接中,文件实际上是一个文本文件,其中包含的有另一文件的位置信息。
这就允许符号链接(经常简写为symlinks)指向位于其他分区、甚至是其他网络硬盘上的某个文件
删除原文件,查看软连接会报找不到文件;删除原文件,对硬链接没有影响。
 
本质的区别:
(1)软连接可以 跨文件系统 ,硬连接不可以 。实践的方法就是用共享文件把windows下的 aa.txt文本文档连接到linux下/root目录 下 bb,cc . ln -s aa.txt /root/bb 连接成功 。ln aa.txt /root/bb 失败;

(2)关于 I节点的问题 。硬连接不管有多少个,都指向的是同一个I节点,会把结点连接数增加,只要结点的连接数不是 0,文件就一直存在 ,不管你删除的是源文件还是连接的文件。只要有一个存在,文件就 存在(其实也不分什么 源文件连接文件的 ,因为他们指向都是同一个 I节点)。 当你修改源文件或者连接文件任何一个的时候,其他的 文件都会做同步的修改 。
 
软链接不直接使用i节点号作为文件指针, 而是使用文件路径名作为指针。所以删除连接文件对源文件无影响,但是删除源文件,连接文件就会找不到要指向的文件。软链接有自己的inode, 并在磁盘上有一小片空间存放路径名。
 
(3)硬链接不增加系统的I节点数目,软链接增加系统I节点数目



Understanding UNIX / Linux symbolic (soft) and hard links

Inodes are associated with precisely one directory entry at a time. However, with hard links it is possible to associate multiple directory entries with a single inode. To create a hard link use ln command as follows:
# ln /root/file1 /root/file2
# ls -l

Above commands create a link to file1. Symbolic links refer to:



A symbolic path indicating the abstract location of another file.

Hard links refer to:

The specific location of physical data.

Hard link vs. Soft link in Linux or UNIX

  • Hard links cannot link directories.
  • Cannot cross file system boundaries.

Soft or symbolic links are just like hard links. It allows to associate multiple filenames with a single file. However, symbolic links allows:

  • To create links between directories.
  • Can cross file system boundaries.

These links behave differently when the source of the link is moved or removed.

  • Symbolic links are not updated.
  • Hard links always refer to the source, even if moved or removed.

How do I create symbolic link?

You can create symbolic link with ln command:
$ ln -s /path/to/file1.txt /path/to/file2.txt
$ ls -ali

Above command will create a symbolic link to file1.txt.

Task: Symbolic link creation and deletion

Let us create a directory called foo, enter:
$ mkdir foo
$ cd foo

Copy /etc/resolv.conf file, enter:
$ cp /etc/resolv.conf .
View inode number, enter:
$ ls -ali
Sample output:

total 152
1048600 drwxr-xr-x   2 vivek vivek   4096 2008-12-09 20:19 .
1015809 drwxrwxrwt 220 root  root  143360 2008-12-09 20:19 ..
1048601 -rwxr-xr-x   1 vivek vivek    129 2008-12-09 20:19 resolv.conf

Now create soft link to resolv.conf, enter:
$ ln -s resolv.conf alink.conf
$ ls -ali

Sample output:

total 152
1048600 drwxr-xr-x   2 vivek vivek   4096 2008-12-09 20:24 .
1015809 drwxrwxrwt 220 root  root  143360 2008-12-09 20:19 ..
1048602 lrwxrwxrwx   1 vivek vivek     11 2008-12-09 20:24 alink.conf -> resolv.conf
1048601 -rwxr-xr-x   1 vivek vivek    129 2008-12-09 20:19 resolv.conf

The reference count of the directory has not changed (total 152). Our symbolic (soft) link is stored in a different inode than the text file (1048602). The information stored in resolv.conf is accessible through the alink.conf file. If we delete the text file resolv.conf, alink.conf becomes a broken link and our data is lost:
$ rm resolv.conf
$ ls -ali

If alink.conf was a hard link, our data would still be accessible through alink.conf. Also, if you delete the soft link itself, the data would still be there. Read man page of ln for more information.
Continue reading rest of the Understanding Linux file system series (this is part VI):

  • Part I – Understanding Linux superblock
  • Part II – Understanding Linux superblock
  • Part III – An example of Surviving a Linux Filesystem Failures
  • Part IV – Understanding filesystem Inodes
  • Part V – Understanding filesystem directories
  • Part VI – Understanding UNIX/Linux symbolic (soft) and hard links
  • Part VII – Why isn’t it possible to create hard links across file system boundaries?
grub配置文件默认为:/boot/grub/grub.conf
 
cat /etc/grub.conf(为软链接)
 
default 定义缺省启动 系统 (多系统有意思)
 
timeout 定义默认等待时间
 
splashimage 定义GRUB界面图片
 
title 定义菜单项名称
 
root  定义内核所在分区
 
kernel 指定内核文件所在位置
 
initrd  指定镜像文件所在位置
 
单用户是干嘛的? 能干嘛?  其实就跟window的安全模式一样 假如你的密码忘记 进去可以修改  单用户也可就是init1 级别
 
     进入单用户模式  开机后进grub界面。按下e进入菜单项,选中kernel行,再次按下e进入编辑模式,在行后空格并输入1,火车保存按b键引导,既可以进入单用户模式
 
   要是想修改你的启动画面等 都可以都这里设置

9.2. GRUB

The GNU GRand Unified Boot loader (GRUB) is a program which enables the selection of the installed operating system or kernel to be loaded at system boot time. It also allows the user to pass arguments to the kernel. 

9.2.1. GRUB and the x86 Boot Process

This section discusses the specific role GRUB plays when booting an x86 system. For a look at the overall boot process, refer to Section 30.2, “A Detailed Look at the Boot Process”. 

GRUB loads itself into memory in the following stages: 

  1. The Stage 1 or primary boot loader is read into memory by the BIOS from the MBR[4]. The primary boot loader exists on less than 512 bytes of disk space within the MBR and is capable of loading either the Stage 1.5 or Stage 2 boot loader. 

  2. The Stage 1.5 boot loader is read into memory by the Stage 1 boot loader, if necessary. Some hardware requires an intermediate step to get to the Stage 2 boot loader. This is sometimes true when the /boot/partition is above the 1024 cylinder head of the hard drive or when using LBA mode. The Stage 1.5 boot loader is found either on the /boot/ partition or on a small part of the MBR and the /boot/ partition. 

  3. The Stage 2 or secondary boot loader is read into memory. The secondary boot loader displays the GRUB menu and command environment. This interface allows the user to select which kernel or operating system to boot, pass arguments to the kernel, or look at system parameters. 

  4. The secondary boot loader reads the operating system or kernel as well as the contents of /boot/sysroot/ into memory. Once GRUB determines which operating system or kernel to start, it loads it into memory and transfers control of the machine to that operating system. 

The method used to boot Red Hat Enterprise Linux is called direct loading because the boot loader loads the operating system directly. There is no intermediary between the boot loader and the kernel. 

The boot process used by other operating systems may differ. For example, the Microsoft®Windows® operating system, as well as other operating systems, are loaded using chain loading. Under this method, the MBR points to the first sector of the partition holding the operating system, where it finds the files necessary to actually boot that operating system. 

GRUB supports both direct and chain loading boot methods, allowing it to boot almost any operating system.



用Origin快速拟合荧光寿命、PL Decay (TRPL)数据分析处理 阅读详情

相关推荐

MicroPython ubluetooth 库详细介绍

MicroPython的ubluetooth库为蓝牙通信提供了强大的支持,使得开发者能够在MicroPython环境下轻松实现蓝牙设备之间的通信。其中ubluetooth库为MicroPython提供了强大的蓝牙通信功能,使得开发者能够轻松地在各种支持MicroPython的硬件平台上实现蓝牙设备之间的通信。它提供了一系列的函数和类,用于实现蓝牙设备的扫描、连接、数据传输等功能。- 上述代码中,首先创建了一个蓝牙服务和一个特征,然后可以通过read和write函数读取和写入特征值。# 处理连接成功事件。

m0_46311182的博客 1761

linux 分区 添加 挂载centos挂载 Microsoft basic

linux 分区 添加 挂载centos挂载 Microsoft basic

weixin_39560112的博客 2057

C++ 类

本文介绍了C++中类的核心概念和使用方法。

weixin_54859557的博客 1016

磁盘与文件系统

磁盘与文件系统 整块磁盘的组成 园形的碟片 记录数据 机械手臂 与机械手臂的磁头 可擦写数据 主轴马达 可以转动碟片,让机械手臂在碟片上写数据 扇区 最小的物理存储单位 ,且有512B与4KB的两种格式。 柱面 将扇区组成圆 磁盘分区表主要有两种格式MBR分区表 和GPT分区表。 MBR分区表中,第一个分区表最重要,只要记录主引导记录及分区表,其中MBR占有446B,而分区表占有64B; GPT分区表除了分区是数量增加后分区支持磁盘容量超过2TB 物理磁盘命名 :dev/sd [a-p] [1-128

qq_35931537的博客 597

海康威视工业相机网络配置实战:从MVS软件操作到IP地址规划

本文详细介绍了海康威视工业相机的网络配置实战,从MVS软件操作到IP地址规划。重点讲解了IP设置的重要性、Windows系统下的网络配置步骤、避免IP冲突的技巧,以及MVS软件中的相机IP配置方法。帮助用户快速掌握工业相机的网络连接技术,确保稳定高效的图像采集。

weixin_30296405的博客 484

在 Eclipse 里快速用上 SAP Joule:ABAP 开发者的 AI 助手上手指南

本文介绍了SAP Joule for developers如何集成在ABAP开发工具中,为开发者提供AI辅助能力。主要内容包括: Joule作为ADT的增强层,直接嵌入开发流程,支持在项目资源管理器、代码编辑器等场景下通过上下文菜单调用AI功能。 核心使用方式:打开Joule视图后,可在开发对象、代码片段等上下文中使用自然语言交互,请求解释、生成测试或获取示例代码。 重点功能: Explain:解释现有代码逻辑,降低理解成本 ABAP Unit测试生成:快速创建与上下文相关的测试用例 支持在传输管理器等完整

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 392

Linux挂载磁盘 Microsoft basic data错误解决

Windows系统重装成Ubuntu系统,外接的固态硬盘挂载报错解决,Microsoft basic data

weixin_45225566的博客 4792

【YoloV8改进策略】上采样改进|EUCB,轻量高效的上采样模块|即插即用

YOLOv8作为当前最先进的实时目标检测与实例分割模型之一,其在速度与精度之间取得了出色的平衡。然而,在资源受限的边缘设备或对实时性要求极高的应用场景中,YOLOv8的计算开销,尤其是在特征金字塔网络(FPN)和路径聚合网络(PAN)中用于特征融合的上采样操作,仍然是一个瓶颈。YOLOv8的颈部(Neck)结构中广泛使用nn.Upsample进行上采样,该操作虽然简单,但缺乏对特征内容的感知能力,且后续通常需要标准卷积来修复因插值带来的伪影,这增加了不必要的计算负担。

m0_47867638的博客 750

Linux 挂载/卸载磁盘

Linux 挂载/卸载磁盘 1. 查看磁盘列表 fdisk -l 找到需要挂在的磁盘 Device Start End Sectors Size Type /dev/sda1 2048 1953523711 1953521664 931.5G Microsoft basic data 2. 挂载磁盘 mount /dev/sda1 /media/gz/disk1g 如果出现错误: ntfs-3g-mount:

galoiszhou的博客 9627

【实验】ENSP 实战:酒店有线 + 无线三层组网全配置(VLAN 规划 + AC/AP+SSID 绑定)

三层架构:出口路由器 → 核心交换机 → 汇聚交换机 → 接入交换机 / AP / 终端。

jundao1997的专栏 430

谁还攥着旧的类加载器:Metaspace OOM 的元数据记账、类卸载条件与泄漏定位解析

MetaSpace区是JVM内存管理中的关键部分,负责存储类元数据。随着Java 8的推出,MetaSpace取代了PermGen区,但其灵活性也带来了新的挑战,尤其是在动态类加载和频繁类更新的场景下,容易导致MetaSpace内存溢出(OOM)问题。本文探讨了MetaSpace OOM的根本原因,包括类加载器泄漏、内存管理不当和GC效率低下等,并提供了一系列调优策略和解决方案,帮助开发者有效排查和防止此类问题的发生,确保应用程序的稳定性和高可用性。

曾经“等你生日那天”都遥远得像未来,如今却可欢愉的挥手说“下个十年见” 15万+

linux basic knowledge

全栈必备Linux 基础  标签: Linuxcentosubuntu全栈 2016-09-14 09:13 3064人阅读 评论(2) 收藏 举报  分类: Linux(6)  版权声明:本文为博主原创文章,未经博主允许不得转载。 目录(?)[+] Linux 几乎无处不在,不论是服务器构建,还是客户端开发,操

screaming的博客 393

【大模型应用开发-FastAPI框架】(八)Sqlalchemy+postgresql简单增删改查

语言,为高效和高性能的数据库访问设计,实现了完整的企业级持久模型”。SQLAlchemy的理念是,的量级和性能重要于对象集合;而对象集合的抽象又重要于表和行。因此,SQLAlchemy采用了类似于。社区中成为广泛使用的ORM工具之一,不亚于Django的ORM框架。和declarative等可选插件可以让用户使用声明语法。SQLAlchemy首次发行于2006年2月,并迅速地在。SQLAlchemy“采用简单的。二、安装postgresql。一、SQLAlchemy简介。的数据映射模型,而不是其他。

2098

Linux学习笔记——1、Basic knowledge

参考鸟哥的Linux私房菜地址:http://vbird.dic.ksu.edu.tw/linux_basic/linux_basic.php 参考网中人地址:http://www.study-area.org/linux/linuxfr.htm 工具书:《Linux系统最佳实践工具》 Linux命令在线速查:https://ganquan.info/linux/ 在学习Linux前,应具

2820

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

deep learning and linux basic knowledge

.bashrc .theanorc 后面rc 指的是 runtime configopenmp  指的是是否开启CPU的multi process 多和处理。在终端里面激活环境: source activate python27  source deactivate在终端里面运行Python 语句,第一种方法是Python 直接进入Python交互环境。 第二种方法是 Python -c 'imp...

likejoey的专栏 274

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

Learning Linux(1) : basic knowledge

Installed Ubuntu 10.04.But I could not watch Youku or Xinlang or Tudou online videos using Firefox browser. So I have to go here:http://get.adobe.com/flashplayer/to download the flashplayer needed.

Kevin的专栏 809

Certification Objective 1.01: Basic Linux Knowledge

原文来自:RHCE Red Hat Certified Engineer Linux Study Guide Exam RH302 4th ED 2004.chm认证目标1.01: Basic Linux KnowledgeLinux和Unix都是通过一系列的文本文件来管理。Linux管理员通常不会使用图形化的编辑工具来管理这些配置文件。诸如WordPerfect, StarOffice,

Plan9 615

Notes for the missing semester. Useful and basic knowledge about Linux.

The notes for the missing semester. The course is awesome and I recommend it for all new beginners of Linux.

qq_45523675的博客 1312

linux防火墙基础知识,linux防火墙基本知识(Basic knowledge of Linux Firewall).doc

linux防火墙基本知识(Basic knowledge of Linux Firewall)linux防火墙基本知识(Basic knowledge of Linux Firewall)Firewall classification(1) packet filtering firewalls.Packet filtering (packet Filtering) technology is to...

weixin_39982452的博客 140

linux基础教程-linux运维日志

https://www.centos.bz/linux-basic-knowledge/

m0_37477061的博客 408

linux 基础教程地址(centos)

http://www.centos.bz/linux-basic-knowledge/

sebastain的专栏 603

SQL injection_basic knowledge

help limit

Daria 224

root/user basic knowledge...

UID:使用者的号码GID:群组的号码一般来说 root的UID和GID都为0.可以在/etc/passwd中可以看到只要把UID设为0的话,账户就具有root权限。平时最好不用root来登陆哦~以防不小心修改了文件,会造成致命的错误。。。还有一个常见问题。root的密码是什么呢?可以进普通user 然后输入命令 sudo root passwd

blue881280的专栏 449

在 goose 中接入 Knowledge Graph Memory MCP Server:打造跨会话的持久化知识图谱记忆

知识图谱记忆(Knowledge Graph Memory)扩展把 goose 从"能记住零散偏好"的助手升级为"能理解概念间关联"的推理伙伴:它以实体(entities)、关系(relations)与观测(observations)组织知识,让 goose 可以追溯漏洞影响链、匹配解决方案、发现数据中的隐藏模式。本文将以"将 goose 训练成智能安全审查员"为主线,完整演示如何在 goose

gitblog_00084的博客 469

linux初学者_Linux上的软件开发初学者注意事项

linux初学者Linux is a great platform for software development targeting servers or backends. In general, working on Linux is very productive. The problem that beginners on Linux face is the the learning ...

cuma2369的博客 378

Linux operating system basic knowleadge

1.Linux目录系统结构 It makes sense to explore the Linux filesystem from a terminal window. In fact, that is the name of the first tool you'll install to help you on the way:tree. If you are using Ubunt...

weixin_34112030的博客 122

高效教育资源下载工具:KnowledgeGrab完整使用与部署指南

在数字化教育时代,如何快速获取优质教育资源成为教师和学生的共同需求。KnowledgeGrab作为一款基于Tauri和Vue 3构建的跨平台教育资源下载工具,专为解决国家中小学智慧教育平台资源下载难题而生,让您轻松获取电子课本和课程视频资源。 [![KnowledgeGrab应用图标](https://raw.gitcode.com/gh_mirrors/kn/knowledge-grab/ra

gitblog_00053的博客 999
上一篇: GRUB, GRUB2, BURG
下一篇: What RESTful actually means
screaming
博客等级 码龄19年 60粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值