Linux instruction beginner notes

Enlarge and reduce fonts: CTRL+mouse wheel

It's also the first time to learn Linux instructions. If you have any questions, you can join me in QQ to discuss and study. The video I learned is the Linux video of B Station Crazy God Talking about JAVA

	如何xshell远程连接centos?

Enter ifconfig in the terminal of centos, where the first ens33 is the ip address

1.Linux: Everything is a file
2. The root directory/, all files are mounted under this root directory

xshell remotely connect to centos7, enter
Linux in the centos terminal , no error means the operation is successful

You can use the command shutdown
sync # to save the files in the temporary save folder to the hard disk to prevent loss. Generally, execute
shutdown before shutting down. #The shutdown command
shutdown
-h means to shut down in a few minutes, plus the shutdown time. For example, shutdown -h +10 means shutdown in 10 minutes, +10 can also be replaced by now, which means power off, or it can be replaced by a certain time, such as 2:21, that is, shutdown at 2:21,
-r means restart, Generally, you need to add time after it to indicate when to restart, such as now, restart immediately, or restart after +10.10 minutes
reboot # means restart immediately, equivalent to shutdown -r now
halt # means shutdown, equivalent to shutdown -h now

Common uses of some common files
/ abbreviation of bin binary, saves some commonly used commands
/ abbreviations of sbin super binary, saves commands that only the system administrator can use
/boot saves the core files of the system, which represents the files that the system boots up
/opt
contains some additional software installed /root system administrator's storage directory
/tmp contains some temporary files
/user contains some common user files and applications

Commonly used basic commands

One, catalog management

/: indicates the root directory

如何进入一个文件?

cd …: means to go back one level of directory, which means to return to the upper directory.
cd ~: return to the current user’s home directory, which means "public template video picture file download music desktop". The interface
cd + file path: cd means to enter the directory, so The directory path needs to be added after the cd. There are two ways to express the directory path. Absolute path and relative path.
cd /
cd /usr
cd …/lib //relative path, …/ indicates the previous path of the current path

如何查看文件下的目录?

ls: means to view the directories under the current folder.
Parameters:
-a: means to view all directories, including hidden files
-l: means to view the detailed information of the directory
ls
ls -a
ls -l
ls -al

clear: means to clear all content on the control page of the current year

如何在里面新建文件?

mkdir: means to create a new file
madir text

mkdir -p: indicates that there is a recursive relationship between newly created files, which is equivalent to building a series of included files at the same time
mkdir text1/text2/text3/text4

如何直到当前目录的具体位置?

pwd: It can show which directory it is currently in

如何删除一些目录?

rmdir -p:
rmdir text1/text2/text3/text4

rmdir :
rmdir text

如何复制一个文件到目录中去?

cp xx xxx:xxx target location
-r: This parameter represents that you can copy a file with subfiles to the target directory
cp text text2
cd text
mkdir text1
cd…
cp -r text text2

overwrite:

怎么直接删除目录或者文件?

rm:
-f: means ignoring non-existent files, without warning, force deletion
-r: means recursive deletion
-i: interactive, ask when deleting

怎么把一个文件或目录转移到另一个目录下面

mv source file destination directory:
-f: forced displacement
-u: automatically add different files, the same is not in the past,
how to rename the file
mv original file name change the file name:

2. Basic attributes
cd /
ls -l

lrwxrwxrwx. 1 root root 7 11月 26 11:53 bin -> usr/bin
dr-xr-xr-x. 5 root root 4096 11月 26 12:17 boot
drwxr-xr-x. 20 root root 3300 11月 26 14:00 dev
drwxr-xr-x. 139 root root 8192 11月 26 15:44 etc
drwxr-xr-x. 3 root root 17 11月 26 12:12 home
lrwxrwxrwx. 1 root root 7 11月 26 11:53 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 11月 26 11:53 lib64 -> usr/lib64
drwxr-xr-x. 2 root root 6 4月 11 2018 media
drwxr-xr-x. 2 root root 6 4月 11 2018 mnt
drwxr-xr-x. 3 root root 16 11月 26 12:02 opt
dr-xr-xr-x. 234 root root 0 11月 26 14:00 proc
dr-xr-x—. 15 root root 4096 11月 26 14:11 root
drwxr-xr-x. 41 root root 1280 11月 26 15:46 run
lrwxrwxrwx. 1 root root 8 11月 26 11:53 sbin -> usr/sbin
drwxr-xr-x. 2 root root 6 4月 11 2018 srv
dr-xr-xr-x. 13 root root 0 11月 26 14:00 sys
drwxrwxrwt. 20 root root 4096 11月 26 14:04 tmp
drwxr-xr-x. 13 root root 155 11月 26 11:53 usr
drwxr-xr-x. 20 root root 282 11月 26 12:17 var

The first column indicates the type of this thing. Under normal circumstances, only 3 symbols will appear, l, d, -, among them, l means this is a link, d means this is a directory, and-means this is an openable file.

Next are nine English letters, r, w, and x, which respectively represent readable, writable and executable. Then each of the nine English letters becomes a group of three, so it can be divided into three groups. If there is no English letter, and-is used, it means that there is no authority. These three groups belong to three different groups, and the first group belongs to things. The owner of this person belongs to this person. The second group belongs to the belonging group, that is, the owner gives some specific people some permissions. These permissions are different from others. The third group belongs to other people.

Then there are the two lines root root, indicating the owner and group of the file, the owner and group are equivalent to the owner of the file

怎么改变文件的属性呢?或者怎么提高其他人对文件的权限呢?

1. Change the file's genus group
chgrp: the changed genus group name and directory name. Change the genus name of
some files to root or other users so that other users can read and write.
chgrp -r uzi 123.docx is equivalent to The 123.docx file belongs to the group to the user uzi

2. Change the owner
chown of the file : the changed owner name and file name. Change the main name of
some files to root or other users, so that other users can read and write. The
chown -r uzi 123.docx is equivalent to The 123.docx file belongs to the user uzi

chmod: The nine letters of the file are changed, thereby changing the reading and writing of the file. Executable
chmod: Digital file or directory
chmod 777 123.docx is equivalent to all the groups and owners of this file can read and write and execute this file

-r: It still means recursion, which is equivalent to changing the attributes of the directory, and the attributes of all the things in this directory are changed

Three, file content view

The network configuration address of the virtual machine: /etc/sysconfig/network-scripts
The network configuration address of windows: ipconfig

cat: means that a file is opened for you in the positive order.
tac: means that the file is opened for you in the reverse order.
nl: the line number is displayed when the file is opened.
Less: the file can be opened up and down, and the space can be used to control the page. Page
more: The file can be turned left and right, and the page can be turned by space control.
head -n number: look at the first few pages
tail -n number: look at the next few pages
?: search for a thing
from back to front/: search for a thing from front to back
n : Page down after searching
N: Page up after searching

e.g.
cat csh.login
tac ifcfg-ens33
less ifcfg-ens33
more ifcfg-ens33
head -n 3 ifcfg-ens33
tail -n 2 ifcfg-ens33
nl ifcfg-ens33

Four, hard link and soft link

Hard link: is to establish a link between two files, one of which is deleted, and the other is still there

Soft link: create a link between two files, if the linked file is deleted, it will be discarded

touch file name: means to create a new file
echo> file name or >> file name:> means overwrite, write from the beginning, >> means append, write
ln at the end. File linked by the linked file: establish hard link
ln -s Linked file Linked file: establish soft link

Guess you like

Origin blog.csdn.net/qq_43511094/article/details/110203208