Linux Questions and answers on operation and maintenance surface
1 , create a 10G file system, type EXT4, require the boot can be automatically mounted to a separate data/data directory;
Check your computer's existing disk and partition, command: [[email protected] ~]# DF–LH
1.1 We all know that the Linux system partitions are in the form of files, when we installed a Linux system device, the disk partition of the device may already exist, so we first want to determine the disk existing partition, under which partition has to meet our topic requirements of capacity.
View your computer's existing disks and partitions:[[email protected] ~]# DF–LH
1.2 Creating Partitions
[[Email protected]~]# fdisk/dev/sdb
Command (M for help): N
Partitiontype:
P Primary (2 primary, 0 extended, 2 free)
E Extended
Select (default p): P
PartitionNumber (3,4, default 3): 3
FirstSector (4810752-41943039, default 4810752):
Usingdefault value 4810752
Lastsector, +sectors or +size{k,m,g} (4810752-41943039, default 41943039): +10g
Partition3 of type Linux and of size ten GiB is set
Command (M for help): W
Thepartition table has been altered!
1.3 The kernel recognizes the new partition
[Email protected]~]# partx-a/dev/sdb
1.4 formatted as EXT4
[[Email protected]~]# mkfs.ext4/dev/sdb
1.5 mount the/DEV/SDB to the data directory
[[Email protected]~]# mkdir/data
[[Email protected]~]# mount/dev/sdb1/root/data
1.6 Edit the/etc/fstab file, configure the implementation to boot automatically mount add the following content
/dev/sdb1/data EXT4 Defaults 0 0
1.7 implementation does not restart to take effect and view
[[Email protected]~]# mount–a
[[Email PROTECTED]~]DF-LH
2 , display the ' netstat-tan ' command result with ' LISTEN ' followed by 0, one or more whitespace characters end of the line;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/78/DB/wKioL1aEOX_jUO6OAADJAweKUDQ284.jpg "title=" 2.JPG " alt= "Wkiol1aeox_juo6oaadjawekudq284.jpg"/>
3 , add user Nginx, Zabbix, Tomcat, Nologin, and Hadoop users (nologin user's shell is/sbin/nologin), then find out/etc/ A row in the passwd file that has the same user name as its shell name;
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/78/DD/wKiom1aEOXfzJP_uAAEtsQ4K1nk889.jpg "title=" 3.JPG " alt= "Wkiom1aeoxfzjp_uaaetsq4k1nk889.jpg"/>
4 , find a word in the/etc/rc.d/init.d/functions file (the middle of the word can be underlined) followed by a set of parentheses line;
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/78/DD/wKiom1aEPFvyas40AAGexqLAg0I577.jpg "title=" 4.JPG " alt= "Wkiom1aepfvyas40aagexqlag0i577.jpg"/>
5 , use echo to output a path, and then egrep find its path base name, and further use Egrep to remove its directory name (note that the directory name, not the directory path);
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/78/DD/wKiom1aEPHCjYMF0AABvZ5pQHt0498.jpg "title=" 5.JPG " alt= "Wkiom1aephcjymf0aabvz5pqht0498.jpg"/>
6 , look for all files that do not belong to root, bin, or Hadoop in the/usr directory;
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/78/DD/wKiom1aEPH-jsfA4AAC_tRGWKJs470.jpg "title=" 6.JPG " alt= "Wkiom1aeph-jsfa4aac_trgwkjs470.jpg"/>
7 , one day the system was invaded, hackers in your system to leave the Trojan file:
You now need to find all the files on the current system that are not owned by the master or group and have been visited in the last week;
In addition, it is necessary to find all files of more than 20k and type ordinary files in/etc directory;
7.1[[email protected] ~] #find/-nouser-o-nogroup-atime-7
7.2[[email protected] ~] #find/etc-size+20k-type F
8 , Create directory/test/data, let the normal user in a group have write permission to it, and all the files created belong to the group that the directory belongs to, in addition, each user can only delete their own files.
[Email protected]~]# groupadd Workgroup
[Email protected]~]# mkdir-p/test/data
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/78/DD/wKiom1aEPI_DuY91AADQg7Vj2fw877.jpg "title=" 8.1. JPG "alt=" Wkiom1aepi_duy91aadqg7vj2fw877.jpg "/>
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/78/DB/wKioL1aEPNDA-vbyAAKOeNvqAzI244.jpg "title=" 8.2. JPG "alt=" Wkiol1aepnda-vbyaakoenvqazi244.jpg "/>
Ps: The above solutions are performed on CentOS 7.0, which are different from other versions of the command, please search by yourself.
This article from "10914693" blog, declined reprint!
Questions and answers on Linux operation and maintenance surface