当前位置:网站首页>Commands related to files and directories
Commands related to files and directories
2022-07-03 19:54:00 【Fat tiger test】
File and directory related commands
1.ls: List the names of the current files and folders
grammar :
ls [-alrtAFR] [name...]
Parameters :
- -a Show hidden files and directories (. The hidden files at the beginning will also be listed )
- -l In addition to the file name , Will also document type 、 jurisdiction 、 The owner 、 File size and other information detailing
- -r The files are displayed in reverse order ( Scheduled in alphabetical order )
- -t The file lists in accordance with the priorities set-up time
- -A Same as -a , But not listed “.” ( Currently directory ) And “…” ( Parent directory )
- -F Add a symbol to the file name listed ; Then add executable e.g. “*”, Then add directory “/”
- -R If there are files in the directory , The following are listed in order of files Beijing and Taipei
ls -a: Show the names of all files and folders ( Including hidden such as .book)
ls -l=ll: Show details of files and folders
drwxr-xr-x 1 root root 4096:d The beginning is the folder , Folders are 4096 size
ls -R: Recursively display the directory of the current folder
[[email protected] ~]# ls -ahl
total 28K
dr-xr-x---. 2 root root 135 Dec 16 02:34 .
dr-xr-xr-x. 17 root root 224 Dec 14 01:38 ..
-rw-------. 1 root root 1.3K Dec 14 01:38 anaconda-ks.cfg
-rw-------. 1 root root 1.2K Dec 16 02:34 .bash_history
-rw-r--r--. 1 root root 18 Dec 28 2013 .bash_logout
-rw-r--r--. 1 root root 176 Dec 28 2013 .bash_profile
-rw-r--r--. 1 root root 176 Dec 28 2013 .bashrc
-rw-r--r--. 1 root root 100 Dec 28 2013 .cshrc
-rw-r--r--. 1 root root 129 Dec 28 2013 .tcshrc

You can see from above , Every line has 7 Column , Namely :
- ** First column ** common 10 position ,

