当前位置:网站首页>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
边栏推荐
- 第一章:简化同码小数和s(d, n)
- 2022-06-27 网工进阶(十二)IS-IS-开销类型、开销计算、LSP的处理机制、路由撤销、路由渗透
- Point cloud data denoising
- 5- (4-nitrophenyl) - 10,15,20-triphenylporphyrin ntpph2/ntppzn/ntppmn/ntppfe/ntppni/ntppcu/ntppcd/ntppco and other metal complexes
- Titles can only be retrieved in PHP via curl - header only retrieval in PHP via curl
- Chapter 20: y= sin (x) /x, rambling coordinate system calculation, y= sin (x) /x with profile graphics, Olympic rings, ball rolling and bouncing, water display, rectangular optimization cutting, R que
- BOC protected amino acid porphyrins TAPP ala BOC, TAPP Phe BOC, TAPP Trp BOC, Zn · TAPP ala BOC, Zn · TAPP Phe BOC, Zn · TAPP Trp BOC Qiyue
- Win10 share you don't have permission
- 第一章:求同吗小数和s(d, n)
- FPGA learning notes: vivado 2019.1 project creation
猜你喜欢
Chapter 20: y= sin (x) /x, rambling coordinate system calculation, y= sin (x) /x with profile graphics, Olympic rings, ball rolling and bouncing, water display, rectangular optimization cutting, R que
Chapter 1: King Shehan miscalculated
FPGA 学习笔记:Vivado 2019.1 工程创建
FAQs for datawhale learning!
第一章: 舍罕王失算
2022-07-02 网工进阶(十五)路由策略-Route-Policy特性、策略路由(Policy-Based Routing)、MQC(模块化QoS命令行)
2022-06-25 网工进阶(十一)IS-IS-三大表(邻居表、路由表、链路状态数据库表)、LSP、CSNP、PSNP、LSP的同步过程
Xctf attack and defense world crypto advanced area best_ rsa
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
第一章: 舍罕王失算
随机推荐
2022-07-02 网工进阶(十五)路由策略-Route-Policy特性、策略路由(Policy-Based Routing)、MQC(模块化QoS命令行)
The space of C disk is insufficient, and the computer becomes stuck. Quickly expand the capacity of C disk to make the system more smooth
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
04 -- QT OpenGL two sets of shaders draw two triangles
2. Template syntax
Detailed and not wordy. Share the win10 tutorial of computer reinstallation system
Leetcode 1189. Maximum number of balloons (special character count)
Read the paper glodyne global topology preserving dynamic network embedding
Gym welcomes the first complete environmental document, which makes it easier to get started with intensive learning!
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
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
Rd file name conflict when extending a S4 method of some other package
unittest框架基本使用
Realize user registration and login
Chapter 2: find the classical solution of the maximum Convention and the least common multiple of a and B, find the conventional solution of the maximum Convention and the least common multiple of a a
Don't be afraid of no foundation. Zero foundation doesn't need any technology to reinstall the computer system
Basic command of IP address configuration ---ip V4
Microservice knowledge sorting - search technology and automatic deployment technology
PR 2021 quick start tutorial, how to create a new sequence and set parameters?
03 -- QT OpenGL EBO draw triangle