1. How do I change the Linux hostname?
Editing a configuration file/etc/sysconfig/network
Change Hostsname, save exit after restart effective;
[email protected] ~]# cat/etc/sysconfig/network
Networking=yes
Hostname=yonglinux.com
2, Login to Linux, in addition to using password authentication, we can also use which way? Briefly describe the configuration process.
Use the key to encrypt the login, the client generates the public and private keys, the client saves the private key, the public key is copied to the remote Linux host, log in with the key encryption login;
Perform the following operations on the Linux host:
Mkdir/root/.ssh
chmod 700/root/.ssh
Vi/root/.ssh/authorized_keys paste the copied public key, save the exit;
chmod 600/root/.ssh/authorized_keys
Vi/etc/selinux/config Edit SELinux Firewall configuration
Change selinux=disabled permanently close SELINUX;
Iptables-f empty firewall rules;
/etc/init.d/iptables Save firewall settings;
The client uses the key to log in;
3, how to add password to grub (clear text, ciphertext), cipher encryption is divided into what kinds?
PlainText Encryption vi/etc/grub.conf
Add a row under Hiddenmenu
password=123456
Save exit, restart the system to enter the menu selection, press p to enter the password can be edited;
Ciphertext encryption sub-MD5 encryption and SHA encryption
The MD5 encryption command is: Grub-md5-crypt
Enter a password, generate a string of encrypted passwords, copy the password
Vi/etc/grub.conf
Password--md5 paste Password
Save exit, restart the system to enter the menu, press p to enter the password;
SHA encryption command: Grub-crypt--sha-256
Enter a password, generate a string of passwords, copy the password
Edit/etc/grub.conf
Password--encrypted paste password,
Save exit, reboot into the system, press p to enter the password;
4. How to install/delete a software package with Yum? How to see if a package is already installed
Installation: Yum install-y tree
Delete: Yum remove-y tree
View: Rpm-qa | grep "package name" or RPM-Q package name
5. How to view the system version? (3 methods)
Cat/etc/centos-release
Cat/etc/issue
Rpm-qa | grep release
6, find find out the current directory of directories and ordinary files? Find common Files or directories with a size greater than 4K in the current directory for 10 days
Find./-type d-o-type F
Find/-type d-o-type f-size +4k! -mtime-10
7. Create a command with the directory named 1 under the current directory? Create cascading catalogs./2/3/'s order? A command to create a cascading directory./1/2/3 and./1/2/4?
mkdir./1
Mkdir-p./2/3
Mkdir-p./1/2/{3,4}
8, CP A directory of the files need what permissions, mv it? What about touch? Where's RM?
CP needs to have the directory X permission, the MV need WX permission, touch requires WX permission, RM needs WX permission;
9. How to redirect a string to a file with cat
The first method:
[email protected] tmp]$ cat >>1.txt
000000000000
111111111111
222222222222
Finally press CTRL + D
The second method:
Cat >>1.txt<<eof (with EOF as Terminator, can be replaced with another such as ABC)
> 000000000000
> QQQQQQQQQQQQQ
>eof (This concludes)
10, the establishment of a public directory/opt/public, requires that each user can create files and directories, but only their own and root can be deleted;
Mkdir/opt/public
chmod 1777/opt/public
This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://8802265.blog.51cto.com/8792265/1627702
Linux basic Exercises (i.)