当前位置:网站首页>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
边栏推荐
- IP address is such an important knowledge that it's useless to listen to a younger student?
- 5- (4-nitrophenyl) - 10,15,20-triphenylporphyrin ntpph2/ntppzn/ntppmn/ntppfe/ntppni/ntppcu/ntppcd/ntppco and other metal complexes
- February 14-20, 2022 (osgear source code debugging +ue4 video +ogremain source code transcription)
- BOC protected tryptophan porphyrin compound (TAPP Trp BOC) Pink Solid 162.8mg supply - Qiyue supply
- PR 2021 quick start tutorial, how to create a new sequence and set parameters?
- Rad+xray vulnerability scanning tool
- Bright purple crystal meso tetra (4-aminophenyl) porphyrin tapp/tapppt/tappco/tappcd/tappzn/tapppd/tappcu/tappni/tappfe/tappmn metal complex - supplied by Qiyue
- BOC protected alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC supplied by Qiyu
- Microsoft: the 12th generation core processor needs to be upgraded to win11 to give full play to its maximum performance
- P1891 crazy LCM (Euler function)
猜你喜欢

原生表格-滚动-合并功能

Detailed explanation of shuttle unity interworking principle

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

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

BOC protected tryptophan porphyrin compound (TAPP Trp BOC) Pink Solid 162.8mg supply - Qiyue supply

BOC protected alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC / alanine zinc porphyrin Zn · TAPP ala BOC supplied by Qiyu

Phpstudy set LAN access

第一章:求所有阶乘和数,大奖赛现场统分程序设计,三位阶乘和数,图形点扫描,递归求n的阶乘n!,求n的阶乘n!,舍罕王失算

Bright purple crystal meso tetra (4-aminophenyl) porphyrin tapp/tapppt/tappco/tappcd/tappzn/tapppd/tappcu/tappni/tappfe/tappmn metal complex - supplied by Qiyue

第一章:喝汽水,阶梯电费计算,阶梯电费计算函数,个人所税,求解平方根不等式,简化求解平方根不等式,求解调和级数不等式,解不等式:d<1+1/2-1/3+1/4+1/5-1/6+..士1/n
随机推荐
BUUCTF
Native table - scroll - merge function
What is the difference between a kill process and a close process- What are the differences between kill process and close process?
Initialization and instantiation
第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)
AcWing 1460. Where am i?
Acquisition and transmission of parameters in automatic testing of JMeter interface
February 14-20, 2022 (osgear source code debugging +ue4 video +ogremain source code transcription)
Network security Kali penetration learning how to get started with web penetration how to scan based on nmap
Chapter 1: find the factorial n of n!
第一章: 舍罕王失算
原生表格-滚动-合并功能
03 -- QT OpenGL EBO draw triangle
JMeter connection database
Strict data sheet of new features of SQLite 3.37.0
FPGA learning notes: vivado 2019.1 project creation
Part 27 supplement (27) buttons of QML basic elements
Leetcode 1189. Maximum number of balloons (special character count)
P5.js development - setting
MPLS configuration