作业:
文件查找
1.[root@134 ~]# find $HOME -mtime +5
2.[root@134 ~]# find /etc -name "host*"
/etc/host.conf
/etc/hosts
/etc/avahi/hosts
/etc/hostname
/etc/nvme/hostnqn
/etc/nvme/hostid
3.[root@134 ~]# find /test/ -type d
[root@134 ~]# ll /test/.pki
total 0
drwxrw----. 2 redhat redhat 6 Jul 27 09:35 nssdb
4.[root@134 ~]# find /test -size +2k
/test
/test/.config/dconf/user
/test/.config/pulse
/test/.config/pulse/2268394c1f724c5cafb89ae93a67ff61-device-volumes.tdb
/test/.config/pulse/2268394c1f724c5cafb89ae93a67ff61-stream-volumes.tdb
/test/.config/pulse/2268394c1f724c5cafb89ae93a67ff61-card-database.tdb
/test/.local/share/evolution/addressbook/system/contacts.db
/test/.local/share/gvfs-metadata/home-d3158669.log
/test/.local/share/tracker/data/tracker-store.ontology.journal
/test/.local/share/tracker/data/tracker-store.journal
/test/.cache/gstreamer-1.0/registry.x86_64.bin
/test/.cache/gnome-software/appstream/components.xmlb
/test/.cache/tracker/meta.db
/test/.cache/tracker/meta.db-wal
/test/.cache/tracker/meta.db-shm
/test/.cache/tracker/ontologies.gvdb
/test/.cache/event-sound-cache.tdb.2268394c1f724c5cafb89ae93a67ff61.x86_64-redh
打包压缩:
1.[root@134 test]# mkdir test1 test2 test3
[root@134 test]# ll
total 0
drwxr-xr-x. 2 root root 6 Aug 5 07:16 test1
drwxr-xr-x. 2 root root 6 Aug 5 07:16 test2
drwxr-xr-x. 2 root root 6 Aug 5 07:16 test3
[root@134 test]# zip -r myfile.zip .
adding: test1/ (stored 0%)
adding: test2/ (stored 0%)
adding: test3/ (stored 0%)
[root@134 test]# ls myfile.zip
myfile.zip
[root@134 test]# ll
total 4
-rw-r--r--. 1 root root 442 Aug 5 07:17 myfile.zip
drwxr-xr-x. 2 root root 6 Aug 5 07:16 test1
drwxr-xr-x. 2 root root 6 Aug 5 07:16 test2
drwxr-xr-x. 2 root root 6 Aug 5 07:16 test3
[root@134 test]# ls myfile*
myfile.zip
2.[root@134 test]# unzip myfile.zip -d /opt
Archive: myfile.zip
creating: /opt/test1/
creating: /opt/test2/
creating: /opt/test3/
3.[root@134 test]# tar cvzf /test/newfile.tar.gz /opt
tar: Removing leading `/' from member names
/opt/
/opt/test1/
/opt/test2/
4.
[root@134 test]# tar tvf newfile.tar.gz
drwxr-xr-x root/root 0 2022-08-05 07:20 opt/
drwxr-xr-x root/root 0 2022-08-05 07:16 opt/test1/
drwxr-xr-x root/root 0 2022-08-05 07:16 opt/test2/
drwxr-xr-x root/root 0 2022-08-05 07:16 opt/test3/
别名
1.
[root@134 /]# echo "alias hello=echo hello everyone >>file.txt " ~/.bashrcg
alias hello=echo hello everyone >>file.txt /root/.bashrcg
[root@134 /]# hello
[root@134 /]# hello
[root@134 /]# cat file.txt
hello everyone
hello everyone
用户管理:
1.
[root@134 ~]# usermod -s /sbin/nologin sarah
[root@134 ~]# grep sarah /etc/passwd
sarah:x:1091:1091::/home/sarah:/sbin/nologin
2.
[root@134 ~]# useradd alex
[root@134 ~]# tail -1 /etc/passwd
alex:x:1092:1092::/home/alex:/bin/bash
[root@134 ~]# usermod -u 3456 -c alian alex
[root@134 ~]# tail -1 /etc/passwd
alex:x:3456:1092:alian:/home/alex:/bin/bash
[root@134 ~]# password alex
bash: password: command not found...
[root@134 ~]# passwd alex
Changing password for user alex.
New password: glegunge
Retype new password: glegunge
passwd: all authentication tokens updated successfully.