Directory Operations Command
Command Format command [-option][-parameter]
Ls-la/etc
Can be combined when there are multiple options
ls command:
-A (all) displays all files, including hidden files, that are used. Files that begin with.
Why hide (This is a system file, do not move it)
-L (Long) details
-D Displays the current directory itself
-H humanized Display
-I view file ID number
-rw------ -1root root 1255 Sep 1116:02anaconda-ks.cfg
(Number of references) (owner) (owning group) (size byte) (last modified) (file name)
It's a letter representing the meaning.
1 First letter-Represents a binary file D represents a file L represents a soft link
2 U g o
U owner G-owned group O other person
rw-r-----
R Read W write-executable
That is: What file + three different user groups of people's permissions, in fact, reflects the permissions
2 mkdir
Create a new directory
Mkdir/tmp/xiaodianying
Create multiple Catalogs
Mkdir/tmp/xiaoze/tmp/longze
What if you want to create a multilevel catalog?
Mkdir-p/tmp/japan/boduo
Switch directory: CD
Toggle: Cd/tmp/japan
Question: can now display: "[email protected] Japan" How can I show all paths?
PWD (print working directtpry) is now working in the folder
The PWD show is/tmp/japan.
Points and dots. ..
The point represents the current directory CD.
Point point represents the parent directory CD.
3 Delete directory: rmdir (remove empty directory) Delete blank directories, compare faces!
Rmdit/tmp/japan/boduo Note: It is an empty directory! , not much to use
4 Copy command CP (copy)
Copy file CP [source file] [destination folder]cp/tmp/japan/aaa/home
Copy files or folders cp-r [source files or folders] "Destination files or Folders"
Cp-r/tmp/japan/home
You can also copy multiple files at the same time
Cp-r/tmp/japan/tmp/hanguo/home
When copying, the time attribute will change if it does not change
Cp-rp/tmp/japan/home
Rename when copying past
5 Clear the screen ctrl+l or clear
Cut and rename MV
Cut MV
Mv/tmp/daoguo/gaoshu/home cut the high number to the home directory.
Renaming under current directory
MV Cangjing Canglaoshi
6RM Deleting files
RM grub.conf (delete files)
Rm-r xiaozeyuan1 (delete directory)
Rm-rfxiaozeyuan2 (forced deletion) Sometimes it's easier, but be careful.
Create Delete copy move cut rename toggle and display
File Operations Command
File New command: Touch
Touch japanlovestory.list
Touch/root/lovestory.list
Note: It is best not to add a space to create two files
Touch YLF Cgq
If you want to create a file with spaces
Touch "Program Files"
Browse Show short File cat
Cat/etc/issue
What if I want to show the line number?
Cat-n/etc/issue
Note: Cat cannot manipulate folders
If it's long, like/etc/services, what if you want to see what's in front of you?
If you're looking backwards, put cat upside down TAC.
Tac/etc/issue
Show Browse long files more/etc/services (emphasis)
Press or PageUp on a page to scroll down, press PAGEDN to scroll down
Press ENTER to turn down the line
Press Q to exit
You can also search. Press/Then enter the command you want to search, and search down to press N (NEXT)
Less command
or less/etc/services.
Under less, you can search
Look at the first few lines of the file: Head defaults to the first 10 rows
For example: Look at the top 7 lines head-n 7/etc/service
Look at the following lines of the file; tail is 10 rows by default
For example: Look at the end of a few lines tail-n 7/etc/services
Tail-f can be updated in real time
Link command
ln
Ln-s Soft Link command (similar to shortcut)
Ln-s/etc/issue/tmp/issue.soft
The shortcut to issue is Issue.soft
ln hard-Link command
Ln/etc/issue/tmp/issue
Two files can be updated at the same time, and CP is just a copy
If the original file is deleted, then the soft link will prompt the file does not exist, the hard link does not change
How to tell a hard link
I nodes are the same
Ls-i Original file hard link soft link
source file = Hard link does not equal soft link
Note: Hard links and original files must be in the same partition and cannot be used for directory use
File Permissions Command
chmod
Change file permissions
CHOMD [Ugoa] [+-=] [rwx] [directories or files]
For example: Increase permissions
chmod u+r/tmp/japanlovestory.list
Reduce or multiple permission operations
CHOMD G+w,0-r/tmp/japanlovesroty.list
Give permission directly
chmod g=rwx/tmp/japanlovestory.list
Another way to r=4 w=2 x=1
For example rwxrw--wx= 763
such as rwxrwxrwx=777
If you want to open all the properties, then
CHOMD 777/tmp/japanlovestory.list
Attention:
Linux File Operations Command