当前位置:网站首页>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
边栏推荐
- 2022-06-30 网工进阶(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
- 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
- BOC protected phenylalanine zinc porphyrin (Zn · TAPP Phe BOC) / iron porphyrin (Fe · TAPP Phe BOC) / nickel porphyrin (Ni · TAPP Phe BOC) / manganese porphyrin (Mn · TAPP Phe BOC) Qiyue Keke
- 第一章: 舍罕王失算
- Summary of learning materials and notes of Zhang Fei's actual combat electronics 1-31
- Microsoft: the 12th generation core processor needs to be upgraded to win11 to give full play to its maximum performance
- Xctf attack and defense world crypto advanced area best_ rsa
- 2022-06-30 網工進階(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
- 第一章: 舍罕王失算
- Network security Kali penetration learning how to get started with web penetration how to scan based on nmap
猜你喜欢
Chapter 2: find the number of daffodils based on decomposition, find the number of daffodils based on combination, find the conformal number in [x, y], explore the n-bit conformal number, recursively
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
Vscode reports an error according to the go plug-in go get connectex: a connection attempt failed because the connected party did not pro
CMD implements the language conversion of locale non Unicode programs
Chapter 1: find all factorial sums, Grand Prix site unified programming, three factorial sums, graphic point scanning, recursive factorial n of n!, Find the factorial n of n!, King Shehan miscalculate
QT -- qfileinfo file information reading
第一章:递归求n的阶乘n!
Gym welcomes the first complete environmental document, which makes it easier to get started with intensive learning!
2022 - 06 - 30 networker Advanced (XIV) Routing Policy Matching Tool [ACL, IP prefix list] and policy tool [Filter Policy]
第一章: 舍罕王失算
随机推荐
Xctf attack and defense world crypto master advanced area olddriver
Network security Kali penetration learning how to get started with web penetration how to scan based on nmap
BOC protected alanine porphyrin compound TAPP ala BOC BOC BOC protected phenylalanine porphyrin compound TAPP Phe BOC Qi Yue supply
论文阅读 GloDyNE Global Topology Preserving Dynamic Network Embedding
Day11 - my page, user information acquisition, modification and channel interface
PR 2021 quick start tutorial, material import and management
Chapter 1: find the algebraic sum of odd factors, find the same decimal sum s (D, n), simplify the same code decimal sum s (D, n), expand the same code decimal sum s (D, n)
Chapter 1: find the factorial n of n!
4. Data splitting of Flink real-time project
2022-06-27 网工进阶(十二)IS-IS-开销类型、开销计算、LSP的处理机制、路由撤销、路由渗透
MPLS configuration
UE source code analysis: uccharactermovementcomponent - rootmotion
Buuctf's different flags and simplerev
Microsoft: the 12th generation core processor needs to be upgraded to win11 to give full play to its maximum performance
2022-06-28 advanced network engineering (XIII) IS-IS route filtering, route summary, authentication, factors affecting the establishment of Isis neighbor relations, other commands and characteristics
Phpstudy set LAN access
Xctf attack and defense world crypto advanced area best_ rsa
Chapter 1: seek common? Decimal and S (D, n)
Geek Daily: the system of monitoring employees' turnover intention has been deeply convinced off the shelves; The meta universe app of wechat and QQ was actively removed from the shelves; IntelliJ pla
交叉编译Opencv带Contrib