1, the creation of a 10G file system, the type of EXT4, requires the boot can be automatically mounted to a separate data/data directory;
(1)FDISK/DEV/SDA
(2)command:n
(3)Command action:p (primary partition)
(4)Partition Number:2
(5)First Cylinder:default
(6)Last cylinder: +10g
(7)command:w
(8)partx-a/DEV/SDA
(9)cat/proc/partitions
(Ten)mkfs-t Ext4/dev/sda3
( One)mount/dev/sda3/data/
( A)mount-l
2, display the ' Netstat-tan ' command results with ' LISTEN ' followed by 0, one or more blank characters end of the line;
Netstat-tan | grep ' listen[[:blank:]]* '
3, add user Nginx, Zabbix, Tomcat, Nologin and Hadoop user (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;
(1)adduser nginx; adduser Zabbix; adduser Tomcat; AddUser Hadoop; adduser-s/sbin/nologin nologin
(2)grep "\<\ ([[: alnum:]]\+\>\). *\1$"/etc/passwd
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;
grep " [[: Alpha:]_]*\ (() \)"/etc/rc.d/init.d/functions
5, use echo to output a path, and then egrep find its path base name; Further use Egrep to remove its directory name (note(1)directory name, not directory path);
(1)echo/etc/rc.d/init.d | egrep-o "[^/]+/?$"
(2)echo/etc/rc.d/init.d | egrep-o "/.*/"
6. Find all files that are not root, bin or hadoop under the/usr directory;
find/usr-not-user root-a -not-user bin-a-not-user hadoop
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;
(1)Find/-nouser-a-nogroup-a-atime-7
(2)find/etc-size +20k-a-type F
8, create the directory/test/data, let a group of ordinary users have write permissions to it, and all the files created by the group is the directory belongs to the group; In addition, each user can only delete their own files.
(1)mkdir-p/test/data
(2)chmod 3755/test/data;
(3)ls-l/test = result Drwx-t-sr-t
Linux OPS Practice case-December 20, 2015-December 31 (first time)