1 displays all files or directories that start with 1, end with a lowercase letter, and have at least one number in the middle of the/var directory ls-d/var/l*[0-9]*[[:lower:]] 2 displays files or directories that start with any digit in the/etc directory and end with a non-numeric ls-d/ ETC/[0-9]*[^0-9] 3 shows the/etc directory with a non-letter beginning, followed by a letter and any other arbitrary length of any character file or directory ls-d/etc/[^a-z][a-z]* 4 shows all the/etc directory with the beginning of the RC, and followed by 0-6 between the number Other files or directories of any character ls-d/etc/rc[0-6]* 5 displays all files or directories ending with. D in the/etc directory ls-d/ETC/*.D 6 shows the/etc directory, all. conf End with M,n,r,p file or directory ls-d/ Etc/[mnrp]*.conf 7 only shows hidden files and directories under/root ls-a--ignore=[^. */root ls-a-i "[^.] * "/root ls-d. */root 8 displays only non-hidden directories under/etc ls-d/etc/*/9 shows all files or directories that begin with K, end in a lowercase letter, and have at least one digit in the middle of the/etc directory ls-d/etc/k*[[:d igit :]]*[[lower]] 1 displays a file or directory with any three-digit name in the/proc directory ls-d/proc/[0-9][0-9][0-9] 2 displays a file or directory containing symbols and numbers in the/var/log directory ls-d/var/log/* [[:p unct:]]*[0-9]* 3 shows all/usr/share/man in the directory starting with M, with a number and x end of the file or directory ls-d/usr/share/man/m*[0-9]x 4 display/etc directory, all start with a capital letter, A file or directory ending with two digits ls-d/etc/[[:upper]]*[0-9][0-9] 5 shows the/etc directory with a file name that contains at least one lowercase letter and a number that ends in. conf ls-d/etc/[[:lower]]*[ 0-9]*.conf 6 shows only the non-hidden directory in the user's home directory ls-d ~/*/7 define alias command Baketc, every day to the/etc directory of all files, backup to/testdir separate subdirectories, and requires a subdirectory format of BACKUPYYYY-MM-DD, the backup process is visible alias baketc= ' mkdir-p/testdir/backup$ (date +%f); cp-av/etc/*/testdir/backup$ ( Date +%f) ' 8 Create the/testdir/rootdir directory, and copy all the files under/root to that directory, requiring the original permission 9 to convert the contents of the/etc/issue file to uppercase and save to the/tmp/issue.out file cat/etc/ Issue |TR A-Z >/tmp/issue.out TR A-Z </etc/issue >/tmp/issue.out 1 Convert the current system login user's information to uppercase and save to the/tmp/who.out file The Who | tr [A-z] [a-z] >tmp/who.out 21 Linux users to the root email, request the message titled "Help", the message body is as follows: Hello,i am Username, the system version is here,please h ELP me to check it, thanks OS version information echo-e hello,i am ' whoami ', the system version is Here,please help me to check It,than KS. " \ n "' Cat/etc/rebhat-release ' | Mail-s Help Root 3 will/root/a list of files, displayed as a line, and the file name separated by a space ls-l/root/|tr "\ n" "1 compute 1+2+3+. +99+100 the sum of echo 1+2 |BC echo {1..100} echo {1..100} |tr "" + |BC 2 processing string "Xt.,l 1 jr#hat-releasemn 2 c*/fe 3 uz 4", preserving only the Digits and Spaces echo "Xt.,l 1 ji#hat-releasemn 2 c*/fe 3 uz 4" | TR-CD [:d Igit:][:blank:] 3 Displays the PATH variable each directory on a separate line echo $PATH |tr: "\ n" 4 Create user Gentoo, additional group for bin and RoOT, default shell is/BIN/CSH, note information for "Gentoo distrbution" 5 Create the following user, group and group memberships
Group with the name Admins
User Natasha, using admins as a subordinate group
User Harry, also use admins as a subordinate group
User Sarah, not an interactive login system, and not a member of admins,
Natrsha,harry,sarah passwords are CentOS.
6 当用户xiaoming对/testdir目录无执行权限时,意味着无法做哪些操作? 7 当用户xiaoqiang对/testdir目录无读权限时,意味着无法做哪些操作? 8 当用户wangcai对/testdir目录无写权限时,该目录下的只读文件filel是否可以修改和删除? 9 当用户wangcai对/testdir目录有写和执行权限时,该目录下的只读文件filel是否可修改和删除? 1 刘备关羽张飞三个用户有一个共享目录叫shuguo,要求三人的主组不一样的情况下,三人在shuguo目录下所创建的文件 ,彼此之间可以读取及修改。但不能删除其他人创建的文件。 2 在/testdir/dir里创建的新文件自动属于g1组,组g2的成员如:alice能对这些新文件有读写权限,组g3的成员如: tom只能对新文件有读权限,其它用户(不属于g1,g2,g3)不能访问这个文件夹。 3 备份/testdir/dir里所有文件的ACL权限到/root/acl.txt中,清除/testdir/dir中所有ACL权限,最后还原ACL权限 4 利用df,取出分区利用率的最大值,只要数字。 df |tr -s " " : |cut -d: -f5 |sort -n |tail -n1 |cut -d% -f1 5 通过查看httpd的访问日志/var/log/httpd/access_log来显示出访问网站最多的来源ip列表,显示结果时显示出访问次数。 cut -d" " -f1 access_log |sort |unip -c |sort -nr
Deployment process for Web sites
[[email protected] ~]# service httpd restart
[[email protected] ~]# iptables-f
[[Email protected] ~]# cd/var/www/html/
[[email protected] html]# vim index.html
6 Digitally display permissions for/etc/passwd files
stat-c%a/etc/passwd
stat/etc/passwd |head-4 |tail-1 |tr [:p unct:]-|cut-d--f3 |cut-c 2-4
7 Find Ifconfig IPv4 address of native in "NIC name" command result
ifconfig eth0 |head-2 |tail-1 |tr-s "": |cut-d:-f4
8 Isolate the maximum percentage value of the partition space rate
9 User name, UID and shell type of user uid max. cat/etc/passed |cut-d:-f1,3,7 | SORT-T:-k2-n |tail-n 1 1 Detect/TMP permissions, digitally display 2 count the number of currently running processes in this machine, and sort PS Axo Comm PS Axo Comm from large to small | Sort-r | Unip-c |sort-nr 3 Remove Comment lines and blank lines in the configuration file (regular expressions) grep-v "^#\|^[[:blank:]]*$"/etc/httpd.conf 4 show/proc/meminf o lines starting with size s in the file (requires: use two methods) Cat/proc/meminfo |grep "^s\| S "Cat/proc/meminfo |grep-i ^s grep ^[ss]/prec/meminfo grep-e ^s-e ^s/prec/meminfo 5 Display/ ETC/PASSWD file does not end in/bin/bash line cat etc/passwd |grep-v "/bin/bash$" 6 display user RPC default shell program Grep-w "^RPC"/etc/pass WD |cut-d:-f7 7 Find out the two-bit or three-digit cat/etc/passwd in/etc/passwd | Grep-o "\<[[:d igit:]]\{2,3\}\>" 8 Add user Bash,basher,sh,nologin (its shell is/sbin/nologin), find out/etc/ passwd user name with Shell name Line CAT/ETC/PASSWD | grep "\ (^.*\) \>.*\<\1$" 9 takes advantage of DF and grep to remove disk partition utilization and sort df |grep-o "[0-9]\{1,3\}%" from large to small) | Grep-o "[0-9]\+" | SORT-NR DF |grep"^/DEV/SD" |grep-o "[[:d igit:]]\{1,3\}%" |tr-d% |sort-nr 1 shows Centos7/etc/grep2.cfg file, with at least one whitespace character beginning with a line that is followed by a non-whitespace character cat/etc/grub2.cfg | grep "^[[:space:]]\+[^[:space:]" 2 Find the result of the "Netstat-tan" command with ' LISTEN ' followed by any number of white-space characters Netstat-tan |grep "listen[[ : space:]]\+$ "3 Displays the user name and UID of all system users on Centos7 cat/etc/passwd |cut-d:-f1,3 |grep" \<[0-9]\{1,3\}\> "4 display Showing three user Root,mage,wang uid and default shell cat/etc/passwd |egrep "^ (Root|mage|wang) \>" |cut-d:-f3,7 5 Find/etc/rc.d/i A line at the beginning of the nit.d/functions file that is followed by a word (including underscores) with a parenthesis egrep "^[_[:alnum:]]+\ (\)"/etc/rc.d/init.d/functions 6 using Egrep to remove/et C/rc.d/init.d/functions its base name echo/etc/tc.d/init.d/functions |egrep-o "[^/]+$" 7 use Egrep to remove the directory name of the path above Ech o/etc/tc.d/init.d/functions | Egrep-o ". */." |egrep-o ". */" 8 count the number of logins in the last command for each host IP address login last |grep "^root\>" |egrep-o "([:d Igit:] ]{1,3}.) {3} [[:d Igit:]] {1,3} "|sort-nr |unip-c 9 uses an extended regular expression to represent 0-9,10-99,100-199,200-249,250-255 [0-9] [0-9][0-9] 1[0-9]{2} 2[0-4][0-9] 25[0-5] 1 show ifconfig command results all I PV4 Address Ifconfig | Egrep "\< ([0-9]|[ 1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]\.) {3} ([0-9]| [1-9] [0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) "-O 2 will this string: Welcome to magedu Linux Each character de-RE and sort, repeat the number of rows to the front echo welcome to magedu Linux | Grep-o. | Sort | uniq-c | SORT-NR 3 Copy the/etc/profile to/tmp/directory, use the Find replacement command to remove the blank characters from the beginning of the/tmp/profile file 4 copy the/etc/rc.d/init.d/functions file to the/tmp directory with the Find and replace command Add a # to the beginning of the line for each line of/tmp/functions that starts with a blank character # Good 5 set the tab indent to 4 characters in vim VIM/ETC/VIMRC set tab Stop=4 6 Copy the/etc/rc.d/init.d/functions file to the/tmp directory, replacing the/etc/sysconfing/init in the/tmp/functions file as/var/log:%s,/etc/syst Ionfig/init,/var/log,g 7 Deletes the # number%[email protected]^#\ ([: Space:) of all lines beginning with # in the/tmp/functions file, with at least one white space character followed by #. ]]\+.*\) @\[email protected]
Linux System Operation test questions section