绝对路径与相对路径
Created|Updated
|Post Views:
前言
/这个表示根目录下bin/这个表示bin的目录下
绝对路径
一定要从根目录(/)写起,就是要写完整的路径名
相对路径
不是从根目录写起
示例
- 当我们要cd(change directory)的时候,不论是要用绝对路径和相对路径,都要遵循
到(根,当前,上一级)目录下,再到其他的目录(用目录名标识)
cd ../bin 到上一级目录下的bin目录(相对路径)cd ./bin 到当前目录下的bin目录,等同于cd bin(相对路径)cd /bin 到根目录下的bin目录(绝对路径)
特殊的目录
. 此层目录.. 上层目录- 上一个的目录(记录)~ home目录
Related Articles
2020-03-18
关于linux install tar ./
前言在Linux的使用中,难免会使用下载,解压和安装。但它不会像windows系统那么直接了当。所以,需要用到一些命令。 了解 wget URL //下载 tar -zxvf <file.tar.gz> //解压 ./<file.pl> //执行 说明当我们在tar时,遇到Not enought space to extract,我们可以将tar.gz(要解压的文件)复制到另外一个地方。再进行操作。
2020-04-26
链接
前言链接有两种硬链接(hard link)和字符链接当我们ln一个硬链接时,ls -al显示出来的文件链接数量就会加1,但是ln -s一个字符链接却不会。 说明 文件的读取文件名——>inode——>数据区块 用ln来创建链接 符合链接,有参数-s 硬链接,无参数 硬链接 这种链接只是新创建一个文件,这个文件里面的inode与源文件的inode相同,所以都会指向相同的数据区块。 f1 \ ->inode->date block /f2 所以,我们新建一个硬链接ln test testing。我们把其中的一个文件删除,另外一个文件也能够访问到原始数据。 优点可以将源文件删除,也能访问到原来的数据。 缺点 不能创建目录的硬链接 不能跨文件系统 符号链接 也是创建一个新文件,但是这个文件指向源文件的文件名,它等同于Windows的快捷方式。 f2->f1->ionde->date block 所以,我们新建一个符号链接ln -s test test2。我们把源文件删除了(f1),那么符合链接文件无效(f2) 优点可以创建目...
2021-06-19
Basic Concept
Processes ManagementA process, in simple terms, is an instance of running program. Whenever you issue a command in Linux, it creates or start a process. Processes TypesWhen you issue a command (a process), there are two ways you can run it. Foreground Process Background Process The simplest way to start a background process is to add an ampersand (&) at the end of the command. Checking Running ProcessesIt is easy to see your own processes by using the ps command. In addition, you ...
2020-04-23
文件系统
前言文件系统,就是用来管理和存储文件的权限,属性,内容等文件信息的系统。因操作系统的不同,文件系统也并不相同。Linux的正统文件系统为ext2。U盘使用的文件系统是FAT格式。 ext2(索引式文件系统)包括 inode一个文件占用一个inode,主要是存储文件的权限和属性,还记录文件所存储所在的数据区块的号码。 数据区块存储文件的内容,当文件太大时,就会占用多个区块 超级区块记录整个文件系统的信息,比如使用了多少个inode,数据区块的使用量 读取 inode指向文件因为,每个inode都对应这个文件的数据块。所以,当我们要读取文件时,就可以通过inode作为索引,找到该文件的数据区块。 inode指向目录数据区块中仅存放文件名 FAT这种格式的文件系统没有inode的存在,就没有索引了。所以,它的读取数据区块速度较慢。 碎片整理当我们要读取一个文件时,磁头会在磁盘上转动,如果保存文件的各个数据区块分散严重的话,磁头就会在磁盘中要多转几圈才能读取数据。碎片整理,就是要把这些数据区块整理到一起,这样读取文件的速度就会更快。
2021-06-18
basic operations
FileListing File ls- listing files in current directory ls -l will help you get more information of the files To list the invisible files, specify the -a option to ls − Copying FilesTo make a copy of a file use the cp command. The basic syntax of the command is − 1$ cp source_file destination_file Renaming FilesTo change the name of a file, use the mv command. Following is the basic syntax − 1$ mv old_file new_file The mv command will move the existing file completely into the new file. ...
2021-06-17
Shell & Shell scripts
IntroductionUsers communicate with the kernel through a program known as the shell. The shell is a command line interpreter; it translates commands entered by the user and converts them into a language that is understood by the kernel. Shell is an environment in which we can run our commands, programs, and shell scripts. A shell provides an interface to your Linux System. It gathers your inputs and executes programs based on that input. The shell is, after all, a real programming language, ...
