您的位置:首页 > 运维架构 > Shell

Xshell如何修改字体大小和颜色

2014-07-08 13:24 651 查看

马哥20151224博客作业

1、创建一个10G的文件系统,类型为ext4,要求开机可自动挂载至单独数据/data目录;

创建分区

[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

命令(输入 m 获取帮助):n
Partition type:
p   primary (0 primary, 0 extended, 4 free)
e   extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):+10G
分区 1 已设置为 Linux 类型,大小设为 10 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xf8f3e822

设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20973567    10485760   83  Linux

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# partx -a /dev/sdb
[root@localhost ~]#


格式化为ext4文件系统

[root@localhost ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2151677952
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

编辑/etc/fstab 实现开机挂载

将/dev/sdb1 /data ext4 default 0 0

这行内容添加至末尾。

2、显示`netstat -tan`命令结果中以‘LISTEN’后跟0个、1个或者多个空白字符结尾的行;

[root@localhost ~]# netstat -tan |grep 'LISTEN.*[[:space:]]'
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 ::1:25                  :::*                    LISTEN


3、添加用户nginx、zabbix、tomcat以及hadoop用户(nologin用户的shell为/sbin/nologin);而后找出/etc/passwd文件中用户名与其shell名相同的行;

[root@localhost ~]# useradd nginx
[root@localhost ~]# useradd zabbix
[root@localhost ~]# useradd tomcat
[root@localhost ~]# useradd hadoop
[root@localhost ~]# userdel nginx
[root@localhost ~]# useradd -s /sbin/nologin  nginx[root@localhost ~]# grep '\(^[[:alnum:]]\+\>\).*\1$' /etc/passwd


4、找出/etc/rc.d/init.d/functions文件中某单词(单词中间可以存在下划线)后面跟着一组小括号的行;

[root@localhost ~]# cat /etc/rc.d/init.d/functions | grep -E -o "^[_[:alpha:]]+\(\)"


5、使用echo输出一个路径,而后egrep找出其路径基名;进一步的使用egrep取出其目录名(注意是目录名,而非目录路径);

[root@localhost ~]# echo "/etc/fstab" | grep -E -o "[^/]+?$"
fstab
[root@localhost ~]#


6、查找/usr目录下不属于root、bin或hadoop的所有文件。

[root@localhost ~]# find /usr  -not \( -user root -o -user bin -o -user hadoop \) -ls
68881497    4 drwx------   2 polkitd  root         4096 12月 13 20:45 /usr/share/polkit-1/rules.d
34736012   12 -rwsr-sr-x   1 abrt     abrt        11232 3月 24  2015 /usr/libexec/abrt-action-install-debuginfo-to-abrt-cache
[root@localhost ~]#


7、某天系统被入侵了,黑客在你系统下留下木马文件:
现需要查找当前系统上没有属主或属组,且最近一周内曾被访问过的所有文件;
另外,需要查找/etc目录下大于20k且类型为普通文件的所有文件;

[root@localhost ~]# find /  \( -nouser -o -nogroup \) -a \( -atime -10 \) -ls
find: ‘/proc/10122’: 没有那个文件或目录
find: ‘/proc/10186’: 没有那个文件或目录
find: ‘/proc/10356/task/10356/fd/6’: 没有那个文件或目录
find: ‘/proc/10356/task/10356/fdinfo/6’: 没有那个文件或目录
find: ‘/proc/10356/fd/6’: 没有那个文件或目录
find: ‘/proc/10356/fdinfo/6’: 没有那个文件或目录
104091251    0 -rw-rw----   1 1002     mail            0 12月 24 20:11 /var/spool/mail/nginx
101554257    0 drwx------   3 1002     1002           74 12月 24 20:11 /home/nginx
26615    0 drwxr-xr-x   4 1002     1002           37 12月 13 20:19 /home/nginx/.mozilla
36748934    0 drwxr-xr-x   2 1002     1002            6 6月 10  2014 /home/nginx/.mozilla/extensions
72216233    0 drwxr-xr-x   2 1002     1002            6 6月 10  2014 /home/nginx/.mozilla/plugins
[root@localhost ~]# find /etc -size +20k -type f -ls
100783049  176 -r--r--r--   1 root     root       179212 12月 13 20:22 /etc/pki/ca-trust/extracted/java/cacerts
393653  316 -r--r--r--   1 root     root       321332 12月 13 20:22 /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
33854264  236 -r--r--r--   1 root     root       240762 12月 13 20:22 /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
33854265  188 -r--r--r--   1 root     root       191741 12月 13 20:22 /etc/pki/ca-trust/extracted/pem/email-ca-bundle.pem
33854266  188 -r--r--r--   1 root     root       191772 12月 13 20:22 /etc/pki/ca-trust/extracted/pem/objsign-ca-bundle.pem
101172059   64 -rw-r--r--   1 root     root        65536 3月  6  2015 /etc/pki/nssdb/cert8.db
489474  240 -rw-r--r--   1 root     root       242153 3月  6  2015 /etc/ssh/moduli
69148059   60 -rw-r--r--   1 root     root        60408 3月  6  2015 /etc/lvm/lvm.conf
33557245  656 -rw-r--r--   1 root     root       670293 6月  7  2013 /etc/services
34556060   56 -rw-r--r--   1 root     root        56178 6月 10  2014 /etc/bash_completion.d/git
69035538   28 -rw-r--r--   1 root     root        26134 1月 15  2015 /etc/sysconfig/network-scripts/network-functions-ipv6
36486526   76 -rw-r--r--   1 root     root        77677 12月 13 20:54 /etc/ld.so.cache
70131212 6228 -r--r--r--   1 root     root      6376691 12月 13 20:36 /etc/udev/hwdb.bin
35893057   68 -rw-r--r--   1 root     root        67286 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree.xml
35893089   24 -rw-r--r--   1 root     root        22126 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-fi.xml
35780487   40 -rw-r--r--   1 root     root        38200 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-or.xml
35893058   24 -rw-r--r--   1 root     root        24055 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-lv.xml
35893086   24 -rw-r--r--   1 root     root        22120 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-zh_CN.xml
35893087   28 -rw-r--r--   1 root     root        27510 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ja.xml
35893082   24 -rw-r--r--   1 root     root        23996 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-sr@latin.xml
35893066   28 -rw-r--r--   1 root     root        26651 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ca@valencia.xml
35780486   24 -rw-r--r--   1 root     root        23549 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-sl.xml
35893061   24 -rw-r--r--   1 root     root        22150 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-tr.xml
35780495   24 -rw-r--r--   1 root     root        23432 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-he.xml
35893062   24 -rw-r--r--   1 root     root        21556 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ast.xml
35893081   32 -rw-r--r--   1 root     root        29891 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-uk.xml
35893093   28 -rw-r--r--   1 root     root        26484 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-fr.xml
35893090   24 -rw-r--r--   1 root     root        22405 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-nb.xml
35780490   32 -rw-r--r--   1 root     root        31577 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-sr.xml
35893070   28 -rw-r--r--   1 root     root        26127 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-en@shaw.xml
35765978   44 -rw-r--r--   1 root     root        41428 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-bn_IN.xml
35893074   44 -rw-r--r--   1 root     root        43112 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ml.xml
35780494   24 -rw-r--r--   1 root     root        23215 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-sv.xml
35893097   28 -rw-r--r--   1 root     root        26660 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ca.xml
35780499   36 -rw-r--r--   1 root     root        35740 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-pa.xml
35765975   24 -rw-r--r--   1 root     root        21470 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-zh_HK.xml
35780504   28 -rw-r--r--   1 root     root        25251 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-hu.xml
35893092   24 -rw-r--r--   1 root     root        21265 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ne.xml
35780491   24 -rw-r--r--   1 root     root        22385 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-zh_TW.xml
35780485   24 -rw-r--r--   1 root     root        21601 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-sk.xml
35893095   24 -rw-r--r--   1 root     root        21907 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-nl.xml
35893099   24 -rw-r--r--   1 root     root        24372 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-lt.xml
35780497   36 -rw-r--r--   1 root     root        35357 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-hi.xml
35893069   28 -rw-r--r--   1 root     root        25362 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ar.xml
35780489   24 -rw-r--r--   1 root     root        20892 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-sq.xml
35780505   28 -rw-r--r--   1 root     root        25173 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-pl.xml
35893067   40 -rw-r--r--   1 root     root        37496 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-as.xml
35780498   24 -rw-r--r--   1 root     root        21030 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-crh.xml
35780501   44 -rw-r--r--   1 root     root        41269 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ta.xml
35780482   28 -rw-r--r--   1 root     root        24970 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-dz.xml
35780503   40 -rw-r--r--   1 root     root        39952 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-te.xml
35893065   36 -rw-r--r--   1 root     root        33886 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-el.xml
35893063   24 -rw-r--r--   1 root     root        24110 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-id.xml
35780506   36 -rw-r--r--   1 root     root        33205 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-th.xml
35765974   24 -rw-r--r--   1 root     root        21768 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ka.xml
35893098   24 -rw-r--r--   1 root     root        23568 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ro.xml
35893060   24 -rw-r--r--   1 root     root        23733 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-pt.xml
35893071   28 -rw-r--r--   1 root     root        25635 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-es.xml
35765979   28 -rw-r--r--   1 root     root        25610 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-gl.xml
35747889   24 -rw-r--r--   1 root     root        22622 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-vi.xml
35893073   24 -rw-r--r--   1 root     root        23219 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-eu.xml
35765973   32 -rw-r--r--   1 root     root        32195 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ru.xml
35765981   28 -rw-r--r--   1 root     root        24935 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-cs.xml
35780483   40 -rw-r--r--   1 root     root        37404 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-gu.xml
35780480   44 -rw-r--r--   1 root     root        41945 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-kn.xml
35893072   24 -rw-r--r--   1 root     root        22353 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-et.xml
35780481   28 -rw-r--r--   1 root     root        25326 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ko.xml
35780488   24 -rw-r--r--   1 root     root        22801 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-da.xml
35780492   28 -rw-r--r--   1 root     root        25819 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-de.xml
35893064   28 -rw-r--r--   1 root     root        25094 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-pt_BR.xml
35780500   24 -rw-r--r--   1 root     root        23650 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-en_GB.xml
35893078   40 -rw-r--r--   1 root     root        37692 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-mr.xml
35893076   28 -rw-r--r--   1 root     root        25788 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-it.xml
35893077   32 -rw-r--r--   1 root     root        28735 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-ug.xml
35893084   32 -rw-r--r--   1 root     root        30289 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-bg.xml
35893088   32 -rw-r--r--   1 root     root        32617 12月 13 20:46 /etc/gconf/gconf.xml.defaults/%gconf-tree-bn.xml
2346664   52 -rw-r--r--   1 root     root        51272 6月 10  2014 /etc/gconf/schemas/nautilus-open-terminal.schemas
2969205 1364 -rw-r--r--   1 root     root      1395438 6月 10  2014 /etc/gconf/schemas/ekiga.schemas
103704864  360 -rw-r--r--   1 root     root       365229 3月  6  2015 /etc/selinux/targeted/contexts/files/file_contexts
103704871   60 -rw-r--r--   1 root     root        58064 3月  6  2015 /etc/selinux/targeted/modules/active/base.pp
103704873  360 -rw-------   1 root     root       365229 3月  6  2015 /etc/selinux/targeted/modules/active/file_contexts
103704875  368 -rw-------   1 root     root       376757 3月  6  2015 /etc/selinux/targeted/modules/active/file_contexts.template
3038067   24 -rw-r--r--   1 root     root        24383 3月  6  2015 /etc/selinux/targeted/modules/active/modules/apache.pp
3038279   28 -rw-r--r--   1 root     root        28414 3月  6  2015 /etc/selinux/targeted/modules/active/modules/init.pp
3108527   36 -rw-r--r--   1 root     root        33705 3月  6  2015 /etc/selinux/targeted/modules/active/modules/staff.pp
3108534   44 -rw-r--r--   1 root     root        44655 3月  6  2015 /etc/selinux/targeted/modules/active/modules/sysadm.pp
3108558   32 -rw-r--r--   1 root     root        29412 3月  6  2015 /etc/selinux/targeted/modules/active/modules/unprivuser.pp
3108571   28 -rw-r--r--   1 root     root        26559 3月  6  2015 /etc/selinux/targeted/modules/active/modules/virt.pp
3108585   24 -rw-r--r--   1 root     root        21063 3月  6  2015 /etc/selinux/targeted/modules/active/modules/xguest.pp
3108586   28 -rw-r--r--   1 root     root        28639 3月  6  2015 /etc/selinux/targeted/modules/active/modules/xserver.pp
36373918 3752 -rw-r--r--   1 root     root      3839718 3月  6  2015 /etc/selinux/targeted/policy/policy.29
563525   36 -rw-r--r--   1 root     root        65536 12月 13 20:25 /etc/openldap/certs/cert8.db
34555182   28 -rw-r--r--   1 root     root        25213 6月 10  2014 /etc/dnsmasq.conf
1716785   36 -rw-------   1 root     root        65536 12月 13 20:31 /etc/ipsec.d/cert8.db
35065622   52 -rw-r--r--   1 root     root        49286 3月  6  2015 /etc/brltty/fr-abrege.ctb
35065657  268 -rw-r--r--   1 root     root       273315 3月  6  2015 /etc/brltty/ko.ctb
35065601   40 -rw-r--r--   1 root     root        37790 3月  6  2015 /etc/brltty/de-kurzschrift.ctb
35065664   56 -rw-r--r--   1 root     root        54704 3月  6  2015 /etc/brltty/letters-latin.tti
35065609   24 -rw-r--r--   1 root     root        20733 3月  6  2015 /etc/brltty/en-nabcc.ttb
35065611   40 -rw-r--r--   1 root     root        39633 3月  6  2015 /etc/brltty/en-us-g2.ctb
35066461   56 -rw-r--r--   1 root     root        56542 3月  6  2015 /etc/brltty/zh-tw-polyphone.cti
35066462  392 -rw-r--r--   1 root     root       400503 3月  6  2015 /etc/brltty/zh-tw-ucb.ctb
35066463 1336 -rw-r--r--   1 root     root      1367395 3月  6  2015 /etc/brltty/zh-tw.ctb
35065335   24 -rw-r--r--   1 root     root        21929 3月  6  2015 /etc/brltty.conf
71914667   24 -rw-r--r--   1 root     root        20876 6月 10  2014 /etc/postfix/access
71914670   24 -rw-r--r--   1 root     root        21545 6月 10  2014 /etc/postfix/header_checks
71914671   28 -rw-r--r--   1 root     root        27176 6月 10  2014 /etc/postfix/main.cf
[root@localhost ~]#


8、创建目录/test/data,让某组内普通用户对其有写权限,且创建的所有文件的属组为目录所属的组;此外,每个用户仅能删除自己的文件。

[root@localhost ~]# mkdir -p /test/data
[root@localhost ~]# chmod g+s /test/data
[root@localhost ~]# chmod g+w /test/data
[root@localhost ~]# chmod o+t /test/data
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: