[root@rehat root]# pwd
[root@rehat root]# cd
[root@rehat root]# cd /etc
[root@rehat root]# cd..
[root@rehat root]# cd /
[root@rehat root]# find ~
[root@rehat root]# find . -perm 644 -exec ls -l {} \;
[root@rehat root]# find / -size 0 -type f -exec ls -l {} \;
[root@rehat root]# find /var/logs -mtime +7 -type f -ok rm -i {} \;
[root@rehat root]# find / -group root -exec ls -l {} \;
[root@rehat root]# find . -name "admin.log[0-9][0-9][0-9]" -atime -7 -ok rm {} \;
[root@rehat root]# find . -type d | sort
[root@rehat root]# find /dev/rmt
[root@rehat root]# ls -a
[root@rehat root]# ls -l
[root@rehat root]# ls -Rl
[root@rehat root]# ls -tl
[root@rehat root]# ls -Sl
[root@rehat root]# ls -s -l -S
[root@rehat root]# mv -b test.txt test2/
// 这样在 test2 下将有两个文件 test.txt 及 text.txt~,其中 test.txt~ 是备份文件,test.txt是新的文件 - **若移动目标文件已存在,但不想弹出是否覆盖的提示,直接覆盖** <code> [root@rehat root]# mv -f test.txt test2/ </code> - **当源与目标都拥有同一个文件,若源文件比目标新则移动,否则不移动** <code> [root@rehat root]# mv -u test.txt test2/ </code> - **更改文件名称** <code> [root@rehat root]# mv test.txt test2.txt </code> - **更改目录名称** <code> [root@rehat root]# mv /test2 /test2_2 </code>
[root@rehat root]# umount /dev/sdb1 [root@rehat root]# mkfs -t ext3 /dev/db1 [root@rehat root]# mount /dev/sdb1 /practice
[root@rehat root]# chmod go-rwx test.txt // 或者 [root@rehat root]# chmod 700 test.txt
[root@rehat root]# chmod 700 test1.txt test2.txt
[root@rehat root]# chmod 700 -R test
[root@rehat root]# chown jim:usergroup test.txt
[root@rehat root]# chown jim:usergroup -R test
[root@rehat root]# cat -n test.txt
[root@rehat root]# cat -b test.txt
[root@rehat root]# cat test1.txt test2.txt > test_new.txt
[root@rehat root]# cat test1.txt test2.txt >> test_total.txt
[root@rehat root]# cat /dev/null > test.txt
[root@rehat root]# cat > new.txt 按 CTRL + C 结束录入
[root@rehat root]# vi newfile.txt
[root@rehat root]# vi test.txt // test.txt 已存在
:w
保存当前文档
:q
直接退出 vi
:wq
先保存后退出
[root@rehat root]# mkdir test
[root@rehat root]# mkdir -p mytest/test1/test1_1
[root@rehat root]# mkdir -m 777 testmod // 这样任何人对此目录都有任何权限
[root@rehat root]# cp ~/.bashrc bashrc_bak
[root@rehat root]# cp -f ~/.bashrc bashrc
[root@rehat root]# cp -r /root/test . [root@rehat root]# cp -r /root/test/ . // 两者效果一样,在复制目录时,会将源路径的最后一级目录全部复制过去,包括它本身。
[root@rehat root]# cp ~/.bashrc /bak/.bashrc
[root@rehat root]# cp -a ~/.bashrc /bak/.bashrc
[root@rehat root]# cp -u /src/.bashrc /bak_src/bashrc
[root@rehat root]# ln -s test.txt test.txt_slnk
[root@rehat root]# ln -l test.txt test.txt_hlnk
[root@rehat root]# rm test.txt
[root@rehat root]# rm -f test.txt
[root@rehat root]# rm -r -f test
[root@rehat root]# rmdir emptydir
[root@rehat root]# rmdir -p emptydir/d1/d11
[root@rehat root]# mount -t iso9660 /dev/cdrom /mnt/cdrom
[root@rehat root]# mount -t iso9660 -o codepage=936,iocharset=cp936 /dev/cdrom /mnt/cdrom
[root@rehat root]# mount -t vfat /dev/hda3 /mnt/cdrom
[root@rehat root]# mount -t ntfs -o iocharset=cp936 /dev/hda7 /mnt/had7
[root@rehat root]# mount -o loop /abc.iso /mnt/cdrom
[root@rehat root]# mount /dev/fd0 /mnt/floppy
[root@rehat root]# mount /dev/sda1 /mnt/cdrom
[root@rehat root]# mount -t smbfs -o username=guest,password=guest //machine/path /mnt/cdrom
[root@rehat root]# mount [root@rehat root]# cat /etc/fstab // 显示系统启动自动加载的文件系统 [root@rehat root]# cat /etc/mtab // 显示当前加载的文件系统
systemctl start firewalld.service
systemctl stop firewalld.service
systemctl restart firewalld.service
systemctl enable firewalld.service
systemctl disable firewalld.service
firewall-cmd --zone=public --add-port=80/tcp --permanent
// 说明: // –zone #作用域 // –add-port=80/tcp #添加端口,格式为:端口/通讯协议 // –permanent 永久生效,没有此参数重启后失效 - **设置防火墙多个端口永久开放**: <code> firewall-cmd --zone=public --add-port=80