download
Ubuntu official Website
Introduction to the
Linux is a free and open source UniX-like operating system that uses the Linux kernel. Generally, Linux is packaged as a Linux distribution for desktop computers and servers. Ubuntu is one of the Linux distributions. The popular Linux distributions are: Ubuntu, RedHat, CentOS, Debian, etc.
Remote control management
XShell is a powerful security terminal simulation software, it supports SSH1, SSH2. It can be used to access remote servers in different systems on the Windows interface, thus achieving the purpose of remote control terminal
XFtp: is a powerful SFTP, FTP file transfer software. With XFtp, Windows users can securely transfer files between UNIX/Linux and Windows PCS
XShell and XFtp school home free version of the official website download
The directory structure
directory | instructions |
---|---|
bin | Store binary executable files (ls,cat,mkdir, etc.) |
boot | Stores the various files used for system boot |
dev | Used to store device files |
etc | Saves the system configuration file |
home | The root directory for storing all user files |
lib | Stores shared libraries and kernel modules needed to run programs in the file system |
mnt | The installation point at which the system administrator installs the temporary file system |
opt | Placement of optional application packages for additional installations |
proc | A virtual file system that stores the current memory mapping |
root | Superuser directory |
sbin | Stores binary executable files, which can only be accessed by root |
tmp | Used to store various temporary files |
usr | Important directory /usr/local Local administrator software installation directory |
var | A file used to hold data that needs to be changed at run time |
The editor
vim
- Enter insert mode: In Edit mode, enter
i
Enter insert mode and insert text information - Enter command mode: In edit mode, press first
ESC
And then type:
Enter command mode
Common commands are as follows:
-
:q Exit directly
-
:wq Save and exit (you can create a new file if no file exists)
-
:q! Forced out of
-
:set paste Paste format
-
:w file Saves the current content to a file
-
:set number Indicates the line number displayed in the edit file
-
:set nonumber does not display line numbers in the edit file
nano
Nano is a character terminal text editor, a bit like the EDITOR program under DOS. It is much simpler than vi/ Vim and is more suitable for Linux beginners. The nano is the default editor for some Linux distributions.
The command is as follows:
ctrl + o
: savectrl + w
Search:ctrl + y
: backctrl + v
: the next pagectrl + x
: quit
Software Package Management
Advanced Packaging Tool (APT) is a software package management program in Debian/Ubuntu Linux system. It can be used to find the desired software package, and it is easy to install, uninstall and update. It can also be used to upgrade Ubuntu; The source file of APT is sources.list in /etc/apt/.
Modifying a data source
Due to the problem of domestic network environment, we need to change the data source of Ubuntu to domestic data source. The procedure is as follows:
-
Viewing the System Version
$ lsb_release -a Copy the code
The output
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04 LTS Release: 16.04 Codename: xenial Copy the code
Codename is Xenial, which is the name of our Ubuntu system and is needed to modify the data source
-
Edit data source
$ vi /etc/apt/sources.list Copy the code
Delete all contents and change to
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverseCopy the code
-
Update data source
$ apt-get update Copy the code
User management
The Linux operating system is a multi-user operating system that allows multiple users to log on to the system and use resources at the same time. The system will distinguish each user’s files, processes, tasks and work environment according to the account, so that each user can work without interference.
Using the Root user
In the actual production operation, we basically use the super administrator account to operate the Linux system, that is, the Root user. By default, the Root account is disabled in The Linux system. We need to set an initial password for the Root user to facilitate our use.
-
Set the password of user Root
$ sudo passwd root Copy the code
-
Switch to user root
$ su Copy the code
Example To enable remote login to the Root user
Example Modify the sshd_config configuration file
$ vi /etc/ssh/sshd_config
Copy the code
Modify the following configurations
#PermitRootLogin Without -password // Comment this linePermitRootLogin YES // Join this lineCopy the code
Restart the service
$ service ssh restart
Copy the code
Common Commands
File directory Command
The command | instructions | parameter | Parameters that |
---|---|---|---|
ls | Displays a list of files and directories | -l | Lists the details of the file |
-a | Lists all files in the current directory, including hidden files | ||
mkdir | Create a directory | -p | If the parent directory does not exist, the parent directory is the parent directory |
cd | Switch directory | ||
touch | Generate an empty file | ||
echo | Generate a file with content | ||
cat | Display text file contents | ||
cp | Copy files or directories | ||
rm | Delete the file | -r | Delete the directory |
-f | Mandatory delete | ||
find | Finds the specified file in the file system | -name | The file name |
grep | Finds the specified string in the specified text file | ||
tree | Use to list the contents of a directory in a tree | ||
pwd | Displays the current working directory | ||
ln | Establishing a soft connection | ||
more | Displays the contents of a text file in pages | ||
head | Displays the beginning of the file | ||
tail | Displays the contents at the end of the file | -f | Track real-time output |
APT command
Installing Software Packages
$ apt-get install packagename
Copy the code
Deleting a Software Package
$ apt-get remove packagename
Copy the code
Updating the Software Package List
$ apt-get update
Copy the code
Upgrade to the latest system (with caution)
$ apt-get upgrade
Copy the code
Decompression command
The compressed file
$ tar -zcvf test.tar.gz test\
Copy the code
Unzip the files
$ tar -zxvf test.tar.gz
Copy the code
System Management Commands
The command | instructions |
---|---|
start | Displays more information about a specified file than the ls command |
who | The online login users are displayed |
hostname | Display host name |
uname | Displaying system Information |
top | Displays the processes that consume the most resources in the current system |
ps | Displays transient process status |
du | Displays the total disk space used by the specified file (directory) |
df | The file system disk space usage is displayed |
free | Displays the current memory and swap space usage |
ifconfig | Display network interface information |
ping | Test the network connectivity |
netstat | Display network status information |
clear | Clear the screen |
kill | Kill a process |
User Management Commands
The command | instructions |
---|---|
useradd | Add user |
usermod | Modify the user |
userdel | Delete user |
Shutdown restart
Immediately shut down
$ shutdown -h now
Copy the code
Immediately restart
$ reboot
Copy the code
File directory Permissions
View permissions on files and directories
Ls -al: The ls command displays only the file name without parameters. The ls -al command displays the permission information about files or directories
Ls -l: Displays the following information: file type, file permission, file user, file owning group, file size, file creation time, and file name
Such as:
-rw-r--r-- 1 antoniopeng antoniopeng 675 Oct 26 17:20 .file_name
Copy the code
The parse of the preceding command is as follows:
-rw-r–r– | 1 | antoniopeng | antoniopeng | 675 | Oct 26 17:20 | .file_name |
---|---|---|---|---|---|---|
Document types and permissions | The number of connections | User of the document | Document Group | Document size | Date the document was last modified | The document name |
-rw-r--r--
Copy the code
The first character represents the document type, and the remaining characters represent permissions
-
: Common filerw-
: Indicates that antoniopeng has read and write permissions but does not have run permissionsr--
: indicates that the user group Antoniopeng has read permissions but does not have write and run permissionsr--
: Other users have read permissions but do not have write or run permissions
All document types
d
Said directoryl
Indicates soft connection-
Represents a common filec
Represents a serial port character device fileb
Represents a block device file available for storage
All permissions
r
: read onlyw
: can writex
: executable
Changing operation Permissions
chown
Changes the owner of a file or directory. The owner includes users and user groups
$Chown [-r] User name file or directory
Copy the code
$Chown [-r] User name User group name File or directory
Copy the code
-r: Recursively changes permissions to update the permissions of all files and subdirectories in the directory
chmod
Change the access permission
$Chmod [who] [+ | | =] [mode] file name
Copy the code
Who indicates that the operation object can be one or a combination of the following letters:
u
User: userg
: user group groupo
: indicates another usera
: indicates that all users are default
+ / – / = Indicates the operation permission:
+
: indicates adding a permission-
: cancels a permission=
: Grants the given permission to revoke all previous permissions on the document
Mode:
r
: read onlyw
: can writex
: executable
Permission number setting method
0: no permission, 1: executable permission = x, 2: write permission = w, 4: read permission = r.
Such as:
$ chmod 755 file_name
Copy the code
The analysis is as follows:
r w x | r – x | r – x |
---|---|---|
4 + 2 + 1 | 4 + 1 | 4 + 1 |
user | group | others |
For more dry goods, please move to:antoniopeng.com |