CD(change direction): Changing the Directory
{
CD/: Go to the root directory
CD Directory Name: Enter the directory
Cd.. : Go to the previous level directory
Cd. : Enter the current directory
CD ~: Enter the host (home) directory (cd ~ Directory Name: Return to the host directory for the directory name) of the current user (normal user or superuser (su root))
CD-: Get to the last catalog
}
chmod Modify permissions 755 (3 digits must be given at the same time) (0-7 eight states) (Binary 111 101 101) (Rwxr-xr-x readable writable executable readable non-writable executable readable executable) text.c Change the TEXT.C permission to 755
{
chmod u-w test.c The owner privilege of the test.c file minus the readable permission rwx-->r-x
U (owner) G (Group) O (Other) a (all)
-
- =
chmod u/g/o/a +/-/= r/w/x file name
chmod u+rwx test.c
}
chown (Modify owner) (chown 51cc test.c Change the owner of the test.c file to 51cc)
(Modify the group while modifying the owner) (chown root.root or root:root test.c 51cc test.c to change the owner and group of the test.c file to root)
chgrp (Modify group) (Chgrp 51cc test.c the group of test.c files to 51cc)
File Management commands:
ls: Show directory contents (show file name)
{
Ls-a: Do not hide any files that begin with a dot (.)
Ls-l: Listing information using longer formats
such as
LS display: Blue for the directory, green for the executable, red for compressed files, light blue for linked files, bold black for symbolic links, gray for other usage files
}
cat: Output [file] or standard input combination to standard output (display text file contents)
RM: Delete the specified file (delete file)
{
Rm-f file name: Force Delete, ignore non-existent files, do not prompt to confirm
Rm-i file name: Confirm before deleting
Rm-r file name: Recursively delete a directory and its contents
By default, RM does not delete the directory
}
Less: Display files by page (split screen display file) Less [options] File
cp : Copy file (copy of file or directory)
{
CP [OPTION] [-t] source file destination file
CP [Options] source file directory
CP [option]-T directory source file
[Options]:
-r copy directory, including all subdirectories and files in this directory
}
Linux basic commands