The first 1 Bit for document type ,d Presentation directory ,- Said file ,l Represents a linked file ,c Represents a random access device , Such as U Plate, etc. ,c Indicates a one-time read device , Like a mouse 、 Keyboard, etc .
after 9 position , Corresponding to the permissions of the three identities in sequence ,1-3 position :owner( The owner of the document )、 The first 4-6 position group( The same group of users of the owner )、 Chapter 7-9 position :others( Other users )
The order of authority is : r Representative readable (read)、 w Representative may write (write)、 x Representative executable (execute).
Such as :-r-xr-x— Means The current document is a file , The owner can read 、 Executable , Users in the same group , Can be read 、 Executable , Other people don't have any authority .
- Second column Indicates the number of links , Indicates how many files are linked to inode number .
- The third column Means the owner
- The fourth column Indicates the group
- The fifth column Indicates the capacity of the document , Unit byte
- The sixth column Indicates when the document was last modified , Note that it's not the creation time of the document
- The seventh column Indicates the document name . With a little (.) The beginning is to hide the document
2.mkdir: Create a new directory
mkdir test: Create folder as test Folder
mkdir test01 test02 test03: Create folders named test01,test02,test03 Folder
mkdir -p: Direct all directories ( Including the upper level directory ) Recursion is created
mkdir -p test04/test04-01/test04-01-01
3.rmdir: Delete empty directory
rmdir test: The name of the deleted folder is test Folder ( Folder content is empty )
rmdir -p test/test01: Put... Directly test Folder , Contains an empty directory test01 Delete... Together .(test01 If there is a file in it, it cannot be deleted )
4.cd Toggle directory
(1) Absolute path
Path writing , By root / Write :cd /root/test1/test2
(2) Relative paths
Click on tab key , Automatically complete the file / Folder name
double-click tab List all files in the current directory , Folder
The path is not written by / Write : stay root Under the table of contents cd test1/test2 perhaps ./( Current directory )
cd ~ Enter the user home directory
cd … Return to upper level
cd …/… Return to superior
cd / Go to the root directory
5.pwd: Displays the absolute path of the current folder
6.vi: Text editor
vi today: open today, If the file does not exist, create a new today
Pattern
(1)Insert Edit mode ( Click on the keyboard insert, perhaps i,a,o) The sign appears in the lower left corner –INSERT–
(2)Esc Command mode ( Click on the keyboard Esc, The sign is in the lower left corner –INSERT– disappear )
:q: Exit procedure ;:w: Save the file
:wq: Save and exit
:wq!: Forced save exit
:q!: Forced exit
u: Undo the last input
G: Skip to the last line of the text
gg: Skip to the first line of text
? bcbx: lookup bcbx, Press n It's looking for the next
/ bcbx: lookup bcbx, Press n It's looking for the last
crtl+c: End
ctrl+b: Turn the page up
ctrl+f: Turn the page down
dd: Delete current row ( Cursor in line )
7.cat: View file contents ( Don't enter the content , Knowledge display content )( Show from the first line )
cat -n sey: Exhibition sey Line number
8.cp: Copy files or directories
cp Source file Under the target file path ( Recommended absolute path )
cp /root/fuyao /root/modaozushi
cp -r: Recursive continuous replication , For the entire folder replication behavior . Such as :cp -r Source folder Destination folder :cp -r /root/day /root/modaozushi
Create copy cp 0001 0002( Nonexistent file name ): Created 0001 Copy of 0002( Nonexistent file name )
9.rm: Delete files or directories
rm The source file name ( Tips “ Whether or not to delete XX file , This command cannot delete the folder directly ”)
rm -r The source file name : Delete folder
rm -f : Force file deletion
rm -rf: Force the deletion of a file or folder
10.mv Move or rename files and folders
mv Source file / Folder Destination folder / file ( If the destination folder / Rename if the file does not exist )
mv Source file / Folder Destination folder ( Move a file or folder to a folder )
11.find Find a folder or file under the specified file , And print the absolute path
find route -name“ Folder or file name ”( Add... To some names *, For wildcard )
Know the full name :find / -name “ylem-hadse”
Only the beginning of the name :find / -name "ylem-h"
Only the end of the name :find / -name “em-hades"
I don't know the middle part :find / -name "yledes”
Only know the middle part :find / -name “em-ha”
12.tar Compress or decompress files
Compress :tar -cvf Compressed package name ( It is suggested that .tar ending , Easy to identify ) Files you want to compress
tar -cvf ylem.tar /bcbx22/kingrealhart
decompression :tar -xvf The name of the package ( Unzip the compressed package to the current folder )
tar -xvf ylem.tar
13.tail Look at the last few lines of the file ( Default 10 That's ok )
tail file name ( Look at the end of the file 10 That's ok )
tail -n file name ( Look at the end of the file n That's ok )
tail -f file name ( Dynamically and continuously view files , Until you press ctrl+c sign out )
14 echo command
It is used to check the value of environment variables after echoing characters on the display ( Equivalent to printing out print)
echo What needs to be displayed
echo test→test
echo ‘ The contents of the document ’ >> File path :echo ‘goodman’ >> /root/bcbx22/kingrealheart/hades04/test
echo ‘ The contents of the document ’ > File path :
15.touch create a file
touch test01: Create a file named test01 The file of
touch test01 test02 test03: Create files named test01 test02 test03 The file of
If there is any infringement , Email contact , I'm sorry .
This is only for learning personal notes , At the same time, if there is any reprint, please indicate the source .
Contact email :[email protected]
Learn the test and development technology penguins together ( gossip , Water group , No advertising ):826471103
边栏推荐
- Parental delegation mechanism
- Microservice framework - frequently asked questions
- unittest框架基本使用
- Rad+xray vulnerability scanning tool
- Blue Bridge Cup: the fourth preliminary - "simulated intelligent irrigation system"
- Zhang Fei hardware 90 day learning notes - personal records on day 2, please see my personal profile / homepage for the complete
- Sword finger offer 30 Stack containing min function
- PR 2021 quick start tutorial, material import and management
- 第二章:求a,b的最大公约与最小公倍数经典求解,求a,b的最大公约与最小公倍数常规求解,求n个正整数的的最大公约与最小公倍数
- 7. Data broker presentation
猜你喜欢

Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu

Ae/pr/fcpx super visual effects plug-in package fxfactory

Teach you how to quickly recover data by deleting recycle bin files by mistake

5- (4-nitrophenyl) - 10,15,20-triphenylporphyrin ntpph2/ntppzn/ntppmn/ntppfe/ntppni/ntppcu/ntppcd/ntppco and other metal complexes

PR 2021 quick start tutorial, how to create a new sequence and set parameters?

2022-06-25 advanced network engineering (XI) IS-IS synchronization process of three tables (neighbor table, routing table, link state database table), LSP, cSNP, psnp, LSP

Octopus online ecological chain tour Atocha protocol received near grant worth $50000

第一章:三位阶乘和数,图形点扫描
![Meso tetra [P - (p-n-carbazole benzylidene imino)] phenylporphyrin (tcipp) /eu (tcipp) [pc( α- 2-oc8h17) 4] and euh (tcipp) [pc (a-2-oc8h17) 4] supplied by Qiyue](/img/5b/fc776a1982e24b82984d82be6a016f.jpg)
Meso tetra [P - (p-n-carbazole benzylidene imino)] phenylporphyrin (tcipp) /eu (tcipp) [pc( α- 2-oc8h17) 4] and euh (tcipp) [pc (a-2-oc8h17) 4] supplied by Qiyue

Gym welcomes the first complete environmental document, which makes it easier to get started with intensive learning!
随机推荐
原生表格-滚动-合并功能
Microsoft: the 12th generation core processor needs to be upgraded to win11 to give full play to its maximum performance
44. Concurrent programming theory
Compared with 4G, what are the advantages of 5g to meet the technical requirements of industry 4.0
IP address is such an important knowledge that it's useless to listen to a younger student?
BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
Zhang Fei hardware 90 day learning notes - personal record of day 3, please see my personal profile / homepage for the complete
Micro service knowledge sorting - three pieces of micro Service Technology
第二章:4位卡普雷卡数,搜索偶数位卡普雷卡数,搜索n位2段和平方数,m位不含0的巧妙平方数,指定数字组成没有重复数字的7位平方数,求指定区间内的勾股数组,求指定区间内的倒立勾股数组
Implementation of stack
Chapter 1: sum of three factorials, graph point scanning
Chapter 1: drinking soft drinks, step tariff calculation, step tariff calculation function, personal income tax, solving square root inequality, simplifying solving square root inequality, solving dem
About callback function and hook function
4. Data binding
3. Data binding
PR 2021 quick start tutorial, how to create a new sequence and set parameters?
第二章:基于分解的求水仙花数,基于组合的求水仙花数, 兰德尔数,求[x,y]内的守形数,探求n位守形数,递推探索n位逐位整除数
Chapter 2: 4-digit Kaplan number, search even digit Kaplan number, search n-digit 2-segment sum square number, m-digit ingenious square number without 0, specify the number to form a 7-digit square nu
Professional interpretation | how to become an SQL developer
Bright purple crystal meso tetra (4-aminophenyl) porphyrin tapp/tapppt/tappco/tappcd/tappzn/tapppd/tappcu/tappni/tappfe/tappmn metal complex - supplied by Qiyue